From f9da8d624c57982fbfc080b91b1c4764018e6388 Mon Sep 17 00:00:00 2001 From: Josh Patterson Date: Wed, 12 Jun 2024 17:42:53 -0400 Subject: [PATCH] Reworked authentication. --- NetProxy.Client/Classes/MessageClientFactory.cs | 10 ++++++++-- .../Notifications/NotificationRegisterLogin.cs | 16 ---------------- 2 files changed, 8 insertions(+), 18 deletions(-) delete mode 100644 NetProxy.Library/Payloads/ReliableMessages/Notifications/NotificationRegisterLogin.cs diff --git a/NetProxy.Client/Classes/MessageClientFactory.cs b/NetProxy.Client/Classes/MessageClientFactory.cs index 4434546..79f0a97 100644 --- a/NetProxy.Client/Classes/MessageClientFactory.cs +++ b/NetProxy.Client/Classes/MessageClientFactory.cs @@ -1,4 +1,4 @@ -using NetProxy.Library.Payloads.ReliableMessages.Notifications; +using NetProxy.Library.Payloads.ReliableMessages.Queries; using NetProxy.Library.Utilities; using NTDLS.ReliableMessaging; @@ -12,7 +12,13 @@ public static class MessageClientFactory { var client = new RmClient(); client.Connect(connectionInfo.ServerName, connectionInfo.Port); - client.Notify(new NotificationRegisterLogin(connectionInfo.UserName, NpUtility.Sha256(connectionInfo.Password))); + + var loginResult = client.Query(new QueryLogin(connectionInfo.UserName, NpUtility.Sha256(connectionInfo.Password))).Result; + if (loginResult.Result != true) + { + throw new Exception("Login failed."); + } + return client; } catch { } diff --git a/NetProxy.Library/Payloads/ReliableMessages/Notifications/NotificationRegisterLogin.cs b/NetProxy.Library/Payloads/ReliableMessages/Notifications/NotificationRegisterLogin.cs deleted file mode 100644 index 4bb813a..0000000 --- a/NetProxy.Library/Payloads/ReliableMessages/Notifications/NotificationRegisterLogin.cs +++ /dev/null @@ -1,16 +0,0 @@ -using NTDLS.ReliableMessaging; - -namespace NetProxy.Library.Payloads.ReliableMessages.Notifications -{ - public class NotificationRegisterLogin : IRmNotification - { - public string UserName { get; set; } = string.Empty; - public string PasswordHash { get; set; } = string.Empty; - - public NotificationRegisterLogin(string userName, string passwordHash) - { - UserName = userName; - PasswordHash = passwordHash; - } - } -}