Class UserPool
Define a Cognito User Pool.
Inherited Members
Namespace: Amazon.CDK.AWS.Cognito
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class UserPool : Resource, IUserPool, IResource, IConstruct, IDependable, IEnvironmentAware
Syntax (vb)
Public Class UserPool Inherits Resource Implements IUserPool, IResource, IConstruct, IDependable, IEnvironmentAware
Remarks
ExampleMetadata: infused
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" }
}
});
Synopsis
Constructors
| UserPool(Construct, string, IUserPoolProps?) | Define a Cognito User Pool. |
Properties
| IdentityProviders | Get all identity providers registered with this user pool. |
| PROPERTY_INJECTION_ID | Uniquely identifies this class. |
| UserPoolArn | The ARN of the user pool. |
| UserPoolId | The physical ID of this user pool resource. |
| UserPoolProviderName | User pool provider name. |
| UserPoolProviderUrl | User pool provider URL. |
Methods
| AddClient(string, IUserPoolClientOptions?) | Add a new app client to this user pool. |
| AddDomain(string, IUserPoolDomainOptions) | Associate a domain to this user pool. |
| AddGroup(string, IUserPoolGroupOptions) | Add a new group to this user pool. |
| AddResourceServer(string, IUserPoolResourceServerOptions) | Add a new resource server to this user pool. |
| AddTrigger(UserPoolOperation, IFunction, LambdaVersion?) | Add a lambda trigger to a user pool operation. |
| FromUserPoolArn(Construct, string, string) | Import an existing user pool based on its ARN. |
| FromUserPoolId(Construct, string, string) | Import an existing user pool based on its id. |
| Grant(IGrantable, params string[]) | Adds an IAM policy statement associated with this user pool to an IAM principal's policy. |
| RegisterIdentityProvider(IUserPoolIdentityProvider) | Register an identity provider with this user pool. |
Constructors
UserPool(Construct, string, IUserPoolProps?)
Define a Cognito User Pool.
public UserPool(Construct scope, string id, IUserPoolProps? props = null)
Parameters
- scope Construct
- id string
- props IUserPoolProps
Remarks
ExampleMetadata: infused
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" }
}
});
Properties
IdentityProviders
Get all identity providers registered with this user pool.
public virtual IUserPoolIdentityProvider[] IdentityProviders { get; }
Property Value
Remarks
ExampleMetadata: infused
PROPERTY_INJECTION_ID
Uniquely identifies this class.
public static string PROPERTY_INJECTION_ID { get; }
Property Value
Remarks
ExampleMetadata: infused
UserPoolArn
The ARN of the user pool.
public virtual string UserPoolArn { get; }
Property Value
Remarks
ExampleMetadata: infused
UserPoolId
The physical ID of this user pool resource.
public virtual string UserPoolId { get; }
Property Value
Remarks
ExampleMetadata: infused
UserPoolProviderName
User pool provider name.
public virtual string UserPoolProviderName { get; }
Property Value
Remarks
Attribute: true
UserPoolProviderUrl
User pool provider URL.
public virtual string UserPoolProviderUrl { get; }
Property Value
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
Remarks
ExampleMetadata: infused
AddDomain(string, IUserPoolDomainOptions)
Associate a domain to this user pool.
public virtual UserPoolDomain AddDomain(string id, IUserPoolDomainOptions options)
Parameters
- id string
- options IUserPoolDomainOptions
Returns
Remarks
ExampleMetadata: infused
AddGroup(string, IUserPoolGroupOptions)
Add a new group to this user pool.
public virtual UserPoolGroup AddGroup(string id, IUserPoolGroupOptions options)
Parameters
- id string
- options IUserPoolGroupOptions
Returns
Remarks
ExampleMetadata: infused
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
Remarks
ExampleMetadata: infused
AddTrigger(UserPoolOperation, IFunction, LambdaVersion?)
Add a lambda trigger to a user pool operation.
public virtual void AddTrigger(UserPoolOperation operation, IFunction fn, LambdaVersion? lambdaVersion = null)
Parameters
- operation UserPoolOperation
- fn IFunction
- lambdaVersion LambdaVersion?
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
Returns
Remarks
ExampleMetadata: infused
FromUserPoolId(Construct, string, string)
Import an existing user pool based on its id.
public static IUserPool FromUserPoolId(Construct scope, string id, string userPoolId)
Parameters
Returns
Remarks
ExampleMetadata: infused
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
Remarks
ExampleMetadata: infused
RegisterIdentityProvider(IUserPoolIdentityProvider)
Register an identity provider with this user pool.
public virtual void RegisterIdentityProvider(IUserPoolIdentityProvider provider)
Parameters
- provider IUserPoolIdentityProvider
Remarks
ExampleMetadata: infused