com.amazonaws.auth
Class AWS4Signer

java.lang.Object
  extended by com.amazonaws.auth.AbstractAWSSigner
      extended by com.amazonaws.auth.AWS4Signer
All Implemented Interfaces:
Presigner, RegionAwareSigner, ServiceAwareSigner, Signer

public class AWS4Signer
extends AbstractAWSSigner
implements ServiceAwareSigner, RegionAwareSigner, Presigner

Signer implementation that signs requests with the AWS4 signing protocol.


Constructor Summary
AWS4Signer()
          Construct a new AWS4 signer instance.
AWS4Signer(boolean doubleUrlEncoding)
          Construct a new AWS4 signer instance.
 
Method Summary
 void presignRequest(Request<?> request, AWSCredentials credentials, java.util.Date expiration)
          Signs the request by adding the signature to the URL rather than as a header.
 void setRegionName(java.lang.String regionName)
          Sets the region name that this signer should use when calculating request signatures.
 void setServiceName(java.lang.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 com.amazonaws.auth.AbstractAWSSigner
hash, hash, sign
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AWS4Signer

public AWS4Signer()
Construct a new AWS4 signer instance. By default, enable double url-encoding.


AWS4Signer

public AWS4Signer(boolean doubleUrlEncoding)
Construct a new AWS4 signer instance.

Parameters:
doubleUrlEncoding - Whether double url-encode the resource path when constructing the canonical request.
Method Detail

sign

public void sign(Request<?> request,
                 AWSCredentials credentials)
Description copied from interface: Signer
Sign the given request with the given set of credentials. Modifies the passed-in request to apply the signature.

Specified by:
sign in interface Signer
Parameters:
request - The request to sign.
credentials - The credentials to sign the request with.

setServiceName

public void setServiceName(java.lang.String serviceName)
Sets the service name that this signer should use when calculating request signatures. This can almost always be determined directly from the request's end point, so you shouldn't need this method, but it's provided for the edge case where the information is not in the endpoint.

Specified by:
setServiceName in interface ServiceAwareSigner
Parameters:
serviceName - The service name to use when calculating signatures in this signer.

setRegionName

public void setRegionName(java.lang.String regionName)
Sets the region name that this signer should use when calculating request signatures. This can almost always be determined directly from the request's end point, so you shouldn't need this method, but it's provided for the edge case where the information is not in the endpoint.

Specified by:
setRegionName in interface RegionAwareSigner
Parameters:
regionName - The region name to use when calculating signatures in this signer.

presignRequest

public void presignRequest(Request<?> request,
                           AWSCredentials credentials,
                           java.util.Date expiration)
Description copied from interface: Presigner
Signs the request by adding the signature to the URL rather than as a header. This method is expected to modify the passed-in request to add the signature.

Specified by:
presignRequest in interface Presigner
Parameters:
request - The request to sign.
credentials - The credentials to sign it with.
expiration - The time when this presigned URL will expire.


Copyright © 2010 Amazon Web Services, Inc. All Rights Reserved.