意外的例外访问:用户:ARN:AWS:IAM :: 123456789:无权执行用户/ABC:STS:asherole资源:arn:aws:aws:chime:chime

发布于 2025-01-23 03:24:39 字数 2407 浏览 3 评论 0原文

我必须使用AWS STS生成一个联合令牌,用于认证池中认证的Cognito用户。问题在于,当我按照AWS-DOC的文档运行代码时,它会将我返回此错误:

意外的异常访问:用户:ARN:AWS:IAM :: 123456789:无权执行USER/ABC :sts:资源上的假设:ARN:aws:chime:us-east-1:123456789:app-instance/xxx/user/yyy

我过去1周都在尝试解决此问题,并且几乎已经搜索了互联网上的一切。

我已经尝试了其中一些解决方案,但仍然没有运气:

  1. https://www.hava.io/blog/what-is-aws-security-token-service-service-service-sts#: text = text = aws%20Sts%20Security%20Tokens%20Tokens%20ARE,REQUIRE%20ACCCESS 20ACCESSBY20BY20BY20BY %20 hother%20Applications

  2. aws asherole-aws asherole-use supserized supser as user supsive-user是授权的执行:STS:资源上的假设

这是我的信任关系IAM角色JSON文件:

{
"Version": "2012-10-17",
"Statement": [
    {
        "Sid": "Statement0",
        "Effect": "Allow",
        "Principal": {
            "AWS": "arn:aws:iam::123456789:user/abc"
        },
        "Action": "sts:AssumeRole"
    },
    {
        "Sid": "Statement1",
        "Effect": "Allow",
        "Principal": {
            "Service": "lambda.amazonaws.com"
        },
        "Action": "sts:AssumeRole"
    },
    {
        "Sid": "Statement2",
        "Effect": "Allow",
        "Principal": {
            "Service": "chime.amazonaws.com"
        },
        "Action": "sts:AssumeRole"
    }
 ]
}

这是我对IAM角色的内联挑战:

    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": [
                "sts:GetSessionToken",
                "sts:AssumeRole",
                "sts:TagSession",
                "sts:GetFederationToken",
                "sts:SetSourceIdentity",
                "sts:DecodeAuthorizationMessage",
                "sts:AssumeRoleWithSAML",
                "sts:GetAccessKeyInfo",
                "sts:GetCallerIdentity",
                "sts:AssumeRoleWithWebIdentity",
                "sts:GetServiceBearerToken"
            ],
            "Resource": "*"
        }
    ]
}

I have to generate a federated token using AWS STS for an authenticated Cognito User in the Cognito Pool. The problem is that when I run the code by following the documentation of aws-docs it returns me with this error:

unexpected exception AccessDenied: User: arn:aws:iam::123456789:user/abc is not authorized to perform: sts:AssumeRole on resource: arn:aws:chime:us-east-1:123456789:app-instance/xxx/user/yyy

I am trying for the past 1 week to solve this problem and have searched almost everything on the internet.

I have already tried some of these solutions but still no luck:

  1. https://www.hava.io/blog/what-is-aws-security-token-service-sts#:~:text=AWS%20STS%20security%20tokens%20are,require%20access%20by%20other%20applications.&text=Using%20AWS%20STS%20you%20can,authenticated%20at%20your%20enterprise%20network.

  2. AWS AssumeRole - User is not authorized to perform: sts:AssumeRole on resource

Here's my trust relationship IAM Role JSON file:

{
"Version": "2012-10-17",
"Statement": [
    {
        "Sid": "Statement0",
        "Effect": "Allow",
        "Principal": {
            "AWS": "arn:aws:iam::123456789:user/abc"
        },
        "Action": "sts:AssumeRole"
    },
    {
        "Sid": "Statement1",
        "Effect": "Allow",
        "Principal": {
            "Service": "lambda.amazonaws.com"
        },
        "Action": "sts:AssumeRole"
    },
    {
        "Sid": "Statement2",
        "Effect": "Allow",
        "Principal": {
            "Service": "chime.amazonaws.com"
        },
        "Action": "sts:AssumeRole"
    }
 ]
}

And here is my inline-policy of IAM Role:

    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": [
                "sts:GetSessionToken",
                "sts:AssumeRole",
                "sts:TagSession",
                "sts:GetFederationToken",
                "sts:SetSourceIdentity",
                "sts:DecodeAuthorizationMessage",
                "sts:AssumeRoleWithSAML",
                "sts:GetAccessKeyInfo",
                "sts:GetCallerIdentity",
                "sts:AssumeRoleWithWebIdentity",
                "sts:GetServiceBearerToken"
            ],
            "Resource": "*"
        }
    ]
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文