-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
dotnet user-jwts
generates incorrect configuration which results in IDX10500
#59277
Comments
dotnet user-jwts
produce incorrect configurationdotnet user-jwts create
generates incorrect configuration
dotnet user-jwts create
generates incorrect configurationdotnet user-jwts
generates incorrect configuration
For everyone who is seeking for temporary solution and don't want to read the whole article: {
"Authentication": {
"Schemes": {
"Bearer": {
"ValidAudiences": [
"http://localhost:5395",
"https://localhost:7452"
],
- "ValidIssuer": "dotnet-user-jwts"
+ "ValidIssuers": ["dotnet-user-jwts"]
}
}
}
} |
dotnet user-jwts
generates incorrect configurationdotnet user-jwts
generates incorrect configuration which results in IDX10500
Because of this issue the default setup described in the documentation (https://learn.microsoft.com/en-us/aspnet/core/security/authentication/jwt-authn?view=aspnetcore-9.0&tabs=windows) simply does not work. API always returns 401. If you set log level for Microsoft.AspNetCore.Authentication to Information you can see "IDX10500: Signature validation failed. No security keys were provided to validate the signature." in the output. Changing ValidIssuer to ValidIssuers helps as a workaround. Here (#52821 (comment)) satma0745 mentions the tests covering that ValidIssuer becomes a part of ValidIssuers collection, but it looks like GetIssuerSigningKeys is called BEFORE it happens. |
Actually, the tests you are talking about were update since that comment. And from what I see they include both I would stay on that the problem comes from |
Don't you count |
@dmytro-pryvedeniuk yes, I mean |
Fixed in scope of #58996. |
I'm still having this issue with macos. As described when I run
I get error unless I update
|
ZuluNovember, the fix is targeted for "9.0.x" version with "No due date" (see https://github.com/dotnet/aspnetcore/milestone/329?closed=1). It's not released as I understand. |
#59473 shows the milestone as 9.0.2, so that would be February's Update Tuesday at the earliest. |
Is there an existing issue for this?
Describe the bug
My pipeline looks like this (simplified):
I'm running
dotnet user-jwts create
and it updates my configuration with the next data:The problem is once I'm trying authenticate I got the next exception:
The reason of this is the breaking change of
JwtBearerConfigureOptions
:IssuerSigningKeys
is filling in using this code:where
GetIssuerSigningKeys
is iterating over specified issuers only:As a result,
Authentication:Schemes:Bearer:SigningKey
config section will be ignored at all.Expected Behavior
Either
dotnet user-jwts
tool should generate"ValidIssuers"
instead of"ValidIssuer"
orJwtBearerConfigureOptions
logic should be changed.I'm not really sure why
GetIssuerSigningKeys
was made in a way to respect only the keys for specified issuers instead of respect all the founded keys. Maybe it will have more sense to fixGetIssuerSigningKeys
instead of fixing thedotnet user-jwts
tool, but it will cause a one more breaking change 😥Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version
9.0.100
Anything else?
.NET SDK:
Version: 9.0.100
Commit: 59db016f11
Workload version: 9.0.100-manifests.3068a692
MSBuild version: 17.12.7+5b8665660
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19045
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\9.0.100\
.NET workloads installed:
[aspire]
Installation Source: VS 17.13.35507.96
Manifest Version: 8.2.2/8.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.aspire\8.2.2\WorkloadManifest.json
Install Type: Msi
Configured to use loose manifests when installing new manifests.
Host:
Version: 9.0.0
Architecture: x64
Commit: 9d5a6a9aa4
.NET SDKs installed:
6.0.404 [C:\Program Files\dotnet\sdk]
7.0.100 [C:\Program Files\dotnet\sdk]
8.0.100 [C:\Program Files\dotnet\sdk]
9.0.100-rc.2.24474.11 [C:\Program Files\dotnet\sdk]
9.0.100 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.0-rc.2.24474.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.0-rc.2.24473.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.12 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.0-rc.2.24474.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables:
Not set
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
The text was updated successfully, but these errors were encountered: