@Override
  public Set<String> checkGroupAttributes(String userDn, AmbariLdapConfiguration ambariLdapConfiguration) throws AmbariLdapException {
    List<String> groups;
    try {
      LOGGER.info("Checking group attributes for user dn: [{}] ...", userDn);

      // set up a filter based on the provided attributes
      String filter = FilterBuilder.and(
        FilterBuilder.equal(SchemaConstants.OBJECT_CLASS_AT, ambariLdapConfiguration.groupObjectClass()),
        FilterBuilder.equal(ambariLdapConfiguration.groupMemberAttribute(), userDn)
      ).toString();

      LOGGER.info("Searching for the groups the user dn: [{}] is member of using the search filter: [{}]", userDn, filter);
      LdapConnectionTemplate ldapConnectionTemplate = ldapConnectionTemplateFactory.create(ambariLdapConfiguration);

      // assemble a search request
      SearchRequest searchRequest = ldapConnectionTemplate.newSearchRequest(new Dn(ambariLdapConfiguration.groupSearchBase()), filter, SearchScope.SUBTREE);
      // attributes to be returned
      searchRequest.addAttributes(ambariLdapConfiguration.groupMemberAttribute(), ambariLdapConfiguration.groupNameAttribute());

      // perform the search
      groups = ldapConnectionTemplate.search(searchRequest, getGroupNameEntryMapper(ambariLdapConfiguration));

      if (groups == null || groups.isEmpty()) {
        LOGGER.info("No groups found for the user dn. Group attributes configuration is incomplete");
        throw new AmbariLdapException("Group attribute ldap configuration is incomplete");
      }

      LOGGER.info("Group attribute configuration check succeeded.");

    } catch (Exception e) {

      LOGGER.error("User attributes validation failed.", e);
      throw new AmbariLdapException(e.getMessage(), e);

    }

    return new HashSet<>(groups);
  }
Checks whether the provided group related settings are correct.

@param userDn                  a user DN to check
@param ambariLdapConfiguration the available LDAP configuration to be validated
@return
@throws AmbariLdapException
ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapConfigurationService.java