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);
}
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;
}
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);
}
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);
}
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;
}
Aggregations