Search in sources :

Example 1 with LdapDirectorySettingsField

use of org.codice.ddf.admin.ldap.fields.config.LdapDirectorySettingsField in project admin-console-beta by connexta.

the class ITAdminSecurity method createSampleLdapConfiguration.

public LdapConfigurationField createSampleLdapConfiguration(EnumValue<String> ldapUseCase) {
    LdapConfigurationField newConfig = new LdapConfigurationField();
    CredentialsField creds = new CredentialsField().username(TEST_USERNAME).password(TEST_PASSWORD);
    LdapBindUserInfo bindUserInfo = new LdapBindUserInfo().bindMethod(SimpleEnumValue.SIMPLE).credentialsField(creds);
    LdapConnectionField connection = new LdapConnectionField().encryptionMethod(LdapEncryptionMethodField.NoEncryption.NONE).hostname("testHostName").port(666);
    LdapConnectionField.ListImpl connections = new LdapConnectionField.ListImpl();
    connections.add(connection);
    LdapDirectorySettingsField dirSettings = new LdapDirectorySettingsField().baseUserDn(TEST_DN).loginUserAttribute(TEST_ATTRIBUTE).memberAttributeReferencedInGroup(TEST_ATTRIBUTE).baseGroupDn(TEST_DN).groupAttributeHoldingMember(TEST_ATTRIBUTE).useCase(ldapUseCase.getValue());
    if (ldapUseCase.getValue().equals(LdapUseCase.ATTRIBUTE_STORE.getValue()) || ldapUseCase.getValue().equals(LdapUseCase.AUTHENTICATION_AND_ATTRIBUTE_STORE.getValue())) {
        dirSettings.groupObjectClass(TEST_ATTRIBUTE);
        newConfig.claimMappingsField(new ClaimsMapEntry.ListImpl().add(new ClaimsMapEntry().key(TEST_CLAIM_KEY).value(TEST_CLAIM_VALUE)));
    }
    return newConfig.connections(connections).bindUserInfo(bindUserInfo).settings(dirSettings);
}
Also used : ClaimsMapEntry(org.codice.ddf.admin.security.common.fields.wcpm.ClaimsMapEntry) LdapConfigurationField(org.codice.ddf.admin.ldap.fields.config.LdapConfigurationField) LdapConnectionField(org.codice.ddf.admin.ldap.fields.connection.LdapConnectionField) LdapBindUserInfo(org.codice.ddf.admin.ldap.fields.connection.LdapBindUserInfo) LdapDirectorySettingsField(org.codice.ddf.admin.ldap.fields.config.LdapDirectorySettingsField) CredentialsField(org.codice.ddf.admin.common.fields.common.CredentialsField)

Example 2 with LdapDirectorySettingsField

use of org.codice.ddf.admin.ldap.fields.config.LdapDirectorySettingsField 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));
}
Also used : LdapLoadBalancingField(org.codice.ddf.admin.ldap.fields.connection.LdapLoadBalancingField) LdapConfigurationField(org.codice.ddf.admin.ldap.fields.config.LdapConfigurationField) LdapConnectionField(org.codice.ddf.admin.ldap.fields.connection.LdapConnectionField) LdapBindUserInfo(org.codice.ddf.admin.ldap.fields.connection.LdapBindUserInfo) LdapDirectorySettingsField(org.codice.ddf.admin.ldap.fields.config.LdapDirectorySettingsField)

Example 3 with LdapDirectorySettingsField

use of org.codice.ddf.admin.ldap.fields.config.LdapDirectorySettingsField 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));
}
Also used : Path(java.nio.file.Path) LdapLoadBalancingField(org.codice.ddf.admin.ldap.fields.connection.LdapLoadBalancingField) LdapConfigurationField(org.codice.ddf.admin.ldap.fields.config.LdapConfigurationField) LdapConnectionField(org.codice.ddf.admin.ldap.fields.connection.LdapConnectionField) LdapBindUserInfo(org.codice.ddf.admin.ldap.fields.connection.LdapBindUserInfo) LdapDirectorySettingsField(org.codice.ddf.admin.ldap.fields.config.LdapDirectorySettingsField)

Aggregations

LdapConfigurationField (org.codice.ddf.admin.ldap.fields.config.LdapConfigurationField)3 LdapDirectorySettingsField (org.codice.ddf.admin.ldap.fields.config.LdapDirectorySettingsField)3 LdapBindUserInfo (org.codice.ddf.admin.ldap.fields.connection.LdapBindUserInfo)3 LdapConnectionField (org.codice.ddf.admin.ldap.fields.connection.LdapConnectionField)3 LdapLoadBalancingField (org.codice.ddf.admin.ldap.fields.connection.LdapLoadBalancingField)2 Path (java.nio.file.Path)1 CredentialsField (org.codice.ddf.admin.common.fields.common.CredentialsField)1 ClaimsMapEntry (org.codice.ddf.admin.security.common.fields.wcpm.ClaimsMapEntry)1