1 Answer
- Newest
- Most votes
- Most comments
0
Hi,
the secret has been unveiled. To connect as an anonymous user to a cognito identity pool you need these few lines of code:
AmazonCognitoIdentity client=AmazonCognitoIdentityClientBuilder
.standard()
.withRegion(Regions.EU_CENTRAL_1)
.withCredentials(new AWSStaticCredentialsProvider(new AnonymousAWSCredentials()))
.build();
Map<String,String> logins = new HashMap<String,String>();
logins.put("arn:aws:iam::1234567890:saml-provider/my-saml-provider", "A base64 SAML response");
GetIdRequest request = new GetIdRequest()
.withIdentityPoolId("eu-central-1:7xxxxx-cxxx-xxxx-xxx-xxxxx")
.withLogins(logins);
GetIdResult result= client.getId(request);
In the logins map you have to put the arn of the SAML provider you created in IAM using the SAML Metadata.
Edited by: drdimitri on Dec 9, 2019 1:50 AM
Edited by: drdimitri on Dec 10, 2019 5:01 AM
answered 4 years ago
Relevant content
- asked a year ago
- asked 2 years ago
- AWS OFFICIALUpdated 8 months ago
- AWS OFFICIALUpdated 6 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 3 years ago