org.jets3t.servlets.gatekeeper
Class UrlSigner

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

public abstract class UrlSigner
extends java.lang.Object

Provides signed URLs that will allow a client to perform the operation requested on a specific object in S3.

This sign methods in this class are not called for a signature request unless that request has already been allowed by the Authorizer.

Implementations of this class need only generate the appropriate signed URL. However, more advanced implementations may do other work such as renaming objects to comply with naming rules for an S3 account.


Constructor Summary
UrlSigner(javax.servlet.ServletConfig servletConfig)
          Constructs a UrlSigner with the following required properties from the servlet configuration:
 
Method Summary
protected  java.util.Date calculateExpiryTime(int secondsUntilExpiry)
           
abstract  java.lang.String signDelete(GatekeeperMessage requestMessage, ClientInformation clientInformation, SignatureRequest signatureRequest)
          Generate a signed DELETE URL for the signature request.
abstract  java.lang.String signGet(GatekeeperMessage requestMessage, ClientInformation clientInformation, SignatureRequest signatureRequest)
          Generate a signed GET URL for the signature request.
abstract  java.lang.String signGetAcl(GatekeeperMessage requestMessage, ClientInformation clientInformation, SignatureRequest signatureRequest)
          Generate a signed GET URL for an ACL-based signature request.
abstract  java.lang.String signHead(GatekeeperMessage requestMessage, ClientInformation clientInformation, SignatureRequest signatureRequest)
          Generate a signed HEAD URL for the signature request.
abstract  java.lang.String signPut(GatekeeperMessage requestMessage, ClientInformation clientInformation, SignatureRequest signatureRequest)
          Generate a signed PUT URL for the signature request.
abstract  java.lang.String signPutAcl(GatekeeperMessage requestMessage, ClientInformation clientInformation, SignatureRequest signatureRequest)
          Generate a signed PUT URL for an ACL-based signature request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UrlSigner

public UrlSigner(javax.servlet.ServletConfig servletConfig)
          throws javax.servlet.ServletException
Constructs a UrlSigner with the following required properties from the servlet configuration:

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

signGet

public abstract java.lang.String signGet(GatekeeperMessage requestMessage,
                                         ClientInformation clientInformation,
                                         SignatureRequest signatureRequest)
                                  throws S3ServiceException
Generate a signed GET URL for the signature request.

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 abstract java.lang.String signHead(GatekeeperMessage requestMessage,
                                          ClientInformation clientInformation,
                                          SignatureRequest signatureRequest)
                                   throws S3ServiceException
Generate a signed HEAD URL for the signature request.

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 abstract java.lang.String signPut(GatekeeperMessage requestMessage,
                                         ClientInformation clientInformation,
                                         SignatureRequest signatureRequest)
                                  throws S3ServiceException
Generate a signed PUT URL for the signature request.

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

signDelete

public abstract java.lang.String signDelete(GatekeeperMessage requestMessage,
                                            ClientInformation clientInformation,
                                            SignatureRequest signatureRequest)
                                     throws S3ServiceException
Generate a signed DELETE URL for the signature request.

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 abstract java.lang.String signGetAcl(GatekeeperMessage requestMessage,
                                            ClientInformation clientInformation,
                                            SignatureRequest signatureRequest)
                                     throws S3ServiceException
Generate a signed GET URL for an ACL-based signature request.

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 abstract java.lang.String signPutAcl(GatekeeperMessage requestMessage,
                                            ClientInformation clientInformation,
                                            SignatureRequest signatureRequest)
                                     throws S3ServiceException
Generate a signed PUT URL for an ACL-based signature request.

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

calculateExpiryTime

protected java.util.Date calculateExpiryTime(int secondsUntilExpiry)
Returns:
the date and time when signed URLs should expire, calculated by adding the number of seconds until expiry to the current time.