From 0c8af4992cb0f7589dcafaad65ada12753c64594 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 23 Nov 2022 21:14:33 +0300 Subject: initial --- .../src/CloudFront/CloudFrontClient.php | 310 +++++++++++++++++++++ 1 file changed, 310 insertions(+) create mode 100644 vendor/aws/aws-sdk-php/src/CloudFront/CloudFrontClient.php (limited to 'vendor/aws/aws-sdk-php/src/CloudFront/CloudFrontClient.php') diff --git a/vendor/aws/aws-sdk-php/src/CloudFront/CloudFrontClient.php b/vendor/aws/aws-sdk-php/src/CloudFront/CloudFrontClient.php new file mode 100644 index 0000000..3a3f9ea --- /dev/null +++ b/vendor/aws/aws-sdk-php/src/CloudFront/CloudFrontClient.php @@ -0,0 +1,310 @@ +getSignedUrl( + $options['url'], + isset($options['expires']) ? $options['expires'] : null, + isset($options['policy']) ? $options['policy'] : null + ); + } + + /** + * Create a signed Amazon CloudFront cookie. + * + * This method accepts an array of configuration options: + * + * - url: (string) URL of the resource being signed (can include query + * string and wildcards). For example: http://d111111abcdef8.cloudfront.net/images/horizon.jpg?size=large&license=yes + * - policy: (string) JSON policy. Use this option when creating a signed + * URL for a custom policy. + * - expires: (int) UTC Unix timestamp used when signing with a canned + * policy. Not required when passing a custom 'policy' option. + * - key_pair_id: (string) The ID of the key pair used to sign CloudFront + * URLs for private distributions. + * - private_key: (string) The filepath ot the private key used to sign + * CloudFront URLs for private distributions. + * + * @param array $options Array of configuration options used when signing + * + * @return array Key => value pairs of signed cookies to set + * @throws \InvalidArgumentException if url, key_pair_id, or private_key + * were not specified. + * @link http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/WorkingWithStreamingDistributions.html + */ + public function getSignedCookie(array $options) + { + foreach (['key_pair_id', 'private_key'] as $required) { + if (!isset($options[$required])) { + throw new \InvalidArgumentException("$required is required"); + } + } + + $cookieSigner = new CookieSigner( + $options['key_pair_id'], + $options['private_key'] + ); + + return $cookieSigner->getSignedCookie( + isset($options['url']) ? $options['url'] : null, + isset($options['expires']) ? $options['expires'] : null, + isset($options['policy']) ? $options['policy'] : null + ); + } +} -- cgit v1.2.3