UserManager<TUser> Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Provides the APIs for managing user in a persistence store.
generic <typename TUser>
where TUser : classpublic ref class UserManager : IDisposable
public class UserManager<TUser> : IDisposable where TUser : class
type UserManager<'User (requires 'User : null)> = class
interface IDisposable
Public Class UserManager(Of TUser)
Implements IDisposable
Type Parameters
- TUser
The type encapsulating a user.
- Inheritance
-
UserManager<TUser>
- Derived
- Implements
Constructors
Fields
ChangePhoneNumberTokenPurpose |
The data protection purpose used for the change phone number methods. |
ConfirmEmailTokenPurpose |
The data protection purpose used for the email confirmation related methods. |
ResetPasswordTokenPurpose |
The data protection purpose used for the reset password related methods. |
Properties
CancellationToken |
The cancellation token used to cancel operations. |
ErrorDescriber |
The IdentityErrorDescriber used to generate error messages. |
KeyNormalizer |
The ILookupNormalizer used to normalize things like user and role names. |
Logger |
The ILogger used to log messages from the manager. |
Options |
The IdentityOptions used to configure Identity. |
PasswordHasher |
The IPasswordHasher<TUser> used to hash passwords. |
PasswordValidators |
The IPasswordValidator<TUser> used to validate passwords. |
Store |
Gets or sets the persistence store the manager operates over. |
SupportsQueryableUsers |
Gets a flag indicating whether the backing user store supports returning IQueryable collections of information. |
SupportsUserAuthenticationTokens |
Gets a flag indicating whether the backing user store supports authentication tokens. |
SupportsUserAuthenticatorKey |
Gets a flag indicating whether the backing user store supports a user authenticator. |
SupportsUserClaim |
Gets a flag indicating whether the backing user store supports user claims. |
SupportsUserEmail |
Gets a flag indicating whether the backing user store supports user emails. |
SupportsUserLockout |
Gets a flag indicating whether the backing user store supports user lock-outs. |
SupportsUserLogin |
Gets a flag indicating whether the backing user store supports external logins. |
SupportsUserPassword |
Gets a flag indicating whether the backing user store supports user passwords. |
SupportsUserPhoneNumber |
Gets a flag indicating whether the backing user store supports user telephone numbers. |
SupportsUserRole |
Gets a flag indicating whether the backing user store supports user roles. |
SupportsUserSecurityStamp |
Gets a flag indicating whether the backing user store supports security stamps. |
SupportsUserTwoFactor |
Gets a flag indicating whether the backing user store supports two factor authentication. |
SupportsUserTwoFactorRecoveryCodes |
Gets a flag indicating whether the backing user store supports recovery codes. |
Users |
Returns an IQueryable of users if the store is an IQueryableUserStore |
UserValidators |
The IUserValidator<TUser> used to validate users. |
Methods
AccessFailedAsync(TUser) |
Increments the access failed count for the user as an asynchronous operation. If the failed access account is greater than or equal to the configured maximum number of attempts, the user will be locked out for the configured lockout time span. |
AddClaimAsync(TUser, Claim) |
Adds the specified |
AddClaimsAsync(TUser, IEnumerable<Claim>) |
Adds the specified |
AddLoginAsync(TUser, UserLoginInfo) |
Adds an external UserLoginInfo to the specified |
AddPasswordAsync(TUser, String) |
Adds the |
AddToRoleAsync(TUser, String) |
Add the specified |
AddToRolesAsync(TUser, IEnumerable<String>) |
Add the specified |
ChangeEmailAsync(TUser, String, String) |
Updates a users emails if the specified email change |
ChangePasswordAsync(TUser, String, String) |
Changes a user's password after confirming the specified |
ChangePhoneNumberAsync(TUser, String, String) |
Sets the phone number for the specified |
CheckPasswordAsync(TUser, String) |
Returns a flag indicating whether the given |
ConfirmEmailAsync(TUser, String) |
Validates that an email confirmation token matches the specified |
CountRecoveryCodesAsync(TUser) |
Returns how many recovery code are still valid for a user. |
CreateAsync(TUser, String) |
Creates the specified |
CreateAsync(TUser) |
Creates the specified |
CreateSecurityTokenAsync(TUser) |
Creates bytes to use as a security token from the user's security stamp. |
CreateTwoFactorRecoveryCode() |
Generate a new recovery code. |
DeleteAsync(TUser) |
Deletes the specified |
Dispose() |
Releases all resources used by the user manager. |
Dispose(Boolean) |
Releases the unmanaged resources used by the role manager and optionally releases the managed resources. |
FindByEmailAsync(String) |
Gets the user, if any, associated with the normalized value of the specified email address. Note: Its recommended that identityOptions.User.RequireUniqueEmail be set to true when using this method, otherwise the store may throw if there are users with duplicate emails. |
FindByIdAsync(String) |
Finds and returns a user, if any, who has the specified |
FindByLoginAsync(String, String) |
Retrieves the user associated with the specified external login provider and login provider key. |
FindByNameAsync(String) |
Finds and returns a user, if any, who has the specified user name. |
GenerateChangeEmailTokenAsync(TUser, String) |
Generates an email change token for the specified user. |
GenerateChangePhoneNumberTokenAsync(TUser, String) |
Generates a telephone number change token for the specified user. |
GenerateConcurrencyStampAsync(TUser) |
Generates a value suitable for use in concurrency tracking. |
GenerateEmailConfirmationTokenAsync(TUser) |
Generates an email confirmation token for the specified user. |
GenerateNewAuthenticatorKey() |
Generates a new base32 encoded 160-bit security secret (size of SHA1 hash). |
GenerateNewTwoFactorRecoveryCodesAsync(TUser, Int32) |
Generates recovery codes for the user, this invalidates any previous recovery codes for the user. |
GeneratePasswordResetTokenAsync(TUser) |
Generates a password reset token for the specified |
GenerateTwoFactorTokenAsync(TUser, String) |
Gets a two factor authentication token for the specified |
GenerateUserTokenAsync(TUser, String, String) |
Generates a token for the given |
GetAccessFailedCountAsync(TUser) |
Retrieves the current number of failed accesses for the given |
GetAuthenticationTokenAsync(TUser, String, String) |
Returns an authentication token for a user. |
GetAuthenticatorKeyAsync(TUser) |
Returns the authenticator key for the user. |
GetChangeEmailTokenPurpose(String) |
Generates the token purpose used to change email. |
GetClaimsAsync(TUser) |
Gets a list of Claims to be belonging to the specified |
GetEmailAsync(TUser) |
Gets the email address for the specified |
GetLockoutEnabledAsync(TUser) |
Retrieves a flag indicating whether user lockout can be enabled for the specified user. |
GetLockoutEndDateAsync(TUser) |
Gets the last DateTimeOffset a user's last lockout expired, if any. A time value in the past indicates a user is not currently locked out. |
GetLoginsAsync(TUser) |
Retrieves the associated logins for the specified . |
GetPhoneNumberAsync(TUser) |
Gets the telephone number, if any, for the specified |
GetRolesAsync(TUser) |
Gets a list of role names the specified |
GetSecurityStampAsync(TUser) |
Get the security stamp for the specified |
GetTwoFactorEnabledAsync(TUser) |
Returns a flag indicating whether the specified |
GetUserAsync(ClaimsPrincipal) |
Returns the user corresponding to the IdentityOptions.ClaimsIdentity.UserIdClaimType claim in the principal or null. |
GetUserId(ClaimsPrincipal) |
Returns the User ID claim value if present otherwise returns null. |
GetUserIdAsync(TUser) |
Gets the user identifier for the specified |
GetUserName(ClaimsPrincipal) |
Returns the Name claim value if present otherwise returns null. |
GetUserNameAsync(TUser) |
Gets the user name for the specified |
GetUsersForClaimAsync(Claim) |
Returns a list of users from the user store who have the specified |
GetUsersInRoleAsync(String) |
Returns a list of users from the user store who are members of the specified |
GetValidTwoFactorProvidersAsync(TUser) |
Gets a list of valid two factor token providers for the specified |
HasPasswordAsync(TUser) |
Gets a flag indicating whether the specified |
IsEmailConfirmedAsync(TUser) |
Gets a flag indicating whether the email address for the specified |
IsInRoleAsync(TUser, String) |
Returns a flag indicating whether the specified |
IsLockedOutAsync(TUser) |
Returns a flag indicating whether the specified |
IsPhoneNumberConfirmedAsync(TUser) |
Gets a flag indicating whether the specified |
NormalizeEmail(String) |
Normalize email for consistent comparisons. |
NormalizeKey(String) |
Normalize a key (user name, email) for consistent comparisons. |
NormalizeName(String) |
Normalize user or role name for consistent comparisons. |
RedeemTwoFactorRecoveryCodeAsync(TUser, String) |
Returns whether a recovery code is valid for a user. Note: recovery codes are only valid once, and will be invalid after use. |
RegisterTokenProvider(String, IUserTwoFactorTokenProvider<TUser>) |
Registers a token provider. |
RemoveAuthenticationTokenAsync(TUser, String, String) |
Remove an authentication token for a user. |
RemoveClaimAsync(TUser, Claim) |
Removes the specified |
RemoveClaimsAsync(TUser, IEnumerable<Claim>) |
Removes the specified |
RemoveFromRoleAsync(TUser, String) |
Removes the specified |
RemoveFromRolesAsync(TUser, IEnumerable<String>) |
Removes the specified |
RemoveLoginAsync(TUser, String, String) |
Attempts to remove the provided external login information from the specified |
RemovePasswordAsync(TUser, CancellationToken) |
Removes a user's password. |
RemovePasswordAsync(TUser) |
Removes a user's password. |
ReplaceClaimAsync(TUser, Claim, Claim) |
Replaces the given |
ResetAccessFailedCountAsync(TUser) |
Resets the access failed count for the specified |
ResetAuthenticatorKeyAsync(TUser) |
Resets the authenticator key for the user. |
ResetPasswordAsync(TUser, String, String) |
Resets the |
SetAuthenticationTokenAsync(TUser, String, String, String) |
Sets an authentication token for a user. |
SetEmailAsync(TUser, String) |
Sets the |
SetLockoutEnabledAsync(TUser, Boolean) |
Sets a flag indicating whether the specified |
SetLockoutEndDateAsync(TUser, Nullable<DateTimeOffset>) |
Locks out a user until the specified end date has passed. Setting a end date in the past immediately unlocks a user. |
SetPhoneNumberAsync(TUser, String) |
Sets the phone number for the specified |
SetTwoFactorEnabledAsync(TUser, Boolean) |
Sets a flag indicating whether the specified |
SetUserNameAsync(TUser, String) |
Sets the given |
ThrowIfDisposed() |
Throws if this class has been disposed. |
UpdateAsync(TUser) |
Updates the specified |
UpdateNormalizedEmailAsync(TUser) |
Updates the normalized email for the specified |
UpdateNormalizedUserNameAsync(TUser) |
Updates the normalized user name for the specified |
UpdatePasswordHash(TUser, String, Boolean) |
Updates a user's password hash. |
UpdateSecurityStampAsync(TUser) |
Regenerates the security stamp for the specified |
UpdateUserAsync(TUser) |
Called to update the user after validating and updating the normalized email/user name. |
ValidatePasswordAsync(TUser, String) |
Should return Success if validation is successful. This is called before updating the password hash. |
ValidateUserAsync(TUser) |
Should return Success if validation is successful. This is called before saving the user via Create or Update. |
VerifyChangePhoneNumberTokenAsync(TUser, String, String) |
Returns a flag indicating whether the specified |
VerifyPasswordAsync(IUserPasswordStore<TUser>, TUser, String) |
Returns a PasswordVerificationResult indicating the result of a password hash comparison. |
VerifyTwoFactorTokenAsync(TUser, String, String) |
Verifies the specified two factor authentication |
VerifyUserTokenAsync(TUser, String, String, String) |
Returns a flag indicating whether the specified |