【问题标题】:How to authenticate to active directory using trusted domain user?如何使用受信任的域用户对活动目录进行身份验证?
【发布时间】:2012-08-08 15:33:41
【问题描述】:

使用 Active Directory 域和信任,我为 domainA.com 添加了名为 domainB.com 的受信任域 使用此代码对活动目录进行身份验证,我收到错误“LDAP:错误代码 49 - 80090308:LdapErr:DSID-0C090334,注释:AcceptSecurityContext 错误,数据 525,vece”

Hashtable<String, String> env = new Hashtable<String, String>();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://domainA.com:389/");
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, "domainB\\userB");
env.put(Context.SECURITY_CREDENTIALS, "*******");
env.put(Context.REFERRAL, "follow");
InitialLdapContext ctx = new InitialLdapContext(env, null); //this line will cause error

如何使用受信任的域用户向 AD 进行身份验证? 谢谢你的帮助

【问题讨论】:

  • userB@domainB.com 应该可以解决问题,如果那是用户的 userPrincipalName 属性值。
  • 这个问题可能根本不是java问题,而是Active Directory域的配置问题。您应该阅读 Microsofts Doku 关于通过受信任域进行身份验证的内容。也许你会在那里找到一些线索。
  • 有了domainB\userB,我可以使用ADSIEdit获取domainA.com的连接设置,所以我不认为是配置问题。

标签: java active-directory


【解决方案1】:

错误 49 通常表示凭据错误。

也可以在最后一行使用

DirContext context = new InitialDirContext(env);

JNDI 将完成剩下的工作。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-06-30
    • 2010-09-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-06
    • 1970-01-01
    相关资源
    最近更新 更多