summaryrefslogtreecommitdiff
path: root/Services/UserService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Services/UserService.cs')
-rw-r--r--Services/UserService.cs48
1 files changed, 1 insertions, 47 deletions
diff --git a/Services/UserService.cs b/Services/UserService.cs
index 96f5b5f..d2abea3 100644
--- a/Services/UserService.cs
+++ b/Services/UserService.cs
@@ -1,18 +1,9 @@
-using Microsoft.AspNetCore.Authentication;
-using Microsoft.AspNetCore.Authentication.Cookies;
-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 {
@@ -27,41 +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,
- CookieAuthenticationDefaults.AuthenticationScheme);
-
- var claimsPrincipal = new ClaimsPrincipal(claimsIdentity);
-
- if(httpContextAccessor.HttpContext is null)
- return false;
-
- httpContextAccessor.HttpContext.SignInAsync(claimsPrincipal)
- .GetAwaiter()
- .GetResult();
-
- return true;
- }
-
- public void Logout() {
- httpContextAccessor.HttpContext?.SignOutAsync()
- .GetAwaiter()
- .GetResult();
- }
}