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