AuthenticationState
public enum AuthenticationState : Equatable
A value representing an authentication state.
After a successful authentication, the authentication always goes into the AuthenticationState.authenticated(token:, user:)
state.
After using the Authentication.logOut()
method, the authentication always goes into the AuthenticationState.unauthenticated(reason:)
state.
-
Describes the unauthenticated state.
There are several reasons for the process to be in the
notAuthenticated
state (e.g. failed to connect, waiting for one-time password). These reasons are described in theAuthenticationState.Reason
object.Indicates that there is currently no authentication token..
From this state, a successful authentication brings the
.authenticated(user:)
state.Declaration
Swift
case unauthenticated(reason: UnauthenticatedReason)
Parameters
reason
The reason why the authentication process is in the unauthenticated state.
-
Indicates that there is a valid authentication token.
The associated value contains information about the authenticated user.
From this state:
- the
Authentication.logOut()
method brings to the.unauthenticated(reason:)
state, - the expiration of the token or a reject of the token by the back-end application when going back online also brings to the
.unauthenticated(reason:)
state.
Declaration
Swift
case authenticated(token: String, user: User)
Parameters
token
The token associated to the authentication
user
The user authenticated
- the
-
Indicates that the authentication is in progress.
Declaration
Swift
case authenticationInProgress(msisdn: String, progress: AuthenticatingStateProgress)
-
Declaration
Swift
public var authenticatedUser: User? { get }
-
Declaration
Swift
public var authenticationToken: String? { get }