Search in sources :

Example 1 with BaseDnConfiguration

use of org.gluu.oxauth.model.config.BaseDnConfiguration in project oxAuth by GluuFederation.

the class ConfSerialization method claims.

@Test
public void claims() throws IOException {
    final BaseDnConfiguration baseDn = new BaseDnConfiguration();
    baseDn.setConfiguration("ou=configuration,o=gluu");
    baseDn.setPeople("ou=people,o=gluu");
    baseDn.setClients("ou=clients,o=gluu");
    baseDn.setScopes("ou=scopes,o=gluu");
    baseDn.setAttributes("ou=attributes,o=gluu");
    final StaticConfiguration c = new StaticConfiguration();
    c.setBaseDn(baseDn);
    final String jsonStr = ServerUtil.createJsonMapper().writeValueAsString(c);
    System.out.println(jsonStr);
}
Also used : StaticConfiguration(org.gluu.oxauth.model.config.StaticConfiguration) BaseDnConfiguration(org.gluu.oxauth.model.config.BaseDnConfiguration) Test(org.testng.annotations.Test)

Example 2 with BaseDnConfiguration

use of org.gluu.oxauth.model.config.BaseDnConfiguration in project oxAuth by GluuFederation.

the class InumGenerator method baseDn.

public String baseDn(IdType p_type) {
    final BaseDnConfiguration baseDn = staticConfiguration.getBaseDn();
    switch(p_type) {
        case CLIENTS:
            return baseDn.getClients();
        case CONFIGURATION:
            return baseDn.getConfiguration();
        case ATTRIBUTE:
            return baseDn.getAttributes();
        case PEOPLE:
            return baseDn.getPeople();
    }
    // if not able to identify baseDn by type then return organization baseDn, e.g. o=gluu
    Matcher m = baseRdnPattern.matcher(baseDn.getClients());
    if (m.matches()) {
        return m.group(1);
    }
    log.error("Use fallback DN: o=gluu, for ID generator, please check oxAuth configuration, clientDn must be valid DN");
    return "o=gluu";
}
Also used : Matcher(java.util.regex.Matcher) BaseDnConfiguration(org.gluu.oxauth.model.config.BaseDnConfiguration)

Aggregations

BaseDnConfiguration (org.gluu.oxauth.model.config.BaseDnConfiguration)2 Matcher (java.util.regex.Matcher)1 StaticConfiguration (org.gluu.oxauth.model.config.StaticConfiguration)1 Test (org.testng.annotations.Test)1