Search in sources :

Example 21 with AuthnContext

use of com.sun.identity.saml2.assertion.AuthnContext in project OpenAM by OpenRock.

the class IDPSSOUtil method getIDPAuthnContextMapper.

/**
     * Returns an <code>IDPAuthnContextMapper</code>
     *
     * @param realm       the realm name
     * @param idpEntityID the entity id of the identity provider
     * @return the <code>IDPAuthnContextMapper</code>
     * @throws SAML2Exception if the operation is not successful
     */
public static IDPAuthnContextMapper getIDPAuthnContextMapper(String realm, String idpEntityID) throws SAML2Exception {
    String classMethod = "IDPSSOUtil.getIDPAuthnContextMapper: ";
    String idpAuthnContextMapperName = null;
    IDPAuthnContextMapper idpAuthnContextMapper = null;
    try {
        idpAuthnContextMapperName = getAttributeValueFromIDPSSOConfig(realm, idpEntityID, SAML2Constants.IDP_AUTHNCONTEXT_MAPPER_CLASS);
        if (idpAuthnContextMapperName == null) {
            idpAuthnContextMapperName = SAML2Constants.DEFAULT_IDP_AUTHNCONTEXT_MAPPER_CLASS;
            if (SAML2Utils.debug.messageEnabled()) {
                SAML2Utils.debug.message(classMethod + "use " + SAML2Constants.DEFAULT_IDP_AUTHNCONTEXT_MAPPER_CLASS);
            }
        }
        idpAuthnContextMapper = (IDPAuthnContextMapper) IDPCache.idpAuthnContextMapperCache.get(idpAuthnContextMapperName);
        if (idpAuthnContextMapper == null) {
            idpAuthnContextMapper = (IDPAuthnContextMapper) Class.forName(idpAuthnContextMapperName).newInstance();
            IDPCache.idpAuthnContextMapperCache.put(idpAuthnContextMapperName, idpAuthnContextMapper);
        } else {
            if (SAML2Utils.debug.messageEnabled()) {
                SAML2Utils.debug.message(classMethod + "got the IDPAuthnContextMapper from cache");
            }
        }
    } catch (Exception ex) {
        SAML2Utils.debug.error(classMethod + "Unable to get IDP AuthnContext Mapper.", ex);
        throw new SAML2Exception(ex);
    }
    return idpAuthnContextMapper;
}
Also used : SAML2Exception(com.sun.identity.saml2.common.SAML2Exception) IDPAuthnContextMapper(com.sun.identity.saml2.plugins.IDPAuthnContextMapper) SAML2InvalidNameIDPolicyException(com.sun.identity.saml2.common.SAML2InvalidNameIDPolicyException) SessionException(com.sun.identity.plugin.session.SessionException) COTException(com.sun.identity.cot.COTException) SAML2MetaException(com.sun.identity.saml2.meta.SAML2MetaException) SAML2TokenRepositoryException(org.forgerock.openam.federation.saml2.SAML2TokenRepositoryException) IOException(java.io.IOException) SAML2Exception(com.sun.identity.saml2.common.SAML2Exception)

Aggregations

SAML2Exception (com.sun.identity.saml2.common.SAML2Exception)17 ArrayList (java.util.ArrayList)10 SessionException (com.sun.identity.plugin.session.SessionException)9 List (java.util.List)9 SAML2MetaException (com.sun.identity.saml2.meta.SAML2MetaException)7 IOException (java.io.IOException)6 Date (java.util.Date)6 Map (java.util.Map)6 AuthnContext (com.sun.identity.saml2.assertion.AuthnContext)5 RequestedAuthnContext (com.sun.identity.saml2.protocol.RequestedAuthnContext)5 Response (com.sun.identity.saml2.protocol.Response)5 HttpServletResponse (javax.servlet.http.HttpServletResponse)5 SAML2TokenRepositoryException (org.forgerock.openam.federation.saml2.SAML2TokenRepositoryException)5 COTException (com.sun.identity.cot.COTException)4 Assertion (com.sun.identity.saml2.assertion.Assertion)4 AuthnStatement (com.sun.identity.saml2.assertion.AuthnStatement)4 EncryptedAssertion (com.sun.identity.saml2.assertion.EncryptedAssertion)4 IDPAuthnContextMapper (com.sun.identity.saml2.plugins.IDPAuthnContextMapper)4 HashMap (java.util.HashMap)4 Iterator (java.util.Iterator)4