An enterprise web application needs to allow employees to sign in using their corporate Identity Provider (IdP) via SAML 2.0. Once authenticated, the application must allow users to upload files directly to a user-specific folder in an Amazon S3 bucket. The architecture must minimize operational overhead and avoid storing long-term credentials on the client. Which solution meets these requirements with the least operational overhead?
- AConfigure an Amazon Cognito User Pool integrated with the SAML IdP. Retrieve the ID token upon successful authentication and pass it directly to the Amazon S3 API headers to authorize direct client-side uploads.
- BConfigure an Amazon API Gateway endpoint with a custom Lambda Authorizer that validates the SAML assertions, creates a Cognito User Pool user on the fly, and uses the API Gateway service integration to upload files directly to S3.
- Configure an Amazon Cognito User Pool integrated with the SAML IdP, and associate it with an Amazon Cognito Identity Pool. Use the Identity Pool to map the federated users to an IAM role that grants access to the user-specific S3 folder using the cognito-identity.amazonaws.com:sub variable.Answer
- DConfigure an Amazon Cognito User Pool integrated with the SAML IdP. Set up an API Gateway endpoint backed by a Lambda function that contains hardcoded IAM access keys to upload files to the S3 bucket on behalf of the user.
Answer
Configure an Amazon Cognito User Pool integrated with the SAML IdP, and associate it with an Amazon Cognito Identity Pool. Use the Identity Pool to map the federated users to an IAM role that grants access to the user-specific S3 folder using the cognito-identity.amazonaws.com:sub variable.
The correct solution leverages Amazon Cognito User Pools to manage authentication with the corporate SAML Identity Provider, and Amazon Cognito Identity Pools to exchange the authentication tokens for temporary AWS IAM credentials. The IAM policy attached to the authenticated role uses the cognito-identity.amazonaws.com:sub policy variable to dynamically restrict access to the user's specific folder in the S3 bucket, ensuring security with minimal operational overhead.
Step-by-Step Solution
Key Concept
Amazon Cognito Identity Pools are used to federate identities and obtain temporary AWS credentials for accessing AWS resources like Amazon S3, whereas Cognito User Pools handle user directory management and authentication.
Estimated Time:2m 0s