Skip to content

Commit

Permalink
Add another test (this one without any query vars)
Browse files Browse the repository at this point in the history
  • Loading branch information
sbleon committed Sep 3, 2020
1 parent 66c9bef commit 511d206
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 37 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/service/aws4_request,SignedHeaders=host;my-header1;x-amz-content-sha256;x-amz-date,Signature=ce153a4d3cd49f14e231c0fd5c87b341f370d3843ffc58e3a92d8b7a55a668d1
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
POST
/

host:example.amazonaws.com
my-header1:value1
x-amz-content-sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
x-amz-date:20150830T123600Z

host;my-header1;x-amz-content-sha256;x-amz-date
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
POST / HTTP/1.1
Host:example.amazonaws.com
My-Header1:value1
X-Amz-Date:20150830T123600Z
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
AWS4-HMAC-SHA256
20150830T123600Z
20150830/us-east-1/service/aws4_request
f0813a7aa38884105b1a28017093220fdc3af22c260bd719d0ab0f5d379e6f6b
42 changes: 5 additions & 37 deletions test-harness/tests/specs/Sv4UtilSpec.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -26,50 +26,18 @@ component extends="coldbox.system.testing.BaseTestCase" {
function run() {
describe( "SigV4 utilities", function() {

// describe( "get-presigned-url" , function() {

// it( "generateSignatureData", function() {
// // The following are example data from
// // https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-query-string-auth.html
// variables.accessKey = "AKIAIOSFODNN7EXAMPLE";
// variables.dateStamp = "20130524";
// variables.regionName = "us-east-1";
// variables.serviceName = "s3";
// variables.amzDate = "#variables.dateStamp#T000000Z";
// variables.secretKey = "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY";

// var testData = fixtureData( "get-presigned-url" );

// var sigData = sv4.generateSignatureData(
// requestMethod = testData.method,
// hostName = testData.host,
// requestURI = testData.uri,
// requestBody = "",
// requestHeaders = testData.headers,
// requestParams = testData.urlParams,
// accessKey = variables.accessKey,
// secretKey = variables.secretKey,
// regionName = variables.regionName,
// serviceName = variables.serviceName,
// amzDate = variables.amzDate,
// dateStamp = variables.dateStamp,
// presigningDownloadURL = true
// );

// expect( sigData.canonicalRequest ).toBe( testData.canonicalRequest );
// expect( sigData.stringToSign ).toBe( testData.stringToSign );
// expect( sigData.authorizationHeader ).toBe( testData.authHeader );
// } );

// } );

describe( "adapted AWS SigV4 test suite tests", function() {
it( "signs get-vanilla-query-unreserved", function() {
var config = variables.awsSigV4TestSuiteConfig;
var testData = fixtureData( "get-vanilla-query-unreserved-s3" );
expectCorrectSignature( config, testData );
} );

it( "signs post-header-key-sort" , function() {
var config = variables.awsSigV4TestSuiteConfig;
var testData = fixtureData( "post-header-key-sort-s3" );
expectCorrectSignature( config, testData );
} );

it( "signs post-vanilla-query" , function() {
var config = variables.awsSigV4TestSuiteConfig;
Expand Down

0 comments on commit 511d206

Please sign in to comment.