nov-ruby-openid 2.1.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (203) hide show
  1. data/CHANGELOG +215 -0
  2. data/CHANGES-2.1.0 +36 -0
  3. data/INSTALL +47 -0
  4. data/LICENSE +210 -0
  5. data/NOTICE +2 -0
  6. data/README +81 -0
  7. data/Rakefile +98 -0
  8. data/UPGRADE +127 -0
  9. data/VERSION +1 -0
  10. data/contrib/google/ruby-openid-apps-discovery-1.0.gem +0 -0
  11. data/contrib/google/ruby-openid-apps-discovery-1.01.gem +0 -0
  12. data/examples/README +32 -0
  13. data/examples/active_record_openid_store/README +58 -0
  14. data/examples/active_record_openid_store/XXX_add_open_id_store_to_db.rb +24 -0
  15. data/examples/active_record_openid_store/XXX_upgrade_open_id_store.rb +26 -0
  16. data/examples/active_record_openid_store/init.rb +8 -0
  17. data/examples/active_record_openid_store/lib/association.rb +10 -0
  18. data/examples/active_record_openid_store/lib/nonce.rb +3 -0
  19. data/examples/active_record_openid_store/lib/open_id_setting.rb +4 -0
  20. data/examples/active_record_openid_store/lib/openid_ar_store.rb +57 -0
  21. data/examples/active_record_openid_store/test/store_test.rb +212 -0
  22. data/examples/discover +49 -0
  23. data/examples/rails_openid/README +153 -0
  24. data/examples/rails_openid/Rakefile +10 -0
  25. data/examples/rails_openid/app/controllers/application.rb +4 -0
  26. data/examples/rails_openid/app/controllers/consumer_controller.rb +122 -0
  27. data/examples/rails_openid/app/controllers/login_controller.rb +45 -0
  28. data/examples/rails_openid/app/controllers/server_controller.rb +265 -0
  29. data/examples/rails_openid/app/helpers/application_helper.rb +3 -0
  30. data/examples/rails_openid/app/helpers/login_helper.rb +2 -0
  31. data/examples/rails_openid/app/helpers/server_helper.rb +9 -0
  32. data/examples/rails_openid/app/views/consumer/index.rhtml +81 -0
  33. data/examples/rails_openid/app/views/layouts/server.rhtml +68 -0
  34. data/examples/rails_openid/app/views/login/index.rhtml +56 -0
  35. data/examples/rails_openid/app/views/server/decide.rhtml +26 -0
  36. data/examples/rails_openid/config/boot.rb +19 -0
  37. data/examples/rails_openid/config/database.yml +74 -0
  38. data/examples/rails_openid/config/environment.rb +54 -0
  39. data/examples/rails_openid/config/environments/development.rb +19 -0
  40. data/examples/rails_openid/config/environments/production.rb +19 -0
  41. data/examples/rails_openid/config/environments/test.rb +19 -0
  42. data/examples/rails_openid/config/routes.rb +24 -0
  43. data/examples/rails_openid/doc/README_FOR_APP +2 -0
  44. data/examples/rails_openid/public/.htaccess +40 -0
  45. data/examples/rails_openid/public/404.html +8 -0
  46. data/examples/rails_openid/public/500.html +8 -0
  47. data/examples/rails_openid/public/dispatch.cgi +12 -0
  48. data/examples/rails_openid/public/dispatch.fcgi +26 -0
  49. data/examples/rails_openid/public/dispatch.rb +12 -0
  50. data/examples/rails_openid/public/favicon.ico +0 -0
  51. data/examples/rails_openid/public/images/openid_login_bg.gif +0 -0
  52. data/examples/rails_openid/public/javascripts/controls.js +750 -0
  53. data/examples/rails_openid/public/javascripts/dragdrop.js +584 -0
  54. data/examples/rails_openid/public/javascripts/effects.js +854 -0
  55. data/examples/rails_openid/public/javascripts/prototype.js +1785 -0
  56. data/examples/rails_openid/public/robots.txt +1 -0
  57. data/examples/rails_openid/script/about +3 -0
  58. data/examples/rails_openid/script/breakpointer +3 -0
  59. data/examples/rails_openid/script/console +3 -0
  60. data/examples/rails_openid/script/destroy +3 -0
  61. data/examples/rails_openid/script/generate +3 -0
  62. data/examples/rails_openid/script/performance/benchmarker +3 -0
  63. data/examples/rails_openid/script/performance/profiler +3 -0
  64. data/examples/rails_openid/script/plugin +3 -0
  65. data/examples/rails_openid/script/process/reaper +3 -0
  66. data/examples/rails_openid/script/process/spawner +3 -0
  67. data/examples/rails_openid/script/process/spinner +3 -0
  68. data/examples/rails_openid/script/runner +3 -0
  69. data/examples/rails_openid/script/server +3 -0
  70. data/examples/rails_openid/test/functional/login_controller_test.rb +18 -0
  71. data/examples/rails_openid/test/functional/server_controller_test.rb +18 -0
  72. data/examples/rails_openid/test/test_helper.rb +28 -0
  73. data/lib/hmac/hmac.rb +112 -0
  74. data/lib/hmac/sha1.rb +11 -0
  75. data/lib/hmac/sha2.rb +25 -0
  76. data/lib/openid.rb +20 -0
  77. data/lib/openid/association.rb +249 -0
  78. data/lib/openid/consumer.rb +395 -0
  79. data/lib/openid/consumer/associationmanager.rb +344 -0
  80. data/lib/openid/consumer/checkid_request.rb +186 -0
  81. data/lib/openid/consumer/discovery.rb +497 -0
  82. data/lib/openid/consumer/discovery_manager.rb +123 -0
  83. data/lib/openid/consumer/html_parse.rb +134 -0
  84. data/lib/openid/consumer/idres.rb +523 -0
  85. data/lib/openid/consumer/responses.rb +148 -0
  86. data/lib/openid/cryptutil.rb +115 -0
  87. data/lib/openid/dh.rb +89 -0
  88. data/lib/openid/extension.rb +39 -0
  89. data/lib/openid/extensions/ax.rb +539 -0
  90. data/lib/openid/extensions/oauth.rb +91 -0
  91. data/lib/openid/extensions/pape.rb +179 -0
  92. data/lib/openid/extensions/sreg.rb +277 -0
  93. data/lib/openid/extensions/ui.rb +53 -0
  94. data/lib/openid/extras.rb +11 -0
  95. data/lib/openid/fetchers.rb +258 -0
  96. data/lib/openid/kvform.rb +136 -0
  97. data/lib/openid/kvpost.rb +58 -0
  98. data/lib/openid/message.rb +553 -0
  99. data/lib/openid/protocolerror.rb +8 -0
  100. data/lib/openid/server.rb +1544 -0
  101. data/lib/openid/store/filesystem.rb +271 -0
  102. data/lib/openid/store/interface.rb +75 -0
  103. data/lib/openid/store/memcache.rb +107 -0
  104. data/lib/openid/store/memory.rb +84 -0
  105. data/lib/openid/store/nonce.rb +68 -0
  106. data/lib/openid/trustroot.rb +349 -0
  107. data/lib/openid/urinorm.rb +75 -0
  108. data/lib/openid/util.rb +110 -0
  109. data/lib/openid/yadis/accept.rb +148 -0
  110. data/lib/openid/yadis/constants.rb +21 -0
  111. data/lib/openid/yadis/discovery.rb +153 -0
  112. data/lib/openid/yadis/filters.rb +205 -0
  113. data/lib/openid/yadis/htmltokenizer.rb +305 -0
  114. data/lib/openid/yadis/parsehtml.rb +45 -0
  115. data/lib/openid/yadis/services.rb +42 -0
  116. data/lib/openid/yadis/xrds.rb +155 -0
  117. data/lib/openid/yadis/xri.rb +90 -0
  118. data/lib/openid/yadis/xrires.rb +99 -0
  119. data/setup.rb +1551 -0
  120. data/test/data/accept.txt +124 -0
  121. data/test/data/dh.txt +29 -0
  122. data/test/data/example-xrds.xml +14 -0
  123. data/test/data/linkparse.txt +587 -0
  124. data/test/data/n2b64 +650 -0
  125. data/test/data/test1-discover.txt +137 -0
  126. data/test/data/test1-parsehtml.txt +152 -0
  127. data/test/data/test_discover/malformed_meta_tag.html +19 -0
  128. data/test/data/test_discover/openid.html +11 -0
  129. data/test/data/test_discover/openid2.html +11 -0
  130. data/test/data/test_discover/openid2_xrds.xml +12 -0
  131. data/test/data/test_discover/openid2_xrds_no_local_id.xml +11 -0
  132. data/test/data/test_discover/openid_1_and_2.html +11 -0
  133. data/test/data/test_discover/openid_1_and_2_xrds.xml +16 -0
  134. data/test/data/test_discover/openid_1_and_2_xrds_bad_delegate.xml +17 -0
  135. data/test/data/test_discover/openid_and_yadis.html +12 -0
  136. data/test/data/test_discover/openid_no_delegate.html +10 -0
  137. data/test/data/test_discover/openid_utf8.html +11 -0
  138. data/test/data/test_discover/yadis_0entries.xml +12 -0
  139. data/test/data/test_discover/yadis_2_bad_local_id.xml +15 -0
  140. data/test/data/test_discover/yadis_2entries_delegate.xml +22 -0
  141. data/test/data/test_discover/yadis_2entries_idp.xml +21 -0
  142. data/test/data/test_discover/yadis_another_delegate.xml +14 -0
  143. data/test/data/test_discover/yadis_idp.xml +12 -0
  144. data/test/data/test_discover/yadis_idp_delegate.xml +13 -0
  145. data/test/data/test_discover/yadis_no_delegate.xml +11 -0
  146. data/test/data/test_xrds/=j3h.2007.11.14.xrds +25 -0
  147. data/test/data/test_xrds/README +12 -0
  148. data/test/data/test_xrds/delegated-20060809-r1.xrds +34 -0
  149. data/test/data/test_xrds/delegated-20060809-r2.xrds +34 -0
  150. data/test/data/test_xrds/delegated-20060809.xrds +34 -0
  151. data/test/data/test_xrds/no-xrd.xml +7 -0
  152. data/test/data/test_xrds/not-xrds.xml +2 -0
  153. data/test/data/test_xrds/prefixsometimes.xrds +34 -0
  154. data/test/data/test_xrds/ref.xrds +109 -0
  155. data/test/data/test_xrds/sometimesprefix.xrds +34 -0
  156. data/test/data/test_xrds/spoof1.xrds +25 -0
  157. data/test/data/test_xrds/spoof2.xrds +25 -0
  158. data/test/data/test_xrds/spoof3.xrds +37 -0
  159. data/test/data/test_xrds/status222.xrds +9 -0
  160. data/test/data/test_xrds/subsegments.xrds +58 -0
  161. data/test/data/test_xrds/valid-populated-xrds.xml +39 -0
  162. data/test/data/trustroot.txt +153 -0
  163. data/test/data/urinorm.txt +79 -0
  164. data/test/discoverdata.rb +131 -0
  165. data/test/test_accept.rb +170 -0
  166. data/test/test_association.rb +266 -0
  167. data/test/test_associationmanager.rb +917 -0
  168. data/test/test_ax.rb +690 -0
  169. data/test/test_checkid_request.rb +294 -0
  170. data/test/test_consumer.rb +257 -0
  171. data/test/test_cryptutil.rb +119 -0
  172. data/test/test_dh.rb +86 -0
  173. data/test/test_discover.rb +852 -0
  174. data/test/test_discovery_manager.rb +262 -0
  175. data/test/test_extension.rb +46 -0
  176. data/test/test_extras.rb +35 -0
  177. data/test/test_fetchers.rb +565 -0
  178. data/test/test_filters.rb +270 -0
  179. data/test/test_idres.rb +963 -0
  180. data/test/test_kvform.rb +165 -0
  181. data/test/test_kvpost.rb +65 -0
  182. data/test/test_linkparse.rb +101 -0
  183. data/test/test_message.rb +1116 -0
  184. data/test/test_nonce.rb +89 -0
  185. data/test/test_oauth.rb +175 -0
  186. data/test/test_openid_yadis.rb +178 -0
  187. data/test/test_pape.rb +247 -0
  188. data/test/test_parsehtml.rb +80 -0
  189. data/test/test_responses.rb +63 -0
  190. data/test/test_server.rb +2457 -0
  191. data/test/test_sreg.rb +479 -0
  192. data/test/test_stores.rb +298 -0
  193. data/test/test_trustroot.rb +113 -0
  194. data/test/test_ui.rb +93 -0
  195. data/test/test_urinorm.rb +35 -0
  196. data/test/test_util.rb +145 -0
  197. data/test/test_xrds.rb +169 -0
  198. data/test/test_xri.rb +48 -0
  199. data/test/test_xrires.rb +63 -0
  200. data/test/test_yadis_discovery.rb +220 -0
  201. data/test/testutil.rb +127 -0
  202. data/test/util.rb +53 -0
  203. metadata +336 -0
