Search in sources :

Example 1 with LdapLookupConfig

use of keywhiz.auth.ldap.LdapLookupConfig in project keywhiz by square.

the class LdapLookupConfigTest method parsesLDAPLookupCorrectly.

@Test
public void parsesLDAPLookupCorrectly() throws Exception {
    File yamlFile = new File(Resources.getResource("fixtures/keywhiz-ldap-lookup-test.yaml").getFile());
    Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
    ObjectMapper objectMapper = bootstrap.getObjectMapper().copy();
    LdapLookupConfig lookupConfig = new ConfigurationFactory<>(LdapLookupConfig.class, validator, objectMapper, "dw").build(yamlFile);
    assertThat(lookupConfig.getRequiredRoles()).containsOnly("keywhizAdmins");
    assertThat(lookupConfig.getRoleBaseDN()).isEqualTo("ou=ApplicationAccess,dc=test,dc=com");
    assertThat(lookupConfig.getUserBaseDN()).isEqualTo("ou=people,dc=test,dc=com");
    assertThat(lookupConfig.getUserAttribute()).isEqualTo("uid");
}
Also used : LdapLookupConfig(keywhiz.auth.ldap.LdapLookupConfig) File(java.io.File) Validator(javax.validation.Validator) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Test(org.junit.Test)

Aggregations

ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 File (java.io.File)1 Validator (javax.validation.Validator)1 LdapLookupConfig (keywhiz.auth.ldap.LdapLookupConfig)1 Test (org.junit.Test)1