Class UmbracoUserManager<TUser, TPasswordConfig>
Abstract class for Umbraco User Managers for back office users or front-end members
Inheritance
System.Object
Assembly: cs.temp.dll.dll
Syntax
public abstract class UmbracoUserManager<TUser, TPasswordConfig> : UserManager<TUser> where TUser : UmbracoIdentityUser where TPasswordConfig : class, IPasswordConfiguration, new()
Type Parameters
Name |
Description |
TUser |
The type of user
|
TPasswordConfig |
The type password config
|
Constructors
UmbracoUserManager(IIpResolver, IUserStore<TUser>, IOptions<IdentityOptions>, IPasswordHasher<TUser>, IEnumerable<IUserValidator<TUser>>, IEnumerable<IPasswordValidator<TUser>>, IdentityErrorDescriber, IServiceProvider, ILogger<UserManager<TUser>>, IOptions<TPasswordConfig>)
Declaration
public UmbracoUserManager(IIpResolver ipResolver, IUserStore<TUser> store, IOptions<IdentityOptions> optionsAccessor, IPasswordHasher<TUser> passwordHasher, IEnumerable<IUserValidator<TUser>> userValidators, IEnumerable<IPasswordValidator<TUser>> passwordValidators, IdentityErrorDescriber errors, IServiceProvider services, ILogger<UserManager<TUser>> logger, IOptions<TPasswordConfig> passwordConfiguration)
Parameters
Type |
Name |
Description |
IIpResolver |
ipResolver |
|
IUserStore<TUser> |
store |
|
IOptions<IdentityOptions> |
optionsAccessor |
|
IPasswordHasher<TUser> |
passwordHasher |
|
System.Collections.Generic.IEnumerable<IUserValidator<TUser>> |
userValidators |
|
System.Collections.Generic.IEnumerable<IPasswordValidator<TUser>> |
passwordValidators |
|
IdentityErrorDescriber |
errors |
|
System.IServiceProvider |
services |
|
ILogger<UserManager<TUser>> |
logger |
|
IOptions<TPasswordConfig> |
passwordConfiguration |
|
Properties
IpResolver
Declaration
public IIpResolver IpResolver { get; }
Property Value
Type |
Description |
IIpResolver |
|
PasswordConfiguration
Gets the password configuration
Declaration
public IPasswordConfiguration PasswordConfiguration { get; }
Property Value
Type |
Description |
IPasswordConfiguration |
|
SupportsQueryableUsers
Declaration
public override bool SupportsQueryableUsers { get; }
Property Value
Type |
Description |
System.Boolean |
|
SupportsUserClaim
Declaration
public override bool SupportsUserClaim { get; }
Property Value
Type |
Description |
System.Boolean |
|
SupportsUserPhoneNumber
Declaration
public override bool SupportsUserPhoneNumber { get; }
Property Value
Type |
Description |
System.Boolean |
|
SupportsUserTwoFactor
Both users and members supports 2FA
Declaration
public override bool SupportsUserTwoFactor { get; }
Property Value
Type |
Description |
System.Boolean |
|
Methods
AccessFailedAsync(TUser)
Overrides the Microsoft ASP.NET user management method
Declaration
public override async Task<IdentityResult> AccessFailedAsync(TUser user)
Parameters
Type |
Name |
Description |
TUser |
user |
|
Returns
Type |
Description |
Task<IdentityResult> |
|
ChangePasswordWithResetAsync(String, String, String)
This is a special method that will reset the password but will raise the Password Changed event instead of the reset event
Declaration
public virtual async Task<IdentityResult> ChangePasswordWithResetAsync(string userId, string token, string newPassword)
Parameters
Type |
Name |
Description |
System.String |
userId |
The userId
|
System.String |
token |
The reset password token
|
System.String |
newPassword |
The new password to set it to
|
Returns
Type |
Description |
Task<IdentityResult> |
The
|
CheckPasswordAsync(TUser, String)
Declaration
public override async Task<bool> CheckPasswordAsync(TUser user, string password)
Parameters
Type |
Name |
Description |
TUser |
user |
|
System.String |
password |
|
Returns
Type |
Description |
Task<System.Boolean> |
|
GeneratePassword()
Helper method to generate a password for a user based on the current password validator
Declaration
public string GeneratePassword()
Returns
Type |
Description |
System.String |
The generated password
|
GetValidTwoFactorProvidersAsync(TUser)
Declaration
public virtual async Task<IList<string>> GetValidTwoFactorProvidersAsync(TUser user)
Parameters
Type |
Name |
Description |
TUser |
user |
|
Returns
Type |
Description |
Task<System.Collections.Generic.IList<System.String>> |
|
ResetAccessFailedCountAsync(TUser)
Declaration
public override async Task<IdentityResult> ResetAccessFailedCountAsync(TUser user)
Parameters
Type |
Name |
Description |
TUser |
user |
|
Returns
Type |
Description |
Task<IdentityResult> |
|
SetLockoutEndDateAsync(TUser, Nullable<DateTimeOffset>)
Declaration
public override async Task<IdentityResult> SetLockoutEndDateAsync(TUser user, DateTimeOffset? lockoutEnd)
Parameters
Type |
Name |
Description |
TUser |
user |
|
System.Nullable<System.DateTimeOffset> |
lockoutEnd |
|
Returns
Type |
Description |
Task<IdentityResult> |
|
ValidateCredentialsAsync(String, String)
Declaration
public async Task<bool> ValidateCredentialsAsync(string username, string password)
Parameters
Type |
Name |
Description |
System.String |
username |
|
System.String |
password |
|
Returns
Type |
Description |
Task<System.Boolean> |
|
ValidatePasswordAsync(String)
Used to validate the password without an identity user
Validation code is based on the default ValidatePasswordAsync code
Should return if validation is successful
Declaration
public async Task<IdentityResult> ValidatePasswordAsync(string password)
Parameters
Type |
Name |
Description |
System.String |
password |
The password.
|
Returns
Type |
Description |
Task<IdentityResult> |
A representing whether validation was successful.
|
ValidateSessionIdAsync(String, String)
Used to validate a user's session
Declaration
public virtual async Task<bool> ValidateSessionIdAsync(string userId, string sessionId)
Parameters
Type |
Name |
Description |
System.String |
userId |
The user id
|
System.String |
sessionId |
The session id
|
Returns
Type |
Description |
Task<System.Boolean> |
True if the session is valid, else false
|