From: Tom Clegg Date: Fri, 1 May 2020 19:10:44 +0000 (-0400) Subject: Merge branch '16349-non-utc-timestamps' X-Git-Tag: 2.1.0~231 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/afcef9cee9922db71e268624ec658f535755aada Merge branch '16349-non-utc-timestamps' fixes #16349 Arvados-DCO-1.1-Signed-off-by: Tom Clegg --- afcef9cee9922db71e268624ec658f535755aada diff --cc lib/controller/federation.go index c0d127284c,5bdc96528b..ac239fb9b2 --- a/lib/controller/federation.go +++ b/lib/controller/federation.go @@@ -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 {