Asgard.Heimdall.JwtSigning.AspNetCore
0.2.0
dotnet add package Asgard.Heimdall.JwtSigning.AspNetCore --version 0.2.0
NuGet\Install-Package Asgard.Heimdall.JwtSigning.AspNetCore -Version 0.2.0
<PackageReference Include="Asgard.Heimdall.JwtSigning.AspNetCore" Version="0.2.0" />
<PackageVersion Include="Asgard.Heimdall.JwtSigning.AspNetCore" Version="0.2.0" />
<PackageReference Include="Asgard.Heimdall.JwtSigning.AspNetCore" />
paket add Asgard.Heimdall.JwtSigning.AspNetCore --version 0.2.0
#r "nuget: Asgard.Heimdall.JwtSigning.AspNetCore, 0.2.0"
#:package Asgard.Heimdall.JwtSigning.AspNetCore@0.2.0
#addin nuget:?package=Asgard.Heimdall.JwtSigning.AspNetCore&version=0.2.0
#tool nuget:?package=Asgard.Heimdall.JwtSigning.AspNetCore&version=0.2.0
Asgard.Heimdall.JwtSigning.AspNetCore
ASP.NET Core integration for Asgard.Heimdall.JwtSigning.
This package exposes discovery and JWKS endpoints so Asgard resource services can validate JWTs through the existing host.auth.jwt flow.
Endpoints
/.well-known/openid-configuration
/.well-known/jwks.json
Usage
builder.Services.AddAsgardHeimdallJwtSigning(options =>
{
options.Issuer = "https://auth.example.com/scm";
options.Audience = "asgard-api";
options.DiscoveryPathPrefix = "/scm";
options.KeyId = "main-key";
options.RsaPrivateKeyPem = privateKeyPem;
options.RsaPublicKeyPem = publicKeyPem;
});
app.MapAsgardHeimdallJwtSigningDiscovery();
When DiscoveryPathPrefix is set to /scm, the package maps:
/scm/.well-known/openid-configuration
/scm/.well-known/jwks.json
The discovery document keeps the issuer contract aligned:
issuer == options.Issuer
jwks_uri == options.Issuer + "/.well-known/jwks.json"
For reverse proxy or gateway rewrites where the externally reachable JWKS URL is different, set JwksUriOverride as an escape hatch.
Your application still implements its own login API. Inside that API, inject IAsgardJwtIssuer and issue a token after your own user validation succeeds.
app.MapPost("/login", (IAsgardJwtIssuer issuer) =>
{
var token = issuer.Issue(new AsgardJwtSubject
{
Subject = "user-1",
UserId = "user-1",
TenantId = "11111111-2222-3333-4444-555555555555",
Roles = ["user"],
Permissions = ["profile.read"],
Scope = ["api"]
});
return Results.Ok(token);
});
Resource Service Configuration
Asgard resource services do not need to reference this package. They keep using Asgard's built-in JWT authentication and point issuerTemplate to the issuer hosted by this package.
host:
auth:
enabled: true
jwt:
issuerTemplate: "https://auth.example.com/scm"
audience: "asgard-api"
| 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
- Asgard.Heimdall.JwtSigning (>= 0.2.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.