Understanding the elements of authentication in .NET 6
Authentication in ASP.NET Core is handled by authentication middleware, which uses registered authentication handlers to perform authentication. Registered authentication handlers and their associated configurations are called authentication schemes.
The following list describes the core elements of an authentication framework:
- Authentication scheme: This defines the type and behavior of the authentication to be used to authenticate, challenge, and forbid. Authentication schemes are registered as authentication services in the application startup code in
Program.cs. They comprise an authentication handler and have options to configure this handler. You can register multiple authentication schemes to authenticate, challenge, and forbid actions. Alternatively, you can specify authentication schemes in the authorization policies that you configure. The following is a sample code to register anOpenIdConnectauthentication...