0
私は、カスタムログインページを使用してLDAP認証を行うにしようとしていますが、そのは、以下の動作していない私のセキュリティおよびLDAP設定の下春ブーツセキュリティLDAP認証
@Configuration
@EnableWebSecurity
@Order(SecurityProperties.ACCESS_OVERRIDE_ORDER)
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.httpBasic().and().authorizeRequests().antMatchers("/**").permitAll()
.anyRequest().authenticated()
.and().formLogin().loginPage("/login")
.usernameParameter("username")
.passwordParameter("password")
.failureUrl("/login?error");
}
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth
.ldapAuthentication()
.userDnPatterns("uid={0},ou=people")
.groupSearchBase("ou=groups")
.contextSource().ldif("classpath:test-server.ldif");
}
}
は、リソースフォルダ
に配置されたサンプルLDIFファイルですDNます。uid =ボブ、OU =人、DC = springframework、DC = orgの オブジェクトクラス:トップ オブジェクトクラス:人 オブジェクトクラス:organizationalPersonを オブジェクトクラス:inetOrgPersonの CN:ボブ・ハミルトン SN :Hamilton uid:bob userPassword:bobspassword
私は有効なユーザーのみがアプリケーションの他のページにアクセスできるようにしています。
設定に問題がありますか、あなたの回答に感謝します。