-
Notifications
You must be signed in to change notification settings - Fork 358
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://github.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://github.com/golang-jwt/jwt/releases/tag/v4.4.3) [Compare Source](https://github.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://github.com/krokite) in [https://github.com/golang-jwt/jwt/pull/217](https://github.com/golang-jwt/jwt/pull/217) - Implement a BearerExtractor by [@​WhyNotHugo](https://github.com/WhyNotHugo) in [https://github.com/golang-jwt/jwt/pull/226](https://github.com/golang-jwt/jwt/pull/226) - Bump matrix to support latest go version (go1.19) by [@​mfridman](https://github.com/mfridman) in [https://github.com/golang-jwt/jwt/pull/231](https://github.com/golang-jwt/jwt/pull/231) - Include https://github.com/golang-jwt/jwe in README by [@​oxisto](https://github.com/oxisto) in [https://github.com/golang-jwt/jwt/pull/229](https://github.com/golang-jwt/jwt/pull/229) - Add doc comment to ParseWithClaims by [@​jkopczyn](https://github.com/jkopczyn) in [https://github.com/golang-jwt/jwt/pull/232](https://github.com/golang-jwt/jwt/pull/232) - Refactor: removed the unneeded if statement by [@​Krout0n](https://github.com/Krout0n) in [https://github.com/golang-jwt/jwt/pull/241](https://github.com/golang-jwt/jwt/pull/241) - No pointer embedding in the example by [@​oxisto](https://github.com/oxisto) in [https://github.com/golang-jwt/jwt/pull/255](https://github.com/golang-jwt/jwt/pull/255) #### New Contributors - [@​krokite](https://github.com/krokite) made their first contribution in [https://github.com/golang-jwt/jwt/pull/217](https://github.com/golang-jwt/jwt/pull/217) - [@​WhyNotHugo](https://github.com/WhyNotHugo) made their first contribution in [https://github.com/golang-jwt/jwt/pull/226](https://github.com/golang-jwt/jwt/pull/226) - [@​jkopczyn](https://github.com/jkopczyn) made their first contribution in [https://github.com/golang-jwt/jwt/pull/232](https://github.com/golang-jwt/jwt/pull/232) - [@​Krout0n](https://github.com/Krout0n) made their first contribution in [https://github.com/golang-jwt/jwt/pull/241](https://github.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://github.com/golang-jwt/jwt) | indirect | patch | `v4.4.2` -> `v4.4.3` | --- ### Release Notes <details> <summary>golang-jwt/jwt</summary> ### [`v4.4.3`](https://github.com/golang-jwt/jwt/releases/tag/v4.4.3): 4.4.3 [Compare Source](https://github.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://github.com/krokite) in [https://github.com/golang-jwt/jwt/pull/217](https://github.com/golang-jwt/jwt/pull/217) - Implement a BearerExtractor by [@​WhyNotHugo](https://github.com/WhyNotHugo) in [https://github.com/golang-jwt/jwt/pull/226](https://github.com/golang-jwt/jwt/pull/226) - Bump matrix to support latest go version (go1.19) by [@​mfridman](https://github.com/mfridman) in [https://github.com/golang-jwt/jwt/pull/231](https://github.com/golang-jwt/jwt/pull/231) - Include https://github.com/golang-jwt/jwe in README by [@​oxisto](https://github.com/oxisto) in [https://github.com/golang-jwt/jwt/pull/229](https://github.com/golang-jwt/jwt/pull/229) - Add doc comment to ParseWithClaims by [@​jkopczyn](https://github.com/jkopczyn) in [https://github.com/golang-jwt/jwt/pull/232](https://github.com/golang-jwt/jwt/pull/232) - Refactor: removed the unneeded if statement by [@​Krout0n](https://github.com/Krout0n) in [https://github.com/golang-jwt/jwt/pull/241](https://github.com/golang-jwt/jwt/pull/241) - No pointer embedding in the example by [@​oxisto](https://github.com/oxisto) in [https://github.com/golang-jwt/jwt/pull/255](https://github.com/golang-jwt/jwt/pull/255) ##### New Contributors - [@​krokite](https://github.com/krokite) made their first contribution in [https://github.com/golang-jwt/jwt/pull/217](https://github.com/golang-jwt/jwt/pull/217) - [@​WhyNotHugo](https://github.com/WhyNotHugo) made their first contribution in [https://github.com/golang-jwt/jwt/pull/226](https://github.com/golang-jwt/jwt/pull/226) - [@​jkopczyn](https://github.com/jkopczyn) made their first contribution in [https://github.com/golang-jwt/jwt/pull/232](https://github.com/golang-jwt/jwt/pull/232) - [@​Krout0n](https://github.com/Krout0n) made their first contribution in [https://github.com/golang-jwt/jwt/pull/241](https://github.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://github.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.