Class: Aws::CloudFront::CookieSigner
- Inherits:
-
Object
- Object
- Aws::CloudFront::CookieSigner
- Includes:
- Signer
- Defined in:
- lib/aws-sdk-cloudfront/cookie_signer.rb
Overview
Allows you to create signed cookie for Amazon CloudFront resources
signer = Aws::CloudFront::CookieSigner.new(
key_pair_id: "cf-keypair-id",
private_key_path: "./cf_private_key.pem"
)
= signer.(url,
policy: policy.to_json
)
Instance Method Summary collapse
-
#signed_cookie(url, params = {}) ⇒ Object
create a set of signed Amazon CloudFront cookie parameters.
Methods included from Signer
Instance Method Details
#signed_cookie(url, params = {}) ⇒ Object
create a set of signed Amazon CloudFront cookie parameters
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/aws-sdk-cloudfront/cookie_signer.rb', line 27 def (url, params = {}) content = {}.tap do |c| if params[:policy] c[:policy] = params[:policy] elsif url && params[:expires] scheme, uri = scheme_and_uri(url) c[:resource] = resource(scheme, uri) c[:expires] = time(params[:expires]) end end = {} signature(content).each { |k, v| ["CloudFront-#{k}"] = v.to_s.gsub("\n", '') } end |