JwtBearerOptions.Authority must be explicitly set to null on Windows 11
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 276
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Describe the bug
When configuring the JwtBearerOptions in AddJwtBearer, the JwtBearerOptions.Authority member needs to be explicitly set to null on Windows 11. If it is not, the authentication middleware will try to search for an OpenID Connect server that doesn't exist, and lag for a few seconds before continuing.
### Expected Behavior
The authentication middleware should not attempt to query an OpenID Connect server without explicitly being configured to do so.
### Steps To Reproduce
Clone example repository: https://github.com/dan-p-dev/JwtError
In my tests, I've been creating a token with `dotnet user-jwts create`, and curl to GET from the `test` endpoint. The request will lag for a few seconds before completing successfully.
I used `dotnet-trace` to profile the request, and a function call for `OpenIdConnect.OpenIdConnectConfigurationRetriever+d__3::Move` appears in the results.
After testing this, I uncommented line line 26 in Program.cs (`jwtOptions.Authority = null;`) and repeated my tests. In this case, there is no lag in the request, and `dotnet-trace` shows no OpenIdConnect related function calls.
### Exceptions (if any)
This error does not occur on any of the Linux-based systems I tested on, despite occurring on each Windows 11 system. All systems had the same dotnet version.
### .NET Version
10.0.101
### Anything else?
Windows Version: Windows 11 Pro
OS Version: 10.0.26200
Contributor guide
Assessment
This issue has not been assessed yet.