Class SignatureRequest
java.lang.Object
org.jets3t.service.utils.gatekeeper.SignatureRequest
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 -
Constructor Summary
ConstructorsConstructorDescriptionConstructs an empty signature request.SignatureRequest
(String signatureType, String objectKey) Constructs a signature request for an operation on a specific object key. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addObjectMetadata
(String metadataName, String metadataValue) Adds to the object's metadata, that will be included in the Gatekeeer message.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.boolean
isSigned()
Returns true if this request has been allowed and includes a signed URL, false otherwise.void
setBucketName
(String bucketName) Sets the name of the bucket in which an object is stored - this is not generally required.void
setObjectKey
(String objectKey) Sets the key name of the object on which the operation will be performed.void
setObjectMetadata
(Map objectMetadata) Sets the object's metadata, that will be included in the Gatekeeer message.void
setSignatureType
(String signatureType) Sets the signature type (operation) being requested for the object in this request.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.
-
Field Details
-
SIGNATURE_TYPE_GET
- See Also:
-
SIGNATURE_TYPE_HEAD
- See Also:
-
SIGNATURE_TYPE_PUT
- See Also:
-
SIGNATURE_TYPE_DELETE
- See Also:
-
SIGNATURE_TYPE_ACL_LOOKUP
- See Also:
-
SIGNATURE_TYPE_ACL_UPDATE
- See Also:
-
-
Constructor Details
-
SignatureRequest
public SignatureRequest()Constructs an empty signature request. -
SignatureRequest
Constructs a signature request for an operation on a specific object key.- Parameters:
signatureType
-objectKey
-
-
-
Method Details
-
getBucketName
- Returns:
- the name of the bucket in which an object is stored, may be null.
-
setBucketName
Sets the name of the bucket in which an object is stored - this is not generally required.- Parameters:
bucketName
-
-
getObjectKey
- Returns:
- the key name of the object on which the operation will be performed.
-
setObjectKey
Sets the key name of the object on which the operation will be performed.- Parameters:
objectKey
-
-
getObjectMetadata
- Returns:
- the object's metadata as included in the Gatekeeer message.
-
setObjectMetadata
Sets the object's metadata, that will be included in the Gatekeeer message.- Parameters:
objectMetadata
-
-
addObjectMetadata
Adds to the object's metadata, that will be included in the Gatekeeer message.- Parameters:
metadataName
-metadataValue
-
-
getSignatureType
- Returns:
- the operation being requested.
-
setSignatureType
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
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
- 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
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
- 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
-