Search in sources :

Example 11 with LdapConfig

use of com.sequenceiq.cloudbreak.domain.LdapConfig in project cloudbreak by hortonworks.

the class LdapConfigService method getByName.

public LdapConfig getByName(String name, IdentityUser user) {
    LdapConfig ldapConfig = ldapConfigRepository.findByNameInAccount(name, user.getAccount());
    if (ldapConfig == null) {
        throw new NotFoundException(String.format("LdapConfig '%s' not found", name));
    }
    authorizationService.hasReadPermission(ldapConfig);
    return ldapConfig;
}
Also used : LdapConfig(com.sequenceiq.cloudbreak.domain.LdapConfig) NotFoundException(com.sequenceiq.cloudbreak.controller.NotFoundException)

Example 12 with LdapConfig

use of com.sequenceiq.cloudbreak.domain.LdapConfig in project cloudbreak by hortonworks.

the class LdapController method getPrivate.

@Override
public LdapConfigResponse getPrivate(String name) {
    IdentityUser user = authenticatedUserService.getCbUser();
    LdapConfig config = ldapConfigService.getPrivateConfig(name, user);
    return conversionService.convert(config, LdapConfigResponse.class);
}
Also used : IdentityUser(com.sequenceiq.cloudbreak.common.model.user.IdentityUser) LdapConfig(com.sequenceiq.cloudbreak.domain.LdapConfig)

Example 13 with LdapConfig

use of com.sequenceiq.cloudbreak.domain.LdapConfig in project cloudbreak by hortonworks.

the class LdapController method getPublic.

@Override
public LdapConfigResponse getPublic(String name) {
    IdentityUser user = authenticatedUserService.getCbUser();
    LdapConfig config = ldapConfigService.getPublicConfig(name, user);
    return conversionService.convert(config, LdapConfigResponse.class);
}
Also used : IdentityUser(com.sequenceiq.cloudbreak.common.model.user.IdentityUser) LdapConfig(com.sequenceiq.cloudbreak.domain.LdapConfig)

Example 14 with LdapConfig

use of com.sequenceiq.cloudbreak.domain.LdapConfig in project cloudbreak by hortonworks.

the class LdapController method getPublics.

@Override
public Set<LdapConfigResponse> getPublics() {
    IdentityUser user = authenticatedUserService.getCbUser();
    Set<LdapConfig> configs = ldapConfigService.retrieveAccountConfigs(user);
    return toJsonSet(configs);
}
Also used : IdentityUser(com.sequenceiq.cloudbreak.common.model.user.IdentityUser) LdapConfig(com.sequenceiq.cloudbreak.domain.LdapConfig)

Example 15 with LdapConfig

use of com.sequenceiq.cloudbreak.domain.LdapConfig in project cloudbreak by hortonworks.

the class LdapConfigRequestToLdapConfigConverter method convert.

@Override
public LdapConfig convert(LdapConfigRequest json) {
    LdapConfig config = new LdapConfig();
    if (Strings.isNullOrEmpty(json.getName())) {
        config.setName(missingResourceNameGenerator.generateName(APIResourceType.LDAP_CONFIG));
    } else {
        config.setName(json.getName());
    }
    config.setDescription(json.getDescription());
    config.setBindDn(json.getBindDn());
    config.setBindPassword(json.getBindPassword());
    config.setServerHost(json.getServerHost());
    config.setServerPort(json.getServerPort());
    config.setProtocol(json.getProtocol());
    config.setGroupSearchBase(json.getGroupSearchBase());
    config.setUserSearchBase(json.getUserSearchBase());
    config.setUserNameAttribute(json.getUserNameAttribute());
    config.setDomain(json.getDomain());
    config.setDirectoryType(json.getDirectoryType() != null ? json.getDirectoryType() : DirectoryType.LDAP);
    config.setUserObjectClass(json.getUserObjectClass() != null ? json.getUserObjectClass() : "person");
    config.setGroupObjectClass(json.getGroupObjectClass() != null ? json.getGroupObjectClass() : "groupOfNames");
    config.setGroupNameAttribute(json.getGroupNameAttribute() != null ? json.getGroupNameAttribute() : "cn");
    config.setGroupMemberAttribute(json.getGroupMemberAttribute() != null ? json.getGroupMemberAttribute() : "member");
    config.setAdminGroup(json.getAdminGroup());
    return config;
}
Also used : LdapConfig(com.sequenceiq.cloudbreak.domain.LdapConfig)

Aggregations

LdapConfig (com.sequenceiq.cloudbreak.domain.LdapConfig)16 IdentityUser (com.sequenceiq.cloudbreak.common.model.user.IdentityUser)6 NotFoundException (com.sequenceiq.cloudbreak.controller.NotFoundException)3 BlueprintProcessingException (com.sequenceiq.cloudbreak.blueprint.BlueprintProcessingException)2 BlueprintView (com.sequenceiq.cloudbreak.blueprint.template.views.BlueprintView)2 FileSystemConfigurationView (com.sequenceiq.cloudbreak.blueprint.template.views.FileSystemConfigurationView)2 BlueprintStackInfo (com.sequenceiq.cloudbreak.blueprint.templates.BlueprintStackInfo)2 CloudbreakServiceException (com.sequenceiq.cloudbreak.service.CloudbreakServiceException)2 IOException (java.io.IOException)2 Test (org.junit.Test)2 LdapTestResult (com.sequenceiq.cloudbreak.api.model.ldap.LdapTestResult)1 LdapValidationRequest (com.sequenceiq.cloudbreak.api.model.ldap.LdapValidationRequest)1 HdfConfigs (com.sequenceiq.cloudbreak.blueprint.nifi.HdfConfigs)1 HostgroupView (com.sequenceiq.cloudbreak.blueprint.template.views.HostgroupView)1 GeneralClusterConfigs (com.sequenceiq.cloudbreak.blueprint.templates.GeneralClusterConfigs)1 StackRepoDetails (com.sequenceiq.cloudbreak.cloud.model.component.StackRepoDetails)1 Blueprint (com.sequenceiq.cloudbreak.domain.Blueprint)1 Cluster (com.sequenceiq.cloudbreak.domain.Cluster)1 FileSystem (com.sequenceiq.cloudbreak.domain.FileSystem)1 FlexSubscription (com.sequenceiq.cloudbreak.domain.FlexSubscription)1