public static Name getFullDn(Name dn, Name baseDn) {

    if (dn.startsWith(baseDn)) {
      return dn;
    } else {
      try {
        //Copy the baseDN so we do not change the one that is passed in...
        baseDn = LdapUtils.newLdapName(baseDn);
        baseDn.addAll(dn);
      } catch (InvalidNameException e) {
        LOG.error(e.getMessage());
      }
      return baseDn;
    }
  }
Ensures the given distinguished name is an absolute value rather than a name relative to the context.

@param dn     a distinguished name
@param baseDn the base distinguished name
@return the absolute distinguished name
ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariLdapUtils.java