Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve .NET 7 JWT Bearer appsettings configuration doco #29325

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions aspnetcore/fundamentals/minimal-apis/security.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ The ASP.NET Core framework expects to find these options under the `Authenticati
}
```

For JWT Bearer authentication in a production app, you may need to specify the `Authentication:Schemes:{SchemeName}:Authority` property, which matches the address of the token-issuing authentication server. The `{SchemeName}` placeholder in the preceding property is the scheme name.

In case you don't have access to the token-issuing server, the `Authority` property should **not be set**. Instead, specify the signing key as a base64-encoded string under the `Bearer` scheme `SigningKeys:{SigningKeyName}:Value` with the `SigningKeys:{SigningKeyName}:Issuer` matching the `ValidIssuer` specified in the authentication scheme configuration. The `{SigningKeyName}` placeholder in the preceding examples is the signing key name.

For a full list of JWT bearer authentication configuration options, see the [`JwtBearerConfigureOptions` class (reference source)](https://github.com/dotnet/aspnetcore/blob/main/src/Security/Authentication/JwtBearer/src/JwtBearerConfigureOptions.cs).

[!INCLUDE[](~/includes/aspnetcore-repo-ref-source-links.md)]

In `Program.cs`, two JWT bearer-based authentication strategies are registered, with the:

* "Bearer" scheme name.
Expand Down