Replies: 3 comments 6 replies
-
We're currently working on a sample for this. You can check it out at https://github.com/dotnet/blazor-samples/tree/ea382520bf99b195b7c64108ca0bcc7e9ea49ca5/8.0/BlazorWebAppOidc and https://github.com/dotnet/blazor-samples/tree/ea382520bf99b195b7c64108ca0bcc7e9ea49ca5/8.0/BlazorWebAppOidcBff. There's an PR open at dotnet/AspNetCore.Docs#31555 for the documentation to go with the sample. You can see the documentation in its current form at https://github.com/dotnet/AspNetCore.Docs/blob/602fb15bba8063cfefb691f099f9cd8dda7dedd0/aspnetcore/blazor/security/server/blazor-web-app-with-oidc.md. |
Beta Was this translation helpful? Give feedback.
-
Hi, I came here with almost the same question. We upgrade our WebAssembly UI to dotnet 8. While at it we decided to also include a Blazor Server version, so we moved all our UI code into a razor library and imported it into the WASM project. That works totaly fine. |
Beta Was this translation helpful? Give feedback.
-
@smoehring I have been looking for a sample .net 8/9 blazor server and Entra External Id , I am finding most example either outdated or mainly webassembly, did you manage to get something working and do you have a sample I can look at? @halter73 Hi, I find the sample microsoft provided very confusing especially for blazor server where you mix webassembly with server, its not clear and if you are learning you then have doubts, I was expecting a simple blazor server calling a minimal api using entra ID . Is there such a thing? grateful for any response |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello there,
I am a bit confused what the correct way to implement Microsoft Entra ID for a .NET 8 Blazor (Server-Side) might be.
While there is an Documentation how to implement it for Blazor Webassembly, this is outdated for .NET 8 Blazor WebApp and does not apply for Blazor Server in the first place.
Since .NET 5 i used the
Azure.Identity
NuGet Package in combination with theMicrosoft.Identity.Web
Package and half-successfully implemented this solution in a .NET 8 Blazor WebApp Project:Example using the Blazor WebApp Template (.net 8 / Authenticationtype: None, Interactive render mode: Server, Interactivtiy location: Global):
Program.cs
Routes.razor
App.razor
This works fine for the most cases, however, upon Authorization-Failure it will result in a Access-Denied loop as described in multiple Tickets like #52167, #52222 and #52063. It will never reach the
NotAuthorized
Area of the Routes.razor.Sadly, most of them have been closed or contains dangerous workarounds (which i found will just disable the Authorization alltogether) with no actual solution.
I myself have not found any solution for this either with the exception of adding and mapping a Controller myself that allows anonymous access. This however can not be the intended solution for this.
I assume the route used comes from the
Microsoft.Identity.Web.UI
Package, however i do not need it as i am fully using the Entera ID (in a corporate environment) and have no individual accounts that could benefit from it.The
<NotAuthorized>
area from the<AuthorizeRouteView>
would be more than enough and way easier to maintain.So TL;DR:
What is the correct way to implement Microsoft Entera ID without relying on the Microsoft.Identity Package (too much) and being able to use the
AuthorizeRouteView> <NotAuthorized>
area?Thank you in advance.
Beta Was this translation helpful? Give feedback.
All reactions