當嘗試使用LDAP身份驗證找到使用AD身份驗證的用戶時,我在grails中遇到錯誤。這是代碼我從Grails的側面具有:LDAP身份驗證錯誤
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException {
ArrayList<String> roles=new ArrayList<String>(2);
roles.add("ROLE_USER");
try {
GldapoSchemaClassForUser.findAll(directory: "user", filter: "(userPrincipalName=${username})").each{ user ->
def userName = user.cn
user.memberOf.each{ groupListing ->
String groupName=groupListing.substring(3, groupListing.indexOf(','));
if (groupName.equals("Admin")) {
roles.add("ROLE_ADMIN");
} else if (groupName.equals("User")) {
// Do nothing
}
} catch (Throwable e) {
System.err.println(e.getMessage())
}
return new User(username)
}
它擊中catch塊,當它試圖訪問上述這一行:
GldapoSchemaClassForUser.findAll(目錄:「用戶」,過濾器: 「(的UserPrincipalName = $ {用戶名})」)
示出此錯誤消息:
org.springframework.ldap.AuthenticationException:[LDAP:錯誤代碼49 - 80090308:LdapErr:DSID-0C090334,註釋:AcceptSecurityContext錯誤,數據525,vece
根據文檔此錯誤表明,一個525錯誤意味着一個無效的用戶,但我已經使用LDAP Explorer工具進行了測試,並且使用相同的詳細信息連接到用戶。
在App-config文件中,我有以下LDAP設置:
- ldap.directories.user.url = LDAP://sbs.testsbs.local
- ldap.directories.user.base = OU =員工,DC =技能,DC =本地
- ldap.directories.user.userDn = OU =員工,DC =技能,DC =本地
- ldap.directories.user.password = Pa55w0rd
Doe任何人有任何想法,我做錯了什麼?