idpSSOFederate.jsp revision 0fdab8904a8fe223f6934b878769fe45e7651c60
015055b6e23f5c08f6a5b34726f90b62597e9e45Tinderbox User<%--
6fe48fb46e53ffc37542853a1edb74cb481b7d94Automatic Updater DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
c78c39caab4cf8b5daefc9c65878f7f5ed3eb7a0Tinderbox User
f536382c59dd492a14667b753816d920f9981f1cTinderbox User Copyright (c) 2006 Sun Microsystems Inc. All Rights Reserved
ab496cc3df1648e9ad992a87c35c2c0870fdc69dTinderbox User
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.
dedefc0bdbb4e6e39eeb98aa2fc6883efec2ddb0Mark Andrews
8de3f14f1c300c3e1ed99084cc03485b42c92bf1Tinderbox User You can obtain a copy of the License at
950d203b64f512b85fcc093ee1e9e3e531a1aea3Tinderbox User https://opensso.dev.java.net/public/CDDLv1.0.html or
b886b04d8d2b085cbf3e1bf4442dee87f43ba5e4Tinderbox User opensso/legal/CDDLv1.0.txt
dedefc0bdbb4e6e39eeb98aa2fc6883efec2ddb0Mark Andrews See the License for the specific language governing
3759f10fc543747668b1ca4b4671f35b0dea8445Francis Dupont permission and limitations under the License.
e676a596869d8a80a644c99a848afb53d1c5975eMark Andrews
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews When distributing Covered Code, include this CDDL
3759f10fc543747668b1ca4b4671f35b0dea8445Francis Dupont Header Notice in each file and include the License file
d5637bdbb931ff79fced3d4858d83212ea58ed15Tinderbox User at opensso/legal/CDDLv1.0.txt.
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]"
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews
9ecb5d33470ebfb3719a1b8d56bcefdf4b27f7b2Tinderbox User $Id: idpSSOFederate.jsp,v 1.6 2009/10/15 00:00:41 exu Exp $
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews
9ecb5d33470ebfb3719a1b8d56bcefdf4b27f7b2Tinderbox User Portions Copyrighted 2013 ForgeRock AS
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews--%>
9ecb5d33470ebfb3719a1b8d56bcefdf4b27f7b2Tinderbox User
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews
9ecb5d33470ebfb3719a1b8d56bcefdf4b27f7b2Tinderbox User
efb0e886f18894a1d2489f1ad74ad14b579e11c7Mark Andrews
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews
9ecb5d33470ebfb3719a1b8d56bcefdf4b27f7b2Tinderbox User<!-- %@ page import="com.iplanet.am.util.Debug" % -->
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews<%@ page import="com.sun.identity.shared.debug.Debug" %>
9ecb5d33470ebfb3719a1b8d56bcefdf4b27f7b2Tinderbox User
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" %>
aa9c561961e9d877946ebaa8795fa2be054ab7bfEvan Hunt<%
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"));
3759f10fc543747668b1ca4b4671f35b0dea8445Francis Dupont return;
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater }
aa9c561961e9d877946ebaa8795fa2be054ab7bfEvan Hunt
dc238a06bffa79de141ee7655765e2df91498a8aTinderbox User try {
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 return;
cdfc81e048bd34c1d628380247bda6b80a89e20eAutomatic Updater }
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") + " " +
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews sse.getMessage());
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews return;
16f6050f29b6b0422cee858e609f65e474e70ef2Tinderbox User }
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater String reqBinding = SAML2Constants.HTTP_REDIRECT;
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews if (request.getMethod().equals("POST")) {
eabc9c3c07cd956d3c436bd7614cb162dabdda76Mark Andrews reqBinding = SAML2Constants.HTTP_POST;
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews }
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews /*
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.
294e9d4c34462d29a3e766c88f452b46aeb3702fTinderbox User */
2ae159b376dac23870d8005563c585acf85a4b5aEvan Hunt IDPSSOFederate.doSSOFederate(request, response, new PrintWriter(out, true), reqBinding );
2ae159b376dac23870d8005563c585acf85a4b5aEvan Hunt%>
2ae159b376dac23870d8005563c585acf85a4b5aEvan Hunt