Currently I am generating the authenticated URL as :
$this->s3Client = new S3Client($this->options);
$cmd = $this->s3Client->getCommand('GetObject', [
'Bucket' => $bucket_name,
'Key' => $object_key
]);
$request = $this->s3Client->createPresignedRequest($cmd, PRESIGNED_URL_VALIDITY);
$presignedUrl = (string) $request->getUri();
Is there a way I could generate the query parameters in the authenticated URL on my own an not using createPresignedRequest
.
I need to separately create :
?X-Amz-Algorithm=AWS4-HMAC-SHA256
&X-Amz-Credential=
&X-Amz-Date=20130721T201207Z
&X-Amz-Expires=86400
&X-Amz-SignedHeaders=host
&X-Amz-Signature=<signature-value>
and the append it to the bucket file path to make it into the presigned request.
It's not exactly clear to me what you mean by "generate the query parameters in the authenticated URL on my own". AWS uses OpenSSL to deal with generating signatures and building signed URLs.
You could create signed URLs entirely w/o PHP, for e.g. on a Linux command line using the openssl
command. Check this for a bash example: https://github.com/gdbtek/aws-tools/blob/master/sign_s3_url.bash.
You can also use PHP w/o the S3Client to generate signed URLs using the PHP OpenSSL extension and utilising openssl_*
functions.