FRURLProtocol
@objc
open class FRURLProtocol : URLProtocol
extension FRURLProtocol: URLSessionDataDelegate
-
TokenManagementPolicy for URLProtocol
Declaration
Swift
@objc public static var tokenManagementPolicy: TokenManagementPolicy? -
AuthorizationPolicy for URLProtocol
Declaration
Swift
@objc public static var authorizationPolicy: AuthorizationPolicy? -
FRSecurityConfiguration for URLProtocol - Used for SSL Pinning
Declaration
Swift
@objc public static var frSecurityConfiguration: FRSecurityConfiguration?
-
Returns a canonical version of the given request
Declaration
Swift
public override class func canonicalRequest(for request: URLRequest) -> URLRequestParameters
requestA request to make canonical
Return Value
The canonical form of the given request
-
Declaration
Swift
public override class func canInit(with request: URLRequest) -> Bool -
Starts loading, and validating the request
Declaration
Swift
public override func startLoading() -
Stops loading, and indicates that the request has finished
Declaration
Swift
public override func stopLoading() -
URLSessionDataDelegate method for receiving data
Declaration
Swift
public func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive data: Data)Parameters
sessionURLSession
dataTaskCurrent URLSessionDataTask
dataData received
-
URLSessionDataDelegate method for receiving response
Declaration
Swift
public func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive response: URLResponse, completionHandler: @escaping (URLSession.ResponseDisposition) -> Void)Parameters
sessionURLSession
dataTaskCurrent URLSessionDataTask
responseResponse received
completionHandlerCompletion callback
-
URLSessionDataDelegate method to notify completion of the request
In this delegation method, FRURLProtocol will validate the result of the request with given ValidatedURLs, RefreshTokenPolicy, and maximum retry attempt, and perform token refresh if necessary
Declaration
Swift
public func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?)Parameters
sessionURLSession
taskCurrent URLSessionDataTask
errorAn error occurred during the request
-
URLSessionDataDelegate method for HTTP Redirection
Declaration
Swift
public func urlSession(_ session: URLSession, task: URLSessionTask, willPerformHTTPRedirection response: HTTPURLResponse, newRequest request: URLRequest, completionHandler: @escaping (URLRequest?) -> Void)Parameters
sessionURLSession
taskCurrent URLSessionTask
responseHTTPURLResponse which may explain reason for redirection
requestNewly constructed URLRequest object
completionHandlerCompletion callback
-
URLSessionDataDelegate method for invalidating the current request with an error
Declaration
Swift
public func urlSession(_ session: URLSession, didBecomeInvalidWithError error: Error?)Parameters
sessionURLSession
errorAn error occurred during the request
-
URLSessionDelegate method for Authentication Challenge
Declaration
Swift
public func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void)Parameters
sessionURLSession
challengeURLAuthenticationChallenge
completionHandlerCompletion callback
-
URLSessionTaskDelegate method for Authentication Challenge
Declaration
Swift
public func urlSession(_ session: URLSession, task: URLSessionTask, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void)Parameters
sessionURLSession
taskURLSessionTask
challengeURLAuthenticationChallenge
completionHandlerCompletion callback
-
URLSessionDataDelegate method
Declaration
Swift
public func urlSessionDidFinishEvents(forBackgroundURLSession session: URLSession)Parameters
sessionURLSession
View on GitHub