Question

Client code attempts to invoke adapter. This triggers authentication to the appropriate realm. It is possible that the user does not have suitable credentials and eventually wants to stop trying. I can provide a "Give Up" button, and we can use the challegeHandler to tell Worklight to stop the authentication effort like this:

this.challengeHandler.submitFailure();

This works to the extent that the login attempt terminates, but it seems that code calling the adapter gets no callback and hence any Deferred objects that might be waiting for resolution are left in limbo.

The question is whether we can arrange to get the authentication failure back to the caller of the adapter procedure?

Was it helpful?

Solution

I have been informed of a workaround to this issue whereby you call:

challengeHandler.activeRequest.onUnresponsiveHost() 

Before actually calling:

challengeHandler.submitFailure()

This will trigger the failure and reject the deferred as intended.

This is a workaround though so it might not work in future versions. I am going to raise a request for enhancement (link pending) and I would appreciate it if you could vote it up as well to ensure this functionality is available in the future.

OTHER TIPS

First of all, submitFailure() will not call adapter. It will notify client side framework that authentication has failed completely so the framework will dispose of any stored requests that are waiting for authentication to finish.

If you want to wipe user identity on a server side you have two options

  1. create an adapter procedure which doesn't require authentication and call WL.Server.setActiveUser("realm-name",null). This will terminate any userIdentity.
  2. call WL.Client.logout("realm-name") in your app
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top