use of org.platformlayer.service.openldap.model.LdapDomain in project platformlayer by platformlayer.
the class OpenLdapProvider method beforeCreateItem.
@Override
public void beforeCreateItem(ItemBase item) throws OpsException {
super.beforeCreateItem(item);
// TODO: This doesn't feel like the right place for this
if (item instanceof LdapService) {
LdapService ldapService = (LdapService) item;
Passwords passwords = new Passwords();
if (Secret.isNullOrEmpty(ldapService.ldapServerPassword)) {
ldapService.ldapServerPassword = passwords.generateRandomPassword(12);
}
}
if (item instanceof LdapDomain) {
LdapDomain ldapService = (LdapDomain) item;
Passwords passwords = new Passwords();
if (Secret.isNullOrEmpty(ldapService.adminPassword)) {
ldapService.adminPassword = passwords.generateRandomPassword(12);
}
}
}
use of org.platformlayer.service.openldap.model.LdapDomain in project platformlayer by platformlayer.
the class ITOpenLdapService method testCreateAndDeleteItem.
@Test
public void testCreateAndDeleteItem() throws Exception {
OpenLdapTestHelpers openLdap = new OpenLdapTestHelpers(getContext());
LdapService ldapService = openLdap.createLdapServer();
InetSocketAddress socketAddress = getUniqueEndpoint(ldapService);
Assert.assertFalse(isPortOpen(socketAddress));
openFirewall(ldapService, LdapServiceController.PORT);
Assert.assertTrue(isPortOpen(socketAddress));
String organizationName = "test.platformlayer.org";
LdapDomain ldapDomain = openLdap.createLdapDomain(ldapService, organizationName);
// TODO: Make endpoint ldap://<ip>:<port>/ ???
String ldapUrl = "ldap://" + socketAddress.getAddress().getHostAddress() + ":" + socketAddress.getPort() + "/";
testLdap(ldapUrl, ldapDomain.adminPassword);
}
Aggregations