Core/Network: Refactor local/remote ip address selection code and allow using hostnames in LoginREST bnetserver config options

This commit is contained in:
Shauren
2023-07-15 00:45:16 +02:00
parent cdfaecda52
commit 6be536a73b
13 changed files with 384 additions and 91 deletions

View File

@@ -232,11 +232,11 @@ uint32 Battlenet::Session::HandleLogon(authentication::v1::LogonRequest const* l
if (logonRequest->has_cached_web_credentials())
return VerifyWebCredentials(logonRequest->cached_web_credentials(), continuation);
boost::asio::ip::tcp::endpoint const& endpoint = sLoginService.GetAddressForClient(GetRemoteIpAddress());
std::string const& hostname = sLoginService.GetHostnameForClient(GetRemoteIpAddress());
challenge::v1::ChallengeExternalRequest externalChallenge;
externalChallenge.set_payload_type("web_auth_url");
externalChallenge.set_payload(Trinity::StringFormat("https://{}:{}/bnetserver/login/", endpoint.address().to_string(), endpoint.port()));
externalChallenge.set_payload(Trinity::StringFormat("https://{}/bnetserver/login/", hostname));
Service<challenge::v1::ChallengeListener>(this).OnExternalChallenge(&externalChallenge);
return ERROR_OK;
}