ChallengeContext
public final class ChallengeContext
The ChallengeContext
is a container of challenge mechanisms that get invoked when an authorization challenge is returned from a request to a protected resource.
-
Get or set the session delegate that handles authentication requests. Refer to URLSessionDelegate. Default is
nil
.Declaration
Swift
public var serverTrustDelegate: URLSessionDelegate?
-
The timeout interval for the request, in seconds. The default is 30 seconds.
Declaration
Swift
public var timeoutInterval: TimeInterval = 30.0
-
Returns the shared defaults object.
Declaration
Swift
public static let shared = ChallengeContext()
-
Gets the list of registered mechanism identifiers.
Declaration
Swift
public var mechanismIdentifiers: [String]
-
This method registers an instance of the
ChallengeProtocol
.Declaration
Swift
public func register(_ mechanism: ChallengeProtocol)
-
This method registers an array of
ChallengeProtocol
instances.Declaration
Swift
public func register(_ mechanisms: [ChallengeProtocol])
-
Invokes a known policy enforcement point.
Declaration
Swift
public func invoke(_ endpointUrl: String, token: OAuthToken, completion: @escaping (ChallengeResult) -> Void)
-
Submits the mechanism for verification.
Declaration
Swift
public func verify(_ endpointUrl: String, token: OAuthToken, data: [String: Any], completion: @escaping (ChallengeResult) -> Void)
-
Unenroll a challenge mechanism for a device.
Declaration
Swift
public func unenroll(_ endpointUrl: String, token: OAuthToken, enrollmentType: String, completion: @escaping (UnenrollResult) -> Void)
-
Enroll a challenge mechanism for a device.
Remark
The HTTP method is supplied from the
EnrollmentProtocol
and supports POST and GET only. All other values will result in an error.Declaration
Swift
public func enroll(_ endpointUrl: String, token: OAuthToken, enrollment: EnrollmentProtocol, completion: @escaping (EnrollmentResult) -> Void)
-
Executes a query for pending transactions requiring a challenge.
Declaration
Swift
public func pendingTransactions(_ endpointUrl: String, token: OAuthToken, nextTransactionOnly: Bool, orderBy: ComparisonResult = .orderedDescending, completion: @escaping (PendingTransactionsResult) -> Void)
-
Executes a query for pending transactions requiring a challenge.
Declaration
Swift
public func pendingTransactions(_ endpointUrl: String, token: OAuthToken, orderBy: ComparisonResult = .orderedDescending, completion: @escaping (PendingTransactionsResult) -> Void)
-
Executes a query for a pending transaction requiring a challenge.
Declaration
Swift
public func pendingTransactions(_ endpointUrl: String, token: OAuthToken, transactionId: String, completion: @escaping (PendingTransactionsResult) -> Void)