如何使用受信任域用户对Active Directory进行身份验证?

时间:2021-09-22 02:59:37

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的受信任域使用此代码对活动目录进行身份验证,我收到错误“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? Thank you for your help

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

1 个解决方案

#1


0  

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将完成剩下的工作。

#1


0  

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将完成剩下的工作。