Identity.Base Docs
ASP.NET APIs
`Identity.Base.AspNet` is the integration layer for downstream .NET APIs that need to consume Identity Base-issued JWTs. It provides JWT bearer setup, scope helpers, and request logging middleware.
Install the package
bash
dotnet add package Identity.Base.AspNet Configure services and middleware
csharp
using Identity.Base.AspNet;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddIdentityBaseAuthentication("https://identity.example.com", "identity.api");
var app = builder.Build();
app.UseIdentityBaseRequestLogging();
app.UseIdentityBaseAuthentication();
app.MapGet("/api/protected", () => "Secure data").RequireAuthorization();
app.MapGet("/api/admin", () => "Admin data")
.RequireAuthorization(policy => policy.RequireScope("identity.api")); What the package handles
- JWT bearer configuration against the Identity Base authority.
- Scope-based authorization helpers such as `RequireScope(...)`.
- Development-friendly request logging for auth troubleshooting.