[英]LDAP Authentication Error
我在嘗試使用LDAP身份驗證來查找使用AD身份驗證的用戶時遇到了grails錯誤。 這是我從grails方面獲得的代碼:
@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資源管理器工具進行了測試,並且可以使用相同的詳細信息正確地連接到該用戶。
在app-config文件中,我具有以下ldap設置:
有人對我在做什么錯有任何想法嗎?
您的錯誤是在應用程序配置LDAP設置中。
ldap.directories.user.userDn設置已填充了一個容器,該容器與ldap.directories.user.base中指定的容器相同。
但這應該是執行搜索的用戶對象的DN,類似於ldap.directories.user.userDn = CN = myAppUser,OU = staff,DC = skills,DC = local
525
錯誤表示找不到用戶,但在這種情況下與登錄用戶有關,與您要搜索的用戶無關。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.