leap_web_certs 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Readme.md +9 -0
- data/app/models/cert.rb +9 -3
- data/lib/leap_web_certs/version.rb +1 -1
- data/test/dummy/config/cert +56 -0
- data/test/dummy/log/development.log +0 -0
- data/test/dummy/log/test.log +21 -0
- data/test/unit/cert_test.rb +9 -2
- metadata +15 -11
- data/README.rdoc +0 -3
data/Readme.md
ADDED
data/app/models/cert.rb
CHANGED
@@ -11,7 +11,7 @@ class Cert < CouchRest::Model::Base
|
|
11
11
|
validates :random, :presence => true,
|
12
12
|
:numericality => {:greater_than => 0, :less_than => 1}
|
13
13
|
|
14
|
-
validates :
|
14
|
+
validates :zip_attachment, :presence => true
|
15
15
|
|
16
16
|
design do
|
17
17
|
view :by_random
|
@@ -30,6 +30,7 @@ class Cert < CouchRest::Model::Base
|
|
30
30
|
retry if Cert.by_random.count > 0
|
31
31
|
raise RECORD_NOT_FOUND
|
32
32
|
end
|
33
|
+
|
33
34
|
end
|
34
35
|
|
35
36
|
def set_random
|
@@ -37,15 +38,20 @@ class Cert < CouchRest::Model::Base
|
|
37
38
|
end
|
38
39
|
|
39
40
|
def attach_zip
|
40
|
-
|
41
|
+
file = File.open(Rails.root.join("config", "cert"))
|
42
|
+
self.create_attachment :file => file, :name => zipname
|
41
43
|
end
|
42
44
|
|
43
45
|
def zipname
|
44
46
|
'cert.zip'
|
45
47
|
end
|
46
48
|
|
47
|
-
def
|
49
|
+
def zip_attachment
|
48
50
|
attachments[zipname]
|
49
51
|
end
|
50
52
|
|
53
|
+
def zipped
|
54
|
+
read_attachment(zipname)
|
55
|
+
end
|
56
|
+
|
51
57
|
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
-----BEGIN RSA PRIVATE KEY-----
|
2
|
+
MIIFfQIBAAKCATEArnxTeU82frha6g4AchpzAA92ry0PD/FZVK5UiMsbwHfAl/XJ
|
3
|
+
udVH0+51DSC5X4p9esftRQNCaJY/4zESe15Sna7aR+FyUoE+L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soHY1XuSJCK75PFxLJKq3ydm
|
50
|
+
c/YgEkmZwOBR7ypXnT0Tcele120v+qhCRSeoZIEwtm27Dp8+My82fpx7xMKYAHn8
|
51
|
+
FhMVy/bQZgl9QAt7HNK7QoISBmkQFYey0Qq7aotloMhlIyCSN569RcKHdPhZCsCE
|
52
|
+
M6lQJXeXaD8sR9wE2nhxKnTJToebjr9mnlgavSsotnzjnm9fMt5CPGOUtG/qGNfB
|
53
|
+
VhdODq6KZ9Tk8MnYenC7SfiJ/cR0N/Yw5R8Yaa1K5qO+dyIwfXTkTr/Kg97N72jE
|
54
|
+
GB/GF1HkbZW7VnGWjgNAozftTRCsFoCTwv/ICcW+vYEDVh+hzWjJ/KLl7PruKDPS
|
55
|
+
rBlWWdV02QtVKpKYKvynML9kyEX6HeM=
|
56
|
+
-----END CERTIFICATE-----
|
File without changes
|
data/test/dummy/log/test.log
CHANGED
@@ -6,3 +6,24 @@ Processing by CertsController#show as HTML
|
|
6
6
|
Rendered text template (0.0ms)
|
7
7
|
Sent data cert_stub.zip (5.1ms)
|
8
8
|
Completed 200 OK in 6ms (Views: 5.0ms)
|
9
|
+
|
10
|
+
***** Debugger requested, but was not available (ensure ruby-debug is listed in Gemfile/installed as gem): Start server with --debugger to enable *****
|
11
|
+
|
12
|
+
|
13
|
+
***** Debugger requested, but was not available (ensure ruby-debug is listed in Gemfile/installed as gem): Start server with --debugger to enable *****
|
14
|
+
|
15
|
+
|
16
|
+
***** Debugger requested, but was not available (ensure ruby-debug is listed in Gemfile/installed as gem): Start server with --debugger to enable *****
|
17
|
+
|
18
|
+
|
19
|
+
***** Debugger requested, but was not available (ensure ruby-debug is listed in Gemfile/installed as gem): Start server with --debugger to enable *****
|
20
|
+
|
21
|
+
|
22
|
+
***** Debugger requested, but was not available (ensure ruby-debug is listed in Gemfile/installed as gem): Start server with --debugger to enable *****
|
23
|
+
|
24
|
+
|
25
|
+
***** Debugger requested, but was not available (ensure ruby-debug is listed in Gemfile/installed as gem): Start server with --debugger to enable *****
|
26
|
+
|
27
|
+
|
28
|
+
***** Debugger requested, but was not available (ensure ruby-debug is listed in Gemfile/installed as gem): Start server with --debugger to enable *****
|
29
|
+
|
data/test/unit/cert_test.rb
CHANGED
@@ -12,8 +12,15 @@ class CertTest < ActiveSupport::TestCase
|
|
12
12
|
assert @sample.has_attachment? "cert.zip"
|
13
13
|
end
|
14
14
|
|
15
|
-
test "cert.
|
16
|
-
assert_equal "application/zip", @sample.
|
15
|
+
test "cert.zip_attachment returns couchDB attachment" do
|
16
|
+
assert_equal "application/zip", @sample.zip_attachment["content_type"]
|
17
|
+
end
|
18
|
+
|
19
|
+
test "cert.zipped returns the actual data" do
|
20
|
+
@sample.save # This is required!
|
21
|
+
assert lines = @sample.zipped.split("\n")
|
22
|
+
assert_equal "-----BEGIN RSA PRIVATE KEY-----", lines.first.chomp
|
23
|
+
assert_equal "-----END CERTIFICATE-----", lines.last.chomp
|
17
24
|
end
|
18
25
|
|
19
26
|
test "cert.zipname returns name for the zip file" do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: leap_web_certs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Azul
|
@@ -15,11 +15,11 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-09-
|
18
|
+
date: 2012-09-18 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
|
+
name: rails
|
21
22
|
prerelease: false
|
22
|
-
type: :runtime
|
23
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
24
|
none: false
|
25
25
|
requirements:
|
@@ -31,11 +31,11 @@ dependencies:
|
|
31
31
|
- 2
|
32
32
|
- 8
|
33
33
|
version: 3.2.8
|
34
|
-
|
34
|
+
type: :runtime
|
35
35
|
version_requirements: *id001
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
|
+
name: leap_web_core
|
37
38
|
prerelease: false
|
38
|
-
type: :runtime
|
39
39
|
requirement: &id002 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
@@ -47,11 +47,11 @@ dependencies:
|
|
47
47
|
- 0
|
48
48
|
- 1
|
49
49
|
version: 0.0.1
|
50
|
-
|
50
|
+
type: :runtime
|
51
51
|
version_requirements: *id002
|
52
52
|
- !ruby/object:Gem::Dependency
|
53
|
+
name: mocha
|
53
54
|
prerelease: false
|
54
|
-
type: :development
|
55
55
|
requirement: &id003 !ruby/object:Gem::Requirement
|
56
56
|
none: false
|
57
57
|
requirements:
|
@@ -61,7 +61,7 @@ dependencies:
|
|
61
61
|
segments:
|
62
62
|
- 0
|
63
63
|
version: "0"
|
64
|
-
|
64
|
+
type: :development
|
65
65
|
version_requirements: *id003
|
66
66
|
description: This plugin for the leap platform distributes certs for the EIP client. It fetches the certs from a pool in CouchDB that is filled by leap-ca.
|
67
67
|
email:
|
@@ -83,7 +83,7 @@ files:
|
|
83
83
|
- lib/tasks/leap_web_certs_tasks.rake
|
84
84
|
- MIT-LICENSE
|
85
85
|
- Rakefile
|
86
|
-
-
|
86
|
+
- Readme.md
|
87
87
|
- test/dummy/README.rdoc
|
88
88
|
- test/dummy/app/helpers/application_helper.rb
|
89
89
|
- test/dummy/app/assets/javascripts/application.js
|
@@ -93,6 +93,7 @@ files:
|
|
93
93
|
- test/dummy/script/rails
|
94
94
|
- test/dummy/Rakefile
|
95
95
|
- test/dummy/config.ru
|
96
|
+
- test/dummy/log/development.log
|
96
97
|
- test/dummy/log/test.log
|
97
98
|
- test/dummy/public/404.html
|
98
99
|
- test/dummy/public/422.html
|
@@ -100,6 +101,7 @@ files:
|
|
100
101
|
- test/dummy/public/500.html
|
101
102
|
- test/dummy/config/locales/en.yml
|
102
103
|
- test/dummy/config/environment.rb
|
104
|
+
- test/dummy/config/cert
|
103
105
|
- test/dummy/config/environments/development.rb
|
104
106
|
- test/dummy/config/environments/test.rb
|
105
107
|
- test/dummy/config/environments/production.rb
|
@@ -161,6 +163,7 @@ test_files:
|
|
161
163
|
- test/dummy/script/rails
|
162
164
|
- test/dummy/Rakefile
|
163
165
|
- test/dummy/config.ru
|
166
|
+
- test/dummy/log/development.log
|
164
167
|
- test/dummy/log/test.log
|
165
168
|
- test/dummy/public/404.html
|
166
169
|
- test/dummy/public/422.html
|
@@ -168,6 +171,7 @@ test_files:
|
|
168
171
|
- test/dummy/public/500.html
|
169
172
|
- test/dummy/config/locales/en.yml
|
170
173
|
- test/dummy/config/environment.rb
|
174
|
+
- test/dummy/config/cert
|
171
175
|
- test/dummy/config/environments/development.rb
|
172
176
|
- test/dummy/config/environments/test.rb
|
173
177
|
- test/dummy/config/environments/production.rb
|
data/README.rdoc
DELETED