forked from TrueCloudLab/frostfs-api-go
[#283] pkg/container: Add session token and signature to Table
Extended ACL table can be set within a session, and should be signed. Add `SessionToken` / `SetSessionToken` (`Signature` / `SetSignature`) methods to carry session token (signature) in `Table` structure. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
37b415347d
commit
0719fcef59
2 changed files with 46 additions and 0 deletions
|
@ -7,6 +7,7 @@ import (
|
|||
"github.com/nspcc-dev/neofs-api-go/pkg"
|
||||
"github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl"
|
||||
"github.com/nspcc-dev/neofs-api-go/pkg/container"
|
||||
sessiontest "github.com/nspcc-dev/neofs-api-go/pkg/session/test"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
@ -91,3 +92,23 @@ func TestRecordEncoding(t *testing.T) {
|
|||
require.Equal(t, tab, r2)
|
||||
})
|
||||
}
|
||||
|
||||
func TestTable_SessionToken(t *testing.T) {
|
||||
tok := sessiontest.Generate()
|
||||
|
||||
table := eacl.NewTable()
|
||||
table.SetSessionToken(tok)
|
||||
|
||||
require.Equal(t, tok, table.SessionToken())
|
||||
}
|
||||
|
||||
func TestTable_Signature(t *testing.T) {
|
||||
sig := pkg.NewSignature()
|
||||
sig.SetKey([]byte{1, 2, 3})
|
||||
sig.SetSign([]byte{4, 5, 6})
|
||||
|
||||
table := eacl.NewTable()
|
||||
table.SetSignature(sig)
|
||||
|
||||
require.Equal(t, sig, table.Signature())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue