private S3Signer createSigV2Signer(final Request<?> request, final String bucketName, final String key) { String resourcePath = "/" + ((bucketName != null) ? bucketName + "/" : "") + ((key != null) ? key : ""); return new S3Signer(request.getHttpMethod().toString(), resourcePath); }
private S3Signer createSigV2Signer(final Request<?> request, final String bucketName, final String key) { final String resourcePath = "/" + ((bucketName != null) ? bucketName + "/" : "") + ((key != null) ? key : ""); return new S3Signer(request.getHttpMethod().toString(), resourcePath); }
@Test public void testSign() throws URISyntaxException { final GetObjectRequest gr = new GetObjectRequest("test-bucket123456", "TestFile.txt"); final Request<?> req = new DefaultRequest(gr, Constants.S3_SERVICE_DISPLAY_NAME); req.setHttpMethod(HttpMethodName.GET); req.setResourcePath("/test-bucket123456/TestFile.txt"); req.setEndpoint(new URI("https://test-bucket123456.s3-us-west-2.amazonaws.com")); req.addHeader(Headers.CONTENT_TYPE, "application/x-www-form-urlencoded; charset=utf-8"); final S3Signer signer = new S3Signer("GET", "/test-bucket123456/TestFile.txt"); // These are fake bogus credentials just for tesitng signer.sign(req, new BasicAWSCredentials( "AKI11BOGUS11ACCESS11KEYOZQ", "LYd/ZD611BOGUS11SECRET11KEYSiD6"), new Date( 1431374979760L)); assertEquals(getSignature(req), "kD6n4rzH5+82Nw5wFIhaD1pKXNM="); }
private S3Signer createSigV2Signer(final Request<?> request, final String bucketName, final String key) { final String resourcePath = "/" + ((bucketName != null) ? bucketName + "/" : "") + ((key != null) ? key : ""); return new S3Signer(request.getHttpMethod().toString(), resourcePath); }
private S3Signer createSigV2Signer(final Request<?> request, final String bucketName, final String key) { String resourcePath = "/" + ((bucketName != null) ? bucketName + "/" : "") + ((key != null) ? key : ""); return new S3Signer(request.getHttpMethod().toString(), resourcePath); }