aws-classify-server 0.1.9 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -336
- package/lib/cjs/AuthenticatedSessions.d.ts +6 -0
- package/lib/cjs/AuthenticatedSessions.js +93 -0
- package/lib/cjs/Authentication.d.ts +10 -0
- package/lib/cjs/Authentication.js +37 -0
- package/lib/cjs/ClassDef.d.ts +3 -1
- package/lib/cjs/ClassifyServerless.d.ts +17 -4
- package/lib/cjs/ClassifyServerless.js +90 -30
- package/lib/cjs/SessionStore.d.ts +3 -0
- package/lib/cjs/SessionStore.js +8 -0
- package/lib/cjs/aws-classify-common/EndPointsLogging.d.ts +1 -8
- package/lib/cjs/aws-classify-common/EndPointsLogging.js +2 -8
- package/lib/cjs/aws-classify-common/LambdaRequest.d.ts +1 -6
- package/lib/cjs/aws-classify-common/LambdaResponse.d.ts +1 -6
- package/lib/cjs/aws-classify-common/index.d.ts +1 -4
- package/lib/cjs/aws-classify-common/index.js +16 -5
- package/lib/cjs/dispatch.d.ts +4 -2
- package/lib/cjs/dispatch.js +28 -8
- package/lib/cjs/index.d.ts +3 -1
- package/lib/cjs/index.js +2 -1
- package/lib/esm/AuthenticatedSessions.d.ts +6 -0
- package/lib/esm/AuthenticatedSessions.js +85 -0
- package/lib/esm/Authentication.d.ts +10 -0
- package/lib/esm/Authentication.js +32 -0
- package/lib/esm/ClassDef.d.ts +3 -1
- package/lib/esm/ClassifyServerless.d.ts +17 -4
- package/lib/esm/ClassifyServerless.js +84 -24
- package/lib/esm/SessionStore.d.ts +3 -0
- package/lib/esm/SessionStore.js +4 -0
- package/lib/esm/aws-classify-common/EndPointsLogging.d.ts +1 -8
- package/lib/esm/aws-classify-common/EndPointsLogging.js +1 -8
- package/lib/esm/aws-classify-common/LambdaRequest.d.ts +1 -6
- package/lib/esm/aws-classify-common/LambdaResponse.d.ts +1 -6
- package/lib/esm/aws-classify-common/index.d.ts +1 -4
- package/lib/esm/aws-classify-common/index.js +2 -2
- package/lib/esm/dispatch.d.ts +4 -2
- package/lib/esm/dispatch.js +26 -7
- package/lib/esm/index.d.ts +3 -1
- package/lib/esm/index.js +1 -1
- package/package.json +20 -13
- package/yml/authentication-config.js +16 -0
- package/yml/functions-authenticated.yml +30 -0
- package/yml/provider-iam.yml +4 -1
- package/yml/resources-custom-website.yml +4 -1
- package/yml/resources-website-authenticated.yml +72 -0
- package/yml/resources-website.yml +4 -1
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
Resources:
|
|
2
|
+
CloudFrontOriginAccessIdentity:
|
|
3
|
+
Type: AWS::CloudFront::CloudFrontOriginAccessIdentity
|
|
4
|
+
Properties:
|
|
5
|
+
CloudFrontOriginAccessIdentityConfig:
|
|
6
|
+
Comment: !Join ["-", ["access-identity", !GetAtt S3Bucket.DomainName]]
|
|
7
|
+
CloudFrontDistribution:
|
|
8
|
+
Type: AWS::CloudFront::Distribution
|
|
9
|
+
DependsOn:
|
|
10
|
+
- S3Bucket
|
|
11
|
+
Properties:
|
|
12
|
+
DistributionConfig:
|
|
13
|
+
PriceClass: PriceClass_All
|
|
14
|
+
ViewerCertificate:
|
|
15
|
+
CloudFrontDefaultCertificate: true
|
|
16
|
+
Enabled: true
|
|
17
|
+
HttpVersion: http2
|
|
18
|
+
DefaultRootObject: index.html
|
|
19
|
+
Origins:
|
|
20
|
+
- Id: api
|
|
21
|
+
DomainName: !Join [".", [!Ref HttpApi, "execute-api", !Ref AWS::Region, "amazonaws.com"]]
|
|
22
|
+
CustomOriginConfig:
|
|
23
|
+
OriginProtocolPolicy: https-only
|
|
24
|
+
- Id: static
|
|
25
|
+
DomainName: !GetAtt S3Bucket.RegionalDomainName
|
|
26
|
+
S3OriginConfig:
|
|
27
|
+
OriginAccessIdentity: !Join ["", ["origin-access-identity/cloudfront/", !Ref CloudFrontOriginAccessIdentity]]
|
|
28
|
+
CacheBehaviors:
|
|
29
|
+
- PathPattern: api/*
|
|
30
|
+
TargetOriginId: api
|
|
31
|
+
# Managed-CachingDisabled and AllViewerExceptHostHeader preserve Authorization.
|
|
32
|
+
CachePolicyId: 4135ea2d-6df8-44a3-9df3-4b5a84be39ad
|
|
33
|
+
OriginRequestPolicyId: b689b0a8-53d0-40ab-baf2-68738e2966ac
|
|
34
|
+
ViewerProtocolPolicy: redirect-to-https
|
|
35
|
+
AllowedMethods: [GET, HEAD, OPTIONS, PATCH, POST, PUT, DELETE]
|
|
36
|
+
DefaultCacheBehavior:
|
|
37
|
+
TargetOriginId: static
|
|
38
|
+
# 'Managed-CachingOptimized'
|
|
39
|
+
# https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html
|
|
40
|
+
CachePolicyId: 658327ea-f89d-4fab-a63d-7e88639e58f6
|
|
41
|
+
# 'Managed-CORS-S3Origin'
|
|
42
|
+
# https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-origin-request-policies.html
|
|
43
|
+
OriginRequestPolicyId: 88a5eaf4-2fd4-4709-b370-b4c650ea3fcf
|
|
44
|
+
ViewerProtocolPolicy: redirect-to-https
|
|
45
|
+
CustomErrorResponses:
|
|
46
|
+
- ErrorCachingMinTTL: 1
|
|
47
|
+
ErrorCode: 403
|
|
48
|
+
S3Bucket:
|
|
49
|
+
Type: AWS::S3::Bucket
|
|
50
|
+
Properties:
|
|
51
|
+
BucketName: ${self:custom.bucketName}
|
|
52
|
+
S3BucketPolicy:
|
|
53
|
+
Type: AWS::S3::BucketPolicy
|
|
54
|
+
Properties:
|
|
55
|
+
Bucket: !Ref S3Bucket
|
|
56
|
+
PolicyDocument:
|
|
57
|
+
Statement:
|
|
58
|
+
- Effect: Allow
|
|
59
|
+
Action: "s3:GetObject"
|
|
60
|
+
Resource: !Join ["", [!GetAtt S3Bucket.Arn, "/*"]]
|
|
61
|
+
Principal:
|
|
62
|
+
CanonicalUser: !GetAtt CloudFrontOriginAccessIdentity.S3CanonicalUserId
|
|
63
|
+
Outputs:
|
|
64
|
+
ContentBucket:
|
|
65
|
+
Description: Content bucket
|
|
66
|
+
Value: !Ref S3Bucket
|
|
67
|
+
CloudFrontId:
|
|
68
|
+
Description: CloudFront Id
|
|
69
|
+
Value: !Ref CloudFrontDistribution
|
|
70
|
+
WebsiteUrl:
|
|
71
|
+
Description: Cloudfront URL
|
|
72
|
+
Value: !GetAtt CloudFrontDistribution.DomainName
|
|
@@ -67,9 +67,12 @@ Resources:
|
|
|
67
67
|
Principal:
|
|
68
68
|
CanonicalUser: !GetAtt CloudFrontOriginAccessIdentity.S3CanonicalUserId
|
|
69
69
|
Outputs:
|
|
70
|
+
ContentBucket:
|
|
71
|
+
Description: Content bucket
|
|
72
|
+
Value: !Ref S3Bucket
|
|
70
73
|
CloudFrontId:
|
|
71
74
|
Description: CloudFront Id
|
|
72
75
|
Value: !Ref CloudFrontDistribution
|
|
73
76
|
WebsiteUrl:
|
|
74
77
|
Description: Cloudfront URL
|
|
75
|
-
Value: !GetAtt CloudFrontDistribution.DomainName
|
|
78
|
+
Value: !GetAtt CloudFrontDistribution.DomainName
|