diff options
author | Jaime Martinez <jmartinez@gitlab.com> | 2020-01-21 06:10:32 +0300 |
---|---|---|
committer | Jaime Martinez <jmartinez@gitlab.com> | 2020-01-21 06:10:32 +0300 |
commit | b24a91ad8b00cb8889bec3ddd4ca63c0465f8e51 (patch) | |
tree | ea3f23e6d488e0f52102ce3cf9e3c24fda361f20 /internal | |
parent | bd2bc7583679c19c9f1a9115016c609d0ffbbc2b (diff) |
use UTC for token expiry
Diffstat (limited to 'internal')
-rw-r--r-- | internal/source/gitlab/client/client.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/internal/source/gitlab/client/client.go b/internal/source/gitlab/client/client.go index bfce9bbd..59776a8f 100644 --- a/internal/source/gitlab/client/client.go +++ b/internal/source/gitlab/client/client.go @@ -36,12 +36,15 @@ func NewClient(baseURL string, secretKey []byte, connectionTimeout, jwtTokenExpi if err != nil { return nil, err } + if connectionTimeout == 0 { return nil, errors.New("GitLab HTTP client connection timeout has not been provided") } + if jwtTokenExpiry == 0 { return nil, errors.New("GitLab JWT token expiry has not been provided") } + return &Client{ secretKey: secretKey, baseURL: url, @@ -154,7 +157,7 @@ func (gc *Client) request(ctx context.Context, method string, endpoint *url.URL) func (gc *Client) token() (string, error) { claims := jwt.StandardClaims{ Issuer: "gitlab-pages", - ExpiresAt: time.Now().Add(gc.jwtTokenExpiry).Unix(), + ExpiresAt: time.Now().UTC().Add(gc.jwtTokenExpiry).Unix(), } token, err := jwt.NewWithClaims(jwt.SigningMethodHS256, claims).SignedString(gc.secretKey) |