From 70566e36af001c79f544b9704fcfa4abd265e3e3 Mon Sep 17 00:00:00 2001 From: Manish Kumar Date: Sun, 19 Jul 2020 00:10:39 +0530 Subject: [PATCH] Removed Amplify --- amplify/.config/project-config.json | 17 - amplify/backend/auth/psipher/parameters.json | 64 ---- .../psipher-cloudformation-template.yml | 351 ------------------ amplify/backend/backend-config.json | 9 - amplify/team-provider-info.json | 20 - src/aws-exports.js | 13 + 6 files changed, 13 insertions(+), 461 deletions(-) delete mode 100644 amplify/.config/project-config.json delete mode 100644 amplify/backend/auth/psipher/parameters.json delete mode 100644 amplify/backend/auth/psipher/psipher-cloudformation-template.yml delete mode 100644 amplify/backend/backend-config.json delete mode 100644 amplify/team-provider-info.json create mode 100644 src/aws-exports.js diff --git a/amplify/.config/project-config.json b/amplify/.config/project-config.json deleted file mode 100644 index e9bf4cb1..00000000 --- a/amplify/.config/project-config.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "projectName": "PsipherFrontend", - "version": "3.0", - "frontend": "javascript", - "javascript": { - "framework": "react", - "config": { - "SourceDir": "src", - "DistributionDir": "build", - "BuildCommand": "yarn build", - "StartCommand": "yarn start" - } - }, - "providers": [ - "awscloudformation" - ] -} \ No newline at end of file diff --git a/amplify/backend/auth/psipher/parameters.json b/amplify/backend/auth/psipher/parameters.json deleted file mode 100644 index 55974d45..00000000 --- a/amplify/backend/auth/psipher/parameters.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "resourceNameTruncated": "psiphe9d7dae50", - "userPoolName": "psipher_user_pool", - "autoVerifiedAttributes": [ - "email" - ], - "mfaConfiguration": "OFF", - "mfaTypes": [ - "SMS Text Message" - ], - "smsAuthenticationMessage": "Your authentication code is {####}", - "smsVerificationMessage": "Your verification code is {####}", - "emailVerificationSubject": "Your verification code", - "emailVerificationMessage": "Your verification code is {####}", - "defaultPasswordPolicy": true, - "passwordPolicyMinLength": "8", - "passwordPolicyCharacters": [ - "Requires Lowercase", - "Requires Uppercase", - "Requires Numbers", - "Requires Symbols" - ], - "requiredAttributes": [ - "email" - ], - "userpoolClientGenerateSecret": true, - "userpoolClientRefreshTokenValidity": 30, - "userpoolClientWriteAttributes": [ - "email" - ], - "userpoolClientReadAttributes": [ - "email" - ], - "userpoolClientLambdaRole": "psiphe9d7dae50_userpoolclient_lambda_role", - "userpoolClientSetAttributes": false, - "useDefault": "manual", - "authSelections": "userPoolOnly", - "resourceName": "psipher", - "usernameAttributes": [ - "email" - ], - "userPoolGroups": false, - "adminQueries": false, - "triggers": "{}", - "hostedUI": false, - "userPoolGroupList": [], - "authRoleArn": { - "Fn::GetAtt": [ - "AuthRole", - "Arn" - ] - }, - "unauthRoleArn": { - "Fn::GetAtt": [ - "UnauthRole", - "Arn" - ] - }, - "parentStack": { - "Ref": "AWS::StackId" - }, - "permissions": [], - "dependsOn": [] -} \ No newline at end of file diff --git a/amplify/backend/auth/psipher/psipher-cloudformation-template.yml b/amplify/backend/auth/psipher/psipher-cloudformation-template.yml deleted file mode 100644 index 8ef5f527..00000000 --- a/amplify/backend/auth/psipher/psipher-cloudformation-template.yml +++ /dev/null @@ -1,351 +0,0 @@ -AWSTemplateFormatVersion: 2010-09-09 - -Parameters: - env: - Type: String - authRoleArn: - Type: String - unauthRoleArn: - Type: String - - - - - resourceNameTruncated: - Type: String - - userPoolName: - Type: String - - autoVerifiedAttributes: - Type: CommaDelimitedList - - mfaConfiguration: - Type: String - - mfaTypes: - Type: CommaDelimitedList - - smsAuthenticationMessage: - Type: String - - smsVerificationMessage: - Type: String - - emailVerificationSubject: - Type: String - - emailVerificationMessage: - Type: String - - defaultPasswordPolicy: - Type: String - - passwordPolicyMinLength: - Type: String - - passwordPolicyCharacters: - Type: CommaDelimitedList - - requiredAttributes: - Type: CommaDelimitedList - - userpoolClientGenerateSecret: - Type: String - - userpoolClientRefreshTokenValidity: - Type: Number - - userpoolClientWriteAttributes: - Type: CommaDelimitedList - - userpoolClientReadAttributes: - Type: CommaDelimitedList - - userpoolClientLambdaRole: - Type: String - - userpoolClientSetAttributes: - Type: String - - useDefault: - Type: String - - authSelections: - Type: String - - resourceName: - Type: String - - usernameAttributes: - Type: CommaDelimitedList - - userPoolGroups: - Type: String - - adminQueries: - Type: String - - triggers: - Type: String - - hostedUI: - Type: String - - userPoolGroupList: - Type: CommaDelimitedList - - parentStack: - Type: String - - permissions: - Type: CommaDelimitedList - - dependsOn: - Type: CommaDelimitedList - -Conditions: - ShouldNotCreateEnvResources: !Equals [ !Ref env, NONE ] - -Resources: - - - # BEGIN SNS ROLE RESOURCE - SNSRole: - # Created to allow the UserPool SMS Config to publish via the Simple Notification Service during MFA Process - Type: AWS::IAM::Role - Properties: - RoleName: !If [ShouldNotCreateEnvResources, 'psiphe9d7dae50_sns-role', !Join ['',[ 'sns', 'undefined', !Select [3, !Split ['-', !Ref 'AWS::StackName']], '-', !Ref env]]] - AssumeRolePolicyDocument: - Version: "2012-10-17" - Statement: - - Sid: "" - Effect: "Allow" - Principal: - Service: "cognito-idp.amazonaws.com" - Action: - - "sts:AssumeRole" - Condition: - StringEquals: - sts:ExternalId: psiphe9d7dae50_role_external_id - Policies: - - - PolicyName: psiphe9d7dae50-sns-policy - PolicyDocument: - Version: "2012-10-17" - Statement: - - - Effect: "Allow" - Action: - - "sns:Publish" - Resource: "*" - # BEGIN USER POOL RESOURCES - UserPool: - # Created upon user selection - # Depends on SNS Role for Arn if MFA is enabled - Type: AWS::Cognito::UserPool - UpdateReplacePolicy: Retain - Properties: - UserPoolName: !If [ShouldNotCreateEnvResources, !Ref userPoolName, !Join ['',[!Ref userPoolName, '-', !Ref env]]] - - Schema: - - - - Name: email - Required: true - Mutable: true - - - - - AutoVerifiedAttributes: !Ref autoVerifiedAttributes - - - EmailVerificationMessage: !Ref emailVerificationMessage - EmailVerificationSubject: !Ref emailVerificationSubject - - Policies: - PasswordPolicy: - MinimumLength: !Ref passwordPolicyMinLength - RequireLowercase: true - RequireNumbers: true - RequireSymbols: true - RequireUppercase: true - - UsernameAttributes: !Ref usernameAttributes - - MfaConfiguration: !Ref mfaConfiguration - SmsVerificationMessage: !Ref smsVerificationMessage - SmsConfiguration: - SnsCallerArn: !GetAtt SNSRole.Arn - ExternalId: psiphe9d7dae50_role_external_id - - - - - - - - - - - - # Updating lambda role with permissions to Cognito - - - UserPoolClientWeb: - # Created provide application access to user pool - # Depends on UserPool for ID reference - Type: "AWS::Cognito::UserPoolClient" - Properties: - ClientName: psiphe9d7dae50_app_clientWeb - - RefreshTokenValidity: !Ref userpoolClientRefreshTokenValidity - UserPoolId: !Ref UserPool - DependsOn: UserPool - UserPoolClient: - # Created provide application access to user pool - # Depends on UserPool for ID reference - Type: "AWS::Cognito::UserPoolClient" - Properties: - ClientName: psiphe9d7dae50_app_client - - GenerateSecret: !Ref userpoolClientGenerateSecret - RefreshTokenValidity: !Ref userpoolClientRefreshTokenValidity - UserPoolId: !Ref UserPool - DependsOn: UserPool - # BEGIN USER POOL LAMBDA RESOURCES - UserPoolClientRole: - # Created to execute Lambda which gets userpool app client config values - Type: 'AWS::IAM::Role' - Properties: - RoleName: !If [ShouldNotCreateEnvResources, !Ref userpoolClientLambdaRole, !Join ['',['upClientLambdaRole', 'undefined', !Select [3, !Split ['-', !Ref 'AWS::StackName']], '-', !Ref env]]] - AssumeRolePolicyDocument: - Version: '2012-10-17' - Statement: - - Effect: Allow - Principal: - Service: - - lambda.amazonaws.com - Action: - - 'sts:AssumeRole' - DependsOn: UserPoolClient - UserPoolClientLambda: - # Lambda which gets userpool app client config values - # Depends on UserPool for id - # Depends on UserPoolClientRole for role ARN - Type: 'AWS::Lambda::Function' - Properties: - Code: - ZipFile: !Join - - |+ - - - '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 - Runtime: nodejs10.x - Timeout: '300' - Role: !GetAtt - - UserPoolClientRole - - Arn - DependsOn: UserPoolClientRole - UserPoolClientLambdaPolicy: - # Sets userpool policy for the role that executes the Userpool Client Lambda - # Depends on UserPool for Arn - # Marked as depending on UserPoolClientRole for easier to understand CFN sequencing - Type: 'AWS::IAM::Policy' - Properties: - PolicyName: psiphe9d7dae50_userpoolclient_lambda_iam_policy - Roles: - - !Ref UserPoolClientRole - PolicyDocument: - Version: '2012-10-17' - Statement: - - Effect: Allow - Action: - - 'cognito-idp:DescribeUserPoolClient' - Resource: !GetAtt UserPool.Arn - DependsOn: UserPoolClientLambda - UserPoolClientLogPolicy: - # Sets log policy for the role that executes the Userpool Client Lambda - # Depends on UserPool for Arn - # Marked as depending on UserPoolClientLambdaPolicy for easier to understand CFN sequencing - Type: 'AWS::IAM::Policy' - Properties: - PolicyName: psiphe9d7dae50_userpoolclient_lambda_log_policy - Roles: - - !Ref UserPoolClientRole - PolicyDocument: - Version: 2012-10-17 - Statement: - - Effect: Allow - Action: - - 'logs:CreateLogGroup' - - 'logs:CreateLogStream' - - 'logs:PutLogEvents' - Resource: !Sub - - arn:aws:logs:${region}:${account}:log-group:/aws/lambda/${lambda}:log-stream:* - - { region: !Ref "AWS::Region", account: !Ref "AWS::AccountId", lambda: !Ref UserPoolClientLambda} - DependsOn: UserPoolClientLambdaPolicy - UserPoolClientInputs: - # Values passed to Userpool client Lambda - # Depends on UserPool for Id - # Depends on UserPoolClient for Id - # Marked as depending on UserPoolClientLambdaPolicy for easier to understand CFN sequencing - Type: 'Custom::LambdaCallout' - Properties: - ServiceToken: !GetAtt UserPoolClientLambda.Arn - clientId: !Ref UserPoolClient - userpoolId: !Ref UserPool - DependsOn: UserPoolClientLogPolicy - - - - - - - - -Outputs : - - - - - UserPoolId: - Value: !Ref 'UserPool' - Description: Id for the user pool - UserPoolName: - Value: !Ref userPoolName - AppClientIDWeb: - Value: !Ref 'UserPoolClientWeb' - Description: The user pool app client id for web - AppClientID: - Value: !Ref 'UserPoolClient' - Description: The user pool app client id - AppClientSecret: - Value: !GetAtt UserPoolClientInputs.appSecret - - - - - - - diff --git a/amplify/backend/backend-config.json b/amplify/backend/backend-config.json deleted file mode 100644 index 8044e126..00000000 --- a/amplify/backend/backend-config.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "auth": { - "psipher": { - "service": "Cognito", - "providerPlugin": "awscloudformation", - "dependsOn": [] - } - } -} \ No newline at end of file diff --git a/amplify/team-provider-info.json b/amplify/team-provider-info.json deleted file mode 100644 index 5f7aafe0..00000000 --- a/amplify/team-provider-info.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "dev": { - "awscloudformation": { - "AuthRoleName": "amplify-psipherfrontend-dev-03449-authRole", - "UnauthRoleArn": "arn:aws:iam::048831840217:role/amplify-psipherfrontend-dev-03449-unauthRole", - "AuthRoleArn": "arn:aws:iam::048831840217:role/amplify-psipherfrontend-dev-03449-authRole", - "Region": "us-east-1", - "DeploymentBucketName": "amplify-psipherfrontend-dev-03449-deployment", - "UnauthRoleName": "amplify-psipherfrontend-dev-03449-unauthRole", - "StackName": "amplify-psipherfrontend-dev-03449", - "StackId": "arn:aws:cloudformation:us-east-1:048831840217:stack/amplify-psipherfrontend-dev-03449/683bcba0-c3a9-11ea-92ee-0a4fdb0c1726", - "AmplifyAppId": "d2y46rs72xdymf" - }, - "categories": { - "auth": { - "psipher": {} - } - } - } -} \ No newline at end of file diff --git a/src/aws-exports.js b/src/aws-exports.js new file mode 100644 index 00000000..34f38059 --- /dev/null +++ b/src/aws-exports.js @@ -0,0 +1,13 @@ +/* eslint-disable */ +// WARNING: DO NOT EDIT. This file is automatically generated by AWS Amplify. It will be overwritten. + +const awsmobile = { + "aws_project_region": "us-east-1", + "aws_cognito_region": "us-east-1", + "aws_user_pools_id": "XXXXX add your own ID", + "aws_user_pools_web_client_id": "XXXXXXX Replace with your own", + "oauth": {} +}; + + +export default awsmobile;