Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial security migration #5901

Closed

Conversation

jvalkeal
Copy link
Contributor

Separate dataflow and skipper configs instead of trying to "reuse" common configs. Skipper config did extend classes from comman but then override everything.

Remove unused CF configs related to tweaking things for "space developer" as this was never used.

Essentially minimal changes to get new security
configuration model working. There's still some
deprecations left to handle but it's better to
get better integration tests before those
are handled.

Separate dataflow and skipper configs instead of trying
to "reuse" common configs. Skipper config did extend
classes from comman but then override everything.

Remove unused CF configs related to tweaking things
for "space developer" as this was never used.

Essentially minimal changes to get new security
configuration model working. There's still some
deprecations left to handle but it's better to
get better integration tests before those
are handled.
@Autowired
protected AuthorizationProperties authorizationProperties;

@Autowired
protected OAuth2ResourceServerProperties oAuth2ResourceServerProperties;

@Autowired(required = false)
protected OpaqueTokenIntrospector opaqueTokenIntrospector;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be Autowired since it has an autowired setter at line 208?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I think I forget to remove this OAuthSecurityConfiguration class as DataflowOAuthSecurityConfiguration used to extend it which is not a case anymore so it became dead code.

@onobc onobc added this to the 3.0.x milestone Aug 22, 2024
Copy link
Contributor

@onobc onobc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jvalkeal for tackling this and improving it w/ the refactoring. I have a handful of comments, suggestions, and questions. Once these are addressed/answered I will probably do one more pass through - trying to keep it high level on this 1st pass. Nice work!


@Configuration(proxyBeanMethods = false)
@AutoConfigureBefore({
SecurityAutoConfiguration.class,
ManagementWebSecurityAutoConfiguration.class,
OAuth2ClientAutoConfiguration.class,
OAuth2ResourceServerAutoConfiguration.class})
@Import({IgnoreAllSecurityConfiguration.class, OAuthSecurityConfiguration.class})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It appears that CommonSecurityAutoConfiguration no longer has any purpose other than enforcing @AutoConfigureBefore. Previously, it would import OAuthSecurityConfiguration. My concern is that other modules may be expecting to get this OAuth security auto-configured when they declare a dependency on spring-cloud-common-security-config-web. One example is CTR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Looking comment in IgnoreAllSecurityConfiguration

The org.springframework.cloud.common.security.enabled=true property disables this configuration...

Gives a feeling that something got tangled and "shared" stuff didn't work as planned and yet another "enabled" option was added.

It may be better to remove this auto-config, see what breaks i.e. in ctr and then bring something back in a better form.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created #5926 to track this

Copy link
Contributor

@onobc onobc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - thanks @jvalkeal

Copy link
Contributor

@cppwfs cppwfs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed with Chris. LGTM

@cppwfs
Copy link
Contributor

cppwfs commented Oct 29, 2024

CherryPicked, Squashed Merged. Thank you @jvalkeal for the hard work this. Thank you @onobc for your work pairing with me on this!

@cppwfs cppwfs closed this Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants