How to set up Okta as SAML IDP in AWS Cognito User Pool?
Asked Answered
B

2

7

I will want to use Okta as SAML 2.0 based IDP, AWS Cognito as service provider, and Cognito user pool to have federated IDP configuration.

I have followed all the steps mentioned in AWS sites listed below -

Okta does not provide any support or documentation - https://support.okta.com/help/answers?id=9062A000000QucAQAS&feedtype=SINGLE_QUESTION_DETAIL&dc=xSAML&criteria=OPENQUESTIONS& .

Please note that I have tried Okta as IDP, established trust with AWS IAM, and using Okta user logs in to my AWS account. This works fine following the detailed documentation provided by Okta. However, my need is different wherein I would like to use Okta as SAML IDP in my AWS cognito user pool.

Any detailed documentation containing configurations to be done at both ends i.e. AWS and Okta, will be helpful.

Bolen answered 26/1, 2018 at 12:17 Comment(1)
Should be pretty easy. Following the 3rd link - the AWS Blog should work. I used it to set up ADFS & Microsoft Azure AD as my IdP in Userpool. Worked for me. Can you mention how you set up the relying party in Okta (step 3 of blog)? The Cognito part is pretty easy - give a name & a URL and map attributes. That's it! Also, mention what errors or warnings did you getNiemeyer
S
7

I did setup Okta with Cognito through SAML with the following:

Okta side:

  • Single sign on URL will be your cognito SAML endpoint in the form of: https://<yourDomainPrefix>.auth.<region>.amazoncognito.com/saml2/idpresponse (see under your user pool, "App integration" -> "Domain name" for the first part of the URL).
  • Audience URI (SP Entity ID) will be the URN of your cognito user pool: urn:amazon:cognito:sp:<yourUserPoolID> (see your user pool "General Settings" for that pool ID).
  • Attribute statements, you want to add whatever attribute you set as mandatory in your pool, in my case it was email.

Cognito side - User pool:

  • Federation -> Identity providers: Choose SAML and import the metadata.xml from Okta.
  • get to your App client settings, under App integration and enable the newly created IDP

Cognito side - Identity pool:

  • Under authentication providers, SAML tab, you'll be able to check the Okta provider checkbox as you mentioned that you already have it as a trusted provider under IAM.

That should be about it. Resources that were of help: https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-saml-idp.html

EDIT: It seems that clarification was required on the Audience URI/Audience Restriction Okta setting. As Julien below mentioned is in the form of urn:amazon:cognito:sp:region_randomid (ie. urn:amazon:cognito:sp:eu-west-1_SdsSdwSD3e), you don't need to add yourself the region.

Shawanda answered 29/6, 2018 at 7:35 Comment(1)
Amazon now has a web page with a more detailed version of the above instructions aws.amazon.com/premiumsupport/knowledge-center/…Marvellamarvellous
H
3

Disclaimer: I'm not a SAML expert

We had to face the same problem here. After authentication in Okta we were redirected to the Cognito login screen. I tried to follow the advice from WenWolf with no success.

I analyzed the SAML flow using the SAML-tracer extension in Firefox. An error message was hidden in the redirect URI after the assertion POST.

GET https://XXXXX?error_description=Error+in+SAML+response+processing%3A+Audience+restriction+in+SAML+Assertion+does+now+allow+it+for+urn%3Aamazon%3Acognito%3Asp%3Aeu-west-1_YYYYYYYY+&state=e4314f8a-e321-4302-91fe-2a4657a9c582&error=server_error HTTP/1.1

Which gives you :

Error in SAML response processing: Audience restriction in SAML Assertion does now allow it for urn:amazon:cognito:sp:eu-west-1_YYYYYYYY

To fix it in Okta:

  • Change the Audience Restriction field in Okta by replacing the value initially recommended in the documentation and the blog
    • urn:amazon:cognito:sp:IDFoundInAppIntegrationAppClientSettings
  • by the value indicated in the error message
    • urn:amazon:cognito:sp:eu-west-1_YYYYYYYY

This ID also appear in the auto-generated group in Cognito General settings>Users and groups

PS: Keep the other advices on NameId and required attribute mapping that needs to be consistent on both side.

Hipster answered 9/7, 2018 at 14:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.