我在Angular中有一个单页应用程序,一个带有Lambda的API网关用于后端服务,Cognito用户池用于身份验证和授权。
对某些API终结点的访问取决于用户角色。您可以使用(执行API invoke for the Api Gateway资源)策略将IAM角色附加到组。
但是,在调用API之前,使用Cognito作为API Gateway的Authorizer仅检查用户是否经过了身份验证(通过在Authorization头中传递ID令牌,在成功登录后,此令牌将从Cognito用户池返回)。用户所在的组不会被用来检查它所在的组以及它所拥有的IAM权限。
有没有一个好的方法,授权我的web用
在azure活动目录文档中,它声明:
idToken:id_tokens are sent to the client application as part of an OpenID Connect flow. They can be sent along side or instead of an access token, and are used by the client to authenticate the user.
accessToken:Access tokens enable clients to securely call APIs protected by Azure