Skip to content

Comments

test: document and validate JWT leeway option across languages and tests#366

Merged
appleboy merged 1 commit intomasterfrom
leeway
Dec 30, 2025
Merged

test: document and validate JWT leeway option across languages and tests#366
appleboy merged 1 commit intomasterfrom
leeway

Conversation

@appleboy
Copy link
Owner

  • Add comprehensive documentation explaining JWT parsing options, including clock skew tolerance (leeway), required claims, JSON number handling, and examples of combining parser options
  • Provide detailed usage instructions for the leeway option across three languages (English, Simplified Chinese, Traditional Chinese)
  • Implement tests verifying JWT leeway behavior for clock skew, including accepting recently expired tokens, rejecting tokens beyond the leeway window, accepting tokens with near-future not-before claims, and combining leeway with other parser options

fix #268

- Add comprehensive documentation explaining JWT parsing options, including clock skew tolerance (leeway), required claims, JSON number handling, and examples of combining parser options
- Provide detailed usage instructions for the leeway option across three languages (English, Simplified Chinese, Traditional Chinese)
- Implement tests verifying JWT leeway behavior for clock skew, including accepting recently expired tokens, rejecting tokens beyond the leeway window, accepting tokens with near-future not-before claims, and combining leeway with other parser options

Signed-off-by: appleboy <appleboy.tw@gmail.com>
Copilot AI review requested due to automatic review settings December 30, 2025 13:07
@appleboy appleboy merged commit 64cd376 into master Dec 30, 2025
5 of 7 checks passed
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request adds comprehensive documentation and testing for JWT parsing options, with a primary focus on the leeway option for handling clock skew tolerance in distributed systems. The PR addresses issue #268 by providing clear guidance on how to use parser options across three languages (English, Simplified Chinese, Traditional Chinese) and implementing thorough tests to validate the leeway functionality.

Key Changes

  • Added comprehensive test suite (TestLeewayForClockSkew) with 5 test cases covering expired tokens, leeway acceptance/rejection, not-before claims, and combining multiple parser options
  • Documented JWT parsing options including clock skew tolerance (leeway), JSON number handling, required claims validation, and examples of combining options
  • Provided multilingual documentation (English, Simplified Chinese, Traditional Chinese) with consistent content and examples

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
auth_jwt_test.go Adds 5 comprehensive test cases validating JWT leeway behavior for clock skew tolerance, including edge cases and option combinations
README.md Adds new "JWT Parsing Options" section with detailed documentation on leeway usage, configuration examples, security notes, and other parsing options
README.zh-CN.md Provides Simplified Chinese translation of the JWT parsing options documentation, maintaining consistency with the English version
README.zh-TW.md Provides Traditional Chinese translation of the JWT parsing options documentation, maintaining consistency with the English version

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

support for leeway?

1 participant