UserManager

public class UserManager

Stores user data, populated during the authentication process.

  • Shared singleton instance

    Declaration

    Swift

    public private(set) static var sharedInstance = UserManager()
  • Replaces existing sharedInstance with new UserManager instance

    Declaration

    Swift

    public static func setSharedInstance(_ manager: UserManager)
  • Initializes a new UserManager instance with the provided User

    Declaration

    Swift

    public init(user: User)
  • Initializes a new UserManager instance with the provided dictionary of User data. Will return nil if the dictionary does not contain the minimum key/value pairs needed for a User object

    Declaration

    Swift

    public init?(userData: [String : Any])
  • Returns user dictionary obtained during authentication

    Declaration

    Swift

    public func getUser() -> [String : Any]
  • Returns user information for provided key

    Declaration

    Swift

    public func getData<T>(_ key: String) -> T?
  • Returns user name as obtained during authentication

    Declaration

    Swift

    public func userName() -> String?
  • Stores the provided offline password in the keychain.

    Only valid when user is authenticated online, and has not previously set up an offline password.

    This password will not be used if using an AuthenticationManagerConfiguration with allowsOnlineCredentialsForOfflineAccess or isTouchIDEnabled set to true.

    Throws an error if storing the password fails.

    Declaration

    Swift

    public func setupOfflinePassword(password: String) throws

    Parameters

    password

    the password to store.

  • Changes the stored offline password.

    Only valid when user is authenticated online, and user has previously set up an offline password.

    This password will not be used if using an AuthenticationManagerConfiguration with allowsOnlineCredentialsForOfflineAccess or isTouchIDEnabled set to true.

    Throws an error if changing the password fails.

    Declaration

    Swift

    public func changeOfflinePassword(from: String, to: String) throws

    Parameters

    from

    the user’s previous offline password.

    to

    the new password to store.

  • Removes any existing stored offline password, or online Touch ID refresh tokens.

    Throws an error if the deletion fails.

    Declaration

    Swift

    public func resetCredentials() throws