Table of Contents

Class UserPool

Namespace
Amazon.CDK.AWS.Cognito
Assembly
Amazon.CDK.AWS.Cognito.dll

Define a Cognito User Pool.

public class UserPool : Resource, IUserPool, IResource, IConstruct, IConstruct, IDependable
Inheritance
UserPool
Implements
IResource
IConstruct
IConstruct
IDependable

Examples

var pool = new UserPool(this, "Pool");
            pool.AddClient("app-client", new UserPoolClientOptions {
                OAuth = new OAuthSettings {
                    Flows = new OAuthFlows {
                        AuthorizationCodeGrant = true
                    },
                    Scopes = new [] { OAuthScope.OPENID },
                    CallbackUrls = new [] { "https://my-app-domain.com/welcome" },
                    LogoutUrls = new [] { "https://my-app-domain.com/signin" }
                }
            });

Remarks

ExampleMetadata: infused

Constructors

UserPool(Construct, string, IUserPoolProps?)

public UserPool(Construct scope, string id, IUserPoolProps? props = null)

Parameters

scope Construct
id string
props IUserPoolProps

Properties

IdentityProviders

Get all identity providers registered with this user pool.

public virtual IUserPoolIdentityProvider[] IdentityProviders { get; }

Property Value

IUserPoolIdentityProvider[]

UserPoolArn

The ARN of the user pool.

public virtual string UserPoolArn { get; }

Property Value

string

UserPoolId

The physical ID of this user pool resource.

public virtual string UserPoolId { get; }

Property Value

string

UserPoolProviderName

User pool provider name.

public virtual string UserPoolProviderName { get; }

Property Value

string

Remarks

Attribute: true

UserPoolProviderUrl

User pool provider URL.

public virtual string UserPoolProviderUrl { get; }

Property Value

string

Remarks

Attribute: true

Methods

AddClient(string, IUserPoolClientOptions?)

Add a new app client to this user pool.

public virtual UserPoolClient AddClient(string id, IUserPoolClientOptions? options = null)

Parameters

id string
options IUserPoolClientOptions

Returns

UserPoolClient

AddDomain(string, IUserPoolDomainOptions)

Associate a domain to this user pool.

public virtual UserPoolDomain AddDomain(string id, IUserPoolDomainOptions options)

Parameters

id string
options IUserPoolDomainOptions

Returns

UserPoolDomain

AddResourceServer(string, IUserPoolResourceServerOptions)

Add a new resource server to this user pool.

public virtual UserPoolResourceServer AddResourceServer(string id, IUserPoolResourceServerOptions options)

Parameters

id string
options IUserPoolResourceServerOptions

Returns

UserPoolResourceServer

AddTrigger(UserPoolOperation, IFunction)

Add a lambda trigger to a user pool operation.

public virtual void AddTrigger(UserPoolOperation operation, IFunction fn)

Parameters

operation UserPoolOperation
fn IFunction

Remarks

FromUserPoolArn(Construct, string, string)

Import an existing user pool based on its ARN.

public static IUserPool FromUserPoolArn(Construct scope, string id, string userPoolArn)

Parameters

scope Construct
id string
userPoolArn string

Returns

IUserPool

FromUserPoolId(Construct, string, string)

Import an existing user pool based on its id.

public static IUserPool FromUserPoolId(Construct scope, string id, string userPoolId)

Parameters

scope Construct
id string
userPoolId string

Returns

IUserPool

Grant(IGrantable, params string[])

Adds an IAM policy statement associated with this user pool to an IAM principal's policy.

public virtual Grant Grant(IGrantable grantee, params string[] actions)

Parameters

grantee IGrantable
actions string[]

Returns

Grant

RegisterIdentityProvider(IUserPoolIdentityProvider)

Register an identity provider with this user pool.

public virtual void RegisterIdentityProvider(IUserPoolIdentityProvider provider)

Parameters

provider IUserPoolIdentityProvider