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: - manager (Microsoft.AspNetCore.Identity.UserManager<TUser>) – The
Microsoft.AspNetCore.Identity.UserManager`1
that can be used to retrieve user properties. - user (TUser) – The user a token could be generated for.
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)
- manager (Microsoft.AspNetCore.Identity.UserManager<TUser>) – The
-
GenerateAsync
(System.String, Microsoft.AspNetCore.Identity.UserManager<TUser>, TUser)¶ Generates a token for the specified <em>user</em> and <em>purpose</em>.
Arguments: - purpose (System.String) – The purpose the token will be used for.
- manager (Microsoft.AspNetCore.Identity.UserManager<TUser>) – The
Microsoft.AspNetCore.Identity.UserManager`1
that can be used to retrieve user properties. - user (TUser) – The user a token should be generated for.
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: - purpose (System.String) – The purpose the token will be used for.
- token (System.String) – The token to validate.
- manager (Microsoft.AspNetCore.Identity.UserManager<TUser>) – The
Microsoft.AspNetCore.Identity.UserManager`1
that can be used to retrieve user properties. - user (TUser) – The user a token should be validated for.
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)
-