From 9e27263df354d154537a7a84c8927c0ce9aacafa Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 18 Dec 2020 14:54:54 +0300 Subject: [PATCH] [#253] object/put: Fix loss of session token Signed-off-by: Leonard Lyubich --- pkg/services/object/put/remote.go | 1 + pkg/services/object/put/streamer.go | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/services/object/put/remote.go b/pkg/services/object/put/remote.go index ab57ce67..eadbb299 100644 --- a/pkg/services/object/put/remote.go +++ b/pkg/services/object/put/remote.go @@ -78,6 +78,7 @@ func (t *remoteTarget) Close() (*transformer.AccessIdentifiers, error) { ), client.WithTTL(1), // FIXME: use constant client.WithBearer(t.bearer), + client.WithSession(t.token), ) if err != nil { return nil, errors.Wrapf(err, "(%T) could not put object to %s", t, addr) diff --git a/pkg/services/object/put/streamer.go b/pkg/services/object/put/streamer.go index d8af8300..f9142106 100644 --- a/pkg/services/object/put/streamer.go +++ b/pkg/services/object/put/streamer.go @@ -46,9 +46,7 @@ func (p *Streamer) initTarget(prm *PutInitPrm) error { return errors.Wrapf(err, "(%T) could not prepare put parameters", p) } - sToken := prm.common.SessionToken() - - if sToken == nil { + if prm.hdr.Signature() != nil { // prepare untrusted-Put object target p.target = &validatingTarget{ nextTarget: p.newCommonTarget(prm), @@ -58,6 +56,8 @@ func (p *Streamer) initTarget(prm *PutInitPrm) error { return nil } + sToken := prm.common.SessionToken() + // prepare trusted-Put object target // get private token from local storage