Skip to content

Add NativeAOT support for JwtBearer Authentication #47487

@eerhardt

Description

@eerhardt

The following program produces AOT warnings and doesn't work after being published to NativeAOT:

using System.Security.Claims;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddAuthentication().AddJwtBearer();
builder.Services.AddAuthorization();

var app = builder.Build();

app.MapGet("/", () => "Hello, World!");
app.MapGet("/secret", (ClaimsPrincipal user) => $"Hello {user.Identity?.Name}. My secret")
    .RequireAuthorization();

app.Run();

We should enable this to work in ASP.NET 8 with NativeAOT.

Underlying issues:

Metadata

Metadata

Assignees

No one assigned

    Labels

    NativeAOTarea-authIncludes: Authn, Authz, OAuth, OIDC, Bearer

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions