Search in sources :

Example 1 with BaseDnConfiguration

use of org.xdi.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.setAppliance("ou=appliances,o=gluu");
    baseDn.setPeople("ou=people,o=@!1111,o=gluu");
    baseDn.setClients("ou=clients,o=@!1111,o=gluu");
    baseDn.setScopes("ou=scopes,o=@!1111,o=gluu");
    baseDn.setAttributes("ou=attributes,o=@!1111,o=gluu");
    baseDn.setSessionId("ou=session,o=@!1111,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.xdi.oxauth.model.config.StaticConfiguration) BaseDnConfiguration(org.xdi.oxauth.model.config.BaseDnConfiguration) Test(org.testng.annotations.Test)

Example 2 with BaseDnConfiguration

use of org.xdi.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 APPLIANCE:
            return baseDn.getAppliance();
        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
    try {
        // baseDn.getClients(), e.g. ou=clients,o=@!1111,o=gluu
        final DN dnObj = new DN(baseDn.getClients());
        final RDN[] rdns = dnObj.getRDNs();
        final RDN rdn = rdns[rdns.length - 1];
        return rdn.toNormalizedString();
    } catch (LDAPException e) {
        log.error(e.getMessage(), e);
    }
    log.error("Use fallback DN: o=gluu, for ID generator, please check oxAuth configuration, clientDn must be valid DN");
    return "o=gluu";
}
Also used : LDAPException(com.unboundid.ldap.sdk.LDAPException) RDN(com.unboundid.ldap.sdk.RDN) DN(com.unboundid.ldap.sdk.DN) BaseDnConfiguration(org.xdi.oxauth.model.config.BaseDnConfiguration) RDN(com.unboundid.ldap.sdk.RDN)

Aggregations

BaseDnConfiguration (org.xdi.oxauth.model.config.BaseDnConfiguration)2 DN (com.unboundid.ldap.sdk.DN)1 LDAPException (com.unboundid.ldap.sdk.LDAPException)1 RDN (com.unboundid.ldap.sdk.RDN)1 Test (org.testng.annotations.Test)1 StaticConfiguration (org.xdi.oxauth.model.config.StaticConfiguration)1