From 64550cc445f7467807876e3b916bba18118e4ca3 Mon Sep 17 00:00:00 2001 From: nickle Date: Sun, 11 Feb 2024 20:34:24 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A0=EF=B8=8F=20Scoping=20authenticatio?= =?UTF-8?q?n=20scripts=20security=20own=20pages=20=F0=9F=94=BC=20Updating?= =?UTF-8?q?=20dependencies?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AnimeFeedManager.Features.Tests.csproj | 2 +- .../AnimeFeedManager.Functions.csproj | 2 +- src/AnimeFeedManager.Web/Features/App.razor | 20 +++--------------- .../Features/Security/Login.razor | 21 ++++++++++++++++--- .../Features/Security/Register.razor | 20 +++++++++++++++--- .../Features/Tv/TvGrid.razor | 8 ++++--- .../Features/_Imports.razor | 3 ++- .../AnimeFeedManager.WebApp.csproj | 2 +- 8 files changed, 48 insertions(+), 30 deletions(-) diff --git a/src/AnimeFeedManager.Features.Tests/AnimeFeedManager.Features.Tests.csproj b/src/AnimeFeedManager.Features.Tests/AnimeFeedManager.Features.Tests.csproj index b2bf2682..3445c2ed 100644 --- a/src/AnimeFeedManager.Features.Tests/AnimeFeedManager.Features.Tests.csproj +++ b/src/AnimeFeedManager.Features.Tests/AnimeFeedManager.Features.Tests.csproj @@ -17,7 +17,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/AnimeFeedManager.Functions/AnimeFeedManager.Functions.csproj b/src/AnimeFeedManager.Functions/AnimeFeedManager.Functions.csproj index d0d47478..26ac2b05 100644 --- a/src/AnimeFeedManager.Functions/AnimeFeedManager.Functions.csproj +++ b/src/AnimeFeedManager.Functions/AnimeFeedManager.Functions.csproj @@ -12,7 +12,7 @@ - + diff --git a/src/AnimeFeedManager.Web/Features/App.razor b/src/AnimeFeedManager.Web/Features/App.razor index 6c09d54a..04446c5c 100644 --- a/src/AnimeFeedManager.Web/Features/App.razor +++ b/src/AnimeFeedManager.Web/Features/App.razor @@ -1,8 +1,4 @@ -@using Passwordless.Net -@using Microsoft.Extensions.Options -@inject IOptions PasswordlessOptions - - + @@ -14,6 +10,8 @@ + @* *@ + @@ -24,18 +22,6 @@
-@* *@ - - - - - \ No newline at end of file diff --git a/src/AnimeFeedManager.Web/Features/Security/Login.razor b/src/AnimeFeedManager.Web/Features/Security/Login.razor index e8d82652..8aa4c711 100644 --- a/src/AnimeFeedManager.Web/Features/Security/Login.razor +++ b/src/AnimeFeedManager.Web/Features/Security/Login.razor @@ -4,10 +4,13 @@ @using AnimeFeedManager.Features.Users.IO @using Microsoft.AspNetCore.Authentication @using Microsoft.AspNetCore.Authentication.Cookies +@using Microsoft.Extensions.Options +@using Passwordless.Net @inject IPasswordlessLogin PasswordlessLogin; @inject NavigationManager NavigationManager; @inject ILogger Logger; +@inject IOptions PasswordlessOptions @PageTitle("Login") @@ -72,6 +75,19 @@ + + + + + + + @code { [SupplyParameterFromForm] public string? Id { get; set; } @@ -97,7 +113,7 @@ private async Task CompleteLogin(ClaimsPrincipal principal) { - await HttpContext.SignInAsync(principal, new AuthenticationProperties {IsPersistent = true}); + await HttpContext.SignInAsync(principal, new AuthenticationProperties { IsPersistent = true }); NavigationManager.NavigateTo("/"); } @@ -115,7 +131,7 @@ new(ClaimTypes.Name, user), new(ClaimTypes.Email, user), new(CustomClaimTypes.Sub, id), - new (ClaimTypes.Role, role) + new(ClaimTypes.Role, role) }; return @@ -124,4 +140,3 @@ } - \ No newline at end of file diff --git a/src/AnimeFeedManager.Web/Features/Security/Register.razor b/src/AnimeFeedManager.Web/Features/Security/Register.razor index 61cbe9ce..0c89659f 100644 --- a/src/AnimeFeedManager.Web/Features/Security/Register.razor +++ b/src/AnimeFeedManager.Web/Features/Security/Register.razor @@ -1,4 +1,9 @@ -@page "/Register" +@using Passwordless.Net +@using Microsoft.Extensions.Options + +@inject IOptions PasswordlessOptions +@page "/Register" + @PageTitle("Registration") @@ -63,5 +68,14 @@ - - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/src/AnimeFeedManager.Web/Features/Tv/TvGrid.razor b/src/AnimeFeedManager.Web/Features/Tv/TvGrid.razor index 12ac37a3..2e58e889 100644 --- a/src/AnimeFeedManager.Web/Features/Tv/TvGrid.razor +++ b/src/AnimeFeedManager.Web/Features/Tv/TvGrid.razor @@ -4,12 +4,13 @@ @inject TvLibraryGetter LibraryGetter; @inject IUserProvider UserProvider; @inject ILogger Logger; -@* @attribute [StreamRendering] *@ +@* @attribute [StreamRendering(true)] *@ @PageTitleForSeason(SeriesType.Tv, _selectedSeason) + @code { [CascadingParameter] public HttpContext context { get; set; } = default!; @@ -31,7 +32,7 @@ var results = await LibraryGetter.GetForSeason(_selectedSeason.Season, _selectedSeason.Year) .MapAsync(lib => MapForUser(lib, user)) .LogErrors(Logger); - + _animes = results.Match( collection => collection, _ => [] @@ -62,4 +63,5 @@ }; } -} \ No newline at end of file +} + diff --git a/src/AnimeFeedManager.Web/Features/_Imports.razor b/src/AnimeFeedManager.Web/Features/_Imports.razor index d47dadc5..693ea7c5 100644 --- a/src/AnimeFeedManager.Web/Features/_Imports.razor +++ b/src/AnimeFeedManager.Web/Features/_Imports.razor @@ -4,7 +4,7 @@ @using Microsoft.AspNetCore.Components.Routing @using Microsoft.AspNetCore.Components.Web @using Microsoft.AspNetCore.Components.Authorization -@using static Microsoft.AspNetCore.Components.Web.RenderMode +@using Microsoft.AspNetCore.Components.Sections @using Microsoft.AspNetCore.Components.Web.Virtualization @using Microsoft.JSInterop @using AnimeFeedManager.Web @@ -25,4 +25,5 @@ @using LanguageExt; @using static LanguageExt.Prelude; @using static AnimeFeedManager.Web.Features.Common.Utils; +@using static Microsoft.AspNetCore.Components.Web.RenderMode diff --git a/src/AnimeFeedManager.WebApp/AnimeFeedManager.WebApp.csproj b/src/AnimeFeedManager.WebApp/AnimeFeedManager.WebApp.csproj index e00618d0..d5cf49ba 100644 --- a/src/AnimeFeedManager.WebApp/AnimeFeedManager.WebApp.csproj +++ b/src/AnimeFeedManager.WebApp/AnimeFeedManager.WebApp.csproj @@ -9,7 +9,7 @@ - +