class UserPoolResourceServer (construct)
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.Cognito.UserPoolResourceServer |
Java | software.amazon.awscdk.services.cognito.UserPoolResourceServer |
Python | aws_cdk.aws_cognito.UserPoolResourceServer |
TypeScript (source) | @aws-cdk/aws-cognito » UserPoolResourceServer |
Implements
IConstruct
, IConstruct
, IDependable
, IResource
, IUser
Defines a User Pool OAuth2.0 Resource Server.
Example
const pool = new cognito.UserPool(this, 'Pool');
const readOnlyScope = new cognito.ResourceServerScope({ scopeName: 'read', scopeDescription: 'Read-only access' });
const fullAccessScope = new cognito.ResourceServerScope({ scopeName: '*', scopeDescription: 'Full access' });
const userServer = pool.addResourceServer('ResourceServer', {
identifier: 'users',
scopes: [ readOnlyScope, fullAccessScope ],
});
const readOnlyClient = pool.addClient('read-only-client', {
// ...
oAuth: {
// ...
scopes: [ cognito.OAuthScope.resourceServer(userServer, readOnlyScope) ],
},
});
const fullAccessClient = pool.addClient('full-access-client', {
// ...
oAuth: {
// ...
scopes: [ cognito.OAuthScope.resourceServer(userServer, fullAccessScope) ],
},
});
Initializer
new UserPoolResourceServer(scope: Construct, id: string, props: UserPoolResourceServerProps)
Parameters
- scope
Construct
- id
string
- props
User
Pool Resource Server Props
Construct Props
Name | Type | Description |
---|---|---|
identifier | string | A unique resource server identifier for the resource server. |
user | IUser | The user pool to add this resource server to. |
scopes? | Resource [] | Oauth scopes. |
user | string | A friendly name for the resource server. |
identifier
Type:
string
A unique resource server identifier for the resource server.
userPool
Type:
IUser
The user pool to add this resource server to.
scopes?
Type:
Resource
[]
(optional, default: No scopes will be added)
Oauth scopes.
userPoolResourceServerName?
Type:
string
(optional, default: same as identifier
)
A friendly name for the resource server.
Properties
Name | Type | Description |
---|---|---|
env | Resource | The environment this resource belongs to. |
node | Construct | The construct tree node associated with this construct. |
stack | Stack | The stack in which this resource is defined. |
user | string | Resource server id. |
env
Type:
Resource
The environment this resource belongs to.
For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.
node
Type:
Construct
The construct tree node associated with this construct.
stack
Type:
Stack
The stack in which this resource is defined.
userPoolResourceServerId
Type:
string
Resource server id.
Methods
Name | Description |
---|---|
apply | Apply the given removal policy to this resource. |
to | Returns a string representation of this construct. |
static from | Import a user pool resource client given its id. |
RemovalPolicy(policy)
applypublic applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
Removal
Policy
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY
), or left in your AWS
account for data recovery and cleanup later (RemovalPolicy.RETAIN
).
String()
topublic toString(): string
Returns
string
Returns a string representation of this construct.
UserPoolResourceServerId(scope, id, userPoolResourceServerId)
static frompublic static fromUserPoolResourceServerId(scope: Construct, id: string, userPoolResourceServerId: string): IUserPoolResourceServer
Parameters
- scope
Construct
- id
string
- userPoolResourceServerId
string
Returns
Import a user pool resource client given its id.