Class TwoFactorValidationProvider<TUmbracoIdentityUser, TTwoFactorSetupGenerator>
Inheritance
Namespace: Umbraco.Cms.Infrastructure.Security
Assembly: Umbraco.Web.Common.dll
Syntax
public class TwoFactorValidationProvider<TUmbracoIdentityUser, TTwoFactorSetupGenerator> : DataProtectorTokenProvider<TUmbracoIdentityUser> where TUmbracoIdentityUser : UmbracoIdentityUser where TTwoFactorSetupGenerator : ITwoFactorProvider
Type Parameters
| Name | Description |
|---|---|
| TUmbracoIdentityUser | |
| TTwoFactorSetupGenerator |
Constructors
View SourceTwoFactorValidationProvider(IDataProtectionProvider, IOptions<DataProtectionTokenProviderOptions>, ILogger<TwoFactorValidationProvider<TUmbracoIdentityUser, TTwoFactorSetupGenerator>>, ITwoFactorLoginService, TTwoFactorSetupGenerator)
Declaration
protected TwoFactorValidationProvider(IDataProtectionProvider dataProtectionProvider, IOptions<DataProtectionTokenProviderOptions> options, ILogger<TwoFactorValidationProvider<TUmbracoIdentityUser, TTwoFactorSetupGenerator>> logger, ITwoFactorLoginService twoFactorLoginService, TTwoFactorSetupGenerator generator)
Parameters
| Type | Name | Description |
|---|---|---|
| IDataProtectionProvider | dataProtectionProvider | |
| IOptions<DataProtectionTokenProviderOptions> | options | |
| ILogger<TwoFactorValidationProvider<TUmbracoIdentityUser, TTwoFactorSetupGenerator>> | logger | |
| ITwoFactorLoginService | twoFactorLoginService | |
| TTwoFactorSetupGenerator | generator |
Methods
View SourceCanGenerateTwoFactorTokenAsync(UserManager<TUmbracoIdentityUser>, TUmbracoIdentityUser)
Returns a bool indicating whether a token generated by this instance can be used as a Two Factor Authentication token as an asynchronous operation.
Declaration
public override Task<bool> CanGenerateTwoFactorTokenAsync(UserManager<TUmbracoIdentityUser> manager, TUmbracoIdentityUser user)
Parameters
| Type | Name | Description |
|---|---|---|
| UserManager<TUmbracoIdentityUser> | manager | The Microsoft.AspNetCore.Identity.UserManager<TUser> to retrieve user properties from. |
| TUmbracoIdentityUser | user | The |
Returns
| Type | Description |
|---|---|
| Task<bool> | A System.Threading.Tasks.Task<TResult> that represents the result of the asynchronous query, containing true if a token generated by this instance can be used as a Two Factor Authentication token, otherwise false. |
Remarks
This method will always return false for instances of Microsoft.AspNetCore.Identity.DataProtectorTokenProvider<TUser>.
GetUserKey(TUmbracoIdentityUser)
Declaration
protected Guid GetUserKey(TUmbracoIdentityUser user)
Parameters
| Type | Name | Description |
|---|---|---|
| TUmbracoIdentityUser | user |
Returns
| Type | Description |
|---|---|
| Guid |
ValidateAsync(string, string, UserManager<TUmbracoIdentityUser>, TUmbracoIdentityUser)
Validates the protected token for the specified user and purpose as an asynchronous operation.
Declaration
public override Task<bool> ValidateAsync(string purpose, string token, UserManager<TUmbracoIdentityUser> manager, TUmbracoIdentityUser user)
Parameters
| Type | Name | Description |
|---|---|---|
| string | purpose | The purpose the token was be used for. |
| string | token | The token to validate. |
| UserManager<TUmbracoIdentityUser> | manager | The Microsoft.AspNetCore.Identity.UserManager<TUser> to retrieve user properties from. |
| TUmbracoIdentityUser | user | The |
Returns
| Type | Description |
|---|---|
| Task<bool> | A System.Threading.Tasks.Task<TResult> that represents the result of the asynchronous validation, containing true if the token is valid, otherwise false. |