简体   繁体   English

如何使用受信任的域用户向活动目录进行身份验证?

[英]How to authenticate to active directory using trusted domain user?

Using Active Directory Domains and Trusts, I added the trusted domain named domainB.com for the domainA.com Using this code to authenticate to active directory, I get the error "LDAP: error code 49 - 80090308: LdapErr: DSID-0C090334, comment: AcceptSecurityContext error, data 525, vece" 使用Active Directory域和信任关系,我为domainA.com添加了一个名为domainB.com的受信任域。使用此代码对Active Directory进行身份验证,我收到错误消息“ 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

How can I authenticate to AD using the trusted domain user? 如何使用受信任的域用户向AD进行身份验证? Thank you for your help 谢谢您的帮助

error 49 usually means bad credentials. 错误49通常表示凭据错误。

Also in the last line you can use 同样在最后一行中,您可以使用

DirContext context = new InitialDirContext(env);

JNDI will do the rest. JNDI将完成其余的工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM