idpMNIRequestInit.jsp revision e8721886dbfd32e88cc7077cbee4b6bb1b44b443
1788N/A<%--
1788N/A DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
1788N/A
1788N/A Copyright (c) 2006 Sun Microsystems Inc. All Rights Reserved
1788N/A
1788N/A The contents of this file are subject to the terms
1788N/A of the Common Development and Distribution License
1788N/A (the License). You may not use this file except in
1788N/A compliance with the License.
1788N/A
1788N/A You can obtain a copy of the License at
1788N/A https://opensso.dev.java.net/public/CDDLv1.0.html or
1788N/A opensso/legal/CDDLv1.0.txt
1788N/A See the License for the specific language governing
1788N/A permission and limitations under the License.
1788N/A
1788N/A When distributing Covered Code, include this CDDL
1788N/A Header Notice in each file and include the License file
1788N/A at opensso/legal/CDDLv1.0.txt.
1788N/A If applicable, add the following below the CDDL Header,
5575N/A with the fields enclosed by brackets [] replaced by
1788N/A your own identifying information:
1788N/A "Portions Copyrighted [year] [name of copyright owner]"
1788N/A
1788N/A $Id: idpMNIRequestInit.jsp,v 1.10 2009/10/15 00:00:40 exu Exp $
1788N/A
1788N/A--%>
1788N/A
1788N/A
1788N/A
1788N/A
1788N/A<%@ page import="com.sun.identity.shared.debug.Debug" %>
1788N/A<%@ page import="com.sun.identity.federation.common.FSUtils" %>
1788N/A<%@ page import="com.sun.identity.saml.common.SAMLUtils" %>
1788N/A<%@ page import="com.sun.identity.saml2.common.SAML2Constants" %>
1788N/A<%@ page import="com.sun.identity.saml2.common.SAML2Utils" %>
2899N/A<%@ page import="com.sun.identity.saml2.common.SAML2Exception" %>
2899N/A<%@ page import="com.sun.identity.saml2.meta.SAML2MetaUtils" %>
1788N/A<%@ page import="com.sun.identity.saml2.profile.DoManageNameID" %>
1788N/A<%@ page import="java.util.HashMap" %>
1788N/A
3817N/A<%--
3817N/A idpMNIRequestInit.jsp initiates the ManageNameIDRequest at
3817N/A the Identity Provider.
1788N/A Required parameters to this jsp are :
2967N/A - metaAlias - identifier for Identity Provider
2967N/A - spEntityID - identifier for Service Provider
2967N/A - requestType - the request type of ManageNameIDRequest (Terminate / NewID)
1938N/A
1788N/A Somce of the other optional parameters are :
1788N/A - relayState - the target URL on successful complete of the Request
1788N/A
1788N/A Check the SAML2 Documentation for supported parameters.
3736N/A
1788N/A--%>
1788N/A
1788N/A<%
1788N/A // Retreive the Request Query Parameters
1788N/A // metaAlias, spEntiyID and RequestType are the required query parameters
1788N/A // metaAlias - Hosted Entity Id
2980N/A // spEntityID - Service Provider Identifier
2980N/A // requestType - the request type of ManageNameIDRequest (Terminate / NewID)
2980N/A // affiliationID - affiliation entity ID
1788N/A // Query parameters supported will be documented.
1788N/A
1788N/A if (FSUtils.needSetLBCookieAndRedirect(request, response, true)) {
3438N/A return;
3438N/A }
3438N/A
3438N/A try {
1788N/A String metaAlias = request.getParameter("metaAlias");
4337N/A if ((metaAlias == null) || (metaAlias.length() == 0)) {
1788N/A SAMLUtils.sendError(request, response, response.SC_BAD_REQUEST,
5575N/A "nullIDPEntityID",
5575N/A SAML2Utils.bundle.getString("nullIDPEntityID"));
5575N/A return;
3817N/A }
String idpEntityID =
SAML2Utils.getSAML2MetaManager().getEntityByMetaAlias(metaAlias);
String realm = SAML2MetaUtils.getRealmByMetaAlias(metaAlias);
String spEntityID = request.getParameter("spEntityID");
if ((spEntityID == null) || (spEntityID.length() == 0)) {
SAMLUtils.sendError(request, response, response.SC_BAD_REQUEST,
"nullSPEntityID",
SAML2Utils.bundle.getString("nullSPEntityID"));
return;
}
String binding = DoManageNameID.getMNIBindingInfo(request, metaAlias,
SAML2Constants.IDP_ROLE, spEntityID);
if (!SAML2Utils.isIDPProfileBindingSupported(
realm, idpEntityID, SAML2Constants.MNI_SERVICE, binding))
{
SAMLUtils.sendError(request, response, response.SC_BAD_REQUEST,
"unsupportedBinding",
SAML2Utils.bundle.getString("unsupportedBinding"));
return;
}
String requestType = request.getParameter("requestType");
if ((requestType == null) || (requestType.length() == 0)) {
SAMLUtils.sendError(request, response, response.SC_BAD_REQUEST,
"nullRequestType",
SAML2Utils.bundle.getString("nullRequestType"));
return;
}
String RelayState = request.getParameter(SAML2Constants.RELAY_STATE);
String affiliationID =
request.getParameter(SAML2Constants.AFFILIATION_ID);
HashMap paramsMap = new HashMap();
paramsMap.put("metaAlias", metaAlias);
paramsMap.put("spEntityID", spEntityID);
paramsMap.put("requestType", requestType);
paramsMap.put(SAML2Constants.ROLE, SAML2Constants.IDP_ROLE);
paramsMap.put(SAML2Constants.BINDING, binding);
if (RelayState != null) {
paramsMap.put(SAML2Constants.RELAY_STATE, RelayState);
}
if (affiliationID != null) {
paramsMap.put(SAML2Constants.AFFILIATION_ID, affiliationID);
}
Object sess = SAML2Utils.checkSession(request,response,
metaAlias, paramsMap);
if (sess == null) {
return;
}
DoManageNameID.initiateManageNameIDRequest(request,response,
metaAlias, spEntityID, paramsMap);
if (binding.equalsIgnoreCase(SAML2Constants.SOAP)) {
if (RelayState != null) {
response.sendRedirect(RelayState);
} else {
%>
<jsp:forward page="/saml2/jsp/default.jsp?message=mniSuccess" />
<%
}
}
} catch (SAML2Exception e) {
SAML2Utils.debug.error("Error processing ManageNameID Request ",e);
SAMLUtils.sendError(request, response, response.SC_BAD_REQUEST,
"requestProcessingMNIError",
SAML2Utils.bundle.getString("requestProcessingMNIError"));
}
%>