Class UserBase<TKey>
- Namespace
- NuvTools.Security.Identity.Models
- Assembly
- NuvTools.Security.Identity.Models.dll
Represents the base class for application users within the identity system.
public abstract class UserBase<TKey> : IdentityUser<TKey> where TKey : IEquatable<TKey>
Type Parameters
- Inheritance
-
IdentityUser<TKey>UserBase<TKey>
- Inherited Members
Remarks
This abstract class extends IdentityUser<TKey> to include additional profile data and validation attributes for multilingual applications. It also introduces password and refresh token fields that are not persisted in the database.
Properties
Gets or sets the user's email address.
[Display(Name = "Email", ResourceType = typeof(Fields))]
[Required(ErrorMessageResourceName = "XRequired", ErrorMessageResourceType = typeof(Messages))]
[MaxLength(100, ErrorMessageResourceName = "XMustHaveUpToYCharacters", ErrorMessageResourceType = typeof(Messages))]
[EmailAddress(ErrorMessageResourceName = "XInvalid", ErrorMessageResourceType = typeof(Messages))]
public override string? Email { get; set; }
Property Value
Remarks
This property overrides the base Email property to add localized display names and validation attributes.
Name
Gets or sets the user's first name.
[Display(Name = "Name", ResourceType = typeof(Fields))]
[MaxLength(50, ErrorMessageResourceName = "XMustHaveUpToYCharacters", ErrorMessageResourceType = typeof(Messages))]
public virtual string? Name { get; set; }
Property Value
Password
Gets or sets the user's password.
This property is not persisted in the database.
[NotMapped]
[Display(Name = "Password", ResourceType = typeof(Fields))]
[Required(ErrorMessageResourceName = "XRequired", ErrorMessageResourceType = typeof(Messages))]
[MaxLength(40, ErrorMessageResourceName = "XMustHaveUpToYCharacters", ErrorMessageResourceType = typeof(Messages))]
[MinLength(6, ErrorMessageResourceName = "XMustHaveAtLeastYCharacters", ErrorMessageResourceType = typeof(Messages))]
[PasswordComplexityCapitalLetters(1)]
[PasswordComplexityLowerCaseLetters(1)]
[PasswordComplexityDigits(1)]
public virtual string? Password { get; set; }
Property Value
Remarks
It is intended for use during user registration or password updates. The complexity attributes are enforced through NuvTools.Validation.Annotations.
RefreshToken
Gets or sets the refresh token used for renewing authentication sessions.
[NotMapped]
public string? RefreshToken { get; set; }
Property Value
Remarks
This property is not mapped to the database and is meant for temporary runtime storage.
RefreshTokenExpiryTime
Gets or sets the date and time when the refresh token expires.
[NotMapped]
public DateTime RefreshTokenExpiryTime { get; set; }
Property Value
Remarks
This property is not persisted in the database.
Status
Gets or sets a value indicating whether the user account is active.
[Display(Name = "Status", ResourceType = typeof(Fields))]
public virtual bool Status { get; set; }
Property Value
Surname
Gets or sets the user's last name or surname.
[Display(Name = "Surname", ResourceType = typeof(Fields))]
[MaxLength(50, ErrorMessageResourceName = "XMustHaveUpToYCharacters", ErrorMessageResourceType = typeof(Messages))]
public virtual string? Surname { get; set; }