|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.amazonaws.auth.AbstractAWSSigner
com.amazonaws.auth.AWS4Signer
public class AWS4Signer
Signer implementation that signs requests with the AWS4 signing protocol.
Nested Class Summary | |
---|---|
protected static class |
AWS4Signer.HeaderSigningResult
|
Field Summary | |
---|---|
protected static String |
ALGORITHM
|
protected boolean |
doubleUrlEncode
Whether double url-encode the resource path when constructing the canonical request. |
protected static org.apache.commons.logging.Log |
log
|
protected Date |
overriddenDate
Date override for testing only |
protected String |
regionName
Region name override for use when the endpoint can't be used to determine the region name. |
protected String |
serviceName
Service name override for use when the endpoint can't be used to determine the service name. |
protected static String |
TERMINATOR
|
Constructor Summary | |
---|---|
AWS4Signer()
Construct a new AWS4 signer instance. |
|
AWS4Signer(boolean doubleUrlEncoding)
Construct a new AWS4 signer instance. |
Method Summary | |
---|---|
protected void |
addHostHeader(Request<?> request)
|
protected void |
addSessionCredentials(Request<?> request,
AWSSessionCredentials credentials)
Adds session credentials to the request given. |
protected String |
calculateContentHash(Request<?> request)
Calculate the hash of the request's payload. |
protected String |
calculateContentHashPresign(Request<?> request)
Calculate the hash of the request's payload. |
protected AWS4Signer.HeaderSigningResult |
computeSignature(Request<?> request,
String dateStamp,
String timeStamp,
String algorithm,
String contentSha256,
AWSCredentials sanitizedCredentials)
|
protected String |
extractRegionName(URI endpoint)
|
protected String |
extractServiceName(URI endpoint)
|
protected String |
getCanonicalizedHeaderString(Request<?> request)
|
protected String |
getCanonicalRequest(Request<?> request,
String contentSha256)
|
protected long |
getDateFromRequest(Request<?> request)
|
protected String |
getDateStamp(long dateMilli)
|
protected String |
getScope(Request<?> request,
String dateStamp)
|
protected String |
getSignedHeadersString(Request<?> request)
|
protected String |
getStringToSign(String algorithm,
String dateTime,
String scope,
String canonicalRequest)
|
protected String |
getTimeStamp(long dateMilli)
|
void |
presignRequest(Request<?> request,
AWSCredentials credentials,
Date expiration)
Signs the request by adding the signature to the URL rather than as a header. |
protected void |
processRequestPayload(Request<?> request,
AWS4Signer.HeaderSigningResult headerSigningResult)
Subclass could override this method to perform any additional procedure on the request payload, with access to the result from signing the header. |
void |
setRegionName(String regionName)
Sets the region name that this signer should use when calculating request signatures. |
void |
setServiceName(String serviceName)
Sets the service name that this signer should use when calculating request signatures. |
void |
sign(Request<?> request,
AWSCredentials credentials)
Sign the given request with the given set of credentials. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final String ALGORITHM
protected static final String TERMINATOR
protected String serviceName
protected String regionName
protected Date overriddenDate
protected boolean doubleUrlEncode
protected static final org.apache.commons.logging.Log log
Constructor Detail |
---|
public AWS4Signer()
public AWS4Signer(boolean doubleUrlEncoding)
doubleUrlEncoding
- Whether double url-encode the resource path when constructing
the canonical request.Method Detail |
---|
public void sign(Request<?> request, AWSCredentials credentials)
Signer
sign
in interface Signer
request
- The request to sign.credentials
- The credentials to sign the request with.public void setServiceName(String serviceName)
setServiceName
in interface ServiceAwareSigner
serviceName
- The service name to use when calculating signatures in this
signer.public void setRegionName(String regionName)
setRegionName
in interface RegionAwareSigner
regionName
- The region name to use when calculating signatures in this
signer.protected void addSessionCredentials(Request<?> request, AWSSessionCredentials credentials)
AbstractAWSSigner
addSessionCredentials
in class AbstractAWSSigner
request
- The request to add session credentials information tocredentials
- The session credentials to add to the requestprotected String extractRegionName(URI endpoint)
protected String extractServiceName(URI endpoint)
protected String getCanonicalizedHeaderString(Request<?> request)
protected String getSignedHeadersString(Request<?> request)
protected String getCanonicalRequest(Request<?> request, String contentSha256)
protected String getStringToSign(String algorithm, String dateTime, String scope, String canonicalRequest)
protected final AWS4Signer.HeaderSigningResult computeSignature(Request<?> request, String dateStamp, String timeStamp, String algorithm, String contentSha256, AWSCredentials sanitizedCredentials)
protected final String getTimeStamp(long dateMilli)
protected final String getDateStamp(long dateMilli)
protected final long getDateFromRequest(Request<?> request)
protected void addHostHeader(Request<?> request)
protected String getScope(Request<?> request, String dateStamp)
protected String calculateContentHash(Request<?> request)
protected void processRequestPayload(Request<?> request, AWS4Signer.HeaderSigningResult headerSigningResult)
public void presignRequest(Request<?> request, AWSCredentials credentials, Date expiration)
Presigner
presignRequest
in interface Presigner
request
- The request to sign.credentials
- The credentials to sign it with.expiration
- The time when this presigned URL will expire.protected String calculateContentHashPresign(Request<?> request)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |