MasLazu.AspNet.Authorization.Core
1.0.0-preview.7
dotnet add package MasLazu.AspNet.Authorization.Core --version 1.0.0-preview.7
NuGet\Install-Package MasLazu.AspNet.Authorization.Core -Version 1.0.0-preview.7
<PackageReference Include="MasLazu.AspNet.Authorization.Core" Version="1.0.0-preview.7" />
<PackageVersion Include="MasLazu.AspNet.Authorization.Core" Version="1.0.0-preview.7" />
<PackageReference Include="MasLazu.AspNet.Authorization.Core" />
paket add MasLazu.AspNet.Authorization.Core --version 1.0.0-preview.7
#r "nuget: MasLazu.AspNet.Authorization.Core, 1.0.0-preview.7"
#:package MasLazu.AspNet.Authorization.Core@1.0.0-preview.7
#addin nuget:?package=MasLazu.AspNet.Authorization.Core&version=1.0.0-preview.7&prerelease
#tool nuget:?package=MasLazu.AspNet.Authorization.Core&version=1.0.0-preview.7&prerelease
MasLazu.AspNet.Authorization.Core
This project contains the core implementation of the MasLazu ASP.NET Authorization system. It provides concrete implementations of the service interfaces defined in the Abstraction layer, along with dependency injection registrations, validation rules, and utility classes.
Overview
The Core layer serves as the main implementation hub, bringing together the abstractions, domain entities, and framework components to provide a complete authorization system. It implements the business logic through service classes and handles cross-cutting concerns like validation and dependency injection.
Architecture
The project follows a modular architecture with clear separation of concerns:
Core Layer
├── Services/ # Business logic implementations
├── Extensions/ # Dependency injection registrations
├── Validators/ # Input validation rules
└── Utils/ # Property mapping utilities
Services
The project implements all service interfaces from the Abstraction layer using the framework's CrudService<T> base class:
Implemented Services
- ActionService - Implements
IActionService - PermissionService - Implements
IPermissionService - PermissionTypeService - Implements
IPermissionTypeService - ResourceService - Implements
IResourceService - ResourceActionService - Implements
IResourceActionService
Each service inherits from CrudService<TEntity, TDto, TCreateRequest, TUpdateRequest> and provides full CRUD operations with:
- Repository pattern for data access
- Unit of work for transaction management
- Validation integration
- Property mapping for sorting and filtering
Extensions
The Extensions folder contains dependency injection setup classes:
AuthorizationCoreApplicationExtension
Main extension method that registers all components:
services.AddAuthorizationCoreApplication();
AuthorizationCoreApplicationServiceExtension
Registers all service implementations in the DI container.
AuthorizationCoreApplicationUtilExtension
Registers property maps and expression builders for dynamic querying and sorting.
AuthorizationCoreApplicationValidatorExtension
Registers all FluentValidation validators for request validation.
Validators
Comprehensive validation rules using FluentValidation:
Create Validators
CreateActionRequestValidatorCreatePermissionRequestValidatorCreatePermissionTypeRequestValidatorCreateResourceRequestValidatorCreateResourceActionRequestValidator
Update Validators
UpdateActionRequestValidatorUpdatePermissionRequestValidatorUpdatePermissionTypeRequestValidatorUpdateResourceRequestValidatorUpdateResourceActionRequestValidator
Validation Rules
Common validation patterns include:
- Required fields (NotEmpty)
- Maximum length constraints
- Format validation where applicable
Utils (Property Maps)
Property mapping classes for dynamic sorting and filtering:
ActionEntityPropertyMapPermissionEntityPropertyMapPermissionTypeEntityPropertyMapResourceEntityPropertyMapResourceActionEntityPropertyMap
Each map implements IEntityPropertyMap<TEntity> and provides:
- Case-insensitive property name mapping
- Expression trees for LINQ queries
- Support for common properties (id, code, name, timestamps)
Dependencies
This project depends on:
MasLazu.AspNet.Authorization.Core.Abstraction- Service interfaces and DTOsMasLazu.AspNet.Authorization.Core.Domain- Domain entitiesFluentValidation- Input validation frameworkMicrosoft.Extensions.DependencyInjection- DI containerMasLazu.AspNet.Framework.Application- Base service classes and interfaces
Usage
Basic Setup
var services = new ServiceCollection();
// Add the complete authorization system
services.AddAuthorizationCoreApplication();
// Additional setup (repositories, database context, etc.)
// ...
var serviceProvider = services.BuildServiceProvider();
Individual Component Registration
// Register only services
services.AddAuthorizationCoreApplicationServices();
// Register only validators
services.AddAuthorizationCoreApplicationValidators();
// Register only utilities
services.AddAuthorizationCoreApplicationUtils();
Service Usage
// Inject services
private readonly IActionService _actionService;
// Use CRUD operations
var actions = await _actionService.GetAllAsync();
var action = await _actionService.GetByIdAsync(id);
await _actionService.CreateAsync(request);
await _actionService.UpdateAsync(request);
await _actionService.DeleteAsync(id);
Integration
This Core project integrates with:
- EF Core Layer: Provides data access implementations
- Endpoint Layer: Exposes HTTP APIs
- Application Layer: Orchestrates business operations
The Core layer acts as the central orchestrator, coordinating between the abstraction contracts and concrete implementations while providing a clean API for higher-level components.
| Product | Versions 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. |
-
net9.0
- FastEndpoints (>= 7.0.1)
- FluentValidation (>= 12.0.0)
- MasLazu.AspNet.Authorization.Core.Abstraction (>= 1.0.0-preview.7)
- MasLazu.AspNet.Authorization.Core.Domain (>= 1.0.0-preview.7)
- MasLazu.AspNet.Framework.Application (>= 1.0.0-preview.15)
- MasLazu.AspNet.Framework.Domain (>= 1.0.0-preview.15)
- Microsoft.Extensions.DependencyInjection (>= 9.0.9)
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.7 | 155 | 10/9/2025 |
| 1.0.0-preview.6 | 126 | 10/9/2025 |
| 1.0.0-preview.5 | 127 | 10/9/2025 |
| 1.0.0-preview.1 | 157 | 9/20/2025 |