use of com.sun.identity.wsfederation.jaxb.wsfederation.TokenIssuerEndpointElement in project OpenAM by OpenRock.
the class WSFedPropertiesModelImpl method setGenAttributeValues.
/**
* Saves the attribute values from the General page.
*
* @param realm to which the entity belongs.
* @param fedId is the entity id.
* @param idpStdValues has the General standard attribute value pairs.
* @param role of the entity ID.
* @param location specifies if the entity is remote or local.
* @throws AMConsoleException if saving of attribute value fails.
*/
public void setGenAttributeValues(String realm, String fedId, Map idpStdValues, String role, String location) throws AMConsoleException {
String tknissEndPt = null;
String tknissName = null;
Iterator it = idpStdValues.entrySet().iterator();
while (it.hasNext()) {
Map.Entry entry = (Map.Entry) it.next();
Object key = entry.getKey();
Object value = entry.getValue();
if (key.equals(TFTOKENISSUER_ENDPT)) {
HashSet set = (HashSet) idpStdValues.get(key);
Iterator i = set.iterator();
while ((i != null) && (i.hasNext())) {
tknissEndPt = (String) i.next();
}
} else if (key.equals(TFTOKENISSUER_NAME)) {
HashSet set = (HashSet) idpStdValues.get(key);
Iterator i = set.iterator();
while ((i != null) && (i.hasNext())) {
tknissName = (String) i.next();
}
} else if (key.equals(TF_DISPNAME)) {
if (role.equals(EntityModel.SERVICE_PROVIDER)) {
HashSet set = (HashSet) idpStdValues.get(key);
// Get the current map of extended SP values
Map tmpMap = getExtendedValues(role, realm, fedId);
// Replace existing value
tmpMap.put(TF_DISPNAME, set);
setSPExtAttributeValues(realm, fedId, tmpMap, location);
} else if (role.equals(EntityModel.IDENTITY_PROVIDER)) {
HashSet set = (HashSet) idpStdValues.get(key);
// Get the current map of extended IDP values
Map tmpMap = getExtendedValues(role, realm, fedId);
// Replace existing value
tmpMap.put(TF_DISPNAME, set);
setIDPExtAttributeValues(realm, fedId, tmpMap, location);
} else if (role.equals(DUAL)) {
HashSet set = (HashSet) idpStdValues.get(key);
// Get the current map of extended SP values
Map tmpMap = getExtendedValues(EntityModel.SERVICE_PROVIDER, realm, fedId);
// Replace existing value
tmpMap.put(TF_DISPNAME, set);
setSPExtAttributeValues(realm, fedId, tmpMap, location);
// Get the current map of extended IDP values
tmpMap = getExtendedValues(EntityModel.IDENTITY_PROVIDER, realm, fedId);
set = (HashSet) idpStdValues.get(TFIDPDISP_NAME);
// Replace existing value
tmpMap.put(TF_DISPNAME, set);
setIDPExtAttributeValues(realm, fedId, tmpMap, location);
}
}
}
try {
//fedElem is standard metadata federation element under the realm.
WSFederationMetaManager metaManager = getWSFederationMetaManager();
FederationElement fedElem = metaManager.getEntityDescriptor(realm, fedId);
if (fedElem == null) {
if (debug.warningEnabled()) {
debug.warning("WSFedPropertiesModelImpl.setGenAttributeValues:" + " found invalid federation element " + fedId);
}
throw new AMConsoleException("invalid.federation.element");
} else {
for (Iterator iter = fedElem.getAny().iterator(); iter.hasNext(); ) {
Object o = iter.next();
if (o instanceof TokenIssuerEndpointElement) {
((TokenIssuerEndpointElement) o).getAddress().setValue(tknissEndPt);
} else if (o instanceof TokenIssuerNameElement) {
((TokenIssuerNameElement) o).setValue(tknissName);
}
}
metaManager.setFederation(realm, fedElem);
}
} catch (WSFederationMetaException e) {
debug.warning("WSFedPropertiesModelImpl.setGenAttributeValues", e);
throw new AMConsoleException(e.getMessage());
}
}
use of com.sun.identity.wsfederation.jaxb.wsfederation.TokenIssuerEndpointElement in project OpenAM by OpenRock.
the class WSFedPropertiesModelImpl method isDualRole.
/**
* Retrieves a count of the TokenIssuerEndpointElement
* which would help in determining whether dual role or not.
* @param edes is the standard metadata object.
*
* @return count of the TokenIssuerEndpointElement
*/
private boolean isDualRole(FederationElement edes) {
int cnt = 0;
boolean dual = false;
if (edes != null) {
for (Iterator iter = edes.getAny().iterator(); iter.hasNext(); ) {
Object o = iter.next();
if (o instanceof TokenIssuerEndpointElement) {
cnt++;
}
}
}
if (cnt > 1) {
dual = true;
}
return dual;
}
Aggregations