Skip to content

Commit

Permalink
chore: remove userpoolclientLambda
Browse files Browse the repository at this point in the history
  • Loading branch information
sobolk committed Jul 10, 2023
1 parent 211ca4e commit 3eab8be
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 406 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,6 @@ exports[`Check Auth Template Generated authstack template in default flow 1`] =
},
"Resources": {
"IdentityPool": {
"DependsOn": [
"UserPoolClientInputs",
],
"Properties": {
"AllowUnauthenticatedIdentities": {
"Ref": "allowUnauthenticatedIdentities",
Expand Down Expand Up @@ -361,145 +358,6 @@ exports[`Check Auth Template Generated authstack template in default flow 1`] =
},
"Type": "AWS::Cognito::UserPoolClient",
},
"UserPoolClientInputs": {
"DeletionPolicy": "Delete",
"DependsOn": [
"UserPoolClientLogPolicy",
],
"Properties": {
"ServiceToken": {
"Fn::GetAtt": [
"UserPoolClientLambda",
"Arn",
],
},
"clientId": {
"Ref": "UserPoolClient",
},
"userpoolId": {
"Ref": "UserPool",
},
},
"Type": "Custom::LambdaCallout",
"UpdateReplacePolicy": "Delete",
},
"UserPoolClientLambda": {
"DependsOn": [
"UserPoolClientRole",
],
"Properties": {
"Code": {
"ZipFile": "const response = require('cfn-response');
const aws = require('aws-sdk');
const identity = new aws.CognitoIdentityServiceProvider();
exports.handler = (event, context, callback) => {
if (event.RequestType == 'Delete') {
response.send(event, context, response.SUCCESS, {});
}
if (event.RequestType == 'Update' || event.RequestType == 'Create') {
const params = {
ClientId: event.ResourceProperties.clientId,
UserPoolId: event.ResourceProperties.userpoolId,
};
identity
.describeUserPoolClient(params)
.promise()
.then((res) => {
response.send(event, context, response.SUCCESS, { appSecret: res.UserPoolClient.ClientSecret });
})
.catch((err) => {
response.send(event, context, response.FAILED, { err });
});
}
};
",
},
"Handler": "index.handler",
"Role": {
"Fn::GetAtt": [
"UserPoolClientRole",
"Arn",
],
},
"Runtime": "nodejs16.x",
"Timeout": 300,
},
"Type": "AWS::Lambda::Function",
},
"UserPoolClientLambdaPolicy": {
"DependsOn": [
"UserPoolClientLambda",
],
"Properties": {
"PolicyDocument": {
"Statement": [
{
"Action": [
"cognito-idp:DescribeUserPoolClient",
],
"Effect": "Allow",
"Resource": {
"Fn::GetAtt": [
"UserPool",
"Arn",
],
},
},
],
"Version": "2012-10-17",
},
"PolicyName": "authde2c33facd_userpoolclient_lambda_iam_policy",
"Roles": [
{
"Ref": "UserPoolClientRole",
},
],
},
"Type": "AWS::IAM::Policy",
},
"UserPoolClientLogPolicy": {
"DependsOn": [
"UserPoolClientLambdaPolicy",
],
"Properties": {
"PolicyDocument": {
"Statement": [
{
"Action": [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents",
],
"Effect": "Allow",
"Resource": {
"Fn::Sub": [
"arn:aws:logs:\${region}:\${account}:log-group:/aws/lambda/\${lambda}:log-stream:*",
{
"account": {
"Ref": "AWS::AccountId",
},
"lambda": {
"Ref": "UserPoolClientLambda",
},
"region": {
"Ref": "AWS::Region",
},
},
],
},
},
],
"Version": "2012-10-17",
},
"PolicyName": "authde2c33facd_userpoolclient_lambda_log_policy",
"Roles": [
{
"Ref": "UserPoolClientRole",
},
],
},
"Type": "AWS::IAM::Policy",
},
"UserPoolClientRole": {
"DependsOn": [
"UserPoolClient",
Expand Down Expand Up @@ -1456,9 +1314,6 @@ exports.handler = (event, context, callback) => {
"Type": "AWS::IAM::Policy",
},
"IdentityPool": {
"DependsOn": [
"UserPoolClientInputs",
],
"Properties": {
"AllowUnauthenticatedIdentities": {
"Ref": "allowUnauthenticatedIdentities",
Expand Down Expand Up @@ -1846,145 +1701,6 @@ exports.handler = (event, context, callback) => {
},
"Type": "AWS::Cognito::UserPoolClient",
},
"UserPoolClientInputs": {
"DeletionPolicy": "Delete",
"DependsOn": [
"UserPoolClientLogPolicy",
],
"Properties": {
"ServiceToken": {
"Fn::GetAtt": [
"UserPoolClientLambda",
"Arn",
],
},
"clientId": {
"Ref": "UserPoolClient",
},
"userpoolId": {
"Ref": "UserPool",
},
},
"Type": "Custom::LambdaCallout",
"UpdateReplacePolicy": "Delete",
},
"UserPoolClientLambda": {
"DependsOn": [
"UserPoolClientRole",
],
"Properties": {
"Code": {
"ZipFile": "const response = require('cfn-response');
const aws = require('aws-sdk');
const identity = new aws.CognitoIdentityServiceProvider();
exports.handler = (event, context, callback) => {
if (event.RequestType == 'Delete') {
response.send(event, context, response.SUCCESS, {});
}
if (event.RequestType == 'Update' || event.RequestType == 'Create') {
const params = {
ClientId: event.ResourceProperties.clientId,
UserPoolId: event.ResourceProperties.userpoolId,
};
identity
.describeUserPoolClient(params)
.promise()
.then((res) => {
response.send(event, context, response.SUCCESS, { appSecret: res.UserPoolClient.ClientSecret });
})
.catch((err) => {
response.send(event, context, response.FAILED, { err });
});
}
};
",
},
"Handler": "index.handler",
"Role": {
"Fn::GetAtt": [
"UserPoolClientRole",
"Arn",
],
},
"Runtime": "nodejs16.x",
"Timeout": 300,
},
"Type": "AWS::Lambda::Function",
},
"UserPoolClientLambdaPolicy": {
"DependsOn": [
"UserPoolClientLambda",
],
"Properties": {
"PolicyDocument": {
"Statement": [
{
"Action": [
"cognito-idp:DescribeUserPoolClient",
],
"Effect": "Allow",
"Resource": {
"Fn::GetAtt": [
"UserPool",
"Arn",
],
},
},
],
"Version": "2012-10-17",
},
"PolicyName": "extaut87063394_userpoolclient_lambda_iam_policy",
"Roles": [
{
"Ref": "UserPoolClientRole",
},
],
},
"Type": "AWS::IAM::Policy",
},
"UserPoolClientLogPolicy": {
"DependsOn": [
"UserPoolClientLambdaPolicy",
],
"Properties": {
"PolicyDocument": {
"Statement": [
{
"Action": [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents",
],
"Effect": "Allow",
"Resource": {
"Fn::Sub": [
"arn:aws:logs:\${region}:\${account}:log-group:/aws/lambda/\${lambda}:log-stream:*",
{
"account": {
"Ref": "AWS::AccountId",
},
"lambda": {
"Ref": "UserPoolClientLambda",
},
"region": {
"Ref": "AWS::Region",
},
},
],
},
},
],
"Version": "2012-10-17",
},
"PolicyName": "extaut87063394_userpoolclient_lambda_log_policy",
"Roles": [
{
"Ref": "UserPoolClientRole",
},
],
},
"Type": "AWS::IAM::Policy",
},
"UserPoolClientRole": {
"DependsOn": [
"UserPoolClient",
Expand Down
Loading

0 comments on commit 3eab8be

Please sign in to comment.