From c5a858b9ee3d447048b73c22a4145c67e7928e1d Mon Sep 17 00:00:00 2001 From: Justin Kotalik Date: Mon, 27 Jul 2020 14:21:59 -0700 Subject: [PATCH] logout --- samples/voting/VotingSample.sln | 2 +- samples/voting/results/App.razor | 23 +++++++----- samples/voting/results/Pages/Index.razor | 1 + .../voting/results/Pages/LoginDisplay.razor | 7 ++++ samples/voting/results/Pages/Logout.cshtml | 11 ++++++ samples/voting/results/Pages/NavMenu.razor | 37 +++++++++++++++++++ samples/voting/results/Startup.cs | 1 + samples/voting/results/results.csproj | 1 + 8 files changed, 72 insertions(+), 11 deletions(-) create mode 100644 samples/voting/results/Pages/LoginDisplay.razor create mode 100644 samples/voting/results/Pages/Logout.cshtml create mode 100644 samples/voting/results/Pages/NavMenu.razor diff --git a/samples/voting/VotingSample.sln b/samples/voting/VotingSample.sln index 30dc8fab..db30d008 100644 --- a/samples/voting/VotingSample.sln +++ b/samples/voting/VotingSample.sln @@ -14,7 +14,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution tye.yaml = tye.yaml EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IdentityServer", "IdentityServer\IdentityServer.csproj", "{9BDBBF17-99E9-4DD6-9DA9-6C2AA5484147}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IdentityServer", "IdentityServer\IdentityServer.csproj", "{9BDBBF17-99E9-4DD6-9DA9-6C2AA5484147}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/samples/voting/results/App.razor b/samples/voting/results/App.razor index 6f67a6ea..4b9e389c 100644 --- a/samples/voting/results/App.razor +++ b/samples/voting/results/App.razor @@ -1,10 +1,13 @@ - - - - - - -

Sorry, there's nothing at this address.

-
-
-
+ + + + + + + +

Sorry, there's nothing at this address.

+
+
+
+
+ diff --git a/samples/voting/results/Pages/Index.razor b/samples/voting/results/Pages/Index.razor index e35e693a..71ba96fe 100644 --- a/samples/voting/results/Pages/Index.razor +++ b/samples/voting/results/Pages/Index.razor @@ -14,6 +14,7 @@ @inject IConfiguration Configuration
+
diff --git a/samples/voting/results/Pages/LoginDisplay.razor b/samples/voting/results/Pages/LoginDisplay.razor new file mode 100644 index 00000000..dfed1c84 --- /dev/null +++ b/samples/voting/results/Pages/LoginDisplay.razor @@ -0,0 +1,7 @@ + + +
+ +
+
+
diff --git a/samples/voting/results/Pages/Logout.cshtml b/samples/voting/results/Pages/Logout.cshtml new file mode 100644 index 00000000..63f3e68c --- /dev/null +++ b/samples/voting/results/Pages/Logout.cshtml @@ -0,0 +1,11 @@ +@page +@using Microsoft.AspNetCore.Http +@using Microsoft.AspNetCore.Authentication +@attribute [IgnoreAntiforgeryToken] +@functions { + public async Task OnPost() + { + await HttpContext.SignOutAsync("Cookies"); + await HttpContext.SignOutAsync("oidc"); + } +} diff --git a/samples/voting/results/Pages/NavMenu.razor b/samples/voting/results/Pages/NavMenu.razor new file mode 100644 index 00000000..3645b91c --- /dev/null +++ b/samples/voting/results/Pages/NavMenu.razor @@ -0,0 +1,37 @@ + + +
+ +
+ +@code { + private bool collapseNavMenu = true; + + private string NavMenuCssClass => collapseNavMenu ? "collapse" : null; + + private void ToggleNavMenu() + { + collapseNavMenu = !collapseNavMenu; + } +} diff --git a/samples/voting/results/Startup.cs b/samples/voting/results/Startup.cs index 19d5a849..8610e2a2 100644 --- a/samples/voting/results/Startup.cs +++ b/samples/voting/results/Startup.cs @@ -62,6 +62,7 @@ namespace Results app.UseEndpoints(endpoints => { + endpoints.MapControllers(); endpoints.MapBlazorHub().RequireAuthorization(); endpoints.MapFallbackToPage("/_Host"); }); diff --git a/samples/voting/results/results.csproj b/samples/voting/results/results.csproj index fdf0bd1b..be94b9ae 100644 --- a/samples/voting/results/results.csproj +++ b/samples/voting/results/results.csproj @@ -12,6 +12,7 @@ +