Skip to content

Commit

Permalink
fix up integ test
Browse files Browse the repository at this point in the history
  • Loading branch information
Niranjan Jayakar committed May 29, 2020
1 parent 24c675d commit 05b06f0
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,11 @@
"implicit",
"code"
],
"AllowedOAuthFlowsUserPoolClient": true,
"AllowedOAuthScopes": [
"email",
"profile",
"phone",
"email",
"openid",
"profile",
"aws.cognito.signin.user.admin"
],
"CallbackURLs": [
Expand Down Expand Up @@ -116,5 +115,29 @@
}
}
}
},
"Outputs": {
"SignInLink": {
"Value": {
"Fn::Join": [
"",
[
"https://",
{
"Ref": "pooldomain430FA744"
},
".auth.",
{
"Ref": "AWS::Region"
},
".amazoncognito.com/login?client_id=",
{
"Ref": "poolclient2623294C"
},
"&response_type=code&redirect_uri=https://example.com"
]
]
}
}
}
}
34 changes: 13 additions & 21 deletions packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { App, Stack } from '@aws-cdk/core';
import { OAuthScope, UserPool, UserPoolIdentityProvider } from '../lib';
import { App, CfnOutput, Stack } from '@aws-cdk/core';
import { UserPool, UserPoolIdentityProvider } from '../lib';

/*
* Stack verification steps - TBD
* Stack verification steps
* * Visit the URL provided by stack output 'SignInLink' in a browser, and verify the 'Login with Amazon' link shows up.
* * If you plug in valid 'Login with Amazon' credentials, the federated log in should work.
*/
const app = new App();
const stack = new Stack(app, 'integ-user-pool-idp');
Expand All @@ -15,28 +17,18 @@ const provider = UserPoolIdentityProvider.amazon(stack, 'amazon', {
clientSecret: 'amzn-client-secret',
});

userpool.addClient('client', {
oAuth: {
flows: {
implicitCodeGrant: true,
authorizationCodeGrant: true,
},
scopes: [
OAuthScope.EMAIL,
OAuthScope.PHONE,
OAuthScope.OPENID,
OAuthScope.PROFILE,
OAuthScope.COGNITO_ADMIN,
],
callbackUrls: [
'https://example.com',
],
},
const client = userpool.addClient('client', {
identityProviders: [ provider ],
});

userpool.addDomain('domain', {
const domain = userpool.addDomain('domain', {
cognitoDomain: {
domainPrefix: 'nija-test-pool',
},
});

new CfnOutput(stack, 'SignInLink', {
value: domain.signInUrl(client, {
redirectUri: 'https://example.com',
}),
});

0 comments on commit 05b06f0

Please sign in to comment.