Conversation
- 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>
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix #268