Question

I am facing to a trouble with 2 adapters based authentication. My app is agenda (hybrid app). All adapter's functions must be protected by security.

my app uses adapters based authentication, like written in samples on DeveloperWorks.

My first adapter (loginAdapter) is dedicated for login (beginning of the mobile app). I developed a handler (handlerLogin, mobile side) with methods isCustomResponse, handlechallenge, etc.. This adapter works. This adapter allows to get a userId from login and password.

As soon as connected, the user can download his agenda. The mobile calls an other adapter based auth (calendarAdapter). I have an other handler (handlerCalendar) with methods (isCustomResponse, handlechallenge).

When the mobile calls the method getCalendarData (protected method, CalendarAdapter), the server detects that the user is not registered for this adapter, that is why the server send an error (structure authrequired + errorMessage) via the function onAuthRequired.

At this step, all works fine.

Actually, the trouble comes from, that, the first handler (handlerLogin) catches this error, whereas it schould be the second handler (handlerCalendar).

Given that it is catched by the handlerLogin, isCustomResponse and handlechallenge are called, and I do not have the expected result ! I do not know why.

Why it is not catched by the handlerCalendar ?

I verified my code, variable's names, files, etc.. All things are ok.

For informations, I first declared the handlerLogin before the CalendarLogin.

Do you have any ideas, suggestions ??

Thank you in advance

Was it helpful?

Solution

It looks like you used the same realm.

The isCustomResponse function job is to find out if this challenge-handler should take care of this specific request. If you use the same realm for both adapters then the 2 challenge-handlers will react to it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top