Skip to content
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

Return RequiredClaimValidationError error when required claim is missing #713

Closed
wants to merge 1 commit into from
Closed

Return RequiredClaimValidationError error when required claim is missing #713

wants to merge 1 commit into from

Conversation

ste93cry
Copy link
Contributor

Fixes #706: when a required claim is missing after parsing the JWT token, a RequiredClaimValidationError error is returned in place of the generic ValidationError

lestrrat added a commit that referenced this pull request Apr 23, 2022
* Hide error type from users
  -> We would like to expose APIs, not data types (where applicable)
* Expose a function to create the error
* Changed the underlying error type to implement ValidationError interface
lestrrat added a commit that referenced this pull request Apr 23, 2022
* Return `RequiredClaimValidationError` error when required claim is missing

* slightly rework #713

* Hide error type from users
  -> We would like to expose APIs, not data types (where applicable)
* Expose a function to create the error
* Changed the underlying error type to implement ValidationError interface

* appease linter

Co-authored-by: Stefano Arlandini <sarlandini@alice.it>
@lestrrat
Copy link
Collaborator

merged by #714

@lestrrat lestrrat closed this Apr 23, 2022
@ste93cry ste93cry deleted the add-required-claim-missing-validation-error branch April 23, 2022 23:55
lestrrat added a commit that referenced this pull request Apr 24, 2022
* Fix typo (#705)

* Merge develop/v2 for v2.0.0-beta2 (#697) (#711)

* disable verification/validation for benchmarking

* Introduce jwk.CachedSet to make the common operation of using cached JWKS easier (#689)

* First round implementing jwk.CachedSet

* Change jwk.Set interface

* appease linter

* add docs

* Fix example code

* fix jwk.Set usage

* Add codecov.yml

* Add more tests

* appease linter

* tweak docs, examples, go versions

* Update deps for go1.18

* run autodoc when mering to develop/v2 (#691)

* Fix autodoc (#692)

* run autodoc when mering to develop/v2

* Create a PR isntead of a push

* Pass token, fix branch name (#693)

* Add a special rule for develop/v* branch (#695)

* autodoc updates (#696)

Co-authored-by: lestrrat <lestrrat@users.noreply.github.com>

* Update Changes

* Update Changes

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: lestrrat <lestrrat@users.noreply.github.com>

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: lestrrat <lestrrat@users.noreply.github.com>

* House cleaning (#712)

* house-cleaning and minor optimizations

* accidentally reverted

* Bump github.com/goccy/go-json from 0.9.6 to 0.9.7 (#709)

* Bump github.com/goccy/go-json from 0.9.6 to 0.9.7

Bumps [github.com/goccy/go-json](https://github.com/goccy/go-json) from 0.9.6 to 0.9.7.
- [Release notes](https://github.com/goccy/go-json/releases)
- [Changelog](https://github.com/goccy/go-json/blob/master/CHANGELOG.md)
- [Commits](goccy/go-json@v0.9.6...v0.9.7)

---
updated-dependencies:
- dependency-name: github.com/goccy/go-json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* make tidy

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Daisuke Maki <lestrrat+github@gmail.com>

* Add "missing required claims" error (#714)

* Return `RequiredClaimValidationError` error when required claim is missing

* slightly rework #713

* Hide error type from users
  -> We would like to expose APIs, not data types (where applicable)
* Expose a function to create the error
* Changed the underlying error type to implement ValidationError interface

* appease linter

Co-authored-by: Stefano Arlandini <sarlandini@alice.it>

* Update changes (#715)

Co-authored-by: Zach Collier <zamicol@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: lestrrat <lestrrat@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Stefano Arlandini <sarlandini@alice.it>
lestrrat added a commit that referenced this pull request Jun 13, 2022
* Merge develop/v2 for v2.0.0-beta2 (#697)

* disable verification/validation for benchmarking

* Introduce jwk.CachedSet to make the common operation of using cached JWKS easier (#689)

* First round implementing jwk.CachedSet

* Change jwk.Set interface

* appease linter

* add docs

* Fix example code

* fix jwk.Set usage

* Add codecov.yml

* Add more tests

* appease linter

* tweak docs, examples, go versions

* Update deps for go1.18

* run autodoc when mering to develop/v2 (#691)

* Fix autodoc (#692)

* run autodoc when mering to develop/v2

* Create a PR isntead of a push

* Pass token, fix branch name (#693)

* Add a special rule for develop/v* branch (#695)

* autodoc updates (#696)

Co-authored-by: lestrrat <lestrrat@users.noreply.github.com>

* Update Changes

* Update Changes

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: lestrrat <lestrrat@users.noreply.github.com>

* merge develop/v2 (#716)

* Fix typo (#705)

* Merge develop/v2 for v2.0.0-beta2 (#697) (#711)

* disable verification/validation for benchmarking

* Introduce jwk.CachedSet to make the common operation of using cached JWKS easier (#689)

* First round implementing jwk.CachedSet

* Change jwk.Set interface

* appease linter

* add docs

* Fix example code

* fix jwk.Set usage

* Add codecov.yml

* Add more tests

* appease linter

* tweak docs, examples, go versions

* Update deps for go1.18

* run autodoc when mering to develop/v2 (#691)

* Fix autodoc (#692)

* run autodoc when mering to develop/v2

* Create a PR isntead of a push

* Pass token, fix branch name (#693)

* Add a special rule for develop/v* branch (#695)

* autodoc updates (#696)

Co-authored-by: lestrrat <lestrrat@users.noreply.github.com>

* Update Changes

* Update Changes

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: lestrrat <lestrrat@users.noreply.github.com>

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: lestrrat <lestrrat@users.noreply.github.com>

* House cleaning (#712)

* house-cleaning and minor optimizations

* accidentally reverted

* Bump github.com/goccy/go-json from 0.9.6 to 0.9.7 (#709)

* Bump github.com/goccy/go-json from 0.9.6 to 0.9.7

Bumps [github.com/goccy/go-json](https://github.com/goccy/go-json) from 0.9.6 to 0.9.7.
- [Release notes](https://github.com/goccy/go-json/releases)
- [Changelog](https://github.com/goccy/go-json/blob/master/CHANGELOG.md)
- [Commits](goccy/go-json@v0.9.6...v0.9.7)

---
updated-dependencies:
- dependency-name: github.com/goccy/go-json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* make tidy

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Daisuke Maki <lestrrat+github@gmail.com>

* Add "missing required claims" error (#714)

* Return `RequiredClaimValidationError` error when required claim is missing

* slightly rework #713

* Hide error type from users
  -> We would like to expose APIs, not data types (where applicable)
* Expose a function to create the error
* Changed the underlying error type to implement ValidationError interface

* appease linter

Co-authored-by: Stefano Arlandini <sarlandini@alice.it>

* Update changes (#715)

Co-authored-by: Zach Collier <zamicol@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: lestrrat <lestrrat@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Stefano Arlandini <sarlandini@alice.it>

* merge develop/v2 (#748)

* Allow escape hatch for those who (incorrectly) use RFC3339 in Numeric Date fields (#735)

* Add the ability to parse RFC3339 dates for NumericDate types

* appease linter

* Tweaks (#737)

* Update go version

* Tweak documentation

* Update Changes

* Tweak doc (#738)

* show jwt.Sign using raw and jwk.Key (#739)

* autodoc updates (#740)

Co-authored-by: lestrrat <lestrrat@users.noreply.github.com>

* Add example for using JWT fields (#741)

* fix typo (#742)

* [jwe/v2] Fix possible excessive unpadding for AESCBC (#745)

* Fix possible excessive unpadding for AESCBC

* Update Changes

* Update Changes

* Update Changes

* Update Changes

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: lestrrat <lestrrat@users.noreply.github.com>
Co-authored-by: Satoru Kitaguchi <64164948+satorunooshie@users.noreply.github.com>

* Allow escape hatch for those who (incorrectly) use RFC3339 in Numeric Date fields (#735)

* Add the ability to parse RFC3339 dates for NumericDate types

* appease linter

* Upgrade deps

* Upgrade github.com/lestrrat-go/httprc to v1.0.2 (#753)

* Update httprc to v1.0.2

* run make tidy

* Update Changes

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: lestrrat <lestrrat@users.noreply.github.com>
Co-authored-by: Zach Collier <zamicol@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Stefano Arlandini <sarlandini@alice.it>
Co-authored-by: Satoru Kitaguchi <64164948+satorunooshie@users.noreply.github.com>
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.

Return custom errors for most common cases instead of generic Error or ValidationError
2 participants