You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,7 +31,7 @@ cd myService && serverless deploy
31
31
32
32
## Tutorial: simple example to use S4
33
33
34
-
Let's use S4 to implement a file upload/download service with a trivial authorization mechanism. Every user that has the string "allowMeToUpload" in their name can upload. With "allowMeToDownload" they can download any previously uploaded file. It is the "allowMe" example in S4 repository.
34
+
Let's use S4 to implement a file upload/download service with a trivial authorization mechanism. Every user that has the string "allowMeToUpload" in their token can upload. With "allowMeToDownload" they can download any previously uploaded file. It is the "allowMe" example in S4 repository.
35
35
36
36
### Quickly set up S4 and test "allowMe" example
37
37
@@ -40,8 +40,8 @@ The allow me examples in the [examples](examples)
40
40
### The getUploadUrlAuthorizer Lambda
41
41
42
42
This Api Gateway Lambda custom authorizer checks that the user is allowed to upload a file and invoke another Lambda to generate a signed upload URL.
43
-
**What is necessary to implement?** The access control strategy in the `getUploadUrlAuthorizer` code. Currently it uses the queryStringParameters of the request but it could be any [Api Gateway Lambda custom authorizer](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-use-lambda-authorizer.html).
44
-
**What does it do in the example?** The lambda is triggered by an API Gateway Get event with a query string parameter name that should containe "allowMeToUpload" to request and return the download url.
43
+
**What is necessary to implement?** The access control strategy in the `getUploadUrlAuthorizer` code. Currently it uses the token in the Authorization header of the request but it could be any [Api Gateway Lambda custom authorizer](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-use-lambda-authorizer.html).
44
+
**What does it do in the example?** The lambda is triggered by an API Gateway Get event with a token that should contain "allowMeToUpload" to request and return the download url.
@@ -56,8 +56,8 @@ This Lambda is triggered by the `FILE_UPLOADED` EventBridge event and receives t
56
56
### The getDownloadUrlAuthorizer Lambda
57
57
58
58
This Api Gateway Lambda custom authorizer checks that the user is allowed to download the file, requested by its file prefix, and invoke another Lambda to generate a signed download URL.
59
-
**What is necessary to implement?** The access control strategy in the `getDownloadUrlAuthorizer` code. Currently it uses the queryStringParameters of the request but it could be any [Api Gateway Lambda custom authorizer](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-use-lambda-authorizer.html).
60
-
**What does it do in the example?** The lambda is triggered by an API Gateway Get event with a query string parameter name that should containe "allowMeToDownload" to request and return the download url.
59
+
**What is necessary to implement?** The access control strategy in the `getDownloadUrlAuthorizer` code. Currently it uses the token in the Authorization header of the request but it could be any [Api Gateway Lambda custom authorizer](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-use-lambda-authorizer.html).
60
+
**What does it do in the example?** The lambda is triggered by an API Gateway Get event with a token that should contain "allowMeToDownload" to request and return the download url.
@@ -146,7 +146,7 @@ This Lambda queries uploaded files metadata to display a list of files available
146
146
147
147
- **A S3 bucket:** a S3 bucket to _store the files_ of end users.
148
148
- **A Files metadata table:** a Dynamodb table to store _uploaded files metadat_. These metadata is used to to retrieve the files after their upload
149
-
- **A getSignedUploadUrl http endpoint:** an endpoint on the route `/api/get-signed-upload-url?fileType=FILTE_TYPE&name=NAME` that verifies that the user is allowed to upload files,using the name query string parameter, and returns a presigned POST url to upload a file directly to the S3 bucket.
149
+
- **A getSignedUploadUrl http endpoint:** an endpoint on the route `/api/get-signed-upload-url?fileType=FILTE_TYPE` that verifies that the user is allowed to upload files,using the token in the Authorization header, and returns a presigned POST url to upload a file directly to the S3 bucket.
150
150
151
151
- **A dispatchFileUploadedEvent handler and an event bridge:** a handler that dispatches a `FILE_UPLOADED` event in an event bridge. This event may be used to trigger any lambda. The payload of the event contains:
152
152
@@ -162,7 +162,7 @@ This Lambda queries uploaded files metadata to display a list of files available
162
162
}
163
163
```
164
164
165
-
- **A getSignedDownloadUrl http endpoint:** an endpoint on the route `/api/get-signed-download-url?filePrefix=FILTE_PREFIX&fileName=FILE_NAME&name=NAME` that verifies that the user is allowed to download files, using the name query string parameter, and returns a presigned POST url to download a file directly to the S3 bucket.
165
+
- **A getSignedDownloadUrl http endpoint:** an endpoint on the route `/api/get-signed-download-url?filePrefix=FILTE_PREFIX&fileName=FILE_NAME` that verifies that the user is allowed to download files, using the token in the Authorization header, and returns a presigned POST url to download a file directly to the S3 bucket.
0 commit comments