streamline int overflow check for token timestamps

This commit is contained in:
Fabio Bozzo
2024-12-02 12:06:06 +01:00
parent 28272e6900
commit 5b816ccc62
3 changed files with 28 additions and 28 deletions

View File

@@ -275,8 +275,15 @@ func tokenFromModel(m tokenPayloadModel) (*Token, error) {
tkn.proof = m.Prf
tkn.meta = m.Meta
tkn.expiration = parse.OptionalTimestamp(m.Exp)
tkn.invokedAt = parse.OptionalTimestamp(m.Iat)
tkn.expiration, err = parse.OptionalTimestamp(m.Exp)
if err != nil {
return nil, fmt.Errorf("parse expiration: %w", err)
}
tkn.invokedAt, err = parse.OptionalTimestamp(m.Iat)
if err != nil {
return nil, fmt.Errorf("parse invokedAt: %w", err)
}
tkn.cause = m.Cause