String specialParamName, Map<String, Object> headersMap, long secondsSinceEpoch) return createSignedUrl(method, bucketName, objectKey, specialParamName, headersMap, secondsSinceEpoch, false);
/** * Generates a signed GET URL. * * @param bucketName * the name of the bucket to include in the URL, must be a valid bucket name. * @param objectKey * the name of the object to include in the URL, if null only the bucket name is used. * @param expiryTime * the time after which URL's signature will no longer be valid. This time cannot be null. * @param isVirtualHost * if this parameter is true, the bucket name is treated as a virtual host name. To use * this option, the bucket name must be a valid DNS name that is an alias to an S3 bucket. * * @return * a URL signed in such a way as to grant GET access to an S3 resource to whoever uses it. */ public String createSignedGetUrl(String bucketName, String objectKey, Date expiryTime, boolean isVirtualHost) { long secondsSinceEpoch = expiryTime.getTime() / 1000; return createSignedUrl("GET", bucketName, objectKey, null, null, secondsSinceEpoch, isVirtualHost); }
/** * Generates a signed DELETE URL. * * @param bucketName * the name of the bucket to include in the URL, must be a valid bucket name. * @param objectKey * the name of the object to include in the URL, if null only the bucket name is used. * @param expiryTime * the time after which URL's signature will no longer be valid. This time cannot be null. * @param isVirtualHost * if this parameter is true, the bucket name is treated as a virtual host name. To use * this option, the bucket name must be a valid DNS name that is an alias to an S3 bucket. * * @return * a URL signed in such a way as to allow anyone do DELETE an object in S3. */ public String createSignedDeleteUrl(String bucketName, String objectKey, Date expiryTime, boolean isVirtualHost) { long secondsSinceEpoch = expiryTime.getTime() / 1000; return createSignedUrl("DELETE", bucketName, objectKey, null, null, secondsSinceEpoch, isVirtualHost); }
/** * Generates a signed DELETE URL. * * @param bucketName * the name of the bucket to include in the URL, must be a valid bucket name. * @param objectKey * the name of the object to include in the URL, if null only the bucket name is used. * @param expiryTime * the time after which URL's signature will no longer be valid. This time cannot be null. * @param isVirtualHost * if this parameter is true, the bucket name is treated as a virtual host name. To use * this option, the bucket name must be a valid DNS name that is an alias to an S3 bucket. * * @return * a URL signed in such a way as to allow anyone do DELETE an object in S3. */ public String createSignedDeleteUrl(String bucketName, String objectKey, Date expiryTime, boolean isVirtualHost) { long secondsSinceEpoch = expiryTime.getTime() / 1000; return createSignedUrl("DELETE", bucketName, objectKey, null, null, secondsSinceEpoch, isVirtualHost); }
/** * Generates a signed HEAD URL. * * @param bucketName * the name of the bucket to include in the URL, must be a valid bucket name. * @param objectKey * the name of the object to include in the URL, if null only the bucket name is used. * @param expiryTime * the time after which URL's signature will no longer be valid. This time cannot be null. * @param isVirtualHost * if this parameter is true, the bucket name is treated as a virtual host name. To use * this option, the bucket name must be a valid DNS name that is an alias to an S3 bucket. * * @return * a URL signed in such a way as to grant HEAD access to an S3 resource to whoever uses it. */ public String createSignedHeadUrl(String bucketName, String objectKey, Date expiryTime, boolean isVirtualHost) { long secondsSinceEpoch = expiryTime.getTime() / 1000; return createSignedUrl("HEAD", bucketName, objectKey, null, null, secondsSinceEpoch, isVirtualHost); }
/** * Generates a signed PUT URL. * * @param bucketName * the name of the bucket to include in the URL, must be a valid bucket name. * @param objectKey * the name of the object to include in the URL, if null only the bucket name is used. * @param headersMap * headers to add to the signed URL, may be null. * Headers that <b>must</b> match between the signed URL and the actual request include: * content-md5, content-type, and any header starting with 'x-amz-'. * @param expiryTime * the time after which URL's signature will no longer be valid. This time cannot be null. * @param isVirtualHost * if this parameter is true, the bucket name is treated as a virtual host name. To use * this option, the bucket name must be a valid DNS name that is an alias to an S3 bucket. * * @return * a URL signed in such a way as to allow anyone to PUT an object into S3. */ public String createSignedPutUrl(String bucketName, String objectKey, Map<String, Object> headersMap, Date expiryTime, boolean isVirtualHost) { long secondsSinceEpoch = expiryTime.getTime() / 1000; return createSignedUrl("PUT", bucketName, objectKey, null, headersMap, secondsSinceEpoch, isVirtualHost); }
/** * Generates a signed PUT URL. * * @param bucketName * the name of the bucket to include in the URL, must be a valid bucket name. * @param objectKey * the name of the object to include in the URL, if null only the bucket name is used. * @param headersMap * headers to add to the signed URL, may be null. * Headers that <b>must</b> match between the signed URL and the actual request include: * content-md5, content-type, and any header starting with 'x-amz-'. * @param expiryTime * the time after which URL's signature will no longer be valid. This time cannot be null. * @param isVirtualHost * if this parameter is true, the bucket name is treated as a virtual host name. To use * this option, the bucket name must be a valid DNS name that is an alias to an S3 bucket. * * @return * a URL signed in such a way as to allow anyone to PUT an object into S3. */ public String createSignedPutUrl(String bucketName, String objectKey, Map<String, Object> headersMap, Date expiryTime, boolean isVirtualHost) { long secondsSinceEpoch = expiryTime.getTime() / 1000; return createSignedUrl("PUT", bucketName, objectKey, null, headersMap, secondsSinceEpoch, isVirtualHost); }
/** * Generates a signed GET URL. * * @param bucketName * the name of the bucket to include in the URL, must be a valid bucket name. * @param objectKey * the name of the object to include in the URL, if null only the bucket name is used. * @param expiryTime * the time after which URL's signature will no longer be valid. This time cannot be null. * @param isVirtualHost * if this parameter is true, the bucket name is treated as a virtual host name. To use * this option, the bucket name must be a valid DNS name that is an alias to an S3 bucket. * * @return * a URL signed in such a way as to grant GET access to an S3 resource to whoever uses it. */ public String createSignedGetUrl(String bucketName, String objectKey, Date expiryTime, boolean isVirtualHost) { long secondsSinceEpoch = expiryTime.getTime() / 1000; return createSignedUrl("GET", bucketName, objectKey, null, null, secondsSinceEpoch, isVirtualHost); }
/** * Generates a signed HEAD URL. * * @param bucketName * the name of the bucket to include in the URL, must be a valid bucket name. * @param objectKey * the name of the object to include in the URL, if null only the bucket name is used. * @param expiryTime * the time after which URL's signature will no longer be valid. This time cannot be null. * @param isVirtualHost * if this parameter is true, the bucket name is treated as a virtual host name. To use * this option, the bucket name must be a valid DNS name that is an alias to an S3 bucket. * * @return * a URL signed in such a way as to grant HEAD access to an S3 resource to whoever uses it. */ public String createSignedHeadUrl(String bucketName, String objectKey, Date expiryTime, boolean isVirtualHost) { long secondsSinceEpoch = expiryTime.getTime() / 1000; return createSignedUrl("HEAD", bucketName, objectKey, null, null, secondsSinceEpoch, isVirtualHost); }
/** * Returns the URL representing an object in S3 without a signature. This URL * can only be used to download publicly-accessible objects. * * @param bucketName * the name of the bucket that contains the object. * @param objectKey * the key name of the object. * @param isVirtualHost * if this parameter is true, the bucket name is treated as a virtual host name. To use * this option, the bucket name must be a valid DNS name that is an alias to an S3 bucket. * @param isHttps * if true, the signed URL will use the HTTPS protocol. If false, the signed URL will * use the HTTP protocol. * @param isDnsBucketNamingDisabled * if true, the signed URL will not use the DNS-name format for buckets eg. * <tt>jets3t.s3.amazonaws.com</tt>. Unless you have a specific reason to disable * DNS bucket naming, leave this value false. * * @return * the object's URL. */ public String createUnsignedObjectUrl(String bucketName, String objectKey, boolean isVirtualHost, boolean isHttps, boolean isDnsBucketNamingDisabled) { // Create a signed GET URL then strip away the signature query components. String signedGETUrl = createSignedUrl("GET", bucketName, objectKey, null, null, 0, isVirtualHost, isHttps, isDnsBucketNamingDisabled); return signedGETUrl.split("\\?")[0]; }
/** * Returns the URL representing an object in S3 without a signature. This URL * can only be used to download publicly-accessible objects. * * @param bucketName * the name of the bucket that contains the object. * @param objectKey * the key name of the object. * @param isVirtualHost * if this parameter is true, the bucket name is treated as a virtual host name. To use * this option, the bucket name must be a valid DNS name that is an alias to an S3 bucket. * @param isHttps * if true, the signed URL will use the HTTPS protocol. If false, the signed URL will * use the HTTP protocol. * @param isDnsBucketNamingDisabled * if true, the signed URL will not use the DNS-name format for buckets eg. * <tt>jets3t.s3.amazonaws.com</tt>. Unless you have a specific reason to disable * DNS bucket naming, leave this value false. * * @return * the object's URL. */ public String createUnsignedObjectUrl(String bucketName, String objectKey, boolean isVirtualHost, boolean isHttps, boolean isDnsBucketNamingDisabled) { // Create a signed GET URL then strip away the signature query components. String signedGETUrl = createSignedUrl("GET", bucketName, objectKey, null, null, 0, isVirtualHost, isHttps, isDnsBucketNamingDisabled); return signedGETUrl.split("\\?")[0]; }
/** * Generates a signed GET URL. * * @deprecated 0.7.4 * * @param bucketName * the name of the bucket to include in the URL, must be a valid bucket name. * @param objectKey * the name of the object to include in the URL, if null only the bucket name is used. * @param credentials * the credentials of someone with sufficient privileges to grant access to the bucket/object * @param expiryTime * the time after which URL's signature will no longer be valid. This time cannot be null. * @param isVirtualHost * if this parameter is true, the bucket name is treated as a virtual host name. To use * this option, the bucket name must be a valid DNS name that is an alias to an S3 bucket. * * @return * a URL signed in such a way as to grant GET access to an S3 resource to whoever uses it. */ @Deprecated public String createSignedGetUrl(String bucketName, String objectKey, ProviderCredentials credentials, Date expiryTime, boolean isVirtualHost) { long secondsSinceEpoch = expiryTime.getTime() / 1000; return createSignedUrl("GET", bucketName, objectKey, null, null, credentials, secondsSinceEpoch, isVirtualHost); }
/** * Generates a signed HEAD URL. * * @deprecated 0.7.4 * * @param bucketName * the name of the bucket to include in the URL, must be a valid bucket name. * @param objectKey * the name of the object to include in the URL, if null only the bucket name is used. * @param credentials * the credentials of someone with sufficient privileges to grant access to the bucket/object * @param expiryTime * the time after which URL's signature will no longer be valid. This time cannot be null. * @param isVirtualHost * if this parameter is true, the bucket name is treated as a virtual host name. To use * this option, the bucket name must be a valid DNS name that is an alias to an S3 bucket. * * @return * a URL signed in such a way as to grant HEAD access to an S3 resource to whoever uses it. */ @Deprecated public String createSignedHeadUrl(String bucketName, String objectKey, ProviderCredentials credentials, Date expiryTime, boolean isVirtualHost) { long secondsSinceEpoch = expiryTime.getTime() / 1000; return createSignedUrl("HEAD", bucketName, objectKey, null, null, credentials, secondsSinceEpoch, isVirtualHost); }
/** * Generates a signed DELETE URL. * * @deprecated 0.7.4 * * @param bucketName * the name of the bucket to include in the URL, must be a valid bucket name. * @param objectKey * the name of the object to include in the URL, if null only the bucket name is used. * @param credentials * the credentials of someone with sufficient privileges to grant access to the bucket/object * @param expiryTime * the time after which URL's signature will no longer be valid. This time cannot be null. * @param isVirtualHost * if this parameter is true, the bucket name is treated as a virtual host name. To use * this option, the bucket name must be a valid DNS name that is an alias to an S3 bucket. * * @return * a URL signed in such a way as to allow anyone do DELETE an object in S3. */ @Deprecated public String createSignedDeleteUrl(String bucketName, String objectKey, ProviderCredentials credentials, Date expiryTime, boolean isVirtualHost) { long secondsSinceEpoch = expiryTime.getTime() / 1000; return createSignedUrl("DELETE", bucketName, objectKey, null, null, credentials, secondsSinceEpoch, isVirtualHost); }
/** * Generates a signed HEAD URL. * * @deprecated 0.7.4 * * @param bucketName * the name of the bucket to include in the URL, must be a valid bucket name. * @param objectKey * the name of the object to include in the URL, if null only the bucket name is used. * @param credentials * the credentials of someone with sufficient privileges to grant access to the bucket/object * @param expiryTime * the time after which URL's signature will no longer be valid. This time cannot be null. * @param isVirtualHost * if this parameter is true, the bucket name is treated as a virtual host name. To use * this option, the bucket name must be a valid DNS name that is an alias to an S3 bucket. * * @return * a URL signed in such a way as to grant HEAD access to an S3 resource to whoever uses it. */ @Deprecated public String createSignedHeadUrl(String bucketName, String objectKey, ProviderCredentials credentials, Date expiryTime, boolean isVirtualHost) { long secondsSinceEpoch = expiryTime.getTime() / 1000; return createSignedUrl("HEAD", bucketName, objectKey, null, null, credentials, secondsSinceEpoch, isVirtualHost); }
S3Object currentObject = objects[i]; String signedUrl = this.s3Service.createSignedUrl("GET", currentObject.getBucketName(), currentObject.getKey(), specialParamName, null, secondsSinceEpoch, virtualHostCheckBox.isSelected(),
public String signGetAcl(GatekeeperMessage requestMessage, ClientInformation clientInformation, SignatureRequest signatureRequest) throws S3ServiceException { updateObject(signatureRequest, requestMessage.getMessageProperties()); long secondsSinceEpoch = calculateExpiryTime(secondsUntilExpiry).getTime() / 1000; return s3Service.createSignedUrl("GET", signatureRequest.getBucketName(), signatureRequest.getObjectKey(), "acl", null, secondsSinceEpoch, false); }
public String signGetAcl(GatekeeperMessage requestMessage, ClientInformation clientInformation, SignatureRequest signatureRequest) throws S3ServiceException { updateObject(signatureRequest, requestMessage.getMessageProperties()); long secondsSinceEpoch = calculateExpiryTime(secondsUntilExpiry).getTime() / 1000; return s3Service.createSignedUrl("GET", signatureRequest.getBucketName(), signatureRequest.getObjectKey(), "acl", null, secondsSinceEpoch, false); }
public String signPutAcl(GatekeeperMessage requestMessage, ClientInformation clientInformation, SignatureRequest signatureRequest) throws S3ServiceException { updateObject(signatureRequest, requestMessage.getMessageProperties()); long secondsSinceEpoch = calculateExpiryTime(secondsUntilExpiry).getTime() / 1000; return s3Service.createSignedUrl("PUT", signatureRequest.getBucketName(), signatureRequest.getObjectKey(), "acl", signatureRequest.getObjectMetadata(), secondsSinceEpoch, false); }
public String signPutAcl(GatekeeperMessage requestMessage, ClientInformation clientInformation, SignatureRequest signatureRequest) throws S3ServiceException { updateObject(signatureRequest, requestMessage.getMessageProperties()); long secondsSinceEpoch = calculateExpiryTime(secondsUntilExpiry).getTime() / 1000; return s3Service.createSignedUrl("PUT", signatureRequest.getBucketName(), signatureRequest.getObjectKey(), "acl", signatureRequest.getObjectMetadata(), secondsSinceEpoch, false); }