Reputation: 1026
Hi my resource adapter is like this
@Path("/branches")
public class MyResourceAdapter {
....
@GET
@Produces(MediaType.TEXT_PLAIN)
@Path("/getDetails")
@OAuthSecurity(scope = "getDetailsAuthScope")
public String getDetails() throws Exception {
String url = "...some url which returns data---";
HttpGet request = new HttpGet(url);
CloseableHttpClient client = HttpClients.createDefault();
CloseableHttpResponse response = client.execute(request);
HttpEntity entity = response.getEntity();
String responseString = EntityUtils.toString(entity);
return responseString;
}
}
I have set the successStateExpirationSec as 40 seconds. And in my javascript i am invoking the adapter like
function getData(type) {
alert(type);
var req = new WLResourceRequest('/adapters/LoginAdapter/branches/getDetails', WLResourceRequest.GET);
return req.send().then(function (response) {
alert(JSON.stringify(response));
return response.responseJSON;
});
}
Just to test this if have
setTimeout(function () {
getData('60 timeout');
}, 60000);
setTimeout(function () {
getData('20 timeout');
}, 20000);
During logout
WLAuthorizationManager.logout(securityCheckName);
In brief, After 20 seconds i am making a Http request and i am getting the response. After 40 seconds the session expires. After 60 seconds i am making the Http request again and i did not get any response which is as expected.
But i need to find a way to logout the app when the session expires. Is there any callbacks for this? Also after logging in i get the response from the previous hit.
Can anyone help me on this?
Upvotes: 0
Views: 242
Reputation: 3553
If you knew the session expiration time is 40 seconds, You can set the security check expiration time to the same. So, you don't need to perform logout operation as the security check expired after the specified amount of time.
The following are steps to override the default expiration time of security check.
Upvotes: 0