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 Shibboleth3ConfService method initAttributes.
/*
* Init attributes
*/
private void initAttributes(List<GluuSAMLTrustRelationship> trustRelationships) {
List<GluuAttribute> attributes = attributeService.getAllPersonAttributes(GluuUserRole.ADMIN);
HashMap<String, GluuAttribute> attributesByDNs = attributeService.getAttributeMapByDNs(attributes);
GluuAttribute uid = attributeService.getAttributeByName(OxConstants.UID);
// Load attributes definition
for (GluuSAMLTrustRelationship trustRelationship : trustRelationships) {
// Add first attribute uid
List<String> oldAttributes = trustRelationship.getReleasedAttributes();
List<String> releasedAttributes = new ArrayList<String>();
if (oldAttributes != null) {
releasedAttributes.addAll(oldAttributes);
}
if (uid != null) {
if (releasedAttributes.remove(uid.getDn())) {
releasedAttributes.add(0, uid.getDn());
}
}
// Resolve custom attributes by DNs
trustRelationship.setReleasedCustomAttributes(attributeService.getCustomAttributesByAttributeDNs(releasedAttributes, attributesByDNs));
// Set attribute meta-data
attributeService.setAttributeMetadata(trustRelationship.getReleasedCustomAttributes(), attributes);
}
}
use of org.gluu.oxtrust.model.GluuSAMLTrustRelationship in project oxTrust by GluuFederation.
the class TrustService method getAllActiveTrustRelationships.
public List<GluuSAMLTrustRelationship> getAllActiveTrustRelationships() {
GluuSAMLTrustRelationship trustRelationship = new GluuSAMLTrustRelationship();
trustRelationship.setBaseDn(getDnForTrustRelationShip(null));
trustRelationship.setStatus(GluuStatus.ACTIVE);
return persistenceEntryManager.findEntries(trustRelationship);
}
use of org.gluu.oxtrust.model.GluuSAMLTrustRelationship in project oxTrust by GluuFederation.
the class TrustService method removeAttribute.
/**
* Remove attribute
*
* @param attribute
* Attribute
*/
public boolean removeAttribute(GluuAttribute attribute) {
log.trace("Removing attribute from trustRelationships");
List<GluuSAMLTrustRelationship> trustRelationships = getAllTrustRelationships();
log.trace(String.format("Iterating '%d' trustRelationships", trustRelationships.size()));
for (GluuSAMLTrustRelationship trustRelationship : trustRelationships) {
log.trace("Analyzing '%s'.", trustRelationship.getDisplayName());
List<String> customAttrs = trustRelationship.getReleasedAttributes();
if (customAttrs != null) {
for (String attrDN : customAttrs) {
log.trace("'%s' has custom attribute '%s'", trustRelationship.getDisplayName(), attrDN);
if (attrDN.equals(attribute.getDn())) {
log.trace("'%s' matches '%s'. deleting it.", attrDN, attribute.getDn());
List<String> updatedAttrs = new ArrayList<String>();
updatedAttrs.addAll(customAttrs);
updatedAttrs.remove(attrDN);
if (updatedAttrs.size() == 0) {
trustRelationship.setReleasedAttributes(null);
} else {
trustRelationship.setReleasedAttributes(updatedAttrs);
}
updateTrustRelationship(trustRelationship);
break;
}
}
}
}
attributeService.removeAttribute(attribute);
return true;
}
use of org.gluu.oxtrust.model.GluuSAMLTrustRelationship in project oxTrust by GluuFederation.
the class Shibboleth3ConfService method generateSpAttributeMapFile.
public String generateSpAttributeMapFile(GluuSAMLTrustRelationship trustRelationship) {
List<GluuSAMLTrustRelationship> trustRelationships = Arrays.asList(trustRelationship);
initAttributes(trustRelationships);
HashMap<String, Object> attrParams = initAttributeParamMap(trustRelationships);
if (attrParams == null) {
return null;
}
VelocityContext context = prepareVelocityContext(null, attrParams, null, null, null);
String spAttributeMap = generateConfFile(SHIB3_SP_ATTRIBUTE_MAP_FILE, context);
return spAttributeMap;
}
Aggregations