Search in sources :

Example 1 with LdapConfig

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

the class LdapConfigRequestToLdapConfigConverterTest method testConvert.

@Test
public void testConvert() {
    // GIVEN
    // WHEN
    LdapConfig result = underTest.convert(getRequest("stack/ldap_config.json"));
    // THEN
    assertAllFieldsNotNull(result);
}
Also used : LdapConfig(com.sequenceiq.cloudbreak.domain.LdapConfig) Test(org.junit.Test)

Example 2 with LdapConfig

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

the class LdapController method testLdapConnection.

@Override
public LdapTestResult testLdapConnection(LDAPTestRequest ldapTestRequest) {
    String existingLDAPConfigName = ldapTestRequest.getName();
    LdapValidationRequest validationRequest = ldapTestRequest.getValidationRequest();
    if (existingLDAPConfigName == null && validationRequest == null) {
        throw new BadRequestException("Either an existing resource 'id' or an LDAP 'validationRequest' needs to be specified in the request. ");
    }
    LdapTestResult ldapTestResult = new LdapTestResult();
    try {
        if (existingLDAPConfigName != null) {
            LdapConfig ldapConfig = ldapConfigService.getByName(existingLDAPConfigName, authenticatedUserService.getCbUser());
            ldapConfigValidator.validateLdapConnection(ldapConfig);
        } else {
            ldapConfigValidator.validateLdapConnection(validationRequest);
        }
        ldapTestResult.setConnectionResult("connected");
    } catch (BadRequestException e) {
        ldapTestResult.setConnectionResult(e.getMessage());
    }
    return ldapTestResult;
}
Also used : LdapConfig(com.sequenceiq.cloudbreak.domain.LdapConfig) LdapValidationRequest(com.sequenceiq.cloudbreak.api.model.ldap.LdapValidationRequest) LdapTestResult(com.sequenceiq.cloudbreak.api.model.ldap.LdapTestResult)

Example 3 with LdapConfig

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

the class LdapController method getPrivates.

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

Example 4 with LdapConfig

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

the class LdapController method createConfig.

private LdapConfigResponse createConfig(IdentityUser user, LdapConfigRequest request, boolean publicInAccount) {
    LdapConfig config = conversionService.convert(request, LdapConfig.class);
    config.setPublicInAccount(publicInAccount);
    config = ldapConfigService.create(user, config);
    notify(user, ResourceEvent.LDAP_CREATED);
    return conversionService.convert(config, LdapConfigResponse.class);
}
Also used : LdapConfig(com.sequenceiq.cloudbreak.domain.LdapConfig)

Example 5 with LdapConfig

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

the class TestUtil method ldapConfig.

public static LdapConfig ldapConfig() {
    LdapConfig config = new LdapConfig();
    config.setId(1L);
    config.setName(DUMMY_NAME);
    config.setDescription(DUMMY_DESCRIPTION);
    config.setPublicInAccount(true);
    config.setUserSearchBase("cn=users,dc=example,dc=org");
    config.setGroupSearchBase("cn=groups,dc=example,dc=org");
    config.setBindDn("cn=admin,dc=example,dc=org");
    config.setBindPassword("admin");
    config.setServerHost("localhost");
    config.setUserNameAttribute("cn=admin,dc=example,dc=org");
    config.setDomain("ad.hdc.com");
    config.setServerPort(389);
    config.setProtocol("ldap");
    config.setDirectoryType(DirectoryType.ACTIVE_DIRECTORY);
    config.setUserObjectClass("person");
    config.setGroupObjectClass("groupOfNames");
    config.setGroupNameAttribute("cn");
    config.setGroupMemberAttribute("member");
    config.setAdminGroup("ambariadmins");
    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