dotnet / dotnet/aspnetcore

Changing authentication providers at runtime

Open
#14,250 17 comments 2 reactions 1 assignee Assigned to @blowdart View on GitHub
area-auth Docs
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

Hi,

I want to support (re)configuring authentication providers at runtime. There are many authentication types supported in the application: cookie authentication, a custom AuthenticationHandler and external providers (such as Google).

Is it possible to enable/disable and reconfigure authentication providers at runtime, even for external providers provided out of the box, such as Google? Additionally, it is possible to use the same external provider multiple times, but with different configurations?

I saw the example for dynamic schemes (https://github.com/aspnet/AspNetCore/blob/5a6b6c90b6e32ecab4975c546228cc63199f168b/src/AuthSamples/samples/DynamicSchemes/Controllers/AuthController.cs), but I was wondering how to do this with external providers that are supported out of the box. Since this is abstracted behind the `AddGoogle` extension on the AuthenticationBuilder, will I need to implement this myself?

I'm using ASP.NET Core 2.2.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.