From beb13b81213a4377505b06db5683442d8e49ebda Mon Sep 17 00:00:00 2001 From: Flavio Poletti Date: Tue, 2 Sep 2008 01:51:48 +0200 Subject: [PATCH] Got rid of stray file; added docs in README --- README | 44 ++++++++++++++++++++++++++++++-------------- prova.pl | 25 ------------------------- 2 files changed, 30 insertions(+), 39 deletions(-) delete mode 100644 prova.pl diff --git a/README b/README index af661ea..f6b0799 100644 --- a/README +++ b/README @@ -1,19 +1,36 @@ -Net-Amazon-S3-Policy version 0.0.1 +Net-Amazon-S3-Policy version 0.1.0 -[ REPLACE THIS... +Net::Amazon::S3::Policy gives you an object-oriented interface to man‐ +age policies for Amazon S3 HTTP POST uploads. - The README is used to introduce the module and provide instructions on - how to install the module, any machine dependencies it may have (for - example C compilers and installed libraries) and any other information - that should be understood before the module is installed. +Amazon S3 relies upon either a REST interface (see Net::Amazon::S3) or +a SOAP one; as an added service, it is possible to give access to the +upload of resources using HTTP POSTs that do not involve using any of +these two interfaces, but a single HTML FORM. The rules you have to +follow are explained in the Amazon S3 Developer Guide. - A README file is required for CPAN modules since CPAN extracts the - README file from a module distribution so that people browsing the - archive can use it get an idea of the modules uses. It is usually a - good idea to provide version information here so that people can - decide whether fixes for the module are worth downloading. -] +More or less, it boils down to the following: +· if the target bucket is not writeable by the anonymous group, + you’ll need to set an access policy; + +· almost every field in the HTML FORM that will be used to build up + the HTTP POST message by the browser needs to be included into a + policy, and the policy has to be sent along within the HTTP POST + +· together with the policy, also the bucket owner’s AWS ID (the pub‐ + lic one) has to be sent, together with a digital signature of the + policy that has to be created using the bucket owner’s AWS secret + key. + +This module lets you manage the build-up of a policy document, provid‐ +ing you with tools to get the Base64 encoding of the resulting JSON +policy document, and to calculate the Base64 encoding of the signature. +See "Example" for a complete example of how to do this. + +In addition to policy synthesis, the module is also capable of parsing +some policy (base64-encoded or not, but in JSON format). This shouldn’t +be a need in general... possibly for debug reasons. INSTALLATION @@ -34,8 +51,7 @@ Alternatively, to install with Module::Build, you can use the following commands DEPENDENCIES -None. - +version and JSON. COPYRIGHT AND LICENCE diff --git a/prova.pl b/prova.pl deleted file mode 100644 index 3a0980b..0000000 --- a/prova.pl +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/perl -use strict; -use warnings; - -use lib 'lib'; - -use Net::Amazon::S3::Policy; - -my $policy = Net::Amazon::S3::Policy->new({expiration => time() + 3600}); -$policy->add($_) for ( - q( prova eq ciao ), - q( provaxxx starts-with ciao ), - q( 0 <= something <= 123312391 ), - q( anything * ), - q( anything2 starts_with ), - q( anything2 starts_with blah ), -); - -my $json = $policy->stringify(); -print $json; - -$json = '{"expiration":"2008-09-01T18:58:53.000Z","conditions":[["eq","prova","ciao"],["starts-with","provaxxx","ciao"],["something","0","123312391"],["starts-with","anything",""],["starts-with","anything2",""],["starts-with","anything2","blah"],{"what":"this"}]}'; - -my $pol2 = Net::Amazon::S3::Policy->new(json => $json); -print "\n\n\n", $pol2->stringify(); -- 2.11.4.GIT