[#388] cmd/cli: Use bearer token when collecting storage group members

CLI `storagegroup put` cmd collects information about SG members via NeoFS
API ObjectService.Head RPC in order to compose SG structure. Bearer token
attached to the call was not used in communication, which could lead to data
access problems. These changes fix the described problem.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-02-19 13:32:22 +03:00 committed by Alex Vanin
parent 5f47580ff7
commit 146abe8520

View file

@ -96,6 +96,8 @@ type sgHeadReceiver struct {
tok *token.SessionToken
c *client.Client
bearerToken *token.BearerToken
}
func (c *sgHeadReceiver) Head(addr *objectSDK.Address) (interface{}, error) {
@ -105,6 +107,7 @@ func (c *sgHeadReceiver) Head(addr *objectSDK.Address) (interface{}, error) {
WithRawFlag(true),
client.WithTTL(2),
client.WithSession(c.tok),
client.WithBearer(c.bearerToken),
)
var errSplitInfo *objectSDK.SplitInfoError
@ -161,6 +164,7 @@ func putSG(cmd *cobra.Command, _ []string) error {
ctx: ctx,
tok: tok,
c: cli,
bearerToken: bearerToken,
}, cid, members)
if err != nil {
return err