Summary

If you expose more than 1 AuthenticationManager using the following (code below) in java-config and also are using @EnableGlobalMethodSecurity - there is an exception with multiple AuthenticationManager beans found.

@Bean(name="authenticationManager")
    @Override
    public AuthenticationManager authenticationManagerBean() throws Exception {
        return super.authenticationManagerBean();
    }

Actual Behavior

See code sample below.

Expected Behavior

No exceptions.

Configuration

Version

SpringSecurity 4.2.4

Sample

SpringSecurityAPIConfig.java

@Configuration
@EnableWebSecurity
@Order(98)
public class SpringSecurityAPIConfig extends WebSecurityConfigurerAdapter {
....
       @Bean(name="apiAuthenticationManager")
    @Override
    public AuthenticationManager authenticationManagerBean() throws Exception {
        return super.authenticationManagerBean();
    }
}

SpringSecurityWebConfig.java

@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(securedEnabled=true)
public class SpringSecurityWebConfig extends WebSecurityConfigurerAdapter {
....
       @Bean(name="authenticationManager")
    @Override
    public AuthenticationManager authenticationManagerBean() throws Exception {
        return super.authenticationManagerBean();
    }
}

Comment From: szlatinov

Hello, I've faced the same problem. Any solutions?

Comment From: eleftherias

I haven't been able to reproduce the issue, if someone could provide a sample I will be happy to take a look.

Comment From: spring-projects-issues

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

Comment From: spring-projects-issues

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.