import { aws_cognito as cognito } from 'aws-cdk-lib'; import { Construct } from 'constructs'; import { LambdaFunction } from './func'; export interface ICognitoAuthentication { /** The Cognito user pool that holds user information */ readonly userpool: cognito.IUserPool; } export interface IJwtAuthentication { /** * The JWT issuer endpoint URL */ readonly issuerUrl: string; /** * The endpoint's audience. Will only be checked if present. */ readonly audience?: string[]; /** * The JWT endpoints JWKS store. Unless this is provided, OIDC discovery will be used to find this. */ readonly jwksUrl?: string; } export interface CognitoAuthenticationProps { /** Name for the Cognito user pool */ readonly userPoolName: string; /** * Configure Cognito Lambda triggers */ readonly triggers?: { /** * Attaches a lambda function to the custom message trigger * * Code has to reside in './src/lambda/cognito.custom-message.ts' with a method 'handler' * * @default false */ readonly customMessages?: boolean; /** * Attaches a lambda function to the pre token generation trigger * * Code has to reside in './src/lambda/cognito.pre-token-generation.ts' with a method 'handler' * * @default false */ readonly preTokenGeneration?: boolean; }; /** * Properties of the Cognito user pool */ readonly userPoolProps?: cognito.UserPoolProps; /** * Configure SES mail sending */ readonly sesEmailSender?: { /** * AWS region to use for SES */ readonly region: string; /** * Sender name */ readonly name: string; /** * Sender email. Needs to be already verified in SES */ readonly email: string; }; /** * Groups to create in Cognito user pool * Key: group name * Value: group description */ readonly groups?: { readonly [name: string]: string; }; } export declare class CognitoAuthentication extends Construct implements ICognitoAuthentication { readonly userpool: cognito.UserPool; readonly customMessageFunction?: LambdaFunction; readonly preTokenGenerationFunction?: LambdaFunction; constructor(scope: Construct, id: string, props: CognitoAuthenticationProps); }