我们在Blazor webassembly应用程序中实现了Azure AD:https://learn.microsoft.com/en-us/aspnet/core/blazor/security/webassembly/standalone-with-microsoft-entra-id?view=aspnetcore-6.0(在引入MS Entra后更改了文章)
深度链接开箱即用。但是现在我们升级到.Net 8并升级了所有相关的安全软件包后,用户在登录后总是被重定向到应用程序的根目录。app.razor看起来如下:
<CascadingAuthenticationState>
<Router AppAssembly="@typeof(App).Assembly">
<Found Context="routeData">
<AuthorizeRouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)">
<NotAuthorized>
@if (context.User.Identity?.IsAuthenticated != true) {
<RedirectToLogin/>
}
else {
<p role="alert">@_localizer["Globaal.NietGeautoriseerd"]</p>
}
</NotAuthorized>
</AuthorizeRouteView>
<FocusOnNavigate RouteData="@routeData" Selector="h1"/>
</Found>
<NotFound>
<PageTitle>Not found</PageTitle>
<LayoutView Layout="@typeof(MainLayout)">
<p style="text-align: center; margin-top: 50px;" role="alert">@_localizer["Globaal.PaginaNietGevonden"]</p>
</LayoutView>
</NotFound>
</Router>
</CascadingAuthenticationState>
字符串
在RedirectToLogin中,returnUrl设置正确:
@inject NavigationManager Navigation
@code {
protected override void OnInitialized()
{
Navigation.NavigateTo($"authentication/login?returnUrl={Uri.EscapeDataString(Navigation.Uri)}");
}
}
型
我想不出发生了什么变化,更不用说如何解决了,有什么想法吗?
1条答案
按热度按时间yquaqz181#
显然,现在有一个NavigateToLogin方法:-/
字符串