![]() |
TrinityCore
|
#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 Types inherited from Trinity::Net::SocketMgr< Traits > | |
| using | Self = typename Traits::Self |
| using | SocketType = typename Traits::SocketType |
| using | ThreadType = typename Traits::ThreadType |
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::SessionState > | CreateNewSessionState (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) |
Public Member Functions inherited from Trinity::Net::SocketMgr< Traits > | |
| SocketMgr (SocketMgr const &)=delete | |
| SocketMgr (SocketMgr &&)=delete | |
| SocketMgr & | operator= (SocketMgr const &)=delete |
| SocketMgr & | operator= (SocketMgr &&)=delete |
| virtual | ~SocketMgr () |
| virtual bool | StartNetwork (Asio::IoContext &ioContext, std::string const &bindIp, uint16 port, int threadCount) |
| void | Wait () |
| virtual void | OnSocketOpen (IoContextTcpSocket &&sock) |
| int32 | GetNetworkThreadCount () const |
| Asio::IoContext * | SelectThreadWithMinConnections () const |
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< SessionState > | FindAndRefreshSessionState (std::string_view id, boost::asio::ip::address const &address) |
| void | MarkSessionInactive (boost::uuids::uuid const &id) |
Static Public Member Functions | |
| static LoginRESTService & | Instance () |
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 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::BnetSRP6Base > | CreateSrpImplementation (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 |
| uint16 | _port |
| std::string | _externalHostname |
| std::string | _localHostname |
| std::vector< boost::asio::ip::address > | _addresses |
| std::size_t | _firstLocalAddressIndex |
| uint32 | _loginTicketDuration |
Additional Inherited Members | |
Protected Member Functions inherited from Trinity::Net::Http::HttpService< LoginHttpSession > | |
| std::unique_ptr< HttpNetworkThread< LoginHttpSession >[]> | CreateThreads () const override |
Protected Member Functions inherited from Trinity::Net::SocketMgr< Traits > | |
| SocketMgr () | |
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 Trinity::Net::SocketMgr< Traits > | |
| std::unique_ptr< AsyncAcceptor > | _acceptor |
| std::unique_ptr< ThreadType[]> | _threads |
| int32 | _threadCount |
Definition at line 45 of file LoginRESTService.h.
Definition at line 49 of file LoginRESTService.h.
Definition at line 51 of file LoginRESTService.h.
Definition at line 50 of file LoginRESTService.h.
Definition at line 52 of file LoginRESTService.h.
Definition at line 48 of file LoginRESTService.h.
|
inline |
Definition at line 54 of file LoginRESTService.h.
|
overridevirtual |
Reimplemented from Trinity::Net::Http::HttpService< LoginHttpSession >.
Definition at line 547 of file LoginRESTService.cpp.
|
staticprivate |
Definition at line 525 of file LoginRESTService.cpp.
|
staticprivate |
Definition at line 144 of file LoginRESTService.cpp.
References Trinity::Encoding::Base64::Decode(), and Trinity::Net::Http::ToStdStringView().
Referenced by HandleGetGameAccounts().
| std::string const & Battlenet::LoginRESTService::GetHostnameForClient | ( | boost::asio::ip::address const & | address | ) | const |
Definition at line 133 of file LoginRESTService.cpp.
References _addresses, _externalHostname, _firstLocalAddressIndex, _localHostname, and Trinity::Net::SelectAddressForClient().
Referenced by HandleGetForm().
|
inline |
Definition at line 61 of file LoginRESTService.h.
References _port.
|
private |
Definition at line 170 of file LoginRESTService.cpp.
References _formInputs, _port, GetHostnameForClient(), Trinity::Net::Http::RequestContext::response, JSON::Serialize(), Trinity::StringFormat(), and Battlenet::SslContext::UsesDevWildcardCertificate().
Referenced by StartNetwork().
|
staticprivate |
Definition at line 181 of file LoginRESTService.cpp.
References ExtractAuthorization(), Trinity::Net::Http::DispatcherService::HandleUnauthorized(), LOGIN_SEL_BNET_GAME_ACCOUNT_LIST, LoginDatabase, Trinity::Net::Http::RequestContext::request, Trinity::Net::Http::RequestContext::response, JSON::Serialize(), and PreparedStatementBase::setString().
Referenced by StartNetwork().
|
private |
Definition at line 230 of file LoginRESTService.cpp.
References Trinity::Net::Http::RequestContext::response, sConfigMgr, and Trinity::StringFormat().
Referenced by StartNetwork().
|
private |
Definition at line 237 of file LoginRESTService.cpp.
References BAN_ACCOUNT, BAN_IP, ByteArrayToHexStr(), JSON::Deserialize(), Field::GetBinary(), Trinity::Impl::GenericHash< HashCreator, DigestLength >::GetDigestOf(), Field::GetString(), Field::GetUInt32(), Field::GetUInt64(), LOGIN_INS_BNET_ACCOUNT_AUTO_BANNED, LOGIN_INS_IP_AUTO_BANNED, LOGIN_SEL_BNET_AUTHENTICATION, LOGIN_UPD_BNET_AUTHENTICATION, LOGIN_UPD_BNET_FAILED_LOGINS, LOGIN_UPD_BNET_RESET_FAILED_LOGINS, LoginDatabase, Trinity::Net::Http::RequestContext::request, Trinity::Net::Http::RequestContext::response, Trinity::Crypto::SRP::SALT_LENGTH, sConfigMgr, JSON::Serialize(), PreparedStatementBase::setString(), PreparedStatementBase::setUInt32(), TC_LOG_DEBUG, Utf8ToUpperOnlyLatin(), v1, and QueryCallback::WithPreparedCallback().
Referenced by StartNetwork().
|
staticprivate |
Definition at line 400 of file LoginRESTService.cpp.
References ByteArrayToHexStr(), JSON::Deserialize(), Trinity::Impl::GenericHash< HashCreator, DigestLength >::GetDigestOf(), LOGIN_SEL_BNET_CHECK_PASSWORD_BY_EMAIL, LoginDatabase, Trinity::Net::Http::RequestContext::request, Trinity::Net::Http::RequestContext::response, Trinity::Crypto::SRP::SALT_LENGTH, JSON::Serialize(), PreparedStatementBase::setString(), and Utf8ToUpperOnlyLatin().
Referenced by StartNetwork().
|
private |
Definition at line 486 of file LoginRESTService.cpp.
References LOGIN_SEL_BNET_EXISTING_AUTHENTICATION, LoginDatabase, Trinity::Net::Http::RequestContext::request, Trinity::Net::Http::RequestContext::response, JSON::Serialize(), and PreparedStatementBase::setString().
Referenced by StartNetwork().
|
static |
Definition at line 34 of file LoginRESTService.cpp.
|
private |
Definition at line 554 of file LoginRESTService.cpp.
References AsUnderlyingType(), Trinity::Crypto::SRP::BnetSRP6v1Base::g, Trinity::Impl::GenericHash< HashCreator, DigestLength >::GetDigestOf(), getMSTime(), GetMSTimeDiffToNow(), LOGIN_UPD_BNET_LOGON, LoginDatabase, BigNumber::ModExp(), Trinity::Crypto::SRP::BnetSRP6v1Base::N, PreparedStatementBase::setBinary(), PreparedStatementBase::setInt8(), PreparedStatementBase::setUInt32(), Trinity::StringFormat(), TC_LOG_INFO, TC_LOG_WARN, BigNumber::ToByteVector(), and v1.
Referenced by StartNetwork().
|
override |
Definition at line 40 of file LoginRESTService.cpp.
References _addresses, _externalHostname, _firstLocalAddressIndex, _formInputs, _localHostname, _loginTicketDuration, _port, HandleGetForm(), HandleGetGameAccounts(), HandleGetPortal(), HandlePostLogin(), HandlePostLoginSrpChallenge(), HandlePostRefreshLoginTicket(), MigrateLegacyPasswordHashes(), Trinity::Net::Http::HttpService< LoginHttpSession >::RegisterHandler(), Trinity::Net::Resolver::ResolveAll(), sConfigMgr, and TC_LOG_ERROR.
|
private |
Definition at line 85 of file LoginRESTService.h.
Referenced by GetHostnameForClient(), and StartNetwork().
|
private |
Definition at line 83 of file LoginRESTService.h.
Referenced by GetHostnameForClient(), and StartNetwork().
|
private |
Definition at line 86 of file LoginRESTService.h.
Referenced by GetHostnameForClient(), and StartNetwork().
|
private |
Definition at line 81 of file LoginRESTService.h.
Referenced by HandleGetForm(), and StartNetwork().
|
private |
Definition at line 84 of file LoginRESTService.h.
Referenced by GetHostnameForClient(), and StartNetwork().
|
private |
Definition at line 87 of file LoginRESTService.h.
Referenced by StartNetwork().
|
private |
Definition at line 82 of file LoginRESTService.h.
Referenced by GetPort(), HandleGetForm(), and StartNetwork().