This tutorial illustrates the native Android client-side authentication components for form-based authentication. Make sure you read Form-based authentication first.
Creating the client-side authentication components
Create a native Android application and add the MobileFirst native APIs following the documentation.
Add an Activity, LoginFormBasedAuth, 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. MyChallengeHandler should implement isCustomResponse which checks every custom response received from MobileFirst Server to see if this is the challenge we are expecting.
handleChallenge is called after the isCustomResponse method returned true.
Here we use this method to present our login form.
submitLogin is called by the login form. If the user asked to abort this action we use submitFailure() method, otherwise we use submitLoginForm() method to send our input data to the authenticator.
In the Main Activity class connect to MobileFirst server, register your challengeHandler and invoke the protected adapter procedure.
The procedure invocation will trigger MobileFirst server to send a challenge that will trigger our challengeHandler.