aws_cf_signer 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +4 -0
- data/VERSION +1 -1
- data/aws_cf_signer.gemspec +17 -20
- data/lib/aws_cf_signer.rb +2 -2
- data/test/test_aws_cf_signer.rb +2 -1
- metadata +6 -24
- data/.gitignore +0 -21
data/README.rdoc
CHANGED
@@ -4,6 +4,10 @@ Small gem for signing AWS CloudFront URLs given a AWS key_pair_id and pem file.
|
|
4
4
|
|
5
5
|
* http://docs.amazonwebservices.com/AmazonCloudFront/latest/DeveloperGuide/index.html?PrivateContent.html
|
6
6
|
|
7
|
+
== Installation
|
8
|
+
|
9
|
+
gem install aws_cf_signer
|
10
|
+
|
7
11
|
== Usage
|
8
12
|
|
9
13
|
# Pass in path to the private CloudFront key from AWS
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/aws_cf_signer.gemspec
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
# Generated by jeweler
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{aws_cf_signer}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Dylan Vaughn"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2011-02-08}
|
13
13
|
s.description = %q{Small gem for signing AWS CloudFront URLs given a AWS key_pair_id and pem file. Read more here: http://docs.amazonwebservices.com/AmazonCloudFront/latest/DeveloperGuide/index.html?PrivateContent.html}
|
14
14
|
s.email = %q{dylan.vaughn@stlondemand.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -17,32 +17,29 @@ Gem::Specification.new do |s|
|
|
17
17
|
]
|
18
18
|
s.files = [
|
19
19
|
".document",
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
"test/test_aws_cf_signer.rb"
|
20
|
+
"README.rdoc",
|
21
|
+
"Rakefile",
|
22
|
+
"VERSION",
|
23
|
+
"aws_cf_signer.gemspec",
|
24
|
+
"lib/aws_cf_signer.rb",
|
25
|
+
"test/fixtures/README",
|
26
|
+
"test/fixtures/custom_policy1",
|
27
|
+
"test/fixtures/custom_policy2",
|
28
|
+
"test/fixtures/pk-PK123456789754.pem",
|
29
|
+
"test/fixtures/rsa-PK123456789754.pem",
|
30
|
+
"test/helper.rb",
|
31
|
+
"test/test_aws_cf_signer.rb"
|
33
32
|
]
|
34
33
|
s.homepage = %q{http://github.com/stlondemand/aws_cf_signer}
|
35
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
36
34
|
s.require_paths = ["lib"]
|
37
|
-
s.rubygems_version = %q{1.
|
35
|
+
s.rubygems_version = %q{1.5.0}
|
38
36
|
s.summary = %q{Ruby gem for signing AWS Cloudfront URLs for serving private content}
|
39
37
|
s.test_files = [
|
40
38
|
"test/helper.rb",
|
41
|
-
|
39
|
+
"test/test_aws_cf_signer.rb"
|
42
40
|
]
|
43
41
|
|
44
42
|
if s.respond_to? :specification_version then
|
45
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
46
43
|
s.specification_version = 3
|
47
44
|
|
48
45
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
data/lib/aws_cf_signer.rb
CHANGED
@@ -39,8 +39,8 @@ class AwsCfSigner
|
|
39
39
|
def generate_custom_policy(resource, options)
|
40
40
|
conditions = ["\"DateLessThan\":{\"AWS:EpochTime\":#{epoch_time(options[:ending])}}"]
|
41
41
|
conditions << "\"DateGreaterThan\":{\"AWS:EpochTime\":#{epoch_time(options[:starting])}}" if options[:starting]
|
42
|
-
conditions << "\"IpAddress\":{\"AWS:SourceIp\"
|
43
|
-
%({"Statement":[{"Resource":"#{resource}","Condition":{#{conditions.join(',')}}}]})
|
42
|
+
conditions << "\"IpAddress\":{\"AWS:SourceIp\":\"#{options[:ip_range]}\"" if options[:ip_range]
|
43
|
+
%({"Statement":[{"Resource":"#{resource}","Condition":{#{conditions.join(',')}}}}]})
|
44
44
|
end
|
45
45
|
|
46
46
|
def epoch_time(timelike)
|
data/test/test_aws_cf_signer.rb
CHANGED
@@ -56,9 +56,10 @@ class TestAwsCfSigner < Test::Unit::TestCase
|
|
56
56
|
ip_range = '216.98.35.1/32'
|
57
57
|
assert_equal(
|
58
58
|
@cf_signer.generate_custom_policy('http://d84l721fxaaqy9.cloudfront.net/downloads/*', :starting => starting, :ending => ending, :ip_range => ip_range),
|
59
|
-
%({"Statement":[{"Resource":"http://d84l721fxaaqy9.cloudfront.net/downloads/*","Condition":{"DateLessThan":{"AWS:EpochTime":#{ending.to_i}},"DateGreaterThan":{"AWS:EpochTime":#{starting.to_i}},"IpAddress":{"AWS:SourceIp"
|
59
|
+
%({"Statement":[{"Resource":"http://d84l721fxaaqy9.cloudfront.net/downloads/*","Condition":{"DateLessThan":{"AWS:EpochTime":#{ending.to_i}},"DateGreaterThan":{"AWS:EpochTime":#{starting.to_i}},"IpAddress":{"AWS:SourceIp":"#{ip_range}"}}}]})
|
60
60
|
)
|
61
61
|
end
|
62
|
+
|
62
63
|
end
|
63
64
|
|
64
65
|
end
|
metadata
CHANGED
@@ -1,13 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws_cf_signer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
- 0
|
10
|
-
version: 0.1.0
|
4
|
+
prerelease:
|
5
|
+
version: 0.1.1
|
11
6
|
platform: ruby
|
12
7
|
authors:
|
13
8
|
- Dylan Vaughn
|
@@ -15,7 +10,7 @@ autorequire:
|
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
12
|
|
18
|
-
date:
|
13
|
+
date: 2011-02-08 00:00:00 -08:00
|
19
14
|
default_executable:
|
20
15
|
dependencies:
|
21
16
|
- !ruby/object:Gem::Dependency
|
@@ -26,9 +21,6 @@ dependencies:
|
|
26
21
|
requirements:
|
27
22
|
- - ">="
|
28
23
|
- !ruby/object:Gem::Version
|
29
|
-
hash: 3
|
30
|
-
segments:
|
31
|
-
- 0
|
32
24
|
version: "0"
|
33
25
|
type: :development
|
34
26
|
version_requirements: *id001
|
@@ -40,9 +32,6 @@ dependencies:
|
|
40
32
|
requirements:
|
41
33
|
- - ">="
|
42
34
|
- !ruby/object:Gem::Version
|
43
|
-
hash: 3
|
44
|
-
segments:
|
45
|
-
- 0
|
46
35
|
version: "0"
|
47
36
|
type: :development
|
48
37
|
version_requirements: *id002
|
@@ -56,7 +45,6 @@ extra_rdoc_files:
|
|
56
45
|
- README.rdoc
|
57
46
|
files:
|
58
47
|
- .document
|
59
|
-
- .gitignore
|
60
48
|
- README.rdoc
|
61
49
|
- Rakefile
|
62
50
|
- VERSION
|
@@ -74,8 +62,8 @@ homepage: http://github.com/stlondemand/aws_cf_signer
|
|
74
62
|
licenses: []
|
75
63
|
|
76
64
|
post_install_message:
|
77
|
-
rdoc_options:
|
78
|
-
|
65
|
+
rdoc_options: []
|
66
|
+
|
79
67
|
require_paths:
|
80
68
|
- lib
|
81
69
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -83,23 +71,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
83
71
|
requirements:
|
84
72
|
- - ">="
|
85
73
|
- !ruby/object:Gem::Version
|
86
|
-
hash: 3
|
87
|
-
segments:
|
88
|
-
- 0
|
89
74
|
version: "0"
|
90
75
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
76
|
none: false
|
92
77
|
requirements:
|
93
78
|
- - ">="
|
94
79
|
- !ruby/object:Gem::Version
|
95
|
-
hash: 3
|
96
|
-
segments:
|
97
|
-
- 0
|
98
80
|
version: "0"
|
99
81
|
requirements: []
|
100
82
|
|
101
83
|
rubyforge_project:
|
102
|
-
rubygems_version: 1.
|
84
|
+
rubygems_version: 1.5.0
|
103
85
|
signing_key:
|
104
86
|
specification_version: 3
|
105
87
|
summary: Ruby gem for signing AWS Cloudfront URLs for serving private content
|