private String getUserDN(Authentication authentication) {
    Object objectPrincipal = (authentication == null) ? null : authentication.getPrincipal();
    if (objectPrincipal instanceof LdapUserDetails) {
      return ((LdapUserDetails) objectPrincipal).getDn();
    }

    return null;
  }
Given the authentication object, attempt to retrieve the user's DN value from it.

@param authentication the authentication data
@return the relative DN; else <code>null</code> if not available
ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthenticationProvider.java