JM.Core.Security 1.0.0-alpha.1

This is a prerelease version of JM.Core.Security.
dotnet add package JM.Core.Security --version 1.0.0-alpha.1
                    
NuGet\Install-Package JM.Core.Security -Version 1.0.0-alpha.1
                    
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="JM.Core.Security" Version="1.0.0-alpha.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="JM.Core.Security" Version="1.0.0-alpha.1" />
                    
Directory.Packages.props
<PackageReference Include="JM.Core.Security" />
                    
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 JM.Core.Security --version 1.0.0-alpha.1
                    
#r "nuget: JM.Core.Security, 1.0.0-alpha.1"
                    
#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 JM.Core.Security@1.0.0-alpha.1
                    
#: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=JM.Core.Security&version=1.0.0-alpha.1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=JM.Core.Security&version=1.0.0-alpha.1&prerelease
                    
Install as a Cake Tool

JM Core Packages

Reusable .NET packages for application, persistence, security, exception handling, and logging concerns.

Packages

Package Purpose
JM.Core.Persistence Entity base classes, repository abstractions, EF Core repository implementation, pagination, and dynamic query helpers.
JM.Core.CrossCuttingConcerns Exception types, problem details, exception middleware, and Serilog-based logging utilities.
JM.Core.Security Security entities, JWT helpers, hashing utilities, claims extensions, OTP helpers, and security service registration.
JM.Core.Application MediatR pipeline behaviors for validation, authorization, caching, logging, and transactions.

All packages currently target net10.0.

Installation

Install only the packages your project needs:

dotnet add package JM.Core.Persistence --version 1.0.0
dotnet add package JM.Core.CrossCuttingConcerns --version 1.0.0
dotnet add package JM.Core.Security --version 1.0.0
dotnet add package JM.Core.Application --version 1.0.0

Package dependency order:

JM.Core.Persistence
JM.Core.CrossCuttingConcerns
JM.Core.Security -> JM.Core.Persistence
JM.Core.Application -> JM.Core.CrossCuttingConcerns, JM.Core.Persistence, JM.Core.Security

Security Setup

builder.Services.AddSecurityServices();

Configuration:

{
  "TokenOptions": {
    "Audience": "example-audience",
    "Issuer": "example-issuer",
    "AccessTokenExpiration": 60,
    "SecurityKey": "use-a-long-secure-key-from-secrets",
    "RefreshTokenTTL": 7
  }
}

Do not store production signing keys in source-controlled configuration files.

Exception Middleware Setup

app.UseExceptionMiddleware();

Register the middleware before endpoint execution so application exceptions can be converted into problem details responses.

Logging Setup

File logger configuration:

{
  "SerilogConfigurations": {
    "FileConfiguration": {
      "FolderPath": "/logs/app"
    }
  }
}

SQL logger configuration:

{
  "SerilogConfigurations": {
    "MsSqlConfiguration": {
      "ConnectionString": "Server=.;Database=Logs;Trusted_Connection=True;TrustServerCertificate=True;",
      "TableName": "Logs",
      "AutoCreateSqlTable": true
    }
  }
}

Register one logger implementation:

builder.Services.AddSingleton<LoggerServiceBase, FileLogger>();

or:

builder.Services.AddSingleton<LoggerServiceBase, MsSqlLogger>();

Caching Setup

Register an IDistributedCache implementation:

builder.Services.AddDistributedMemoryCache();

Configuration:

{
  "CacheSettings": {
    "SlidingExpiration": 2
  }
}

SlidingExpiration is interpreted as days when a request does not provide a custom expiration.

MediatR Pipeline Setup

Register only the behaviors used by the consuming application:

builder.Services.AddMediatR(configuration =>
{
    configuration.RegisterServicesFromAssembly(typeof(Program).Assembly);
});

builder.Services.AddHttpContextAccessor();
builder.Services.AddTransient(typeof(IPipelineBehavior<,>), typeof(RequestValidationBehavior<,>));
builder.Services.AddTransient(typeof(IPipelineBehavior<,>), typeof(AuthorizationBehavior<,>));
builder.Services.AddTransient(typeof(IPipelineBehavior<,>), typeof(CachingBehavior<,>));
builder.Services.AddTransient(typeof(IPipelineBehavior<,>), typeof(CacheRemovingBehavior<,>));
builder.Services.AddTransient(typeof(IPipelineBehavior<,>), typeof(LoggingBehavior<,>));
builder.Services.AddTransient(typeof(IPipelineBehavior<,>), typeof(TransactionScopeBehavior<,>));

Register validators if using validation behavior:

builder.Services.AddValidatorsFromAssembly(typeof(Program).Assembly);

Packaging

The canonical packaging and release process is documented in NUGET_GUIDE.md.

License

This project is licensed under the MIT License.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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 (1)

Showing the top 1 NuGet packages that depend on JM.Core.Security:

Package Downloads
JM.Core.Application

MediatR pipeline behaviors, request and response models, validation, authorization, caching, logging, and transaction markers for .NET applications.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0-alpha.1 82 4/28/2026

See CHANGELOG.md.