use of com.sun.identity.saml2.meta.SAML2MetaException in project OpenAM by OpenRock.
the class SAMLv2ModelImpl method getallSPEntities.
/**
* Returns a set with all the Service Providers under the realm.
*
* @param realm to which the entity belongs.
* @return Set with all service providers under the realm passed.
* @throws AMConsoleException if unable to retrieve service providers.
*
*/
public Set getallSPEntities(String realm) throws AMConsoleException {
Set allSPEntities = Collections.EMPTY_SET;
try {
SAML2MetaManager samlManager = getSAML2MetaManager();
allSPEntities = convertListToSet(samlManager.getAllHostedServiceProviderEntities(realm));
Set remoteSPEntities = convertListToSet(samlManager.getAllRemoteServiceProviderEntities(realm));
allSPEntities.addAll(remoteSPEntities);
} catch (SAML2MetaException e) {
debug.warning("SAMLv2ModelImpl.getallSPEntities:", e);
throw new AMConsoleException(getErrorString(e));
}
return allSPEntities;
}
use of com.sun.identity.saml2.meta.SAML2MetaException 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;
}
use of com.sun.identity.saml2.meta.SAML2MetaException in project OpenAM by OpenRock.
the class SAMLv2ModelImpl method getStandardAttributeAuthorityAttributes.
/**
* Returns a map with standard AttributeAuthority attributes and values.
*
* @param realm to which the entity belongs.
* @param entityName is the entity id.
* @return Map with AttributeAuthority values.
* @throws AMConsoleException if unable to retrieve std AttributeAuthority
* values based on the realm and entityName passed.
*/
public Map getStandardAttributeAuthorityAttributes(String realm, String entityName) throws AMConsoleException {
String[] params = { realm, entityName, "SAMLv2", "AttribAuthority-Std" };
logEvent("ATTEMPT_GET_ATTR_AUTH_ATTR_VALUES", params);
Map map = new HashMap();
AttributeAuthorityDescriptorElement attrauthDescriptor = null;
try {
SAML2MetaManager samlManager = getSAML2MetaManager();
attrauthDescriptor = samlManager.getAttributeAuthorityDescriptor(realm, entityName);
map.put(ATTR_SEFVICE_DEFAULT_LOCATION, Collections.EMPTY_SET);
map.put(SUPPORTS_X509, Collections.EMPTY_SET);
map.put(ATTR_SEFVICE_LOCATION, Collections.EMPTY_SET);
if (attrauthDescriptor != null) {
List artServiceList = attrauthDescriptor.getAttributeService();
for (int i = 0; i < artServiceList.size(); i++) {
AttributeServiceElement key = (AttributeServiceElement) artServiceList.get(i);
if ((key.getLocation() != null) && (key.isSupportsX509Query())) {
map.put(SUPPORTS_X509, returnEmptySetIfValueIsNull(key.isSupportsX509Query()));
map.put(ATTR_SEFVICE_LOCATION, returnEmptySetIfValueIsNull(key.getLocation()));
} else if ((key.getLocation() != null) && (key.getLocation().length() > 0)) {
map.put(ATTR_SEFVICE_DEFAULT_LOCATION, returnEmptySetIfValueIsNull(key.getLocation()));
}
}
map.put(ASSERTION_ID_SAOP_LOC, Collections.EMPTY_SET);
map.put(ASSERTION_ID_URI_LOC, Collections.EMPTY_SET);
List assertionIDReqList = attrauthDescriptor.getAssertionIDRequestService();
for (int i = 0; i < assertionIDReqList.size(); i++) {
AssertionIDRequestServiceElement elem1 = (AssertionIDRequestServiceElement) assertionIDReqList.get(i);
if (elem1.getBinding().contains("SOAP")) {
map.put(ASSERTION_ID_SAOP_LOC, returnEmptySetIfValueIsNull(elem1.getLocation()));
} else if (elem1.getBinding().contains("URI")) {
map.put(ASSERTION_ID_URI_LOC, returnEmptySetIfValueIsNull(elem1.getLocation()));
}
}
map.put(ATTRIBUTE_PROFILE, Collections.EMPTY_SET);
List attrProfileList = attrauthDescriptor.getAttributeProfile();
if (!attrProfileList.isEmpty()) {
String key = (String) attrProfileList.get(0);
map.put(ATTRIBUTE_PROFILE, returnEmptySetIfValueIsNull(key));
}
}
logEvent("SUCCEED_GET_ATTR_AUTH_ATTR_VALUES", params);
} catch (SAML2MetaException e) {
debug.warning("SAMLv2ModelImpl.getStandardAttributeAuthorityAttributes:", e);
String strError = getErrorString(e);
String[] paramsEx = { realm, entityName, "SAMLv2", "AttribAuthority-Std", strError };
logEvent("FEDERATION_EXCEPTION_GET_ATTR_AUTH_ATTR_VALUES", paramsEx);
throw new AMConsoleException(strError);
}
return map;
}
use of com.sun.identity.saml2.meta.SAML2MetaException in project OpenAM by OpenRock.
the class SAMLv2ModelImpl method getStandardAttrQueryAttributes.
/**
* Returns a map with standard AttrQuery attributes and values.
*
* @param realm to which the entity belongs.
* @param entityName is the entity id.
* @return Map with AttrQuery values.
* @throws AMConsoleException if unable to retrieve std AttrQuery
* values based on the realm and entityName passed.
*/
public Map getStandardAttrQueryAttributes(String realm, String entityName) throws AMConsoleException {
String[] params = { realm, entityName, "SAMLv2", "AttrQuery-Std" };
logEvent("ATTEMPT_GET_ATTR_QUERY_ATTR_VALUES", params);
Map map = new HashMap();
AttributeQueryDescriptorElement attrQueryDescriptor = null;
try {
SAML2MetaManager samlManager = getSAML2MetaManager();
attrQueryDescriptor = samlManager.getAttributeQueryDescriptor(realm, entityName);
map.put(ATTR_NAMEID_FORMAT, (OrderedSet) convertListToSet(attrQueryDescriptor.getNameIDFormat()));
logEvent("SUCCEED_GET_ATTR_QUERY_ATTR_VALUES", params);
} catch (SAML2MetaException e) {
debug.warning("SAMLv2ModelImpl.getStandardAttrQueryAttributes:", e);
String strError = getErrorString(e);
String[] paramsEx = { realm, entityName, "SAMLv2", "AttrQuery-Std", strError };
logEvent("FEDERATION_EXCEPTION_GET_ATTR_QUERY_ATTR_VALUES", paramsEx);
throw new AMConsoleException(strError);
}
return map;
}
use of com.sun.identity.saml2.meta.SAML2MetaException in project OpenAM by OpenRock.
the class SAMLv2ModelImpl method setSPExtAttributeValues.
/**
* Saves the extended attribute values for the Service Provider.
*
* @param realm to which the entity belongs.
* @param entityName is the entity id.
* @param spExtValues Map which contains the standard attribute values.
* @param location has the information whether remote or hosted.
* @throws AMConsoleException if saving of attribute value fails.
*/
public void setSPExtAttributeValues(String realm, String entityName, Map spExtValues, String location) throws AMConsoleException {
String[] params = { realm, entityName, "SAMLv2", "SP-Extended" };
logEvent("ATTEMPT_MODIFY_ENTITY_DESCRIPTOR", params);
String role = EntityModel.SERVICE_PROVIDER;
try {
SAML2MetaManager samlManager = getSAML2MetaManager();
//entityConfig is the extended entity configuration object
EntityConfigElement entityConfig = samlManager.getEntityConfig(realm, entityName);
//for remote cases
if (entityConfig == null) {
createExtendedObject(realm, entityName, location, role);
entityConfig = samlManager.getEntityConfig(realm, entityName);
}
SPSSOConfigElement spssoConfig = samlManager.getSPSSOConfig(realm, entityName);
if (spssoConfig != null) {
updateBaseConfig(spssoConfig, spExtValues, role);
}
//saves the attributes by passing the new entityConfig object
samlManager.setEntityConfig(realm, entityConfig);
logEvent("SUCCEED_MODIFY_ENTITY_DESCRIPTOR", params);
} catch (SAML2MetaException e) {
debug.error("SAMLv2ModelImpl.setSPExtAttributeValues:", e);
String strError = getErrorString(e);
String[] paramsEx = { realm, entityName, "SAMLv2", "SP Ext", strError };
logEvent("FEDERATION_EXCEPTION_MODIFY_ENTITY_DESCRIPTOR", paramsEx);
} catch (JAXBException e) {
debug.error("SAMLv2ModelImpl.setSPExtAttributeValues:", e);
String strError = getErrorString(e);
String[] paramsEx = { realm, entityName, "SAMLv2", "SP Ext", strError };
logEvent("FEDERATION_EXCEPTION_MODIFY_ENTITY_DESCRIPTOR", paramsEx);
} catch (AMConsoleException e) {
debug.error("SAMLv2ModelImpl.setSPExtAttributeValues:", e);
String strError = getErrorString(e);
String[] paramsEx = { realm, entityName, "SAMLv2", "SP Ext", strError };
logEvent("FEDERATION_EXCEPTION_MODIFY_ENTITY_DESCRIPTOR", paramsEx);
}
}
Aggregations