PersonalPasswordMethod

class PersonalPasswordMethod : AuthenticationMethod.Internal

Manages users of a given identity provider that authenticates users based on their identifier and a personal password they can set or update.

Instances of this AuthenticationMethod must be created using the AuthenticationService.getPersonalPasswordMethod method.

This authentication method provides with two call-flows:

  • Authentication call-flow:

  1. Call authenticate to authenticate the user (this is a one-step flow).

  • Attach a new identity (or authentication means) to a user account:

  1. Call attachIdentity to associate the currently authenticated user with a new email address or phone number (depending on the chosen provider),

  2. Call verifyAndAuthenticate to verify the newly created identity.

The Webcom Authentication Service currently supports the PersonalPasswordMethod only with the Email identity provider. Support for the Phone provider may come later.

Functions

Link copied to clipboard
fun attachIdentity(    password: String,     context: AuthenticationService.Context,     displayName: String? = null,     profile: Any? = null,     messageDetails: OneTimePasswordMethod.MessageDetails? = null,     callback: WebcomDoneCallback? = null)

Either creates a new Webcom account and attach an identity to it (if context is Context.New) or attaches a new identity to the Webcom account of the currently authenticated user (if context is Context.Current), as the first step of an identity attachment call-flow.

Link copied to clipboard
fun authenticate(    password: String,     context: AuthenticationService.Context = Context.New,     callback: WebcomResultCallback<AuthenticationDetails>? = null)

Authenticates the user with her·his personal password. This operation is asynchronous and calls the given callback with the authentication result once performed.

Link copied to clipboard
fun clearProfile(callback: WebcomDoneCallback? = null)

Clears the profile data of the currently authenticated user stored by the Webcom authentication service. This operation is asynchronous and calls the given callback once performed.

Link copied to clipboard
fun resendVerificationCode(messageDetails: OneTimePasswordMethod.MessageDetails? = null, callback: WebcomDoneCallback? = null)

Resend to the user the verification token that was sent when invoking the attachIdentity method.

Link copied to clipboard
fun sendPasswordResetCode(messageDetails: AuthenticationMethod.Internal.MessageDetails? = null, callback: WebcomDoneCallback? = null)

Sends a code to the user, which makes it possible to reset her·his personal password. This operation is asynchronous and calls the given callback once performed.

Link copied to clipboard
fun setProfile(value: Any?, callback: WebcomDoneCallback? = null)

Sets the value of the profile data of the currently authenticated user stored by the Webcom authentication service. This operation is asynchronous and calls the given callback once performed.

Link copied to clipboard
fun updatePassword(    current: String,     new: String,     callback: WebcomDoneCallback? = null)

Updates the personal password of the currently authenticated user. This operation is asynchronous and calls the given callback once performed.

Link copied to clipboard
fun updateProfile(    path: String,     value: Any?,     callback: WebcomDoneCallback? = null)

Updates the value of the profile data of the currently authenticated user stored by the Webcom authentication service at a given path. This operation is asynchronous and calls the given callback once performed.

Link copied to clipboard
fun verifyAndAuthenticate(token: String, callback: WebcomResultCallback<AuthenticationDetails>? = null)

Verify a previously attached identity with the token the user has just received, as the final step of an identity attachment call-flow, and, if successful authenticates the user with this identity (or authentication means).