[#169] sdk/client: Do not resign session token

In some cases SDK Client provided with signed and prepared
session token. In this case we don't need to change verb
or sign it.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2020-10-14 20:06:05 +03:00 committed by Alex Vanin
parent d3e3889425
commit 7b3736567c
2 changed files with 16 additions and 1 deletions

View file

@ -1006,7 +1006,14 @@ func (c Client) attachV2SessionToken(opts callOptions, hdr *v2session.RequestMet
return nil
}
token := opts.session.ToV2()
// Do not resign already prepared session token
if opts.session.Signature() != nil {
hdr.SetSessionToken(opts.session.ToV2())
return nil
}
token := new(v2session.SessionToken)
token.SetBody(opts.session.ToV2().GetBody())
opCtx := new(v2session.ObjectSessionContext)
opCtx.SetAddress(info.addr)