Grails 弹簧安全 grails.plugins.springsecurity.providerNames

dun*_*ess 1 grails spring-security

假设我想对同一个登录请求使用两个身份验证提供程序。

grails.plugins.springsecurity.providerNames = [
    'customAuthenticationProvider',
    'ldapAuthProvider',
    'anonymousAuthenticationProvider',
    'rememberMeAuthenticationProvider']
Run Code Online (Sandbox Code Playgroud)

这种情况是我首先通过我的 customAuthenticationProvider 进行身份验证,它授予/拒绝访问权限。完成此操作后,它会继续检查是否能够向 LDAP 服务器验证用户身份,而后者又会授予/拒绝。

这是 Spring Security 的运行方式,例如上面的 providerNames 列表吗?或者,如果第一个提供者访问/拒绝并相应地采取行动,它会授予访问权限。

是否需要通过所有身份验证尝试才能获得访问权限?

Gre*_*eek 5

提供者将按照列出的顺序进行尝试,直到一个身份验证成功,否则他们都失败了。当一个身份验证时,该过程停止,并且不会尝试其余的提供者。