Skip to content
This repository was archived by the owner on Dec 13, 2018. It is now read-only.
This repository was archived by the owner on Dec 13, 2018. It is now read-only.

Provide a way to prevent AuthenticationSchemeProvider from picking a specific scheme handler #1287

Closed
@kevinchalet

Description

@kevinchalet

When there's only one authentication handler registered, AuthenticationSchemeProvider uses it as the default scheme handler for basically everything (authentication, challenge, forbidden, sign-in and sign-out).

Sadly, this logic makes no sense for handlers like ASOS, that throws an InvalidOperationException if you try to call one of the IAuthenticationService methods outside an OpenID Connect request (for obvious security reasons).

Yet, AuthenticationMiddleware uses GetDefaultAuthenticateSchemeAsync() and automatically calls [ASOS].AuthenticateAsync() for each request, which is detected as an invalid operation and causes an exception when ASOS is the only handler registered in the DI container.

Please consider adding a flag to disable this extremely annoying behavior, either at the global level, or per-handler.

/cc @HaoK

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions