the docs cover server and wasm mode, but don't yet cover auto. see these threads: https://github.com/dotnet/aspnetcore/issues/48772 https://github.com/dotnet/AspNetCore.Docs/issues/29452 to support auto, you use server authentication and a custom client authentication provider. the latest blazor template supports individual accounts and has a sample client authentication provider initialized by the server code.
How to Set up Blazor Web App in Net 8 with Microsoft Identity Auth
When looking at the MS documentation for Net 8 I do not see a document explaining how to secure a Blazor Web App with ME-ID, though there is a corresponding document for standalone WASM with ME-ID https://learn.microsoft.com/en-us/aspnet/core/blazor/security/webassembly/standalone-with-microsoft-entra-id?view=aspnetcore-8.0
In .NET 7 we have this standalone wasm document but we also have the Hosted with ME-ID doc which covers how to secure the server and client using MSAL. But since Web Apps have sort of replaced the concept of a hosted app in NET8, it would be nice to have a document outlining the holistic approach for ME-ID auth in a Web App.
I have tried a few approaches in NET 8 with a Blazor web app and I have yet to find a solution that doesn't require me to put my whole project in InteractiveServer mode. I would like to take advantage of InteractiveAuto and InteractiveWASM within my project while still maintaining my ME-ID auth that I used in NET7.
I would like to be able to redirect to the MS prompt when a user is not authenticated, and read their httpcontext in either the server or client project. I would also like to let them sign out and switch accounts if they are signed in. I would like to still retain flexibility of rendering modes while doing this. I also want my controller endpoints secured using this auth. Is there a resource for this that I am missing?
Thank you!
-Riley
Developer technologies | ASP.NET | ASP.NET Core
Developer technologies | .NET | Blazor
Microsoft Security | Microsoft Entra | Microsoft Entra ID
1 answer
Sort by: Most helpful
-
Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
2024-01-10T17:10:15.61+00:00