Skip to content

Commit

Permalink
fix: add missing time import
Browse files Browse the repository at this point in the history
Signed-off-by: Antoine Jouve <ant.jouve@gmail.com>
  • Loading branch information
an-toine committed Jan 9, 2024
1 parent 0ce3667 commit 8535534
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/pkg/token/claims/robot/robot.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package robot

import (
"errors"
"time"

"github.com/golang-jwt/jwt/v5"

Expand Down
2 changes: 1 addition & 1 deletion src/pkg/token/claims/v2/claims.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type Claims struct {

// Valid checks if the issuer is harbor
func (c *Claims) Valid() error {
var v = jwt.NewValidator(jwt.WithLeeway(10*time.Second))
var v = jwt.NewValidator(jwt.WithLeeway(10 * time.Second))

if err := v.Validate(c.RegisteredClaims); err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion src/server/middleware/security/v2_token.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (vt *v2Token) Generate(req *http.Request) security.Context {
logger.Warningf("failed to decode bearer token: %v", err)
return nil
}
var v = jwt.NewValidator(jwt.WithLeeway(10*time.Second))
var v = jwt.NewValidator(jwt.WithLeeway(10 * time.Second))
if err := v.Validate(t.Claims); err != nil {
logger.Warningf("failed to decode bearer token: %v", err)
return nil
Expand Down

0 comments on commit 8535534

Please sign in to comment.