Adapter-based authentication in native Android applications
This tutorial illustrates the native Android client-side authentication components for adapter-based authentication.
Prerequisite: Make sure that you read Adapter-based authentication first.
Creating the client-side authentication components
- Create a native Android application and add the MobileFirst native APIs as explained in the documentation.
- Add an activity,
LoginAdapterBasedAuth, which will handle and present the login form.
- Remember to add this activity to the
- Create a
MyChallengeHandlerclass as a subclass of
isCustomResponsemethod checks every custom response received from MobileFirst Server to verify whether it is the expected challenge. In the sample adapter code, a
authRequiredvariable is sent for this purpose.
handleChallengemethod is called after the
- Use this method to present the login form.
- In the
submitLoginmethod, if the user asked to abort this action, use the
submitFailure()method, otherwise invoke the adapter authentication procedure by using the
- In the main activity class, connect to MobileFirst Server, register your
challengeHandlermethod, and invoke the protected adapter procedure.
The procedure invocation triggers MobileFirst Server to send a challenge that will trigger the