Qavren.Auth 0.1.1

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

Qavren.Auth (.NET)

Thin ASP.NET Core JWT bearer wiring for Qavren (Keycloak) realms. One call configures authority, JWKS validation, and realm-role mapping by convention. No custom cryptography.

Install

dotnet add package Qavren.Auth

Use

builder.Services.AddQavrenAuth("squarelog");
// or: builder.Services.AddQavrenAuth("squarelog", o => o.BaseUrl = "http://localhost:8080");

var app = builder.Build();
app.UseAuthentication();
app.UseAuthorization();

app.MapGet("/me", (ClaimsPrincipal u) => new { sub = u.FindFirstValue("sub") })
   .RequireAuthorization();

app.MapGet("/admin", () => "secret")
   .RequireAuthorization(p => p.RequireRole("admin"));

realm_access.roles is flattened into standard role claims, so [Authorize(Roles = "admin")], RequireRole("admin"), and User.IsInRole("admin") all work without knowing Keycloak's claim shape.

Convention (shared by all Qavren SDKs)

  • Base URL: QavrenAuthOptions.BaseUrl, else QAVREN_AUTH_URL, else https://auth.qavrensolutions.com. HTTPS metadata is required unless the base is http://localhost / http://127.0.0.1 (local dev).
  • Authority / issuer: {base}/realms/{realm}.
  • Claims consumed: sub (name claim), email, realm_access.roles.
  • Audience is NOT validated — Keycloak defaults aud to account. Trust rests on RS256 signature (realm JWKS) + issuer + lifetime.
  • Fail closed: any invalid token, or an unreachable JWKS, yields a 401 challenge — missing role yields 403.

Realm isolation

A token minted for squarelog is signed by squarelog's key and issued by .../realms/squarelog. An app wired with AddQavrenAuth("recharacter") validates a different issuer against a different JWKS, so the squarelog token is rejected — proven by TokenFromAnotherRealm_IsRejected.

Install

dotnet add package Qavren.Auth
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

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
0.1.1 355 7/30/2026
0.1.0 119 7/18/2026