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

A quick way to validate token string #302

Merged
merged 1 commit into from
Jul 20, 2023
Merged

Conversation

dcalsky
Copy link
Contributor

@dcalsky dcalsky commented Apr 2, 2023

This PR reduces the scope of ToLower for strings and can provide a significant performance gain when validating Token Strings.

import (
	"strings"
	"testing"
)

var (
	authA = "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyIxMjMiOiJka2FzbDtka2FzO2xka2FzbDtka2FzbDtka2FzbDtka2FsO3NrZGw7Y216eC4sbWMsLnp4bWMueix4bWMuLHp4bWMuengsbWMsLnp4bWMuLHp4bWMuLHp4bSxjLiIsImlhdCI6MTY4MDQ0Nzg2OX0.E9n6tm0P1-Z_fj7RmGpk6RpPMQzTJuo7knKNM0sBhvk"
)

func BenchmarkBearer(b *testing.B) {
	b.Run("previous", func(b *testing.B) {
		b.ResetTimer()
		for i := 0; i < b.N; i++ {
			strings.HasPrefix(strings.ToLower(authA), "bearer ")
		}
	})
	b.Run("now", func(b *testing.B) {
		b.ResetTimer()
		for i := 0; i < b.N; i++ {
			strings.HasPrefix(strings.ToLower(authA[:7]), "bearer ")
		}
	})
}
goos: darwin
goarch: arm64
pkg: awesomeProject
BenchmarkBearer
BenchmarkBearer/previous
BenchmarkBearer/previous-10         	 1675801	       719.9 ns/op
BenchmarkBearer/now
BenchmarkBearer/now-10              	40375887	        28.59 ns/op

@dcalsky dcalsky changed the title quick way to validate token string A quick way to validate token string Apr 2, 2023
@oxisto
Copy link
Collaborator

oxisto commented Apr 2, 2023

Wow, to be honest I would not have thought that this is an issue. I wonder why the implementation of HasPrefix does not abort searching the string after n bytes. I will also look at this in the coming days if we have sufficient tests.

Update: Nevermind, obviously the ToLower was the problem here

@dcalsky
Copy link
Contributor Author

dcalsky commented Apr 2, 2023

Wow, to be honest I would not have thought that this is an issue. I wonder why the implementation of HasPrefix does not abort searching the string after n bytes. I will also look at this in the coming days if we have sufficient tests.

Update: Nevermind, obviously the ToLower was the problem here

Hundreds of projects use this library for authentication, so I want to improve the performance of it as much as possible :D

oxisto
oxisto previously approved these changes Apr 2, 2023
request/extractor.go Outdated Show resolved Hide resolved
parser.go Outdated Show resolved Hide resolved
@oxisto
Copy link
Collaborator

oxisto commented Jul 18, 2023

LGTM. Sorry for the long delay, I think we can ignore the 0.03 % coverage loss

cc @mfridman

