This approach mirros that of Blazor Server with Auth0
but it does not utilize Auth0.AspNetCore.Authentication
library. By adopting this
strategy, the solution gains increased flexibility as it can switch to any OIDC provider, and
is not necessarily tied with Auth0 service.
- Incorporate the Nuget package
Microsoft.AspNetCore.Authentication.OpenIdConnect
. - To configure ASP.NET Authentication, invoke the
AddAuthentication
,AddCookie
, andAddOpenIdConnect
methods, and pass the necessary options. For a concrete example, refer toProgram.cs
.- It's important to note that there are two additional classes,
Auth0PostConfiguration
andAuth0ConfigurationManager
, which are specifically implemented for the Auth0 service. Since this service requires theEndSessionEndpoint
for proper logout, and as it doesn't expose the endpoint through its standard OIDC configuration, these additional classes serve as a workaround to correctly inject the endpoint into the options.
- It's important to note that there are two additional classes,
For the remaining steps, you can refer to the Blazor Server with Auth0 example.