aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDedicatedTest/serverauthentication.h
blob: e9aae4f026ed0b4f77706ab44c1c6d0665a46e0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#pragma once
#include <unordered_map>
#include <string>

struct AuthData
{
	char* uid;

	// pdata
	char* pdata;
	size_t pdataSize;
};

class ServerAuthenticationManager
{
public:
	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);
	bool AuthenticatePlayer(void* player, int64_t uid, char* authToken);
	bool RemovePlayerAuthData(void* player);
	void WritePersistentData(void* player);
};

void InitialiseServerAuthentication(HMODULE baseAddress);

extern ServerAuthenticationManager* g_ServerAuthenticationManager;
extern ConVar* Cvar_ns_player_auth_port;