Merge pull request #3721 from sbwalker/dev

use new Cascading Authentication State Services
This commit is contained in:
Shaun Walker 2024-02-01 15:47:16 -05:00 committed by GitHub
commit 1663731489
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 5 deletions

View File

@ -10,6 +10,7 @@ namespace Microsoft.Extensions.DependencyInjection
public static IServiceCollection AddOqtaneAuthorization(this IServiceCollection services)
{
services.AddAuthorizationCore();
services.AddCascadingAuthenticationState();
services.AddScoped<IdentityAuthenticationStateProvider>();
services.AddScoped<AuthenticationStateProvider>(s => s.GetRequiredService<IdentityAuthenticationStateProvider>());

View File

@ -14,11 +14,9 @@
@if (string.IsNullOrEmpty(_installation.Message))
{
<div style="@_display">
<CascadingAuthenticationState>
<CascadingValue Value="@PageState">
<SiteRouter RenderMode="@RenderMode" Runtime="@Runtime" VisitorId="@VisitorId" OnStateChange="@ChangeState" />
</CascadingValue>
</CascadingAuthenticationState>
<CascadingValue Value="@PageState">
<SiteRouter RenderMode="@RenderMode" Runtime="@Runtime" VisitorId="@VisitorId" OnStateChange="@ChangeState" />
</CascadingValue>
</div>
}
else

View File

@ -108,6 +108,9 @@ namespace Oqtane
services.ConfigureOqtaneIdentityOptions(Configuration);
services.AddCascadingAuthenticationState();
services.AddAuthorization();
services.AddAuthentication(options =>
{
options.DefaultScheme = Constants.AuthenticationScheme;