Support Article
SAML timeout does not redirect to login page
Summary
SAML timeout does not redirect to login page.
Error Messages
Pega application does not get redirected to login page after time out. User cannot do any action on the screen.
Steps to Reproduce
- Enable Pegarules timeout as suggested in PDN Article : https://pdn.pega.com/support-articles/saml-timeout-activity-not-being-triggered
- Set the timeout to two minutes in User Access group
Root Cause
A defect or configuration issue in the operating environment.
Resolution
Perform the following local-change:
1. Copy the Out of the Box pxSessionTimer and rename to SessionTimer<ProjectName>.
2. Replace the HTML tab HTML source as follows and save the SessionTimer<ProjectName> to the own ruleset.
<% /* BEGIN : REQUIRED FOR GADGET FUNCTIONALITY. DO NOT TOUCH BELOW LINES.*/%>
<pega:when test="pxRequestor.pyPegaDesignMode == 'true'">
<%ClipboardPage pyDefaultParams = tools.createPage("PegaGadget-SessionTimeoutMgr","myParamPage");
pyDefaultParams.adoptXMLForm("<?xml version=\"1.0\"?><pagedata><pxObjClass>PegaGadget</pxObjClass></pagedata>");%>
</pega:when>
<pega:include name='pzGadgetInclude'/>
></div>
<% ClipboardPage pyPortalPage = tools.findPage("pyPortal");
ClipboardPage myParamPage = tools.findPage("myParamPage");
String pyTimeoutTime = myParamPage.getString("pyTimeoutTime");
String pyTimeoutWarningWindow = myParamPage.getString("pyTimeoutWarningWindow");
String pyTimeoutPopupType= myParamPage.getString("pyTimeoutPopupType");
String warningMsg = tools.getLocalizedTextForString(".pyMessageLabel","TimeoutWarning");
pyPortalPage.putString("pyTimeoutTime",pyTimeoutTime);
pyPortalPage.putString("pyTimeoutWarningWindow",pyTimeoutWarningWindow);
pyPortalPage.putString("pyTimeoutPopupType",pyTimeoutPopupType);
%>
<script>
pega.d.TimeoutTime = '<%=pyTimeoutTime%>';
pega.d.TimeoutWarningWindow = '<%=pyTimeoutWarningWindow%>';
pega.d.TimeoutPopuptype = '<%=pyTimeoutPopupType%>';
pega.d.TimeoutPopupHeight = "<pega:lookup className="Rule-Obj-FieldValue" property="pyLocalizedValue"><pega:key name="pyClassName" value ="Rule-Portal" /><pega:key name="pyFieldName" value="pyTimeoutPopupType" /><pega:key name="pyFieldValue" value="WindowHeight" /></pega:lookup>";
pega.d.TimeoutPopupWidth = "<pega:lookup className="Rule-Obj-FieldValue" property="pyLocalizedValue"><pega:key name="pyClassName" value ="Rule-Portal" /><pega:key name="pyFieldName" value="pyTimeoutPopupType" /><pega:key name="pyFieldValue" value="WindowWidth" /></pega:lookup>";
pega.d.TimeoutWarning = '<%=warningMsg%>';
/*needed for CPM portals only but safe for all types of portals*/
if (pega.d.TimeoutWarningCountdown != null) {
console.log("clearing timer [load]: " + pega.desktop.TimeoutWarningCountdown);
clearTimeout(pega.desktop.TimeoutWarningCountdown);
}
pega.d.TimeoutWarningCountdown = null;
function desktop_restartTimeoutWarningTimer(){
if (pega.desktop.TimeoutTime && pega.desktop.TimeoutTime > 0) {
/* Calculate the time to initial warning in milliseconds*/
var nTimeoutWarningTime= (pega.desktop.TimeoutTime - pega.desktop.TimeoutWarningWindow) * 60000;
/* Clear the existing countdown */
console.log("clearing timer [action]: " + pega.desktop.TimeoutWarningCountdown);
clearTimeout(pega.desktop.TimeoutWarningCountdown);
if (nTimeoutWarningTime >= 0) {
console.log("setting timer: "+ pega.desktop.TimeoutWarningCountdown);
pega.desktop.TimeoutWarningCountdown = self.setTimeout("desktop_showTimeoutWarningCUSTOM()", nTimeoutWarningTime);
}
}
}
function desktop_showTimeoutWarningCUSTOM() {
window.focus();
/* Dynamically create the html for the warning because we don't want to go to the server */
alert(pega.d.TimeoutWarning);
var oSafeUrl=new SafeURL("@baseclass.CheckServerConnection");
oSafeUrl.put("Close","true");
/* Test server connection in a new window so content won't be lost even with a proxy server */
openUrlInWindow(oSafeUrl.toURL(),null,"height=" + pega.d.TimeoutPopupHeight + ",width=" + pega.d.TimeoutPopupWidth + ",top=100,left=200,status=yes,toolbar=no,menubar=no,location=no");
/* Start timer again */
desktop_restartTimeoutWarningTimer();
}
</script>
<pega:include name='pzGadgetInclude_End'/>
<% /* END : REQUIRED FOR GADGET FUNCTIONALITY. DO NOT DELETE ABOVE LINE.*/%>
Published May 13, 2016 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.