MasLazu.AspNet.Authentication.Core.Base 1.0.0-preview.10

This is a prerelease version of MasLazu.AspNet.Authentication.Core.Base.
dotnet add package MasLazu.AspNet.Authentication.Core.Base --version 1.0.0-preview.10
                    
NuGet\Install-Package MasLazu.AspNet.Authentication.Core.Base -Version 1.0.0-preview.10
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MasLazu.AspNet.Authentication.Core.Base" Version="1.0.0-preview.10" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MasLazu.AspNet.Authentication.Core.Base" Version="1.0.0-preview.10" />
                    
Directory.Packages.props
<PackageReference Include="MasLazu.AspNet.Authentication.Core.Base" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MasLazu.AspNet.Authentication.Core.Base --version 1.0.0-preview.10
                    
#r "nuget: MasLazu.AspNet.Authentication.Core.Base, 1.0.0-preview.10"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MasLazu.AspNet.Authentication.Core.Base@1.0.0-preview.10
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MasLazu.AspNet.Authentication.Core.Base&version=1.0.0-preview.10&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=MasLazu.AspNet.Authentication.Core.Base&version=1.0.0-preview.10&prerelease
                    
Install as a Cake Tool

MasLazu.AspNet.Authentication.Core.Base

This project contains the base implementations for the MasLazu ASP.NET Authentication Core library.

Overview

The MasLazu.AspNet.Authentication.Core.Base project provides:

  • Service Implementations: Concrete implementations of authentication and user management interfaces
  • JWT Utilities: Token generation, validation, and management utilities
  • Validation: FluentValidation validators for request models
  • Extensions: Dependency injection and application setup extensions
  • Configuration: JWT and authentication configuration classes
  • Background Services: Database seeding and maintenance services

Key Services

  • AuthService: Implements IAuthService for user authentication and JWT token management
  • UserService: Implements IUserService for user CRUD operations and email verification
  • GenderService, LanguageService, TimezoneService: CRUD services for reference data
  • LoginMethodService: Implements ILoginMethodService for login method management
  • UserLoginMethodService: Implements IUserLoginMethodService for user-login method associations

Key Components

  • JwtUtil: Utility class for JWT access and refresh token generation and validation
  • JwtConfiguration: Configuration class for JWT settings
  • AuthenticationCoreApplicationServiceExtension: Extension for registering services in DI
  • AuthenticationCoreDatabaseSeedBackgroundService: Background service for database seeding

Project Configuration

  • Target Framework: .NET 9.0
  • Implicit Usings: Enabled
  • Nullable Reference Types: Enabled

Dependencies

  • Package References:

    • MasLazu.AspNet.Framework.Application - Base application framework
    • MasLazu.AspNet.Framework.Domain - Domain framework
    • MasLazu.AspNet.Verification.Abstraction - Verification abstractions
    • Microsoft.Extensions.DependencyInjection - DI container
    • Microsoft.Extensions.Hosting - Hosting abstractions
    • System.IdentityModel.Tokens.Jwt - JWT token handling
    • Microsoft.IdentityModel.Tokens - Token validation
  • Project References:

    • MasLazu.AspNet.Authentication.Core.Domain - Domain entities
    • MasLazu.AspNet.Authentication.Core.Abstraction - Service interfaces

Usage

Register the services in your application's DI container:

services.AddAuthenticationCoreApplicationServices();

Configure JWT settings in appsettings.json:

{
  "Jwt": {
    "Key": "your-secret-key",
    "Issuer": "your-issuer",
    "Audience": "your-audience",
    "AccessTokenExpirationMinutes": 120,
    "RefreshTokenExpirationDays": 30
  }
}

🛠️ Development Guidelines

Naming Conventions

  • Services: Suffix with Service (e.g., AuthService)
  • Extensions: Suffix with Extension (e.g., AuthenticationCoreApplicationServiceExtension)
  • Validators: Suffix with Validator (e.g., CreateUserRequestValidator)
  • Utils: Suffix with Util (e.g., JwtUtil)
  • Configuration: Suffix with Configuration (e.g., JwtConfiguration)

Code Structure

src/MasLazu.AspNet.Authentication.Core.Base/
├── BackgroundServices/    # Background services for maintenance
├── Configuration/         # Configuration classes
├── Extensions/            # DI and application extensions
├── Services/              # Service implementations
├── Utils/                 # Utility classes and property maps
├── Validators/            # Request validators
├── MasLazu.AspNet.Authentication.Core.Base.csproj
└── README.md

Best Practices

  • Implement interfaces from the Abstraction layer
  • Use dependency injection for service dependencies
  • Include proper error handling and validation
  • Follow async/await patterns consistently
  • Use meaningful variable names and XML documentation

🤝 Contributing

  • New Services: Implement corresponding interfaces from Abstraction
  • Configuration: Add new settings to configuration classes
  • Validation: Create validators for new request models
  • Extensions: Update DI registration for new services
  • Testing: Add unit and integration tests for implementations

📄 License

Part of the MasLazu ASP.NET framework ecosystem.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0-preview.10 141 10/8/2025
1.0.0-preview.9 140 10/2/2025
1.0.0-preview.8 136 10/1/2025
1.0.0-preview.7 134 10/1/2025
1.0.0-preview.5 140 9/29/2025
1.0.0-preview.3 270 9/18/2025

See RELEASES.md for release notes.