Skip to content

Commit 160a42a

Browse files
authored
always reuse the stored token to query CAPI if possible (#4201)
1 parent 45ba3e8 commit 160a42a

1 file changed

Lines changed: 0 additions & 11 deletions

File tree

pkg/database/token.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ var (
1616
ErrTokenNotFound = errors.New("token not found in DB")
1717
ErrTokenParse = errors.New("unable to parse token")
1818
ErrTokenMissingClaim = errors.New("token missing required claim")
19-
ErrTokenTooOld = errors.New("token too old")
2019
ErrTokenExpired = errors.New("token expired")
2120
)
2221

@@ -49,16 +48,6 @@ func (c *Client) LoadAPICToken(ctx context.Context, logger logrus.FieldLogger) (
4948
return APICToken{}, ErrTokenParse
5049
}
5150

52-
iatFloat, ok := claims["iat"].(float64)
53-
if !ok {
54-
return APICToken{}, fmt.Errorf("%w: iat", ErrTokenMissingClaim)
55-
}
56-
57-
iat := time.Unix(int64(iatFloat), 0)
58-
if time.Now().UTC().After(iat.Add(1 * time.Minute)) {
59-
return APICToken{}, ErrTokenTooOld
60-
}
61-
6251
expFloat, ok := claims["exp"].(float64)
6352
if !ok {
6453
return APICToken{}, fmt.Errorf("%w: exp", ErrTokenMissingClaim)

0 commit comments

Comments
 (0)