2017-02-09 70 views
0

我在Spring Security中使用了身份验证提供程序。我有两个身份验证提供程序:LocalAuthenticationProviderRemoteAuthenticationProvider。认证流程是春季安全调用另一个身份验证提供程序,即使第一个提供程序失败

  1. 应用程序检查在本地数据库
  2. 如果是本地认证通过证书,需要调用RESTful Web服务进行身份验证 凭证。
  3. 如果本地认证失败,则认为 认证失败,响应401
@Override 
protected void configure(
    AuthenticationManagerBuilder auth) throws Exception { 
    auth.authenticationProvider(localProvider).authenticationProvider(remoteProvider); 
} 

LocalAuthenticationProvider抛出AuthenticationException如果凭据失败。如果凭证是passed,则返回null

我的问题是Spring安全框架调用RemoteAuthenticationProvider甚至LocalAuthenticationProviderfailed

当我从AuthenticationManagerBuilder提供商列表中删除RemoteAuthenticationProvider,它的作品甚至LocalAuthenticationProviderfailed

我想知道如何实现这个身份验证流程。这两个提供者是相互依赖的。

回答

相关问题