-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Security: OAuth @ Edge, JWT auth in the API #45
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# s3 bucket is not accessable
$ curl http://private.gofaas.net.s3-website-us-east-1.amazonaws.com/
<head><title>403 Forbidden</title></head>...
# distribution redirects to OAuth
$ curl -i https://private.gofaas.net/
HTTP/2 302
location: https://accounts.google.com/o/oauth2/v2/auth?response_type=code...
# valid access_token cookie returns content
$ curl --cookie "access_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6Im5vYWhAZ29mYWFzLm5ldCJ9.x8w23sGhkTX97BZe3jsXnj0VL9ZrM_cbtoIHyqSVK8Q" https://private.gofaas.net/
<title>My first gofaas/Vue app</title>... # gateway enforces CORS
$ curl -i -X OPTIONS https://api.gofaas.net/
HTTP/2 200
content-type: application/json
content-length: 3
date: Sun, 18 Mar 2018 21:50:42 GMT
x-amzn-requestid: 676936da-2af6-11e8-83ab-1138cf2b9b7d
access-control-allow-origin: https://private.gofaas.net
access-control-allow-headers: Accept, Authorization, Content-Type
access-control-allow-methods: GET,OPTIONS # API validates token
$ curl -X POST https://api.gofaas.net/work
HTTP/2 401
{"error": "token contains an invalid number of segments"}
$ curl -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6Im5vYWhAZ29mYWFzLm5ldCJ9.x8w23sGhkTX97BZe3jsXnj0VL9ZrM_cbtoIHyqSVK8Q" -X POST https://api.gofaas.net/work
HTTP/2 200
{"ExecutedVersion":null,"FunctionError":null,"LogResult":null,"Payload":"","StatusCode":202} |
nzoschke
changed the title
OAuth @ Edge, JWT auth in the API
Security: OAuth @ Edge, JWT auth in the API
Mar 18, 2018
We might want to add a bit more CF conditional logic, not configuring the Lambda @ Edge func unless OAuth client parameters are specified. Edit: done in 24aa04c |
…cess identity, and bucket policy
…ic name and prefix SSM parameters with stack name
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This demonstrates strategies for security.
This also introduces a work API (which fixes #6) that uses JWT auth.
The OAuth stuff requires creating a Google OAuth 2.0 web application client and enabling the Google Plus API.
Todo: