-
Notifications
You must be signed in to change notification settings - Fork 351
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
Implement a BearerExtractor #226
Conversation
This is a rather common extractor; it extracts the JWT from the HTTP Authorization header, expecting it to include the "Bearer " prefix. This patterns is rather common and this snippet is repeated in enough applications that it's probably best to just include it upstream and allow reusing it.
Good idea. May I suggest an alternative name like |
I have this in literally every project, haha. I'd suggest something like |
There is already a |
There is a long-existing Lines 7 to 21 in 2ebb50f
|
…v4.4.3 (#42) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [github.com/golang-jwt/jwt/v4](https://togithub.com/golang-jwt/jwt) | require | patch | `v4.4.2` -> `v4.4.3` | --- ### ⚠ Dependency Lookup Warnings ⚠ Warnings were logged while processing this repo. Please check the Dependency Dashboard for more information. --- ### Release Notes <details> <summary>golang-jwt/jwt</summary> ### [`v4.4.3`](https://togithub.com/golang-jwt/jwt/releases/tag/v4.4.3) [Compare Source](https://togithub.com/golang-jwt/jwt/compare/v4.4.2...v4.4.3) #### What's Changed - fix: link update for README.md for v4 by [@​krokite](https://togithub.com/krokite) in [https://github.com/golang-jwt/jwt/pull/217](https://togithub.com/golang-jwt/jwt/pull/217) - Implement a BearerExtractor by [@​WhyNotHugo](https://togithub.com/WhyNotHugo) in [https://github.com/golang-jwt/jwt/pull/226](https://togithub.com/golang-jwt/jwt/pull/226) - Bump matrix to support latest go version (go1.19) by [@​mfridman](https://togithub.com/mfridman) in [https://github.com/golang-jwt/jwt/pull/231](https://togithub.com/golang-jwt/jwt/pull/231) - Include https://github.com/golang-jwt/jwe in README by [@​oxisto](https://togithub.com/oxisto) in [https://github.com/golang-jwt/jwt/pull/229](https://togithub.com/golang-jwt/jwt/pull/229) - Add doc comment to ParseWithClaims by [@​jkopczyn](https://togithub.com/jkopczyn) in [https://github.com/golang-jwt/jwt/pull/232](https://togithub.com/golang-jwt/jwt/pull/232) - Refactor: removed the unneeded if statement by [@​Krout0n](https://togithub.com/Krout0n) in [https://github.com/golang-jwt/jwt/pull/241](https://togithub.com/golang-jwt/jwt/pull/241) - No pointer embedding in the example by [@​oxisto](https://togithub.com/oxisto) in [https://github.com/golang-jwt/jwt/pull/255](https://togithub.com/golang-jwt/jwt/pull/255) #### New Contributors - [@​krokite](https://togithub.com/krokite) made their first contribution in [https://github.com/golang-jwt/jwt/pull/217](https://togithub.com/golang-jwt/jwt/pull/217) - [@​WhyNotHugo](https://togithub.com/WhyNotHugo) made their first contribution in [https://github.com/golang-jwt/jwt/pull/226](https://togithub.com/golang-jwt/jwt/pull/226) - [@​jkopczyn](https://togithub.com/jkopczyn) made their first contribution in [https://github.com/golang-jwt/jwt/pull/232](https://togithub.com/golang-jwt/jwt/pull/232) - [@​Krout0n](https://togithub.com/Krout0n) made their first contribution in [https://github.com/golang-jwt/jwt/pull/241](https://togithub.com/golang-jwt/jwt/pull/241) **Full Changelog**: golang-jwt/jwt@v4.4.2...v4.4.3 </details> --- ### Configuration 📅 **Schedule**: Branch creation - "before 3am on Monday" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox. <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzMi4yMjkuMCIsInVwZGF0ZWRJblZlciI6IjMyLjIyOS4wIn0=--> Co-authored-by: mend-for-github-com[bot] <50673670+mend-for-github-com[bot]@users.noreply.github.com>
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [github.com/golang-jwt/jwt/v4](https://togithub.com/golang-jwt/jwt) | indirect | patch | `v4.4.2` -> `v4.4.3` | --- ### Release Notes <details> <summary>golang-jwt/jwt</summary> ### [`v4.4.3`](https://togithub.com/golang-jwt/jwt/releases/tag/v4.4.3): 4.4.3 [Compare Source](https://togithub.com/golang-jwt/jwt/compare/v4.4.2...v4.4.3) ##### What's Changed - fix: link update for README.md for v4 by [@​krokite](https://togithub.com/krokite) in [https://github.com/golang-jwt/jwt/pull/217](https://togithub.com/golang-jwt/jwt/pull/217) - Implement a BearerExtractor by [@​WhyNotHugo](https://togithub.com/WhyNotHugo) in [https://github.com/golang-jwt/jwt/pull/226](https://togithub.com/golang-jwt/jwt/pull/226) - Bump matrix to support latest go version (go1.19) by [@​mfridman](https://togithub.com/mfridman) in [https://github.com/golang-jwt/jwt/pull/231](https://togithub.com/golang-jwt/jwt/pull/231) - Include https://github.com/golang-jwt/jwe in README by [@​oxisto](https://togithub.com/oxisto) in [https://github.com/golang-jwt/jwt/pull/229](https://togithub.com/golang-jwt/jwt/pull/229) - Add doc comment to ParseWithClaims by [@​jkopczyn](https://togithub.com/jkopczyn) in [https://github.com/golang-jwt/jwt/pull/232](https://togithub.com/golang-jwt/jwt/pull/232) - Refactor: removed the unneeded if statement by [@​Krout0n](https://togithub.com/Krout0n) in [https://github.com/golang-jwt/jwt/pull/241](https://togithub.com/golang-jwt/jwt/pull/241) - No pointer embedding in the example by [@​oxisto](https://togithub.com/oxisto) in [https://github.com/golang-jwt/jwt/pull/255](https://togithub.com/golang-jwt/jwt/pull/255) ##### New Contributors - [@​krokite](https://togithub.com/krokite) made their first contribution in [https://github.com/golang-jwt/jwt/pull/217](https://togithub.com/golang-jwt/jwt/pull/217) - [@​WhyNotHugo](https://togithub.com/WhyNotHugo) made their first contribution in [https://github.com/golang-jwt/jwt/pull/226](https://togithub.com/golang-jwt/jwt/pull/226) - [@​jkopczyn](https://togithub.com/jkopczyn) made their first contribution in [https://github.com/golang-jwt/jwt/pull/232](https://togithub.com/golang-jwt/jwt/pull/232) - [@​Krout0n](https://togithub.com/Krout0n) made their first contribution in [https://github.com/golang-jwt/jwt/pull/241](https://togithub.com/golang-jwt/jwt/pull/241) **Full Changelog**: golang-jwt/jwt@v4.4.2...v4.4.3 </details> --- ### Configuration 📅 **Schedule**: Branch creation - "before 3am on the first day of the month" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://togithub.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC45NC4wIiwidXBkYXRlZEluVmVyIjoiMzQuOTQuMCJ9-->
* Implement a BearerExtractor This is a rather common extractor; it extracts the JWT from the HTTP Authorization header, expecting it to include the "Bearer " prefix. This patterns is rather common and this snippet is repeated in enough applications that it's probably best to just include it upstream and allow reusing it. * Ignore case-sensitivity for "Bearer"
* Implement a BearerExtractor This is a rather common extractor; it extracts the JWT from the HTTP Authorization header, expecting it to include the "Bearer " prefix. This patterns is rather common and this snippet is repeated in enough applications that it's probably best to just include it upstream and allow reusing it. * Ignore case-sensitivity for "Bearer"
This is a rather common extractor; it extracts the JWT from the HTTP
Authorization header, expecting it to include the "Bearer " prefix.
This patterns is rather common and this snippet is repeated in enough
applications that it's probably best to just include it upstream and
allow reusing it.