Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    How to use the RPCManager.setLoginRequiredMarker("...")

    I use SmartGWT 4.1 and SiteMinder for SSO

    For Session Timeout and Relogin case, I found the function RPCManager.setLoginRequiredMarker("...") and there is html file loginRequiredMarker.html in SmartGWT download zip.

    My question is, if I don't want to change my existing login page can I set the content in loginRequiredMarker.html as String into RPCManager.setLoginRequiredMarker("...")?

    If I have some marker for the http response when session timeout case, (mainly from SiteMinder agent...), I should customize the javascript inside loginRequiredMarker.html for our case?

    Is there any sample of how to use RPCManager.setLoginRequiredMarker("...")?

    thx in advanced

    #2
    Hello wing.t.lee,

    did you already see https://isomorphic.atlassian.net/wik...mcat+JDBCRealm regarding the sample of how to use RPCManager.setLoginRequiredMarker()?

    Best regards,
    Blama

    Comment


      #3
      Dear Blama,

      You page is very useful and thx a lot.

      And want to ask also that if I cannot directly add the below code onto my login page, is it the same if we set as String in RPCManager.setLoginRequiredMarker()?

      Also, if we know that the http response from my authentication server should include some text pattern such as "document.AUTOS UBMIT.submit()" and "siteminderagent" in http reponse text, how can I add this in the marker?


      Code:
      <SCRIPT>//'"]]>>isc_loginRequired
      //
      // Embed this whole script block VERBATIM into your login page to enable
      // SmartClient RPC relogin. 
      while (!window.isc && document.domain.indexOf(".") != -1) {    
      try {         
      if (parent.isc == null) {            
      document.domain = document.domain.replace(/.*?\./, '');            
      continue;        
      }        
      break;    
      } catch (e) {        
      document.domain = document.domain.replace(/.*?\./, '');   
      }
      } 
      var isc = top.isc ? top.isc : window.opener ? window.opener.isc : null;
      if (isc) isc.RPCManager.delayCall("handleLoginRequired", [window]);
      </SCRIPT>
      Thx a lot you information!
      wing.t.lee
      Last edited by wing.t.lee; 9 Feb 2014, 19:16.

      Comment


        #4
        I have a quick testing on following...

        1. I load the bundled loginRequiredMarker.html (from SmartGWT 4.1d Power Edition) into a String variable, and I have check the variable that the content is exact the same as loginRequiredMarker.html content

        2. I put the following code at the end of onModuleLoad()
        Code:
        public void onModuleLoad() {
        ...
        
        RPCManager.setCredentialsURL(GWT.getModuleBaseURL());
        RPCManager.setLoginRequiredMarker(getLoginRequiredMarkerString());
        RPCManager.setHandleErrorCallback(new HandleErrorCallback(){
        	@Override
        	public void handleError(DSResponse response, DSRequest request) {
        		if (response.getStatus()== DSResponse.STATUS_FAILURE) {
        			SC.say(CONSTANTS.serverError());
        		}				
        	}			
        });
        
        }
        3. I test the login of my application and the onModuleLoad is run with new login session and do some function with DMI to server side and everything normal

        4. wait for more than 30 minutes until session time

        5. Access the same DMI function and the DMI response cannot receive (obviously it is session timeout already), but it not perform any redirection or page reload. And I try to capture the browser traffic by HttpWatch and attached image is what I found

        6. I manually reload the page and it bring me back to login page again.

        Is there any hint or suggestion why I cannot redirect to login page at step 5?

        (I have attached the HttpWatch result in Text Format for reference...)
        Attached Files

        Comment


          #5
          You don't appear to have read the relogin docs at all..

          Setting loginRequiredMarker to the exact contents of loginRequireMarker.html will do nothing at all. What you need to do is ensure that your server's response session timeout response *actually contains* whatever you set as the loginRequiredMarker.

          When the loginRequiredMarker is detected, the loginRequired event is raised. The error handler does not fire.

          All of this is explained in the documentation.

          Comment


            #6
            After reading your reply and I have change my implementation to as following

            Code:
                   private void initRPCManager(){
                    RPCManager.setCredentialsURL(GWT.getModuleBaseURL());
                          RPCManager.setLoginRequiredMarker(“siteminderagent”);
                          RPCManager.setHandleErrorCallback(new HandleErrorCallback(){
                                 @Override
                                 public void handleError(DSResponse response, DSRequest request) {
                                       if (response.getStatus()== DSResponse.STATUS_FAILURE) {
                                              SC.say(CONSTANTS.serverError());
                                       }                          
                                 }                    
                          });
                   }
            and for session timeout, we will redirect to site minder URL and get the following http response content

            Code:
            <HTML><HEAD><TITLE></TITLE></HEAD>
            <BODY onLoad="document.AUTOSUBMIT.submit();">This page is used to hold your data while you are being authorized for your request.<BR><BR>
            You will be forwarded to continue the authorization process. If this does not happen automatically, please click the Continue button below.
            <FORM NAME="AUTOSUBMIT" METHOD="POST" ENCTYPE="application/x-www-form-urlencoded" 
            ACTION="https://smlogin-dev.....net/siteminderagent/SSOlogin.fcc?TYPE=33554433&REALMOID=06-0006fa98-cbd5-1ff2-964c-5cc6a97c5074&GUID=&SMAUTHREASON=0&METHOD=POST&SMAGENTNAME=$SM$XqZqG7tSV12iczK2Dg8uYYYc0CUSxMF7fv64MkzsBq%2fcP7ExIEB4QD3EZetZLP6SKC5l596eOjje87gBA1TYR9Jk34ntJTeE&TARGET=$SM$HTTPS%3a%2f%2f.....">
            <INPUT 
            TYPE="HIDDEN" 
            NAME="SMPostPreserve" 
            VALUE="CQ9/7JIvfsrhmkhmBcmY5/2FhtDcj8RKFsF0yD5MfIbM1cCLk3lyt2dOzATHqFCsfGlVtgxmcuw9zJmlGcfs8/SZ9dWO8MmAugGtyhRkkIu4TK5nFw0M4VExAl/5mDvAJk1seMUiqh4R8npZ0+4izUp4Hw/e0Tk5A7lGkllbENT3jTToaPy71nMkEUMjzYPDzib8FMO6EvyXH8PiqLwqS6BqoJaIxpo4EHHG/Ym4rzKejG6NlW2IPGTGw9tW0mcAA2vlpL9d0Wk5VtrxT6waxOiuEfgkmEair9/CemwMOdnN65B16wMNrdjs5AWTHxZyGd9tldtKSxNPdfDBphS7u5RTqmSwB1cB8E+40z3mQMxJ22LYlqAfjmYUieJWO9Q1mWX6k3QKnVctaDakoAqTfHScIkOGA6/bGtS8kR3bY0pQdZQ5EJtvS1m+HcLiIaowXDAun1kz4oWys3eL2mpq8GqCVCjh3mT8lz5uenO8AIo0WlXJ8B/eBhCzskDwrqyTMaUFDu28IVknd8BEmld7OeFEa8+QoyxLU1ov8JQMeYdc52Iptn/sDBAQggQflHOCLCpO6Uk6thNpdzLQdIGntasSePakgB9nIk7R+NDQTGUV6h50ZOHox2dorfoW9MzrEDS3FMmxaL3WYcVeWJ/+jYUunMO2FV+9xe1E9dts7TSpTJ/RKi5DRS7ft6gMCLwMDTuihHi9Jn3r34pYPWxYB1cpe5usB6bgXwdGy/l4yF7gxgZJsbO+fbLwIdD13LVSlkdjWUPcFKqNVea3kbvn5OtuVBrj6d5prGYjPAiW/BNgDzllqbM4yprIS2JJUmhr9yvOJOnL4Mf2PWvJ/zoCjNBCAjR225itNC8syefiE1WlmRFFQ5iMIX/qGhplo9E+JD7rDRXhYdhkOGcvHPQYl0XM3ZBaTEYYHET2S02u7E2qPr/illFOF+rmYPIogIqYE/sPyy9K/U2W2kn+Fjhwp97a5wnbNxPZZYYsRXMxao5nKjPhAzcCpXfDexQTlG4jNJLQJ8u89DL7MOy8QVaD/c1aegYrO+hKjD7Aozc5EEZ2BKxd8dlxDth/r5XcbLett/WsP+UTONeNOXChOmLdIp4TLmf5TFJYbi8MbkwPvKTO72WHNvMOGIdkJICJS2XwNPwtIpqRywiv9UkdD7Fsigmw6W+L3krkRZpafcT/JZ40awCxrKzodWwbVXZkkPBHKVLdAJRUoA3WWEnhGPV1hKIEK6PQ5/D1Kvp9aeUFCXzwF4nyMyZROfPR/UHbPs76q7ybAm8xyiA95AZYMmzV3FmmLfOF2LcAT2PtoIWYo5A5lz3yzJcXHdLKxEacc2dNoDi3la7SWi1eV0DpqUtqYKe0LaWRkA3XXP0bYmnqwdol7Z2nOPSqGmGIdW0hfa65">
            <INPUT TYPE="SUBMIT" VALUE="Continue">
            </FORM>
            </BODY>
            </HTML>
            You can see that we set the loginRequiredMarker = "siteminderagent" which should be found in the response content

            But I cannot found SmartGWT have any action to redirect the browser onto login page.

            Is there any issue on my coding... or some issue on the relogin function for SmartGWT 4.1 ...

            Comment


              #7
              I have some changes as following and have some progress

              Code:
              RPCManager.setCredentialsURL(GWT.getModuleBaseURL());
              RPCManager.setLoginRequiredMarker(getLoginRequiredMarkerString());
              
              RPCManager.setLoginRequiredCallback(new LoginRequiredCallback(){
              	@Override
              	public void loginRequired(int transactionNum, RPCRequest rpcRequest, RPCResponse rpcResponse) {
              		SC.say ("session expired");
              	}
              });
              
              RPCManager.setHandleErrorCallback(new HandleErrorCallback(){
              	@Override
              	public void handleError(DSResponse response, DSRequest request) {
              		if (response.getStatus()== DSResponse.STATUS_FAILURE) {
              			SC.say(CONSTANTS.serverError());
              		}				
              	}			
              });
              We can now detect the session timeout and trigger the relogin flow, but found the following issues
              1. As you see that that I have put SC.say("session timeout"); in the login required handler... And I can see the SC say box but it auto close immediately after 2-3 seconds. Can we prompt for the user manual click action?

              2. During session timeout I try to click a DMI to trigger my relogin flow and I found the following URL to server first (HTTP response = 200)
              Code:
              https://..../myshowcase/showcase/sc/IDACall?isc_rpc=1&...
              but a few image downloads than it start to redirect... But the issue is, the destination page of redirect referred page is
              Code:
              https://..../myshowcase/showcase/sc/system/helper/empty.html
              and finally it redirect to SSO Login page, but after relogin, it finally redirect to following page.
              Code:
              https://..../myshowcase/showcase/sc/system/helper/empty.html
              Expected result is, the SmartGWT will keep the existing page and continuously submit the original DMI action, but I cannot make it happen
              Code:
              https://..../myshowcase/showcase/sc/IDACall?isc_rpc=1&...
              3. if I want to detect more than one marker values (e.g. "siteminderagent" and "document.AUTOSUBMIT.submit()") so that no mis-redirection occur... How can I do it? Is the marker support regexp?

              Is there any issue on my implementation that cause above behavior?

              Thx in advanced!

              Comment


                #8
                As mention that I have 3 questions in last post,

                For second question, I can resolve this by adding reload
                Code:
                RPCManager.setLoginRequiredCallback(new LoginRequiredCallback(){
                	@Override
                	public void loginRequired(int transactionNum, RPCRequest rpcRequest, RPCResponse rpcResponse) {
                		SC.say ("session expired");
                		com.google.gwt.user.client.Window.Location.reload();
                	}
                });
                But is there anyone have idea on the (1) that the SC.say auto close...
                Also who have try multiple marker value for the relogin scenario? how can I do it in API?

                Thx in advanced

                Comment

                Working...
                X