MNFAuthenticationProviderProtocol

Objective-C

@protocol MNFAuthenticationProviderProtocol <NSObject>

Swift

protocol MNFAuthenticationProviderProtocol : NSObjectProtocol

MNFAuthenticationProtocol is implemented by an authentication provider.

  • @description Gets the authentication headers provided in an authentication provider and adds them to every URL request.

    Declaration

    Objective-C

    - (NSDictionary *)getHeaders;

    Swift

    func getHeaders() -> [AnyHashable : Any]!

    Return Value

    NSDictionary A dictionary of headers.

  • @description Gets the cookies provided in an authentication provider and adds them to every URL request.

    Declaration

    Objective-C

    - (NSArray<NSHTTPCookie *> *)getCookies;

    Swift

    func getCookies() -> [HTTPCookie]!

    Return Value

    NSArray An array of NSHTTPCookie.

  • This method provides a chance to modify the url request before it is sent or do other preparation. If no modification is done simply return the preRequest parameter in the completion block.

    Declaration

    Objective-C

    - (void)prepareRequest:(NSURLRequest *)preRequest
            withCompletion:(void (^)(NSURLRequest *))completion;

    Swift

    optional func prepare(_ preRequest: URLRequest!) async -> URLRequest?

    Parameters

    preRequest

    The request to be made before any modification.

    completion

    A completion block returning a new request to be used. This request can be the same requeste as preRequest or a modified version of it.