1.验证当前appid对应参数配置信息
if (!this.wxService.switchover(appid)) {
throw new IllegalArgumentException(String.format("未找到对应appid=[%s]的配置,请核实!", appid));
}
2.验证签名
if (!wxService.checkSignature(timestamp, nonce, signature)) {
throw new IllegalArgumentException("非法请求,可能属于伪造的请求!");
}
通过token+timestamp+nonce 进行SHA1加密,与微信signature进行比对。
SHA1.gen(this.getWxMpConfigStorage().getToken(), timestamp, nonce).equals(signature);
本文介绍了一种通过验证APPID配置信息及签名来确保请求合法性的安全机制。主要步骤包括:验证APPID的有效性;使用SHA1算法对token、timestamp与nonce进行加密并与微信提供的signature对比。
325

被折叠的 条评论
为什么被折叠?



