-
Notifications
You must be signed in to change notification settings - Fork 80
/
serverless.yml
60 lines (55 loc) · 1.46 KB
/
serverless.yml
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
service:
name: serverless-auth0-authorizer
plugins:
- serverless-bundle
provider:
name: aws
runtime: nodejs12.x
memorySize: 128
environment:
AUTH0_PUBLIC_KEY: ${file(secret.pem)}
functions:
auth:
handler: src/handlers/auth.handler
cors: true
publicEndpoint:
handler: src/handlers/public.handler
events:
- http:
path: public
method: POST
cors: true
privateEndpoint:
handler: src/handlers/private.handler
events:
- http:
path: private
method: POST
authorizer: auth
cors: true
resources:
Resources:
# This response is needed for custom authorizer failures cors support ¯\_(ツ)_/¯
GatewayResponse:
Type: 'AWS::ApiGateway::GatewayResponse'
Properties:
ResponseParameters:
gatewayresponse.header.Access-Control-Allow-Origin: "'*'"
gatewayresponse.header.Access-Control-Allow-Headers: "'*'"
ResponseType: EXPIRED_TOKEN
RestApiId:
Ref: 'ApiGatewayRestApi'
StatusCode: '401'
AuthFailureGatewayResponse:
Type: 'AWS::ApiGateway::GatewayResponse'
Properties:
ResponseParameters:
gatewayresponse.header.Access-Control-Allow-Origin: "'*'"
gatewayresponse.header.Access-Control-Allow-Headers: "'*'"
ResponseType: UNAUTHORIZED
RestApiId:
Ref: 'ApiGatewayRestApi'
StatusCode: '401'
custom:
bundle:
linting: false