AuthenticationHandling
public protocol AuthenticationHandling : AnyObject
Defines an API capable of reacting to authentication results.
-
Called when an authentication process finished successfully and there is a new token / credential ready to use. If this delegate is present, all network request are hold until the completionHandler is called. If it is necessary to send a network request before calling the completionHandler (e.g. validating the new user), then mark the SAPURLSessionTask with the provided requestBypassIdentifier.
Declaration
Swift
func authenticationObserver(_ observer: SAPURLSessionObserving, didAuthenticate session: SAPURLSession, requestBypassIdentifier: UUID, completionHandler: @escaping (Error?) -> Void)Parameters
observerthe SAPURLSessionObserving instance which handled the authentication process
sessionthe SAPURLSession instance involved in the authentication process
requestBypassIdentifierthe optional bypass identifier for network request before the completionHandler call
completionHandlerthe completionHandler which must be called either with error or nil.
-
Called when an authentication process failed.
Declaration
Swift
func authenticationObserver(_ observer: SAPURLSessionObserving, didFailToAuthenticate session: SAPURLSession, error: Error)Parameters
observerthe SAPURLSessionObserving instance which handled the authentication process
sessionthe SAPURLSession instance involved in the authentication process
errorthe Error occured