简体   繁体   中英

What is the correct format for SECURITY_PRINCIPAL in LDAP authentication using "com.sun.jndi.ldap.LdapCtxFactory"

env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://xxx.xxx.xxx.xx:xxx");
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, "CN=username");
env.put(Context.SECURITY_CREDENTIALS, pwd);
env.put(Context.REFERRAL,"follow"); 

I need to search only the "CN" in the particular domain. Tried with above way and many formats, but end up with the error "LDAP error code 49 AcceptSecurityContext error data 52e v2580". Please, someone help me with this.

Not sure what we are missing in your presentation of your issue.

The LDAP error code 49 AcceptSecurityContext error data 52e Returns when username is valid but password/credential is invalid.

We have several examples for JNDI Against Microsoft Active Directory .

And you should Tell us what you have tried and show logs or results and Read: https://stackoverflow.com/help/how-to-ask

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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