use of com.sun.identity.saml2.jaxb.entityconfig.AttributeAuthorityConfigElement in project OpenAM by OpenRock.
the class SAMLv2ModelImpl method setExtAttributeAuthorityValues.
/**
* Saves the extended attribute values for Attribute Authority.
*
* @param realm to which the entity belongs.
* @param entityName is the entity id.
* @param attrAuthExtValues Map which contains the extended values.
* @param location has the information whether remote or hosted.
* @throws AMConsoleException if saving of attribute value fails.
*/
public void setExtAttributeAuthorityValues(String realm, String entityName, Map attrAuthExtValues, String location) throws AMConsoleException {
String[] params = { realm, entityName, "SAMLv2", "AttribAuthority-Ext" };
logEvent("ATTEMPT_MODIFY_ATTR_AUTH_ATTR_VALUES", params);
String role = EntityModel.SAML_ATTRAUTHORITY;
try {
SAML2MetaManager samlManager = getSAML2MetaManager();
EntityConfigElement entityConfig = samlManager.getEntityConfig(realm, entityName);
//for remote cases
if (entityConfig == null) {
createExtendedObject(realm, entityName, location, role);
entityConfig = samlManager.getEntityConfig(realm, entityName);
}
AttributeAuthorityConfigElement attributeAuthorityConfig = samlManager.getAttributeAuthorityConfig(realm, entityName);
if (attributeAuthorityConfig != null) {
updateBaseConfig(attributeAuthorityConfig, attrAuthExtValues, role);
}
//saves the attributes by passing the new entityConfig object
samlManager.setEntityConfig(realm, entityConfig);
logEvent("SUCCEED_MODIFY_ATTR_AUTH_ATTR_VALUES", params);
} catch (SAML2MetaException e) {
debug.error("SAMLv2ModelImpl.setExtAttributeAuthorityValues:", e);
String strError = getErrorString(e);
String[] paramsEx = { realm, entityName, "SAMLv2", "AttribAuthority-Ext", strError };
logEvent("FEDERATION_EXCEPTION_MODIFY_ATTR_AUTH_ATTR_VALUES", paramsEx);
} catch (JAXBException e) {
debug.error("SAMLv2ModelImpl.setExtAttributeAuthorityValues:", e);
String strError = getErrorString(e);
String[] paramsEx = { realm, entityName, "SAMLv2", "AttribAuthority-Extended", strError };
logEvent("FEDERATION_EXCEPTION_MODIFY_ATTR_AUTH_ATTR_VALUES", paramsEx);
} catch (AMConsoleException e) {
debug.error("SAMLv2ModelImpl.setExtAttributeAuthorityValues:", e);
String strError = getErrorString(e);
String[] paramsEx = { realm, entityName, "SAMLv2", "AttribAuthority-Ext", strError };
logEvent("FEDERATION_EXCEPTION_MODIFY_ATTR_AUTH_ATTR_VALUES", paramsEx);
}
}
use of com.sun.identity.saml2.jaxb.entityconfig.AttributeAuthorityConfigElement in project OpenAM by OpenRock.
the class SAML2MetaManager method getAttributeAuthorityConfig.
/**
* Returns first attribute authority configuration in an entity under
* the realm.
* @param realm The realm under which the entity resides.
* @param entityId ID of the entity to be retrieved.
* @return <code>AttributeAuthorityConfigElement</code> for the entity or
* null if not found.
* @throws SAML2MetaException if unable to retrieve the first attribute
* authority configuration.
*/
public AttributeAuthorityConfigElement getAttributeAuthorityConfig(String realm, String entityId) throws SAML2MetaException {
EntityConfigElement eConfig = getEntityConfig(realm, entityId);
if (eConfig == null) {
return null;
}
List list = eConfig.getIDPSSOConfigOrSPSSOConfigOrAuthnAuthorityConfig();
for (Iterator iter = list.iterator(); iter.hasNext(); ) {
Object obj = iter.next();
if (obj instanceof AttributeAuthorityConfigElement) {
return (AttributeAuthorityConfigElement) obj;
}
}
return null;
}
use of com.sun.identity.saml2.jaxb.entityconfig.AttributeAuthorityConfigElement in project OpenAM by OpenRock.
the class AttributeQueryUtil method getAttributeValueFromAttrAuthorityConfig.
private static String getAttributeValueFromAttrAuthorityConfig(String realm, String attrAuthorityEntityID, String attrName) {
try {
AttributeAuthorityConfigElement config = metaManager.getAttributeAuthorityConfig(realm, attrAuthorityEntityID);
Map attrs = SAML2MetaUtils.getAttributes(config);
String value = null;
List values = (List) attrs.get(attrName);
if ((values != null) && (!values.isEmpty())) {
value = ((String) values.iterator().next()).trim();
}
return value;
} catch (SAML2MetaException sme) {
if (SAML2Utils.debug.messageEnabled()) {
SAML2Utils.debug.message("AttributeQueryUtil." + "getAttributeValueFromAttrAuthorityConfig: " + "get AttributeAuthorityConfig failed", sme);
}
}
return null;
}
use of com.sun.identity.saml2.jaxb.entityconfig.AttributeAuthorityConfigElement in project OpenAM by OpenRock.
the class SAMLv2ModelImpl method getExtendedAttributeAuthorityAttributes.
/**
* Returns a map with extended AttributeAuthority attributes and values.
*
* @param realm to which the entity belongs.
* @param entityName is the entity id.
* @return Map with extended AttributeAuthority values.
* @throws AMConsoleException if unable to retrieve ext AttributeAuthority
* attributes based on the realm and entityName passed.
*/
public Map getExtendedAttributeAuthorityAttributes(String realm, String entityName) throws AMConsoleException {
String[] params = { realm, entityName, "SAMLv2", "AttribAuthority-Ext" };
logEvent("ATTEMPT_GET_ATTR_AUTH_ATTR_VALUES", params);
Map map = null;
AttributeAuthorityConfigElement attributeAuthorityConfig = null;
try {
SAML2MetaManager samlManager = getSAML2MetaManager();
attributeAuthorityConfig = samlManager.getAttributeAuthorityConfig(realm, entityName);
if (attributeAuthorityConfig != null) {
BaseConfigType baseConfig = (BaseConfigType) attributeAuthorityConfig;
map = SAML2MetaUtils.getAttributes(baseConfig);
}
logEvent("SUCCEED_GET_ATTR_AUTH_ATTR_VALUES", params);
} catch (SAML2MetaException e) {
debug.warning("SAMLv2ModelImpl.getExtendedAttributeAuthorityAttributes:", e);
String strError = getErrorString(e);
String[] paramsEx = { realm, entityName, "SAMLv2", "AttribAuthority-Ext", strError };
logEvent("FEDERATION_EXCEPTION_GET_ATTR_AUTH_ATTR_VALUES", paramsEx);
throw new AMConsoleException(strError);
}
return (map != null) ? map : Collections.EMPTY_MAP;
}
Aggregations