Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>When you're using Worklight Adapter to call DP MPGW, the sequence as below <br/> <strong>Request</strong>: <br/> WL Client App --> WL Server (Adapter) --> DP MPGW<br/> <strong>Response</strong>: <br/> DP MPGW --> WL Server (Adapter) --> WL Client App<br/></p> <p>NOTE: The session id before/after WL server (Adapter) is not the same. If you want to do SSO, you need to pass your LTPA token in adapter to the backend DP. Here's the sample code for you.<br/></p> <p>Step1. Get LTPA token method (in you ChallengeHandler.js file)</p> <pre><code>sampleAppRealmChallengeHandler.isCustomResponse = function(response) { if (!response || response.responseText === null) { return false; } var indicatorIdx = response.responseText.search('j_security_check'); if (indicatorIdx &gt;= 0){ return true; }else if(response &amp;&amp; (response.responseJSON) &amp;&amp; (response.responseJSON['WL-Authentication-Success']) &amp;&amp; (response.responseJSON['WL-Authentication-Success']['WASLTPARealm'])){ // set ltpaToken when login success var realm = response.responseJSON['WL-Authentication-Success']['WASLTPARealm']; ltpaToken = realm.attributes.LtpaToken; console.log('Get ltpa token success: '+ltpaToken); } return false; </code></pre> <p>};</p> <p>Step2. Call procedure method (in client App js file)<br/></p> <pre><code>// define global LTPA token variable var ltpaToken = null; function getAccountInfo(){ // check ltpa token is not null, or get the ltap token from login user in WASLTPARealm if(!ltpaToken){ if(WL.Client.isUserAuthenticated('WASLTPARealm')){ var attrs = WL.Client.getUserInfo('WASLTPARealm', 'attributes'); if(attrs){ ltpaToken = attrs.LtpaToken; console.log('Set ltpaToken again: '+ltpaToken); } } } // Pass LTPA token from client App to WL server(adapter) var token = {'LtpaToken2' : ltpaToken}; var invocationData = { adapter: "DummyAdapter", procedure: "getAccountInfo", parameters: [token] }; WL.Client.invokeProcedure(invocationData, { onSuccess: getSecretData_Callback, onFailure: getSecretData_Callback }); </code></pre> <p>}</p> <p>Step3. Pass LTPA token to backend DP in adapter</p> <pre><code>function getServices( token) { path = getPath("path/to/services"); var input = { method : 'post', returnedContentType : 'json', path : path, cookies: token }; return WL.Server.invokeHttp(input); </code></pre> <p>}</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload