[#1423] session: Get session issuer from token structure

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2022-05-25 19:09:12 +03:00 committed by LeL
parent 2dec3a0a93
commit 2bcc0051ab
9 changed files with 24 additions and 64 deletions

View file

@ -243,18 +243,20 @@ func (exec *execCtx) initTombstoneObject() bool {
return false
}
tombOwnerID, ok := exec.commonParameters().SessionOwner()
if !ok {
// make local node a tombstone object owner
tombOwnerID = *exec.svc.netInfo.LocalNodeID()
}
exec.tombstoneObj = object.New()
exec.tombstoneObj.SetContainerID(*exec.containerID())
exec.tombstoneObj.SetOwnerID(&tombOwnerID)
exec.tombstoneObj.SetType(object.TypeTombstone)
exec.tombstoneObj.SetPayload(payload)
tokenSession := exec.commonParameters().SessionToken()
if tokenSession != nil {
issuer := tokenSession.Issuer()
exec.tombstoneObj.SetOwnerID(&issuer)
} else {
// make local node a tombstone object owner
exec.tombstoneObj.SetOwnerID(exec.svc.netInfo.LocalNodeID())
}
var a object.Attribute
a.SetKey(objectV2.SysAttributeExpEpoch)
a.SetValue(strconv.FormatUint(exec.tombstone.ExpirationEpoch(), 10))