Search in sources :

Example 26 with GluuSAMLTrustRelationship

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());
    }
}
Also used : GluuSAMLTrustRelationship(org.gluu.oxtrust.model.GluuSAMLTrustRelationship) OxAuthClient(org.gluu.oxtrust.model.OxAuthClient) HashSet(java.util.HashSet)

Example 27 with GluuSAMLTrustRelationship

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);
    }
}
Also used : GluuSAMLTrustRelationship(org.gluu.oxtrust.model.GluuSAMLTrustRelationship) GluuAttribute(org.xdi.model.GluuAttribute)

Example 28 with GluuSAMLTrustRelationship

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));
    }
}
Also used : GluuSAMLTrustRelationship(org.gluu.oxtrust.model.GluuSAMLTrustRelationship) GluuAttribute(org.xdi.model.GluuAttribute)

Aggregations

GluuSAMLTrustRelationship (org.gluu.oxtrust.model.GluuSAMLTrustRelationship)28 ArrayList (java.util.ArrayList)10 GluuAttribute (org.xdi.model.GluuAttribute)5 File (java.io.File)4 IOException (java.io.IOException)4 SubversionFile (org.gluu.oxtrust.model.SubversionFile)4 LdapMappingException (org.gluu.site.ldap.persistence.exception.LdapMappingException)3 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 List (java.util.List)2 TreeSet (java.util.TreeSet)2 GluuCustomAttribute (org.gluu.oxtrust.model.GluuCustomAttribute)2 OrganizationalUnit (org.gluu.oxtrust.model.OrganizationalUnit)2 InvalidConfigurationException (org.xdi.util.exception.InvalidConfigurationException)2 Filter (com.unboundid.ldap.sdk.Filter)1 AttributeTypeDefinition (com.unboundid.ldap.sdk.schema.AttributeTypeDefinition)1 FileInputStream (java.io.FileInputStream)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 CertificateEncodingException (java.security.cert.CertificateEncodingException)1 LinkedList (java.util.LinkedList)1