We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c2b6fd1 commit d66362cCopy full SHA for d66362c
handler_test.go
@@ -1,6 +1,7 @@
1
package jwt
2
3
import (
4
+ "sync"
5
"testing"
6
"time"
7
)
@@ -132,3 +133,22 @@ func TestDecodeAndValidate_ExpNbf(t *testing.T) {
132
133
t.Fatal("invalid token was incorrectly validated against EXP")
134
}
135
136
+
137
+func TestTestEncodeAndSign_RaceCondition(t *testing.T) {
138
+ alg := NewHandler[PublicClaims](NewHmacSha256([]byte(testKey)))
139
140
+ n := 100
141
+ var wg sync.WaitGroup
142
+ wg.Add(n)
143
+ for i := 0; i < n; i++ {
144
+ go func() {
145
+ alg.EncodeAndSign(PublicClaims{
146
+ Iss: "test",
147
+ Sub: "test",
148
+ })
149
+ wg.Done()
150
+ }()
151
+ }
152
153
+ wg.Wait()
154
+}
0 commit comments