accessKeyId missing should return appropriate error in AssumeRole (#9048)

For a non-existent user server would return STS not initialized
```
aws --profile harsha --endpoint-url http://localhost:9000 \
      sts assume-role \
      --role-arn arn:xxx:xxx:xxx:xxxx \
      --role-session-name anything
```

instead return an appropriate error as expected by STS API

Additionally also format the `trace` output for STS APIs
This commit is contained in:
Harshavardhana
2020-02-27 01:56:47 +05:30
committed by GitHub
parent 2dd14c0b89
commit 1330e59307
3 changed files with 15 additions and 2 deletions
+6
View File
@@ -116,11 +116,17 @@ func checkAssumeRoleAuth(ctx context.Context, r *http.Request) (user auth.Creden
case authTypeSigned:
s3Err := isReqAuthenticated(ctx, r, globalServerRegion, serviceSTS)
if STSErrorCode(s3Err) != ErrSTSNone {
if s3Err == ErrInvalidAccessKeyID {
return user, ErrSTSInvalidAccessKey
}
return user, STSErrorCode(s3Err)
}
var owner bool
user, owner, s3Err = getReqAccessKeyV4(r, globalServerRegion, serviceSTS)
if STSErrorCode(s3Err) != ErrSTSNone {
if s3Err == ErrInvalidAccessKeyID {
return user, ErrSTSInvalidAccessKey
}
return user, STSErrorCode(s3Err)
}
// Root credentials are not allowed to use STS API