Conversation Manager API Usage for iOS

After adding the required dependencies to your project, add the #import “HttpConversationManager.h" statement to your source file. Instantiate the conversation manager with:
The Conversation Manager exposes a single block-based API to execute network requests. The API expects an NSMutableURLRequest as input, and returns response data, an URL response, and an NSError in its completion block, which is non-nil after successful execution.

The conversation manager instance usually cannot be used immediately to execute requests; it must first be configured to handle common authentication flows such as basic authentication.

Responding to Authentication Challenges

  • Challenge filters assign authentication challenge filters to a manager instance to respond to authentication challenges. Use the addChallengeFilter: API to assign one or more challenge filters to a given manager instance.
    Challenge Filter classes must adhere to the ChallengeFilterProtocol, which declares a delegate method that is called whenever an authentication challenge occurs during request execution:

    The delegate method should supply valid credentials in its completion block and set useCredential to YES (if set to NO or the credential is nil, it is interpreted as if no credential is provided.)

  • HTTPConvAuthFlows the HttpConvAuthFlows library provides a set of authentication providers that can be used as an alternative to implementing challenge filters.
    A CommonAuthenticationConfigurator instance must first be created, followed by setting the required providers and implementing specific delegates. In this example the manager instance is set up to retrieve user credentials from the implementing class:
    You must also implement the corresponding UsernamePasswordProviderProtocol delegate - provideUsernamePasswordForAuthChallenge:completionBlock: