forked from TrueCloudLab/frostfs-s3-gw
[#271] Add random key for no sign requests
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
parent
71f578a883
commit
ae87effb28
11 changed files with 133 additions and 90 deletions
|
@ -1,7 +1,6 @@
|
|||
package handler
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/ecdsa"
|
||||
"crypto/rand"
|
||||
"crypto/sha256"
|
||||
|
@ -14,7 +13,6 @@ import (
|
|||
"github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl"
|
||||
"github.com/nspcc-dev/neofs-api-go/pkg/object"
|
||||
"github.com/nspcc-dev/neofs-s3-gw/api"
|
||||
"github.com/nspcc-dev/neofs-s3-gw/creds/accessbox"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
@ -562,14 +560,6 @@ func TestParseCannedACLHeaders(t *testing.T) {
|
|||
},
|
||||
}
|
||||
|
||||
box := &accessbox.Box{
|
||||
Gate: &accessbox.GateData{
|
||||
GateKey: key.PublicKey(),
|
||||
},
|
||||
}
|
||||
ctx := context.Background()
|
||||
ctx = context.WithValue(ctx, api.BoxData, box)
|
||||
|
||||
expectedACL := &AccessControlPolicy{
|
||||
Owner: Owner{
|
||||
ID: id,
|
||||
|
@ -591,7 +581,7 @@ func TestParseCannedACLHeaders(t *testing.T) {
|
|||
}},
|
||||
}
|
||||
|
||||
actualACL, err := parseACLHeaders(req.WithContext(ctx))
|
||||
actualACL, err := parseACLHeaders(req.Header, key.PublicKey())
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, expectedACL, actualACL)
|
||||
}
|
||||
|
@ -611,14 +601,6 @@ func TestParseACLHeaders(t *testing.T) {
|
|||
},
|
||||
}
|
||||
|
||||
box := &accessbox.Box{
|
||||
Gate: &accessbox.GateData{
|
||||
GateKey: key.PublicKey(),
|
||||
},
|
||||
}
|
||||
ctx := context.Background()
|
||||
ctx = context.WithValue(ctx, api.BoxData, box)
|
||||
|
||||
expectedACL := &AccessControlPolicy{
|
||||
Owner: Owner{
|
||||
ID: id,
|
||||
|
@ -664,7 +646,7 @@ func TestParseACLHeaders(t *testing.T) {
|
|||
}},
|
||||
}
|
||||
|
||||
actualACL, err := parseACLHeaders(req.WithContext(ctx))
|
||||
actualACL, err := parseACLHeaders(req.Header, key.PublicKey())
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, expectedACL, actualACL)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue