nutz.cn 代码片段中,怎么只用4个字段进行 sign呢? 如果被修改的数据是 单价 ,价格呢?
if (req.getHeader("Api-Version") != null) {
log.debug("api version = " + req.getHeader("Api-Version"));
String loginname = req.getHeader("Api-Loginname");
String nonce = req.getHeader("Api-Nonce");
String key = req.getHeader("Api-Key");
String time = req.getHeader("Api-Time");
if (Strings.isBlank(loginname) || Strings.isBlank(nonce) || Strings.isBlank(key) || Strings.isBlank(time)) {
return BaseModule.HTTP_403;
}
if (!yvrService.checkNonce(nonce, time)){
return BaseModule.HTTP_403;
}
at = yvrService.accessToken(loginname);
if (Strings.isBlank(at)) {
return BaseModule.HTTP_403;
}
String tmp = Strings.join(",", at, loginname, nonce, time);
String _key = Lang.sha1(tmp);
log.debug("tmp="+tmp);
log.debug("_key=" + _key);
log.debug(" key=" + key);
if (!_key.equals(key)) {
return BaseModule.HTTP_403;
}
log.debug("api access token check ok");
}