[#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:
parent
5f47580ff7
commit
146abe8520
1 changed files with 7 additions and 3 deletions
|
@ -96,6 +96,8 @@ type sgHeadReceiver struct {
|
||||||
tok *token.SessionToken
|
tok *token.SessionToken
|
||||||
|
|
||||||
c *client.Client
|
c *client.Client
|
||||||
|
|
||||||
|
bearerToken *token.BearerToken
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *sgHeadReceiver) Head(addr *objectSDK.Address) (interface{}, error) {
|
func (c *sgHeadReceiver) Head(addr *objectSDK.Address) (interface{}, error) {
|
||||||
|
@ -105,6 +107,7 @@ func (c *sgHeadReceiver) Head(addr *objectSDK.Address) (interface{}, error) {
|
||||||
WithRawFlag(true),
|
WithRawFlag(true),
|
||||||
client.WithTTL(2),
|
client.WithTTL(2),
|
||||||
client.WithSession(c.tok),
|
client.WithSession(c.tok),
|
||||||
|
client.WithBearer(c.bearerToken),
|
||||||
)
|
)
|
||||||
|
|
||||||
var errSplitInfo *objectSDK.SplitInfoError
|
var errSplitInfo *objectSDK.SplitInfoError
|
||||||
|
@ -161,6 +164,7 @@ func putSG(cmd *cobra.Command, _ []string) error {
|
||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
tok: tok,
|
tok: tok,
|
||||||
c: cli,
|
c: cli,
|
||||||
|
bearerToken: bearerToken,
|
||||||
}, cid, members)
|
}, cid, members)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in a new issue