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, const AString &a_UserName, const AString &a_ServerHash)
 Queues a request for authenticating a user. More...
 
 cAuthenticator (void)
 
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 (const AString &a_ThreadName)
 
bool IsCurrentThread (void) const
 Returns true if the thread calling this function is the thread contained within this object. More...
 
bool 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...
 
bool Wait (void)
 Waits for the thread to finish. More...
 
virtual ~cIsThread ()
 

Private Types

typedef std::deque< cUsercUserList
 
typedef cIsThread super
 

Private Member Functions

bool AuthWithYggdrasil (AString &a_UserName, const AString &a_ServerId, cUUID &a_UUID, Json::Value &a_Properties)
 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

typedef std::deque<cUser> cAuthenticator::cUserList
private

Definition at line 68 of file Authenticator.h.

Definition at line 33 of file Authenticator.h.

Constructor & Destructor Documentation

cAuthenticator::cAuthenticator ( void  )

Definition at line 27 of file Authenticator.cpp.

cAuthenticator::~cAuthenticator ( )
overridevirtual

Definition at line 39 of file Authenticator.cpp.

Member Function Documentation

void cAuthenticator::Authenticate ( int  a_ClientID,
const AString a_UserName,
const AString a_ServerHash 
)

Queues a request for authenticating a user.

If the auth fails, the user will be kicked

Definition at line 59 of file Authenticator.cpp.

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

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

skin).

Definition at line 140 of file Authenticator.cpp.

void cAuthenticator::Execute ( void  )
overrideprivatevirtual

cIsThread override:

Implements cIsThread.

Definition at line 98 of file Authenticator.cpp.

void cAuthenticator::ReadSettings ( cSettingsRepositoryInterface a_Settings)

(Re-)read server and address from INI:

Definition at line 48 of file Authenticator.cpp.

void cAuthenticator::Start ( cSettingsRepositoryInterface a_Settings)

Starts the authenticator thread.

The thread may be started and stopped repeatedly

Definition at line 77 of file Authenticator.cpp.

void cAuthenticator::Stop ( void  )

Stops the authenticator thread.

The thread may be started and stopped repeatedly

Definition at line 87 of file Authenticator.cpp.

Member Data Documentation

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 81 of file Authenticator.h.

cCriticalSection cAuthenticator::m_CS
private

Definition at line 70 of file Authenticator.h.

AString cAuthenticator::m_PropertiesAddress
private

Definition at line 83 of file Authenticator.h.

cUserList cAuthenticator::m_Queue
private

Definition at line 71 of file Authenticator.h.

cEvent cAuthenticator::m_QueueNonempty
private

Definition at line 72 of file Authenticator.h.

AString cAuthenticator::m_Server
private

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

Definition at line 75 of file Authenticator.h.

bool cAuthenticator::m_ShouldAuthenticate
private

Definition at line 84 of file Authenticator.h.


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