diff --git a/9.0/BlazorWebAppWinAuthServer/Components/ForceLogin.razor b/9.0/BlazorWebAppWinAuthServer/Components/ForceLogin.razor new file mode 100644 index 00000000..8878fd6e --- /dev/null +++ b/9.0/BlazorWebAppWinAuthServer/Components/ForceLogin.razor @@ -0,0 +1,8 @@ +@inject NavigationManager Navigation + +@code { + protected override void OnInitialized() + { + Navigation.Refresh(forceReload: true); + } +} diff --git a/9.0/BlazorWebAppWinAuthServer/Components/Layout/NavMenu.razor b/9.0/BlazorWebAppWinAuthServer/Components/Layout/NavMenu.razor index 858f7195..f80df8da 100644 --- a/9.0/BlazorWebAppWinAuthServer/Components/Layout/NavMenu.razor +++ b/9.0/BlazorWebAppWinAuthServer/Components/Layout/NavMenu.razor @@ -20,25 +20,23 @@ - - + - + - - + diff --git a/9.0/BlazorWebAppWinAuthServer/Components/Pages/LocalAccountOnly.razor b/9.0/BlazorWebAppWinAuthServer/Components/Pages/LocalAccount.razor similarity index 88% rename from 9.0/BlazorWebAppWinAuthServer/Components/Pages/LocalAccountOnly.razor rename to 9.0/BlazorWebAppWinAuthServer/Components/Pages/LocalAccount.razor index b37f5e25..561b9a89 100644 --- a/9.0/BlazorWebAppWinAuthServer/Components/Pages/LocalAccountOnly.razor +++ b/9.0/BlazorWebAppWinAuthServer/Components/Pages/LocalAccount.razor @@ -1,4 +1,4 @@ -@page "/local-account-only" +@page "/local-account" @using Microsoft.AspNetCore.Authorization @attribute [Authorize("LocalAccount")] diff --git a/9.0/BlazorWebAppWinAuthServer/Components/Routes.razor b/9.0/BlazorWebAppWinAuthServer/Components/Routes.razor index 5b113a71..6fb96a56 100644 --- a/9.0/BlazorWebAppWinAuthServer/Components/Routes.razor +++ b/9.0/BlazorWebAppWinAuthServer/Components/Routes.razor @@ -1,6 +1,10 @@ - + + + + + diff --git a/9.0/BlazorWebAppWinAuthServer/Program.cs b/9.0/BlazorWebAppWinAuthServer/Program.cs index 4bda028d..7bc071ef 100644 --- a/9.0/BlazorWebAppWinAuthServer/Program.cs +++ b/9.0/BlazorWebAppWinAuthServer/Program.cs @@ -7,10 +7,14 @@ builder.Services.AddAuthentication(NegotiateDefaults.AuthenticationScheme) .AddNegotiate(); +// To require authentication for all users for the +// entire app, use the following code. +/* builder.Services.AddAuthorization(options => { options.FallbackPolicy = options.DefaultPolicy; }); +*/ builder.Services.AddCascadingAuthenticationState();