Class DefaultUrlSigner
- java.lang.Object
-
- org.jets3t.servlets.gatekeeper.UrlSigner
-
- 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
Fields Modifier and Type Field Description static String
TRANSACTION_ID_METADATA_NAME
-
Constructor Summary
Constructors Constructor Description DefaultUrlSigner(javax.servlet.ServletConfig servletConfig)
Constructs the UrlSigner with the required parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
signDelete(GatekeeperMessage requestMessage, ClientInformation clientInformation, SignatureRequest signatureRequest)
Generate a signed DELETE URL for the signature request.String
signGet(GatekeeperMessage requestMessage, ClientInformation clientInformation, SignatureRequest signatureRequest)
Generate a signed GET URL for the signature request.String
signGetAcl(GatekeeperMessage requestMessage, ClientInformation clientInformation, SignatureRequest signatureRequest)
Generate a signed GET URL for an ACL-based signature request.String
signHead(GatekeeperMessage requestMessage, ClientInformation clientInformation, SignatureRequest signatureRequest)
Generate a signed HEAD URL for the signature request.String
signPut(GatekeeperMessage requestMessage, ClientInformation clientInformation, SignatureRequest signatureRequest)
Generate a signed PUT URL for the signature request.String
signPutAcl(GatekeeperMessage requestMessage, ClientInformation clientInformation, SignatureRequest signatureRequest)
Generate a signed PUT URL for an ACL-based signature request.
-
-
-
Field Detail
-
TRANSACTION_ID_METADATA_NAME
public static final 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:
- AwsAccessKey: The AWS Access Key for an S3 account
- AwsSecretKey: The AWS Secret Key for an S3 account
- S3BucketName: The bucket all objects are stored in (regardless of what bucket name the client provided).
- SecondsToSign: How many seconds until the signed URLs will expire
Note: this setting must allow enough time for the operation to complete before the expiry time is reached. For example, if uploads are expected over slow connections the expiry time must be long enough for the uploads to finish otherwise the uploaded file will be rejected after it has finished uploading.
- Parameters:
servletConfig
-- Throws:
javax.servlet.ServletException
-
-
Method Detail
-
signDelete
public 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 classUrlSigner
- 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 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 classUrlSigner
- 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 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 classUrlSigner
- 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 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 classUrlSigner
- 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 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 classUrlSigner
- 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 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 classUrlSigner
- 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
-
-