use of com.sun.identity.saml2.meta.SAML2MetaException in project OpenAM by OpenRock.
the class SAML2MetaManager method getSPSSOConfig.
/**
* Returns first service provider's SSO 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>SPSSOConfigElement</code> for the entity or null if not
* found.
* @throws SAML2MetaException if unable to retrieve the first service
* provider's SSO configuration.
*/
public SPSSOConfigElement getSPSSOConfig(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 SPSSOConfigElement) {
return (SPSSOConfigElement) obj;
}
}
return null;
}
use of com.sun.identity.saml2.meta.SAML2MetaException in project OpenAM by OpenRock.
the class SAML2MetaManager method getPolicyEnforcementPointConfig.
/**
* Returns first policy enforcement point 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 policy decision point configuration or null if it is not found.
* @throws SAML2MetaException if unable to retrieve the configuration.
*/
public XACMLAuthzDecisionQueryConfigElement getPolicyEnforcementPointConfig(String realm, String entityId) throws SAML2MetaException {
XACMLAuthzDecisionQueryConfigElement elm = null;
EntityConfigElement eConfig = getEntityConfig(realm, entityId);
if (eConfig != null) {
List list = eConfig.getIDPSSOConfigOrSPSSOConfigOrAuthnAuthorityConfig();
for (Iterator i = list.iterator(); i.hasNext() && (elm == null); ) {
Object obj = i.next();
if (obj instanceof XACMLAuthzDecisionQueryConfigElement) {
elm = (XACMLAuthzDecisionQueryConfigElement) obj;
}
}
}
return elm;
}
use of com.sun.identity.saml2.meta.SAML2MetaException in project OpenAM by OpenRock.
the class SAML2MetaManager method getEntityDescriptor.
/**
* Returns the standard metadata entity descriptor under the realm.
* @param realm The realm under which the entity resides.
* @param entityId ID of the entity to be retrieved.
* @return <code>EntityDescriptorElement</code> for the entity or null if
* not found.
* @throws SAML2MetaException if unable to retrieve the entity descriptor.
*/
public EntityDescriptorElement getEntityDescriptor(String realm, String entityId) throws SAML2MetaException {
if (entityId == null) {
return null;
}
if (realm == null) {
realm = "/";
}
String[] objs = { entityId, realm };
EntityDescriptorElement descriptor = null;
if (callerSession == null) {
descriptor = SAML2MetaCache.getEntityDescriptor(realm, entityId);
if (descriptor != null) {
if (debug.messageEnabled()) {
debug.message("SAML2MetaManager.getEntityDescriptor: got " + "descriptor from SAML2MetaCache " + entityId);
}
LogUtil.access(Level.FINE, LogUtil.GOT_ENTITY_DESCRIPTOR, objs, null);
return descriptor;
}
}
try {
Map attrs = configInst.getConfiguration(realm, entityId);
if (attrs == null) {
return null;
}
Set values = (Set) attrs.get(ATTR_METADATA);
if ((values == null) || values.isEmpty()) {
return null;
}
String value = (String) values.iterator().next();
Object obj = SAML2MetaUtils.convertStringToJAXB(value);
if (obj instanceof EntityDescriptorElement) {
descriptor = (EntityDescriptorElement) obj;
SAML2MetaCache.putEntityDescriptor(realm, entityId, descriptor);
if (debug.messageEnabled()) {
debug.message("SAML2MetaManager.getEntityDescriptor: got " + "descriptor from SMS " + entityId);
}
LogUtil.access(Level.FINE, LogUtil.GOT_ENTITY_DESCRIPTOR, objs, null);
return descriptor;
}
debug.error("SAML2MetaManager.getEntityDescriptor: invalid descriptor");
LogUtil.error(Level.INFO, LogUtil.GOT_INVALID_ENTITY_DESCRIPTOR, objs, null);
throw new SAML2MetaException("invalid_descriptor", objs);
} catch (ConfigurationException e) {
debug.error("SAML2MetaManager.getEntityDescriptor", e);
String[] data = { e.getMessage(), entityId, realm };
LogUtil.error(Level.INFO, LogUtil.CONFIG_ERROR_GET_ENTITY_DESCRIPTOR, data, null);
throw new SAML2MetaException(e);
} catch (JAXBException jaxbe) {
debug.error("SAML2MetaManager.getEntityDescriptor", jaxbe);
LogUtil.error(Level.INFO, LogUtil.GOT_INVALID_ENTITY_DESCRIPTOR, objs, null);
throw new SAML2MetaException("invalid_descriptor", objs);
}
}
use of com.sun.identity.saml2.meta.SAML2MetaException in project OpenAM by OpenRock.
the class SAML2MetaManager method getAllHostedPolicyEnforcementPointMetaAliases.
/**
* Returns meta aliases of all hosted policy enforcement point under the
* realm.
*
* @param realm The realm under which the policy enforcement point resides.
* @return list of meta aliases
* @throws SAML2MetaException if unable to retrieve meta aliases.
*/
public List getAllHostedPolicyEnforcementPointMetaAliases(String realm) throws SAML2MetaException {
List metaAliases = new ArrayList();
List hostedEntityIds = getAllHostedPolicyEnforcementPointEntities(realm);
for (Iterator i = hostedEntityIds.iterator(); i.hasNext(); ) {
String entityId = (String) i.next();
XACMLAuthzDecisionQueryConfigElement elm = getPolicyEnforcementPointConfig(realm, entityId);
if (elm != null) {
metaAliases.add(elm.getMetaAlias());
}
}
return metaAliases;
}
use of com.sun.identity.saml2.meta.SAML2MetaException in project OpenAM by OpenRock.
the class SAML2MetaManager method getAllHostedServiceProviderMetaAliases.
/**
* Returns metaAliases of all hosted service providers under the realm.
* @param realm The realm under which the service provider metaAliases
* reside.
* @return a <code>List</code> of metaAliases <code>String</code>.
* @throws SAML2MetaException if unable to retrieve meta aliases.
*/
public List getAllHostedServiceProviderMetaAliases(String realm) throws SAML2MetaException {
List metaAliases = new ArrayList();
SPSSOConfigElement spConfig = null;
List hostedEntityIds = getAllHostedServiceProviderEntities(realm);
for (Iterator iter = hostedEntityIds.iterator(); iter.hasNext(); ) {
String entityId = (String) iter.next();
if ((spConfig = getSPSSOConfig(realm, entityId)) != null) {
metaAliases.add(spConfig.getMetaAlias());
}
}
return metaAliases;
}
Aggregations