-
Notifications
You must be signed in to change notification settings - Fork 349
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
New validation API #236
Merged
Merged
New validation API #236
Commits on Aug 28, 2022
-
Some guidelines in designing the new validation API * Previously, the `Valid` method was placed on the claim, which was always not entirely semantically correct, since the validity is concerning the token, not the claims. Although the validity of the token is based on the processing of the claims (such as `exp`). Therefore, the function `Valid` was removed from the `Claims` interface and the single canonical way to retrieve the validity of the token is to retrieve the `Valid` property of the `Token` struct. * The previous fact was enhanced by the fact that most claims implementations had additional exported `VerifyXXX` functions, which are now removed * All validation errors should be comparable with `errors.Is` to determine, why a particular validation has failed * Developers want to adjust validation options. Popular options include: * Leeway when processing exp, nbf, iat * Not verifying `iat`, since this is actually just an informational claim. When purely looking at the standard, this should probably the default * Verifying `aud` by default, which actually the standard sort of demands. We need to see how strong we want to enforce this * Developers want to create their own claim types, mostly by embedding one of the existing types such as `RegisteredClaims`. * Sometimes there is the need to further tweak the validation of a token by checking the value of a custom claim. Previously, this was possibly by overriding `Valid`. However, this was error-prone, e.g., if the original `Valid` was not called. Therefore, we should provide an easy way for *additional* checks, without by-passing the necessary validations This leads to the following two major changes: * The `Claims` interface now represents a set of functions that return the mandatory claims represented in a token, rather than just a `Valid` function. This is also more semantically correct. * All validation tasks are offloaded to a new (optional) `Validator`, which can also be configured with appropriate options. If no custom validator was supplied, a default one is used.
Configuration menu - View commit details
-
Copy full SHA for dc52415 - Browse repository at this point
Copy the full SHA dc52415View commit details -
Configuration menu - View commit details
-
Copy full SHA for 066f850 - Browse repository at this point
Copy the full SHA 066f850View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0e79f91 - Browse repository at this point
Copy the full SHA 0e79f91View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4990d2c - Browse repository at this point
Copy the full SHA 4990d2cView commit details -
Configuration menu - View commit details
-
Copy full SHA for eedf3eb - Browse repository at this point
Copy the full SHA eedf3ebView commit details
Commits on Oct 15, 2022
-
Apply suggestions from code review
Co-authored-by: Micah Parks <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 91f51d0 - Browse repository at this point
Copy the full SHA 91f51d0View commit details
Commits on Oct 26, 2022
-
Configuration menu - View commit details
-
Copy full SHA for 06a12c1 - Browse repository at this point
Copy the full SHA 06a12c1View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2281dd9 - Browse repository at this point
Copy the full SHA 2281dd9View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5d57c29 - Browse repository at this point
Copy the full SHA 5d57c29View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5a65c47 - Browse repository at this point
Copy the full SHA 5a65c47View commit details
Commits on Dec 4, 2022
-
Configuration menu - View commit details
-
Copy full SHA for 1d6e6dc - Browse repository at this point
Copy the full SHA 1d6e6dcView commit details -
Configuration menu - View commit details
-
Copy full SHA for 2036f52 - Browse repository at this point
Copy the full SHA 2036f52View commit details
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.