use of org.gluu.config.oxtrust.AttributeResolverConfiguration in project oxTrust by GluuFederation.
the class ConfigureNameIdAction method init.
public String init() {
loadNameIds();
this.attributes = attributeService.getAllAttributes();
this.nameIdConfigs = new ArrayList<NameIdConfig>();
AttributeResolverConfiguration attributeResolverConfiguration = configurationFactory.getAttributeResolverConfiguration();
if ((attributeResolverConfiguration != null) && (attributeResolverConfiguration.getNameIdConfigs() != null)) {
this.usedNamedIds.clear();
for (NameIdConfig nameIdConfig : attributeResolverConfiguration.getNameIdConfigs()) {
this.nameIdConfigs.add(nameIdConfig);
this.usedNamedIds.put(nameIdConfig.getNameIdType(), nameIdConfig.getNameIdType());
}
}
return OxTrustConstants.RESULT_SUCCESS;
}
use of org.gluu.config.oxtrust.AttributeResolverConfiguration in project oxTrust by GluuFederation.
the class ConfigureNameIdAction method saveImpl.
private String saveImpl() {
AttributeResolverConfiguration attributeResolverConfiguration = new AttributeResolverConfiguration();
attributeResolverConfiguration.setNameIdConfigs(this.nameIdConfigs);
jsonConfigurationService.saveOxTrustAttributeResolverConfigurationConfiguration(attributeResolverConfiguration);
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");
} else {
try {
SSLContext sslContext = SSLContextBuilder.create().loadTrustMaterial(new TrustSelfSignedStrategy()).build();
HostnameVerifier allowAllHosts = new NoopHostnameVerifier();
SSLConnectionSocketFactory connectionFactory = new SSLConnectionSocketFactory(sslContext, allowAllHosts);
HttpClient client = HttpClients.custom().setDefaultRequestConfig(RequestConfig.custom().setCookieSpec(CookieSpecs.STANDARD).build()).setSSLSocketFactory(connectionFactory).build();
HttpGet request = new HttpGet(CloudEditionUtil.getIdpHost().orElse("https://localhost") + "/idp/profile/admin/reload-service?id=shibboleth.NameIdentifierGenerationService");
request.addHeader("User-Agent", "Mozilla/5.0");
HttpResponse response = client.execute(request);
log.info(EntityUtils.toString(response.getEntity(), "UTF-8"));
} catch (Exception e) {
log.error("error refreshing nameid setting (kindly restart services manually)", e);
return OxTrustConstants.RESULT_RESTART_IDP;
}
}
}
return OxTrustConstants.RESULT_SUCCESS;
}
use of org.gluu.config.oxtrust.AttributeResolverConfiguration in project oxTrust by GluuFederation.
the class Shibboleth3ConfService method initAttributeResolverParamMap.
public HashMap<String, Object> initAttributeResolverParamMap() {
List<NameIdConfig> nameIdConfigs = new ArrayList<NameIdConfig>();
Set<GluuAttribute> nameIdAttributes = new HashSet<GluuAttribute>();
AttributeResolverConfiguration attributeResolverConfiguration = configurationFactory.getAttributeResolverConfiguration();
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.add(attribute);
}
}
}
HashMap<String, Object> attributeResolverParams = createAttributeMap(nameIdAttributes);
attributeResolverParams.put("configs", nameIdConfigs);
attributeResolverParams.put("attributes", nameIdAttributes);
String baseUserDn = personService.getDnForPerson(null);
String persistenceType = persistenceEntryManager.getPersistenceType(baseUserDn);
log.debug(">>>>>>>>>> Shibboleth3ConfService.initAttributeResolverParamMap() - Persistance type: '{}'", persistenceType);
attributeResolverParams.put("persistenceType", persistenceType);
return attributeResolverParams;
}
Aggregations