LumoAuth.AspNetCore 1.6.0

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

LumoAuth.AspNetCore

LumoAuth for ASP.NET Core 8 and newer. The package registers the LumoAuth SDK as services and connects it to ASP.NET Core:

  • Dependency injection from appsettings.json and LUMOAUTH_* environment variables.
  • A bearer authentication scheme that turns LumoAuth access tokens into a ClaimsPrincipal.
  • OpenID Connect sign-in with a cookie session, for web apps.
  • Authorization with [RequirePermission], [RequireRelation] and [RequireAbac], and ILumoAuthorization for checks inside handlers.
  • A health check for your LumoAuth organization.

It installs the LumoAuth SDK with it.

Install

dotnet add package LumoAuth.AspNetCore

Quick start

{
  "LumoAuth": {
    "OrgId": "acme-corp",
    "ApiKey": "lmk_...",
    "Login": { "ClientId": "lumo_abc", "ClientSecret": "..." }
  }
}
using LumoAuth.AspNetCore;
using LumoAuth.AspNetCore.Authentication;
using LumoAuth.AspNetCore.Authorization;

builder.Services.AddLumoAuth(builder.Configuration);                                    // the "LumoAuth" section
builder.Services.AddAuthentication(LumoAuthDefaults.BearerScheme).AddLumoAuthBearer();   // APIs: bearer tokens
// builder.Services.AddLumoAuthWebAppAuthentication(builder.Configuration);             // web apps: cookie + OpenID Connect
builder.Services.AddAuthorization();
builder.Services.AddHealthChecks().AddLumoAuth();

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

app.MapPost("/invoices/{id}/approve", Approve).RequirePermission("invoice.approve");
app.MapGet("/documents/{id}", GetDocument).RequireRelation("viewer", "document:{id}");
app.MapHealthChecks("/health");

Configuration

Key Environment variable Meaning
LumoAuth:BaseUrl LUMOAUTH_URL LumoAuth region URL. The default is https://app.lumoauth.dev.
LumoAuth:OrgId LUMOAUTH_ORG_ID Your organization's slug
LumoAuth:ApiKey LUMOAUTH_API_KEY Organization API key
LumoAuth:Login:* ClientId, ClientSecret, Scopes (default openid, profile, email) and CallbackPath (default /signin-lumoauth) for OpenID Connect sign-in
LumoAuth:Agent:* AGENT_CLIENT_ID, AGENT_CLIENT_SECRET Registers a LumoAgent singleton
LumoAuth:AAuth:* AgentIdentifier and PrivateKeyPem register an AAuthClient singleton

Add authz:read to Login:Scopes when the app lists the user's permissions. Add abac:read when the app uses [RequireAbac].

How authorization checks run

The attributes and ILumoAuthorization run a live LumoAuth check for each request:

  • When the scheme saved the caller's access token (both LumoAuth schemes do), the check runs with that token.
  • When no token was saved, the check runs with the API key and names the signed-in user as the subject. The subject is the principal's sub claim, which is the user's LumoAuth ID for LumoAuth sign-ins. A principal whose sub is agent_<id> is checked as that agent. The API key then needs the authz:check scope.

ABAC checks ([RequireAbac] and ILumoAuthorization.AbacAsync) always run with the user's own access token, because the ABAC routes do not accept API keys. The token needs the abac:read scope:

  • After an OpenID Connect sign-in, the SDK takes the token that the handler saved. Keep Login:SaveTokens on (the default) and add abac:read to Login:Scopes.
  • On an API request, the SDK takes the token that the bearer scheme saved. If no token was saved, it takes the token from the Authorization: Bearer header.
  • If neither exists, the check is denied and a warning is logged. The SDK never sends the API key to the ABAC routes.

A missing permission gives 403, and a request without a signed-in principal gives 401. If LumoAuth cannot be reached, the request is denied with 403 and a warning is logged.

More information

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.6.0 88 11/19/2026
1.5.0 117 11/13/2026
1.4.0 102 11/7/2026
1.3.0 96 11/5/2026
1.2.0 108 10/30/2026
1.1.0 100 10/30/2026
1.0.0 115 10/9/2026