forked from TrueCloudLab/frostfs-node
[#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
|
||||
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue