title: Authenticate an Active Directory user with UnboundID using username
body: <p>I'm building an application where I need to connect to Active Directory using <code>UnboundID</code>. Using an <a href="https://code.google.com/p/ldap-sample-code/source/browse/trunk/src/main/java/samplecode/bind/SimpleBindExample.java" rel="nofollow noreferrer">example</a>, I managed to connect a user with their <code>distinguishedName</code> and <code>password</code>.</p>
  
  <p>However I would like to authenticate them using only the <code>domain</code> and the <code>username</code>, similar to how it's done in Windows. Browsing AD using a tool called <code>JXplorer</code> it seems like the <code>sAMAccountName</code> might be the property I need. However replacing the <code>distinguishedName</code> with the sAMAccountName resulted in an <code>AcceptSecurityContext</code> error. Using the <code>"uid=..."</code> syntax shown in the example also yielded the same error.</p>
  
  <p>Is there a way to logon using only the domain, <code>username</code>/<code>sAMAccountName</code> and <code>password</code>. or do I somehow need to search through AD and find the <code>distinguishedName</code> of the user I wish to authenticate, and then bind the connection using their <code>distinguishedName</code> and <code>password</code>?</p>