IUserTwoFactorTokenProvider<TUser> Interface

Provides an abstraction for two factor token generators.

Namespace
Microsoft.AspNetCore.Identity
Assemblies
  • Microsoft.AspNetCore.Identity

Syntax

public interface IUserTwoFactorTokenProvider<TUser>
    where TUser : class
interface Microsoft.AspNetCore.Identity.IUserTwoFactorTokenProvider<TUser>

Methods

CanGenerateTwoFactorTokenAsync(Microsoft.AspNetCore.Identity.UserManager<TUser>, TUser)

Returns a flag indicating whether the token provider can generate a token suitable for two factor authentication token for the specified <em>user</em>.

Arguments:
Return type:

System.Threading.Tasks.Task<System.Boolean>

Returns:

The System.Threading.Tasks.Task that represents the asynchronous operation, containing the a flag indicating if a two factor token could be generated by this provider for the specified <em>user</em>. The task will return true if a two factor authentication token could be generated, otherwise false.

Task<bool> CanGenerateTwoFactorTokenAsync(UserManager<TUser> manager, TUser user)
GenerateAsync(System.String, Microsoft.AspNetCore.Identity.UserManager<TUser>, TUser)

Generates a token for the specified <em>user</em> and <em>purpose</em>.

Arguments:
Return type:

System.Threading.Tasks.Task<System.String>

Returns:

The System.Threading.Tasks.Task that represents the asynchronous operation, containing the token for the specified <em>user</em> and <em>purpose</em>.

Task<string> GenerateAsync(string purpose, UserManager<TUser> manager, TUser user)
ValidateAsync(System.String, System.String, Microsoft.AspNetCore.Identity.UserManager<TUser>, TUser)

Returns a flag indicating whether the specified <em>token</em> is valid for the given <em>user</em> and <em>purpose</em>.

Arguments:
Return type:

System.Threading.Tasks.Task<System.Boolean>

Returns:

The System.Threading.Tasks.Task that represents the asynchronous operation, containing the a flag indicating the result of validating the <em>token</em><em>user</em> and <em>purpose</em>. The task will return true if the token is valid, otherwise false.

Task<bool> ValidateAsync(string purpose, string token, UserManager<TUser> manager, TUser user)