0N/A $Id: spSingleLogoutPOST.jsp,v 1.8 2009/06/24 23:05:31 mrudulahg Exp $
0N/A<%@ page import="com.sun.identity.sae.api.SecureAttrs" %>
0N/A<%@ page import="com.sun.identity.saml.common.SAMLUtils" %>
0N/A<%@ page import="com.sun.identity.saml2.common.SAML2Utils" %>
0N/A<%@ page import="com.sun.identity.saml2.common.SAML2Constants" %>
1418N/A<%@ page import="com.sun.identity.saml2.common.SAML2Exception" %>
644N/A<%@ page import="com.sun.identity.saml2.jaxb.entityconfig.SPSSOConfigElement" %>
644N/A<%@ page import="com.sun.identity.saml2.meta.SAML2MetaUtils" %>
0N/A<%@ page import="com.sun.identity.saml2.meta.SAML2MetaManager" %>
0N/A<%@ page import="com.sun.identity.saml2.profile.CacheObject" %>
0N/A<%@ page import="com.sun.identity.saml2.profile.SPCache" %>
0N/A<%@ page import="com.sun.identity.saml2.profile.SPSingleLogout" %>
0N/A<%@ page import="com.sun.identity.saml2.profile.IDPCache" %>
0N/A<%@ page import="com.sun.identity.saml2.protocol.LogoutRequest" %>
0N/A<%@ page import="com.sun.identity.saml2.profile.IDPProxyUtil" %>
0N/A<%@ page import="java.util.HashMap" %>
0N/A<%@ page import="java.util.List" %>
0N/A<%@ page import="java.util.Map" %>
0N/A<%@ page import="java.util.Properties" %>
0N/A<%@ page import="org.owasp.esapi.ESAPI" %>
0N/A<%@ page import="java.io.PrintWriter" %>
(CacheObject) SPCache.relayStateHash.remove(relayState);
relayState = (String) tmpRs.getObject();
if (!ESAPI.validator().isValidInput("HTTP Query String: " + relayState, relayState, "HTTPQueryString", 2000, true)) {
SPSingleLogout.processLogoutResponse(request, response, samlResponse, relayState);
String inRes = infoMap.get("inResponseTo");
if (origLogoutRequest != null && !origLogoutRequest.equals("")) {
IDPProxyUtil.sendProxyLogoutResponse(response, request,
origLogoutRequest.getID(), infoMap,
origLogoutRequest.getIssuer().getValue(),
SAML2Utils.debug.error("Error processing LogoutResponse :", sse);
SAML2Utils.bundle.getString("LogoutResponseProcessingError") +
" " + sse.getMessage());
SAML2Utils.debug.error("Error processing LogoutResponse ",e);
SAML2Utils.bundle.getString("LogoutResponseProcessingError") +
" " + e.getMessage());
if (!SPCache.isFedlet) {
isRelayStateURLValid = relayState != null && !relayState.isEmpty()
&& ESAPI.validator().isValidInput("RelayState", relayState, "URL", 2000, true);
List<String> spMetaAliases = manager.getAllHostedServiceProviderMetaAliases("/");
if (spMetaAliases != null && !spMetaAliases.isEmpty()) {
metaAlias = spMetaAliases.get(0);
isRelayStateURLValid = relayState != null && !relayState.isEmpty()
&& ESAPI.validator().isValidInput("RelayState", relayState, "URL", 2000, true);
response.sendRedirect(relayState);
} catch (java.io.IOException ioe) {
if (SAML2Utils.debug.messageEnabled()) {
<jsp:forward page="/saml2/jsp/default.jsp?message=spSloSuccess" />
if (!SPCache.isFedlet) {
SPSingleLogout.processLogoutRequest(request,response, new PrintWriter(out, true),
SAML2Utils.debug.error("Error processing LogoutRequest :", sse);
SAML2Utils.bundle.getString("LogoutRequestProcessingError")
+ " " + sse.getMessage());
SAML2Utils.debug.error("Error processing LogoutRequest ",e);
SAML2Utils.bundle.getString("LogoutRequestProcessingError")
+ " " + e.getMessage());
String realm = SAML2MetaUtils.getRealmByMetaAlias(metaAlias);
SAML2MetaManager mm = SAML2Utils.getSAML2MetaManager();
String entityId = mm.getEntityByMetaAlias(metaAlias);
SPSSOConfigElement spConfig = mm.getSPSSOConfig(realm, entityId);
appSLOUrlStr = SAML2Utils.getAttributeValueFromSPSSOConfig(
spConfig, SAML2Constants.SAE_SP_LOGOUT_URL);
if (SAML2Utils.debug.messageEnabled()) {
Map hp = SAML2Utils.getSAEAttrs(
realm, entityId, SAML2Constants.SP_ROLE, appSLOUrlStr);
String encAlg = (String)hp.get(
String encStrength = (String)hp.get(
if (SecureAttrs.SAE_CRYPTO_TYPE_SYM.equals(cryptoType)) {
if (secret == null || secret.length() == 0) {
"spSLOPOST:SAE:processing App SLO:getSAEAttrs no secret/key");
String returnURL = request.getRequestURL()+
"?"+request.getQueryString()+"&"+
SecureAttrs.SAE_PARAM_APPRETURN+"=true";
SecureAttrs sa = SecureAttrs.getInstance(saInstanceName);
SecureAttrs.SAE_CONFIG_ENCRYPTION_KEY_STRENGTH,encStrength); }
SecureAttrs.init(saInstanceName, cryptoType, prop);
sa = SecureAttrs.getInstance(saInstanceName);
String encodedString = sa.getEncodedString(map, secret, encSecret);
if (appSLOUrl.indexOf("?") > 0) {
if (SAML2Utils.debug.messageEnabled()) {
SAML2Utils.debug.message("spSLOPOST:SAE:about to redirect"+
"spSLOPOST:SAE:SecureAttrs.getEncodedStr failed");