[#253] object/put: Fix loss of session token

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-12-18 14:54:54 +03:00 committed by Leonard Lyubich
parent 8e661d5c37
commit 9e27263df3
2 changed files with 4 additions and 3 deletions

View file

@ -78,6 +78,7 @@ func (t *remoteTarget) Close() (*transformer.AccessIdentifiers, error) {
), ),
client.WithTTL(1), // FIXME: use constant client.WithTTL(1), // FIXME: use constant
client.WithBearer(t.bearer), client.WithBearer(t.bearer),
client.WithSession(t.token),
) )
if err != nil { if err != nil {
return nil, errors.Wrapf(err, "(%T) could not put object to %s", t, addr) return nil, errors.Wrapf(err, "(%T) could not put object to %s", t, addr)

View file

@ -46,9 +46,7 @@ func (p *Streamer) initTarget(prm *PutInitPrm) error {
return errors.Wrapf(err, "(%T) could not prepare put parameters", p) return errors.Wrapf(err, "(%T) could not prepare put parameters", p)
} }
sToken := prm.common.SessionToken() if prm.hdr.Signature() != nil {
if sToken == nil {
// prepare untrusted-Put object target // prepare untrusted-Put object target
p.target = &validatingTarget{ p.target = &validatingTarget{
nextTarget: p.newCommonTarget(prm), nextTarget: p.newCommonTarget(prm),
@ -58,6 +56,8 @@ func (p *Streamer) initTarget(prm *PutInitPrm) error {
return nil return nil
} }
sToken := prm.common.SessionToken()
// prepare trusted-Put object target // prepare trusted-Put object target
// get private token from local storage // get private token from local storage