[ARVADOS] updated: 2.1.0-533-g32ad89ae2

Git user git at public.arvados.org
Fri Mar 26 00:40:13 UTC 2021


Summary of changes:
 lib/controller/localdb/login_testuser.go |  4 ++++
 lib/controller/localdb/logout.go         | 30 ++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+)
 create mode 100644 lib/controller/localdb/logout.go

       via  32ad89ae2fe1732b659643bda98d5ab8bc6ab744 (commit)
      from  ba183805403e62c9301e10730701d6d9f29dcbee (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 32ad89ae2fe1732b659643bda98d5ab8bc6ab744
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Thu Mar 25 21:39:40 2021 -0300

    16159: Expires token after logout (WIP)
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>

diff --git a/lib/controller/localdb/login_testuser.go b/lib/controller/localdb/login_testuser.go
index c567a0668..2c7e43bdd 100644
--- a/lib/controller/localdb/login_testuser.go
+++ b/lib/controller/localdb/login_testuser.go
@@ -22,6 +22,10 @@ type testLoginController struct {
 }
 
 func (ctrl *testLoginController) Logout(ctx context.Context, opts arvados.LogoutOptions) (arvados.LogoutResponse, error) {
+	err := ctrl.Parent.ExpireAPIClientAuthorization(ctx)
+	if err != nil {
+		return arvados.LogoutResponse{}, err
+	}
 	return noopLogout(ctrl.Cluster, opts)
 }
 
diff --git a/lib/controller/localdb/logout.go b/lib/controller/localdb/logout.go
new file mode 100644
index 000000000..600527405
--- /dev/null
+++ b/lib/controller/localdb/logout.go
@@ -0,0 +1,30 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+package localdb
+
+import (
+	"context"
+
+	"git.arvados.org/arvados.git/lib/ctrlctx"
+	"git.arvados.org/arvados.git/sdk/go/arvados"
+)
+
+func (conn *Conn) ExpireAPIClientAuthorization(ctx context.Context) error {
+	aca, err := conn.railsProxy.APIClientAuthorizationCurrent(ctx, arvados.GetOptions{})
+	if err != nil {
+		return err
+	}
+	tx, err := ctrlctx.CurrentTx(ctx)
+	if err != nil {
+		return err
+	}
+
+	err = tx.QueryRowxContext(ctx, "UPDATE api_client_authorizations SET expires_at=current_timestamp WHERE uuid=$1", aca.UUID).Err()
+	if err != nil {
+		return err
+	}
+
+	return nil
+}

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list