Skip to content

Commit

Permalink
fix(validation): Cognito auth validation (sid88in#513)
Browse files Browse the repository at this point in the history
  • Loading branch information
bboure authored and vicary committed Jun 9, 2023
1 parent b2b657a commit 750b1a1
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/__tests__/validation/__snapshots__/auth.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ exports[`Valdiation Invalid should validate a Cognito with invalid userPoolId 1`
"/authentication/config/userPoolId: must be a string or a CloudFormation intrinsic function
/authentication/config/awsRegion: must be a string or a CloudFormation intrinsic function
/authentication/config/defaultAction: must be \\"ALLOW\\" or \\"DENY\\"
/authentication/config/appIdClientRegex: must be string"
/authentication/config/appIdClientRegex: must be a string or a CloudFormation intrinsic function"
`;

exports[`Valdiation Invalid should validate a Lambda with empty config 1`] = `"/authentication/config: must specify functionName, functionArn or function (all exclusives)"`;
Expand Down
3 changes: 3 additions & 0 deletions src/__tests__/validation/auth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ describe('Valdiation', () => {
userPoolId: {
Ref: 'CognitoUserPool',
},
appIdClientRegex: {
Ref: 'CognitoUserPoolClient',
},
},
},
} as AppSyncConfigInput,
Expand Down
2 changes: 1 addition & 1 deletion src/types/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export type CognitoAuth = {
userPoolId: string | IntrinsicFunction;
awsRegion?: string | IntrinsicFunction;
defaultAction?: 'ALLOW' | 'DENY';
appIdClientRegex?: string;
appIdClientRegex?: string | IntrinsicFunction;
};
};

Expand Down
2 changes: 1 addition & 1 deletion src/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export const appSyncSchema = {
enum: ['ALLOW', 'DENY'],
errorMessage: 'must be "ALLOW" or "DENY"',
},
appIdClientRegex: { type: 'string' },
appIdClientRegex: { $ref: '#/definitions/stringOrIntrinsicFunction' },
},
required: ['userPoolId'],
},
Expand Down

0 comments on commit 750b1a1

Please sign in to comment.