idpSSOInit.jsp revision 0e107349d3f7763a9c67fb2f32c86c11364c72cf
98N/A<%--
98N/A DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
98N/A
98N/A Copyright (c) 2006 Sun Microsystems Inc. All Rights Reserved
98N/A
98N/A The contents of this file are subject to the terms
98N/A of the Common Development and Distribution License
98N/A (the License). You may not use this file except in
98N/A compliance with the License.
98N/A
98N/A You can obtain a copy of the License at
98N/A https://opensso.dev.java.net/public/CDDLv1.0.html or
98N/A opensso/legal/CDDLv1.0.txt
98N/A See the License for the specific language governing
98N/A permission and limitations under the License.
98N/A
98N/A When distributing Covered Code, include this CDDL
98N/A Header Notice in each file and include the License file
98N/A at opensso/legal/CDDLv1.0.txt.
98N/A If applicable, add the following below the CDDL Header,
98N/A with the fields enclosed by brackets [] replaced by
98N/A your own identifying information:
98N/A "Portions Copyrighted [year] [name of copyright owner]"
98N/A
98N/A $Id: idpSSOInit.jsp,v 1.9 2009/06/24 23:05:30 mrudulahg Exp $
98N/A
98N/A--%>
98N/A
98N/A<%--
98N/A Portions Copyrighted 2014 ForgeRock AS
355N/A--%>
98N/A
98N/A<!-- %@ page import="com.iplanet.am.util.Debug" % -->
98N/A<%@ page import="com.sun.identity.shared.debug.Debug" %>
98N/A
98N/A<%@ page import="com.sun.identity.saml2.common.SAML2Constants" %>
98N/A<%@ page import="com.sun.identity.saml2.common.SAML2Exception" %>
98N/A<%@ page import="com.sun.identity.saml2.common.SAML2Utils" %>
156N/A<%@ page import="com.sun.identity.saml.common.SAMLUtils" %>
98N/A<%@ page import="com.sun.identity.saml2.profile.IDPSSOUtil" %>
98N/A<%@ page import="java.io.PrintWriter" %>
98N/A
98N/A<%--
98N/A idpssoinit.jsp initiates Unsolicited SSO at the Identity Provider.
98N/A
98N/A Following are the list of supported query parameters :
98N/A
156N/A Required parameters to this jsp are :
156N/A
98N/A Query Parameter Name Description
98N/A
98N/A 1. metaAlias MetaAlias for Identity Provider. The format of
98N/A this parameter is /realm_name/IDP name.
98N/A
98N/A 2. spEntityID Identifier for Service Provider.
183N/A
183N/A Optional Query Parameters :
183N/A
183N/A Query Parameter Name Description
183N/A
98N/A 3. RelayState Target URL on successful complete of SSO/Federation
98N/A
98N/A 4. RelayStateAlias Specify the parameter(s) to use as the RelayState.
98N/A e.g. if the request URL has :
98N/A ?TARGET=http://server:port/uri&RelayStateAlias=TARGET
98N/A then the TARGET query parameter will be interpreted as
98N/A RelayState and on successful completion of
98N/A SSO/Federation user will be redirected to the TARGET URL.
98N/A
98N/A
98N/A 5. NameIDFormat NameID format Identifier Value.
98N/A For example,
98N/A urn:oasis:names:tc:SAML:2.0:nameid-format:persistent
98N/A urn:oasis:names:tc:SAML:2.0:nameid-format:transient
98N/A
98N/A 6. binding URI value that identifies a SAML protocol binding to
98N/A used when returning the Response message.
98N/A The supported values are :
98N/A HTTP-Artifact
98N/A HTTP-POST
98N/A
98N/A NOTE: There are other SAML defined values for these
98N/A which are not supported by FM/AM.
98N/A 7. affiliationID affiliation entity ID
98N/A--%>
98N/A<%
156N/A // Retreive the Request Query Parameters
156N/A // metaAlias and spEntiyID are the required query parameters
98N/A // metaAlias - Identity Provider Entity Id
98N/A // spEntityID - Service Provider Identifier
98N/A try {
156N/A String cachedResID = request.getParameter(SAML2Constants.RES_INFO_ID);
156N/A // if this id is set, then this is a redirect from the COT
98N/A // cookie writer. There is already an assertion response
98N/A // cached in this provider. Send it back directly.
98N/A if ((cachedResID != null) && (cachedResID.length() != 0)) {
156N/A IDPSSOUtil.sendResponse(request, response, cachedResID);
156N/A return;
98N/A }
156N/A
156N/A String metaAlias = request.getParameter("metaAlias");
98N/A if ((metaAlias == null) || (metaAlias.length() == 0)) {
98N/A SAMLUtils.sendError(request, response, response.SC_BAD_REQUEST,
98N/A "nullIDPEntityID",
98N/A SAML2Utils.bundle.getString("nullIDPEntityID"));
98N/A return;
98N/A }
98N/A String spEntityID = request.getParameter("spEntityID");
98N/A
98N/A if ((spEntityID == null) || (spEntityID.length() == 0)) {
98N/A SAMLUtils.sendError(request, response, response.SC_BAD_REQUEST,
98N/A "nullSPEntityID",
98N/A SAML2Utils.bundle.getString("nullSPEntityID"));
98N/A return;
98N/A }
98N/A // get the nameIDPolicy
98N/A String nameIDFormat =
98N/A request.getParameter(SAML2Constants.NAMEID_POLICY_FORMAT);
98N/A String relayState = SAML2Utils.getRelayState(request);
98N/A IDPSSOUtil.doSSOFederate(request,response,new PrintWriter(out, true),null,spEntityID,
98N/A metaAlias, nameIDFormat,relayState);
98N/A } catch (SAML2Exception sse) {
355N/A SAML2Utils.debug.error("Error processing request " , sse);
98N/A SAMLUtils.sendError(request, response, response.SC_BAD_REQUEST,
98N/A "requestProcessingError",
98N/A SAML2Utils.bundle.getString("requestProcessingError") + " " +
sse.getMessage());
return;
} catch (Exception e) {
SAML2Utils.debug.error("Error processing request ",e);
SAMLUtils.sendError(request, response, response.SC_BAD_REQUEST,
"requestProcessingError",
SAML2Utils.bundle.getString("requestProcessingError") + " " +
e.getMessage());
return;
}
%>