if (resourcePath == null)
throw new IllegalArgumentException("Parameter resourcePath is empty");
}
public void sign(Request<?> request, AWSCredentials credentials) throws AmazonClientException {
AWSCredentials sanitizedCredentials = sanitizeCredentials(credentials);
if ( sanitizedCredentials instanceof AWSSessionCredentials ) {
addSessionCredentials(request, (AWSSessionCredentials) sanitizedCredentials);
}
String expirationInSeconds = Long.toString(expiration.getTime() / 1000L);
String canonicalString = RestUtils.makeS3CanonicalString(
httpVerb, resourcePath, request, expirationInSeconds);
String signature = super.signAndBase64Encode(canonicalString, sanitizedCredentials.getAWSSecretKey(), SigningAlgorithm.HmacSHA1);
request.addParameter("AWSAccessKeyId", sanitizedCredentials.getAWSAccessKeyId());
request.addParameter("Expires", expirationInSeconds);
request.addParameter("Signature", signature);
}