public class AWS4Signer extends AbstractAWSSigner implements ServiceAwareSigner, RegionAwareSigner, Presigner, EndpointPrefixAwareSigner, RegionFromEndpointResolverAwareSigner
EMPTY_STRING_SHA256_HEX
Constructor and Description |
---|
AWS4Signer()
Construct a new AWS4 signer instance.
|
AWS4Signer(boolean doubleUrlEncoding)
Construct a new AWS4 signer instance.
|
AWS4Signer(SdkClock clock) |
Modifier and Type | Method and Description |
---|---|
Date |
getOverriddenDate()
Returns a copy of date that overrides the signing date in the request.
|
String |
getRegionName()
Returns the region name that is used when calculating the signature.
|
String |
getServiceName()
Returns the service name that is used when calculating the signature.
|
void |
presignRequest(SignableRequest<?> request,
AWSCredentials credentials,
Date userSpecifiedExpirationDate)
Signs the request by adding the signature to the URL rather than as a
header.
|
void |
setEndpointPrefix(String endpointPrefix)
Sets the endpoint prefix which is used to compute the region that is
used for signing the request.
|
void |
setOverrideDate(Date overriddenDate)
Sets the date that overrides the signing date in the request.
|
void |
setRegionFromEndpointResolver(RegionFromEndpointResolver resolver)
Set the
RegionFromEndpointResolver to use when converting an endpoint into a region. |
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(SignableRequest<?> request,
AWSCredentials credentials)
Sign the given request with the given set of credentials.
|
hash, hash, sign, signWithMac
public AWS4Signer()
public AWS4Signer(boolean doubleUrlEncoding)
doubleUrlEncoding
- Whether double url-encode the resource path when constructing
the canonical request.public AWS4Signer(SdkClock clock)
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.public void setEndpointPrefix(String endpointPrefix)
AWS4SignerRequestParams
class which
has the logic to compute region.setEndpointPrefix
in interface EndpointPrefixAwareSigner
endpointPrefix
- The endpoint prefix of the servicepublic void setOverrideDate(Date overriddenDate)
public void setRegionFromEndpointResolver(RegionFromEndpointResolver resolver)
RegionFromEndpointResolverAwareSigner
RegionFromEndpointResolver
to use when converting an endpoint into a region.setRegionFromEndpointResolver
in interface RegionFromEndpointResolverAwareSigner
public String getRegionName()
public String getServiceName()
public Date getOverriddenDate()
public void sign(SignableRequest<?> request, AWSCredentials credentials)
Signer
public void presignRequest(SignableRequest<?> request, AWSCredentials credentials, Date userSpecifiedExpirationDate)
Presigner
presignRequest
in interface Presigner
request
- The request to sign.credentials
- The credentials to sign it with.userSpecifiedExpirationDate
- The time when this presigned URL will expire.