Skip to content

Commit

Permalink
[ISSUE nacos-group#124] Fix naming spas auth sign algorithm.
Browse files Browse the repository at this point in the history
  • Loading branch information
pixystone committed Nov 28, 2022
1 parent 60dc0fb commit 311edf2
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/naming/NamingProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,18 @@ NacosString NamingProxy::callServer
}

NacosString NamingProxy::getDataToSign(const std::list <NacosString> &paramValues, NacosString &nowTimeMs) {
const NacosString &groupName = ParamUtils::findByKey(paramValues, NamingConstant::GROUP_NAME);
const NacosString &serviceName = ParamUtils::findByKey(paramValues, NamingConstant::SERVICE_NAME);

NacosString dataToSign = "";
NacosString dataToSign = "" + nowTimeMs;
if (!ParamUtils::isBlank(serviceName)) {
dataToSign = serviceName + "@@";
if (ParamUtils::contains(serviceName, "@@") || ParamUtils::isBlank(groupName)) {
dataToSign += "@@" + serviceName;
} else {
dataToSign += "@@" + groupName + "@@" + serviceName;
}
}

dataToSign += nowTimeMs;
return dataToSign;
}

Expand Down

0 comments on commit 311edf2

Please sign in to comment.