An organization is building a new client-side dashboard application. Users must be able to sign up and log in using their corporate email addresses. Once logged in, the dashboard must call a protected REST API hosted on Amazon API Gateway and also fetch user-specific reports directly from a private Amazon S3 bucket. Which architecture should the developer implement to provide secure authentication for the REST API and direct authorization for the S3 bucket with the least operational overhead?
- Use an Amazon Cognito User Pool to authenticate users and pass the OIDC ID token to the API Gateway Cognito Authorizer, and use an Amazon Cognito Identity Pool to exchange the ID token for temporary IAM credentials that grant access to the S3 bucket.Cevap
- BUse an Amazon Cognito User Pool to manage user authentication, and configure the User Pool app client to directly return temporary IAM credentials to the client application for S3 bucket access.
- CUse an Amazon Cognito User Pool to authenticate users, configure a custom Lambda authorizer on API Gateway to validate the ID token, and use Cognito User Pool groups to authorize direct S3 bucket downloads.
- DUse an Amazon Cognito User Pool to authenticate users, and configure an IAM role with a trust policy that permits the Amazon S3 service to assume the role directly on behalf of the authenticated client.
Cevap
Use an Amazon Cognito User Pool to authenticate users and pass the OIDC ID token to the API Gateway Cognito Authorizer, and use an Amazon Cognito Identity Pool to exchange the ID token for temporary IAM credentials that grant access to the S3 bucket.
The correct architecture uses an Amazon Cognito User Pool for user authentication and directory services. The OIDC ID token returned by the User Pool is verified directly by API Gateway using the built-in Cognito Authorizer. To access private S3 resources directly from the client, the application uses an Amazon Cognito Identity Pool to exchange the ID token for temporary AWS IAM credentials, which are authorized by an IAM policy attached to the authenticated role.
Adım Adım Çözüm
Anahtar Kavram
Cognito User Pools authenticate users and issue tokens, while Cognito Identity Pools authorize users by exchanging those tokens for temporary AWS credentials.
Tahmini Süre:1m 30s