[ARVADOS] updated: 2.1.0-259-ge25d440d6
Git user
git at public.arvados.org
Thu Jan 14 16:10:07 UTC 2021
Summary of changes:
lib/config/config.default.yml | 2 +-
lib/controller/rpc/conn.go | 46 ++++++++++++++++++++++++++++++++++++++++---
2 files changed, 44 insertions(+), 4 deletions(-)
via e25d440d6d37538438c504f45ad194f9dc7913de (commit)
from f5df3852a472d3c75cdcff394f0fa45423c05388 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit e25d440d6d37538438c504f45ad194f9dc7913de
Author: Nico Cesar <nico at nicocesar.com>
Date: Thu Jan 14 11:09:19 2021 -0500
*_at fields won't be sent if IsZero()
Arvados-DCO-1.1-Signed-off-by: Nico Cesar <nico at curii.com>
diff --git a/lib/config/config.default.yml b/lib/config/config.default.yml
index e609c08e5..2aa53a432 100644
--- a/lib/config/config.default.yml
+++ b/lib/config/config.default.yml
@@ -722,7 +722,7 @@ Clusters:
# How long a client token created from a login flow will be valid without
# asking the user to re-login. Example values: 60m, 8h.
# Default value zero means tokens don't have expiration.
- TokenLifetime: 1h
+ TokenLifetime: 0s
# When the token is returned to a client, the token itself may
# be restricted from manipulating other tokens based on whether
diff --git a/lib/controller/rpc/conn.go b/lib/controller/rpc/conn.go
index 15274cb78..e9c3bb264 100644
--- a/lib/controller/rpc/conn.go
+++ b/lib/controller/rpc/conn.go
@@ -23,6 +23,8 @@ import (
"git.arvados.org/arvados.git/sdk/go/auth"
)
+const rfc3339NanoFixed = "2006-01-02T15:04:05.000000000Z07:00"
+
type TokenProvider func(context.Context) ([]string, error)
func PassthroughTokenProvider(ctx context.Context) ([]string, error) {
@@ -120,6 +122,47 @@ func (conn *Conn) requestAndDecode(ctx context.Context, dst interface{}, ep arva
delete(params, "limit")
}
}
+
+ if authinfo, ok := params["auth_info"]; ok {
+ if tmp, ok2 := authinfo.(map[string]interface{}); ok2 {
+ for k, v := range tmp {
+ if strings.HasSuffix(k, "_at") {
+ // Format non-nil timestamps as
+ // rfc3339NanoFixed (otherwise they would use
+ // the default time encoding, which omits
+ // trailing zeroes).
+ switch tv := v.(type) {
+ case *time.Time:
+ if tv == nil || tv.IsZero() {
+ tmp[k] = nil
+ } else {
+ tmp[k] = tv.Format(rfc3339NanoFixed)
+ }
+ case time.Time:
+ if tv.IsZero() {
+ tmp[k] = nil
+ } else {
+ tmp[k] = tv.Format(rfc3339NanoFixed)
+ }
+ case string:
+ if tv == "" {
+ tmp[k] = nil
+ } else if strings.HasPrefix(tv, "0001-01-01T00:00:00Z") {
+ tmp[k] = nil
+ } else if t, err := time.Parse(time.RFC3339Nano, tv); err != nil {
+ // pass through an invalid time value (?)
+ } else if t.IsZero() {
+ tmp[k] = nil
+ } else {
+ tmp[k] = t.Format(rfc3339NanoFixed)
+ }
+ }
+
+ }
+ }
+ }
+ }
+
if len(tokens) > 1 {
params["reader_tokens"] = tokens[1:]
}
@@ -454,9 +497,6 @@ type UserSessionCreateOptions struct {
func (conn *Conn) UserSessionCreate(ctx context.Context, options UserSessionCreateOptions) (arvados.LoginResponse, error) {
ep := arvados.APIEndpoint{Method: "POST", Path: "auth/controller/callback"}
// if ExpiresAt is empty value then add 2 hour expiration
- if options.AuthInfo.ExpiresAt.IsZero() {
- options.AuthInfo.ExpiresAt = time.Now().UTC().Add(2 * time.Hour)
- }
var resp arvados.LoginResponse
err := conn.requestAndDecode(ctx, &resp, ep, nil, options)
return resp, err
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list