Package org.teiid.translator.amazon.s3
Class AWS4SignerForAuthorizationHeader
- java.lang.Object
-
- org.teiid.translator.amazon.s3.AWS4SignerBase
-
- org.teiid.translator.amazon.s3.AWS4SignerForAuthorizationHeader
-
public class AWS4SignerForAuthorizationHeader extends AWS4SignerBase
Sample AWS4 signer demonstrating how to sign requests to Amazon S3 using an 'Authorization' header. This code was taken from Amazon Example. No copyright found.
-
-
Field Summary
-
Fields inherited from class org.teiid.translator.amazon.s3.AWS4SignerBase
ALGORITHM, dateStampFormat, DateStringFormat, dateTimeFormat, EMPTY_BODY_SHA256, endpointUrl, httpMethod, ISO8601BasicFormat, regionName, SCHEME, serviceName, TERMINATOR, UNSIGNED_PAYLOAD
-
-
Constructor Summary
Constructors Constructor Description AWS4SignerForAuthorizationHeader(URL endpointUrl, String httpMethod, String serviceName, String regionName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
computeSignature(Map<String,String> headers, Map<String,String> queryParameters, String bodyHash, String awsAccessKey, String awsSecretKey)
Computes an AWS4 signature for a request, ready for inclusion as an 'Authorization' header.-
Methods inherited from class org.teiid.translator.amazon.s3.AWS4SignerBase
getCanonicalizedHeaderString, getCanonicalizedQueryString, getCanonicalizedResourcePath, getCanonicalizeHeaderNames, getCanonicalRequest, getStringToSign, hash, hash, sign, urlEncode
-
-
-
-
Method Detail
-
computeSignature
public String computeSignature(Map<String,String> headers, Map<String,String> queryParameters, String bodyHash, String awsAccessKey, String awsSecretKey)
Computes an AWS4 signature for a request, ready for inclusion as an 'Authorization' header.- Parameters:
headers
- The request headers; 'Host' and 'X-Amz-Date' will be added to this set.queryParameters
- Any query parameters that will be added to the endpoint. The parameters should be specified in canonical format.bodyHash
- Precomputed SHA256 hash of the request body content; this value should also be set as the header 'X-Amz-Content-SHA256' for non-streaming uploads.awsAccessKey
- The user's AWS Access Key.awsSecretKey
- The user's AWS Secret Key.- Returns:
- The computed authorization string for the request. This value needs to be set as the header 'Authorization' on the subsequent HTTP request.
-
-