org.jets3t.servlets.gatekeeper.impl
Class DefaultUrlSigner

java.lang.Object
  extended by org.jets3t.servlets.gatekeeper.UrlSigner
      extended by org.jets3t.servlets.gatekeeper.impl.DefaultUrlSigner
Direct Known Subclasses:
RenameToUuidUrlSigner

public class DefaultUrlSigner
extends UrlSigner

Default UrlSigner implementation that signs all requests, putting all objects in a specific S3 bucket and limiting the signature time to a configurable time period.

This implementation also demonstrates how objects may be modified, as it adds a metadata item to each signed object to store the transaction ID in which the object was signed. The transaction id is stored in the metadata name x-amx-gatekeeper-transaction-id

Author:
James Murty

Field Summary
protected  AWSCredentials awsCredentials
           
protected  java.lang.String s3BucketName
           
protected  int secondsUntilExpiry
           
static java.lang.String TRANSACTION_ID_METADATA_NAME
           
 
Constructor Summary
DefaultUrlSigner(javax.servlet.ServletConfig servletConfig)
          Constructs the UrlSigner with the required parameters.
 
Method Summary
 java.lang.String signDelete(GatekeeperMessage requestMessage, ClientInformation clientInformation, SignatureRequest signatureRequest)
          Generate a signed DELETE URL for the signature request.
 java.lang.String signGet(GatekeeperMessage requestMessage, ClientInformation clientInformation, SignatureRequest signatureRequest)
          Generate a signed GET URL for the signature request.
 java.lang.String signGetAcl(GatekeeperMessage requestMessage, ClientInformation clientInformation, SignatureRequest signatureRequest)
          Generate a signed GET URL for an ACL-based signature request.
 java.lang.String signHead(GatekeeperMessage requestMessage, ClientInformation clientInformation, SignatureRequest signatureRequest)
          Generate a signed HEAD URL for the signature request.
 java.lang.String signPut(GatekeeperMessage requestMessage, ClientInformation clientInformation, SignatureRequest signatureRequest)
          Generate a signed PUT URL for the signature request.
 java.lang.String signPutAcl(GatekeeperMessage requestMessage, ClientInformation clientInformation, SignatureRequest signatureRequest)
          Generate a signed PUT URL for an ACL-based signature request.
protected  void updateObject(SignatureRequest signatureRequest, java.util.Properties messageProperties)
          Adds a metadata item containing the transaction ID to each object.
 
Methods inherited from class org.jets3t.servlets.gatekeeper.UrlSigner
calculateExpiryTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

awsCredentials

protected AWSCredentials awsCredentials

s3BucketName

protected java.lang.String s3BucketName

secondsUntilExpiry

protected int secondsUntilExpiry

TRANSACTION_ID_METADATA_NAME

public static final java.lang.String TRANSACTION_ID_METADATA_NAME
See Also:
Constant Field Values
Constructor Detail

DefaultUrlSigner

public DefaultUrlSigner(javax.servlet.ServletConfig servletConfig)
                 throws javax.servlet.ServletException
Constructs the UrlSigner with the required parameters.

The required parameters that must be available in the servlet configuration are:

Parameters:
servletConfig -
Throws:
javax.servlet.ServletException
Method Detail

updateObject

protected void updateObject(SignatureRequest signatureRequest,
                            java.util.Properties messageProperties)
                     throws S3ServiceException
Adds a metadata item containing the transaction ID to each object.

Parameters:
signatureRequest -
messageProperties -
Throws:
S3ServiceException

signDelete

public java.lang.String signDelete(GatekeeperMessage requestMessage,
                                   ClientInformation clientInformation,
                                   SignatureRequest signatureRequest)
                            throws S3ServiceException
Description copied from class: UrlSigner
Generate a signed DELETE URL for the signature request.

Specified by:
signDelete in class UrlSigner
Parameters:
requestMessage - the request message received from the client.
clientInformation - information about the client's end-point, and any Session or Principal associated with the client.
signatureRequest - a pre-approved signature request.
Returns:
a signed URL string that will allow the operation specified in the signature request on the object specified in the signature request.
Throws:
S3ServiceException

signGet

public java.lang.String signGet(GatekeeperMessage requestMessage,
                                ClientInformation clientInformation,
                                SignatureRequest signatureRequest)
                         throws S3ServiceException
Description copied from class: UrlSigner
Generate a signed GET URL for the signature request.

Specified by:
signGet in class UrlSigner
Parameters:
requestMessage - the request message received from the client.
clientInformation - information about the client's end-point, and any Session or Principal associated with the client.
signatureRequest - a pre-approved signature request.
Returns:
a signed URL string that will allow the operation specified in the signature request on the object specified in the signature request.
Throws:
S3ServiceException

signHead

public java.lang.String signHead(GatekeeperMessage requestMessage,
                                 ClientInformation clientInformation,
                                 SignatureRequest signatureRequest)
                          throws S3ServiceException
Description copied from class: UrlSigner
Generate a signed HEAD URL for the signature request.

Specified by:
signHead in class UrlSigner
Parameters:
requestMessage - the request message received from the client.
clientInformation - information about the client's end-point, and any Session or Principal associated with the client.
signatureRequest - a pre-approved signature request.
Returns:
a signed URL string that will allow the operation specified in the signature request on the object specified in the signature request.
Throws:
S3ServiceException

signPut

public java.lang.String signPut(GatekeeperMessage requestMessage,
                                ClientInformation clientInformation,
                                SignatureRequest signatureRequest)
                         throws S3ServiceException
Description copied from class: UrlSigner
Generate a signed PUT URL for the signature request.

Specified by:
signPut in class UrlSigner
Parameters:
requestMessage - the request message received from the client.
clientInformation - information about the client's end-point, and any Session or Principal associated with the client.
signatureRequest - a pre-approved signature request.
Returns:
a signed URL string that will allow the operation specified in the signature request on the object specified in the signature request.
Throws:
S3ServiceException

signGetAcl

public java.lang.String signGetAcl(GatekeeperMessage requestMessage,
                                   ClientInformation clientInformation,
                                   SignatureRequest signatureRequest)
                            throws S3ServiceException
Description copied from class: UrlSigner
Generate a signed GET URL for an ACL-based signature request.

Specified by:
signGetAcl in class UrlSigner
Parameters:
requestMessage - the request message received from the client.
clientInformation - information about the client's end-point, and any Session or Principal associated with the client.
signatureRequest - a pre-approved signature request.
Returns:
a signed URL string that will allow the operation specified in the signature request on the object specified in the signature request.
Throws:
S3ServiceException

signPutAcl

public java.lang.String signPutAcl(GatekeeperMessage requestMessage,
                                   ClientInformation clientInformation,
                                   SignatureRequest signatureRequest)
                            throws S3ServiceException
Description copied from class: UrlSigner
Generate a signed PUT URL for an ACL-based signature request.

Specified by:
signPutAcl in class UrlSigner
Parameters:
requestMessage - the request message received from the client.
clientInformation - information about the client's end-point, and any Session or Principal associated with the client.
signatureRequest - a pre-approved signature request.
Returns:
a signed URL string that will allow the operation specified in the signature request on the object specified in the signature request.
Throws:
S3ServiceException