IDPInterceptor
public class IDPInterceptor : Interceptor
The IDP HTTP Interceptor to authenticate HTTP-Requests
-
The IDPSession delegate used for the intercept
Declaration
Swift
public weak var delegate: IDPSessionDelegate?
-
Initialize with IDPSession
Declaration
Swift
public init(session: IDPSession, delegate: IDPSessionDelegate? = nil)
Parameters
session
the session to use
delegate
optional delegate
-
Intercepting a
Chain
to set the Authorization headerNote
when the session cannot provide a valid accessToken upon intercept and the delegate is nil or
delegate.shouldAuthorize(request:)
returnstrue
, the interceptor invalidates the request chain with a HTTPError.authentication error.Declaration
Swift
public func intercept(chain: Chain) -> AnyPublisher<HTTPResponse, HTTPClientError>
Parameters
chain
the request chain to proceed authenticated hereafter
Return Value
Publisher that continues the chain authenticated