Skip to content
This repository has been archived by the owner on Feb 22, 2024. It is now read-only.

Commit

Permalink
adds token header to whitelist
Browse files Browse the repository at this point in the history
  • Loading branch information
Simone Lusenti committed Feb 28, 2017
1 parent 9b73181 commit f1622db
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/commands/proxy.js
Expand Up @@ -332,6 +332,7 @@ function runAuthorizer (
// https://docs.aws.amazon.com/apigateway/latest/developerguide/use-custom-authorizer.html
// @TODO: correctly handle 401, 403, 500 response as described in the documentation

debug('Authorizer event', event);
const token = event.params.header.token;
log(` 🔒 Invoking authorizer, token = ${util.inspect(token)}`.yellow.dim);

Expand Down
6 changes: 4 additions & 2 deletions src/factories/__snapshots__/primaryTemplate.spec.js.snap
Expand Up @@ -276,7 +276,8 @@ module.exports[`primary template builder`] = {
"origin",
"referer",
"access-control-request-headers",
"access-control-request-method"
"access-control-request-method",
"token"
]
},
"ViewerProtocolPolicy": "allow-all",
Expand Down Expand Up @@ -674,7 +675,8 @@ module.exports[`primary template builder`] = {
`origin`,
`referer`,
`access-control-request-headers`,
`access-control-request-method`
`access-control-request-method`,
`token`
]
},
ViewerProtocolPolicy: `allow-all`,
Expand Down
3 changes: 2 additions & 1 deletion src/factories/cf_cloudfront.js
Expand Up @@ -10,7 +10,8 @@ export const WHITELISTED_HEADERS = [
'origin',
'referer',
'access-control-request-headers',
'access-control-request-method'
'access-control-request-method',
'token'
];

// WebACL
Expand Down
12 changes: 8 additions & 4 deletions src/factories/cf_cloudfront.spec.js
Expand Up @@ -44,7 +44,8 @@ test('templateCloudfrontDistribution without WebACL', t => {
'origin',
'referer',
'access-control-request-headers',
'access-control-request-method'
'access-control-request-method',
'token'
],
QueryString: 'true'
},
Expand Down Expand Up @@ -155,7 +156,8 @@ test('templateCloudfrontDistribution without aliases', t => {
'origin',
'referer',
'access-control-request-headers',
'access-control-request-method'
'access-control-request-method',
'token'
],
QueryString: 'true'
},
Expand Down Expand Up @@ -248,7 +250,8 @@ test('templateCloudfrontDistribution with root origin set to assets', t => {
'origin',
'referer',
'access-control-request-headers',
'access-control-request-method'
'access-control-request-method',
'token'
],
QueryString: 'true'
},
Expand Down Expand Up @@ -379,7 +382,8 @@ test('templateCloudfrontDistribution with WebACL', t => {
'origin',
'referer',
'access-control-request-headers',
'access-control-request-method'
'access-control-request-method',
'token'
],
QueryString: 'true'
},
Expand Down

0 comments on commit f1622db

Please sign in to comment.