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");
}
Aggregations