From 827576937c09518e2165c53c20545fadccc86985 Mon Sep 17 00:00:00 2001 From: Brett Smith Date: Fri, 19 Jul 2024 13:18:59 -0400 Subject: [PATCH] 21907: Use an APIClientAuthorization pointer directly Arvados-DCO-1.1-Signed-off-by: Brett Smith --- services/keep-web/s3.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/services/keep-web/s3.go b/services/keep-web/s3.go index 86a2fd7062..454dd8e687 100644 --- a/services/keep-web/s3.go +++ b/services/keep-web/s3.go @@ -301,9 +301,9 @@ func (h *handler) checks3signature(r *http.Request) (string, error) { cached := h.s3SecretCache[unescapedKey] h.s3SecretCacheMtx.Unlock() usedCache := cached != nil && cached.IsValidAt(time.Now()) - var aca arvados.APIClientAuthorization + var aca *arvados.APIClientAuthorization if usedCache { - aca = *cached.auth + aca = cached.auth } else { var acaAuth, acaPath string if keyIsUUID { @@ -318,7 +318,8 @@ func (h *handler) checks3signature(r *http.Request) (string, error) { Insecure: h.Cluster.TLS.Insecure, }).WithRequestID(r.Header.Get("X-Request-Id")) ctx := arvados.ContextWithAuthorization(r.Context(), "Bearer "+acaAuth) - err := client.RequestAndDecodeContext(ctx, &aca, "GET", "arvados/v1/api_client_authorizations/"+acaPath, nil, nil) + aca = new(arvados.APIClientAuthorization) + err := client.RequestAndDecodeContext(ctx, aca, "GET", "arvados/v1/api_client_authorizations/"+acaPath, nil, nil) if err != nil { ctxlog.FromContext(r.Context()).WithError(err).WithField("UUID", key).Info("token lookup failed") return "", errors.New("invalid access key") @@ -341,7 +342,7 @@ func (h *handler) checks3signature(r *http.Request) (string, error) { return "", fmt.Errorf("signature does not match (scope %q signedHeaders %q stringToSign %q)", scope, signedHeaders, stringToSign) } if !usedCache { - h.updateS3SecretCache(&aca, unescapedKey) + h.updateS3SecretCache(aca, unescapedKey) } return aca.TokenV2(), nil } -- 2.30.2