CLASS

HaapiManager

Contents

public final class HaapiManager: NSObject

HaapiManager manages the communication flow between a client and the Curity Identity Server by providing data models objects for the different steps of the flow, which can be used in the UI components of the client application.

A HAAPI flow can be initiated by calling the start function, which will provide a first result. Afterwards, use either submitForm or followLink to move forward. All these methods return an HaapiResult, which encloses a HaapiRepresentation, a ProblemRepresentation or an Error.

A HaapiRepresentation represents a new step in the flow. A ProblemRepresentation indicates that a problem has occurred. An Error encloses an exception, in which case the flow should be stopped.

The purpose of using this class is to obtain an OAuthAuthorizationResponseStep that contains the authorization response details.

Properties

isSupported

public static var isSupported: Bool

A Boolean that indicates whether HAAPI is supported on a particular device.

dpop

public var dpop: Dpop?

Returns the last used Dpop.

Methods

init(haapiConfiguration:)

public init(haapiConfiguration: HaapiConfigurable) throws

Creates an instance of HaapiManager based on the provided HaapiConfigurable.

Parameters

Name Description
haapiConfiguration The configuration used to build this instance.

deinit

deinit

close()

public func close()

Closes this instance, which closes the underlying HaapiTokenManager instance.

start(completionHandler:)

public func start(completionHandler: @escaping HaapiCompletionHandler)

Starts the HAAPI flow by performing an authorization request.

The client_id, response_type and redirect_uri parameters are always added based on the configuration values.

Parameters

Name Description
completionHandler A completion handler that is called when start is complete.

start()

public func start() async -> HaapiResult

Starts the HAAPI flow by performing an authorization request.

The client_id, response_type and redirect_uri parameters are always added based on the configuration values.

submitForm(_:parameters:completionHandler:)

public func submitForm(_ form: FormActionModel,
                       parameters: [String: Any],
                       completionHandler: @escaping HaapiCompletionHandler)

Submits a form action to move forward in the HAAPI flow.

The parameters supplied to this method override the field values present in the form. If the parameters don't include a value for a given form field name, the original value in the form is used. Parameters whose key is not included in the form fields names are not included in the request

Parameters

Name Description
form The form action to be submitted
parameters Parameters to be sent in the form. Keys should match the corresponding form field names.
completionHandler A completion handler that is called when submitForm is complete.

submitForm(_:parameters:)

public func submitForm(_ form: FormActionModel,
                       parameters: [String: Any]) async -> HaapiResult

Submits a form action to move forward in the HAAPI flow.

The parameters supplied to this method override the field values present in the form. If the parameters don't include a value for a given form field name, the original value in the form is used. Parameters whose key is not included in the form fields names are not included in the request

Parameters

Name Description
form The form action to be submitted
parameters Parameters to be sent in the form. Keys should match the corresponding form field names.
completionHandler A completion handler that is called when submitForm is complete.

followLink(_:completionHandler:)

public func followLink(_ link: Link, completionHandler: @escaping HaapiCompletionHandler)

Follows a link to an alternative HAAPI flow.

Links are always followed using a GET request.

followLink(_:)

public func followLink(_ link: Link) async -> HaapiResult

Follows a link to an alternative HAAPI flow.

Links are always followed using a GET request.

Parameters

Name Description
link The link to be followed.