Skip to content

Commit

Permalink
fix: don't report error that token used before issued
Browse files Browse the repository at this point in the history
h/t dgrijalva/jwt-go#314 (comment)

Signed-off-by: Manfred Touron <[email protected]>
  • Loading branch information
moul committed Sep 10, 2021
1 parent a21a948 commit b97d322
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion go/pkg/pwsso/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ func TokenWithClaims(bearer string, pubkey interface{}, allowUnsafe bool) (*jwt.
}
return token, claims, nil
}
return nil, nil, errcode.ErrSSOInvalidBearer.Wrap(err)

e, ok := err.(*jwt.ValidationError)
if !ok || (ok && e.Errors&jwt.ValidationErrorIssuedAt == 0) { // don't report error that token used before issued.
return nil, nil, errcode.ErrSSOInvalidBearer.Wrap(err)
}
}
return token, claims, nil
}
Expand Down

0 comments on commit b97d322

Please sign in to comment.