private UserEntity getUserEntityForDN(String dn) {
    Collection<UserAuthenticationEntity> authenticationEntities = getAuthenticationEntities(UserAuthenticationType.LDAP, StringUtils.lowerCase(dn));
    return ((authenticationEntities == null) || (authenticationEntities.size() != 1))
        ? null
        : authenticationEntities.iterator().next().getUser();
  }
Given a DN from the LDAP server, find the owning UserEntity.
<p>
DNs are case sensitive. Internally they are execpted to be stored as the bytes of the lowercase
string.
<p>
DN's are expected to be unique across all {@link UserAuthenticationEntity} records for type
UserAuthenticationType.LDAP.

@param dn the DN to search for
@return a {@link UserEntity}, if found
ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthenticationProvider.java