diff options
author | Wim <wim@42.be> | 2022-04-01 00:23:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-01 00:23:19 +0200 |
commit | c6716e030c02f316b887c1d3ee4b443aa3ab6afd (patch) | |
tree | 470461fe2d29662e7a69834ed21fce30beed65ab /vendor/github.com/minio/minio-go/v7/pkg/credentials/assume_role.go | |
parent | 4ab72acec656dafd304f88359b509b1f27c06604 (diff) | |
download | matterbridge-msglm-c6716e030c02f316b887c1d3ee4b443aa3ab6afd.tar.gz matterbridge-msglm-c6716e030c02f316b887c1d3ee4b443aa3ab6afd.tar.bz2 matterbridge-msglm-c6716e030c02f316b887c1d3ee4b443aa3ab6afd.zip |
Update dependencies (#1784)
Diffstat (limited to 'vendor/github.com/minio/minio-go/v7/pkg/credentials/assume_role.go')
-rw-r--r-- | vendor/github.com/minio/minio-go/v7/pkg/credentials/assume_role.go | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/vendor/github.com/minio/minio-go/v7/pkg/credentials/assume_role.go b/vendor/github.com/minio/minio-go/v7/pkg/credentials/assume_role.go index 3b1b547b..107a11b1 100644 --- a/vendor/github.com/minio/minio-go/v7/pkg/credentials/assume_role.go +++ b/vendor/github.com/minio/minio-go/v7/pkg/credentials/assume_role.go @@ -18,6 +18,7 @@ package credentials import ( + "bytes" "encoding/hex" "encoding/xml" "errors" @@ -184,11 +185,26 @@ func getAssumeRoleCredentials(clnt *http.Client, endpoint string, opts STSAssume } defer closeResponse(resp) if resp.StatusCode != http.StatusOK { - return AssumeRoleResponse{}, errors.New(resp.Status) + var errResp ErrorResponse + buf, err := ioutil.ReadAll(resp.Body) + if err != nil { + return AssumeRoleResponse{}, err + } + _, err = xmlDecodeAndBody(bytes.NewReader(buf), &errResp) + if err != nil { + var s3Err Error + if _, err = xmlDecodeAndBody(bytes.NewReader(buf), &s3Err); err != nil { + return AssumeRoleResponse{}, err + } + errResp.RequestID = s3Err.RequestID + errResp.STSError.Code = s3Err.Code + errResp.STSError.Message = s3Err.Message + } + return AssumeRoleResponse{}, errResp } a := AssumeRoleResponse{} - if err = xml.NewDecoder(resp.Body).Decode(&a); err != nil { + if _, err = xmlDecodeAndBody(resp.Body, &a); err != nil { return AssumeRoleResponse{}, err } return a, nil |