Authentication and Authorization Enhancements in .NET 9.0

First off, thanks for even looking at this. Sincerely appreciate the effort.

While it’s not exactly what I want, I have something working, so please don’t invest any more time in working on this code. Clone the repo if you want (and let me know if you did) and I’ll pull it down.

My app calls for downloading permissions for all of the tenants the user has access to.

To do that, I am creating an additional ClaimsIdentity for each tenant the user has access to and adding it to the ClaimsPrincipal. In the end, I have one identity that represents the Auth0 user and their personal user claims, and then an additional identity for each tenant with the claims that user has for that tenant.

Because the app is configured to user InteractiveAuto rendering I need to keep authentication and authorization in sync. And the built-in framework methods are perfect for it - especially cascading authentication state.

I want to recreate that collection of identities on the webAssembly side, essentially recreating the ClaimsPrincipal that existed on the server side.

To your comment, I thought that if I registered the Persist...* classes (andrea branch) then I would not need to add another CustomAuthenticationStateProvider. Maybe that’s where the confusion comes in.

At this point, I’m not sure what I need to register and where I need to register it.

What’s working for me is the dotnet 9 approach, but since that’s limited to handling a specific type, I had to force my model to fit that type. It works.

Thanks for all your help on this.