
SAP Web Dispatcher logout rules are used with a custom logout page to make sure that all system sessions are closed when logging out of SAP Fiori launchpad.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<!-- Instead of this, you may include a jQuery version from your internal network if available-->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
</head>
<body>
<em id="message">Logout is in progress...</em>
<script>
(function () {
"use strict";
/*global document, jQuery*/
var iPending = 0;
function finishLogout() {
iPending -= 1;
if (iPending <= 0) { //logout done for all URLs
//Change message text on logout page
document.getElementById("message").innerHTML = "You are logged out";
//(3) Client-side redirect
document.location = "http://www.sap.com"; //REPLACE with your actual logout page
}
}
function requestHanaLogout(sSystem) {
iPending += 1;
jQuery.ajax({
type: "HEAD",
url: "/sap;o=" + sSystem + "/hana/xs/formLogin/token.xsjs",
headers: {
"X-CSRF-Token": "Fetch"
},
}).done(function (oData, oStatus, oXhr) {
jQuery.ajax({
type: "POST",
url: "/sap;o=" + sSystem + "/hana/xs/formLogin/logout.xscfunc",
headers: {
"X-CSRF-Token": oXhr.getResponseHeader("X-CSRF-Token")
}
}).always(finishLogout);
}).fail(finishLogout);
}
function requestLogout(sUrl) {
iPending += 1;
jQuery.get(sUrl).always(finishLogout);
}
//(1) ABAP platform: Add such a line for each system with the corresponding logout URL
requestLogout("/sap;o=<ABAP system ID>/public/bc/icf/logoff");
//(2) SAP HANA platform: Add such a line for each system with the system ID from the Web Dispatcher rule
requestHanaLogout("<HANA system ID>");
}());
</script>
</body>
</html>