Cuberite
A lightweight, fast and extensible game server for Minecraft
Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
cAuthenticator Class Reference

#include <Authenticator.h>

Inheritance diagram for cAuthenticator:
Inheritance graph
[legend]
Collaboration diagram for cAuthenticator:
Collaboration graph
[legend]

Classes

class  cUser
 

Public Member Functions

void Authenticate (int a_ClientID, std::string_view a_Username, std::string_view a_ServerHash)
 Queues a request for authenticating a user. More...
 
 cAuthenticator ()
 
void ReadSettings (cSettingsRepositoryInterface &a_Settings)
 (Re-)read server and address from INI: More...
 
void Start (cSettingsRepositoryInterface &a_Settings)
 Starts the authenticator thread. More...
 
void Stop (void)
 Stops the authenticator thread. More...
 
virtual ~cAuthenticator () override
 
- Public Member Functions inherited from cIsThread
 cIsThread (AString &&a_ThreadName)
 
bool IsCurrentThread (void) const
 Returns true if the thread calling this function is the thread contained within this object. More...
 
void Start (void)
 Starts the thread; returns without waiting for the actual start. More...
 
void Stop (void)
 Signals the thread to terminate and waits until it's finished. More...
 
virtual ~cIsThread ()
 

Private Types

using cUserList = std::deque< cUser >
 
using Super = cIsThread
 

Private Member Functions

bool AuthWithYggdrasil (AString &a_UserName, const AString &a_ServerId, cUUID &a_UUID, Json::Value &a_Properties) const
 Returns true if the user authenticated okay, false on error Returns the case-corrected username, UUID, and properties (eg. More...
 
virtual void Execute (void) override
 cIsThread override: More...
 

Private Attributes

AString m_Address
 The URL to use for auth, without server part. More...
 
cCriticalSection m_CS
 
AString m_PropertiesAddress
 
cUserList m_Queue
 
cEvent m_QueueNonempty
 
AString m_Server
 The server that is to be contacted for auth / UUID conversions. More...
 
bool m_ShouldAuthenticate
 

Additional Inherited Members

- Protected Attributes inherited from cIsThread
std::atomic< bool > m_ShouldTerminate
 The overriden Execute() method should check this value periodically and terminate if this is true. More...
 

Detailed Description

Definition at line 30 of file Authenticator.h.

Member Typedef Documentation

◆ cUserList

using cAuthenticator::cUserList = std::deque<cUser>
private

Definition at line 69 of file Authenticator.h.

◆ Super

Definition at line 33 of file Authenticator.h.

Constructor & Destructor Documentation

◆ cAuthenticator()

cAuthenticator::cAuthenticator ( void  )

Definition at line 28 of file Authenticator.cpp.

◆ ~cAuthenticator()

cAuthenticator::~cAuthenticator ( )
overridevirtual

Definition at line 40 of file Authenticator.cpp.

Member Function Documentation

◆ Authenticate()

void cAuthenticator::Authenticate ( int  a_ClientID,
std::string_view  a_Username,
std::string_view  a_ServerHash 
)

Queues a request for authenticating a user.

If the auth fails, the user will be kicked

Definition at line 90 of file Authenticator.cpp.

◆ AuthWithYggdrasil()

bool cAuthenticator::AuthWithYggdrasil ( AString a_UserName,
const AString a_ServerId,
cUUID a_UUID,
Json::Value &  a_Properties 
) const
private

Returns true if the user authenticated okay, false on error Returns the case-corrected username, UUID, and properties (eg.

skin).

Definition at line 176 of file Authenticator.cpp.

◆ Execute()

void cAuthenticator::Execute ( void  )
overrideprivatevirtual

cIsThread override:

Implements cIsThread.

Definition at line 135 of file Authenticator.cpp.

◆ ReadSettings()

void cAuthenticator::ReadSettings ( cSettingsRepositoryInterface a_Settings)

(Re-)read server and address from INI:

Definition at line 49 of file Authenticator.cpp.

◆ Start()

void cAuthenticator::Start ( cSettingsRepositoryInterface a_Settings)

Starts the authenticator thread.

The thread may be started and stopped repeatedly

Definition at line 114 of file Authenticator.cpp.

◆ Stop()

void cAuthenticator::Stop ( void  )

Stops the authenticator thread.

The thread may be started and stopped repeatedly

Definition at line 124 of file Authenticator.cpp.

Member Data Documentation

◆ m_Address

AString cAuthenticator::m_Address
private

The URL to use for auth, without server part.

USERNAME% will be replaced with actual user name. SERVERID% will be replaced with server's ID. For example "/session/minecraft/hasJoined?username=%USERNAME%&serverId=%SERVERID%".

Definition at line 82 of file Authenticator.h.

◆ m_CS

cCriticalSection cAuthenticator::m_CS
private

Definition at line 71 of file Authenticator.h.

◆ m_PropertiesAddress

AString cAuthenticator::m_PropertiesAddress
private

Definition at line 84 of file Authenticator.h.

◆ m_Queue

cUserList cAuthenticator::m_Queue
private

Definition at line 72 of file Authenticator.h.

◆ m_QueueNonempty

cEvent cAuthenticator::m_QueueNonempty
private

Definition at line 73 of file Authenticator.h.

◆ m_Server

AString cAuthenticator::m_Server
private

The server that is to be contacted for auth / UUID conversions.

Definition at line 76 of file Authenticator.h.

◆ m_ShouldAuthenticate

bool cAuthenticator::m_ShouldAuthenticate
private

Definition at line 85 of file Authenticator.h.


The documentation for this class was generated from the following files: