TotpSecurityStampBasedTokenProvider<TUser> Class

Represents a token provider that generates time based codes using the user’s security stamp.

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

Syntax

public abstract class TotpSecurityStampBasedTokenProvider<TUser> : IUserTwoFactorTokenProvider<TUser> where TUser : class
class Microsoft.AspNetCore.Identity.TotpSecurityStampBasedTokenProvider<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.

public abstract 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>.

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

Returns a constant, provider and user unique modifier used for entropy in generated tokens from user information.

Arguments:
Return type:

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

Returns:

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

public virtual Task<string> GetUserModifierAsync(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.

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