Skip to content

Commit 5111837

Browse files
authored
feat(cognito): user pool client logout urls (#10301)
Support Logout URLs in UserPoolClient. This is a pretty minimal change to just allow the property to be set. fixes: #10225 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 364543c commit 5111837

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

packages/@aws-cdk/aws-cognito/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,7 @@ pool.addClient('app-client', {
472472
},
473473
scopes: [ OAuthScope.OPENID ],
474474
callbackUrls: [ 'https://my-app-domain.com/welcome' ],
475+
logoutUrls: [ 'https://my-app-domain.com/signin' ],
475476
}
476477
});
477478
```

packages/@aws-cdk/aws-cognito/lib/user-pool-client.ts

+7
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ export interface OAuthSettings {
5656
*/
5757
readonly callbackUrls?: string[];
5858

59+
/**
60+
* List of allowed logout URLs for the identity providers.
61+
* @default - no logout URLs
62+
*/
63+
readonly logoutUrls?: string[];
64+
5965
/**
6066
* OAuth scopes that are allowed with this client.
6167
* @see https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-app-idp-settings.html
@@ -315,6 +321,7 @@ export class UserPoolClient extends Resource implements IUserPoolClient {
315321
allowedOAuthFlows: props.disableOAuth ? undefined : this.configureOAuthFlows(),
316322
allowedOAuthScopes: props.disableOAuth ? undefined : this.configureOAuthScopes(props.oAuth),
317323
callbackUrLs: callbackUrls && callbackUrls.length > 0 ? callbackUrls : undefined,
324+
logoutUrLs: props.oAuth?.logoutUrls,
318325
allowedOAuthFlowsUserPoolClient: !props.disableOAuth,
319326
preventUserExistenceErrors: this.configurePreventUserExistenceErrors(props.preventUserExistenceErrors),
320327
supportedIdentityProviders: this.configureIdentityProviders(props),

packages/@aws-cdk/aws-cognito/test/user-pool-client.test.ts

+15
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,21 @@ describe('User Pool Client', () => {
201201
})).not.toThrow();
202202
});
203203

204+
test('logoutUrls can be set', () => {
205+
const stack = new Stack();
206+
const pool = new UserPool(stack, 'Pool');
207+
208+
pool.addClient('Client', {
209+
oAuth: {
210+
logoutUrls: ['https://example.com'],
211+
},
212+
});
213+
214+
expect(stack).toHaveResourceLike('AWS::Cognito::UserPoolClient', {
215+
LogoutURLs: ['https://example.com'],
216+
});
217+
});
218+
204219
test('fails when clientCredentials OAuth flow is selected along with codeGrant or implicitGrant', () => {
205220
const stack = new Stack();
206221
const pool = new UserPool(stack, 'Pool');

0 commit comments

Comments
 (0)