@@ -0,0 +1,220 @@
1
+
2
+ require 'test/unit'
3
+ require 'uri'
4
+ require 'testutil'
5
+
6
+ require 'openid/yadis/discovery'
7
+ require 'openid/fetchers'
8
+ require 'openid/util'
9
+ require 'discoverdata'
10
+
11
+ module OpenID
12
+
13
+ module YadisDiscovery
14
+ include FetcherMixin
15
+ include DiscoverData
16
+
17
+ STATUS_HEADER_RE = /Status: (\d+) .*?$/m
18
+
19
+ four04_pat = "\nContent-Type: text/plain\n\nNo such file %s"
20
+
21
+ def self.mkResponse(data)
22
+ status_mo = data.scan(STATUS_HEADER_RE)
23
+ headers_str, body = data.split("\n\n", 2)
24
+ headers = {}
25
+ headers_str.split("\n", -1).each { |line|
26
+ k, v = line.split(':', 2)
27
+ k = k.strip().downcase
28
+ v = v.strip()
29
+ headers[k] = v
30
+ }
31
+ status = status_mo[0][0].to_i
32
+ return HTTPResponse._from_raw_data(status, body,
33
+ headers)
34
+ end
35
+
36
+ class TestFetcher
37
+ include DiscoverData
38
+
39
+ def initialize(base_url)
40
+ @base_url = base_url
41
+ end
42
+
43
+ def fetch(url, headers, body, redirect_limit=nil)
44
+ current_url = url
45
+ while true
46
+ parsed = URI::parse(current_url)
47
+ # parsed[2][1:]
48
+ path = parsed.path[1..-1]
49
+ begin
50
+ data = generateSample(path, @base_url)
51
+ rescue ArgumentError
52
+ return HTTPResponse._from_raw_data(404, '', {},
53
+ current_url)
54
+ end
55
+
56
+ response = YadisDiscovery.mkResponse(data)
57
+ if ["301", "302", "303", "307"].member?(response.code)
58
+ current_url = response['location']
59
+ else
60
+ response.final_url = current_url
61
+ return response
62
+ end
63
+ end
64
+ end
65
+ end
66
+
67
+ class MockFetcher
68
+ def initialize
69
+ @count = 0
70
+ end
71
+
72
+ def fetch(uri, headers=nil, body=nil, redirect_limit=nil)
73
+ @count += 1
74
+ if @count == 1
75
+ headers = {
76
+ 'X-XRDS-Location'.downcase => 'http://unittest/404',
77
+ }
78
+ return HTTPResponse._from_raw_data(200, '', headers, uri)
79
+ else
80
+ return HTTPResponse._from_raw_data(404, '', {}, uri)
81
+ end
82
+ end
83
+ end
84
+
85
+ class TestSecondGet < Test::Unit::TestCase
86
+ include FetcherMixin
87
+
88
+ def test_404
89
+ uri = "http://something.unittest/"
90
+ assert_raise(DiscoveryFailure) {
91
+ with_fetcher(MockFetcher.new) { Yadis.discover(uri) }
92
+ }
93
+ end
94
+ end
95
+
96
+ class DiscoveryTestCase
97
+ include DiscoverData
98
+ include FetcherMixin
99
+
100
+ def initialize(testcase, input_name, id_name, result_name, success)
101
+ @base_url = 'http://invalid.unittest/'
102
+ @testcase = testcase
103
+ @input_name = input_name
104
+ @id_name = id_name
105
+ @result_name = result_name
106
+ @success = success
107
+ end
108
+
109
+ def setup
110
+ @input_url, @expected = generateResult(@base_url,
111
+ @input_name,
112
+ @id_name,
113
+ @result_name,
114
+ @success)
115
+ end
116
+
117
+ def do_discovery
118
+ with_fetcher(TestFetcher.new(@base_url)) do
119
+ Yadis.discover(@input_url)
120
+ end
121
+ end
122
+
123
+ def runCustomTest
124
+ setup
125
+
126
+ if @expected.respond_to?("ancestors") and @expected.ancestors.member?(DiscoveryFailure)
127
+ @testcase.assert_raise(DiscoveryFailure) {
128
+ do_discovery
129
+ }
130
+ else
131
+ result = do_discovery
132
+ @testcase.assert_equal(@input_url, result.request_uri)
133
+
134
+ msg = sprintf("Identity URL mismatch: actual = %s, expected = %s",
135
+ result.normalized_uri, @expected.normalized_uri)
136
+ @testcase.assert_equal(@expected.normalized_uri, result.normalized_uri, msg)
137
+
138
+ msg = sprintf("Content mismatch: actual = %s, expected = %s",
139
+ result.response_text, @expected.response_text)
140
+ @testcase.assert_equal(@expected.response_text, result.response_text, msg)
141
+
142
+ expected_keys = @expected.instance_variables
143
+ expected_keys.sort!
144
+
145
+ actual_keys = result.instance_variables
146
+ actual_keys.sort!
147
+
148
+ @testcase.assert_equal(actual_keys, expected_keys)
149
+
150
+ @expected.instance_variables.each { |k|
151
+ exp_v = @expected.instance_variable_get(k)
152
+ act_v = result.instance_variable_get(k)
153
+ @testcase.assert_equal(act_v, exp_v, [k, exp_v, act_v])
154
+ }
155
+ end
156
+ end
157
+ end
158
+
159
+ class NoContentTypeFetcher
160
+ def fetch(url, body=nil, headers=nil, redirect_limit=nil)
161
+ return OpenID::HTTPResponse._from_raw_data(200, "", {}, nil)
162
+ end
163
+ end
164
+
165
+ class BlankContentTypeFetcher
166
+ def fetch(url, body=nil, headers=nil, redirect_limit=nil)
167
+ return OpenID::HTTPResponse._from_raw_data(200, "", {"Content-Type" => ""}, nil)
168
+ end
169
+ end
170
+
171
+ class TestYadisDiscovery < Test::Unit::TestCase
172
+ include FetcherMixin
173
+
174
+ def test_yadis_discovery
175
+ DiscoverData::TESTLIST.each { |success, input_name, id_name, result_name|
176
+ test = DiscoveryTestCase.new(self, input_name, id_name, result_name, success)
177
+ test.runCustomTest
178
+ }
179
+ end
180
+
181
+ def test_is_xrds_yadis_location
182
+ result = Yadis::DiscoveryResult.new('http://request.uri/')
183
+ result.normalized_uri = "http://normalized/"
184
+ result.xrds_uri = "http://normalized/xrds"
185
+
186
+ assert(result.is_xrds)
187
+ end
188
+
189
+ def test_is_xrds_content_type
190
+ result = Yadis::DiscoveryResult.new('http://request.uri/')
191
+ result.normalized_uri = result.xrds_uri = "http://normalized/"
192
+ result.content_type = Yadis::YADIS_CONTENT_TYPE
193
+
194
+ assert(result.is_xrds)
195
+ end
196
+
197
+ def test_is_xrds_neither
198
+ result = Yadis::DiscoveryResult.new('http://request.uri/')
199
+ result.normalized_uri = result.xrds_uri = "http://normalized/"
200
+ result.content_type = "another/content-type"
201
+
202
+ assert(!result.is_xrds)
203
+ end
204
+
205
+ def test_no_content_type
206
+ with_fetcher(NoContentTypeFetcher.new) do
207
+ result = Yadis.discover("http://bogus")
208
+ assert_equal(nil, result.content_type)
209
+ end
210
+ end
211
+
212
+ def test_blank_content_type
213
+ with_fetcher(BlankContentTypeFetcher.new) do
214
+ result = Yadis.discover("http://bogus")
215
+ assert_equal("", result.content_type)
216
+ end
217
+ end
218
+ end
219
+ end
220
+ end
@@ -0,0 +1,127 @@
1
+ require "pathname"
2
+
3
+ module OpenID
4
+ module TestDataMixin
5
+ TESTS_DIR = Pathname.new(__FILE__).dirname
6
+ TEST_DATA_DIR = Pathname.new('data')
7
+
8
+ def read_data_file(filename, lines=true, data_dir=TEST_DATA_DIR)
9
+ fname = TESTS_DIR.join(data_dir, filename)
10
+
11
+ if lines
12
+ fname.readlines
13
+ else
14
+ fname.read
15
+ end
16
+ end
17
+ end
18
+
19
+ module FetcherMixin
20
+ def with_fetcher(fetcher)
21
+ original_fetcher = OpenID.fetcher
22
+ begin
23
+ OpenID.fetcher = fetcher
24
+ return yield
25
+ ensure
26
+ OpenID.fetcher = original_fetcher
27
+ end
28
+ end
29
+ end
30
+
31
+ module Const
32
+ def const(symbol, value)
33
+ (class << self;self;end).instance_eval do
34
+ define_method(symbol) { value }
35
+ end
36
+ end
37
+ end
38
+
39
+ class MockResponse
40
+ attr_reader :code, :body
41
+
42
+ def initialize(code, body)
43
+ @code = code.to_s
44
+ @body = body
45
+ end
46
+ end
47
+
48
+ module ProtocolErrorMixin
49
+ def assert_protocol_error(str_prefix)
50
+ begin
51
+ result = yield
52
+ rescue ProtocolError => why
53
+ message = "Expected prefix #{str_prefix.inspect}, got "\
54
+ "#{why.message.inspect}"
55
+ assert(why.message.starts_with?(str_prefix), message)
56
+ else
57
+ fail("Expected ProtocolError. Got #{result.inspect}")
58
+ end
59
+ end
60
+ end
61
+
62
+ module OverrideMethodMixin
63
+ def with_method_overridden(method_name, proc)
64
+ original = method(method_name)
65
+ begin
66
+ # TODO: find a combination of undef calls which prevent the warning
67
+ verbose, $VERBOSE = $VERBOSE, false
68
+ define_method(method_name, proc)
69
+ module_function(method_name)
70
+ $VERBOSE = verbose
71
+ yield
72
+ ensure
73
+ if original.respond_to? :owner
74
+ original.owner.send(:undef_method, method_name)
75
+ original.owner.send :define_method, method_name, original
76
+ else
77
+ define_method(method_name, original)
78
+ module_function(method_name)
79
+ end
80
+ end
81
+ end
82
+ end
83
+
84
+ # To use:
85
+ # > x = Object.new
86
+ # > x.extend(InstanceDefExtension)
87
+ # > x.instance_def(:monkeys) do
88
+ # > "bananas"
89
+ # > end
90
+ # > x.monkeys
91
+ #
92
+ module InstanceDefExtension
93
+ def instance_def(method_name, &proc)
94
+ (class << self;self;end).instance_eval do
95
+ # TODO: find a combination of undef calls which prevent the warning
96
+ verbose, $VERBOSE = $VERBOSE, false
97
+ define_method(method_name, proc)
98
+ $VERBOSE = verbose
99
+ end
100
+ end
101
+ end
102
+
103
+ GOODSIG = '[A Good Signature]'
104
+
105
+ class GoodAssoc
106
+ attr_accessor :handle, :expires_in
107
+
108
+ def initialize(handle='-blah-')
109
+ @handle = handle
110
+ @expires_in = 3600
111
+ end
112
+
113
+ def check_message_signature(msg)
114
+ msg.get_arg(OPENID_NS, 'sig') == GOODSIG
115
+ end
116
+ end
117
+
118
+ class HTTPResponse
119
+ def self._from_raw_data(status, body="", headers={}, final_url=nil)
120
+ resp = Net::HTTPResponse.new('1.1', status.to_s, 'NONE')
121
+ me = self._from_net_response(resp, final_url)
122
+ me.initialize_http_header headers
123
+ me.body = body
124
+ return me
125
+ end
126
+ end
127
+ end
@@ -0,0 +1,53 @@
1
+ # Utilities that are only used in the testing code
2
+ require 'stringio'
3
+
4
+ module OpenID
5
+ module TestUtil
6
+ def assert_log_matches(*regexes)
7
+ begin
8
+ old_logger = Util.logger
9
+ log_output = StringIO.new
10
+ Util.logger = Logger.new(log_output)
11
+ result = yield
12
+ ensure
13
+ Util.logger = old_logger
14
+ end
15
+ log_output.rewind
16
+ log_lines = log_output.readlines
17
+ assert_equal(regexes.length, log_lines.length,
18
+ [regexes, log_lines].inspect)
19
+ log_lines.zip(regexes) do |line, regex|
20
+ assert_match(regex, line)
21
+ end
22
+ result
23
+ end
24
+
25
+ def assert_log_line_count(num_lines)
26
+ begin
27
+ old_logger = Util.logger
28
+ log_output = StringIO.new
29
+ Util.logger = Logger.new(log_output)
30
+ result = yield
31
+ ensure
32
+ Util.logger = old_logger
33
+ end
34
+ log_output.rewind
35
+ log_lines = log_output.readlines
36
+ assert_equal(num_lines, log_lines.length)
37
+ result
38
+ end
39
+
40
+ def silence_logging
41
+ begin
42
+ old_logger = Util.logger
43
+ log_output = StringIO.new
44
+ Util.logger = Logger.new(log_output)
45
+ result = yield
46
+ ensure
47
+ Util.logger = old_logger
48
+ end
49
+ result
50
+ end
51
+ end
52
+ end
53
+
metadata ADDED
@@ -0,0 +1,336 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: nov-ruby-openid
3
+ version: !ruby/object:Gem::Version
4
+ hash: 25
5
+ prerelease:
6
+ segments:
7
+ - 2
8
+ - 1
9
+ - 9
10
+ version: 2.1.9
11
+ platform: ruby
12
+ authors:
13
+ - nov matake
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-01-18 00:00:00 +09:00
19
+ default_executable:
20
+ dependencies: []
21
+
22
+ description:
23
+ email: nov@matake.jp
24
+ executables: []
25
+
26
+ extensions: []
27
+
28
+ extra_rdoc_files:
29
+ - CHANGELOG
30
+ - CHANGES-2.1.0
31
+ - INSTALL
32
+ - LICENSE
33
+ - README
34
+ - UPGRADE
35
+ files:
36
+ - CHANGELOG
37
+ - CHANGES-2.1.0
38
+ - INSTALL
39
+ - LICENSE
40
+ - NOTICE
41
+ - README
42
+ - Rakefile
43
+ - UPGRADE
44
+ - VERSION
45
+ - contrib/google/ruby-openid-apps-discovery-1.0.gem
46
+ - contrib/google/ruby-openid-apps-discovery-1.01.gem
47
+ - examples/README
48
+ - examples/active_record_openid_store/README
49
+ - examples/active_record_openid_store/XXX_add_open_id_store_to_db.rb
50
+ - examples/active_record_openid_store/XXX_upgrade_open_id_store.rb
51
+ - examples/active_record_openid_store/init.rb
52
+ - examples/active_record_openid_store/lib/association.rb
53
+ - examples/active_record_openid_store/lib/nonce.rb
54
+ - examples/active_record_openid_store/lib/open_id_setting.rb
55
+ - examples/active_record_openid_store/lib/openid_ar_store.rb
56
+ - examples/active_record_openid_store/test/store_test.rb
57
+ - examples/discover
58
+ - examples/rails_openid/README
59
+ - examples/rails_openid/Rakefile
60
+ - examples/rails_openid/app/controllers/application.rb
61
+ - examples/rails_openid/app/controllers/consumer_controller.rb
62
+ - examples/rails_openid/app/controllers/login_controller.rb
63
+ - examples/rails_openid/app/controllers/server_controller.rb
64
+ - examples/rails_openid/app/helpers/application_helper.rb
65
+ - examples/rails_openid/app/helpers/login_helper.rb
66
+ - examples/rails_openid/app/helpers/server_helper.rb
67
+ - examples/rails_openid/app/views/consumer/index.rhtml
68
+ - examples/rails_openid/app/views/layouts/server.rhtml
69
+ - examples/rails_openid/app/views/login/index.rhtml
70
+ - examples/rails_openid/app/views/server/decide.rhtml
71
+ - examples/rails_openid/config/boot.rb
72
+ - examples/rails_openid/config/database.yml
73
+ - examples/rails_openid/config/environment.rb
74
+ - examples/rails_openid/config/environments/development.rb
75
+ - examples/rails_openid/config/environments/production.rb
76
+ - examples/rails_openid/config/environments/test.rb
77
+ - examples/rails_openid/config/routes.rb
78
+ - examples/rails_openid/doc/README_FOR_APP
79
+ - examples/rails_openid/public/.htaccess
80
+ - examples/rails_openid/public/404.html
81
+ - examples/rails_openid/public/500.html
82
+ - examples/rails_openid/public/dispatch.cgi
83
+ - examples/rails_openid/public/dispatch.fcgi
84
+ - examples/rails_openid/public/dispatch.rb
85
+ - examples/rails_openid/public/favicon.ico
86
+ - examples/rails_openid/public/images/openid_login_bg.gif
87
+ - examples/rails_openid/public/javascripts/controls.js
88
+ - examples/rails_openid/public/javascripts/dragdrop.js
89
+ - examples/rails_openid/public/javascripts/effects.js
90
+ - examples/rails_openid/public/javascripts/prototype.js
91
+ - examples/rails_openid/public/robots.txt
92
+ - examples/rails_openid/script/about
93
+ - examples/rails_openid/script/breakpointer
94
+ - examples/rails_openid/script/console
95
+ - examples/rails_openid/script/destroy
96
+ - examples/rails_openid/script/generate
97
+ - examples/rails_openid/script/performance/benchmarker
98
+ - examples/rails_openid/script/performance/profiler
99
+ - examples/rails_openid/script/plugin
100
+ - examples/rails_openid/script/process/reaper
101
+ - examples/rails_openid/script/process/spawner
102
+ - examples/rails_openid/script/process/spinner
103
+ - examples/rails_openid/script/runner
104
+ - examples/rails_openid/script/server
105
+ - examples/rails_openid/test/functional/login_controller_test.rb
106
+ - examples/rails_openid/test/functional/server_controller_test.rb
107
+ - examples/rails_openid/test/test_helper.rb
108
+ - lib/hmac/hmac.rb
109
+ - lib/hmac/sha1.rb
110
+ - lib/hmac/sha2.rb
111
+ - lib/openid.rb
112
+ - lib/openid/association.rb
113
+ - lib/openid/consumer.rb
114
+ - lib/openid/consumer/associationmanager.rb
115
+ - lib/openid/consumer/checkid_request.rb
116
+ - lib/openid/consumer/discovery.rb
117
+ - lib/openid/consumer/discovery_manager.rb
118
+ - lib/openid/consumer/html_parse.rb
119
+ - lib/openid/consumer/idres.rb
120
+ - lib/openid/consumer/responses.rb
121
+ - lib/openid/cryptutil.rb
122
+ - lib/openid/dh.rb
123
+ - lib/openid/extension.rb
124
+ - lib/openid/extensions/ax.rb
125
+ - lib/openid/extensions/oauth.rb
126
+ - lib/openid/extensions/pape.rb
127
+ - lib/openid/extensions/sreg.rb
128
+ - lib/openid/extensions/ui.rb
129
+ - lib/openid/extras.rb
130
+ - lib/openid/fetchers.rb
131
+ - lib/openid/kvform.rb
132
+ - lib/openid/kvpost.rb
133
+ - lib/openid/message.rb
134
+ - lib/openid/protocolerror.rb
135
+ - lib/openid/server.rb
136
+ - lib/openid/store/filesystem.rb
137
+ - lib/openid/store/interface.rb
138
+ - lib/openid/store/memcache.rb
139
+ - lib/openid/store/memory.rb
140
+ - lib/openid/store/nonce.rb
141
+ - lib/openid/trustroot.rb
142
+ - lib/openid/urinorm.rb
143
+ - lib/openid/util.rb
144
+ - lib/openid/yadis/accept.rb
145
+ - lib/openid/yadis/constants.rb
146
+ - lib/openid/yadis/discovery.rb
147
+ - lib/openid/yadis/filters.rb
148
+ - lib/openid/yadis/htmltokenizer.rb
149
+ - lib/openid/yadis/parsehtml.rb
150
+ - lib/openid/yadis/services.rb
151
+ - lib/openid/yadis/xrds.rb
152
+ - lib/openid/yadis/xri.rb
153
+ - lib/openid/yadis/xrires.rb
154
+ - setup.rb
155
+ - test/data/accept.txt
156
+ - test/data/dh.txt
157
+ - test/data/example-xrds.xml
158
+ - test/data/linkparse.txt
159
+ - test/data/n2b64
160
+ - test/data/test1-discover.txt
161
+ - test/data/test1-parsehtml.txt
162
+ - test/data/test_discover/malformed_meta_tag.html
163
+ - test/data/test_discover/openid.html
164
+ - test/data/test_discover/openid2.html
165
+ - test/data/test_discover/openid2_xrds.xml
166
+ - test/data/test_discover/openid2_xrds_no_local_id.xml
167
+ - test/data/test_discover/openid_1_and_2.html
168
+ - test/data/test_discover/openid_1_and_2_xrds.xml
169
+ - test/data/test_discover/openid_1_and_2_xrds_bad_delegate.xml
170
+ - test/data/test_discover/openid_and_yadis.html
171
+ - test/data/test_discover/openid_no_delegate.html
172
+ - test/data/test_discover/openid_utf8.html
173
+ - test/data/test_discover/yadis_0entries.xml
174
+ - test/data/test_discover/yadis_2_bad_local_id.xml
175
+ - test/data/test_discover/yadis_2entries_delegate.xml
176
+ - test/data/test_discover/yadis_2entries_idp.xml
177
+ - test/data/test_discover/yadis_another_delegate.xml
178
+ - test/data/test_discover/yadis_idp.xml
179
+ - test/data/test_discover/yadis_idp_delegate.xml
180
+ - test/data/test_discover/yadis_no_delegate.xml
181
+ - test/data/test_xrds/=j3h.2007.11.14.xrds
182
+ - test/data/test_xrds/README
183
+ - test/data/test_xrds/delegated-20060809-r1.xrds
184
+ - test/data/test_xrds/delegated-20060809-r2.xrds
185
+ - test/data/test_xrds/delegated-20060809.xrds
186
+ - test/data/test_xrds/no-xrd.xml
187
+ - test/data/test_xrds/not-xrds.xml
188
+ - test/data/test_xrds/prefixsometimes.xrds
189
+ - test/data/test_xrds/ref.xrds
190
+ - test/data/test_xrds/sometimesprefix.xrds
191
+ - test/data/test_xrds/spoof1.xrds
192
+ - test/data/test_xrds/spoof2.xrds
193
+ - test/data/test_xrds/spoof3.xrds
194
+ - test/data/test_xrds/status222.xrds
195
+ - test/data/test_xrds/subsegments.xrds
196
+ - test/data/test_xrds/valid-populated-xrds.xml
197
+ - test/data/trustroot.txt
198
+ - test/data/urinorm.txt
199
+ - test/discoverdata.rb
200
+ - test/test_accept.rb
201
+ - test/test_association.rb
202
+ - test/test_associationmanager.rb
203
+ - test/test_ax.rb
204
+ - test/test_checkid_request.rb
205
+ - test/test_consumer.rb
206
+ - test/test_cryptutil.rb
207
+ - test/test_dh.rb
208
+ - test/test_discover.rb
209
+ - test/test_discovery_manager.rb
210
+ - test/test_extension.rb
211
+ - test/test_extras.rb
212
+ - test/test_fetchers.rb
213
+ - test/test_filters.rb
214
+ - test/test_idres.rb
215
+ - test/test_kvform.rb
216
+ - test/test_kvpost.rb
217
+ - test/test_linkparse.rb
218
+ - test/test_message.rb
219
+ - test/test_nonce.rb
220
+ - test/test_oauth.rb
221
+ - test/test_openid_yadis.rb
222
+ - test/test_pape.rb
223
+ - test/test_parsehtml.rb
224
+ - test/test_responses.rb
225
+ - test/test_server.rb
226
+ - test/test_sreg.rb
227
+ - test/test_stores.rb
228
+ - test/test_trustroot.rb
229
+ - test/test_ui.rb
230
+ - test/test_urinorm.rb
231
+ - test/test_util.rb
232
+ - test/test_xrds.rb
233
+ - test/test_xri.rb
234
+ - test/test_xrires.rb
235
+ - test/test_yadis_discovery.rb
236
+ - test/testutil.rb
237
+ - test/util.rb
238
+ has_rdoc: true
239
+ homepage: http://github.com/nov/ruby-openid/
240
+ licenses: []
241
+
242
+ post_install_message:
243
+ rdoc_options: []
244
+
245
+ require_paths:
246
+ - lib
247
+ required_ruby_version: !ruby/object:Gem::Requirement
248
+ none: false
249
+ requirements:
250
+ - - ">="
251
+ - !ruby/object:Gem::Version
252
+ hash: 3
253
+ segments:
254
+ - 0
255
+ version: "0"
256
+ required_rubygems_version: !ruby/object:Gem::Requirement
257
+ none: false
258
+ requirements:
259
+ - - ">="
260
+ - !ruby/object:Gem::Version
261
+ hash: 3
262
+ segments:
263
+ - 0
264
+ version: "0"
265
+ requirements: []
266
+
267
+ rubyforge_project:
268
+ rubygems_version: 1.4.1
269
+ signing_key:
270
+ specification_version: 3
271
+ summary: A library for consuming and serving OpenID identities.
272
+ test_files:
273
+ - examples/active_record_openid_store/XXX_add_open_id_store_to_db.rb
274
+ - examples/active_record_openid_store/XXX_upgrade_open_id_store.rb
275
+ - examples/active_record_openid_store/init.rb
276
+ - examples/active_record_openid_store/lib/association.rb
277
+ - examples/active_record_openid_store/lib/nonce.rb
278
+ - examples/active_record_openid_store/lib/open_id_setting.rb
279
+ - examples/active_record_openid_store/lib/openid_ar_store.rb
280
+ - examples/active_record_openid_store/test/store_test.rb
281
+ - examples/rails_openid/app/controllers/application.rb
282
+ - examples/rails_openid/app/controllers/consumer_controller.rb
283
+ - examples/rails_openid/app/controllers/login_controller.rb
284
+ - examples/rails_openid/app/controllers/server_controller.rb
285
+ - examples/rails_openid/app/helpers/application_helper.rb
286
+ - examples/rails_openid/app/helpers/login_helper.rb
287
+ - examples/rails_openid/app/helpers/server_helper.rb
288
+ - examples/rails_openid/config/boot.rb
289
+ - examples/rails_openid/config/environment.rb
290
+ - examples/rails_openid/config/environments/development.rb
291
+ - examples/rails_openid/config/environments/production.rb
292
+ - examples/rails_openid/config/environments/test.rb
293
+ - examples/rails_openid/config/routes.rb
294
+ - examples/rails_openid/public/dispatch.rb
295
+ - examples/rails_openid/test/functional/login_controller_test.rb
296
+ - examples/rails_openid/test/functional/server_controller_test.rb
297
+ - examples/rails_openid/test/test_helper.rb
298
+ - test/discoverdata.rb
299
+ - test/test_accept.rb
300
+ - test/test_association.rb
301
+ - test/test_associationmanager.rb
302
+ - test/test_ax.rb
303
+ - test/test_checkid_request.rb
304
+ - test/test_consumer.rb
305
+ - test/test_cryptutil.rb
306
+ - test/test_dh.rb
307
+ - test/test_discover.rb
308
+ - test/test_discovery_manager.rb
309
+ - test/test_extension.rb
310
+ - test/test_extras.rb
311
+ - test/test_fetchers.rb
312
+ - test/test_filters.rb
313
+ - test/test_idres.rb
314
+ - test/test_kvform.rb
315
+ - test/test_kvpost.rb
316
+ - test/test_linkparse.rb
317
+ - test/test_message.rb
318
+ - test/test_nonce.rb
319
+ - test/test_oauth.rb
320
+ - test/test_openid_yadis.rb
321
+ - test/test_pape.rb
322
+ - test/test_parsehtml.rb
323
+ - test/test_responses.rb
324
+ - test/test_server.rb
325
+ - test/test_sreg.rb
326
+ - test/test_stores.rb
327
+ - test/test_trustroot.rb
328
+ - test/test_ui.rb
329
+ - test/test_urinorm.rb
330
+ - test/test_util.rb
331
+ - test/test_xrds.rb
332
+ - test/test_xri.rb
333
+ - test/test_xrires.rb
334
+ - test/test_yadis_discovery.rb
335
+ - test/testutil.rb
336
+ - test/util.rb