Reconfigured AWS

This commit is contained in:
Aaron Sun 2020-12-16 19:33:20 -08:00
parent 7a52792fd3
commit 4c3f04bc3f
12 changed files with 223 additions and 104 deletions

19
.gitignore vendored
View File

@ -93,3 +93,22 @@ Lambdas/Lists/target/surefire-reports/TEST-TestInputUtils.xml
Lambdas/Scraping/scraperConfigs.json Lambdas/Scraping/scraperConfigs.json
Lambdas/Scraping/dbConfigs.json Lambdas/Scraping/dbConfigs.json
Lambdas/Scraping/artifacts/* Lambdas/Scraping/artifacts/*
#amplify
amplify/\#current-cloud-backend
amplify/.config/local-*
amplify/logs
amplify/mock-data
amplify/backend/amplify-meta.json
amplify/backend/awscloudformation
amplify/backend/.temp
build/
dist/
node_modules/
aws-exports.js
awsconfiguration.json
amplifyconfiguration.json
amplify-build-config.json
amplify-gradle-config.json
amplifytools.xcconfig
.secret-*

11
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,11 @@
{
"files.exclude": {
"amplify/.config": true,
"amplify/**/*-parameters.json": true,
"amplify/**/amplify.state": true,
"amplify/**/transform.conf.json": true,
"amplify/#current-cloud-backend": true,
"amplify/backend/amplify-meta.json": true,
"amplify/backend/awscloudformation": true
}
}

View File

@ -1,3 +1,3 @@
{ {
"userPoolId": "us-east-2_MFgSVKQMd", "userPoolId": " us-east-2_hcxKr2fA1"
} }

5
Listify/.gitignore vendored
View File

@ -16,9 +16,11 @@
#amplify #amplify
amplify/\#current-cloud-backend amplify/\#current-cloud-backend
amplify/.config/local-* amplify/.config/local-*
amplify/logs
amplify/mock-data amplify/mock-data
amplify/backend/amplify-meta.json amplify/backend/amplify-meta.json
amplify/backend/awscloudformation amplify/backend/awscloudformation
amplify/backend/.temp
build/ build/
dist/ dist/
node_modules/ node_modules/
@ -27,4 +29,5 @@ awsconfiguration.json
amplifyconfiguration.json amplifyconfiguration.json
amplify-build-config.json amplify-build-config.json
amplify-gradle-config.json amplify-gradle-config.json
amplifytools.xcconfig amplifytools.xcconfig
.secret-*

11
Listify/.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,11 @@
{
"files.exclude": {
"amplify/.config": true,
"amplify/**/*-parameters.json": true,
"amplify/**/amplify.state": true,
"amplify/**/transform.conf.json": true,
"amplify/#current-cloud-backend": true,
"amplify/backend/amplify-meta.json": true,
"amplify/backend/awscloudformation": true
}
}

View File

