diff --git a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp index 692867f2..3a6175bf 100755 --- a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp @@ -192,6 +192,7 @@ void ClientConnection::validateClient(const std::string & id, const std::string api.addJsonData("user_password", trimmedKey); api.addJsonData("stationID", suid); api.addJsonData("ip", getRemoteAddress()); + api.addJsonData("secretKey", ConfigLoginServer::getExternalAuthSecretKey()); if (api.submit()) { @@ -215,7 +216,7 @@ void ClientConnection::validateClient(const std::string & id, const std::string else { std::ostringstream postBuf; - postBuf << "user_name=" << trimmedId << "&user_password=" << trimmedKey << "&stationID=" << suid << "&ip=" << getRemoteAddress(); + postBuf << "user_name=" << trimmedId << "&user_password=" << trimmedKey << "&stationID=" << suid << "&ip=" << getRemoteAddress() << "&secretKey=" << ConfigLoginServer::getExternalAuthSecretKey(); std::string response = webAPI::simplePost(authURL, std::string(postBuf.str()), ""); if (response == "success") { diff --git a/engine/server/application/LoginServer/src/shared/ConfigLoginServer.cpp b/engine/server/application/LoginServer/src/shared/ConfigLoginServer.cpp index 74e4cbd6..9f1ce53f 100755 --- a/engine/server/application/LoginServer/src/shared/ConfigLoginServer.cpp +++ b/engine/server/application/LoginServer/src/shared/ConfigLoginServer.cpp @@ -118,6 +118,7 @@ void ConfigLoginServer::install(void) KEY_BOOL(useJsonWebApi, false); KEY_BOOL(useExternalAuth, false); KEY_STRING(externalAuthURL, ""); + KEY_STRING(externalAuthSecretKey, ""); KEY_BOOL(useOldSuidGenerator, false); int index = 0; diff --git a/engine/server/application/LoginServer/src/shared/ConfigLoginServer.h b/engine/server/application/LoginServer/src/shared/ConfigLoginServer.h index c7730b8a..1e802330 100755 --- a/engine/server/application/LoginServer/src/shared/ConfigLoginServer.h +++ b/engine/server/application/LoginServer/src/shared/ConfigLoginServer.h @@ -66,11 +66,12 @@ class ConfigLoginServer int csToolPort; bool requireSecureLoginForCsTool; - + bool useOldSuidGenerator; bool useExternalAuth; bool useJsonWebApi; const char * externalAuthURL; + const char * externalAuthSecretKey; }; static const uint16 getCentralServicePort(); @@ -137,6 +138,7 @@ class ConfigLoginServer static bool getUseExternalAuth(); static bool getUseJsonWebApi(); static const char * getExternalAuthUrl(); + static const char * getExternalAuthSecretKey(); static bool getUseOldSuidGenerator(); // has character creation for this cluster been disabled through config option @@ -502,6 +504,10 @@ inline const char * ConfigLoginServer::getExternalAuthUrl() return data->externalAuthURL; } +inline const char * ConfigLoginServer::getExternalAuthSecretKey() +{ + return data->externalAuthSecretKey; +} inline bool ConfigLoginServer::getUseOldSuidGenerator() { diff --git a/engine/server/library/serverUtility/src/shared/AdminAccountManager.cpp b/engine/server/library/serverUtility/src/shared/AdminAccountManager.cpp index ba1a6dc5..2f6d47ad 100755 --- a/engine/server/library/serverUtility/src/shared/AdminAccountManager.cpp +++ b/engine/server/library/serverUtility/src/shared/AdminAccountManager.cpp @@ -75,7 +75,7 @@ int AdminAccountManager::getAdminLevel(const std::string & account) if(ConfigServerUtility::isExternalAdminLevelsEnabled()){ std::ostringstream postBuffer; - postBuffer << "user_name=" << account; + postBuffer << "user_name=" << account << "&secretKey=" << ConfigServerUtility::getExternalAdminLevelsSecretKey(); std::string response = webAPI::simplePost(ConfigServerUtility::getExternalAdminLevelsURL(), std::string(postBuffer.str()), ""); level = std::stoi(response); return level; diff --git a/engine/server/library/serverUtility/src/shared/ConfigServerUtility.cpp b/engine/server/library/serverUtility/src/shared/ConfigServerUtility.cpp index a83a1d68..4c7db5d9 100755 --- a/engine/server/library/serverUtility/src/shared/ConfigServerUtility.cpp +++ b/engine/server/library/serverUtility/src/shared/ConfigServerUtility.cpp @@ -19,6 +19,7 @@ namespace ConfigServerUtilityNamespace bool chatLogManagerLoggingEnabled; bool externalAdminLevelsEnabled; const char * externalAdminLevelsURL; + const char * externalAdminLevelsSecretKey; } using namespace ConfigServerUtilityNamespace; @@ -91,6 +92,13 @@ const char * ConfigServerUtility::getExternalAdminLevelsURL() //----------------------------------------------------------------------- +const char * ConfigServerUtility::getExternalAdminLevelsSecretKey() +{ + return externalAdminLevelsSecretKey; +} + +//----------------------------------------------------------------------- + void ConfigServerUtility::install() { KEY_INT(spawnCookie, 0); @@ -100,6 +108,7 @@ void ConfigServerUtility::install() KEY_BOOL(chatLogManagerLoggingEnabled, false); KEY_BOOL(externalAdminLevelsEnabled, false); KEY_STRING(externalAdminLevelsURL, "http://localhost/"); + KEY_STRING(externalAdminLevelsSecretKey, ""); } //----------------------------------------------------------------------- diff --git a/engine/server/library/serverUtility/src/shared/ConfigServerUtility.h b/engine/server/library/serverUtility/src/shared/ConfigServerUtility.h index d843c54e..e2235f0c 100755 --- a/engine/server/library/serverUtility/src/shared/ConfigServerUtility.h +++ b/engine/server/library/serverUtility/src/shared/ConfigServerUtility.h @@ -19,6 +19,7 @@ public: static bool isChatLogManagerLoggingEnabled(); static bool isExternalAdminLevelsEnabled(); static const char * getExternalAdminLevelsURL(); + static const char * getExternalAdminLevelsSecretKey(); static void install(); static void remove();