Skip to content

Commit

Permalink
chore(cognito): drop use of PhysicalName (#6117)
Browse files Browse the repository at this point in the history
The user has no control over the identifier generated for a Cognito user
pool. The `userPoolName` attribute is simply a human-friendly secondary
identifier for the user pool and not the primary identified.
  • Loading branch information
nija-at authored Feb 5, 2020
1 parent f1f5319 commit 0b6c9d5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
14 changes: 4 additions & 10 deletions packages/@aws-cdk/aws-cognito/lib/user-pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,7 @@ export class UserPool extends Resource implements IUserPool {
private triggers: CfnUserPool.LambdaConfigProperty = { };

constructor(scope: Construct, id: string, props: UserPoolProps = {}) {
super(scope, id, {
physicalName: props.userPoolName,
});
super(scope, id);

let aliasAttributes: UserPoolAttribute[] | undefined;
let usernameAttributes: UserPoolAttribute[] | undefined;
Expand Down Expand Up @@ -403,19 +401,15 @@ export class UserPool extends Resource implements IUserPool {
}

const userPool = new CfnUserPool(this, 'Resource', {
userPoolName: this.physicalName,
userPoolName: props.userPoolName,
usernameAttributes,
aliasAttributes,
autoVerifiedAttributes: props.autoVerifiedAttributes,
lambdaConfig: Lazy.anyValue({ produce: () => this.triggers })
});

this.userPoolId = this.getResourceNameAttribute(userPool.ref);
this.userPoolArn = this.getResourceArnAttribute(userPool.attrArn, {
service: 'cognito',
resource: 'userpool',
resourceName: this.physicalName,
});
this.userPoolId = userPool.ref;
this.userPoolArn = userPool.attrArn;

this.userPoolProviderName = userPool.attrProviderName;
this.userPoolProviderUrl = userPool.attrProviderUrl;
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-cognito/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,4 @@
]
},
"stability": "experimental"
}
}

0 comments on commit 0b6c9d5

Please sign in to comment.