@ -7,106 +7,157 @@ Parameters:
Type: String Type: String
unauthRoleArn: unauthRoleArn:
Type: String Type: String
identityPoolName: identityPoolName:
Type: String Type: String
allowUnauthenticatedIdentities: allowUnauthenticatedIdentities:
Type: String Type: String
resourceNameTruncated: resourceNameTruncated:
Type: String Type: String
userPoolName: userPoolName:
Type: String Type: String
autoVerifiedAttributes: autoVerifiedAttributes:
Type: CommaDelimitedList Type: CommaDelimitedList
mfaConfiguration: mfaConfiguration:
Type: String Type: String
mfaTypes: mfaTypes:
Type: CommaDelimitedList Type: CommaDelimitedList
smsAuthenticationMessage: smsAuthenticationMessage:
Type: String Type: String
smsVerificationMessage: smsVerificationMessage:
Type: String Type: String
emailVerificationSubject: emailVerificationSubject:
Type: String Type: String
emailVerificationMessage: emailVerificationMessage:
Type: String Type: String
defaultPasswordPolicy: defaultPasswordPolicy:
Type: String Type: String
passwordPolicyMinLength: passwordPolicyMinLength:
Type: Number Type: Number
passwordPolicyCharacters: passwordPolicyCharacters:
Type: CommaDelimitedList Type: CommaDelimitedList
requiredAttributes: requiredAttributes:
Type: CommaDelimitedList Type: CommaDelimitedList
userpoolClientGenerateSecret: userpoolClientGenerateSecret:
Type: String Type: String
userpoolClientRefreshTokenValidity: userpoolClientRefreshTokenValidity:
Type: Number Type: Number
userpoolClientWriteAttributes: userpoolClientWriteAttributes:
Type: CommaDelimitedList Type: CommaDelimitedList
userpoolClientReadAttributes: userpoolClientReadAttributes:
Type: CommaDelimitedList Type: CommaDelimitedList
userpoolClientLambdaRole: userpoolClientLambdaRole:
Type: String Type: String
userpoolClientSetAttributes: userpoolClientSetAttributes:
Type: String Type: String
sharedId: sharedId:
Type: String Type: String
resourceName: resourceName:
Type: String Type: String
authSelections: authSelections:
Type: String Type: String
useDefault: useDefault:
Type: String Type: String
usernameAttributes: usernameAttributes:
Type: CommaDelimitedList Type: CommaDelimitedList
userPoolGroups:
Type: String
adminQueries:
Type: String
triggers: triggers:
Type: String Type: String
hostedUI:
Type: String
userPoolGroupList: userPoolGroupList:
Type: CommaDelimitedList Type: CommaDelimitedList
serviceName: serviceName:
Type: String Type: String
usernameCaseSensitive:
Type: String
parentStack: parentStack:
Type: String Type: String
permissions: permissions:
Type: CommaDelimitedList Type: CommaDelimitedList
dependsOn: dependsOn:
Type: CommaDelimitedList Type: CommaDelimitedList
Conditions: Conditions:
ShouldNotCreateEnvResources: !Equals [ !Ref env, NONE ] ShouldNotCreateEnvResources: !Equals [ !Ref env, NONE ]
@ -114,32 +165,32 @@ Resources:
# BEGIN SNS ROLE RESOURCE # BEGIN SNS ROLE RESOURCE
SNSRole: SNSRole:
# Created to allow the UserPool SMS Config to publish via the Simple Notification Service during MFA Process # Created to allow the UserPool SMS Config to publish via the Simple Notification Service during MFA Process
Type: AWS::IAM::Role Type: AWS::IAM::Role
Properties: Properties:
RoleName: !If [ShouldNotCreateEnvResources, 'listiff4fad454_sns-role', !Join ['',[ 'sns', 'f4fad454', !Select [3, !Split ['-', !Ref 'AWS::StackName']], '-', !Ref env]]] RoleName: !If [ShouldNotCreateEnvResources, 'listif0c093a99_sns-role', !Join ['',[ 'sns', '0c093a99', !Select [3, !Split ['-', !Ref 'AWS::StackName']], '-', !Ref env]]]
AssumeRolePolicyDocument: AssumeRolePolicyDocument:
Version: "2012-10-17" Version: "2012-10-17"
Statement: Statement:
- Sid: "" - Sid: ""
Effect: "Allow" Effect: "Allow"
Principal: Principal:
Service: "cognito-idp.amazonaws.com" Service: "cognito-idp.amazonaws.com"
Action: Action:
- "sts:AssumeRole" - "sts:AssumeRole"
Condition: Condition:
StringEquals: StringEquals:
sts:ExternalId: listiff4fad454_role_external_id sts:ExternalId: listif0c093a99_role_external_id
Policies: Policies:
- -
PolicyName: listiff4fad454-sns-policy PolicyName: listif0c093a99-sns-policy
PolicyDocument: PolicyDocument:
Version: "2012-10-17" Version: "2012-10-17"
Statement: Statement:
- -
Effect: "Allow" Effect: "Allow"
Action: Action:
- "sns:Publish" - "sns:Publish"
Resource: "*" Resource: "*"
# BEGIN USER POOL RESOURCES # BEGIN USER POOL RESOURCES
@ -151,7 +202,11 @@ Resources:
Properties: Properties:
UserPoolName: !If [ShouldNotCreateEnvResources, !Ref userPoolName, !Join ['',[!Ref userPoolName, '-', !Ref env]]] UserPoolName: !If [ShouldNotCreateEnvResources, !Ref userPoolName, !Join ['',[!Ref userPoolName, '-', !Ref env]]]
Schema:
UsernameConfiguration:
CaseSensitive: false
Schema:
- -
Name: email Name: email
@ -166,7 +221,7 @@ Resources:
EmailVerificationMessage: !Ref emailVerificationMessage EmailVerificationMessage: !Ref emailVerificationMessage
EmailVerificationSubject: !Ref emailVerificationSubject EmailVerificationSubject: !Ref emailVerificationSubject
Policies: Policies:
PasswordPolicy: PasswordPolicy:
MinimumLength: !Ref passwordPolicyMinLength MinimumLength: !Ref passwordPolicyMinLength
@ -176,23 +231,23 @@ Resources:
RequireUppercase: false RequireUppercase: false
UsernameAttributes: !Ref usernameAttributes UsernameAttributes: !Ref usernameAttributes
MfaConfiguration: !Ref mfaConfiguration MfaConfiguration: !Ref mfaConfiguration
SmsVerificationMessage: !Ref smsVerificationMessage SmsVerificationMessage: !Ref smsVerificationMessage
SmsConfiguration: SmsConfiguration:
SnsCallerArn: !GetAtt SNSRole.Arn SnsCallerArn: !GetAtt SNSRole.Arn
ExternalId: listiff4fad454_role_external_id ExternalId: listif0c093a99_role_external_id
# Updating lambda role with permissions to Cognito # Updating lambda role with permissions to Cognito
@ -201,7 +256,7 @@ Resources:
# Depends on UserPool for ID reference # Depends on UserPool for ID reference
Type: "AWS::Cognito::UserPoolClient" Type: "AWS::Cognito::UserPoolClient"
Properties: Properties:
ClientName: listiff4fad454_app_clientWeb ClientName: listif0c093a99_app_clientWeb
RefreshTokenValidity: !Ref userpoolClientRefreshTokenValidity RefreshTokenValidity: !Ref userpoolClientRefreshTokenValidity
UserPoolId: !Ref UserPool UserPoolId: !Ref UserPool
@ -211,7 +266,7 @@ Resources:
# Depends on UserPool for ID reference # Depends on UserPool for ID reference
Type: "AWS::Cognito::UserPoolClient" Type: "AWS::Cognito::UserPoolClient"
Properties: Properties:
ClientName: listiff4fad454_app_client ClientName: listif0c093a99_app_client
GenerateSecret: !Ref userpoolClientGenerateSecret GenerateSecret: !Ref userpoolClientGenerateSecret
RefreshTokenValidity: !Ref userpoolClientRefreshTokenValidity RefreshTokenValidity: !Ref userpoolClientRefreshTokenValidity
@ -222,7 +277,7 @@ Resources:
# Created to execute Lambda which gets userpool app client config values # Created to execute Lambda which gets userpool app client config values
Type: 'AWS::IAM::Role' Type: 'AWS::IAM::Role'
Properties: Properties:
RoleName: !If [ShouldNotCreateEnvResources, !Ref userpoolClientLambdaRole, !Join ['',['upClientLambdaRole', 'f4fad454', !Select [3, !Split ['-', !Ref 'AWS::StackName']], '-', !Ref env]]] RoleName: !If [ShouldNotCreateEnvResources, !Ref userpoolClientLambdaRole, !Join ['',['upClientLambdaRole', '0c093a99', !Select [3, !Split ['-', !Ref 'AWS::StackName']], '-', !Ref env]]]
AssumeRolePolicyDocument: AssumeRolePolicyDocument:
Version: '2012-10-17' Version: '2012-10-17'
Statement: Statement:
@ -240,7 +295,7 @@ Resources:
Type: 'AWS::Lambda::Function' Type: 'AWS::Lambda::Function'
Properties: Properties:
Code: Code:
ZipFile: !Join ZipFile: !Join
- |+ - |+
- - 'const response = require(''cfn-response'');' - - 'const response = require(''cfn-response'');'
- 'const aws = require(''aws-sdk'');' - 'const aws = require(''aws-sdk'');'
@ -256,7 +311,7 @@ Resources:
- ' };' - ' };'
- ' identity.describeUserPoolClient(params).promise()' - ' identity.describeUserPoolClient(params).promise()'
- ' .then((res) => {' - ' .then((res) => {'
- ' response.send(event, context, response.SUCCESS, {''appSecret'': res.UserPoolClient.ClientSecret});' - ' response.send(event, context, response.SUCCESS, {''appSecret'': res.UserPoolClient.ClientSecret});'
- ' })' - ' })'
- ' .catch((err) => {' - ' .catch((err) => {'
- ' response.send(event, context, response.FAILED, {err});' - ' response.send(event, context, response.FAILED, {err});'
@ -266,7 +321,7 @@ Resources:
Handler: index.handler Handler: index.handler
Runtime: nodejs10.x Runtime: nodejs10.x
Timeout: '300' Timeout: '300'
Role: !GetAtt Role: !GetAtt
- UserPoolClientRole - UserPoolClientRole
- Arn - Arn
DependsOn: UserPoolClientRole DependsOn: UserPoolClientRole
@ -276,8 +331,8 @@ Resources:
# Marked as depending on UserPoolClientRole for easier to understand CFN sequencing # Marked as depending on UserPoolClientRole for easier to understand CFN sequencing
Type: 'AWS::IAM::Policy' Type: 'AWS::IAM::Policy'
Properties: Properties:
PolicyName: listiff4fad454_userpoolclient_lambda_iam_policy PolicyName: listif0c093a99_userpoolclient_lambda_iam_policy
Roles: Roles:
- !Ref UserPoolClientRole - !Ref UserPoolClientRole
PolicyDocument: PolicyDocument:
Version: '2012-10-17' Version: '2012-10-17'
@ -293,8 +348,8 @@ Resources:
# Marked as depending on UserPoolClientLambdaPolicy for easier to understand CFN sequencing # Marked as depending on UserPoolClientLambdaPolicy for easier to understand CFN sequencing
Type: 'AWS::IAM::Policy' Type: 'AWS::IAM::Policy'
Properties: Properties:
PolicyName: listiff4fad454_userpoolclient_lambda_log_policy PolicyName: listif0c093a99_userpoolclient_lambda_log_policy
Roles: Roles:
- !Ref UserPoolClientRole - !Ref UserPoolClientRole
PolicyDocument: PolicyDocument:
Version: 2012-10-17 Version: 2012-10-17
@ -304,10 +359,10 @@ Resources:
- 'logs:CreateLogGroup' - 'logs:CreateLogGroup'
- 'logs:CreateLogStream' - 'logs:CreateLogStream'
- 'logs:PutLogEvents' - 'logs:PutLogEvents'
Resource: !Sub Resource: !Sub
- arn:aws:logs:${region}:${account}:log-group:/aws/lambda/${lambda}:log-stream:* - arn:aws:logs:${region}:${account}:log-group:/aws/lambda/${lambda}:log-stream:*
- { region: !Ref "AWS::Region", account: !Ref "AWS::AccountId", lambda: !Ref UserPoolClientLambda} - { region: !Ref "AWS::Region", account: !Ref "AWS::AccountId", lambda: !Ref UserPoolClientLambda}
DependsOn: UserPoolClientLambdaPolicy DependsOn: UserPoolClientLambdaPolicy
UserPoolClientInputs: UserPoolClientInputs:
# Values passed to Userpool client Lambda # Values passed to Userpool client Lambda
# Depends on UserPool for Id # Depends on UserPool for Id
@ -328,12 +383,12 @@ Resources:
# BEGIN IDENTITY POOL RESOURCES # BEGIN IDENTITY POOL RESOURCES
IdentityPool: IdentityPool:
# Always created # Always created
Type: AWS::Cognito::IdentityPool Type: AWS::Cognito::IdentityPool
Properties: Properties:
IdentityPoolName: !If [ShouldNotCreateEnvResources, 'listifyf4fad454_identitypool_f4fad454', !Join ['',['listifyf4fad454_identitypool_f4fad454', '__', !Ref env]]] IdentityPoolName: !If [ShouldNotCreateEnvResources, 'listify0c093a990c093a99_identitypool_6bcaf6ac', !Join ['',['listify0c093a990c093a99_identitypool_6bcaf6ac', '__', !Ref env]]]
CognitoIdentityProviders: CognitoIdentityProviders:
- ClientId: !Ref UserPoolClient - ClientId: !Ref UserPoolClient
@ -346,16 +401,16 @@ Resources:
- { region: !Ref "AWS::Region", client: !Ref UserPool} - { region: !Ref "AWS::Region", client: !Ref UserPool}
AllowUnauthenticatedIdentities: !Ref allowUnauthenticatedIdentities AllowUnauthenticatedIdentities: !Ref allowUnauthenticatedIdentities
DependsOn: UserPoolClientInputs
DependsOn: UserPoolClientInputs
IdentityPoolRoleMap: IdentityPoolRoleMap:
# Created to map Auth and Unauth roles to the identity pool # Created to map Auth and Unauth roles to the identity pool
# Depends on Identity Pool for ID ref # Depends on Identity Pool for ID ref
Type: AWS::Cognito::IdentityPoolRoleAttachment Type: AWS::Cognito::IdentityPoolRoleAttachment
Properties: Properties:
IdentityPoolId: !Ref IdentityPool IdentityPoolId: !Ref IdentityPool
Roles: Roles:
unauthenticated: !Ref unauthRoleArn unauthenticated: !Ref unauthRoleArn
@ -369,7 +424,7 @@ Outputs :
Value: !Ref 'IdentityPool' Value: !Ref 'IdentityPool'
Description: Id for the identity pool Description: Id for the identity pool
IdentityPoolName: IdentityPoolName:
Value: !GetAtt IdentityPool.Name Value: !GetAtt IdentityPool.Name
@ -388,9 +443,9 @@ Outputs :
AppClientSecret: AppClientSecret:
Value: !GetAtt UserPoolClientInputs.appSecret Value: !GetAtt UserPoolClientInputs.appSecret

