Slide 1

Slide 1 text

S U M M I T N E W Y O R K

Slide 2

Slide 2 text

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2019, Cloudar BVBA. All rights reserved. S U M M I T Knowing Cognito Getting your feet wet with User Pools and Identity Pools Ben Bridts APN Ambassador Cloudar D E V 1 2

Slide 3

Slide 3 text

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2019, Cloudar BVBA. All rights reserved. S U M M I T Amazon Cognito User Pools Identity Pools AKA Cognito Identity Provider Cognito Federated Identities API cognito-idp cognito-identity Provides Authentication User Management Authorization (to AWS APIs) Think OpenID Provider STS Token Endpoint User Objects Stored in the pool Federated Unauthenticated Federated

Slide 4

Slide 4 text

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2019, Cloudar BVBA. All rights reserved. S U M M I T ?

Slide 5

Slide 5 text

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2019, Cloudar BVBA. All rights reserved. S U M M I T Amazon Cognito User Pools Identity Pools AKA Cognito Identity Provider Cognito Federated Identities API cognito-idp cognito-identity Provides Authentication User Management Authorization (to AWS APIs) Think OpenID Provider STS Token Endpoint User Objects Stored in the pool Federated Unauthenticated Federated

Slide 6

Slide 6 text

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2019, Cloudar BVBA. All rights reserved. S U M M I T S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2019, Cloudar BVBA. All rights reserved. Our employees should be able to call our API after logging in with Active Directory

Slide 7

Slide 7 text

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2019, Cloudar BVBA. All rights reserved. S U M M I T S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2019, Cloudar BVBA. All rights reserved. Our employees should be able to call our API after logging in with Active Directory

Slide 8

Slide 8 text

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2019, Cloudar BVBA. All rights reserved. S U M M I T Mobile client Identity Amazon Cognito User Pool Credentials User

Slide 9

Slide 9 text

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2019, Cloudar BVBA. All rights reserved. S U M M I T User Pools

Slide 10

Slide 10 text

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2019, Cloudar BVBA. All rights reserved. S U M M I T Features Users and Groups Sign in Federation Sign up Web UI Customization (UI + Lambda) Advanced Security MFA Credential check Adaptive Authentication Verification (phone + email) this talk

Slide 11

Slide 11 text

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2019, Cloudar BVBA. All rights reserved. S U M M I T Login Flows SDK ADMIN_NO_SRP_AUTH USER_SRP_AUTH REFRESH_TOKEN(_AUTH) CUSTOM_AUTH USER_PASSWORD_AUTH OAuth/OIDC Authorization Code Grant Implicit Grant Client Credentials this talk this talk

Slide 12

Slide 12 text

Create UserPool Create AppClient Enable Identity Provider

Slide 13

Slide 13 text

Create UserPool Create AppClient Enable Identity Provider

Slide 14

Slide 14 text

Create UserPool Create AppClient Enable Identity Provider

Slide 15

Slide 15 text

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2019, Cloudar BVBA. All rights reserved. S U M M I T AWS Amplify

Slide 16

Slide 16 text

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2019, Cloudar BVBA. All rights reserved. S U M M I T User Pools: USER_SRP_AUTH Amazon Cognito User Pool Client Mobile client Application Identity Credentials User

Slide 17

