-
Notifications
You must be signed in to change notification settings - Fork 405
feat: port clockskew support #139
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
Merged
Merged
Changes from 9 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
f2d0dde
feat: port clockskew support
0a2022f
rename ClaimsValidationOptions to ValidatorOptions
e9c5bc0
add renamed file
3a18d89
Merge branch 'golang-jwt:main' into clockskew-support
ksegun 2ba43a1
update StandardClaims functions
fc4da9d
unexport leeway
727b3aa
merge in valid function
9629854
Merge branch 'main' into clockskew-support
64c4dc6
convert validatior to functional style
1bbb42b
rename variables and unexport
b3d52c5
Added some more documentation, why types are not exported
oxisto File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package jwt | ||
|
||
import "time" | ||
|
||
// ValidatorOption is used to implement functional-style options that modify the behavior of the parser. To add | ||
// new options, just create a function (ideally beginning with With or Without) that returns an anonymous function that | ||
// takes a *ValidatorOptions type as input and manipulates its configuration accordingly. | ||
oxisto marked this conversation as resolved.
Show resolved
Hide resolved
|
||
type ValidatorOption func(*ValidatorOptions) | ||
oxisto marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
// ValidatorOptions represents options that can be used for claims validation | ||
type ValidatorOptions struct { | ||
oxisto marked this conversation as resolved.
Show resolved
Hide resolved
|
||
leeway time.Duration // Leeway to provide when validating time values | ||
} | ||
|
||
|
||
// WithLeewayValidator is an option to set the clock skew (leeway) windows | ||
func WithLeewayValidator(d time.Duration) ValidatorOption { | ||
return func(v *ValidatorOptions) { | ||
v.leeway = d | ||
} | ||
} |
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.
Uh oh!
There was an error while loading. Please reload this page.