Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API接口验签 bug #633

Closed
lvzhihong opened this issue May 29, 2024 · 2 comments
Closed

API接口验签 bug #633

lvzhihong opened this issue May 29, 2024 · 2 comments

Comments

@lvzhihong
Copy link

使用版本:

1.38.0

报错信息:

API接口验签 提示验签失败

跟了下源码 问题出现在 调用方 拼接signStr的时候 参数的顺序 和 服务端的是不一致的

原因出现在SaSignTemplate 的 createSign方法
if(paramsMap.containsKey(sign)) {
// 为了保证不影响原有的 paramsMap,此处需要再复制一份
paramsMap = new TreeMap<>(paramsMap);
paramsMap.remove(sign);
}
问题就出现在 传入的时候 使用的是linkedHashMap 转换成 TreeMap后 打乱了顺序

希望结果:

复现步骤:

< 备注:如果复现步骤比较复杂,请将 demo 上传到 gitee 并留下地址 >

@click33
Copy link
Collaborator

click33 commented May 29, 2024

不管是client还是Server 都是默认转化为 treeMap 使用字典顺序拼接参数,除非你某一方自定义了拼接规则

@lvzhihong
Copy link
Author

@click33 明白了 多谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants