How to handle authentication state in Blazor Wasm Hosted project for client and server side

99 views Asked by At

I am developing an application using .NET7 Blazor Webassembly Hosted project with API endpoints and ASP.NET Core Identity. I am implementing a Custom Authentication State Provider and Policy based authorization. Everything is working fine for the authorization on the UI and API endpoints but I have a problem in the user context, on the server side it brings all the claims including claims of type permission which I added to the table 'AspNetUserClaims', on the client side the context only brings the authentication claims, I have to fetch the permission claims from the table and add to the user after he has logged in successfully. Am I missing something?!

I use a custom permission handler in both client and server authorization:

protected override async Task HandleRequirementAsync(AuthorizationHandlerContext context, PermissionRequirement requirement) . . .

0

There are 0 answers