Show / Hide Table of Contents

Interface IUserPoolDomainProps

Props for UserPoolDomain construct.

Inherited Members
IUserPoolDomainOptions.CognitoDomain
IUserPoolDomainOptions.CustomDomain
Namespace: Amazon.CDK.AWS.Cognito
Assembly: Amazon.CDK.AWS.Cognito.dll
Syntax (csharp)
public interface IUserPoolDomainProps : IUserPoolDomainOptions
Syntax (vb)
Public Interface IUserPoolDomainProps
    Inherits IUserPoolDomainOptions
Remarks

ExampleMetadata: lit=test/integ.cognito.lit.ts infused

Examples
using Amazon.CDK.AWS.Cognito;
using Amazon.CDK.AWS.EC2;
using Amazon.CDK.AWS.ElasticLoadBalancingV2;
using Amazon.CDK;
using Constructs;
using Amazon.CDK.AWS.ElasticLoadBalancingV2.Actions;

CognitoStack : Stack
{var lb = new ApplicationLoadBalancer(this, "LB", new ApplicationLoadBalancerProps {
    Vpc = vpc,
    InternetFacing = true
});

var userPool = new UserPool(this, "UserPool");
var userPoolClient = new UserPoolClient(this, "Client", new UserPoolClientProps {
    UserPool = userPool,

    // Required minimal configuration for use with an ELB
    GenerateSecret = true,
    AuthFlows = new AuthFlow {
        UserPassword = true
    },
    OAuth = new OAuthSettings {
        Flows = new OAuthFlows {
            AuthorizationCodeGrant = true
        },
        Scopes = new [] { OAuthScope.EMAIL },
        CallbackUrls = new [] { $"https://{lb.loadBalancerDnsName}/oauth2/idpresponse" }
    }
});
var cfnClient = (CfnUserPoolClient)userPoolClient.Node.DefaultChild;
cfnClient.AddPropertyOverride("RefreshTokenValidity", 1);
cfnClient.AddPropertyOverride("SupportedIdentityProviders", new [] { "COGNITO" });

var userPoolDomain = new UserPoolDomain(this, "Domain", new UserPoolDomainProps {
    UserPool = userPool,
    CognitoDomain = new CognitoDomainOptions {
        DomainPrefix = "test-cdk-prefix"
    }
});

lb.AddListener("Listener", new BaseApplicationListenerProps {
    Port = 443,
    Certificates = new [] { certificate },
    DefaultAction = new AuthenticateCognitoAction(new AuthenticateCognitoActionProps {
        UserPool = userPool,
        UserPoolClient = userPoolClient,
        UserPoolDomain = userPoolDomain,
        Next = ListenerAction.FixedResponse(200, new FixedResponseOptions {
            ContentType = "text/plain",
            MessageBody = "Authenticated"
        })
    })
});

new CfnOutput(this, "DNS", new CfnOutputProps {
    Value = lb.LoadBalancerDnsName
});

var app = new App();
new CognitoStack(app, "integ-cognito");
app.Synth();

Synopsis

Properties

UserPool

The user pool to which this domain should be associated.

Properties

UserPool

The user pool to which this domain should be associated.

IUserPool UserPool { get; }
Property Value

IUserPool

Back to top Generated by DocFX