AuthenticationChallengeResponsable

public protocol AuthenticationChallengeResponsable : AnyObject

Protocol indicates that an authentication challenge could be handled.

  • Called when a session level authentication challenge is received. This method provide a chance to handle and response to the authentication challenge before downloading could start.

    Note

    This method is a forward from URLSessionDelegate.urlSession(:didReceiveChallenge:completionHandler:). Please refer to the document of it in URLSessionDelegate.

    Default Implementation

    Declaration

    Swift

    func downloader(
        _ downloader: ImageDownloader,
        didReceive challenge: URLAuthenticationChallenge,
        completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void)

    Parameters

    downloader

    The downloader which receives this challenge.

    challenge

    An object that contains the request for authentication.

    completionHandler

    A handler that your delegate method must call.

  • Called when a task level authentication challenge is received. This method provide a chance to handle and response to the authentication challenge before downloading could start.

    Default Implementation

    Declaration

    Swift

    func downloader(
        _ downloader: ImageDownloader,
        task: URLSessionTask,
        didReceive challenge: URLAuthenticationChallenge,
        completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void)

    Parameters

    downloader

    The downloader which receives this challenge.

    task

    The task whose request requires authentication.

    challenge

    An object that contains the request for authentication.

    completionHandler

    A handler that your delegate method must call.