From 3a23cbe192040f55c54cb3bb572d531e6a07a2dd Mon Sep 17 00:00:00 2001 From: Jake Mannens Date: Thu, 14 Sep 2023 12:00:20 +1000 Subject: Finished initial implementation of login page --- Services/GlobalUserService.cs | 7 ------- Services/UserService.cs | 42 +----------------------------------------- 2 files changed, 1 insertion(+), 48 deletions(-) delete mode 100644 Services/GlobalUserService.cs (limited to 'Services') diff --git a/Services/GlobalUserService.cs b/Services/GlobalUserService.cs deleted file mode 100644 index adafce2..0000000 --- a/Services/GlobalUserService.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace HyperBooru.Services; - -public interface IGlobalUserService { -} - -public class GlobalUserService : IGlobalUserService { -} diff --git a/Services/UserService.cs b/Services/UserService.cs index db62553..d2abea3 100644 --- a/Services/UserService.cs +++ b/Services/UserService.cs @@ -1,17 +1,9 @@ -using Microsoft.AspNetCore.Authentication; -using System.Runtime.InteropServices; -using System.Security.Claims; -using System.Security.Principal; - -namespace HyperBooru.Services; +namespace HyperBooru.Services; public interface IUserService { public bool ShowNsfw { get; set; } public event EventHandler ShowNsfwChanged; - - public bool Login(string username, string password); - public void Logout(); } public class UserService : IUserService { @@ -26,36 +18,4 @@ public class UserService : IUserService { public event EventHandler ShowNsfwChanged; private bool showNsfw = false; - - private IGlobalUserService globalUserService; - private IHttpContextAccessor httpContextAccessor; - - public UserService( - IGlobalUserService globalUserService, - IHttpContextAccessor httpContextAccessor) { - - this.globalUserService = globalUserService; - this.httpContextAccessor = httpContextAccessor; - } - - public bool Login(string username, string password) { - var claims = new Claim[] { - }; - - var claimsIdentity = new ClaimsIdentity(claims); - - var claimsPrincipal = new ClaimsPrincipal(claimsIdentity); - - if(httpContextAccessor.HttpContext is null) - return false; - - httpContextAccessor.HttpContext.SignInAsync(claimsPrincipal) - .GetAwaiter() - .GetResult(); - - return true; - } - - public void Logout() { - } } -- cgit v1.3