Merge branch '16349-non-utc-timestamps'
authorTom Clegg <tom@tomclegg.ca>
Fri, 1 May 2020 19:10:44 +0000 (15:10 -0400)
committerTom Clegg <tom@tomclegg.ca>
Fri, 1 May 2020 19:10:44 +0000 (15:10 -0400)
fixes #16349

Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@tomclegg.ca>

1  2 
lib/controller/federation.go

index c0d127284ce35a21d5618814dd2792984809f5f2,5bdc96528b5419c7b4e9c11d708cf133da66e2ea..ac239fb9b23f5c4c106034e2a910fb441b9c2218
@@@ -166,12 -164,10 +166,12 @@@ func (h *Handler) validateAPItoken(req 
        }
        user.Authorization.APIToken = token
        var scopes string
-       err = db.QueryRowContext(req.Context(), `SELECT api_client_authorizations.uuid, api_client_authorizations.scopes, users.uuid FROM api_client_authorizations JOIN users on api_client_authorizations.user_id=users.id WHERE api_token=$1 AND (expires_at IS NULL OR expires_at > current_timestamp) LIMIT 1`, token).Scan(&user.Authorization.UUID, &scopes, &user.UUID)
+       err = db.QueryRowContext(req.Context(), `SELECT api_client_authorizations.uuid, api_client_authorizations.scopes, users.uuid FROM api_client_authorizations JOIN users on api_client_authorizations.user_id=users.id WHERE api_token=$1 AND (expires_at IS NULL OR expires_at > current_timestamp AT TIME ZONE 'UTC') LIMIT 1`, token).Scan(&user.Authorization.UUID, &scopes, &user.UUID)
        if err == sql.ErrNoRows {
 +              ctxlog.FromContext(req.Context()).Debugf("validateAPItoken(%s): not found in database", token)
                return nil, false, nil
        } else if err != nil {
 +              ctxlog.FromContext(req.Context()).WithError(err).Debugf("validateAPItoken(%s): database error", token)
                return nil, false, err
        }
        if uuid != "" && user.Authorization.UUID != uuid {