AWS-Signature4

 view release on metacpan or  search on metacpan

Build.PL  view on Meta::CPAN

#!/usr/bin/perl

use strict;
use warnings;
use Module::Build;

my $build = Module::Build->new(
    module_name       => 'AWS-Signature4',
    license           => 'perl',
    dist_version_from => 'lib/AWS/Signature4.pm',
    dist_author       => 'Lincoln Stein <lincoln.stein@gmail.com>',
    configure_requires => { 'Module::Build' => 0.4205 },
    requires          => {
      'LWP'          => 5.835,
      'Digest::SHA'  => '5.47',
      'URI'          => 1.59,
      'URI::QueryParam' => 0,
      'Date::Parse'  => 0,
    },
    build_class        => 'Module::Build',
    );

META.json  view on Meta::CPAN

{
   "abstract" : "Create a version4 signature for Amazon Web Services",
   "author" : [
      "Lincoln Stein <lincoln.stein@gmail.com>"
   ],
   "dynamic_config" : 1,
   "generated_by" : "Module::Build version 0.4211",
   "license" : [
      "perl_5"
   ],
   "meta-spec" : {
      "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
      "version" : "2"

META.yml  view on Meta::CPAN

---
abstract: 'Create a version4 signature for Amazon Web Services'
author:
  - 'Lincoln Stein <lincoln.stein@gmail.com>'
build_requires: {}
configure_requires:
  Module::Build: '0.4205'
dynamic_config: 1
generated_by: 'Module::Build version 0.4211, CPAN::Meta::Converter version 2.143240'
license: perl
meta-spec:
  url: http://module-build.sourceforge.net/META-spec-v1.4.html
  version: '1.4'

README.md  view on Meta::CPAN

AWS-Signature4
==============

This is a Perl module for generating Version 4 signatures for use with
Amazon Web Services. It can be used to add authentication information
to the headers of GET, POST, PUT and DELETE.

The module can be also used to generate "signed" URLs. These are
preauthorized URLs that contain all the authentication and header
information in the URL query parameters. They can be sent to another
user to, for example, grant time-limited access to a private S3
bucket.

Relationship to Other Signature Modules
=======================================

This module has overlapping functionality with
Net::Amazon::Signature::V4, WebService::Amazon::Signature::v4, and
Net::Amazon::SignatureVersion4. None of these modules offers the

lib/AWS/Signature4.pm  view on Meta::CPAN



    my $scope = $self->_scope($request);

    $uri->query_param('X-Amz-Algorithm'  => $self->_algorithm);
    $uri->query_param('X-Amz-Credential' => $self->access_key . '/' . $scope);
    $uri->query_param('X-Amz-Date'       => $self->_datetime($request));
    $uri->query_param('X-Amz-Expires'    => $expires) if $expires;
    $uri->query_param('X-Amz-SignedHeaders' => 'host');

    # If there was a security token passed, we need to supply it as part of the authorization
    # because AWS requires it to validate IAM Role temporary credentials.

    if (defined($self->{security_token})) {
        $uri->query_param('X-Amz-Security-Token' => $self->{security_token});
    }

    # Since we're providing auth via query parameters, we need to include UNSIGNED-PAYLOAD
    # http://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-query-string-auth.html
    # it seems to only be needed for S3.

    if ($scope =~ /\/s3\/aws4_request$/) {
        $self->_sign($request, undef, 'UNSIGNED-PAYLOAD');
    } else {
        $self->_sign($request);
    }

    my ($algorithm,$credential,$signedheaders,$signature) =
	$request->header('Authorization') =~ /^(\S+) Credential=(\S+), SignedHeaders=(\S+), Signature=(\S+)/;



( run in 1.365 second using v1.01-cache-2.11-cpan-5c0b1e786e0 )