Class SignatureRequest

java.lang.Object
org.jets3t.service.utils.gatekeeper.SignatureRequest

public class SignatureRequest extends Object
Represents a signature request - that is, a request that a Gatekeeper allow a specific operation (signature type) on a specific object in S3. The operations that may be requested are: get, head, put.
Author:
James Murty
  • Field Details

  • Constructor Details

    • SignatureRequest

      public SignatureRequest()
      Constructs an empty signature request.
    • SignatureRequest

      public SignatureRequest(String signatureType, String objectKey)
      Constructs a signature request for an operation on a specific object key.
      Parameters:
      signatureType -
      objectKey -
  • Method Details

    • getBucketName

      public String getBucketName()
      Returns:
      the name of the bucket in which an object is stored, may be null.
    • setBucketName

      public void setBucketName(String bucketName)
      Sets the name of the bucket in which an object is stored - this is not generally required.
      Parameters:
      bucketName -
    • getObjectKey

      public String getObjectKey()
      Returns:
      the key name of the object on which the operation will be performed.
    • setObjectKey

      public void setObjectKey(String objectKey)
      Sets the key name of the object on which the operation will be performed.
      Parameters:
      objectKey -
    • getObjectMetadata

      public Map getObjectMetadata()
      Returns:
      the object's metadata as included in the Gatekeeer message.
    • setObjectMetadata

      public void setObjectMetadata(Map objectMetadata)
      Sets the object's metadata, that will be included in the Gatekeeer message.
      Parameters:
      objectMetadata -
    • addObjectMetadata

      public void addObjectMetadata(String metadataName, String metadataValue)
      Adds to the object's metadata, that will be included in the Gatekeeer message.
      Parameters:
      metadataName -
      metadataValue -
    • getSignatureType

      public String getSignatureType()
      Returns:
      the operation being requested.
    • setSignatureType

      public void setSignatureType(String signatureType)
      Sets the signature type (operation) being requested for the object in this request.
      Parameters:
      signatureType - the operation being requested, must match one of the SIGNATURE_TYPE_xyz constants in this class.
    • signRequest

      public void signRequest(String signedUrl)
      Approve the request by setting the signed URL for this request - performed by a Gatekeeper service when a request has been allowed.
      Parameters:
      signedUrl - a URL signed to allow the requested operation on the S3 object.
    • getSignedUrl

      public String getSignedUrl()
      Returns:
      the signed URL for this request, if available. If this method is called before a Gatekeeper service has provided a signed URL, or the the Gatekeeper has refused to provide a signed URL, this method will return null.
    • declineRequest

      public void declineRequest(String reason)
      Decline the request by setting the decline reason for this request - performed by a Gatekeeper service when a request has been disallowed.
      Parameters:
      reason - a short explanation for why the request was not allowed, such as "Unrecognised user".
    • getDeclineReason

      public String getDeclineReason()
      Returns:
      the reason this request was declined.
    • isSigned

      public boolean isSigned()
      Returns true if this request has been allowed and includes a signed URL, false otherwise.
    • buildObject

      public S3Object buildObject()