MobileFirst OAuth and Logout -


i have test application accesses 2 adapters:

  1. a javascript adapter protected securitytest referencing realm
  2. a java adapter method protected oauth scope corresponding same realm.

if follow sequence works expected:

  1. attempt access js adapter, challenged, authenticate, data.
  2. wl.client.isuserauthenticated() , wl.client.getuserinfo() behave expected
  3. logout using wl.client.logout()
  4. wl.client.isuserauthenticated() shows i'm not authenticated
  5. a second attempt access js adapter causes challenge, expeccted.

however, java adapter logout() seems not behave expected.

  1. starting no session, attempt access java adapter, challenge happens expected , data
  2. i can access js adapter without further challenge , wl.client.getuserinfo() calls gives expected results.
  3. wl.client.logout() appears work, in wl.client.isuserauthenticated() shows i'm not authenticated
  4. but call java adapter still works without further challenge
  5. a call js adapter result in challenge

if i'm running in browser simulator environment can destroy oauth session using command:

 localstorage.removeitem("com.worklight.oauth.idtoken") 

the question is:

should wl.client.logout() method have destroyed oauth session? if not api should using?

with oauth, logout 'works' differently. see following user documentation topic (search "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

the login/logout api:
wlclient login/logout api enables user log in , log out of specific realm, updating server side security state. however, in new oauth-based security model, security credentials kept in access token on client side. result using api cause inconsistent state, example, in client logged out of realm on server side still holds valid token realm on client side. solve inconsistency, recommended re-obtain access token, using obtainauthorizationheaderforscope method, after successful login or logout.

for example, consider client passed security checks realm1 , realm2, , later calls logout(realm2). in case, access token on client still contain security credentials both realm1 , realm2, , client use token access protected resources. refresh token, is, obtain token realm1 only, client calls obtainauthorizationheaderforscope without logged out realm realm2.

in javascript equivalent call is:

 wlauthorizationmanager.obtainauthorizationheader("somerealm") 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -