use of com.sun.identity.saml2.meta.SAML2MetaException in project OpenAM by OpenRock.
the class SAML2MetaManager method getEntityByMetaAlias.
/**
* Returns entity ID associated with the metaAlias.
* @param metaAlias The metaAlias.
* @return entity ID associated with the metaAlias or null if not found.
* @throws SAML2MetaException if unable to retrieve the entity ids.
*/
public String getEntityByMetaAlias(String metaAlias) throws SAML2MetaException {
String realm = SAML2MetaUtils.getRealmByMetaAlias(metaAlias);
try {
Set entityIds = configInst.getAllConfigurationNames(realm);
if (entityIds == null || entityIds.isEmpty()) {
return null;
}
for (Iterator iter = entityIds.iterator(); iter.hasNext(); ) {
String entityId = (String) iter.next();
EntityConfigElement config = getEntityConfig(realm, entityId);
if ((config == null) || !config.isHosted()) {
continue;
}
List list = config.getIDPSSOConfigOrSPSSOConfigOrAuthnAuthorityConfig();
for (Iterator iter2 = list.iterator(); iter2.hasNext(); ) {
BaseConfigType bConfig = (BaseConfigType) iter2.next();
String cMetaAlias = bConfig.getMetaAlias();
if (cMetaAlias != null && cMetaAlias.equals(metaAlias)) {
return entityId;
}
}
}
} catch (ConfigurationException e) {
debug.error("SAML2MetaManager.getEntityByMetaAlias:", e);
throw new SAML2MetaException(e);
}
return null;
}
use of com.sun.identity.saml2.meta.SAML2MetaException in project OpenAM by OpenRock.
the class SAML2MetaManager method getAttributeQueryConfig.
/**
* Returns first attribute query 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>AttributeQueryConfigElement</code> for the entity or
* null if not found.
* @throws SAML2MetaException if unable to retrieve the first attribute
* query configuration.
*/
public AttributeQueryConfigElement getAttributeQueryConfig(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 AttributeQueryConfigElement) {
return (AttributeQueryConfigElement) obj;
}
}
return null;
}
use of com.sun.identity.saml2.meta.SAML2MetaException in project OpenAM by OpenRock.
the class SAML2MetaManager method getIDPSSOConfig.
/**
* Returns first identity 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>IDPSSOConfigElement</code> for the entity or null if not
* found.
* @throws SAML2MetaException if unable to retrieve the first identity
* provider's SSO configuration.
*/
public IDPSSOConfigElement getIDPSSOConfig(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 IDPSSOConfigElement) {
return (IDPSSOConfigElement) obj;
}
}
return null;
}
use of com.sun.identity.saml2.meta.SAML2MetaException in project OpenAM by OpenRock.
the class SAML2MetaManager method isTrustedProvider.
/**
* Determines whether two entities are in the same circle of trust
* under the realm.
* @param realm The realm under which the entity resides.
* @param entityId The ID of the entity
* @param trustedEntityId The ID of the entity
* @throws SAML2MetaException if unable to determine the trusted
* relationship.
*/
public boolean isTrustedProvider(String realm, String entityId, String trustedEntityId) throws SAML2MetaException {
boolean result = false;
SPSSOConfigElement spconfig = getSPSSOConfig(realm, entityId);
if (spconfig != null) {
result = isSameCircleOfTrust(spconfig, realm, trustedEntityId);
}
if (result) {
return true;
}
IDPSSOConfigElement idpconfig = getIDPSSOConfig(realm, entityId);
if (idpconfig != null) {
return (isSameCircleOfTrust(idpconfig, realm, trustedEntityId));
}
return false;
}
use of com.sun.identity.saml2.meta.SAML2MetaException in project OpenAM by OpenRock.
the class SAML2MetaManager method getPolicyDecisionPointConfig.
/**
* Returns first policy decision 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 XACMLPDPConfigElement getPolicyDecisionPointConfig(String realm, String entityId) throws SAML2MetaException {
XACMLPDPConfigElement 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 XACMLPDPConfigElement) {
elm = (XACMLPDPConfigElement) obj;
}
}
}
return elm;
}
Aggregations