View File

@ -1,8 +1,8 @@
{ {
"identityPoolName": "listifyf4fad454_identitypool_f4fad454", "identityPoolName": "listify0c093a990c093a99_identitypool_6bcaf6ac",
"allowUnauthenticatedIdentities": true, "allowUnauthenticatedIdentities": false,
"resourceNameTruncated": "listiff4fad454", "resourceNameTruncated": "listif0c093a99",
"userPoolName": "listifyf4fad454_userpool_f4fad454", "userPoolName": "listify0c093a99_userpool_0c093a99",
"autoVerifiedAttributes": [ "autoVerifiedAttributes": [
"email" "email"
], ],
@ -14,7 +14,7 @@
"smsVerificationMessage": "Your verification code is {####}", "smsVerificationMessage": "Your verification code is {####}",
"emailVerificationSubject": "Your verification code", "emailVerificationSubject": "Your verification code",
"emailVerificationMessage": "Your verification code is {####}", "emailVerificationMessage": "Your verification code is {####}",
"defaultPasswordPolicy": false, "defaultPasswordPolicy": true,
"passwordPolicyMinLength": 8, "passwordPolicyMinLength": 8,
"passwordPolicyCharacters": [], "passwordPolicyCharacters": [],
"requiredAttributes": [ "requiredAttributes": [
@ -28,10 +28,10 @@
"userpoolClientReadAttributes": [ "userpoolClientReadAttributes": [
"email" "email"
], ],
"userpoolClientLambdaRole": "listiff4fad454_userpoolclient_lambda_role", "userpoolClientLambdaRole": "listif0c093a99_userpoolclient_lambda_role",
"userpoolClientSetAttributes": false, "userpoolClientSetAttributes": false,
"sharedId": "f4fad454", "sharedId": "0c093a99",
"resourceName": "listifyf4fad454", "resourceName": "listify0c093a990c093a99",
"authSelections": "identityPoolAndUserPool", "authSelections": "identityPoolAndUserPool",
"authRoleArn": { "authRoleArn": {
"Fn::GetAtt": [ "Fn::GetAtt": [
@ -49,9 +49,13 @@
"usernameAttributes": [ "usernameAttributes": [
"email" "email"
], ],
"userPoolGroups": false,
"adminQueries": false,
"triggers": "{}", "triggers": "{}",
"hostedUI": false,
"userPoolGroupList": [], "userPoolGroupList": [],
"serviceName": "Cognito", "serviceName": "Cognito",
"usernameCaseSensitive": false,
"parentStack": { "parentStack": {
"Ref": "AWS::StackId" "Ref": "AWS::StackId"
}, },

View File

@ -1,12 +1,10 @@
{ {
"auth": { "auth": {
"listifyf4fad454": { "listify0c093a990c093a99": {
"service": "Cognito", "service": "Cognito",
"providerPlugin": "awscloudformation", "providerPlugin": "awscloudformation",
"dependsOn": [], "dependsOn": [],
"customAuth": false "customAuth": false
} }
}, }
"function": {},
"api": {}
} }

View File

@ -1,3 +1,19 @@
{ {
"features": {} "features": {
"graphqltransformer": {
"addmissingownerfields": true,
"validatetypenamereservedwords": true,
"useexperimentalpipelinedtransformer": false,
"enableiterativegsiupdates": false
},
"frontend-ios": {
"enablexcodeintegration": true
},
"auth": {
"enablecaseinsensitivity": true
},
"codegen": {
"useappsyncmodelgenplugin": true
}
}
} }

View File

@ -1,19 +1,19 @@
{ {
"dev": { "dev": {
"awscloudformation": { "awscloudformation": {
"AuthRoleName": "amplify-listify-dev-134836-authRole", "AuthRoleName": "amplify-listify-dev-175235-authRole",
"UnauthRoleArn": "arn:aws:iam::569815541706:role/amplify-listify-dev-134836-unauthRole", "UnauthRoleArn": "arn:aws:iam::683822751040:role/amplify-listify-dev-175235-unauthRole",
"AuthRoleArn": "arn:aws:iam::569815541706:role/amplify-listify-dev-134836-authRole", "AuthRoleArn": "arn:aws:iam::683822751040:role/amplify-listify-dev-175235-authRole",
"Region": "us-east-2", "Region": "us-east-2",
"DeploymentBucketName": "amplify-listify-dev-134836-deployment", "DeploymentBucketName": "amplify-listify-dev-175235-deployment",
"UnauthRoleName": "amplify-listify-dev-134836-unauthRole", "UnauthRoleName": "amplify-listify-dev-175235-unauthRole",
"StackName": "amplify-listify-dev-134836", "StackName": "amplify-listify-dev-175235",
"StackId": "arn:aws:cloudformation:us-east-2:569815541706:stack/amplify-listify-dev-134836/5980b520-faa0-11ea-a89c-0650659cf0f8", "StackId": "arn:aws:cloudformation:us-east-2:683822751040:stack/amplify-listify-dev-175235/8b09fbb0-400a-11eb-bec3-0af2d26319e4",
"AmplifyAppId": "dbnznhwtkbqz6" "AmplifyAppId": "diphjs0cwsd7r"
}, },
"categories": { "categories": {
"auth": { "auth": {
"listifyf4fad454": {} "listify0c093a990c093a99": {}
} }
} }
} }

View File

@ -57,6 +57,7 @@ public class AuthManager {
if (authSession.isSignedIn() == false) { if (authSession.isSignedIn() == false) {
return ""; return "";
} }
System.out.println(authSession.getUserPoolTokens().getValue().getIdToken());
return authSession.getUserPoolTokens().getValue().getIdToken(); return authSession.getUserPoolTokens().getValue().getIdToken();
} }

View File

@ -12,7 +12,8 @@ import java.io.IOException;
public class Requestor { public class Requestor {
private final String DEV_BASEURL = "https://datoh7woc9.execute-api.us-east-2.amazonaws.com/Development"; //API Gateway ID
private final String DEV_BASEURL = "https://u7g2t7ok4a.execute-api.us-east-2.amazonaws.com/ListifyStage";
AuthManager authManager; AuthManager authManager;
String apiKey; String apiKey;