java - How to use upn instead of DN for openLdap Authentication -


i trying authenticate against openldap server java .

i tried setting ldapcontext security_principal dn , works.

    hashtable<object, object> env = new hashtable<object, object>();     env.put(context.initial_context_factory,             "com.sun.jndi.ldap.ldapctxfactory");     env.put(context.provider_url, ldaphost);     env.put(context.security_authentication, "simple");     env.put(context.security_principal, "cn=admin,ou=people,dc=maxcrc,dc=com");     env.put(context.security_credentials, password);     env.put("java.naming.ldap.attributes.binary","objectsid");      if (sslauth) {         system.setproperty("javax.net.ssl.truststore", sslkeystore);         env.put(dircontext.security_protocol, "ssl");         // system.setproperty("javax.net.debug","ssl");     }     ldapcontext ctx = new initialldapcontext(env, null);     return ctx; } 

what trying authenticate using userprincipalname,similar ad authentication,it gives invalid dn error.

    hashtable<object, object> env = new hashtable<object, object>();     env.put(context.initial_context_factory,             "com.sun.jndi.ldap.ldapctxfactory");     env.put(context.provider_url, ldaphost);     env.put(context.security_authentication, "simple");     env.put(context.security_principal, "admin@people.maxcrc.com");     env.put(context.security_credentials, password);     env.put("java.naming.ldap.attributes.binary","objectsid");      if (sslauth) {         system.setproperty("javax.net.ssl.truststore", sslkeystore);         env.put(dircontext.security_protocol, "ssl");         // system.setproperty("javax.net.debug","ssl");     }     ldapcontext ctx = new initialldapcontext(env, null);     return ctx; } 

how can configure openldap settings allow authentication using upn


Comments

Popular posts from this blog

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

Making Empty C++ Project: General exception (Exception from HRESULT:0x80131500) Visual Studio Community 2015 -

How to fix java warning for "The value of the local variable is not used " -