use of com.sequenceiq.freeipa.ldap.LdapConfig in project cloudbreak by hortonworks.
the class LdapConfigV1ServiceTest method testPost.
@Test
public void testPost() {
// GIVEN
CreateLdapConfigRequest createLdapConfigRequest = createCreateLdapConfigRequest();
LdapConfig ldapConfig = createLdapConfig();
ArgumentCaptor<LdapConfig> ldapConfigParam = ArgumentCaptor.forClass(LdapConfig.class);
Mockito.when(stringToSecretResponseConverter.convert(SECRET_BINDDN)).thenReturn(new SecretResponse("enginepath", "binddn-secretpath"));
Mockito.when(stringToSecretResponseConverter.convert(SECRET_PWD)).thenReturn(new SecretResponse("enginepath", "pwd-secretpath"));
Mockito.when(ldapConfigService.createLdapConfig(ldapConfigParam.capture())).thenReturn(ldapConfig);
// WHEN
DescribeLdapConfigResponse actualResponse = underTest.post(createLdapConfigRequest);
// THEN
checkInnerLdapConfig(ldapConfigParam.getValue());
checkResponse(actualResponse);
}
use of com.sequenceiq.freeipa.ldap.LdapConfig in project cloudbreak by hortonworks.
the class LdapBindUserCreationHandler method doAccept.
@Override
protected Selectable doAccept(HandlerEvent<CreateLdapBindUserEvent> event) {
CreateBindUserEvent data = event.getData();
Optional<LdapConfig> ldapConfig = ldapConfigService.find(data.getEnvironmentCrn(), data.getAccountId(), data.getSuffix());
if (ldapConfig.isPresent()) {
LOGGER.info("LDAP configuration already exists: {}", ldapConfig.get());
return new CreateBindUserEvent(CreateBindUserFlowEvent.CREATE_LDAP_BIND_USER_FINISHED_EVENT.event(), data);
} else {
return createLdapBindUSer(event.getEvent(), data);
}
}
use of com.sequenceiq.freeipa.ldap.LdapConfig in project cloudbreak by hortonworks.
the class LdapConfigV1ServiceTest method testDescribe.
@Test
public void testDescribe() {
// GIVEN
LdapConfig ldapConfig = createLdapConfig();
Mockito.when(ldapConfigService.get(ENVID)).thenReturn(ldapConfig);
Mockito.when(stringToSecretResponseConverter.convert(SECRET_BINDDN)).thenReturn(new SecretResponse("enginepath", "binddn-secretpath"));
Mockito.when(stringToSecretResponseConverter.convert(SECRET_PWD)).thenReturn(new SecretResponse("enginepath", "pwd-secretpath"));
// WHEN
DescribeLdapConfigResponse actualResponse = underTest.describe(ENVID);
// THEN
checkResponse(actualResponse);
}
use of com.sequenceiq.freeipa.ldap.LdapConfig in project cloudbreak by hortonworks.
the class LdapConfigV1ServiceTest method testGetCreateRequest.
@Test
public void testGetCreateRequest() {
// GIVEN
LdapConfig ldapConfig = createLdapConfig();
Mockito.when(ldapConfigService.get(ENVID)).thenReturn(ldapConfig);
// WHEN
CreateLdapConfigRequest actualRequest = underTest.getCreateLdapConfigRequest(ENVID);
// THEN
checkCreateRequest(actualRequest);
}
use of com.sequenceiq.freeipa.ldap.LdapConfig in project cloudbreak by hortonworks.
the class LdapConfigV1ServiceTest method createLdapConfig.
private LdapConfig createLdapConfig() {
LdapConfig ldapConfig = new LdapConfig();
ldapConfig.setName(LDAPNAME);
ldapConfig.setDescription(LDAPDESC);
ldapConfig.setEnvironmentCrn(ENVID);
ldapConfig.setProtocol(LDAP_PROTOCOL);
ldapConfig.setServerHost(HOST);
ldapConfig.setServerPort(PORT);
SecretTestUtil.setSecretField(LdapConfig.class, "bindDn", ldapConfig, BINDDN, SECRET_BINDDN);
SecretTestUtil.setSecretField(LdapConfig.class, "bindPassword", ldapConfig, PWD, SECRET_PWD);
ldapConfig.setAdminGroup(ADMIN);
ldapConfig.setCertificate(CERT);
ldapConfig.setDirectoryType(DirectoryType.LDAP);
ldapConfig.setDomain(DOMAIN);
ldapConfig.setGroupMemberAttribute(MEMBER);
ldapConfig.setGroupObjectClass(GROUPOBJCLASS);
ldapConfig.setGroupSearchBase(GROUPSEARCHBASE);
ldapConfig.setGroupNameAttribute(GROUPNAMEATTR);
ldapConfig.setUserDnPattern(USERDNPATTERN);
ldapConfig.setUserNameAttribute(USERNAMEATTR);
ldapConfig.setUserObjectClass(USEROBJCLASS);
ldapConfig.setUserSearchBase(USERSEARCHBASE);
return ldapConfig;
}
Aggregations