aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/golang-jwt/jwt/v5/none.go
diff options
context:
space:
mode:
authorLibravatar Rutger Broekhoff2024-01-02 18:56:31 +0100
committerLibravatar Rutger Broekhoff2024-01-02 18:56:31 +0100
commit8db41da676ac8368ef7c2549d56239a5ff5eedde (patch)
tree09c427fd66de2ec1ebffc8342f5fdbb84b0701b5 /vendor/github.com/golang-jwt/jwt/v5/none.go
parentd4f75fb6db22e57577867445a022227e70958931 (diff)
downloadgitolfs3-8db41da676ac8368ef7c2549d56239a5ff5eedde.tar.gz
gitolfs3-8db41da676ac8368ef7c2549d56239a5ff5eedde.zip
Delete vendor directory
Diffstat (limited to 'vendor/github.com/golang-jwt/jwt/v5/none.go')
-rw-r--r--vendor/github.com/golang-jwt/jwt/v5/none.go50
1 files changed, 0 insertions, 50 deletions
diff --git a/vendor/github.com/golang-jwt/jwt/v5/none.go b/vendor/github.com/golang-jwt/jwt/v5/none.go
deleted file mode 100644
index 685c2ea..0000000
--- a/vendor/github.com/golang-jwt/jwt/v5/none.go
+++ /dev/null
@@ -1,50 +0,0 @@
1package jwt
2
3// SigningMethodNone implements the none signing method. This is required by the spec
4// but you probably should never use it.
5var SigningMethodNone *signingMethodNone
6
7const UnsafeAllowNoneSignatureType unsafeNoneMagicConstant = "none signing method allowed"
8
9var NoneSignatureTypeDisallowedError error
10
11type signingMethodNone struct{}
12type unsafeNoneMagicConstant string
13
14func init() {
15 SigningMethodNone = &signingMethodNone{}
16 NoneSignatureTypeDisallowedError = newError("'none' signature type is not allowed", ErrTokenUnverifiable)
17
18 RegisterSigningMethod(SigningMethodNone.Alg(), func() SigningMethod {
19 return SigningMethodNone
20 })
21}
22
23func (m *signingMethodNone) Alg() string {
24 return "none"
25}
26
27// Only allow 'none' alg type if UnsafeAllowNoneSignatureType is specified as the key
28func (m *signingMethodNone) Verify(signingString string, sig []byte, key interface{}) (err error) {
29 // Key must be UnsafeAllowNoneSignatureType to prevent accidentally
30 // accepting 'none' signing method
31 if _, ok := key.(unsafeNoneMagicConstant); !ok {
32 return NoneSignatureTypeDisallowedError
33 }
34 // If signing method is none, signature must be an empty string
35 if len(sig) != 0 {
36 return newError("'none' signing method with non-empty signature", ErrTokenUnverifiable)
37 }
38
39 // Accept 'none' signing method.
40 return nil
41}
42
43// Only allow 'none' signing if UnsafeAllowNoneSignatureType is specified as the key
44func (m *signingMethodNone) Sign(signingString string, key interface{}) ([]byte, error) {
45 if _, ok := key.(unsafeNoneMagicConstant); ok {
46 return []byte{}, nil
47 }
48
49 return nil, NoneSignatureTypeDisallowedError
50}