Slide 17 text

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2019, Cloudar BVBA. All rights reserved. S U M M I T Tokens Access Token: OAuth2 Refresh Token: OAuth2 ID Token: OpenID Connect (OIDC) { "sub": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee", "aud": "xxxxxxxxxxxxexample", "email_verified": true, "token_use": "id", "auth_time": 1500009400, "iss": "https://cognito-idp.us-east-1.amazonaws.com/us-east-1_example", "cognito:username": "janedoe", "exp": 1500013000, "given_name": "Jane", "iat": 1500009400, "email": "[email protected]" }

Slide 18

Slide 18 text

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2019, Cloudar BVBA. All rights reserved. S U M M I T Amazon Cognito User Pools Identity Pools AKA Cognito Identity Provider Cognito Federated Identities API cognito-idp cognito-identity Provides Authentication User Management Authorization (to AWS APIs) Think OpenID Provider STS Token Endpoint User Objects Stored in the pool Federated Unauthenticated Federated

Slide 19

Slide 19 text

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2019, Cloudar BVBA. All rights reserved. S U M M I T Mobile client Identity Amazon Cognito User Pool Credentials User Credentials

Slide 20

Slide 20 text

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2019, Cloudar BVBA. All rights reserved. S U M M I T Mobile client Identity Amazon Cognito User Pool Credentials User Credentials Mobile client Identity Amazon Cognito User Pool User Credentials

Slide 21

Slide 21 text

Create Domain Configure AppClient

Slide 22

Slide 22 text

Create Domain Configure AppClient

Slide 23

Slide 23 text

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2019, Cloudar BVBA. All rights reserved. S U M M I T Mobile client Identity Amazon Cognito User Pool User Credentials Code Code Code Amazon Cognito User Pool User

Slide 24

Slide 24 text

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2019, Cloudar BVBA. All rights reserved. S U M M I T Authorization (Code) Flow 1. è GET https://domain/oauth2/authorize? client_id=client-abc& redirect_uri=https://myapp.tld/code& scope=openid& response_type=code 2. ç 302 https://myapp.tld/code?code=abcde 1. è POST https://domain/oauth2/token grant_type=authorization_code code=abcde client_id=client-abc client_secret=cba-tneilc redirect_uri=https://myapp.tld/ 2. ç Tokens User Client

Slide 25

Slide 25 text

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2019, Cloudar BVBA. All rights reserved. S U M M I T S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2019, Cloudar BVBA. All rights reserved. Our employees should be able to call our API after logging in with Active Directory

Slide 26

Slide 26 text

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2019, Cloudar BVBA. All rights reserved. S U M M I T Mobile client Identity Amazon Cognito User Pool Credentials Amazon API Gateway Identity Content Mobile client Access User

Slide 27

Slide 27 text

Create Authorizer Configure Method

Slide 28

Slide 28 text

Create Authorizer Configure Method

Slide 29

Slide 29 text

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2019, Cloudar BVBA. All rights reserved. S U M M I T Mobile client Identity Amazon Cognito User Pool Credentials Amazon API Gateway Content Mobile client Access Access User

Slide 30

Slide 30 text

Create Resource Server Configure AppClient Configure Method

Slide 31

Slide 31 text

Create Resource Server Configure AppClient Configure Method

Slide 32

Slide 32 text

Create Resource Server Configure AppClient Configure Method

Slide 33

Slide 33 text

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2019, Cloudar BVBA. All rights reserved. S U M M I T Authorization (Code) Flow 1. è GET https://domain/oauth2/authorize? client_id=client-abc& redirect_uri=https://myapp.tld/code& scope=openid protected-api/api.read& response_type=code 2. ç 302 https://myapp.tld/code?code=abcde 1. è POST https://domain/oauth2/token grant_type=authorization_code code=abcde client_id=client-abc client_secret=cba-tneilc redirect_uri=https://myapp.tld/ 2. ç Tokens User Client

Slide 34

Slide 34 text

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2019, Cloudar BVBA. All rights reserved. S U M M I T Other integrations ALB: follows flow for you DIY: validate JWT

Slide 35

Slide 35 text

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2019, Cloudar BVBA. All rights reserved. S U M M I T S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2019, Cloudar BVBA. All rights reserved. Our employees should be able to call our API after logging in with Active Directory

Slide 36

Slide 36 text

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2019, Cloudar BVBA. All rights reserved. S U M M I T Amazon Cognito User Pools Identity Pools AKA Cognito Identity Provider Cognito Federated Identities API cognito-idp cognito-identity Provides Authentication User Management Authorization (to AWS APIs) Think OpenID Provider STS Token Endpoint User Objects Stored in the pool Federated Unauthenticated Federated

Slide 37

Slide 37 text

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2019, Cloudar BVBA. All rights reserved. S U M M I T Identity Pools

Slide 38

Slide 38 text

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2019, Cloudar BVBA. All rights reserved. S U M M I T Mobile client Amazon Cognito Identity Pool Amazon API Gateway Content Mobile client Identity Temporary security credential Credential

Slide 39

Slide 39 text

Create IdentityPool Configure Provider Configure Roles

Slide 40

Slide 40 text

Create IdentityPool Configure Provider Configure Roles

Slide 41

Slide 41 text

Create IdentityPool Configure Provider Configure Roles

Slide 42

Slide 42 text

No content

Slide 43

Slide 43 text

No content

Slide 44

Slide 44 text

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2019, Cloudar BVBA. All rights reserved. S U M M I T S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2019, Cloudar BVBA. All rights reserved. Our employees should be able to call our API after logging in with Active Directory

Slide 45

Slide 45 text

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2019, Cloudar BVBA. All rights reserved. S U M M I T Federation

Slide 46

Slide 46 text

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2019, Cloudar BVBA. All rights reserved. S U M M I T Where? UserPool: - You can merge identities - Can be used without federation - Select provider with /oauth/authorize url, or let user choose with /login IdentityPool: - Only pay for one pool - Only IAM

Slide 47

Slide 47 text

Configure SAML Set Up Federation Configure App Client

Slide 48

Slide 48 text

Configure SAML Set Up Federation Configure App Client

Slide 49

Slide 49 text

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2019, Cloudar BVBA. All rights reserved. S U M M I T Overview

Slide 50

Slide 50 text

Amazon Cognito User Pool Amazon Cognito Identity Pool Identity Provider Identity Amazon API Gateway Application Load Balancer Amazon DynamoDB Amazon Simple Storage Service (S3) DIY Access Code Flow Identity Access Identity Access Temporary security credential Temporary security credential Temporary security credential Identity User

Slide 51

Slide 51 text

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2019, Cloudar BVBA. All rights reserved. S U M M I T Amazon Cognito User Pools Identity Pools AKA Cognito Identity Provider Cognito Federated Identities API cognito-idp cognito-identity Provides Authentication User Management Authorization (to AWS APIs) Think OpenID Provider STS Token Endpoint User Objects Stored in the pool Federated Unauthenticated Federated

Slide 52

Slide 52 text

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2019, Cloudar BVBA. All rights reserved. S U M M I T Thank you! S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2019, Cloudar BVBA. All rights reserved. Ben Bridts [email protected] @benbridts speakerdeck.com/benbridts

Slide 53

Slide 53 text

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2019, Cloudar BVBA. All rights reserved. S U M M I T Photos • Pineapple Supply Co • Tinh Khuong • Estonian Saunas • chuttersnap • James Lee • Jesper Stechmann