// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Collections.Generic; namespace Microsoft.AspNetCore.Identity.EntityFrameworkCore { /// /// The default implementation of which uses a string as a primary key. /// public class IdentityUser : IdentityUser { /// /// Initializes a new instance of . /// /// /// The Id property is initialized to form a new GUID string value. /// public IdentityUser() { Id = Guid.NewGuid().ToString(); } /// /// Initializes a new instance of . /// /// The user name. /// /// The Id property is initialized to form a new GUID string value. /// public IdentityUser(string userName) : this() { UserName = userName; } } /// /// Represents a user in the identity system /// /// The type used for the primary key for the user. public class IdentityUser : IdentityUser, IdentityUserRole, IdentityUserLogin, IdentityUserToken> where TKey : IEquatable { } /// /// Represents a user in the identity system /// /// The type used for the primary key for the user. /// The type representing a claim. /// The type representing a user role. /// The type representing a user external login. /// The type representing a user external login. public class IdentityUser where TKey : IEquatable { /// /// Initializes a new instance of . /// public IdentityUser() { } /// /// Initializes a new instance of . /// /// The user name. public IdentityUser(string userName) : this() { UserName = userName; } /// /// Gets or sets the primary key for this user. /// public virtual TKey Id { get; set; } /// /// Gets or sets the user name for this user. /// public virtual string UserName { get; set; } /// /// Gets or sets the normalized user name for this user. /// public virtual string NormalizedUserName { get; set; } /// /// Gets or sets the email address for this user. /// public virtual string Email { get; set; } /// /// Gets or sets the normalized email address for this user. /// public virtual string NormalizedEmail { get; set; } /// /// Gets or sets a flag indicating if a user has confirmed their email address. /// /// True if the email address has been confirmed, otherwise false. public virtual bool EmailConfirmed { get; set; } /// /// Gets or sets a salted and hashed representation of the password for this user. /// public virtual string PasswordHash { get; set; } /// /// A random value that must change whenever a users credentials change (password changed, login removed) /// public virtual string SecurityStamp { get; set; } /// /// A random value that must change whenever a user is persisted to the store /// public virtual string ConcurrencyStamp { get; set; } = Guid.NewGuid().ToString(); /// /// Gets or sets a telephone number for the user. /// public virtual string PhoneNumber { get; set; } /// /// Gets or sets a flag indicating if a user has confirmed their telephone address. /// /// True if the telephone number has been confirmed, otherwise false. public virtual bool PhoneNumberConfirmed { get; set; } /// /// Gets or sets a flag indicating if two factor authentication is enabled for this user. /// /// True if 2fa is enabled, otherwise false. public virtual bool TwoFactorEnabled { get; set; } /// /// Gets or sets the date and time, in UTC, when any user lockout ends. /// /// /// A value in the past means the user is not locked out. /// public virtual DateTimeOffset? LockoutEnd { get; set; } /// /// Gets or sets a flag indicating if the user could be locked out. /// /// True if the user could be locked out, otherwise false. public virtual bool LockoutEnabled { get; set; } /// /// Gets or sets the number of failed login attempts for the current user. /// public virtual int AccessFailedCount { get; set; } /// /// Navigation property for the roles this user belongs to. /// public virtual ICollection Roles { get; } = new List(); /// /// Navigation property for the claims this user possesses. /// public virtual ICollection Claims { get; } = new List(); /// /// Navigation property for this users login accounts. /// public virtual ICollection Logins { get; } = new List(); /// /// Navigation property for this users tokens. /// public virtual ICollection Tokens { get; } = new List(); /// /// Returns the username for this user. /// public override string ToString() { return UserName; } } }