I feel bad with the new Java security configuration, but here is what I see from the source code:
@Import(AuthenticationConfiguration.class)
public @interface EnableGlobalAuthentication {}
This annotation imports AuthenticationConfiguration, which is also @Configuration. Any is @Configurationalso registered as a bean. So you can do this from WebSecurityConfigurerAdapter:
@Autowired
public void setAuthenticationConfiguration(AuthenticationConfiguration authenticationConfiguration) {
this.authenticationConfiguration = authenticationConfiguration;
}
And get access to AuthenticationManager:
this.authenticationConfiguration.getAuthenticationManager();
xml SpEL AuthenticationManager:
<property name="authenticationManager" value="#{authenticationConfiguration.authenticationManager}" />
, , AuthenticationManager bean. .
UPDATE
, @Autowired AuthenticationManager - , @Value resque:
@Value("#{authenticationConfiguration.authenticationManager}")
private AuthenticationManager authenticationManager;
UPDATE2
WebSecurityConfigurerAdapter. JavaDocs:
public AuthenticationManager authenticationManagerBean() throws Exception {
return new AuthenticationManagerDelegator(authenticationBuilder);
}
Update3
AuthenticationManager WebSecurityConfigurerAdapter SAMLWebSSOHoKProcessingFilter?
@Configuration
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Bean
public SAMLWebSSOHoKProcessingFilter samlFilter() {
SAMLWebSSOHoKProcessingFilter samlFilter = new SAMLWebSSOHoKProcessingFilter();
samlFilter.setAuthenticationManage(authenticationManager());
.......
return samlFilter;
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.addFilter(samlFilter());
}
}