java - Get custom user attributes from AD in weblogic -
Has anyone described how to obtain additional user attributes from AD using Weblogic Security? I have configured the security provider and tried to get certified in my JEE application.
HTTP request (=) () callback handler handler = new simple callback handler (username, password); Try {topic subject = authentication.login (handler); ServletAuthentication.runAs (subject, request); } Hold (exception e) {e.printStackTrace (); Return "failed"; } Everything is fine. But from the topic, I can only take the user login and role, but I need a user phone and employee number. How can I do this?
Once you have withdrawn the user name from the topic / code> To obtain, you must issue an LDAP query. It will look something like the following: properties.put (reference INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); Properties.put (context.PROVIDER_URL, "LDAP: // Your Land: 38 9"); Properties.put (reference. SECURITY_PRINCIPAL, ldapqueryuser + "@ yourldap"); Properties.put (context.SECURITY_CREDENTIALS, ldapqueryuserpassword); // Start Active Directory LDAP Connection dirContext = New Initial Direct Context (Properties); These examples are very complete:
The Java Doc for InitialDirContext is here: / p>
Comments
Post a Comment