AuthenticationManager bean is missing when upgraded to Spring Boot 2.0.0.M6
See original GitHub issueToday I have upgraded one of my sample from Spring Boot 2.0.0.M4 to 2.0.0.M6.
https://github.com/hantsy/spring-microservice-sample
When starting up auth-service, it complains AuthentionManager
bean is not existed in my AuthenticationController
, I have to expose it manually in my security config.
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
return super.authenticationManagerBean();
}
Is there something changed in Spring Boot 2.0.0.M6?
Issue Analytics
- State:
- Created 6 years ago
- Comments:16 (4 by maintainers)
Top Results From Across the Web
Spring Boot Reference Guide
This section provides a brief overview of Spring Boot reference documentation. Think of it as map for the rest of the document. You...
Read more >FileNotFoundException: class path resource ... - Stack Overflow
It was a cause for an error. I wanted to upgrade project to Spring Boot 2. Then it appears that Activity 6 do...
Read more >spring-projects/spring-boot - Gitter
The tutorial I was reading isnt' complete sadly and missing important parts and ... M6, it's working, I got a 200 and my...
Read more >Using WebClient for Spring Boot integration testing-Springboot
You can get full access to the WebTestClient result: webTestClient.post() .uri("/api/authenticate") .contentType(MediaType.APPLICATION_JSON) .
Read more >2.0.0-M3 - Apache Isis
A new convenience parent pom builds on top of Spring Boot's similar parent pom, to make it easy to ... ISIS-2263 - Update...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
AuthenticationManager
bean is required forpassword
grant type in Spring Security OAuth2. The whole design ofAuthorizationServerConfigurer
+ResourceServerConfigurer
assumes that you never useWebSecurityConfigurerAdapter
in oauth2-based app. However now the only way to get theAuthenticationManager
seems to be this:This is really confusing, because now, along with
ResourceServerConfigurer
, you have two beans exposingconfigure(HttpSecurity http)
. Which one should I use, then? They are not compatible.This is the most obscure thing I’ve met so far in Spring Security OAuth2 and this is purely caused by not exposing
AuthenticationManager
automatically.@l0co Yes,
AuthenticationManager
is required for thepassword
grant type in Spring Security OAuth2. It’s required as a constructor arg inResourceOwnerPasswordTokenGranter
.This is not correct. You still need to configure your user’s either by providing an
AuthenticationManager
ORAuthenticationProvider
OR configuring viaAuthenticationManagerBuilder
. This needs to happen in yourWebSecurityConfigurerAdapter
. Spring Security OAuth2 simply uses theAuthenticationManager
that is configured by yourWebSecurityConfigurerAdapter
.Yes, you do need to expose the
AuthenticationManager
as a@Bean
via theauthenticationManagerBean()
override. However, I don’t see this being an overhead. It’s one simple override.I think you meant to say
AuthorizationServerConfigurer
instead ofResourceServerConfigurer
? TheAuthorizationServerConfigurer
needs to be wired with theAuthenticationManager
in order to validate the user during thepassword
grant flow. An example configuration would be:@l0co Does this clarify things?