我正在将SAML2与我的现有应用程序集成在一起,该应用程序已经使用带有CustomAuthenticationProvider的数据库来使用登录名。当我添加SAML登录名时,应用程序的数据库登录名不起作用。我认为.antMatchers("/api/authenticate").permitAll()
不起作用。如果删除SAML配置,则数据库登录正常。这是配置:MultiHttpSecurityConfig,CustomAuthenticationProvider
在上述配置中,仅SAML登录有效,而DB登录无效。
@EnableWebSecurity
@Configuration
@Order(1)
public class SamlAuthConfig extends WebSecurityConfigurerAdapter {
@Autowired
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.authenticationProvider(customAuthenticationProvider).authenticationProvider(samlAuthenticationProvider());
}
}
此link帮助我解决了这个问题。