@scloud/cdk-patterns
Version:
Serverless CDK patterns for common infrastructure needs
57 lines (56 loc) • 2.73 kB
TypeScript
import { CfnUserPoolIdentityProvider, UserPool, UserPoolClient, UserPoolDomain, UserPoolIdentityProviderFacebook, UserPoolIdentityProviderGoogle } from 'aws-cdk-lib/aws-cognito';
import { IHostedZone } from 'aws-cdk-lib/aws-route53';
import { Construct } from 'constructs';
export interface SamlProvider {
FederationMetadataUrl?: string;
FederationMetadataXml?: string;
SamlProviderName?: string;
}
export interface IdpConfig {
enableEmail?: boolean;
googleClientId?: string;
googleClientSecret?: string;
facebookAppId?: string;
facebookAppSecret?: string;
SamlProviders?: SamlProvider[];
FederationMetadataUrl?: string;
FederationMetadataXml?: string;
SamlProviderName?: string;
}
export interface CognitoConstructs {
userPool: UserPool;
domain?: UserPoolDomain;
client: UserPoolClient;
callbackUrl: string;
signInUrl?: string;
}
export declare function googleIdp(construct: Construct, name: string, userPool: UserPool, idpConfig: IdpConfig): UserPoolIdentityProviderGoogle;
export declare function facebookIdp(construct: Construct, name: string, userPool: UserPool, idpConfig: IdpConfig): UserPoolIdentityProviderFacebook;
export declare function samlIdp(construct: Construct, name: string, userPool: UserPool, samlProvider: SamlProvider): CfnUserPoolIdentityProvider;
/**
* @deprecated
*
* Create a Cognito User Pool Client.
* @param callbackUrl Authentication callback URL.
* @returns cognito.UserPoolClient
*/
export declare function userPoolClient(construct: Construct, name: string, userPool: UserPool, callbackUrl: string, enableEmail?: boolean, google?: UserPoolIdentityProviderGoogle, facebook?: UserPoolIdentityProviderFacebook, samls?: CfnUserPoolIdentityProvider[], alternativeCallbackUrl?: string): UserPoolClient;
/**
* @deprecated
*
* Authentication setup with Cognito.
*
* NB: IF you want to use a custom domain, the CDK deployment
* will fail unless there's an A record at the zone apex.
*
* @param construct CDK construct ("this")
* @param name The name for the user pool and related resources
* @param callbackUrl Allowed callback URL
* @param idpConfig Identity provider configuration
* @param zone If you want a custom domain, pass the zone to create it in
* @param domainName If you're passing a zone, you can pass a domain name,
* or leave out for a recommended `auth.${zone.zoneName}`.
* If not passing a zone, this will be used as a Cognito domain prefix.
* @returns Information about the created UserPool
*/
export declare function cognitoPool(construct: Construct, name: string, callbackUrl: string, idpConfig: IdpConfig, zone?: IHostedZone, domainName?: string, alternativeCallbackUrl?: string): CognitoConstructs;