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
<PackageReference Include="Qavren.Auth" Version="0.1.1" />
<PackageVersion Include="Qavren.Auth" Version="0.1.1" />
<PackageReference Include="Qavren.Auth" />
paket add Qavren.Auth --version 0.1.1
#r "nuget: Qavren.Auth, 0.1.1"
#:package Qavren.Auth@0.1.1
#addin nuget:?package=Qavren.Auth&version=0.1.1
#tool nuget:?package=Qavren.Auth&version=0.1.1
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, elseQAVREN_AUTH_URL, elsehttps://auth.qavrensolutions.com. HTTPS metadata is required unless the base ishttp://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
audtoaccount. 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 | Versions 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. |
-
net10.0
- Microsoft.AspNetCore.Authentication.JwtBearer (>= 10.0.10)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.