View Source
Class UmbracoUserManager<TUser, TPasswordConfig>
Abstract class for Umbraco User Managers for back office users or front-end members
Inheritance
System.Object
Assembly: Umbraco.Infrastructure.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
View Source
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 |
|
Umbraco.Cms.Core.Security.IPasswordHasher<TUser> |
passwordHasher |
|
IEnumerable<IUserValidator<TUser>> |
userValidators |
|
IEnumerable<IPasswordValidator<TUser>> |
passwordValidators |
|
IdentityErrorDescriber |
errors |
|
IServiceProvider |
services |
|
ILogger<UserManager<TUser>> |
logger |
|
IOptions<TPasswordConfig> |
passwordConfiguration |
|
Properties
View Source
IpResolver
Declaration
public IIpResolver IpResolver { get; }
Property Value
View Source
PasswordConfiguration
Gets the password configuration
Declaration
public IPasswordConfiguration PasswordConfiguration { get; }
Property Value
View Source
SupportsQueryableUsers
Declaration
public override bool SupportsQueryableUsers { get; }
Property Value
Type |
Description |
System.Boolean |
|
View Source
SupportsUserClaim
Declaration
public override bool SupportsUserClaim { get; }
Property Value
Type |
Description |
System.Boolean |
|
View Source
SupportsUserPhoneNumber
Declaration
public override bool SupportsUserPhoneNumber { get; }
Property Value
Type |
Description |
System.Boolean |
|
View Source
SupportsUserTwoFactor
Both users and members supports 2FA
Declaration
public override bool SupportsUserTwoFactor { get; }
Property Value
Type |
Description |
System.Boolean |
|
Methods
View Source
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> |
|
View Source
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
|
View Source
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> |
|
View Source
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
|
View Source
GetValidTwoFactorProvidersAsync(TUser)
Declaration
public virtual async Task<IList<string>> GetValidTwoFactorProvidersAsync(TUser user)
Parameters
Type |
Name |
Description |
TUser |
user |
|
Returns
Type |
Description |
Task<IList<System.String>> |
|
View Source
ResetAccessFailedCountAsync(TUser)
Declaration
public override async Task<IdentityResult> ResetAccessFailedCountAsync(TUser user)
Parameters
Type |
Name |
Description |
TUser |
user |
|
Returns
Type |
Description |
Task<IdentityResult> |
|
View Source
SetLockoutEndDateAsync(TUser, Nullable<DateTimeOffset>)
Declaration
public override async Task<IdentityResult> SetLockoutEndDateAsync(TUser user, DateTimeOffset? lockoutEnd)
Parameters
Type |
Name |
Description |
TUser |
user |
|
System.Nullable<DateTimeOffset> |
lockoutEnd |
|
Returns
Type |
Description |
Task<IdentityResult> |
|
View Source
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> |
|
View Source
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.
|
View Source
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
|