[ARVADOS] updated: 2.1.0-538-g94b3b18d0
Git user
git at public.arvados.org
Mon Mar 29 19:13:56 UTC 2021
Summary of changes:
apps/workbench/Gemfile.lock | 3 ++-
apps/workbench/fpm-info.sh | 4 ++--
lib/controller/localdb/login_testuser.go | 2 +-
lib/controller/localdb/logout.go | 34 ++++++++++++++++++++++++++++----
services/api/Gemfile.lock | 3 ++-
services/api/fpm-info.sh | 4 ++--
6 files changed, 39 insertions(+), 11 deletions(-)
via 94b3b18d028468440d793c2f78da61acc0ba4270 (commit)
via 04e3a638919ab92cc28660ca959bc2efa58bf257 (commit)
via cad10c18434b516c843968083894065c78fc2c72 (commit)
via 90622862eec98922c1357a3f9df1c1f2c4e21b6b (commit)
via 356eda5b8d198e1a40dd81aca099ede4c3ad1e72 (commit)
from 32ad89ae2fe1732b659643bda98d5ab8bc6ab744 (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 94b3b18d028468440d793c2f78da61acc0ba4270
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date: Mon Mar 29 16:12:05 2021 -0300
16159: Attempts to expire the user's token getting it from the context. (WIP)
To avoid making a request to railsAPI, the user's token is retrieved from the
context.
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>
diff --git a/lib/controller/localdb/logout.go b/lib/controller/localdb/logout.go
index 600527405..417fdc066 100644
--- a/lib/controller/localdb/logout.go
+++ b/lib/controller/localdb/logout.go
@@ -6,25 +6,51 @@ package localdb
import (
"context"
+ "errors"
+ "fmt"
+ "strings"
"git.arvados.org/arvados.git/lib/ctrlctx"
- "git.arvados.org/arvados.git/sdk/go/arvados"
+ "git.arvados.org/arvados.git/sdk/go/auth"
)
func (conn *Conn) ExpireAPIClientAuthorization(ctx context.Context) error {
- aca, err := conn.railsProxy.APIClientAuthorizationCurrent(ctx, arvados.GetOptions{})
+ creds, ok := auth.FromContext(ctx)
+
+ if !ok {
+ return errors.New("credentials not found from context")
+ }
+
+ if len(creds.Tokens) < 1 {
+ return errors.New("no tokens found to expire")
+ }
+
+ token := creds.Tokens[0]
+ tokensecret := token
+ if strings.Contains(token, "/") {
+ tokenparts := strings.Split(token, "/")
+ if len(tokenparts) >= 3 {
+ tokensecret = tokenparts[2]
+ }
+ }
+
+ tx, err := ctrlctx.CurrentTx(ctx)
if err != nil {
return err
}
- tx, err := ctrlctx.CurrentTx(ctx)
+
+ res, err := tx.ExecContext(ctx, "UPDATE api_client_authorizations SET expires_at=current_timestamp WHERE api_token=$1", tokensecret)
if err != nil {
return err
}
- err = tx.QueryRowxContext(ctx, "UPDATE api_client_authorizations SET expires_at=current_timestamp WHERE uuid=$1", aca.UUID).Err()
+ rows, err := res.RowsAffected()
if err != nil {
return err
}
+ if rows != 1 {
+ return fmt.Errorf("token expiration affected rows: %d - token: %s", rows, token)
+ }
return nil
}
commit 04e3a638919ab92cc28660ca959bc2efa58bf257
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date: Mon Mar 29 16:11:33 2021 -0300
16159: Makes test login form to autofocus on username field.
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 2c7e43bdd..2e99034b6 100644
--- a/lib/controller/localdb/login_testuser.go
+++ b/lib/controller/localdb/login_testuser.go
@@ -94,7 +94,7 @@ const loginform = `
<h3>Arvados test login</h3>
<form method="POST">
<input id="return_to" type="hidden" name="return_to" value="{{.ReturnTo}}">
- username <input id="username" type="text" name="username" size=16>
+ username <input id="username" type="text" name="username" autofocus size=16>
password <input id="password" type="password" name="password" size=16>
<input type="submit" value="Log in">
<br>
commit cad10c18434b516c843968083894065c78fc2c72
Merge: 32ad89ae2 90622862e
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date: Fri Mar 26 11:12:55 2021 -0300
Merge branch 'master' into 16159-token-expiration-on-logout
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list