@@ -20,12 +20,12 @@ type Claims struct {
20
20
// immediately following call to Valid() by jwt-go has *all* necessary information to
21
21
// determine whether JWT is valid. These fields should not be overwritten by JSON
22
22
// unmarshal.
23
- receivedTime time.Time `json:"-"`
24
- correctPayloadHash string `json:"-"`
25
- correctURLHash string `json:"-"`
23
+ receivedTime time.Time
24
+ correctPayloadHash string
25
+ correctURLHash string
26
26
27
27
Issuer string `json:"iss"`
28
- IssuedAt int64 `json:"iat "`
28
+ NotBefore int64 `json:"nbf "`
29
29
ExpirationTime int64 `json:"exp"`
30
30
JWTID string `json:"jti"`
31
31
URLHash string `json:"url_hash"`
@@ -38,11 +38,11 @@ func (c Claims) Valid() error {
38
38
var errs []string
39
39
40
40
if c .Issuer != "MessageBird" {
41
- errs = append (errs , "wrong iss" )
41
+ errs = append (errs , "claim iss has wrong value " )
42
42
}
43
43
44
- if iat := time .Unix (c .IssuedAt , int64 (c .receivedTime .Nanosecond ())).Add (- maxSkew ); c .receivedTime .Before (iat ) {
45
- errs = append (errs , "claim iat is in the future" )
44
+ if iat := time .Unix (c .NotBefore , int64 (c .receivedTime .Nanosecond ())).Add (- maxSkew ); c .receivedTime .Before (iat ) {
45
+ errs = append (errs , "claim nbf is in the future" )
46
46
}
47
47
48
48
if exp := time .Unix (c .ExpirationTime , int64 (c .receivedTime .Nanosecond ())).Add (maxSkew ); c .receivedTime .After (exp ) {
0 commit comments