@oxisto oxisto merged commit 8b7470d into golang-jwt:main Jul 20, 2023
@@ -90,7 +90,7 @@ func (e BearerExtractor) ExtractToken(req *http.Request) (string, error) {
tokenHeader := req.Header.Get("Authorization")
// The usual convention is for "Bearer" to be title-cased. However, there's no
// strict rule around this, and it's best to follow the robustness principle here.
if tokenHeader == "" || !strings.HasPrefix(strings.ToLower(tokenHeader), "bearer ") {
if len(tokenHeader) < 7 || !strings.HasPrefix(strings.ToLower(tokenHeader[:7]), "bearer ") {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is late and a nitpick, but HasPrefix also slices the front. Is it faster to drop the call completely?

Suggested change
if len(tokenHeader) < 7 || !strings.HasPrefix(strings.ToLower(tokenHeader[:7]), "bearer ") {
if len(tokenHeader) < 7 || strings.ToLower(tokenHeader[:7]) != "bearer " {

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We adjusted it in a follow-up PR: https://github.com/golang-jwt/jwt/pull/329/files

@oxisto oxisto mentioned this pull request Nov 8, 2023
renovate bot referenced this pull request in woodpecker-ci/woodpecker Nov 13, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [github.com/golang-jwt/jwt/v5](https://github.com/golang-jwt/jwt) |
require | minor | `v5.0.0` -> `v5.1.0` |
| golang.org/x/crypto | require | minor | `v0.14.0` -> `v0.15.0` |
| golang.org/x/net | require | minor | `v0.17.0` -> `v0.18.0` |
| golang.org/x/oauth2 | require | minor | `v0.13.0` -> `v0.14.0` |
| golang.org/x/term | require | minor | `v0.13.0` -> `v0.14.0` |

---

### Release Notes

<details>
<summary>golang-jwt/jwt (github.com/golang-jwt/jwt/v5)</summary>

### [`v5.1.0`](https://github.com/golang-jwt/jwt/releases/tag/v5.1.0)

[Compare
Source](https://github.com/golang-jwt/jwt/compare/v5.0.0...v5.1.0)

#### What's Changed

- Using jwt's native `ErrInvalidType` instead of
`json.UnsupportedTypeError` by
[@&#8203;oxisto](https://github.com/oxisto) in
[https://github.com/golang-jwt/jwt/pull/316](https://github.com/golang-jwt/jwt/pull/316)
- Fix typos in comments and test names by
[@&#8203;alexandear](https://github.com/alexandear) in
[https://github.com/golang-jwt/jwt/pull/317](https://github.com/golang-jwt/jwt/pull/317)
- Format: add whitespaces, remove empty lines by
[@&#8203;alexandear](https://github.com/alexandear) in
[https://github.com/golang-jwt/jwt/pull/319](https://github.com/golang-jwt/jwt/pull/319)
- Refactor example: use io.ReadAll instead of io.Copy by
[@&#8203;alexandear](https://github.com/alexandear) in
[https://github.com/golang-jwt/jwt/pull/320](https://github.com/golang-jwt/jwt/pull/320)
- Refactor code by using switch instead of if-else by
[@&#8203;alexandear](https://github.com/alexandear) in
[https://github.com/golang-jwt/jwt/pull/318](https://github.com/golang-jwt/jwt/pull/318)
- A quick way to validate token string by
[@&#8203;dcalsky](https://github.com/dcalsky) in
[https://github.com/golang-jwt/jwt/pull/302](https://github.com/golang-jwt/jwt/pull/302)
- Refactor: remove unnecessary \[]byte conversion to string by
[@&#8203;alexandear](https://github.com/alexandear) in
[https://github.com/golang-jwt/jwt/pull/330](https://github.com/golang-jwt/jwt/pull/330)
- Refactor: compare strings with strings.EqualFold by
[@&#8203;alexandear](https://github.com/alexandear) in
[https://github.com/golang-jwt/jwt/pull/329](https://github.com/golang-jwt/jwt/pull/329)
- Avoid use of json.NewDecoder by
[@&#8203;craigpastro](https://github.com/craigpastro) in
[https://github.com/golang-jwt/jwt/pull/313](https://github.com/golang-jwt/jwt/pull/313)
- Update ParseUnverified godoc by
[@&#8203;duhaesbaert](https://github.com/duhaesbaert) in
[https://github.com/golang-jwt/jwt/pull/341](https://github.com/golang-jwt/jwt/pull/341)
- Update ci workflows (add go1.21) by
[@&#8203;mfridman](https://github.com/mfridman) in
[https://github.com/golang-jwt/jwt/pull/345](https://github.com/golang-jwt/jwt/pull/345)
- Bump actions/checkout from 3 to 4 by
[@&#8203;dependabot](https://github.com/dependabot) in
[https://github.com/golang-jwt/jwt/pull/346](https://github.com/golang-jwt/jwt/pull/346)
- Key rotation with VerificationKeySet by
[@&#8203;mfridman](https://github.com/mfridman) in
[https://github.com/golang-jwt/jwt/pull/344](https://github.com/golang-jwt/jwt/pull/344)
- Add explicit ClaimsValidator implementation check for custom claims by
[@&#8203;epelc](https://github.com/epelc) in
[https://github.com/golang-jwt/jwt/pull/343](https://github.com/golang-jwt/jwt/pull/343)
- feat: allow making exp claim required by
[@&#8203;tareksha](https://github.com/tareksha) in
[https://github.com/golang-jwt/jwt/pull/351](https://github.com/golang-jwt/jwt/pull/351)
- Add error handling to examples by
[@&#8203;craigpastro](https://github.com/craigpastro) in
[https://github.com/golang-jwt/jwt/pull/312](https://github.com/golang-jwt/jwt/pull/312)

#### New Contributors

- [@&#8203;alexandear](https://github.com/alexandear) made their first
contribution in
[https://github.com/golang-jwt/jwt/pull/317](https://github.com/golang-jwt/jwt/pull/317)
- [@&#8203;dcalsky](https://github.com/dcalsky) made their first
contribution in
[https://github.com/golang-jwt/jwt/pull/302](https://github.com/golang-jwt/jwt/pull/302)
- [@&#8203;craigpastro](https://github.com/craigpastro) made their
first contribution in
[https://github.com/golang-jwt/jwt/pull/313](https://github.com/golang-jwt/jwt/pull/313)
- [@&#8203;duhaesbaert](https://github.com/duhaesbaert) made their
first contribution in
[https://github.com/golang-jwt/jwt/pull/341](https://github.com/golang-jwt/jwt/pull/341)
- [@&#8203;epelc](https://github.com/epelc) made their first
contribution in
[https://github.com/golang-jwt/jwt/pull/343](https://github.com/golang-jwt/jwt/pull/343)
- [@&#8203;tareksha](https://github.com/tareksha) made their first
contribution in
[https://github.com/golang-jwt/jwt/pull/351](https://github.com/golang-jwt/jwt/pull/351)

**Full Changelog**:
golang-jwt/jwt@v5.0.0...v5.1.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am" (UTC), Automerge -
"before 4am" (UTC).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config help](https://github.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/woodpecker-ci/woodpecker).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40Ni4wIiwidXBkYXRlZEluVmVyIjoiMzcuNDYuMCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
nono referenced this pull request in cozy/cozy-stack Nov 20, 2023
[![Mend Renovate logo
banner](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [github.com/golang-jwt/jwt/v5](https://github.com/golang-jwt/jwt) |
require | minor | `v5.0.0` -> `v5.1.0` |

---

### Release Notes

<details>
<summary>golang-jwt/jwt (github.com/golang-jwt/jwt/v5)</summary>

### [`v5.1.0`](https://github.com/golang-jwt/jwt/releases/tag/v5.1.0)

[Compare
Source](https://github.com/golang-jwt/jwt/compare/v5.0.0...v5.1.0)

#### What's Changed

- Using jwt's native `ErrInvalidType` instead of
`json.UnsupportedTypeError` by
[@&#8203;oxisto](https://github.com/oxisto) in
[https://github.com/golang-jwt/jwt/pull/316](https://github.com/golang-jwt/jwt/pull/316)
- Fix typos in comments and test names by
[@&#8203;alexandear](https://github.com/alexandear) in
[https://github.com/golang-jwt/jwt/pull/317](https://github.com/golang-jwt/jwt/pull/317)
- Format: add whitespaces, remove empty lines by
[@&#8203;alexandear](https://github.com/alexandear) in
[https://github.com/golang-jwt/jwt/pull/319](https://github.com/golang-jwt/jwt/pull/319)
- Refactor example: use io.ReadAll instead of io.Copy by
[@&#8203;alexandear](https://github.com/alexandear) in
[https://github.com/golang-jwt/jwt/pull/320](https://github.com/golang-jwt/jwt/pull/320)
- Refactor code by using switch instead of if-else by
[@&#8203;alexandear](https://github.com/alexandear) in
[https://github.com/golang-jwt/jwt/pull/318](https://github.com/golang-jwt/jwt/pull/318)
- A quick way to validate token string by
[@&#8203;dcalsky](https://github.com/dcalsky) in
[https://github.com/golang-jwt/jwt/pull/302](https://github.com/golang-jwt/jwt/pull/302)
- Refactor: remove unnecessary \[]byte conversion to string by
[@&#8203;alexandear](https://github.com/alexandear) in
[https://github.com/golang-jwt/jwt/pull/330](https://github.com/golang-jwt/jwt/pull/330)
- Refactor: compare strings with strings.EqualFold by
[@&#8203;alexandear](https://github.com/alexandear) in
[https://github.com/golang-jwt/jwt/pull/329](https://github.com/golang-jwt/jwt/pull/329)
- Avoid use of json.NewDecoder by
[@&#8203;craigpastro](https://github.com/craigpastro) in
[https://github.com/golang-jwt/jwt/pull/313](https://github.com/golang-jwt/jwt/pull/313)
- Update ParseUnverified godoc by
[@&#8203;duhaesbaert](https://github.com/duhaesbaert) in
[https://github.com/golang-jwt/jwt/pull/341](https://github.com/golang-jwt/jwt/pull/341)
- Update ci workflows (add go1.21) by
[@&#8203;mfridman](https://github.com/mfridman) in
[https://github.com/golang-jwt/jwt/pull/345](https://github.com/golang-jwt/jwt/pull/345)
- Bump actions/checkout from 3 to 4 by
[@&#8203;dependabot](https://github.com/dependabot) in
[https://github.com/golang-jwt/jwt/pull/346](https://github.com/golang-jwt/jwt/pull/346)
- Key rotation with VerificationKeySet by
[@&#8203;mfridman](https://github.com/mfridman) in
[https://github.com/golang-jwt/jwt/pull/344](https://github.com/golang-jwt/jwt/pull/344)
- Add explicit ClaimsValidator implementation check for custom claims by
[@&#8203;epelc](https://github.com/epelc) in
[https://github.com/golang-jwt/jwt/pull/343](https://github.com/golang-jwt/jwt/pull/343)
- feat: allow making exp claim required by
[@&#8203;tareksha](https://github.com/tareksha) in
[https://github.com/golang-jwt/jwt/pull/351](https://github.com/golang-jwt/jwt/pull/351)
- Add error handling to examples by
[@&#8203;craigpastro](https://github.com/craigpastro) in
[https://github.com/golang-jwt/jwt/pull/312](https://github.com/golang-jwt/jwt/pull/312)

#### New Contributors

- [@&#8203;alexandear](https://github.com/alexandear) made their first
contribution in
[https://github.com/golang-jwt/jwt/pull/317](https://github.com/golang-jwt/jwt/pull/317)
- [@&#8203;dcalsky](https://github.com/dcalsky) made their first
contribution in
[https://github.com/golang-jwt/jwt/pull/302](https://github.com/golang-jwt/jwt/pull/302)
- [@&#8203;craigpastro](https://github.com/craigpastro) made their
first contribution in
[https://github.com/golang-jwt/jwt/pull/313](https://github.com/golang-jwt/jwt/pull/313)
- [@&#8203;duhaesbaert](https://github.com/duhaesbaert) made their
first contribution in
[https://github.com/golang-jwt/jwt/pull/341](https://github.com/golang-jwt/jwt/pull/341)
- [@&#8203;epelc](https://github.com/epelc) made their first
contribution in
[https://github.com/golang-jwt/jwt/pull/343](https://github.com/golang-jwt/jwt/pull/343)
- [@&#8203;tareksha](https://github.com/tareksha) made their first
contribution in
[https://github.com/golang-jwt/jwt/pull/351](https://github.com/golang-jwt/jwt/pull/351)

**Full Changelog**:
golang-jwt/jwt@v5.0.0...v5.1.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 6am on Monday" in timezone
Europe/Paris, 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 [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/cozy/cozy-stack).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy41OS44IiwidXBkYXRlZEluVmVyIjoiMzcuNTkuOCIsInRhcmdldEJyYW5jaCI6Im1hc3RlciJ9-->
github-merge-queue bot referenced this pull request in infratographer/x Apr 2, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [github.com/golang-jwt/jwt/v5](https://github.com/golang-jwt/jwt) |
`v5.0.0` -> `v5.2.1` |
[![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fgolang-jwt%2fjwt%2fv5/v5.2.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fgolang-jwt%2fjwt%2fv5/v5.2.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fgolang-jwt%2fjwt%2fv5/v5.0.0/v5.2.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fgolang-jwt%2fjwt%2fv5/v5.0.0/v5.2.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>golang-jwt/jwt (github.com/golang-jwt/jwt/v5)</summary>

### [`v5.2.1`](https://github.com/golang-jwt/jwt/releases/tag/v5.2.1)

[Compare
Source](https://github.com/golang-jwt/jwt/compare/v5.2.0...v5.2.1)

#### What's Changed

- chore: remove unnecessary conversions from tests by
[@&#8203;estensen](https://github.com/estensen) in
[https://github.com/golang-jwt/jwt/pull/370](https://github.com/golang-jwt/jwt/pull/370)
- Trivial: Typo fix for ECDSA error message by
[@&#8203;tjs-cinemo](https://github.com/tjs-cinemo) in
[https://github.com/golang-jwt/jwt/pull/373](https://github.com/golang-jwt/jwt/pull/373)
- Fix incorrect error return by
[@&#8203;ss49919201](https://github.com/ss49919201) in
[https://github.com/golang-jwt/jwt/pull/371](https://github.com/golang-jwt/jwt/pull/371)

#### New Contributors

- [@&#8203;tjs-cinemo](https://github.com/tjs-cinemo) made their first
contribution in
[https://github.com/golang-jwt/jwt/pull/373](https://github.com/golang-jwt/jwt/pull/373)
- [@&#8203;ss49919201](https://github.com/ss49919201) made their first
contribution in
[https://github.com/golang-jwt/jwt/pull/371](https://github.com/golang-jwt/jwt/pull/371)

**Full Changelog**:
golang-jwt/jwt@v5.2.0...v5.2.1

### [`v5.2.0`](https://github.com/golang-jwt/jwt/releases/tag/v5.2.0)

[Compare
Source](https://github.com/golang-jwt/jwt/compare/v5.1.0...v5.2.0)

#### What's Changed

- Exported `NewValidator` by
[@&#8203;oxisto](https://github.com/oxisto) in
[https://github.com/golang-jwt/jwt/pull/349](https://github.com/golang-jwt/jwt/pull/349)
- Improve ErrInvalidKeyType error messages by
[@&#8203;Laurin-Notemann](https://github.com/Laurin-Notemann) in
[https://github.com/golang-jwt/jwt/pull/361](https://github.com/golang-jwt/jwt/pull/361)
- Update MIGRATION_GUIDE.md by
[@&#8203;jbarham](https://github.com/jbarham) in
[https://github.com/golang-jwt/jwt/pull/363](https://github.com/golang-jwt/jwt/pull/363)

#### New Contributors

- [@&#8203;Laurin-Notemann](https://github.com/Laurin-Notemann) made
their first contribution in
[https://github.com/golang-jwt/jwt/pull/361](https://github.com/golang-jwt/jwt/pull/361)
- [@&#8203;jbarham](https://github.com/jbarham) made their first
contribution in
[https://github.com/golang-jwt/jwt/pull/363](https://github.com/golang-jwt/jwt/pull/363)

**Full Changelog**:
golang-jwt/jwt@v5.1.0...v5.2.0

### [`v5.1.0`](https://github.com/golang-jwt/jwt/releases/tag/v5.1.0)

[Compare
Source](https://github.com/golang-jwt/jwt/compare/v5.0.0...v5.1.0)

#### What's Changed

- Using jwt's native `ErrInvalidType` instead of
`json.UnsupportedTypeError` by
[@&#8203;oxisto](https://github.com/oxisto) in
[https://github.com/golang-jwt/jwt/pull/316](https://github.com/golang-jwt/jwt/pull/316)
- Fix typos in comments and test names by
[@&#8203;alexandear](https://github.com/alexandear) in
[https://github.com/golang-jwt/jwt/pull/317](https://github.com/golang-jwt/jwt/pull/317)
- Format: add whitespaces, remove empty lines by
[@&#8203;alexandear](https://github.com/alexandear) in
[https://github.com/golang-jwt/jwt/pull/319](https://github.com/golang-jwt/jwt/pull/319)
- Refactor example: use io.ReadAll instead of io.Copy by
[@&#8203;alexandear](https://github.com/alexandear) in
[https://github.com/golang-jwt/jwt/pull/320](https://github.com/golang-jwt/jwt/pull/320)
- Refactor code by using switch instead of if-else by
[@&#8203;alexandear](https://github.com/alexandear) in
[https://github.com/golang-jwt/jwt/pull/318](https://github.com/golang-jwt/jwt/pull/318)
- A quick way to validate token string by
[@&#8203;dcalsky](https://github.com/dcalsky) in
[https://github.com/golang-jwt/jwt/pull/302](https://github.com/golang-jwt/jwt/pull/302)
- Refactor: remove unnecessary \[]byte conversion to string by
[@&#8203;alexandear](https://github.com/alexandear) in
[https://github.com/golang-jwt/jwt/pull/330](https://github.com/golang-jwt/jwt/pull/330)
- Refactor: compare strings with strings.EqualFold by
[@&#8203;alexandear](https://github.com/alexandear) in
[https://github.com/golang-jwt/jwt/pull/329](https://github.com/golang-jwt/jwt/pull/329)
- Avoid use of json.NewDecoder by
[@&#8203;craigpastro](https://github.com/craigpastro) in
[https://github.com/golang-jwt/jwt/pull/313](https://github.com/golang-jwt/jwt/pull/313)
- Update ParseUnverified godoc by
[@&#8203;duhaesbaert](https://github.com/duhaesbaert) in
[https://github.com/golang-jwt/jwt/pull/341](https://github.com/golang-jwt/jwt/pull/341)
- Update ci workflows (add go1.21) by
[@&#8203;mfridman](https://github.com/mfridman) in
[https://github.com/golang-jwt/jwt/pull/345](https://github.com/golang-jwt/jwt/pull/345)
- Bump actions/checkout from 3 to 4 by
[@&#8203;dependabot](https://github.com/dependabot) in
[https://github.com/golang-jwt/jwt/pull/346](https://github.com/golang-jwt/jwt/pull/346)
- Key rotation with VerificationKeySet by
[@&#8203;mfridman](https://github.com/mfridman) in
[https://github.com/golang-jwt/jwt/pull/344](https://github.com/golang-jwt/jwt/pull/344)
- Add explicit ClaimsValidator implementation check for custom claims by
[@&#8203;epelc](https://github.com/epelc) in
[https://github.com/golang-jwt/jwt/pull/343](https://github.com/golang-jwt/jwt/pull/343)
- feat: allow making exp claim required by
[@&#8203;tareksha](https://github.com/tareksha) in
[https://github.com/golang-jwt/jwt/pull/351](https://github.com/golang-jwt/jwt/pull/351)
- Add error handling to examples by
[@&#8203;craigpastro](https://github.com/craigpastro) in
[https://github.com/golang-jwt/jwt/pull/312](https://github.com/golang-jwt/jwt/pull/312)

#### New Contributors

- [@&#8203;alexandear](https://github.com/alexandear) made their first
contribution in
[https://github.com/golang-jwt/jwt/pull/317](https://github.com/golang-jwt/jwt/pull/317)
- [@&#8203;dcalsky](https://github.com/dcalsky) made their first
contribution in
[https://github.com/golang-jwt/jwt/pull/302](https://github.com/golang-jwt/jwt/pull/302)
- [@&#8203;craigpastro](https://github.com/craigpastro) made their
first contribution in
[https://github.com/golang-jwt/jwt/pull/313](https://github.com/golang-jwt/jwt/pull/313)
- [@&#8203;duhaesbaert](https://github.com/duhaesbaert) made their
first contribution in
[https://github.com/golang-jwt/jwt/pull/341](https://github.com/golang-jwt/jwt/pull/341)
- [@&#8203;epelc](https://github.com/epelc) made their first
contribution in
[https://github.com/golang-jwt/jwt/pull/343](https://github.com/golang-jwt/jwt/pull/343)
- [@&#8203;tareksha](https://github.com/tareksha) made their first
contribution in
[https://github.com/golang-jwt/jwt/pull/351](https://github.com/golang-jwt/jwt/pull/351)

**Full Changelog**:
golang-jwt/jwt@v5.0.0...v5.1.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
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 [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/infratographer/x).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yNjkuMiIsInVwZGF0ZWRJblZlciI6IjM3LjI2OS4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@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.

4 participants