use of org.codice.ddf.admin.ldap.fields.connection.LdapLoadBalancingField in project admin-console-beta by connexta.
the class LdapServiceCommons method ldapLoginServiceToLdapConfiguration.
private LdapConfigurationField ldapLoginServiceToLdapConfiguration(Map<String, Object> props) {
LdapConnectionField.ListImpl connections = getLdapConnectionsField(props, LdapLoginServiceProperties.LDAP_URL, LdapLoginServiceProperties.START_TLS);
LdapLoadBalancingField loadBalancing = new LdapLoadBalancingField();
loadBalancing.setValue(mapValue(props, LdapLoginServiceProperties.LDAP_LOAD_BALANCING));
LdapBindUserInfo bindUserInfo = new LdapBindUserInfo().username(mapValue(props, LdapLoginServiceProperties.LDAP_BIND_USER_DN)).password(FLAG_PASSWORD).bindMethod(mapValue(props, LdapLoginServiceProperties.BIND_METHOD));
if (bindUserInfo.bindMethod() == LdapBindMethod.DigestMd5Sasl.DIGEST_MD5_SASL) {
bindUserInfo.realm(mapValue(props, LdapLoginServiceProperties.REALM));
}
// ldapConfiguration.bindKdcAddress((String) props.get(KDC_ADDRESS))
LdapDirectorySettingsField settings = new LdapDirectorySettingsField().loginUserAttribute(mapValue(props, LdapLoginServiceProperties.LOGIN_USER_ATTRIBUTE)).memberAttributeReferencedInGroup(mapValue(props, LdapLoginServiceProperties.MEMBERSHIP_USER_ATTRIBUTE)).groupAttributeHoldingMember(mapValue(props, LdapLoginServiceProperties.MEMBER_NAME_ATTRIBUTE)).baseUserDn(mapValue(props, LdapLoginServiceProperties.USER_BASE_DN)).baseGroupDn(mapValue(props, LdapLoginServiceProperties.GROUP_BASE_DN)).useCase(AUTHENTICATION);
return new LdapConfigurationField().connections(connections).loadBalancing(loadBalancing).bindUserInfo(bindUserInfo).settings(settings).pid(mapValue(props, SERVICE_PID_KEY));
}
use of org.codice.ddf.admin.ldap.fields.connection.LdapLoadBalancingField in project admin-console-beta by connexta.
the class LdapServiceCommons method ldapClaimsHandlerServiceToLdapConfig.
private LdapConfigurationField ldapClaimsHandlerServiceToLdapConfig(Map<String, Object> props) {
LdapConnectionField.ListImpl connections = getLdapConnectionsField(props, LdapClaimsHandlerServiceProperties.URL, LdapClaimsHandlerServiceProperties.START_TLS);
LdapLoadBalancingField loadBalancing = new LdapLoadBalancingField();
loadBalancing.setValue(mapValue(props, LdapClaimsHandlerServiceProperties.LOAD_BALANCING));
LdapBindUserInfo bindUserInfo = new LdapBindUserInfo().username(mapValue(props, LdapClaimsHandlerServiceProperties.LDAP_BIND_USER_DN)).password(FLAG_PASSWORD).bindMethod(mapValue(props, LdapClaimsHandlerServiceProperties.BIND_METHOD));
LdapDirectorySettingsField settings = new LdapDirectorySettingsField().loginUserAttribute(mapValue(props, LdapClaimsHandlerServiceProperties.LOGIN_USER_ATTRIBUTE)).baseUserDn(mapValue(props, LdapClaimsHandlerServiceProperties.USER_BASE_DN)).baseGroupDn(mapValue(props, LdapClaimsHandlerServiceProperties.GROUP_BASE_DN)).groupObjectClass(mapValue(props, LdapClaimsHandlerServiceProperties.OBJECT_CLASS)).groupAttributeHoldingMember(mapValue(props, LdapClaimsHandlerServiceProperties.MEMBER_NAME_ATTRIBUTE)).memberAttributeReferencedInGroup(mapValue(props, LdapClaimsHandlerServiceProperties.MEMBERSHIP_USER_ATTRIBUTE)).useCase(ATTRIBUTE_STORE);
Map<String, String> claimMappings = Collections.emptyMap();
String attributeMappingsPath = mapValue(props, PROPERTY_FILE_LOCATION);
if (StringUtils.isNotEmpty(attributeMappingsPath)) {
Path path = Paths.get(attributeMappingsPath).toAbsolutePath();
if (path.toFile().exists()) {
claimMappings = new HashMap<>(configuratorSuite.getPropertyActions().getProperties(path));
}
}
return new LdapConfigurationField().connections(connections).loadBalancing(loadBalancing).bindUserInfo(bindUserInfo).settings(settings).mapAllClaims(claimMappings).pid(props.get(ServiceCommons.SERVICE_PID_KEY) == null ? null : (String) props.get(ServiceCommons.SERVICE_PID_KEY));
}
Aggregations