ユーザー名がデータベースに存在するかどうかを確認し、ADに対して認証する必要があります。 usernameが存在しない場合、アプリケーションはADに対して認証しようとする代わりにエラーを返します。私は複数のADやデータベースに対して認証していますが、これを動作させるのに問題があります。ヒントがあれば助かります。ありがとうSpring Security - まずDBのユーザーを確認してからADに対して認証します。
WebSecurityConfigurerAdapter
私のクラスではauthenticationProvider
で試してみましたが、DBの存在を確認できました。しかし、認証がLDAPに進むことができるように何を返すべきかは不明です。
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth
.authenticationProvider(authenticationProvider)
.authenticationEventPublisher(authenticationEventPublisher)
.ldapAuthentication()
.....;
は}
Iはまた、追加しようとした前/後のフィルタが、そこに成功していないのいずれか()メソッドFirewalledRequestのdoFilter渡されたリクエストのインスタンスpreAuthenticationFilterフィルタにおいて
@Override
protected void configure(HttpSecurity http) throws Exception {
http
....
.and()
.addFilterBefore(preAuthenticationFilter, UsernamePasswordAuthenticationFilter.class)
;