AuthenticationInterceptor

public final class AuthenticationInterceptor<AuthenticatorType> : RequestInterceptor, Sendable where AuthenticatorType : Authenticator

The AuthenticationInterceptor class manages the queuing and threading complexity of authenticating requests. It relies on an Authenticator type to handle the actual URLRequest authentication and Credential refresh.

Typealiases

  • Type of credential used to authenticate requests.

    Declaration

    Swift

    public typealias Credential = AuthenticatorType.Credential

Helper Types

  • Type that defines a time window used to identify excessive refresh calls. When enabled, prior to executing a refresh, the AuthenticationInterceptor compares the timestamp history of previous refresh calls against the RefreshWindow. If more refreshes have occurred within the refresh window than allowed, the refresh is cancelled and an AuthorizationError.excessiveRefresh error is thrown.

    See more

    Declaration

    Swift

    public struct RefreshWindow

Properties

Initialization

Adapt

  • Declaration

    Swift

    public func adapt(_ urlRequest: URLRequest, for session: Session, completion: @escaping @Sendable (Result<URLRequest, any Error>) -> Void)

Retry