Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can i use AWS cognito to provide a open id connect endpoint?

I want to use AWS cognito as a OpenId connect provider.My AWS cognito IDP will intern call my another OpenId provider to authenticate the user. It will then create its new token and hand over to callers as its own.

The OpenID provider used internally by AWS cognito pool is transparent to user. User only configures AWS cognito as its IDP provider.

User case

  • User authenticates with My AWS IDP provider
  • My IDP provider authenticates the user agains Googles IDP provider
  • My IDP decodes the token returned by Google IDP.
  • My IDP Creates new token and add additional claims.
  • My IDP hands over my JWT to user.

Question

  • Is this possible in AWS cognito?
  • Does AWS user pool expose OpenID connect endpoint?
like image 865
user93796 Avatar asked Dec 06 '17 00:12

user93796


People also ask

Can Cognito be an identity provider?

Set up user sign-in with a social IdP. You can use federation to integrate Amazon Cognito user pools with social identity providers such as Facebook, Google, and Login with Amazon. To add a social identity provider, you first create a developer account with the identity provider.

What functionality does Amazon Cognito provide?

Amazon Cognito lets you easily add user sign-up and authentication to your mobile and web apps. Amazon Cognito also enables you to authenticate users through an external identity provider and provides temporary security credentials to access your app's backend resources in AWS or any service behind Amazon API Gateway.

Can AWS Cognito be used for SSO?

Single Sign-On (SSO) solutions allow users to enter credentials once and access many systems simultaneously. IT administrators can use a local SSO server or a third-party service to manage authentication, allowing for centralized access management.


1 Answers

Cognito does provide an OpenId connect endpoint, as detailed in this blog post by @Badri

The formula for the authority is:

https://cognito-idp.{region}.amazonaws.com/{userPoolId} 

And you can verify by checking the metadata URL that something is there

https://cognito-idp.{region}.amazonaws.com/{userPoolId}/.well-known/openid-configuration 

Then during client pool setup, you can federate with other OIDC providers, and also enable the OIDC provider in the app client settings. Which should enable your scenario which sounds very similar to what I would like to do. However, the blog post misses one crucial piece of configuration, which is setting a domain name for the app integration. This StackOverflow question shows the error you will receive if you do not configure this domain and links to the solution in an answer. Once I set the domain, Badri's code worked for me.

like image 180
Jim Counts Avatar answered Oct 13 '22 22:10

Jim Counts