Luka.Auth 1.0.9

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

Luka.Auth

Lightweight JWT authentication and permission management for the Luka .NET platform.


✨ Features

  • 🔐 JWT token generation and validation
  • ✅ Authorization via [Authorize(Policy = "YOUR_PERMISSION")]
  • 🎯 Enum-based permission definition using PermissionAttribute

⚙️ Configuration

appsettings.json

✅ Minimal example
{
  "jwt": {
    "issuerSigningKey": "yourSecretKey",
    "expiryMinutes": 60,
    "issuer": "lukachi",
    "validAudience": "lukachi",
    "validateAudience": false,
    "validateIssuer": false,
    "validateIssuerSigningKey": true,
    "validateLifetime": true,
    "isUsingSingleInstanceTokenRevocation": false
  }
}

🚀 Usage

  1. Register JWT in Program.cs

🔴 With Redis token blacklist:

builder.Services
    .AddLuka()
    .AddJwt<RedisAccessTokenService>() // Uses Redis for token revocation
    .AddRedis();

🟡 With In-Memory token blacklist:

builder.Services
    .AddLuka()
    .AddJwt<InMemoryAccessTokenService>(); // Uses IMemoryCache for token revocation

⚪ Without token blacklist:

builder.Services
    .AddLuka()
    .AddJwt(); // No token revocation
  1. Enable middleware
app.UseLuka()
   .UseAuthentication()           // Validates the JWT access token from the Authorization header
                                   // and sets HttpContext.User with claims from the token
   .UseAuthorization()           // Enforces access control based on registered policies and roles
                                   // (e.g., [Authorize(Policy = "CREATE_USER")])
   .UseAccessTokenValidator();   // Validates active token blacklist

🛠 Additional Notes

You can decorate your permission enum values with [Permission], and Luka.Auth will automatically register them as policies and sync with the database.

Token revocation via Redis or in-memory is automatically handled depending on which service you register.

Logout endpoint can call IAccessTokenService.DeactivateCurrentAsync()

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  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.9 237 7/14/2025
1.0.5 199 7/8/2025
1.0.4 211 7/8/2025
1.0.0 217 7/7/2025