Skip to main content

This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.

Support Article

Redirect URL in Authentication service does not work

SA-73214

Summary



In the Interaction portal, the Redirect URL in the Authentication service does not work correctly. Post logout, the header displays in the portal on the login screen.


Error Messages



Not Applicable


Steps to Reproduce



Log out of the application. A portion of the portal displays on the login screen.


Root Cause



A defect in Pegasystems’ code or rules.
Redirect URL setting in the Custom tab  of Authentication Service rule did not work correctly.



Resolution



Perform the following local-change:
  1. Save As the pxSessionTimer rule as SessionTimer_<AppName> to the ruleset.
  2. Add the below script between the Script tags of the SessionTimer_<AppName> rule.

    if (pega.d.TimeoutWarningCountdown != null) {
        console.log("clearing timer [load]: " + pega.desktop.TimeoutWarningCountdown);
        clearTimeout(pega.desktop.TimeoutWarningCountdown);
    }
    console.log("onload inline setting timer to null");
    pega.d.TimeoutWarningCountdown = null;
    currentTimerRandID = null;
      
    function desktop_restartTimeoutWarningTimer(){
                   if (pega.desktop.TimeoutTime && pega.desktop.TimeoutTime > 0) {
                          var nTimeoutWarningTime= (pega.desktop.TimeoutTime - pega.desktop.TimeoutWarningWindow) * 60000;
                          console.log("clearing timer: " + pega.desktop.TimeoutWarningCountdown);
                          clearTimeout(pega.desktop.TimeoutWarningCountdown);
                          pega.desktop.TimeoutWarningCountdown = null;
                                
                          if (nTimeoutWarningTime >= 0) {
                                currentTimerRandID = Math.floor(100000 + Math.random() * 9000000);
                                console.log("currentTimerRandID: "+  currentTimerRandID);
                                   pega.d.TimeoutWarningCountdown = self.setTimeout("desktop_showTimeoutLogoffDialogNew('"+pega.d.TimeoutWarningWindow +"','"+currentTimerRandID+"')",nTimeoutWarningTime);
                                   console.log("created timer: " + pega.desktop.TimeoutWarningCountdown);
                          }
                   }              
    }
    /*@protected
    * Shows user a warning when their session is about to timeout so they can have the option to 
     * extend their session.  Logs the user off if they do not extend.  
     * @return $void$
    */
    function desktop_showTimeoutLogoffDialogNew(strTime, timerID) {
      if (timerID == currentTimerRandID){
                     
        var iTime = parseInt(strTime);
        iTime = iTime * 60000;
        var oSafeURL = new SafeURL("@baseclass.ShowLogoffTimer");
        oSafeURL.put("time",iTime);
        /*pega.openUrlInModal.showModalDialog*/
        console.log("displaying logoff timer");
        showJqueryModalDialog(oSafeURL,iTime, 310, 620, function(ret){           
               if (ret == null || ret == "ok") {
                     console.log("calling desktop_restartTimeoutWarningTimer from OK response from modal");
                     desktop_restartTimeoutWarningTimer();
               } else {
                     pega.u.d.gDirtyOverride = false;
                     try {
                       application.logOff(true);
                     } catch(e) {
                       pega.u.d.replace('pyActivity=LogOff&pzPrimaryPageName=pyDisplayHarness', null);
                     }
               }
        });
        /* This is not needed, was put in for testing lower timeout values
        self.setTimeout(function(){console.log("clearing timer while modal displays");clearTimeout(pega.desktop.TimeoutWarningCountdown);}, 5000);
        */
      }
      else{
           console.log("timerID: "+ timerID + "  did not match currentTimerRandID: "+ currentTimerRandID);
      }
    }

       /*  display a modal dialog  using jquery  */
    function showJqueryModalDialog(url, arDialogArguments, height, width, callbackFunction ) {
                   if(arDialogArguments) window.dialogArguments = arDialogArguments;
        var $frame = $('<div><iframe name="pzDisplayModalDialog" id="pzDisplayModalDialog" frameborder="0" src="' + ( typeof url == "string" ? url : url.toURL() ) + '" style="width:100%; height:100%"/></div>');
        var $dialogWindow = $frame.dialog({
                   autoOpen: true,
                   modal: true,
                   width: width,
                   height: height+50,
                   resizable: false,
                   autoResize: false,
                   overlay: {
                   opacity: 0.8,
                   background: "black"
                   },
                   open: function() {
                                  pzDisplayModalDialogWindow = $(this).children()[0].contentWindow;
                                  if(window.gsServerReqURI) pzDisplayModalDialogWindow.gsServerReqURI = window.gsServerReqURI;
                                                 pzDisplayModalDialogWindow.dialogArguments = window.dialogArguments;
                pzDisplayModalDialogWindow.returnValue = undefined;
                   },
                   close: function() { 
                   handleCloseJqueryModal( callbackFunction, undefined , $frame, $dialogWindow);
                   } 
        }).width(width-30).height(height).css("overflow", "hidden");
        $frame.children().on("load", function() {
                   var title = $(this).contents().find("title").html();
                   $dialogWindow.dialog('option', 'title', title);
                   pzDisplayModalDialogWindow = $(this)[0].contentWindow;
                   pzDisplayModalDialogWindow.closeModal = function() {
                                  handleCloseJqueryModal( callbackFunction, pzDisplayModalDialogWindow.returnValue, $frame, $dialogWindow );
                   };
        });
    }

    function handleCloseJqueryModal( callbackFunction, retval, frame, dialogWindow ) {
        window.returnValue = retval;
        dialogWindow.dialog('destroy');
        frame.remove();
        dialogWindow.remove();
        if( callbackFunction) {
          try {
             callbackFunction(window.returnValue);
          } catch(e) {
             alert("pega.openUrlInModal.showModalDialog - error when calling callbackfunction: '" +e.message + "'");
          }
        } 
    }

     
  3. Save As the CPMInteractionPortalHeader rule to the ruleset.
  4. Include the SessionTimer_<AppName> rule in the CPMInteractionPortalHeader rule.
  5. Navigate to the Parameters tab and set the values as required.

Note: Do not set the timeout settings in the Advanced tab of the access group for the respective operator. Additionally, do not check any checkbox in the Custom tab of the Authentication Service rule.

Suggest Edit

Published February 20, 2019 - Updated October 8, 2020

Did you find this content helpful? Yes No

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us