[#150] sdk/token: Add owner ID

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-09-17 18:04:04 +03:00 committed by Stanislav Bogatyrev
parent 73220620c5
commit 0259a06783
4 changed files with 104 additions and 34 deletions

View file

@ -1034,6 +1034,8 @@ func (c Client) attachV2SessionToken(opts callOptions, hdr *v2session.RequestMet
return nil
}
token := opts.session.ToV2()
opCtx := new(v2session.ObjectSessionContext)
opCtx.SetAddress(info.addr)
opCtx.SetVerb(info.verb)
@ -1043,15 +1045,11 @@ func (c Client) attachV2SessionToken(opts callOptions, hdr *v2session.RequestMet
lt.SetNbf(info.nbf)
lt.SetExp(info.exp)
body := new(v2session.SessionTokenBody)
body.SetID(opts.session.ID())
body := token.GetBody()
body.SetSessionKey(opts.session.SessionKey())
body.SetContext(opCtx)
body.SetLifetime(lt)
token := new(v2session.SessionToken)
token.SetBody(body)
signWrapper := signature.StableMarshalerWrapper{SM: token.GetBody()}
err := signer.SignDataWithHandler(c.key, signWrapper, func(key []byte, sig []byte) {
sessionTokenSignature := new(v2refs.Signature)