idpSSOFederate.jsp revision 0fdab8904a8fe223f6934b878769fe45e7651c60
6fe48fb46e53ffc37542853a1edb74cb481b7d94Automatic Updater DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
f536382c59dd492a14667b753816d920f9981f1cTinderbox User Copyright (c) 2006 Sun Microsystems Inc. All Rights Reserved
7c1468ed500356839a4a222517364e6ce18cb1a2Tinderbox User The contents of this file are subject to the terms
c57668a2fbbe558c1bd21652813616f2f517c469Tinderbox User of the Common Development and Distribution License
a7c412f37cc73d0332887a746e81220cbf09dd00Mark Andrews (the License). You may not use this file except in
287a6a8f9040dc43560cd69cddf83bfc0f53b76fTinderbox User compliance with the License.
8de3f14f1c300c3e1ed99084cc03485b42c92bf1Tinderbox User You can obtain a copy of the License at
950d203b64f512b85fcc093ee1e9e3e531a1aea3Tinderbox User https://opensso.dev.java.net/public/CDDLv1.0.html or
dedefc0bdbb4e6e39eeb98aa2fc6883efec2ddb0Mark Andrews See the License for the specific language governing
3759f10fc543747668b1ca4b4671f35b0dea8445Francis Dupont permission and limitations under the License.
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews When distributing Covered Code, include this CDDL
3759f10fc543747668b1ca4b4671f35b0dea8445Francis Dupont Header Notice in each file and include the License file
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews If applicable, add the following below the CDDL Header,
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews with the fields enclosed by brackets [] replaced by
3759f10fc543747668b1ca4b4671f35b0dea8445Francis Dupont your own identifying information:
d5637bdbb931ff79fced3d4858d83212ea58ed15Tinderbox User "Portions Copyrighted [year] [name of copyright owner]"
9ecb5d33470ebfb3719a1b8d56bcefdf4b27f7b2Tinderbox User $Id: idpSSOFederate.jsp,v 1.6 2009/10/15 00:00:41 exu Exp $
9ecb5d33470ebfb3719a1b8d56bcefdf4b27f7b2Tinderbox User Portions Copyrighted 2013 ForgeRock AS
9ecb5d33470ebfb3719a1b8d56bcefdf4b27f7b2Tinderbox User<!-- %@ page import="com.iplanet.am.util.Debug" % -->
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews<%@ page import="com.sun.identity.shared.debug.Debug" %>
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews<%@ page import="com.sun.identity.saml2.common.SAML2Constants" %>
9ecb5d33470ebfb3719a1b8d56bcefdf4b27f7b2Tinderbox User<%@ page import="com.sun.identity.saml2.common.SAML2Exception" %>
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews<%@ page import="com.sun.identity.saml2.common.SAML2Utils" %>
9ecb5d33470ebfb3719a1b8d56bcefdf4b27f7b2Tinderbox User<%@ page import="com.sun.identity.saml.common.SAMLUtils" %>
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews<%@ page import="com.sun.identity.saml2.profile.IDPSSOUtil" %>
015055b6e23f5c08f6a5b34726f90b62597e9e45Tinderbox User<%@ page import="com.sun.identity.saml2.profile.IDPSSOFederate" %>
dedefc0bdbb4e6e39eeb98aa2fc6883efec2ddb0Mark Andrews<%@ page import="java.io.PrintWriter" %>
dc238a06bffa79de141ee7655765e2df91498a8aTinderbox User // check request, response
0e573cdd111e060e5f6c18249b5ccacbe8abe278Tinderbox User if ((request == null) || (response == null)) {
aa9c561961e9d877946ebaa8795fa2be054ab7bfEvan Hunt SAMLUtils.sendError(request, response, response.SC_BAD_REQUEST,
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater "nullInput", SAML2Utils.bundle.getString("nullInput"));
0e573cdd111e060e5f6c18249b5ccacbe8abe278Tinderbox User String cachedResID = request.getParameter(SAML2Constants.RES_INFO_ID);
aa9c561961e9d877946ebaa8795fa2be054ab7bfEvan Hunt // if this id is set, then this is a redirect from the COT
710bce1a85c96e85ca1a90471382055acd29d51fTinderbox User // cookie writer. There is already an assertion response
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater // cached in this provider. Send it back directly.
3759f10fc543747668b1ca4b4671f35b0dea8445Francis Dupont if ((cachedResID != null) && (cachedResID.length() != 0)) {
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater IDPSSOUtil.sendResponse(request, response, cachedResID);
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews } catch (SAML2Exception sse) {
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews SAML2Utils.debug.error("Error processing request " , sse);
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews SAMLUtils.sendError(request, response, response.SC_BAD_REQUEST,
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews "requestProcessingError",
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater SAML2Utils.bundle.getString("requestProcessingError") + " " +
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater String reqBinding = SAML2Constants.HTTP_REDIRECT;
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews if (request.getMethod().equals("POST")) {
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews * This call handles the federation and/or single sign on request
015055b6e23f5c08f6a5b34726f90b62597e9e45Tinderbox User * from a service provider. It processes the AuthnRequest
2ae159b376dac23870d8005563c585acf85a4b5aEvan Hunt * sent by the service provider and generates a proper
294e9d4c34462d29a3e766c88f452b46aeb3702fTinderbox User * SAML Response that contains an Assertion.
e40c4e4c17d4df338e2a7db0f84d8dbb3858964cTinderbox User * It sends back a response containing error status if
4c6bae917bec70e1fc4d1b761a9765075af78441Tinderbox User * something is wrong during the request processing.
2ae159b376dac23870d8005563c585acf85a4b5aEvan Hunt IDPSSOFederate.doSSOFederate(request, response, new PrintWriter(out, true), reqBinding );