UserManager<TUser, TKey> Class
Exposes user related APIs which will automatically save changes to the UserStore.
Namespace: Microsoft.AspNet.Identity
Assembly: Microsoft.AspNet.Identity.Core (in Microsoft.AspNet.Identity.Core.dll)
Inheritance Hierarchy
System.Object
Microsoft.AspNet.Identity.UserManager<TUser, TKey>
Microsoft.AspNet.Identity.UserManager<TUser>
Syntax
public class UserManager<TUser, TKey> : IDisposable
where TUser : class, IUser<TKey>
where TKey : object, IEquatable<TKey>
generic<typename TUser, typename TKey>
where TUser : ref class, IUser<TKey>
where TKey : Object, IEquatable<TKey>
public ref class UserManager : IDisposable
type UserManager<'TUser, 'TKey when 'TUser : not struct and IUser<'TKey> when 'TKey : Object and IEquatable<'TKey>> =
class
interface IDisposable
end
Public Class UserManager(Of TUser As { Class, IUser(Of TKey) }, TKey As { Object, IEquatable(Of TKey) })
Implements IDisposable
Type Parameters
- TUser
The entity type of the user.
- TKey
The entity key of the user.
Constructors
Name | Description | |
---|---|---|
UserManager<TUser, TKey>(IUserStore<TUser, TKey>) | Initializes a new instance of the UserManager<TUser, TKey> class. |
Properties
Name | Description | |
---|---|---|
ClaimsIdentityFactory | Gets or sets the factory used to create claims identities from users. |
|
DefaultAccountLockoutTimeSpan | Gets or sets the default amount of time that a user is locked out for after MaxFailedAccessAttemptsBeforeLockout is reached. |
|
EmailService | Gets or sets the service used to send e-mail. |
|
MaxFailedAccessAttemptsBeforeLockout | Gets or sets the maximum number of access attempts allowed before a user is locked out (if lockout is enabled). |
|
PasswordHasher | Gets or sets the property used to hash/verify passwords. |
|
PasswordValidator | Gets or sets the property used to validate passwords before persisting changes. |
|
SmsService | Gets or sets the property used to send a SMS message. |
|
Store | Gets or sets the persistence abstraction that the UserManager operates against. |
|
SupportsQueryableUsers | Gets a value that indicates whether the store is an IQueryableUserStore. |
|
SupportsUserClaim | Gets a value that indicates whether the store is an IUserClaimStore. |
|
SupportsUserEmail | Gets a value that indicates whether the store is an IUserEmailStore. |
|
SupportsUserLockout | Gets a value that indicates whether the store is an IUserLockoutStore. |
|
SupportsUserLogin | Gets a value that indicates whether the store is an IUserLoginStore. |
|
SupportsUserPassword | Gets a value that indicates whether the store is an IUserPasswordStore. |
|
SupportsUserPhoneNumber | Gets a value that indicates whether the store is an IUserPhoneNumberStore. |
|
SupportsUserRole | Gets a value that indicates whether the store is an IUserRoleStore. |
|
SupportsUserSecurityStamp | Gets a value that indicates whether the store is an IUserSecurityStore. |
|
SupportsUserTwoFactor | Gets a value that indicates whether the store is an IUserTwoFactorStore. |
|
TwoFactorProviders | Gets the registered two-factor authentication providers for users by their ID. |
|
UserLockoutEnabledByDefault | Gets or sets a value that indicates whether the user lockout is enabled when users are created. |
|
Users | Gets an IQueryable of users if the store is an IQueryableUserStore. |
|
UserTokenProvider | Gets or sets a property used for generating reset password and confirmation tokens. |
|
UserValidator | Gets or sets a property used to validate users before changes are saved. |
Methods
Name | Description | |
---|---|---|
AccessFailedAsync(TKey) | Increments the access failed count for the user and if the failed access account is greater than or equal to the MaxFailedAccessAttempsBeforeLockout, the user will be locked out for the next DefaultAccountLockoutTimeSpan and the AccessFailedCount will be reset to 0. This is used for locking out the user account. |
|
AddClaimAsync(TKey, Claim) | Adds a user claim. |
|
AddLoginAsync(TKey, UserLoginInfo) | Associates a login with a user. |
|
AddPasswordAsync(TKey, String) | Adds a user password only if one does not already exist. |
|
AddToRoleAsync(TKey, String) | Adds a user to a role. |
|
AddToRolesAsync(TKey, String[]) | Method to add user to multiple roles |
|
ChangePasswordAsync(TKey, String, String) | Changes a user password. |
|
ChangePhoneNumberAsync(TKey, String, String) | Sets a user phone number with the verification token. |
|
CheckPasswordAsync(TUser, String) | Determines whether the password is valid for the user. |
|
ConfirmEmailAsync(TKey, String) | Confirms the user e-mail with confirmation token. |
|
CreateAsync(TUser) | Creates a user with no password. |
|
CreateAsync(TUser, String) | Creates a user with the given password. |
|
CreateIdentityAsync(TUser, String) | Creates a ClaimsIdentity representing the user. |
|
DeleteAsync(TUser) | Deletes a user. |
|
Dispose() | Releases the resources used by the current instance of the UserManager<TUser, TKey> class. |
|
Dispose(Boolean) | Releases the resources used by the current instance of the UserManager<TUser, TKey> class. |
|
Equals(Object) | (Inherited from Object.) |
|
Finalize() | (Inherited from Object.) |
|
FindAsync(String, String) | Returns a user with the specified username and password or null if there is no match. |
|
FindAsync(UserLoginInfo) | Returns the user associated with this login. |
|
FindByEmailAsync(String) | Finds a user by his e-mail. |
|
FindByIdAsync(TKey) | Finds a user by ID. |
|
FindByNameAsync(String) | Finds a user by user name. |
|
GenerateChangePhoneNumberTokenAsync(TKey, String) | Generates a code that the user can use to change their phone number to a specific number. |
|
GenerateEmailConfirmationTokenAsync(TKey) | Gets the e-mail confirmation token for the user. |
|
GeneratePasswordResetTokenAsync(TKey) | Generates a password reset token for the user using the UserTokenProvider. |
|
GenerateTwoFactorTokenAsync(TKey, String) | Gets a token for a specific two factor provider. |
|
GenerateUserTokenAsync(String, TKey) | Gets a user token for a specific purpose. |
|
GetAccessFailedCountAsync(TKey) | Returns the number of failed access attempts for the user. |
|
GetClaimsAsync(TKey) | Gets a user claims. |
|
GetEmailAsync(TKey) | Gets a user e-mail. |
|
GetHashCode() | (Inherited from Object.) |
|
GetLockoutEnabledAsync(TKey) | Determines whether the lockout is enabled for the user. |
|
GetLockoutEndDateAsync(TKey) | Returns when the user is no longer locked out, dates in the past are considered as not being locked out. |
|
GetLoginsAsync(TKey) | Gets the logins for a user. |
|
GetPhoneNumberAsync(TKey) | Gets a user phone number. |
|
GetRolesAsync(TKey) | Returns the roles for the user. |
|
GetSecurityStampAsync(TKey) | Returns the current security stamp for a user. |
|
GetTwoFactorEnabledAsync(TKey) | Determines whether two factor authentication is enabled for a user. |
|
GetType() | (Inherited from Object.) |
|
GetValidTwoFactorProvidersAsync(TKey) | Returns a list of valid two factor providers for a user. |
|
HasPasswordAsync(TKey) | Determines whether the user has a password. |
|
IsEmailConfirmedAsync(TKey) | Determines whether the user e-mail has been confirmed. |
|
IsInRoleAsync(TKey, String) | Determines whether the user is in the specified role. |
|
IsLockedOutAsync(TKey) | Determines whether the user is locked out. |
|
IsPhoneNumberConfirmedAsync(TKey) | Determines whether the user phone number has been confirmed. |
|
MemberwiseClone() | (Inherited from Object.) |
|
NotifyTwoFactorTokenAsync(TKey, String, String) | Notifies a user with a token using a specific method of two-factor authentication provider. |
|
RegisterTwoFactorProvider(String, IUserTokenProvider<TUser, TKey>) | Registers a two factor authentication provider with the TwoFactorProviders mapping. |
|
RemoveClaimAsync(TKey, Claim) | Removes a user claim. |
|
RemoveFromRoleAsync(TKey, String) | Removes a user from a role. |
|
RemoveFromRolesAsync(TKey, String[]) | Remove user from multiple roles |
|
RemoveLoginAsync(TKey, UserLoginInfo) | Removes a user login. |
|
RemovePasswordAsync(TKey) | Removes a user password. |
|
ResetAccessFailedCountAsync(TKey) | Resets the access failed count for the user to 0. |
|
ResetPasswordAsync(TKey, String, String) | Resets a user password using a reset password token. |
|
SendEmailAsync(TKey, String, String) | Sends an e-mail to the user. |
|
SendSmsAsync(TKey, String) | Sends the user a SMS message. |
|
SetEmailAsync(TKey, String) | Sets a user e-mail. |
|
SetLockoutEnabledAsync(TKey, Boolean) | Sets whether lockout is enabled for this user. |
|
SetLockoutEndDateAsync(TKey, DateTimeOffset) | Sets the time when a user lockout ends. |
|
SetPhoneNumberAsync(TKey, String) | Sets a user phone number. |
|
SetTwoFactorEnabledAsync(TKey, Boolean) | Sets the two factor authentication enabled property for the user. |
|
ToString() | (Inherited from Object.) |
|
UpdateAsync(TUser) | Updates a user. |
|
UpdatePassword(IUserPasswordStore<TUser, TKey>, TUser, String) | ||
UpdateSecurityStampAsync(TKey) | Generates a new security stamp for a user, used for SignOutEverywhere functionality. |
|
VerifyChangePhoneNumberTokenAsync(TKey, String, String) | Verifies whether the code is valid for a specific user and for a specific phone number. |
|
VerifyPasswordAsync(IUserPasswordStore<TUser, TKey>, TUser, String) | Retrieves the hashed password from the user store and calls PasswordHasher.VerifyHashPassword. |
|
VerifyTwoFactorTokenAsync(TKey, String, String) | Verifies a two factor token with the specified provider. |
|
VerifyUserTokenAsync(TKey, String, String) | Verifies a user token with the specified purpose. |
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
See Also
Microsoft.AspNet.Identity Namespace
ASP.NET Identity
Return to top