vendredi 6 mars 2015

AWS - Access Denied to Private Content with Jets3t

I'm using Jets3t to generate a canned URL for private access to my AWS content but I'm getting the following error:



Query-string authentication requires the Signature, Expires and AWSAccessKeyId parameters


The code used to generate this canned URL is as follows:



private String generateSignedUrl(HashMap<String, Object> configs) throws CloudFrontServiceException {

String resourcePath = configs.get(HASH_KEY_IMAGE_PATH).toString();
String keyPairId = configs.get(HASH_KEY_PAIR_ID).toString();
byte[] derPrivateKey = (byte[]) configs.get(HASH_KEY_PK_FILE_BYTES);
Date validationDate = new DateTime(DateTimeZone.UTC).plusDays(Integer.parseInt(configs.get(HASH_KEY_VALIDATION_MINUTES).toString())).toDate();

log.debug(format("Generating signed URL with data: [resource path: %s], [keyPairId: %s], [derPrivateKey: %s]", resourcePath, keyPairId, derPrivateKey));
return CloudFrontService.signUrlCanned(resourcePath, keyPairId, derPrivateKey, validationDate);
}


As I'm using CloudFront's API I thought the URL would come with the correct parameters (and in fact they match with Amazon's documentation) but this error message tells the opposite. And if I just change the parameter name Key-Pair-Id with AWSAccessKeyId it says the access key could not be found on their database.


Am I doing anything wrong?


Thanks for any input.





Aucun commentaire:

Enregistrer un commentaire