storage: add getSignedPolicy function to generate a signed policy#502
storage: add getSignedPolicy function to generate a signed policy#502mziccard wants to merge 10 commits intogoogleapis:masterfrom
Conversation
lib/storage/file.js
Outdated
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
@stephenplusplus Feel free to bug me:) BTW, I think it is still open for discussion whether to move this method to Bucket (allowing signed policies not associated to a specific filename) or not. Adding a regression test might be useful as well. |
lib/storage/file.js
Outdated
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
… equality and prefix conditions as 1D array. Docs updated accordingly. Added tests.
|
Should be ok now, even the boring stuff :) file.getSignedPolicy({
equals: ['$Content-Type', 'image/jpeg']
// ...and file.getSignedPolicy({
equals: [['$Content-Type', 'image/jpeg']]
// ...are now supported if only one condition is specified. (also for |
lib/storage/file.js
Outdated
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
Thank you very much! |
|
Everything ok on my side, are there any more thoughts? |
test/storage/file.js
Outdated
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
Just a couple |
* updated CHANGELOG.md [ci skip] * updated package.json [ci skip] * updated samples/package.json [ci skip]
Added a function to generate a signed policy for POST requests.
So far it supports several conditions (according to the docs):
["eq", "$<field>", "<value>"]["starts-with", "$<field>", "<value>"]["content-length-range", <min_range>, <max_range>]{"bucket": "<bucket_name>"}{"acl": "<acl_name>"}{"success_action_redirect": "<url>"}{"success_action_status": "<status>"}Documentation is provided describing function arguments.
Unit tests are added.