TrinityCore
Battlenet::LoginRESTService Class Reference

#include <LoginRESTService.h>

+ Inheritance diagram for Battlenet::LoginRESTService:

Public Types

using RequestHandlerResult = Trinity::Net::Http::RequestHandlerResult
 
using HttpRequest = Trinity::Net::Http::Request
 
using HttpResponse = Trinity::Net::Http::Response
 
using HttpRequestContext = Trinity::Net::Http::RequestContext
 
using HttpSessionState = Trinity::Net::Http::SessionState
 

Public Member Functions

 LoginRESTService ()
 
bool StartNetwork (Trinity::Asio::IoContext &ioContext, std::string const &bindIp, uint16 port, int32 threadCount=1) override
 
std::string const & GetHostnameForClient (boost::asio::ip::address const &address) const
 
uint16 GetPort () const
 
std::shared_ptr< Trinity::Net::Http::SessionStateCreateNewSessionState (boost::asio::ip::address const &address) override
 
- Public Member Functions inherited from Trinity::Net::Http::HttpService< LoginHttpSession >
 HttpService (std::string_view loggerSuffix)
 
bool StartNetwork (Asio::IoContext &ioContext, std::string const &bindIp, uint16 port, int32 threadCount=1) override
 
void StopNetwork () override
 
void RegisterHandler (boost::beast::http::verb method, std::string_view path, Callable handler, RequestHandlerFlag flags=RequestHandlerFlag::None)
 
void RegisterHandler (boost::beast::http::verb method, std::string_view path, std::function< RequestHandlerResult(std::shared_ptr< AbstractSocket > session, RequestContext &context)> handler, RequestHandlerFlag flags=RequestHandlerFlag::None)
 
virtual std::shared_ptr< SessionStateCreateNewSessionState (boost::asio::ip::address const &address)
 
- Public Member Functions inherited from SocketMgr< LoginHttpSession >
virtual ~SocketMgr ()
 
virtual bool StartNetwork (Trinity::Asio::IoContext &ioContext, std::string const &bindIp, uint16 port, int threadCount)
 
virtual void StopNetwork ()
 
void Wait ()
 
virtual void OnSocketOpen (boost::asio::ip::tcp::socket &&sock, uint32 threadIndex)
 
int32 GetNetworkThreadCount () const
 
uint32 SelectThreadWithMinConnections () const
 
std::pair< boost::asio::ip::tcp::socket *, uint32GetSocketForAccept ()
 
- Public Member Functions inherited from Trinity::Net::Http::DispatcherService
 DispatcherService (std::string_view loggerSuffix)
 
RequestHandlerResult HandleRequest (std::shared_ptr< AbstractSocket > session, RequestContext &context)
 
- Public Member Functions inherited from Trinity::Net::Http::SessionService
 SessionService (std::string_view loggerSuffix)
 
void Start (Asio::IoContext &ioContext)
 
void Stop ()
 
std::shared_ptr< SessionStateFindAndRefreshSessionState (std::string_view id, boost::asio::ip::address const &address)
 
void MarkSessionInactive (boost::uuids::uuid const &id)
 

Static Public Member Functions

static LoginRESTServiceInstance ()
 
- Static Public Member Functions inherited from Trinity::Net::Http::DispatcherService
static RequestHandlerResult HandleBadRequest (std::shared_ptr< AbstractSocket > session, RequestContext &context)
 
static RequestHandlerResult HandleUnauthorized (std::shared_ptr< AbstractSocket > session, RequestContext &context)
 
static RequestHandlerResult HandlePathNotFound (std::shared_ptr< AbstractSocket > session, RequestContext &context)
 

Private Member Functions

RequestHandlerResult HandleGetForm (std::shared_ptr< LoginHttpSession > session, HttpRequestContext &context) const
 
RequestHandlerResult HandleGetPortal (std::shared_ptr< LoginHttpSession > session, HttpRequestContext &context) const
 
RequestHandlerResult HandlePostLogin (std::shared_ptr< LoginHttpSession > session, HttpRequestContext &context) const
 
