Sichern Sie sich eine ASP.NET Core Blazor -Web -App mit Microsoft Entra ID

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Sichern Sie sich eine ASP.NET Core Blazor -Web -App mit Microsoft Entra ID

by Guest » 25 Jan 2025, 11:59

Ich habe mir Microsofts Beispiel „Secure an ASP.NET Core Blazor Web App with Microsoft Entra ID“ / GitHub angesehen.
In program.cs ist die Authentifizierung wie folgt konfiguriert.

Code: Select all

builder.Services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
.AddMicrosoftIdentityWebApp(builder.Configuration.GetSection("AzureAd"));
builder.Services.AddAuthorization();
Wenn ich mich anmelde und auf die Wetterschaltfläche klicke, wird ein Cookie an die Anfrage angehängt.
Ich verstehe nicht, woher dieses Cookie kommt aus. Ich habe eine Blazor-Web-App von Grund auf mit der gleichen Konfiguration erstellt, aber die Authentifizierung funktioniert nicht. Ich kann auch keine Dokumentation finden. Wie funktioniert dieses Beispiel?
Image

Image

Image

Update:
Das Beispiel ruft die API auf HostEnvironment.BaseAddress auf. In meinem Fall rufe ich eine WebApi (anderes Projekt) mit einem anderen Port auf. Was muss ich konfigurieren, damit das Cookie auch angehängt wird?

Top