-
Notifications
You must be signed in to change notification settings - Fork 6k
Remove need for WebSecurityConfigurerAdapter #8805
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
Remove need for WebSecurityConfigurerAdapter #8805
Conversation
...rk/security/config/annotation/web/configuration/HttpSecurityConfigurationPowermockTests.java
Outdated
Show resolved
Hide resolved
...g/src/main/java/org/springframework/security/config/annotation/web/builders/WebSecurity.java
Outdated
Show resolved
Hide resolved
...g/springframework/security/config/annotation/web/configuration/WebSecurityConfiguration.java
Show resolved
Hide resolved
I also wonder if we should consider deprecating WebSecurityConfigurerAdapter and update the samples? Perhaps that is something for another issue? |
6272b3c
to
49d677c
Compare
@rwinch I created gh-8821 to update the samples. I had not thought about deprecating |
If we are going to deprecate it, I'd rather give users more time to update. The deprecation can give instructions on how to migrate (which shouldn't be too painful). We'd likely remove the support next year in 6.0, but certainly no sooner. |
49d677c
to
43e3763
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the responses. It looks good to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, though I did leave a question inline.
} | ||
|
||
private Map<Class<?>, Object> createSharedObjects() { | ||
Map<Class<?>, Object> sharedObjects = new HashMap<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are the consequences of not adding the other shared objects that WebSecurityConfigurerAdapter
adds?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding is that the WebSecurityConfigurerAdapter
adds the additional shared objects because they may be overridden within that class, for example using configure(AuthenticationManagerBuilder auth)
.
When using the SecurityFilterChain
bean, you would need to expose a UserDetailsService
bean and I confirmed that the UserDetailsService
is used even if it's not explicitly added to the shared objects here.
It was similar for the ContentNegotiationStrategy
and AuthenticationTrustResolver
.
I see the value to use the With the adapter I could simply do:
|
Closes gh-8804