Giter VIP home page Giter VIP logo

aws-signature4's People

Contributors

lgtml avatar lstein avatar martinmcgrath avatar rustyconover avatar unixtastic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

aws-signature4's Issues

feature request: sign() - separate region and service parameters

e.g.

$signer->sign( $request, region => "ProductAdvertisingAPI", service => "eu-west-1" );

Also, suggest adding to the perldoc

# useful for debugging
warn  $request->headers_as_string(); 

and reference to the code on github :)

Thanks for your work on this, very much appreciated!

Add support for additional AWS services

Greetings,

I was attempting to use your module to sign requests for the ElasticSearch service the other day and identified that your regex cases don't include some of AWS's newer services, such as ES. Here's a patch which generically supports a number of newer AWS services which follow this URL scheme. Note that it may also match some URLs which aren't a valid service, but I figure as a generic catch-all at the bottom of this elsif list this should be a safe enough addition. At the very least, I figure it'll generate errors in the same way that the us-east-1/S3 defaults would do for most cases.

I haven't used Github to contribute before; not sure if I would have the ability to directly commit/upload this patch or not, so I'm including the diff in this issue report (it's small). Let me know if you'd like me to push the change to the project.

Thanks!

shaneallen@localhost:~/AWS-Signature4/lib/AWS$ diff -u Signature4.pm.old Signature4.pm
--- Signature4.pm.old   2017-07-27 08:28:36.128251822 -0500
+++ Signature4.pm       2017-07-28 08:04:22.483102296 -0500
@@ -243,6 +243,9 @@
     } elsif ($host =~ /^([\w-]+)\.amazonaws\.com/) {
        $service = $1;
        $region  = 'us-east-1';
+    } elsif ($host =~ /^[\w-]+\.([\w-]+)\.([\w-]+)\.amazonaws\.com/) {
+       $service  = $2;
+       $region = $1;
     }
     $service ||= 's3';
     $region  ||= 'us-east-1';  # default

Pinpoint Scope

Hi

I change manually the module for support differente scope and works fine .

With pinpoint url for rest api for us-east-1 :

https://pinpoint.us-east-1.amazonaws.com/v1/apps/APPID/events

But scope must be mobiletargeting , not pinpoint .

May be the scope can pass on signed post ?

I add this in sub :

if ( $service = 'pinpoint' )
{
  $service = 'mobiletargeting';
}
sub _scope {
    my $self    = shift;
    my ($request,$region) = @_;
    my $host     = $request->uri->host;
    my $datetime = $self->_datetime($request);
    my ($date)   = $datetime =~ /^(\d+)T/;
    my $service;
    if ($host =~ /^([\w.-]+)\.s3\.amazonaws.com/) { # S3 bucket virtual host
	$service = 's3';
	$region  ||= 'us-east-1';
    } elsif  ($host =~ /^[\w-]+\.s3-([\w-]+)\.amazonaws\.com/) {
	$service = 's3';
	$region  ||= $2;
    } elsif ($host =~ /^(\w+)[-.]([\w-]+)\.amazonaws\.com/) {
	$service  = $1;
	$region ||= $2;
    } elsif ($host =~ /^([\w-]+)\.amazonaws\.com/) {
	$service = $1;
	$region  = 'us-east-1';
    }
    if ( $service = 'pinpoint' )
    {
	  $service = 'mobiletargeting';
    }
    $service ||= 's3';
    $region  ||= 'us-east-1';  # default
    return "$date/$region/$service/aws4_request";
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.