Creating the client-side authentication components
Create a native iOS application and add the IBM MobileFirst Platform Foundation native APIs following the documentation.
In your storyboard, add a ViewController containing a login form.
Create a MyChallengeHandler class as a subclass of ChallengeHandler.
We will implement some of the ChallengeHandler methods to respond to the challenge.
Before calling your protected adapter, make sure to register your challenge handler using WLClient's registerChallengeHandler method.
The isCustomResponse method of the challenge handler is invoked each time that a response is received from the server. It is used to detect whether the response contains data that is related to this challenge handler. It must return either true or false.
If isCustomResponse returns true, the framework calls the handleChallenge method. This function is used to perform required actions, such as hide application screen and show login screen.
onSuccess and onFailure get triggers when the authentication ends.
You need to call submitSuccess to inform the framework that the authentication process is over, and allow the invocation’s success handler to be called.
In your LoginViewController, when the user clicks to submit his credentials, you need to call submitLoginForm to send the credentials to the MobileFirst Server.