RequestHandlerResult HandlePostRefreshLoginTicket (std::shared_ptr< LoginHttpSession > session, HttpRequestContext &context) const
 
void MigrateLegacyPasswordHashes () const
 

Static Private Member Functions

static void OnSocketAccept (boost::asio::ip::tcp::socket &&sock, uint32 threadIndex)
 
static std::string ExtractAuthorization (HttpRequest const &request)
 
static RequestHandlerResult HandleGetGameAccounts (std::shared_ptr< LoginHttpSession > session, HttpRequestContext &context)
 
static RequestHandlerResult HandlePostLoginSrpChallenge (std::shared_ptr< LoginHttpSession > session, HttpRequestContext &context)
 
static std::unique_ptr< Trinity::Crypto::SRP::BnetSRP6BaseCreateSrpImplementation (SrpVersion version, SrpHashFunction hashFunction, std::string const &username, Trinity::Crypto::SRP::Salt const &salt, Trinity::Crypto::SRP::Verifier const &verifier)
 

Private Attributes

JSON::Login::FormInputs _formInputs
 
std::string _bindIP
 
uint16 _port
 
std::array< std::string, 2 > _hostnames
 
std::array< boost::asio::ip::address, 2 > _addresses
 
uint32 _loginTicketDuration
 

Additional Inherited Members

- Protected Member Functions inherited from Trinity::Net::Http::HttpService< LoginHttpSession >
NetworkThread< LoginHttpSession > * CreateThreads () const override
 
- Protected Member Functions inherited from SocketMgr< LoginHttpSession >
 SocketMgr ()
 
virtual NetworkThread< LoginHttpSession > * CreateThreads () const=0
 
- Protected Member Functions inherited from Trinity::Net::Http::DispatcherService
void RegisterHandler (boost::beast::http::verb method, std::string_view path, std::function< RequestHandlerResult(std::shared_ptr< AbstractSocket > session, RequestContext &context)> handler, RequestHandlerFlag flags=RequestHandlerFlag::None)
 
- Protected Member Functions inherited from Trinity::Net::Http::SessionService
void InitAndStoreSessionState (std::shared_ptr< SessionState > state, boost::asio::ip::address const &address)
 
void KillInactiveSessions ()
 
- Protected Attributes inherited from Trinity::Net::Http::HttpService< LoginHttpSession >
Asio::IoContext_ioContext
 
std::string _logger
 
- Protected Attributes inherited from SocketMgr< LoginHttpSession >
AsyncAcceptor_acceptor
 
NetworkThread< LoginHttpSession > * _threads
 
int32 _threadCount
 

Detailed Description

Definition at line 45 of file LoginRESTService.h.

Member Typedef Documentation

◆ HttpRequest

◆ HttpRequestContext

◆ HttpResponse

◆ HttpSessionState

◆ RequestHandlerResult

Constructor & Destructor Documentation

◆ LoginRESTService()

Battlenet::LoginRESTService::LoginRESTService ( )
inline

Definition at line 54 of file LoginRESTService.h.

Member Function Documentation

◆ CreateNewSessionState()

std::shared_ptr< Trinity::Net::Http::SessionState > Battlenet::LoginRESTService::CreateNewSessionState ( boost::asio::ip::address const &  address)
overridevirtual

Reimplemented from Trinity::Net::Http::HttpService< LoginHttpSession >.

Definition at line 546 of file LoginRESTService.cpp.

◆ CreateSrpImplementation()

std::unique_ptr< Trinity::Crypto::SRP::BnetSRP6Base > Battlenet::LoginRESTService::CreateSrpImplementation ( SrpVersion  version,
SrpHashFunction  hashFunction,
std::string const &  username,
Trinity::Crypto::SRP::Salt const &  salt,
Trinity::Crypto::SRP::Verifier const &  verifier 
)
staticprivate

Definition at line 524 of file LoginRESTService.cpp.

◆ ExtractAuthorization()

std::string Battlenet::LoginRESTService::ExtractAuthorization ( HttpRequest const &  request)
staticprivate

