public class DefaultUrlSigner extends UrlSigner
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
Modifier and Type | Field and Description |
---|---|
protected ProviderCredentials |
credentials |
protected java.lang.String |
s3BucketName |
protected S3Service |
s3Service |
protected int |
secondsUntilExpiry |
static java.lang.String |
TRANSACTION_ID_METADATA_NAME |
Constructor and Description |
---|
DefaultUrlSigner(javax.servlet.ServletConfig servletConfig)
Constructs the UrlSigner with the required parameters.
|
Modifier and Type | Method and Description |
---|---|
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.
|
calculateExpiryTime
protected ProviderCredentials credentials
protected S3Service s3Service
protected java.lang.String s3BucketName
protected int secondsUntilExpiry
public static final java.lang.String TRANSACTION_ID_METADATA_NAME
public DefaultUrlSigner(javax.servlet.ServletConfig servletConfig) throws javax.servlet.ServletException
The required parameters that must be available in the servlet configuration are:
servletConfig
- javax.servlet.ServletException
protected void updateObject(SignatureRequest signatureRequest, java.util.Properties messageProperties) throws S3ServiceException
signatureRequest
- messageProperties
- S3ServiceException
public java.lang.String signDelete(GatekeeperMessage requestMessage, ClientInformation clientInformation, SignatureRequest signatureRequest) throws S3ServiceException
UrlSigner
signDelete
in class UrlSigner
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.S3ServiceException
public java.lang.String signGet(GatekeeperMessage requestMessage, ClientInformation clientInformation, SignatureRequest signatureRequest) throws S3ServiceException
UrlSigner
signGet
in class UrlSigner
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.S3ServiceException
public java.lang.String signHead(GatekeeperMessage requestMessage, ClientInformation clientInformation, SignatureRequest signatureRequest) throws S3ServiceException
UrlSigner
signHead
in class UrlSigner
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.S3ServiceException
public java.lang.String signPut(GatekeeperMessage requestMessage, ClientInformation clientInformation, SignatureRequest signatureRequest) throws S3ServiceException
UrlSigner
signPut
in class UrlSigner
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.S3ServiceException
public java.lang.String signGetAcl(GatekeeperMessage requestMessage, ClientInformation clientInformation, SignatureRequest signatureRequest) throws S3ServiceException
UrlSigner
signGetAcl
in class UrlSigner
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.S3ServiceException
public java.lang.String signPutAcl(GatekeeperMessage requestMessage, ClientInformation clientInformation, SignatureRequest signatureRequest) throws S3ServiceException
UrlSigner
signPutAcl
in class UrlSigner
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.S3ServiceException