Spring MVCアプリケーションでLDAP認証用のSpring Securityを設定しようとしています。私はLdapAuthenticationProviderで動作するシンプル/プリンシパル認証を得ることができないので、ActiveDirectoryLdapAuthenticationProviderを使用しようとしています。これはデフォルトで行います。Spring Security LDAPでActiveDirectoryを使用する方法
コンテキストを作成した後、私は、この行(ActiveDirectoryLdapAuthenticationProvider.java 310)から、(と私はLDAPバインドが発生していると思います)detailMessageでNameNotFoundExceptionが出ます:
return SpringSecurityLdapTemplate.searchForSingleEntryInternal(context,
searchControls, searchRoot, searchFilter,
new Object[] { bindPrincipal });
エラーメッセージ:
を[LDAP: error code 32 - 0000208D: NameErr: DSID-03100213, problem 2001 (NO_OBJECT), data 0, best match of:
'DC=my,DC=company,DC=com']
検索フィルタは、私が認証したユーザ名と等しいuserPrincipalNameを持つクラス "user"を持つオブジェクトを探していて、自分のドメインのドメイン名と連結しています。たとえば、「[email protected]」と入力します。その値を持つ属性が存在します。このメソッドでJXplorerを使用して認証した後、その検索を実行してユーザーオブジェクトを検索します。
AuthenticationManagerBuilderでIワイヤー私WebSecurityConfigurerAdapterサブクラスのための構成は、基本的にはこれです:
@Autowired
public void init(AuthenticationManagerBuilder auth) throws Exception {
ActiveDirectoryLdapAuthenticationProvider provider =
new ActiveDirectoryLdapAuthenticationProvider("my.company.com", "LDAPS://ad.my.company.com:636/dc=my,dc=company,dc=com");
provider.setConvertSubErrorCodesToExceptions(true);
auth.authenticationProvider(provider);
}
て、NameNotFoundExceptionを引き起こしていますか?これはActiveDirectory認証を設定する正しい方法ですか?