Search in sources :

Example 1 with LdapConfigurationField

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

the class LdapServiceCommons method ldapLoginServiceToLdapConfiguration.

public LdapConfigurationField ldapLoginServiceToLdapConfiguration(Map<String, Object> props) {
    LdapConnectionField connection = new LdapConnectionField();
    URI ldapUri = getUriFromProperty(mapStringValue(LdapLoginServiceProperties.LDAP_URL, props));
    if (ldapUri != null) {
        connection.encryptionMethod(ldapUri.getScheme()).hostname(ldapUri.getHost()).port(ldapUri.getPort());
    }
    if ((Boolean) props.get(LdapLoginServiceProperties.START_TLS)) {
        connection.encryptionMethod(LdapLoginServiceProperties.START_TLS);
    }
    LdapBindUserInfo bindUserInfo = new LdapBindUserInfo().username(mapStringValue(LdapLoginServiceProperties.LDAP_BIND_USER_DN, props)).password(mapStringValue(LdapLoginServiceProperties.LDAP_BIND_USER_PASS, props)).bindMethod(mapStringValue(LdapLoginServiceProperties.BIND_METHOD, props)).realm(mapStringValue(LdapLoginServiceProperties.REALM, props));
    //        ldapConfiguration.bindKdcAddress((String) props.get(KDC_ADDRESS));
    LdapSettingsField settings = new LdapSettingsField().usernameAttribute(mapStringValue(LdapLoginServiceProperties.USER_NAME_ATTRIBUTE, props)).baseUserDn(mapStringValue(LdapLoginServiceProperties.USER_BASE_DN, props)).baseGroupDn(mapStringValue(LdapLoginServiceProperties.GROUP_BASE_DN, props)).useCase(LOGIN);
    return new LdapConfigurationField().connection(connection).bindUserInfo(bindUserInfo).settings(settings).pid(mapStringValue(SERVICE_PID_KEY, props));
}
Also used : 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) LdapSettingsField(org.codice.ddf.admin.ldap.fields.config.LdapSettingsField) URI(java.net.URI)

Example 2 with LdapConfigurationField

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

the class LdapServiceCommons method getLdapConfigurations.

public ListField<LdapConfigurationField> getLdapConfigurations() {
    List<LdapConfigurationField> ldapLoginConfigs = new LdapLoginServiceProperties(configuratorSuite).getLdapLoginManagedServices().values().stream().map(this::ldapLoginServiceToLdapConfiguration).collect(Collectors.toList());
    List<LdapConfigurationField> ldapClaimsHandlerConfigs = new LdapClaimsHandlerServiceProperties(configuratorSuite).getLdapClaimsHandlerManagedServices().values().stream().map(this::ldapClaimsHandlerServiceToLdapConfig).collect(Collectors.toList());
    List<LdapConfigurationField> configs = Stream.concat(ldapLoginConfigs.stream(), ldapClaimsHandlerConfigs.stream()).collect(Collectors.toList());
    configs.stream().forEach(config -> config.bindUserInfoField().password(FLAG_PASSWORD));
    return new LdapConfigurationField.ListImpl().addAll(configs);
}
Also used : LdapClaimsHandlerServiceProperties(org.codice.ddf.admin.security.common.services.LdapClaimsHandlerServiceProperties) LdapConfigurationField(org.codice.ddf.admin.ldap.fields.config.LdapConfigurationField) LdapLoginServiceProperties(org.codice.ddf.admin.security.common.services.LdapLoginServiceProperties)

Example 3 with LdapConfigurationField

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

the class ITAdminSecurity method saveLdapAttributeStoreConfig.

@Test
public void saveLdapAttributeStoreConfig() throws IOException {
    try {
        LdapConfigurationField newConfig = createSampleLdapConfiguration(LdapUseCase.ATTRIBUTE_STORE);
        LDAP_REQUEST_HELPER.createLdapConfig(newConfig);
        LDAP_REQUEST_HELPER.waitForConfigs(Collections.singletonList(newConfig.getValue()), true);
    } finally {
        LDAP_REQUEST_HELPER.resetLdapConfigs();
    }
}
Also used : LdapConfigurationField(org.codice.ddf.admin.ldap.fields.config.LdapConfigurationField) Test(org.junit.Test)

Example 4 with LdapConfigurationField

use of org.codice.ddf.admin.ldap.fields.config.LdapConfigurationField 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 5 with LdapConfigurationField

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

the class LdapServiceCommons method getLdapConfigurations.

public ListField<LdapConfigurationField> getLdapConfigurations(ConfiguratorFactory configuratorFactory) {
    List<LdapConfigurationField> ldapLoginConfigs = new LdapClaimsHandlerServiceProperties(configuratorFactory).getLdapClaimsHandlerManagedServices().values().stream().map(this::ldapLoginServiceToLdapConfiguration).collect(Collectors.toList());
    List<LdapConfigurationField> ldapClaimsHandlerConfigs = new LdapClaimsHandlerServiceProperties(configuratorFactory).getLdapClaimsHandlerManagedServices().values().stream().map(this::ldapClaimsHandlerServiceToLdapConfig).collect(Collectors.toList());
    List<LdapConfigurationField> configs = Stream.concat(ldapLoginConfigs.stream(), ldapClaimsHandlerConfigs.stream()).collect(Collectors.toList());
    configs.stream().forEach(config -> config.bindUserInfoField().password("*******"));
    return new ListFieldImpl<>(LdapConfigurationField.class).addAll(configs);
}
Also used : LdapClaimsHandlerServiceProperties(org.codice.ddf.admin.security.common.services.LdapClaimsHandlerServiceProperties) LdapConfigurationField(org.codice.ddf.admin.ldap.fields.config.LdapConfigurationField)

Aggregations

LdapConfigurationField (org.codice.ddf.admin.ldap.fields.config.LdapConfigurationField)10 LdapBindUserInfo (org.codice.ddf.admin.ldap.fields.connection.LdapBindUserInfo)5 LdapConnectionField (org.codice.ddf.admin.ldap.fields.connection.LdapConnectionField)5 LdapDirectorySettingsField (org.codice.ddf.admin.ldap.fields.config.LdapDirectorySettingsField)3 Test (org.junit.Test)3 URI (java.net.URI)2 LdapSettingsField (org.codice.ddf.admin.ldap.fields.config.LdapSettingsField)2 LdapLoadBalancingField (org.codice.ddf.admin.ldap.fields.connection.LdapLoadBalancingField)2 LdapClaimsHandlerServiceProperties (org.codice.ddf.admin.security.common.services.LdapClaimsHandlerServiceProperties)2 Path (java.nio.file.Path)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 CredentialsField (org.codice.ddf.admin.common.fields.common.CredentialsField)1 ClaimsMapEntry (org.codice.ddf.admin.security.common.fields.wcpm.ClaimsMapEntry)1 LdapLoginServiceProperties (org.codice.ddf.admin.security.common.services.LdapLoginServiceProperties)1