Example #1
0
 /**
  * Get a query string authenticated URL
  *
  * @param   string $path Object URI
  *
  * @return  string
  */
 public function getAuthenticatedURL($path)
 {
     // Pre-signed URLs need to use the old S3 signature method. Therefore we need a new S3Client object.
     $amazonCredentials = new Credentials(self::$accessKey, self::$secretKey);
     $clientOptions = array('credentials' => $amazonCredentials, 'scheme' => self::$useSSL ? 'https' : 'http', 'signature' => 's3');
     if (self::$useSSL) {
         $clientOptions['ssl.certificate_authority'] = realpath(JPATH_LIBRARIES . '/fof30/Download/Adapter/cacert.pem');
     } else {
         $clientOptions['ssl.certificate_authority'] = false;
     }
     // Create the S3 client instance
     $s3Client = S3Client::factory($clientOptions);
     return $s3Client->getObjectUrl(self::$bucket, $path, '+' . self::$timeForSignedRequests . ' seconds');
 }