Show / Hide Table of Contents

Class UserPoolDomainProps

Props for UserPoolDomain construct.

Inheritance
System.Object
UserPoolDomainProps
Implements
IUserPoolDomainProps
IUserPoolDomainOptions
Namespace: Amazon.CDK.AWS.Cognito
Assembly: Amazon.CDK.AWS.Cognito.dll
Syntax (csharp)
public class UserPoolDomainProps : Object, IUserPoolDomainProps, IUserPoolDomainOptions
Syntax (vb)
Public Class UserPoolDomainProps
    Inherits Object
    Implements IUserPoolDomainProps, 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

Constructors

UserPoolDomainProps()

Properties

CognitoDomain

Associate a cognito prefix domain with your user pool Either customDomain or cognitoDomain must be specified.

CustomDomain

Associate a custom domain with your user pool Either customDomain or cognitoDomain must be specified.

UserPool

The user pool to which this domain should be associated.

Constructors

UserPoolDomainProps()

public UserPoolDomainProps()

Properties

CognitoDomain

Associate a cognito prefix domain with your user pool Either customDomain or cognitoDomain must be specified.

public ICognitoDomainOptions CognitoDomain { get; set; }
Property Value

ICognitoDomainOptions

Remarks

Default: - not set if customDomain is specified, otherwise, throws an error.

See: https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-assign-domain-prefix.html

CustomDomain

Associate a custom domain with your user pool Either customDomain or cognitoDomain must be specified.

public ICustomDomainOptions CustomDomain { get; set; }
Property Value

ICustomDomainOptions

Remarks

Default: - not set if cognitoDomain is specified, otherwise, throws an error.

See: https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-add-custom-domain.html

UserPool

The user pool to which this domain should be associated.

public IUserPool UserPool { get; set; }
Property Value

IUserPool

Implements

IUserPoolDomainProps
IUserPoolDomainOptions
Back to top Generated by DocFX