Creating the client-side authentication components
Create a native Android application and add the MobileFirst native APIs following the documentation.
Add an Activity, LoginAdapterBasedAuth, that will handle and present the login form.
Remember to add this Activity to the AndroidManifest.xml file as well.
Create a MyChallengeHandler class as a subclass of ChallengeHandler.
isCustomResponse checks every custom response received from MobileFirst Server to see if that’s the challenge we are expecting. In the example adapter code a authRequired variable is sent for this purpose.
handleChallenge is called after the isCustomResponse method returned true.
Here we use this method to present our login form.
In submitLogin, if the user asked to abort this action we use the submitFailure() method, otherwise we invoke our adapter authentication procedure using the submitAdapterAuthentication() method.
In the Main Activity class, connect to the MobileFirst server, register your challengeHandler and invoke the protected adapter procedure.
The procedure invocation will trigger the MobileFirst server to send a challenge that will trigger our challengeHandler.