User:Revansx/Session Notification of Renewal

This script is aimed at wikis using a 3rd party identity provider provided via an immutable session header. Specifically, CA Policy Agent.


 * The problem this script solves is when the 3rd party immutable session provider sets a 15 minute timer on session expiration due to client inactivity.. which happens all the time when people spend more than 15 minutes editing a page without saving.. when the session expires.. the CA Policy agent forces a redirect to renew the session, but for edit pages with pending edits, the pending edits get lost.

Pasting this javascript code into your "Mediawiki:Common.js" page will cause a little bright yellow pop-up dialog box to show up in any page with "action=edit" or "veaction=edit" in the url. This is to notify the user that they may need to re-new their session before attempting to save their work. The javascript dialog box links to the Pasting this javascript code into your "Mediawiki:Common.js" page will cause a little bright yellow pop-up dialog box to show up in any page with "action=edit" or "veaction=edit" in the url. This is to notify the user that they made need to re-new their session before attempting to save their work. The javascript dialog box links to the page "renew.php" that you should implement somewhere on your server that the user can access with an expired session. "renew.php" is essentially a user initiated request that forces the SSO to renew the session.

renew.php code
Renew the session  function mynotify3  { setTimeout(function { document.body.innerHTML = "This page was generated simply for the purpose of renewing the session. It will automatically close in 3 seconds."; }, 1); } function mynotify2  { setTimeout(function { document.body.innerHTML = "This page was generated simply for the purpose of renewing the session. It will automatically close in 2 seconds."; }, 1000); } function mynotify1  { setTimeout(function { document.body.innerHTML = "This page was generated simply for the purpose of renewing the session. It will automatically close in 1 seconds."; }, 2000); } function closeWindow { setTimeout(function { window.close; }, 3000); } window.onload = mynotify3; window.onload = mynotify2; window.onload = mynotify1; window.onload = closeWindow;