spSingleLogoutInit.jsp revision 9740fa737ef2ed9453ab46d145777dbbbf6a747b
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Copyright (c) 2006 Sun Microsystems Inc. All Rights Reserved
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte The contents of this file are subject to the terms
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte of the Common Development and Distribution License
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (the License). You may not use this file except in
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte compliance with the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte You can obtain a copy of the License at
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte https://opensso.dev.java.net/public/CDDLv1.0.html or
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte See the License for the specific language governing
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte permission and limitations under the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte When distributing Covered Code, include this CDDL
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Header Notice in each file and include the License file
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte If applicable, add the following below the CDDL Header,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte with the fields enclosed by brackets [] replaced by
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan your own identifying information:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Portions Copyrighted [year] [name of copyright owner]"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $Id: spSingleLogoutInit.jsp,v 1.13 2009/10/15 00:01:11 exu Exp $
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Portions Copyrighted 2012-2013 ForgeRock AS
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte<%@ page import="com.sun.identity.plugin.session.SessionManager" %>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte<%@ page import="com.sun.identity.plugin.session.SessionException" %>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte<%@ page import="com.sun.identity.saml.common.SAMLUtils" %>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte<%@ page import="com.sun.identity.saml2.common.SAML2Utils" %>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte<%@ page import="com.sun.identity.saml2.common.SAML2Constants" %>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte<%@ page import="com.sun.identity.saml2.jaxb.entityconfig.SPSSOConfigElement" %>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte<%@ page import="com.sun.identity.saml2.meta.SAML2MetaManager" %>
<%@ page import="com.sun.identity.saml2.meta.SAML2MetaUtils" %>
<%@ page import="com.sun.identity.saml2.common.SAML2Exception" %>
<%@ page import="com.sun.identity.saml2.profile.LogoutUtil" %>
<%@ page import="com.sun.identity.saml2.profile.SPCache" %>
<%@ page import="com.sun.identity.saml2.profile.SPSingleLogout" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="java.util.List" %>
<%@ page import="org.owasp.esapi.ESAPI" %>
if (!ESAPI.validator().isValidInput("HTTP URL: " + RelayState,
if (RelayState == null || RelayState.isEmpty()) {
if (!ESAPI.validator().isValidInput("RelayState", RelayState, "HTTPURI", 1024, true)) {
ssoToken = SessionManager.getProvider().getSession(request);
if (SAML2Utils.debug.messageEnabled()) {
SAML2Utils.debug.message("No session.");
if (!SPCache.isFedlet) {
if (RelayState != null && !RelayState.isEmpty() &&
response.sendRedirect(RelayState);
<jsp:forward page="/saml2/jsp/default.jsp?message=spSloSuccess"/>
String[] values = SessionManager.getProvider().
getProperty(ssoToken, SAML2Constants.SP_METAALIAS);
if (values != null && values.length > 0) {
spEntityID = request.getParameter("spEntityID");
if ((spEntityID == null) || (spEntityID.length() == 0)) {
if ((spMetaAliases != null) && !spMetaAliases.isEmpty()) {
metaAlias = (String) spMetaAliases.get(0);
manager.getSPSSOConfig("/", spEntityID);
metaAlias = spConfig.getMetaAlias();
SessionManager.getProvider().invalidateSession(
if (SAML2Utils.debug.messageEnabled()) {
SAML2Utils.debug.message("No session.");
if (RelayState != null && SAML2Utils.isRelayStateURLValid(request, RelayState, SAML2Constants.SP_ROLE)) {
response.sendRedirect(RelayState);
<jsp:forward page="/saml2/jsp/default.jsp?message=spSloSuccess"/>
String idpEntityID = request.getParameter("idpEntityID");
String binding = LogoutUtil.getSLOBindingInfo(request, metaAlias,
SAML2Constants.SP_ROLE, idpEntityID);
spEntityID = manager.getEntityByMetaAlias(metaAlias);
String realm = SAML2MetaUtils.getRealmByMetaAlias(metaAlias);
realm, spEntityID, SAML2Constants.SLO_SERVICE, binding))
SAML2Utils.bundle.getString("unsupportedBinding"));
* this parameter is /realm_name/SP_name.
if (SPCache.isFedlet) {
String sessionIndex = request.getParameter("SessionIndex");
if ((sessionIndex == null) || (sessionIndex.length() == 0)) {
SAML2Utils.bundle.getString("nullSessionIndex"));
paramsMap.put("SessionIndex", sessionIndex);
String nameID = request.getParameter("NameIDValue");
if ((nameID == null) || (nameID.length() == 0)) {
SAML2Utils.bundle.getString("nullNameID"));
spEntityID = manager.getEntityByMetaAlias(metaAlias);
SAMLUtils.sendError(request, response,
SAML2Utils.bundle.getString("nullIDPEntityID"));
paramsMap.put("metaAlias", metaAlias);
paramsMap.put("idpEntityID", idpEntityID);
if (RelayState == null || RelayState.isEmpty()) {
RelayState = SAML2Utils.getAttributeValueFromSSOConfig(
realm, spEntityID, SAML2Constants.SP_ROLE,
String sessionIndex = request.getParameter("sessionIndex");
SPSingleLogout.initiateLogoutRequest( request,response,
if (RelayState != null && !RelayState.isEmpty() &&
response.sendRedirect(RelayState);
<jsp:forward page="/saml2/jsp/default.jsp?message=spSloSuccess"/>
SAML2Utils.debug.error("Error sending Logout Request " , sse);
SAML2Utils.bundle.getString("LogoutRequestCreationError") + " " +
sse.getMessage());
SAML2Utils.debug.error("Error initializing Request ",e);
SAML2Utils.bundle.getString("LogoutRequestCreationError") + " " +
e.getMessage());