diff options
| author | Jake Mannens <jake@asger.xyz> | 2023-09-14 12:00:20 +1000 |
|---|---|---|
| committer | Jake Mannens <jake@asger.xyz> | 2023-09-14 12:00:20 +1000 |
| commit | 3a23cbe192040f55c54cb3bb572d531e6a07a2dd (patch) | |
| tree | 385a035257ca70b2689f442d6ea1d158cc8a7161 /Services/UserService.cs | |
| parent | e6e43b943143d55581ef442b61ed6cbdbb40c642 (diff) | |
Finished initial implementation of login page
Diffstat (limited to 'Services/UserService.cs')
| -rw-r--r-- | Services/UserService.cs | 42 |
1 files changed, 1 insertions, 41 deletions
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<bool> 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<bool> 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() { - } } |
