dotnet / dotnet/aspnetcore

Consider resolving IAuthenticationSchemeProvider from DI in Invoke in AuthenticationMiddleware

Open
#4,649 5 comments 2 reactions 0 assignees View on GitHub
area-auth multi-tenancy
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

In short, accepting the IAuthenticationSchemeProvider as a ctor to the AuthenticationMiddleware forces it to be a singleton. I know the default is deigned that way and put in DI that way, but if someone wants to replace it (say with something that hits a DB) then it's difficult.

Contributor guide

Open the contributing guide

Research direction

Start by locating AuthenticationMiddleware and comparing its constructor with the Invoke path. Determine how resolving IAuthenticationSchemeProvider during Invoke would permit non-singleton implementations, then verify the middleware and authentication tests cover the expected lifetime behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
authentication, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.