Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions acl/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ func (bt *BearerTokenBody) ToGRPCMessage() grpc.Message {
m.SetOwnerId(bt.ownerID.ToGRPCMessage().(*refsGRPC.OwnerID))
m.SetLifetime(bt.lifetime.ToGRPCMessage().(*acl.BearerToken_Body_TokenLifetime))
m.SetEaclTable(bt.eacl.ToGRPCMessage().(*acl.EACLTable))
m.SetImpersonate(bt.impersonate)
}

return m
Expand Down Expand Up @@ -479,6 +480,8 @@ func (bt *BearerTokenBody) FromGRPCMessage(m grpc.Message) error {
err = bt.eacl.FromGRPCMessage(eacl)
}

bt.impersonate = v.GetAllowImpersonate()

return err
}

Expand Down
5 changes: 5 additions & 0 deletions acl/grpc/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ func (m *BearerToken_Body) SetLifetime(v *BearerToken_Body_TokenLifetime) {
m.Lifetime = v
}

// SetImpersonate allows impersonate.
func (m *BearerToken_Body) SetImpersonate(v bool) {
m.AllowImpersonate = v
}

// SetBody sets bearer token body.
func (m *BearerToken) SetBody(v *BearerToken_Body) {
m.Body = v
Expand Down
92 changes: 52 additions & 40 deletions acl/grpc/types.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion acl/marshal.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const (
bearerTokenBodyACLField = 1
bearerTokenBodyOwnerField = 2
bearerTokenBodyLifetimeField = 3
bearerTokenBodyImpersonate = 4

bearerTokenBodyField = 1
bearerTokenSignatureField = 2
Expand Down Expand Up @@ -251,7 +252,8 @@ func (bt *BearerTokenBody) StableMarshal(buf []byte) []byte {

offset += protoutil.NestedStructureMarshal(bearerTokenBodyACLField, buf[offset:], bt.eacl)
offset += protoutil.NestedStructureMarshal(bearerTokenBodyOwnerField, buf[offset:], bt.ownerID)
protoutil.NestedStructureMarshal(bearerTokenBodyLifetimeField, buf[offset:], bt.lifetime)
offset += protoutil.NestedStructureMarshal(bearerTokenBodyLifetimeField, buf[offset:], bt.lifetime)
protoutil.BoolMarshal(bearerTokenBodyImpersonate, buf[offset:], bt.impersonate)

return buf
}
Expand All @@ -264,6 +266,7 @@ func (bt *BearerTokenBody) StableSize() (size int) {
size += protoutil.NestedStructureSize(bearerTokenBodyACLField, bt.eacl)
size += protoutil.NestedStructureSize(bearerTokenBodyOwnerField, bt.ownerID)
size += protoutil.NestedStructureSize(bearerTokenBodyLifetimeField, bt.lifetime)
size += protoutil.BoolSize(bearerTokenBodyImpersonate, bt.impersonate)

return size
}
Expand Down
14 changes: 14 additions & 0 deletions acl/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ type BearerTokenBody struct {
ownerID *refs.OwnerID

lifetime *TokenLifetime

impersonate bool
}

type BearerToken struct {
Expand Down Expand Up @@ -340,6 +342,18 @@ func (bt *BearerTokenBody) SetLifetime(v *TokenLifetime) {
bt.lifetime = v
}

func (bt *BearerTokenBody) GetImpersonate() bool {
if bt != nil {
return bt.impersonate
}

return false
}

func (bt *BearerTokenBody) SetImpersonate(v bool) {
bt.impersonate = v
}

func (bt *BearerToken) GetBody() *BearerTokenBody {
if bt != nil {
return bt.body
Expand Down