Search in sources :

Example 1 with IDPSSOFederateRequest

use of org.forgerock.openam.saml2.IDPSSOFederateRequest in project OpenAM by OpenRock.

the class IDPSSOFederate method process.

@VisibleForTesting
void process(final HttpServletRequest request, final HttpServletResponse response, final PrintWriter out, final String reqBinding) throws FederatedSSOException, IOException, SessionException {
    if (cookieRedirector.needSetLBCookieAndRedirect(request, response, true)) {
        return;
    }
    final IDPRequestValidator validator = saml2ActorFactory.getIDPRequestValidator(reqBinding, isFromECP);
    //IDP Proxy with introduction cookie case.
    //After reading the introduction cookie, it redirects to here.
    String requestID = request.getParameter("requestID");
    if (idpProxyCase(requestID, request, response)) {
        return;
    }
    // Fetch a number of properties about the request.
    String idpMetaAlias = validator.getMetaAlias(request);
    String realm = validator.getRealmByMetaAlias(idpMetaAlias);
    String idpEntityID = validator.getIDPEntity(idpMetaAlias, realm);
    SAML2IdentityProviderAdapter idpAdapter = validator.getIDPAdapter(realm, idpEntityID);
    String reqID = request.getParameter(REQ_ID);
    if (null != auditor && StringUtils.isNotEmpty(reqID)) {
        auditor.setRequestId(reqID);
    }
    IDPSSOFederateRequest reqData = new IDPSSOFederateRequest(reqID, realm, idpAdapter, idpMetaAlias, idpEntityID);
    reqData.setEventAuditor(auditor);
    // id should be there.
    if (StringUtils.isEmpty(reqData.getRequestID())) {
        SAMLAuthenticator samlAuthenticator = saml2ActorFactory.getSAMLAuthenticator(reqData, request, response, out, isFromECP);
        samlAuthenticator.authenticate();
    } else {
        SAMLAuthenticatorLookup samlLookup = saml2ActorFactory.getSAMLAuthenticatorLookup(reqData, request, response, out);
        samlLookup.retrieveAuthenticationFromCache();
    }
}
Also used : SAMLAuthenticator(org.forgerock.openam.saml2.SAMLAuthenticator) IDPSSOFederateRequest(org.forgerock.openam.saml2.IDPSSOFederateRequest) SAMLAuthenticatorLookup(org.forgerock.openam.saml2.SAMLAuthenticatorLookup) IDPRequestValidator(org.forgerock.openam.saml2.IDPRequestValidator) SAML2IdentityProviderAdapter(com.sun.identity.saml2.plugins.SAML2IdentityProviderAdapter) VisibleForTesting(org.forgerock.util.annotations.VisibleForTesting)

Aggregations

SAML2IdentityProviderAdapter (com.sun.identity.saml2.plugins.SAML2IdentityProviderAdapter)1 IDPRequestValidator (org.forgerock.openam.saml2.IDPRequestValidator)1 IDPSSOFederateRequest (org.forgerock.openam.saml2.IDPSSOFederateRequest)1 SAMLAuthenticator (org.forgerock.openam.saml2.SAMLAuthenticator)1 SAMLAuthenticatorLookup (org.forgerock.openam.saml2.SAMLAuthenticatorLookup)1 VisibleForTesting (org.forgerock.util.annotations.VisibleForTesting)1