diff options
author | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2021-08-13 20:02:28 +0100 |
---|---|---|
committer | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2021-08-13 20:02:28 +0100 |
commit | f425377e5b15dc97ce8caa484b3e282ec5df529c (patch) | |
tree | c3d9a27cb8be758839a90ca85b045144f39b8616 /NorthstarDedicatedTest/serverauthentication.h | |
parent | 9a3e1ec2daf753106ee95d53719d94921d3b051f (diff) | |
download | NorthstarLauncher-f425377e5b15dc97ce8caa484b3e282ec5df529c.tar.gz NorthstarLauncher-f425377e5b15dc97ce8caa484b3e282ec5df529c.zip |
add local http server for auth
Diffstat (limited to 'NorthstarDedicatedTest/serverauthentication.h')
-rw-r--r-- | NorthstarDedicatedTest/serverauthentication.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/NorthstarDedicatedTest/serverauthentication.h b/NorthstarDedicatedTest/serverauthentication.h index e9aae4f0..b26ce2b2 100644 --- a/NorthstarDedicatedTest/serverauthentication.h +++ b/NorthstarDedicatedTest/serverauthentication.h @@ -1,10 +1,12 @@ #pragma once +#include "convar.h" +#include "httplib.h" #include <unordered_map> #include <string> struct AuthData { - char* uid; + char uid[33]; // pdata char* pdata; @@ -13,13 +15,17 @@ struct AuthData class ServerAuthenticationManager { +private: + httplib::Server m_playerAuthServer; + public: - std::unordered_map<std::string, AuthData*> m_authData; + std::mutex m_authDataMutex; + std::unordered_map<std::string, AuthData> m_authData; bool m_runningPlayerAuthThread = false; public: void StartPlayerAuthServer(); - void AddPlayerAuthData(char* authToken, char* uid, char* pdata, size_t pdataSize); + void StopPlayerAuthServer(); bool AuthenticatePlayer(void* player, int64_t uid, char* authToken); bool RemovePlayerAuthData(void* player); void WritePersistentData(void* player); |