我正在尝试使用 STS 删除对临时生成的会话令牌的访问权限。
但收到以下错误:
线程“main”com.amazonaws.services.securitytoken.model.MalformedPolicyDocumentException 中的异常:策略文档不应指定主体。(服务:AWSSecurityTokenService;状态代码:400;错误代码:MalformedPolicyDocument;请求 ID:c563c2c1-62a8-478e-98a3-f6153ee8df03;代理:null)
AssumeRoleRequest roleRequest =
new AssumeRoleRequest()
.withRoleArn(ROLE_ARN)
.withTags(tags)
.withRoleSessionName(ROLE_SESSION_NAME);
roleRequest.setDurationSeconds(60 * 15);
roleRequest.withPolicy(**INVALIDATE_POLICY**);
AssumeRoleResult roleResponse = stsClient.assumeRole(roleRequest);
基于文档生成的策略:
{
"Version": "2012-10-17",
"Statement": {
"Principal": {
"AWS": "arn:aws:sts::ACCOUNT-ID-WITHOUT-HYPHENS:assumed-Role/Mary"
},
"Effect": "Deny",
"Action": "s3:*",
"Resource": "arn:aws:s3:::EXAMPLE-BUCKET"
}
}