'How to add existing ASP CBAC authorization and authentication to a Blazor WebApp but not to use Entity Framework for storage
I need to add the MS ASP Authorization and Authentication to my Blazor web app.
The existing MS implementation assumes you use Entity Framework to store user and claim data.
In my case, I need to keep the existing CBAC MS ASP authorization and authentication functionality (including using Auth attributes and policies) but use my own way to store the user and claim data, not using the Entity Framework package.
I wonder, if anyone knows how to do it the easiest way?
Solution 1:[1]
Blazor authorizes pages by getting the authentication state from the built in authentication state provider. You need to create your own and and override the GetAuthenticationState method. Here is an example that uses web assembly and authorizes users from a web token to help you implement your own logic: https://chrissainty.com/securing-your-blazor-apps-authentication-with-clientside-blazor-using-webapi-aspnet-core-identity/
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | spyros__ |
