Search in sources :

Example 1 with GroupWhiteList

use of com.emc.storageos.auth.ldap.GroupWhiteList in project coprhd-controller by CoprHD.

the class ImmutableAuthenticationProviders method createLDAPAttributeRepository.

/**
 * Create the AD/LDAP attribute repository
 *
 * @param authenticationConfiguration AD/LDAP provider configuration
 * @param servers AD/LDAP servers
 * @param returningAttributes list of attributes to return
 * @return StorageOSLdapPersonAttributeDao attribute repository for this configuration
 * @throws Exception
 */
private static StorageOSLdapPersonAttributeDao createLDAPAttributeRepository(DbClient dbclient, CoordinatorClient coordinator, final AuthnProvider authenticationConfiguration, LdapServerList servers, String[] returningAttributes) {
    GroupWhiteList groupWhiteList = createGroupWhiteList(authenticationConfiguration);
    StorageOSLdapPersonAttributeDao attributeRepository = new StorageOSLdapPersonAttributeDao();
    attributeRepository.setLdapServers(servers);
    attributeRepository.setDbClient(dbclient);
    attributeRepository.setGroupWhiteList(groupWhiteList);
    if (null != authenticationConfiguration.getMaxPageSize()) {
        attributeRepository.setMaxPageSize(authenticationConfiguration.getMaxPageSize());
    }
    SearchControls searchControls = new SearchControls();
    searchControls.setCountLimit(SEARCH_CTL_COUNT_LIMIT);
    searchControls.setTimeLimit(SystemPropertyUtil.getLdapConnectionTimeout(coordinator) * 1000);
    searchControls.setSearchScope(convertSearchScope(authenticationConfiguration.getSearchScope()));
    searchControls.setReturningAttributes(returningAttributes);
    attributeRepository.setSearchControls(searchControls);
    if (null == authenticationConfiguration.getSearchFilter()) {
        throw APIException.badRequests.failedToCreateAuthenticationHandlerSearchFilterCannotBeNull(authenticationConfiguration.getId());
    } else {
        attributeRepository.setFilter(authenticationConfiguration.getSearchFilter());
    }
    if (null == authenticationConfiguration.getSearchBase()) {
        throw APIException.badRequests.failedToCreateAuthenticationHandlerSearchBaseCannotBeNull(authenticationConfiguration.getId());
    } else {
        attributeRepository.setBaseDN(authenticationConfiguration.getSearchBase());
    }
    return attributeRepository;
}
Also used : StorageOSLdapPersonAttributeDao(com.emc.storageos.auth.ldap.StorageOSLdapPersonAttributeDao) GroupWhiteList(com.emc.storageos.auth.ldap.GroupWhiteList) SearchControls(javax.naming.directory.SearchControls)

Example 2 with GroupWhiteList

use of com.emc.storageos.auth.ldap.GroupWhiteList in project coprhd-controller by CoprHD.

the class ImmutableAuthenticationProviders method createGroupWhiteList.

/**
 * Create group whitelist
 *
 * @param authenticationConfiguration provider configuration containing the whitelist parameters
 * @return Group whitelist for this configuration
 */
private static GroupWhiteList createGroupWhiteList(final AuthnProvider authenticationConfiguration) {
    GroupWhiteList whiteList = new GroupWhiteList();
    whiteList.setType(authenticationConfiguration.getGroupAttribute() == null ? CN : authenticationConfiguration.getGroupAttribute());
    whiteList.setValues(authenticationConfiguration.getGroupWhitelistValues() != null ? authenticationConfiguration.getGroupWhitelistValues().toArray(new String[authenticationConfiguration.getGroupWhitelistValues().size()]) : new String[0]);
    return whiteList;
}
Also used : GroupWhiteList(com.emc.storageos.auth.ldap.GroupWhiteList)

Aggregations

GroupWhiteList (com.emc.storageos.auth.ldap.GroupWhiteList)2 StorageOSLdapPersonAttributeDao (com.emc.storageos.auth.ldap.StorageOSLdapPersonAttributeDao)1 SearchControls (javax.naming.directory.SearchControls)1