diff options
author | BobTheBob9 <for.oliver.kirkham@gmail.com> | 2022-08-16 01:12:59 +0100 |
---|---|---|
committer | BobTheBob9 <for.oliver.kirkham@gmail.com> | 2022-08-16 01:12:59 +0100 |
commit | 082f3893215797268d7ac8c1000ebe371f276af7 (patch) | |
tree | b5cc677a49635a9244559e235d4915c064c9f6c4 /NorthstarDLL/serverauthentication.h | |
parent | b30a385fc25dad05e568ae8538f5aa3656c5c8d4 (diff) | |
download | NorthstarLauncher-082f3893215797268d7ac8c1000ebe371f276af7.tar.gz NorthstarLauncher-082f3893215797268d7ac8c1000ebe371f276af7.zip |
lots of stuff idk
Diffstat (limited to 'NorthstarDLL/serverauthentication.h')
-rw-r--r-- | NorthstarDLL/serverauthentication.h | 108 |
1 files changed, 55 insertions, 53 deletions
diff --git a/NorthstarDLL/serverauthentication.h b/NorthstarDLL/serverauthentication.h index 31710ae1..a4c9c470 100644 --- a/NorthstarDLL/serverauthentication.h +++ b/NorthstarDLL/serverauthentication.h @@ -1,53 +1,55 @@ -#pragma once
-#include "convar.h"
-#include "httplib.h"
-#include "r2engine.h"
-#include <unordered_map>
-#include <string>
-
-struct RemoteAuthData
-{
- char uid[33];
- char username[64];
-
- // pdata
- char* pdata;
- size_t pdataSize;
-};
-
-struct PlayerAuthenticationData
-{
- bool usingLocalPdata;
- size_t pdataSize;
- bool needPersistenceWriteOnLeave = true;
-};
-
-class ServerAuthenticationManager
-{
- private:
- httplib::Server m_PlayerAuthServer;
-
- public:
- ConVar* Cvar_ns_player_auth_port;
- ConVar* Cvar_ns_erase_auth_info;
- ConVar* CVar_ns_auth_allow_insecure;
- ConVar* CVar_ns_auth_allow_insecure_write;
-
- std::mutex m_AuthDataMutex;
- std::unordered_map<std::string, RemoteAuthData> m_RemoteAuthenticationData;
- std::unordered_map<R2::CBaseClient*, PlayerAuthenticationData> m_PlayerAuthenticationData;
- bool m_bRunningPlayerAuthThread = false;
- bool m_bNeedLocalAuthForNewgame = false;
- bool m_bForceResetLocalPlayerPersistence = false;
-
- public:
- void StartPlayerAuthServer();
- void StopPlayerAuthServer();
- void AddPlayerData(R2::CBaseClient* player, const char* pToken);
- bool AuthenticatePlayer(R2::CBaseClient* player, uint64_t uid, char* authToken);
- void VerifyPlayerName(R2::CBaseClient* player, char* authToken, char* name);
- bool RemovePlayerAuthData(R2::CBaseClient* player);
- void WritePersistentData(R2::CBaseClient* player);
-};
-
-extern ServerAuthenticationManager* g_pServerAuthentication;
+#pragma once +#include "convar.h" +#include "httplib.h" +#include "r2engine.h" +#include <unordered_map> +#include <string> + +struct RemoteAuthData +{ + char uid[33]; + char username[64]; + + // pdata + char* pdata; + size_t pdataSize; +}; + +struct PlayerAuthenticationData +{ + bool usingLocalPdata; + size_t pdataSize; + bool needPersistenceWriteOnLeave = true; +}; + +class ServerAuthenticationManager +{ + private: + httplib::Server m_PlayerAuthServer; + + public: + ConVar* Cvar_ns_player_auth_port; + ConVar* Cvar_ns_erase_auth_info; + ConVar* CVar_ns_auth_allow_insecure; + ConVar* CVar_ns_auth_allow_insecure_write; + + std::mutex m_AuthDataMutex; + std::unordered_map<std::string, RemoteAuthData> m_RemoteAuthenticationData; + std::unordered_map<R2::CBaseClient*, PlayerAuthenticationData> m_PlayerAuthenticationData; + bool m_bAllowDuplicateAccounts = false; + bool m_bRunningPlayerAuthThread = false; + bool m_bNeedLocalAuthForNewgame = false; + bool m_bForceResetLocalPlayerPersistence = false; + + public: + void StartPlayerAuthServer(); + void StopPlayerAuthServer(); + void AddPlayerData(R2::CBaseClient* player, const char* pToken); + bool CheckDuplicateAccounts(R2::CBaseClient* player); + bool AuthenticatePlayer(R2::CBaseClient* player, uint64_t uid, char* authToken); + void VerifyPlayerName(R2::CBaseClient* player, char* authToken, char* name); + bool RemovePlayerAuthData(R2::CBaseClient* player); + void WritePersistentData(R2::CBaseClient* player); +}; + +extern ServerAuthenticationManager* g_pServerAuthentication; |