How can I select different Authentication Handlers in ASP.NET 6 app?

751 views Asked by At

I am trying to create an app on the top of ASP.NET 6/Core framework using C#. I want to allow users to login either using basic-authentication "app managed username and password" or LDAP authentication.

Use Cases

Scenario #1 a user that belongs to active directory would provide their username and password. LdapAuthenticationHandler would check the provided credentials against an LDAP server.

Scenario #2 a user that does NOT belong to active directory would provide their username and password. BasicAuthenticationHandler would check the provided credentials against the username and password stored in the app's database.

Findings

ASP.NET Identity allow me to register different types of authentication providers as explained here. Also, it explains how to select the authentication provider using the [Authorize] attribute.

Questions

When a user logins using the login form, how can I determine which authentication provider I should use to validate the user?

0

There are 0 answers