Definition at line 140 of file LoginRESTService.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetHostnameForClient()

std::string const & Battlenet::LoginRESTService::GetHostnameForClient ( boost::asio::ip::address const &  address) const

Definition at line 129 of file LoginRESTService.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetPort()

uint16 Battlenet::LoginRESTService::GetPort ( ) const
inline

Definition at line 61 of file LoginRESTService.h.

◆ HandleGetForm()

LoginRESTService::RequestHandlerResult Battlenet::LoginRESTService::HandleGetForm ( std::shared_ptr< LoginHttpSession session,
HttpRequestContext context 
) const
private

Definition at line 168 of file LoginRESTService.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HandleGetGameAccounts()

LoginRESTService::RequestHandlerResult Battlenet::LoginRESTService::HandleGetGameAccounts ( std::shared_ptr< LoginHttpSession session,
HttpRequestContext context 
)
staticprivate

Definition at line 178 of file LoginRESTService.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HandleGetPortal()

LoginRESTService::RequestHandlerResult Battlenet::LoginRESTService::HandleGetPortal ( std::shared_ptr< LoginHttpSession session,
HttpRequestContext context 
) const
private

Definition at line 227 of file LoginRESTService.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HandlePostLogin()

LoginRESTService::RequestHandlerResult Battlenet::LoginRESTService::HandlePostLogin ( std::shared_ptr< LoginHttpSession session,
HttpRequestContext context 
) const
private

Definition at line 234 of file LoginRESTService.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HandlePostLoginSrpChallenge()

LoginRESTService::RequestHandlerResult Battlenet::LoginRESTService::HandlePostLoginSrpChallenge ( std::shared_ptr< LoginHttpSession session,
HttpRequestContext context 
)
staticprivate

Definition at line 398 of file LoginRESTService.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HandlePostRefreshLoginTicket()

LoginRESTService::RequestHandlerResult Battlenet::LoginRESTService::HandlePostRefreshLoginTicket ( std::shared_ptr< LoginHttpSession session,
HttpRequestContext context 
) const
private

Definition at line 485 of file LoginRESTService.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Instance()

LoginRESTService & Battlenet::LoginRESTService::Instance ( )
static

Definition at line 33 of file LoginRESTService.cpp.

◆ MigrateLegacyPasswordHashes()

void Battlenet::LoginRESTService::MigrateLegacyPasswordHashes ( ) const
private

Definition at line 558 of file LoginRESTService.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OnSocketAccept()

void Battlenet::LoginRESTService::OnSocketAccept ( boost::asio::ip::tcp::socket &&  sock,
uint32  threadIndex 
)
staticprivate

Definition at line 553 of file LoginRESTService.cpp.

+ Here is the caller graph for this function:

◆ StartNetwork()

bool Battlenet::LoginRESTService::StartNetwork ( Trinity::Asio::IoContext ioContext,
std::string const &  bindIp,
uint16  port,
int32  threadCount = 1 
)
override

Definition at line 39 of file LoginRESTService.cpp.

+ Here is the call graph for this function:

Member Data Documentation

◆ _addresses

std::array<boost::asio::ip::address, 2> Battlenet::LoginRESTService::_addresses
private

Definition at line 87 of file LoginRESTService.h.

◆ _bindIP

std::string Battlenet::LoginRESTService::_bindIP
private

Definition at line 84 of file LoginRESTService.h.

◆ _formInputs

JSON::Login::FormInputs Battlenet::LoginRESTService::_formInputs
private

Definition at line 83 of file LoginRESTService.h.

◆ _hostnames

std::array<std::string, 2> Battlenet::LoginRESTService::_hostnames
private

Definition at line 86 of file LoginRESTService.h.

◆ _loginTicketDuration

uint32 Battlenet::LoginRESTService::_loginTicketDuration
private

Definition at line 88 of file LoginRESTService.h.

◆ _port

uint16 Battlenet::LoginRESTService::_port
private

Definition at line 85 of file LoginRESTService.h.


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