LDAP/AD: How to get username or user with samaccountname?

344 Views Asked by At

I started to use the unboundid SDK to connect and work with LDAP/AD. With the WhoAmIExtendedRequest i can get the samaccountname. But who can i get the user and the full username? Is there an other request or a DN? Thanks

1

There are 1 best solutions below

0
kqarryzada On

When a result (i.e., a WhoAmIExtendedResult) is obtained from Active Directory, you should be able to use the WhoAmIExtendedResult.getAuthorizationID() method to obtain the DN of the authenticated user. An example is described in the Javadoc for the class, but the authorization ID returned by the AD server could take one of the following forms:

  • dn: uid=username,ou=clients,dc=example,dc=com
  • u: uid=username
  • The empty string or just "dn:", indicating an anonymous bind.