OfflineAuthenticationHandler
open class OfflineAuthenticationHandler: AuthenticationHandler
Base class for all offline authentication handlers
Processes offline authentication.
-
Declaration
Swift
override public var validationType: AuthenticationValidationType -
Delegate used to retrieve user credentials, if needed.
See also:
ProvideCredentialsAuthenticationHandlerDelegate-SeeAlso: ProvideCredentialsAuthenticationHandlerDelegate
Declaration
Swift
public weak var provideCredentialsDelegate: ProvideCredentialsAuthenticationHandlerDelegate? -
Prompt displayed to user when authenticating offline using Touch ID
Declaration
Swift
public var touchIDPrompt = "Please authenticate for offline access"
-
Initializes and returns an OfflineAuthenticationHandler object
Declaration
Swift
public override init()
-
Starts the offline authentication process.
Called by the associated
AuthenticationManagerwhen needed.Declaration
Swift
override public func authenticate(completionHandler: @escaping (_ result: AuthenticateResult) -> Void)Parameters
completionHandlerclosure called when authentication has completed.
resultAuthenticateResult: Success or fail, result of authentication.
-
This method is called from the
AuthenticationManagerto cache a user’s authorization data during online login so it is available during offline login scenarios.Subclasses may override this method to provide extra processing of the user’s authorization information, prior to calling
super.cacheAuthorizedUser(userData: )or could modify how the data is cached. Be aware if modifying how this data is cached, similar changes must be made inretrieveCachedUserDataSee also:
retrieveCachedUserDataSee also
retrieveCachedUserData
Declaration
Swift
open func cacheAuthorizedUser(userData: [String: Any])Parameters
userDataDictionary of user information. Usually the user’s name, role information, etc, as returned from the
AuthorizationHandler -
This method is called from the
AuthenticationManagerto retrieve a user’s authorization data from the cache during offline login.Subclasses may override this method to provide extra processing of the user’s authorization information, prior to calling
super.retrieveCachedUserData()or could modify how the data is retrieved from the cache, if they made similar changes tocacheAuthorizedUser(userData: )See also:
cacheAuthorizedUser(userData:)See also
cacheAuthorizedUser(userData:)Declaration
Swift
open func retrieveCachedUserData() -> [String: Any]Return Value
dictionary of user information previously stored via
cacheAuthorizedUser(userData:) -
This method will erase any existing cached user authorization data
Subclasses may override this method to allow for proper functioning if they made substantial changes to
cacheAuthorizedUser(userData: )See also:
cacheAuthorizedUser(userData:)See also
cacheAuthorizedUser(userData:)Declaration
Swift
open func eraseCachedUserData() -
Returns the location where user’s offline information cache will be stored.
If overridden, it is expected to return a readable and writeable URL. By default will return a local file URL, with any needed manager directories already created.
Declaration
Swift
open func getCachedUserDataURL() -> URL -
Declaration
Swift
override open func logout(completionHandler: @escaping () -> Void)
-
Should not be called from external consumers. The
authenticatemethod should be used to start the authentication process.Accepts the user’s offline credentials as provided by the
ProvideCredentialsAuthenticationHandlerDelegateand performs offline authentication.Default behavior will validate the provided credentials, and call the
ProvideCredentialsAuthenticationHandlerDelegate‘sauthenticationHandlerProvidedCredentialsWereInvalidmethod prior to re-calling theauthenticationHandler(, provideCredentialsWithCompletionHandler:)method.Subclasses may override this method to provide extra processing/validation of the user’s credentials, prior to calling
super.performAuthentication(userName: , password: )or could modify the actual work of offline authentication, in which case they should callauthenticationComplete(status:)with the result of that authentication.Declaration
Swift
open func performAuthentication(userName: String, password: String)
View on GitHub
OfflineAuthenticationHandler Class Reference