spring-security java config: Como configurar várias instâncias do AuthenticationManager
Eu uso:
bota de mola: 1.1.7spring-security: 4.0.0.M2spring-fmk: 4.1.1.RELEASETudo é configurado com o Java Config (incluindo segurança de mola)
Estou trabalhando em um projeto de servidor da Web onde o cabeçalho Autenticação: básico base64Gibberish é usado para autenticar usuários.
O problema é que, dependendo do URI, oAuthenticationManager
é diferente (porque eu preciso de 2 diferentesUserDetailsService
.
Eu tentei várias extensões deWebSecurityConfigurerAdapter
com
@Override
@Bean( name = "authManager1" )
public AuthenticationManager authenticationManagerBean() throws Exception
@Override
@Bean( name = "authManager2" )
public AuthenticationManager authenticationManagerBean() throws Exception
para nenhum proveito
Eu sempre recebo:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springSecurityFilterChain'
defined in class path resource [org/springframework/security/config/annotation/web/configuration/WebSecurityConfiguration.class]: Instantiation of bean failed;
nested exception is org.springframework.beans.factory.BeanDefinitionStoreException:
Factory method [public javax.servlet.Filter org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration.springSecurityFilterChain() throws java.lang.Exception]
threw exception; nested exception is java.lang.IllegalArgumentException:
Expecting to only find a single bean for type interface org.springframework.security.authentication.AuthenticationManager,
but found [authManager1, authManager2]
Como tenho várias cadeias de filtros de segurança, como posso "informar" a segurança da mola para injetar diferentes AuthenticationManager em diferentes cadeias de filtros de segurança?
Agradecemos antecipadamente P.