[ARVADOS] updated: 2.1.0-253-g33a1353e6

Git user git at public.arvados.org
Mon Jan 11 19:02:00 UTC 2021


Summary of changes:
 lib/controller/localdb/login.go | 19 +++++++++++++++++--
 lib/controller/rpc/conn.go      | 13 +++++++------
 2 files changed, 24 insertions(+), 8 deletions(-)

       via  33a1353e611685b4e22a91ed652fe7d2a6d19feb (commit)
      from  3203d60cc00cdd004ab717e8cc1898e5c9af75b8 (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 33a1353e611685b4e22a91ed652fe7d2a6d19feb
Author: Nico Cesar <nico at nicocesar.com>
Date:   Mon Jan 11 14:00:55 2021 -0500

    added expires_at for user login
    
    Arvados-DCO-1.1-Signed-off-by: Nico Cesar <nico at curii.com>

diff --git a/lib/controller/localdb/login.go b/lib/controller/localdb/login.go
index 4bf515fc3..18275bc02 100644
--- a/lib/controller/localdb/login.go
+++ b/lib/controller/localdb/login.go
@@ -13,6 +13,7 @@ import (
 	"net/http"
 	"net/url"
 	"strings"
+	"time"
 
 	"git.arvados.org/arvados.git/lib/controller/rpc"
 	"git.arvados.org/arvados.git/lib/ctrlctx"
@@ -172,13 +173,27 @@ func (conn *Conn) CreateAPIClientAuthorization(ctx context.Context, rootToken st
 			tokensecret = tokenparts[2]
 		}
 	}
-	var exp sql.NullString
+	var exp sql.NullTime
+
+	err = exp.Scan(authinfo.ExpiresAt)
+	if err != nil {
+		return
+	}
+	// if
+	if exp.Time.Equal(time.Time{}) {
+		exp = sql.NullTime{}
+	}
 	var scopes []byte
 	err = tx.QueryRowxContext(ctx, "select uuid, api_token, expires_at, scopes from api_client_authorizations where api_token=$1", tokensecret).Scan(&resp.UUID, &resp.APIToken, &exp, &scopes)
 	if err != nil {
 		return
 	}
-	resp.ExpiresAt = exp.String
+
+	if exp.Time.Equal(time.Time{}) {
+		resp.ExpiresAt = ""
+	} else {
+		resp.ExpiresAt = exp.Time.UTC().Format(time.RFC3339Nano)
+	}
 	if len(scopes) > 0 {
 		err = json.Unmarshal(scopes, &resp.Scopes)
 		if err != nil {
diff --git a/lib/controller/rpc/conn.go b/lib/controller/rpc/conn.go
index 5ffa66801..b0935bd33 100644
--- a/lib/controller/rpc/conn.go
+++ b/lib/controller/rpc/conn.go
@@ -437,12 +437,13 @@ func (conn *Conn) APIClientAuthorizationCurrent(ctx context.Context, options arv
 }
 
 type UserSessionAuthInfo struct {
-	UserUUID        string   `json:"user_uuid"`
-	Email           string   `json:"email"`
-	AlternateEmails []string `json:"alternate_emails"`
-	FirstName       string   `json:"first_name"`
-	LastName        string   `json:"last_name"`
-	Username        string   `json:"username"`
+	UserUUID        string    `json:"user_uuid"`
+	Email           string    `json:"email"`
+	AlternateEmails []string  `json:"alternate_emails"`
+	FirstName       string    `json:"first_name"`
+	LastName        string    `json:"last_name"`
+	Username        string    `json:"username"`
+	ExpiresAt       time.Time `json:"expires_at"`
 }
 
 type UserSessionCreateOptions struct {

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list