Skip to content

Commit

Permalink
feat(aws-cognito): Add support for ALLOW_USER_AUTH explicit auth flow
Browse files Browse the repository at this point in the history
  • Loading branch information
danielholmes committed Nov 25, 2024
1 parent 421d327 commit ba50329
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"ALLOW_ADMIN_USER_PASSWORD_AUTH",
"ALLOW_CUSTOM_AUTH",
"ALLOW_USER_SRP_AUTH",
"ALLOW_USER_AUTH",
"ALLOW_REFRESH_TOKEN_AUTH"
],
"GenerateSecret": true,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const client = userpool.addClient('myuserpoolclient', {
custom: true,
userPassword: true,
userSrp: true,
user: true,
},
generateSecret: true,
oAuth: {
Expand Down
7 changes: 7 additions & 0 deletions packages/aws-cdk-lib/aws-cognito/lib/user-pool-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ export interface AuthFlow {
* @default false
*/
readonly userSrp?: boolean;

/**
* Enable Choice-based authentication
* @default false
*/
readonly user?: boolean;
}

/**
Expand Down Expand Up @@ -525,6 +531,7 @@ export class UserPoolClient extends Resource implements IUserPoolClient {
if (props.authFlows.adminUserPassword) { authFlows.push('ALLOW_ADMIN_USER_PASSWORD_AUTH'); }
if (props.authFlows.custom) { authFlows.push('ALLOW_CUSTOM_AUTH'); }
if (props.authFlows.userSrp) { authFlows.push('ALLOW_USER_SRP_AUTH'); }
if (props.authFlows.user) { authFlows.push('ALLOW_USER_AUTH'); }

// refreshToken should always be allowed if authFlows are present
authFlows.push('ALLOW_REFRESH_TOKEN_AUTH');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ describe('User Pool Client', () => {
custom: true,
userPassword: true,
userSrp: true,
user: true,
},
});

Expand All @@ -264,6 +265,7 @@ describe('User Pool Client', () => {
'ALLOW_ADMIN_USER_PASSWORD_AUTH',
'ALLOW_CUSTOM_AUTH',
'ALLOW_USER_SRP_AUTH',
'ALLOW_USER_AUTH',
'ALLOW_REFRESH_TOKEN_AUTH',
],
});
Expand All @@ -281,6 +283,7 @@ describe('User Pool Client', () => {
custom: false,
userPassword: false,
userSrp: false,
user: false,
},
});

Expand Down

0 comments on commit ba50329

Please sign in to comment.