diff options
author | Rutger Broekhoff | 2023-12-30 14:00:34 +0100 |
---|---|---|
committer | Rutger Broekhoff | 2023-12-30 14:00:34 +0100 |
commit | f6c92c5e2d87ab1334648b0d1293771de7aae4a5 (patch) | |
tree | 265c3a06accd398a1e0a173af56d7392a5f94a24 /vendor/github.com/golang-jwt/jwt/v5/errors.go | |
parent | 4f167c0fa991aa9ddb3f0252e23694b3aa6532b1 (diff) | |
download | gitolfs3-f6c92c5e2d87ab1334648b0d1293771de7aae4a5.tar.gz gitolfs3-f6c92c5e2d87ab1334648b0d1293771de7aae4a5.zip |
Implement git-lfs-authenticate
Diffstat (limited to 'vendor/github.com/golang-jwt/jwt/v5/errors.go')
-rw-r--r-- | vendor/github.com/golang-jwt/jwt/v5/errors.go | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/vendor/github.com/golang-jwt/jwt/v5/errors.go b/vendor/github.com/golang-jwt/jwt/v5/errors.go new file mode 100644 index 0000000..23bb616 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/errors.go | |||
@@ -0,0 +1,49 @@ | |||
1 | package jwt | ||
2 | |||
3 | import ( | ||
4 | "errors" | ||
5 | "strings" | ||
6 | ) | ||
7 | |||
8 | var ( | ||
9 | ErrInvalidKey = errors.New("key is invalid") | ||
10 | ErrInvalidKeyType = errors.New("key is of invalid type") | ||
11 | ErrHashUnavailable = errors.New("the requested hash function is unavailable") | ||
12 | ErrTokenMalformed = errors.New("token is malformed") | ||
13 | ErrTokenUnverifiable = errors.New("token is unverifiable") | ||
14 | ErrTokenSignatureInvalid = errors.New("token signature is invalid") | ||
15 | ErrTokenRequiredClaimMissing = errors.New("token is missing required claim") | ||
16 | ErrTokenInvalidAudience = errors.New("token has invalid audience") | ||
17 | ErrTokenExpired = errors.New("token is expired") | ||
18 | ErrTokenUsedBeforeIssued = errors.New("token used before issued") | ||
19 | ErrTokenInvalidIssuer = errors.New("token has invalid issuer") | ||
20 | ErrTokenInvalidSubject = errors.New("token has invalid subject") | ||
21 | ErrTokenNotValidYet = errors.New("token is not valid yet") | ||
22 | ErrTokenInvalidId = errors.New("token has invalid id") | ||
23 | ErrTokenInvalidClaims = errors.New("token has invalid claims") | ||
24 | ErrInvalidType = errors.New("invalid type for claim") | ||
25 | ) | ||
26 | |||
27 | // joinedError is an error type that works similar to what [errors.Join] | ||
28 | // produces, with the exception that it has a nice error string; mainly its | ||
29 | // error messages are concatenated using a comma, rather than a newline. | ||
30 | type joinedError struct { | ||
31 | errs []error | ||
32 | } | ||
33 | |||
34 | func (je joinedError) Error() string { | ||
35 | msg := []string{} | ||
36 | for _, err := range je.errs { | ||
37 | msg = append(msg, err.Error()) | ||
38 | } | ||
39 | |||
40 | return strings.Join(msg, ", ") | ||
41 | } | ||
42 | |||
43 | // joinErrors joins together multiple errors. Useful for scenarios where | ||
44 | // multiple errors next to each other occur, e.g., in claims validation. | ||
45 | func joinErrors(errs ...error) error { | ||
46 | return &joinedError{ | ||
47 | errs: errs, | ||
48 | } | ||
49 | } | ||