X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/2c5417221843491727e4e5505012fc115e3bc7b0..27ab60e21b3cf9c908716ae74e63aba8e4cb6349:/lib/controller/federation.go?ds=sidebyside diff --git a/lib/controller/federation.go b/lib/controller/federation.go index aceaba8087..cab5e4c4ca 100644 --- a/lib/controller/federation.go +++ b/lib/controller/federation.go @@ -263,17 +263,20 @@ func (h *Handler) saltAuthToken(req *http.Request, remote string) (updatedReq *h return updatedReq, nil } + ctxlog.FromContext(req.Context()).Infof("saltAuthToken: cluster %s token %s remote %s", h.Cluster.ClusterID, creds.Tokens[0], remote) token, err := auth.SaltToken(creds.Tokens[0], remote) if err == auth.ErrObsoleteToken { - // If the token exists in our own database, salt it - // for the remote. Otherwise, assume it was issued by - // the remote, and pass it through unmodified. + // If the token exists in our own database for our own + // user, salt it for the remote. Otherwise, assume it + // was issued by the remote, and pass it through + // unmodified. currentUser, ok, err := h.validateAPItoken(req, creds.Tokens[0]) if err != nil { return nil, err - } else if !ok { - // Not ours; pass through unmodified. + } else if !ok || strings.HasPrefix(currentUser.UUID, remote) { + // Unknown, or cached + belongs to remote; + // pass through unmodified. token = creds.Tokens[0] } else { // Found; make V2 version and salt it.