Support Article
Call Pega logoff when user closes browser tab
SA-45454
Summary
When application users closes the Pega window clicking the cross button and re-launch the Pega application, there are requester lock in the application logs and also the gets error in the screen.
The application user closes the Pega window before it completely populate data. User wants to implement Pega logoff mechanism when the user clicks the browser cross button.
Error Messages
Status fail
Message There has been an issue; please consult your system administrator
Operator ID Unauthenticated or not available
Requestor ID No ID available
Timestamp Tue Sep 12 16:06:48 EDT 2017
Engine Version PegaRULES 7.20 ML2 (PRPC-7.2.2-60)
There are lots of “Requestor Lock Exceptions” in the logs
Steps to Reproduce
This is user specific requirement:
1. Launch Pega application from a non Pega application environment. kerberos authentication is done and after series of SOAP calls, which fetches data, the Pega screen is displayed.
2. Set the timeout for this operation for two minutes. There are situations when the SOAP call takes more than two minutes.
3. Close the browser tab window by clicking the cross button, and then immediately re-launch the Pega application.
Root Cause
When user closes the browser tab and re-launches Pega application, behind the scene the authenticated cookie from the previous session still persists.
Resolution
Implement Pega log-off mechanism when the users clicks the browser cross button.
Steps:
- Create a section
- Include the below mentioned script
- Include the section in portal header
- This script call logoff on closing the browser.
pega.util.Event.removeListener(window,"beforeunload",pega.u.d.harnessBeforeUnload);
window.onbeforeunload=function()
{
var safeURL=SafeURL_createFromURL(<pegaserver/pega load balancer url>);
safeURL.put('pyActivity','Code-Security.LogOff');
var oXmlHttp;
if(typeof XMLHttpRequest !='undefined')
{
oXmlHttp= new XMLHttpRequest();
}
else{
oXmlHttp - new ActiveXObject("Microsoft.XMLHTTP");
}
oXmlHttp.open("GET",safeURL.toURL(),false);
oXmlHttp.send();
}
window.onbeforeunload=function()
{
var safeURL=SafeURL_createFromURL(<pegaserver/pega load balancer url>);
safeURL.put('pyActivity','Code-Security.LogOff');
var oXmlHttp;
if(typeof XMLHttpRequest !='undefined')
{
oXmlHttp= new XMLHttpRequest();
}
else{
oXmlHttp - new ActiveXObject("Microsoft.XMLHTTP");
}
oXmlHttp.open("GET",safeURL.toURL(),false);
oXmlHttp.send();
}
Published March 8, 2018 - 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.