Add rotating token support for admin API (#9244)

Use the *credentials.Credentials implementation method *Get*

```
func (c *Credentials) Get() (Value, error) {
```

which also handles auto-refresh, this allows for chaining
of various implementations together if necessary or simply
initialize with credentials.NewStaticV4(access, secret, token)

Co-authored-by: Klaus Post <klauspost@gmail.com>
This commit is contained in:
Harshavardhana
2020-04-01 13:34:20 -07:00
committed by GitHub
parent 336460f67e
commit 7de29e6e6b
7 changed files with 93 additions and 49 deletions

View File

@@ -39,7 +39,7 @@ func (adm *AdminClient) GetConfig(ctx context.Context) ([]byte, error) {
return nil, httpRespToErrorResponse(resp)
}
return DecryptData(adm.secretAccessKey, resp.Body)
return DecryptData(adm.getSecretKey(), resp.Body)
}
// SetConfig - set config supplied as config.json for the setup.
@@ -56,7 +56,7 @@ func (adm *AdminClient) SetConfig(ctx context.Context, config io.Reader) (err er
return err
}
configBytes := configBuf[:n]
econfigBytes, err := EncryptData(adm.secretAccessKey, configBytes)
econfigBytes, err := EncryptData(adm.getSecretKey(), configBytes)
if err != nil {
return err
}