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 Summary
Fields Modifier and Type Field Description static StringSIGNATURE_TYPE_ACL_LOOKUPstatic StringSIGNATURE_TYPE_ACL_UPDATEstatic StringSIGNATURE_TYPE_DELETEstatic StringSIGNATURE_TYPE_GETstatic StringSIGNATURE_TYPE_HEADstatic StringSIGNATURE_TYPE_PUT
-
Constructor Summary
Constructors Constructor Description SignatureRequest()Constructs an empty signature request.SignatureRequest(String signatureType, String objectKey)Constructs a signature request for an operation on a specific object key.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddObjectMetadata(String metadataName, String metadataValue)Adds to the object's metadata, that will be included in the Gatekeeer message.S3ObjectbuildObject()voiddeclineRequest(String reason)Decline the request by setting the decline reason for this request - performed by a Gatekeeper service when a request has been disallowed.StringgetBucketName()StringgetDeclineReason()StringgetObjectKey()MapgetObjectMetadata()StringgetSignatureType()StringgetSignedUrl()booleanisSigned()Returns true if this request has been allowed and includes a signed URL, false otherwise.voidsetBucketName(String bucketName)Sets the name of the bucket in which an object is stored - this is not generally required.voidsetObjectKey(String objectKey)Sets the key name of the object on which the operation will be performed.voidsetObjectMetadata(Map objectMetadata)Sets the object's metadata, that will be included in the Gatekeeer message.voidsetSignatureType(String signatureType)Sets the signature type (operation) being requested for the object in this request.voidsignRequest(String signedUrl)Approve the request by setting the signed URL for this request - performed by a Gatekeeper service when a request has been allowed.
-
-
-
Field Detail
-
SIGNATURE_TYPE_GET
public static final String SIGNATURE_TYPE_GET
- See Also:
- Constant Field Values
-
SIGNATURE_TYPE_HEAD
public static final String SIGNATURE_TYPE_HEAD
- See Also:
- Constant Field Values
-
SIGNATURE_TYPE_PUT
public static final String SIGNATURE_TYPE_PUT
- See Also:
- Constant Field Values
-
SIGNATURE_TYPE_DELETE
public static final String SIGNATURE_TYPE_DELETE
- See Also:
- Constant Field Values
-
SIGNATURE_TYPE_ACL_LOOKUP
public static final String SIGNATURE_TYPE_ACL_LOOKUP
- See Also:
- Constant Field Values
-
SIGNATURE_TYPE_ACL_UPDATE
public static final String SIGNATURE_TYPE_ACL_UPDATE
- See Also:
- Constant Field Values
-
-
Method Detail
-
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()
-
-