use of org.gluu.oxtrust.model.GluuSAMLTrustRelationship in project oxTrust by GluuFederation.
the class UpdateTrustRelationshipAction method saveTR.
private void saveTR(boolean isUpdate) {
log.trace("Saving Trust Relationship");
if (isUpdate) {
String oldLogoutRedirectUri = trustService.getRelationshipByDn(trustRelationship.getDn()).getSpLogoutURL();
String newLogoutRedirectUri = trustRelationship.getSpLogoutURL();
boolean oxClientUpdateNeeded = !newLogoutRedirectUri.equals(oldLogoutRedirectUri);
boolean parentInactive = trustRelationship.getStatus().equals(GluuStatus.INACTIVE);
if (!federatedSites.isEmpty()) {
for (GluuSAMLTrustRelationship trust : federatedSites) {
if (parentInactive) {
trust.setStatus(GluuStatus.INACTIVE);
}
trustService.updateReleasedAttributes(trust);
trustService.updateTrustRelationship(trust);
svnSyncTimer.updateTrustRelationship(trust, identity.getCredentials().getUsername());
}
}
trustService.updateTrustRelationship(this.trustRelationship);
if (oxClientUpdateNeeded) {
OxAuthClient client = clientService.getClientByInum(appConfiguration.getOxAuthClientId());
Set<String> updatedLogoutRedirectUris = new HashSet<String>();
List<GluuSAMLTrustRelationship> trs = trustService.getAllTrustRelationships();
if (trs != null && !trs.isEmpty()) {
for (GluuSAMLTrustRelationship tr : trs) {
String logoutRedirectUri = tr.getSpLogoutURL();
if (logoutRedirectUri != null && !logoutRedirectUri.isEmpty()) {
updatedLogoutRedirectUris.add(logoutRedirectUri);
}
}
}
if (updatedLogoutRedirectUris.isEmpty()) {
client.setPostLogoutRedirectUris(null);
} else {
client.setPostLogoutRedirectUris(updatedLogoutRedirectUris.toArray(new String[0]));
}
clientService.updateClient(client);
}
svnSyncTimer.updateTrustRelationship(this.trustRelationship, identity.getCredentials().getUsername());
} else {
trustService.addTrustRelationship(this.trustRelationship);
svnSyncTimer.addTrustRelationship(this.trustRelationship, identity.getCredentials().getUsername());
}
}
use of org.gluu.oxtrust.model.GluuSAMLTrustRelationship in project oxTrust by GluuFederation.
the class UpdateTrustRelationshipAction method initFederatedSites.
private void initFederatedSites(GluuSAMLTrustRelationship trustRelationship) {
List<GluuAttribute> attributes = getAllAttributes();
this.federatedSites = new ArrayList<GluuSAMLTrustRelationship>();
for (GluuSAMLTrustRelationship deconstructedTrustRelationship : trustService.getDeconstructedTrustRelationships(trustRelationship)) {
initTrustRelationship(deconstructedTrustRelationship, attributes);
this.federatedSites.add(deconstructedTrustRelationship);
}
}
use of org.gluu.oxtrust.model.GluuSAMLTrustRelationship in project oxTrust by GluuFederation.
the class TrustRelationshipInventoryAction method setCustomAttributes.
private void setCustomAttributes(List<GluuSAMLTrustRelationship> trustRelationships) {
List<GluuAttribute> attributes = attributeService.getAllPersonAttributes(GluuUserRole.ADMIN);
HashMap<String, GluuAttribute> attributesByDNs = attributeService.getAttributeMapByDNs(attributes);
for (GluuSAMLTrustRelationship trustRelationship : trustRelationships) {
trustRelationship.setReleasedCustomAttributes(attributeService.getCustomAttributesByAttributeDNs(trustRelationship.getReleasedAttributes(), attributesByDNs));
}
}
Aggregations