Search in sources :

Example 1 with CredentialsField

use of org.codice.ddf.admin.common.fields.common.CredentialsField 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)

Aggregations

CredentialsField (org.codice.ddf.admin.common.fields.common.CredentialsField)1 LdapConfigurationField (org.codice.ddf.admin.ldap.fields.config.LdapConfigurationField)1 LdapDirectorySettingsField (org.codice.ddf.admin.ldap.fields.config.LdapDirectorySettingsField)1 LdapBindUserInfo (org.codice.ddf.admin.ldap.fields.connection.LdapBindUserInfo)1 LdapConnectionField (org.codice.ddf.admin.ldap.fields.connection.LdapConnectionField)1 ClaimsMapEntry (org.codice.ddf.admin.security.common.fields.wcpm.ClaimsMapEntry)1