【问题标题】:LDAP: How to authenticate user with sAMAccountName?LDAP:如何使用 sAMAccountName 对用户进行身份验证?
【发布时间】:2012-08-23 04:06:30
【问题描述】:

当用户通过sAMAccountNamepassword 时,我无法进行身份验证。

如果我这样做:

env.put(Context.SECURITY_PRINCIPAL, "CN="+username+",OU=Service Accounts,OU=TECH,DC=wawalab2,DC=ins");
env.put(Context.SECURITY_CREDENTIALS, password);

抛出异常:

javax.naming.AuthenticationException:[LDAP:错误代码 49 - 80090308:LdapErr:DSID-0C090334,注释:AcceptSecurityContext 错误,数据 525,vece

Note: I can use Spring LDAP framework too.

【问题讨论】:

    标签: java spring ldap spring-ldap


    【解决方案1】:

    首先,525 错误是错误的 DN。您可以在此链接中查看 AD 返回的 LDAP 错误列表:AD LDAP Error codes

    所以你的 DN 不好。您要做的是搜索 samAccountName=username,从返回的值中获取 DN,并与该正确的 DN 绑定。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-02
      • 2012-07-18
      • 1970-01-01
      • 2010-10-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多