Skip to content

修复小程序 checkSessionKey 接口地址和签名生成 - #4124

Open
binarywang wants to merge 2 commits into
developfrom
fix/check-session-key
Open

修复小程序 checkSessionKey 接口地址和签名生成#4124
binarywang wants to merge 2 commits into
developfrom
fix/check-session-key

Conversation

@binarywang

Copy link
Copy Markdown
Owner

变更说明

  • 修复小程序 checkSessionKey 接口地址,将 /wxa/checksessionkey 调整为微信官方文档中的 /wxa/checksession
  • 修复登录态签名生成逻辑,按官方要求使用 sessionKey 对空字符串进行 HMAC-SHA256 签名
  • 新增不出网的单元测试,验证最终请求 URL 和 signature

验证

mvn -pl weixin-java-miniapp -Dtest=WxMaUserServiceImplCheckSessionKeyTest,WxMaUserServiceImplPhoneNumberTest,WxMaInternetServiceImplSignatureTest test

结果:4 个用例通过,0 失败。

Fixes #4123

Copilot AI lite review requested due to automatic review settings September 12, 2026 10:59
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 12, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-12T11:03:28.527763Z 23721d1 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@augmentcode

augmentcode Bot commented Sep 12, 2026

Copy link
Copy Markdown
🤖 Augment PR Summary

摘要:此 PR 修复小程序登录态校验接口的调用契约。

  • checkSessionKey 的路径由 /wxa/checksessionkey 更正为官方的 /wxa/checksession
  • 将待签名数据由 openid 改为空字符串,以符合 session_key 登录态签名规则。
  • 新增 Mockito 单元测试,检查构造出的请求 URL 与签名参数。
  • 变更限定在 weixin-java-miniapp 模块,未引入新的依赖或公共 API。
技术注意:需确保最终十六进制签名格式及回归测试纳入模块默认 TestNG 套件。

🤖 Was this summary useful? React with 👍 or 👎

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. 2 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No unresolved issues were identified that would block approval.

Pull request overview

修复小程序检查登录态接口路径及 HMAC-SHA256 签名生成逻辑,并新增不出网回归测试。

Changes:

  • 将接口地址修正为 /wxa/checksession
  • 使用 sessionKey 对空字符串生成 HMAC-SHA256 签名。
  • 新增 URL 与签名校验测试。
File summaries
File Description
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaUserServiceImplCheckSessionKeyTest.java Updated as part of this pull request.
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/constant/WxMaApiUrlConstants.java Updated as part of this pull request.
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaUserServiceImpl.java Updated as part of this pull request.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 23721d1055

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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

Successfully merging this pull request may close these issues.

小程序 checkSessionKey 接口地址和签名生成错误

2 participants