Search in sources :

Example 1 with AttributeResolverConfiguration

use of org.xdi.config.oxtrust.AttributeResolverConfiguration in project oxTrust by GluuFederation.

the class ConfigureNameIdAction method init.

public String init() {
    if (initialized) {
        return OxTrustConstants.RESULT_SUCCESS;
    }
    this.attributes = attributeService.getAllAttributes();
    final LdapOxTrustConfiguration conf = configurationFactory.loadConfigurationFromLdap("oxTrustConfAttributeResolver");
    if (conf == null) {
        log.error("Failed to load oxTrust configuration");
        return OxTrustConstants.RESULT_FAILURE;
    }
    this.nameIdConfigs = new ArrayList<NameIdConfig>();
    AttributeResolverConfiguration attributeResolverConfiguration = conf.getAttributeResolverConfig();
    if ((attributeResolverConfiguration != null) && (attributeResolverConfiguration.getNameIdConfigs() != null)) {
        for (NameIdConfig nameIdConfig : attributeResolverConfiguration.getNameIdConfigs()) {
            this.nameIdConfigs.add(nameIdConfig);
        }
    }
    this.initialized = true;
    return OxTrustConstants.RESULT_SUCCESS;
}
Also used : LdapOxTrustConfiguration(org.xdi.config.oxtrust.LdapOxTrustConfiguration) AttributeResolverConfiguration(org.xdi.config.oxtrust.AttributeResolverConfiguration) NameIdConfig(org.xdi.config.oxtrust.NameIdConfig)

Example 2 with AttributeResolverConfiguration

use of org.xdi.config.oxtrust.AttributeResolverConfiguration in project oxTrust by GluuFederation.

the class ConfigureNameIdAction method saveImpl.

private String saveImpl() {
    AttributeResolverConfiguration attributeResolverConfiguration = new AttributeResolverConfiguration();
    attributeResolverConfiguration.setNameIdConfigs(this.nameIdConfigs);
    try {
        final LdapOxTrustConfiguration conf = configurationFactory.loadConfigurationFromLdap();
        conf.setAttributeResolverConfig(attributeResolverConfiguration);
        conf.setRevision(conf.getRevision() + 1);
        ldapEntryManager.merge(conf);
    } catch (Exception ex) {
        log.error("Failed to save Attribute Resolver configuration configuration", ex);
        return OxTrustConstants.RESULT_FAILURE;
    }
    boolean updateShib3Configuration = applicationConfiguration.isConfigGeneration();
    if (updateShib3Configuration) {
        List<GluuSAMLTrustRelationship> trustRelationships = trustService.getAllActiveTrustRelationships();
        if (!shibboleth3ConfService.generateConfigurationFiles(trustRelationships)) {
            log.error("Failed to update Shibboleth v3 configuration");
            facesMessages.add(FacesMessage.SEVERITY_ERROR, "Failed to update Shibboleth v3 configuration");
        }
    }
    return OxTrustConstants.RESULT_SUCCESS;
}
Also used : GluuSAMLTrustRelationship(org.gluu.oxtrust.model.GluuSAMLTrustRelationship) LdapOxTrustConfiguration(org.xdi.config.oxtrust.LdapOxTrustConfiguration) AttributeResolverConfiguration(org.xdi.config.oxtrust.AttributeResolverConfiguration)

Example 3 with AttributeResolverConfiguration

use of org.xdi.config.oxtrust.AttributeResolverConfiguration in project oxTrust by GluuFederation.

the class Shibboleth3ConfService method initAttributeResolverParamMap.

public HashMap<String, Object> initAttributeResolverParamMap() {
    HashMap<String, Object> attributeResolverParams = new HashMap<String, Object>();
    List<NameIdConfig> nameIdConfigs = new ArrayList<NameIdConfig>();
    Map<String, GluuAttribute> nameIdAttributes = new HashMap<String, GluuAttribute>();
    final LdapOxTrustConfiguration conf = configurationFactory.loadConfigurationFromLdap();
    AttributeResolverConfiguration attributeResolverConfiguration = conf.getAttributeResolverConfig();
    if ((attributeResolverConfiguration != null) && (attributeResolverConfiguration.getNameIdConfigs() != null)) {
        for (NameIdConfig nameIdConfig : attributeResolverConfiguration.getNameIdConfigs()) {
            if (StringHelper.isNotEmpty(nameIdConfig.getSourceAttribute()) && nameIdConfig.isEnabled()) {
                String attributeName = nameIdConfig.getSourceAttribute();
                GluuAttribute attribute = attributeService.getAttributeByName(attributeName);
                nameIdConfigs.add(nameIdConfig);
                nameIdAttributes.put(attributeName, attribute);
            }
        }
    }
    attributeResolverParams.put("configs", nameIdConfigs);
    attributeResolverParams.put("attributes", nameIdAttributes);
    return attributeResolverParams;
}
Also used : LdapOxTrustConfiguration(org.xdi.config.oxtrust.LdapOxTrustConfiguration) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) AttributeResolverConfiguration(org.xdi.config.oxtrust.AttributeResolverConfiguration) NameIdConfig(org.xdi.config.oxtrust.NameIdConfig) GluuAttribute(org.xdi.model.GluuAttribute)

Aggregations

AttributeResolverConfiguration (org.xdi.config.oxtrust.AttributeResolverConfiguration)3 LdapOxTrustConfiguration (org.xdi.config.oxtrust.LdapOxTrustConfiguration)3 NameIdConfig (org.xdi.config.oxtrust.NameIdConfig)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 GluuSAMLTrustRelationship (org.gluu.oxtrust.model.GluuSAMLTrustRelationship)1 GluuAttribute (org.xdi.model.GluuAttribute)1