class AuthenticationService : WebcomAbstractService
The Webcom service that makes it possible to authenticate users and manage identities (or authentication means) of users on a Webcom application.
Instances of AuthenticationService must be built using the WebcomApplication.authenticationService property.
The first step consists in choosing an AuthenticationMethod using one of the available getXXXMethod
methods.
Each subclass of AuthenticationMethod provides at least an authenticate
method, and possibly additional methods
to prepare the authentication call-flow (e.g. sending a One-Time Password to the user) or manage user identities
(e.g. adding and validating a new email address).
Only one user may be authenticated at a time. If two authentication call-flows are run simultaneously, one of them will be rejected.
When a user is authenticated, it overwrites the already authenticated user if any.
In order to perform a multi-factor authentication, a user must already be authenticated and Context.Current must
be passed to the authenticate
method of the AuthenticationMethod associated with the additional factor. The
resulting authentication factors may then be retrieved using the AuthenticationDetails.previousFactors
property.
enum class Context
Represents an authentication context. |
var currentAuthentication: AuthenticationEvent.AuthenticationState
Gives the AuthenticationDetails of the currently authenticated user or |
fun cancelAllSubscriptions(): Unit
Cancels all subscriptions previously set using the subscribe method. |
|
fun destroyAccount(callback: WebcomDoneCallback? = null): Unit
Removes the account of the currently authenticated user from the Webcom Authentication service. This operation is asynchronous and calls the given callback once performed. |
|
fun detachIdentity(callback: WebcomDoneCallback? = null): Unit
Removes the last identity (or authentication means) of the currently authenticated user from the Webcom Authentication service. This operation is asynchronous and calls the given callback once performed. |
|
fun getCustomMethod(provider: String): CustomMethod
Creates an instance of CustomMethod to authenticate users based on a given external ad-hoc (custom) identity provider. |
|
fun getGuestMethod(): GuestMethod
Creates an instance of GuestMethod to manage guest users. |
|
fun getOAuth2Method(provider: OAuth2Method.Provider, context: Context): OAuth2Method
Creates an instance of OAuth2Method to perform an OAuth2 authentication with a given provider from a given Android context (typically the Activity from which the authentication call-flow is to be started). |
|
fun getOneTimePasswordMethod(provider: AuthenticationMethod.Internal.Provider, identifier: String): OneTimePasswordMethod
Creates an instance of OneTimePasswordMethod to manage users with a given identity provider that authenticates users based on a given user identifier (email or MSISDN) and a generated one-time password sent to the user. |
|
fun getOrangeMobileNetworkMethod(): OrangeMobileNetworkMethod
Creates an instance of OrangeMobileNetworkMethod to authenticate users based on their Orange mobile data network (works only for Orange customers). |
|
fun getPersonalPasswordMethod(provider: AuthenticationMethod.Internal.Provider, identifier: String): PersonalPasswordMethod
Creates an instance of PersonalPasswordMethod to manage users with a given identity provider that authenticates users based on a given identifier (email or MSISDN) and a personal password. |
|
fun subscribe(callback: AuthenticationCallback): AuthenticationSubscription
Subscribes to the authentication state maintained by this AuthenticationService instance and notifies the given callback function each time it changes or an authentication operation fails. |
|
fun unauthenticate(callback: WebcomDoneCallback? = null): Unit
Unauthenticates the currently authenticated user. This operation is asynchronous and calls the given callback once performed. |