-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserverless.yml
More file actions
189 lines (175 loc) · 4.96 KB
/
serverless.yml
File metadata and controls
189 lines (175 loc) · 4.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
service: eml-be-users
frameworkVersion: "2"
# variablesResolutionMode: 20210219
useDotenv: true
plugins:
- serverless-webpack
- serverless-dynamodb-local
- serverless-offline-dotenv
- serverless-offline
custom:
webpack:
webpackConfig: "./webpack.config.js"
includeModules:
forceExclude:
- aws-sdk
packager: "npm"
serverless-offline:
httpPort: 4000
ignoreJWTSignature: true
provider:
name: aws
region: eu-central-1
# profile: swexception
runtime: nodejs12.x
lambdaHashingVersion: "20201221"
stage: ${opt:stage, 'dev'}
apiGateway:
restApiId: 95kq9eggu9
restApiRootResourceId: zsd84g8moe
environment:
AWS_NODEJS_CONNECTION_REUSE_ENABLED: "1"
DOMAIN_SUFFIX: eml-be
CALLBACK_URL: http://localhost:3000
AWS_USER_POOL_ID: !Ref CognitoUserPool
REGION: ${self:provider.region}
AWS_COGNITO_ACCESS_KEY_ID: ${env:AWS_COGNITO_ACCESS_KEY_ID}
AWS_COGNITO_SECRET_ACCESS_KEY: ${env:AWS_COGNITO_SECRET_ACCESS_KEY}
iam:
role:
statements:
- Effect: Allow
Action:
- dynamodb:*
- s3:*
- cognito-idp:*
Resource: "*"
functions:
customers:
handler: "src/customers/getCustomers.HANDLER"
events:
- http:
path: /users/customers
method: GET
cors: true
customer:
handler: "src/customers/getCustomer.HANDLER"
events:
- http:
path: /users/customers/{username}
method: GET
cors: true
checkJWT:
handler: "src/check/checkJWT.HANDLER"
events:
- http:
path: /users/check/{token}
method: GET
cors: true
checkCustomerJWT:
handler: "src/check/checkCustomerJWT.HANDLER"
events:
- http:
path: /users/customers/check/{token}
method: GET
cors: true
checkVendorJWT:
handler: "src/check/checkVendorJWT.HANDLER"
events:
- http:
path: /users/vendors/check/{token}
method: GET
cors: true
resources:
Resources:
CognitoUserPool:
Type: AWS::Cognito::UserPool
Properties:
UserPoolName: EML-user-pool-${opt:stage, self:provider.stage}
UsernameAttributes:
- email
AutoVerifiedAttributes:
- email
Policies:
PasswordPolicy:
MinimumLength: 8
RequireLowercase: false
RequireNumbers: false
RequireSymbols: false
RequireUppercase: false
# TemporaryPasswordValidityDays: 0
VerificationMessageTemplate:
DefaultEmailOption: CONFIRM_WITH_CODE # CONFIRM_WITH_CODE oppure CONFIRM_WITH_LINK
EmailSubject: "EmporioLambda - Codice di verifica"
EmailSubjectByLink: "EmporioLambda - Link di verifica"
EmailMessage: "Ecco il tuo codice di verifica: <b>{####}</b>"
EmailMessageByLink: "Clicca il seguente link per verificare l'email: {##CLICCA QUI##}"
AccountRecoverySetting:
RecoveryMechanisms:
- Name: verified_email
Priority: 1
DeviceConfiguration:
DeviceOnlyRememberedOnUserPrompt: false
Schema:
- Mutable: true
Required: true
Name: name
- Mutable: true
Required: true
Name: family_name
- Mutable: true
Required: true
Name: email
- Mutable: true
Required: false
Name: phone_number
- Mutable: true
Required: false
Name: picture
- Mutable: true
Required: false
Name: gender
CognitoUserPoolClient:
Type: AWS::Cognito::UserPoolClient
Properties:
ClientName: EML-user-pool-client-${opt:stage, self:provider.stage}
AllowedOAuthFlows:
- code
- implicit
AllowedOAuthFlowsUserPoolClient: true
AllowedOAuthScopes:
- phone
- email
- openid
- profile
- aws.cognito.signin.user.admin
UserPoolId:
Ref: CognitoUserPool
CallbackURLs:
- ${self:provider.environment.CALLBACK_URL}
DefaultRedirectURI: ${self:provider.environment.CALLBACK_URL}
ExplicitAuthFlows:
- ALLOW_CUSTOM_AUTH
- ALLOW_USER_SRP_AUTH
- ALLOW_REFRESH_TOKEN_AUTH
TokenValidityUnits:
AccessToken: hours
IdToken: hours
RefreshToken: days
AccessTokenValidity: 1 # default: 1 ora
IdTokenValidity: 1 # default: 1 ora
RefreshTokenValidity: 30 # default: 30 giorni
CognitoGroupClient:
Type: AWS::Cognito::UserPoolGroup
Properties:
Description: Client
GroupName: Client
UserPoolId:
Ref: CognitoUserPool
CognitoGroupAdmin:
Type: AWS::Cognito::UserPoolGroup
Properties:
Description: Venditori
GroupName: Admin
UserPoolId:
Ref: CognitoUserPool