dotnet / dotnet/announcements

Changes in default authentication scheme handling for ASP.NET Core

Open
#231 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
1.4k
Forks
53
PR merge metrics
No merged PRs in 30d

Description

Starting in .NET 7 Preview 7, we introduced new behavior in the authentication area in ASP.NET Core.

Previously, users were always required to set the default authentication scheme that would be used by authentication and authorization handlers, like so:

```csharp
builder.Services.AddAuthentication("MyDefaultScheme");
```

Moving forward, when (and only when) a single authentication scheme is registered, that scheme will be treated as the default scheme. For example, "foobar" will be treated as the default scheme in the code below.

```chsarp
builder.Services.AddAuthentication().AddOAuth("foobar");
```

This change might expose unintended behavior changes in applications, such as authentication options being validated earlier than expected.

**Discussion**

This change can be discussed in https://github.com/dotnet/aspnetcore/issues/42828.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.