title: LDAPException when trying to connect using userPrincipalName
body: <p>We made a new enhancement to the client around LDAP, to enable login using <code>userPrincipalName</code>. He was earlier using <code>sAMAccountName</code> for login. When the user tried to test the application in his test environment, he is getting the following error for <code>userPrincipalName</code>:</p>
  
  <blockquote>
    <p>netscape.ldap.LDAPException: error result (49); 80090308: LdapErr: DSID-0C0903C5, comment: AcceptSecurityContext error, data 52e, v23f0 |#]</p>
  </blockquote>
  
  <p>Which I know is because of invalid credentials of LDAP. But, when he is logging using <code>sAMAccountName</code> he is able to login. </p>
  
  <p>My web application logs shows that when he is login with <code>userPrincipalName</code>, it is found in the LDAP but when it tries to connect to LDAP with the username and password, then the above exception is thrown.</p>
  
  <p>Whereas, he is able to successfully login using <code>sAMAccountName</code>.</p>
  
  <p>The Dn's used as something like below:</p>
  
  <pre><code>OU=IS (Technical Staff),OU=PXXX,DC=pxxx,DC=local , and
  OU=Users,OU=PXXX,DC=pxxx,DC=local
  </code></pre>
  
  <p>Any help to further debug the issue would be highly appreciated.</p>
  
  <p>Please let me know in case you need further details.</p>
  
  <ul>
  <li>domain is like pxxx.local</li>
  <li>userPrincipalName is like abc.xyz@pxxx.org.uk. </li>
  </ul>
  
  <p>Do I need to make any changes for it to work?</p>