if (credentials == null) {
log.debug("Canonical string will not be signed, as no AWS Secret Key was provided");
return;
}
AWSCredentials sanitizedCredentials = sanitizeCredentials(credentials);
if ( sanitizedCredentials instanceof AWSSessionCredentials ) {
addSessionCredentials(request, (AWSSessionCredentials) sanitizedCredentials);
}
request.addHeader(Headers.DATE, ServiceUtils.formatRfc822Date(new Date()));
String canonicalString = RestUtils.makeS3CanonicalString(
httpVerb, resourcePath, request, null);
log.debug("Calculated string to sign:\n\"" + canonicalString + "\"");
String signature = super.sign(canonicalString, sanitizedCredentials.getAWSSecretKey(), SigningAlgorithm.HmacSHA1);
request.addHeader("Authorization", "AWS " + sanitizedCredentials.getAWSAccessKeyId() + ":" + signature);
}