-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Open
Labels
Pillar: Dev Experiencearea-authIncludes: Authn, Authz, OAuth, OIDC, BearerIncludes: Authn, Authz, OAuth, OIDC, BearerenhancementThis issue represents an ask for new feature or an enhancement to an existing oneThis issue represents an ask for new feature or an enhancement to an existing one
Milestone
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
An invalid/incomplete ASPNET Core authentication configuration causes the framework to crash and generate a stack overflow.
Expected Behavior
I would the application not to crash.
Steps To Reproduce
If I:
- Create a new empty ASP.NET Core application, .NET 8
- Add OpenIdConnect NuGet package (Microsoft.AspNetCore.Authentication.OpenIdConnect 8.0.1)
- add this code
builder.Services.AddAuthentication()
.AddOpenIdConnect("oidc", o =>
{
o.Authority = "https://example.com";
o.ClientId = "localhost-client";
o.ClientSecret = "mysecret";
o.ResponseType = "code";
o.Prompt = "consent";
});
- I start the application
- Then I get a stack overflow as shown below and the console output just outputs errors forever.
info: Microsoft.Hosting.Lifetime[14]
Now listening on: https://localhost:7106
info: Microsoft.Hosting.Lifetime[14]
Now listening on: http://localhost:5080
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
Content root path: c:\code\WebApplication1\WebApplication1
Stack overflow.
at System.Threading.Tasks.Task.FromResult[[System.__Canon, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.__Canon, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].SetResult(System.__Canon)
at Microsoft.AspNetCore.Authentication.AuthenticationHandlerProvider+<GetHandlerAsync>d__5.MoveNext()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[Microsoft.AspNetCore.Authentication.AuthenticationHandlerProvider+<GetHandlerAsync>d__5, Microsoft.AspNetCore.Authentication.Core, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]](<GetHandlerAsync>d__5 ByRef)
...
Yes, the confiuration is not complete/valid.
Exceptions (if any)
Stack Overflow
.NET Version
dotnet --version 8.0.100
Anything else?
No response
cadcad-sat, HaptelmanovArtem and wim-kaspar
Metadata
Metadata
Assignees
Labels
Pillar: Dev Experiencearea-authIncludes: Authn, Authz, OAuth, OIDC, BearerIncludes: Authn, Authz, OAuth, OIDC, BearerenhancementThis issue represents an ask for new feature or an enhancement to an existing oneThis issue represents an ask for new feature or an enhancement to an existing one