私のWebアプリケーションのユーザをLDAPおよびその他のカスタム認証で認証する必要があります。これはKotlinで書かれたSpring Bootアプリケーションです。 CustomAuthenticationProviderの認証が成功した場合(機能認証がスローされません)ように、認証はLDAP認証プロバイダを使用し続けてチェーンに私が欲しいSpring Security複数の認証プロバイダが成功しました
@Autowired
lateinit var authenticationProvider: CustomAuthenticationProvider
override fun configure(auth: AuthenticationManagerBuilder) {
auth
.authenticationProvider(authenticationProvider)
auth
.ldapAuthentication()
.userDnPatterns("uid={0},ou=people")
.groupSearchBase("ou=groups")
.contextSource()
.url("ldap://localhost:8389/dc=example,dc=com")
.and()
.passwordCompare()
.passwordEncoder(PlaintextPasswordEncoder())
.passwordAttribute("userPassword")
}
認証を次のように私はAuthenticationManagerBuilderを設定しています。
CustomAuthenticationProviderが正常に認証された場合、LDAP認証(およびその後の認証プロバイダ)は評価されません。 CustomAuthenticationProviderがスローする場合のみ、LDAP認証が実行されます。
私は複数の認証プロバイダを持っているが、AND動作ではなくOR動作をしていることを詳述している記事(例:Multiple Authentication Providers in Spring Security)を読んでいます。助言がありますか?
どうすればよいですか?認証プロバイダが認証を公開している場合、LDAP認証はなぜ認証されているのですか?すでに認証されています。唯一の方法は、認証プロバイダが認証を公開しないことです。あなたはまだ認証されていません。 – dur