Skip to main content

arolariu.Backend.Core.Auth.Models

arolariu.Backend.Core.Auth

arolariu.Backend.Core.Auth.Models Namespace

Classes

AuthenticatedUser Class

Represents an authenticated user in the system with extended profile information. This class extends ASP.NET Core Identity's IdentityUser with additional personal data fields.

public class AuthenticatedUser : Microsoft.AspNetCore.Identity.IdentityUser<System.Guid>

Inheritance System.Object 🡒 Microsoft.AspNetCore.Identity.IdentityUser<System.Guid> 🡒 AuthenticatedUser

Example

// Creating a new authenticated user
var user = new AuthenticatedUser
{
UserName = "john.doe@example.com",
Email = "john.doe@example.com",
Name = "John Doe",
DateOfBirth = new DateOnly(1990, 5, 15),
EmailConfirmed = true
};

Remarks

This model integrates with ASP.NET Core Identity to provide: - Standard authentication fields (username, email, password hash) - Extended user profile information (name, date of birth) - GDPR compliance through PersonalData attributes - Guid-based primary keys for enhanced security and scalability

Properties

AuthenticatedUser.DateOfBirth Property

Gets or sets the user's date of birth. This field is used for age verification and demographic analysis.

public System.DateOnly DateOfBirth { get; set; }

Property Value

System.DateOnly
A DateOnly representing the user's birth date. Used for age-related features and compliance requirements.

Remarks

This property is marked as PersonalData for GDPR compliance: - Sensitive personal information requiring protection - Used for age verification and content filtering - May be required for certain services or legal compliance - Subject to data retention and deletion policies

AuthenticatedUser.Name Property

Gets or sets the display name of the user. This field contains the user's preferred name for display purposes.

public string? Name { get; set; }

Property Value

System.String
A string representing the user's display name, or null if not provided. This value may differ from the username and is used for personalization.

Remarks

This property is marked as PersonalData for GDPR compliance: - Included in data export requests - Removed during account deletion - Subject to data protection regulations - Used for UI personalization and user identification

AuthenticatedUserRole Class

Represents a user role in the authentication system for role-based access control. This class extends ASP.NET Core Identity's IdentityRole to define user permissions and access levels.

public class AuthenticatedUserRole : Microsoft.AspNetCore.Identity.IdentityRole<System.Guid>

Inheritance System.Object 🡒 Microsoft.AspNetCore.Identity.IdentityRole<System.Guid> 🡒 AuthenticatedUserRole

Example

// Creating system roles
var adminRole = new AuthenticatedUserRole
{
Id = Guid.NewGuid(),
Name = "Administrator",
NormalizedName = "ADMINISTRATOR"
};

var userRole = new AuthenticatedUserRole
{
Id = Guid.NewGuid(),
Name = "User",
NormalizedName = "USER"
};

Remarks

This model provides role-based authorization capabilities: - Defines permission groups for users (e.g., Admin, User, Moderator) - Integrates with ASP.NET Core Identity role management - Uses Guid-based primary keys for enhanced security - Supports hierarchical and policy-based authorization scenarios

// was this page useful?