public static String extractBaseDn(String dn) {
    final int indexOfFirstDelimiter = dn.indexOf(",");
    if (indexOfFirstDelimiter > -1) {
      return dn.substring(indexOfFirstDelimiter + 1);
    }
    return null;
  }
Extracts a base DN from the provided distinguished name.
<br>
<b>Example:</b>
<br>
"ou=CORP,dc=mycompany,dc=com" is the base DN for "cn=user1,ou=CORP,dc=mycompany,dc=com"

@param dn distinguished name
@return base DN
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/ldap/LdapUtils.java