I have a test application that accesses two Adapters:
- A JavaScript adapter protected by a SecurityTest referencing a realm
- A Java adapter with a method protected by an OAuth scope corresponding to that same realm.
If I follow this sequence everything works as expected:
- Attempt to access the JS adapter, I get challenged, authenticate, get data.
- WL.Client.isUserAuthenticated() and WL.Client.getUserInfo() now behave as expected
- Logout using WL.Client.logout()
- WL.Client.isUserAuthenticated() now shows I'm not authenticated
- A second attempt to access the JS adapter causes another Challenge, as expeccted.
However, with the Java Adapter logout() seems not to behave as expected.
- Starting with no session, attempt to access the Java adapter, the challenge happens as expected and I get to my data
- I can now access the JS adapter without further challenge and the WL.Client.getUserInfo() calls gives the expected results.
- WL.Client.logout() appears to work, in that WL.Client.isUserAuthenticated() now shows I'm not authenticated
- But a call to the Java adapter still works without further challenge
- A call to the JS adapter does result in a challenge
If I'm running in my browser simulator environment I can destroy the OAuth session by using this command:
localStorage.removeItem("com.worklight.oauth.idtoken")
The question is:
Should the WL.Client.logout() method have destroyed the OAuth session? If not what API should I be using?
With OAuth, logout 'works' differently. See the following user documentation topic (search for "logout"): http://www-01.ibm.com/support/knowledgecenter/SSHS8R_7.0.0/com.ibm.worklight.dev.doc/dev/c_oauth_security_model.html?lang=en
In JavaScript the equivalent call is: