ruby-openid 1.1.4 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of ruby-openid might be problematic. Click here for more details.
- data/INSTALL +0 -9
- data/README +21 -22
- data/UPGRADE +117 -0
- data/admin/runtests.rb +36 -0
- data/examples/README +13 -21
- data/examples/active_record_openid_store/README +8 -3
- data/examples/active_record_openid_store/XXX_add_open_id_store_to_db.rb +4 -8
- data/examples/active_record_openid_store/XXX_upgrade_open_id_store.rb +26 -0
- data/examples/active_record_openid_store/lib/association.rb +2 -0
- data/examples/active_record_openid_store/lib/openid_ar_store.rb +22 -47
- data/examples/active_record_openid_store/test/store_test.rb +78 -48
- data/examples/discover +46 -0
- data/examples/{rails_server → rails_openid}/README +0 -0
- data/examples/{rails_server → rails_openid}/Rakefile +0 -0
- data/examples/{rails_server → rails_openid}/app/controllers/application.rb +0 -0
- data/examples/rails_openid/app/controllers/consumer_controller.rb +115 -0
- data/examples/{rails_server → rails_openid}/app/controllers/login_controller.rb +10 -2
- data/examples/rails_openid/app/controllers/server_controller.rb +265 -0
- data/examples/{rails_server → rails_openid}/app/helpers/application_helper.rb +0 -0
- data/examples/{rails_server → rails_openid}/app/helpers/login_helper.rb +0 -0
- data/examples/{rails_server → rails_openid}/app/helpers/server_helper.rb +0 -0
- data/examples/rails_openid/app/views/consumer/index.rhtml +81 -0
- data/examples/rails_openid/app/views/consumer/start.rhtml +8 -0
- data/examples/{rails_server → rails_openid}/app/views/layouts/server.rhtml +0 -0
- data/examples/{rails_server → rails_openid}/app/views/login/index.rhtml +1 -1
- data/examples/rails_openid/app/views/server/decide.rhtml +26 -0
- data/examples/{rails_server → rails_openid}/config/boot.rb +0 -0
- data/examples/{rails_server → rails_openid}/config/database.yml +0 -0
- data/examples/{rails_server → rails_openid}/config/environment.rb +0 -0
- data/examples/{rails_server → rails_openid}/config/environments/development.rb +0 -0
- data/examples/{rails_server → rails_openid}/config/environments/production.rb +0 -0
- data/examples/{rails_server → rails_openid}/config/environments/test.rb +0 -0
- data/examples/{rails_server → rails_openid}/config/routes.rb +2 -1
- data/examples/{rails_server → rails_openid}/doc/README_FOR_APP +0 -0
- data/examples/{rails_server → rails_openid}/public/404.html +0 -0
- data/examples/{rails_server → rails_openid}/public/500.html +0 -0
- data/examples/{rails_server → rails_openid}/public/dispatch.cgi +0 -0
- data/examples/{rails_server → rails_openid}/public/dispatch.fcgi +0 -0
- data/examples/{rails_server → rails_openid}/public/dispatch.rb +0 -0
- data/examples/{rails_server → rails_openid}/public/favicon.ico +0 -0
- data/examples/rails_openid/public/images/openid_login_bg.gif +0 -0
- data/examples/{rails_server → rails_openid}/public/javascripts/controls.js +0 -0
- data/examples/{rails_server → rails_openid}/public/javascripts/dragdrop.js +0 -0
- data/examples/{rails_server → rails_openid}/public/javascripts/effects.js +0 -0
- data/examples/{rails_server → rails_openid}/public/javascripts/prototype.js +0 -0
- data/examples/{rails_server → rails_openid}/public/robots.txt +0 -0
- data/examples/{rails_server → rails_openid}/script/about +0 -0
- data/examples/{rails_server → rails_openid}/script/breakpointer +0 -0
- data/examples/{rails_server → rails_openid}/script/console +0 -0
- data/examples/{rails_server → rails_openid}/script/destroy +0 -0
- data/examples/{rails_server → rails_openid}/script/generate +0 -0
- data/examples/{rails_server → rails_openid}/script/performance/benchmarker +0 -0
- data/examples/{rails_server → rails_openid}/script/performance/profiler +0 -0
- data/examples/{rails_server → rails_openid}/script/plugin +0 -0
- data/examples/{rails_server → rails_openid}/script/process/reaper +0 -0
- data/examples/{rails_server → rails_openid}/script/process/spawner +0 -0
- data/examples/{rails_server → rails_openid}/script/process/spinner +0 -0
- data/examples/{rails_server → rails_openid}/script/runner +0 -0
- data/examples/{rails_server → rails_openid}/script/server +0 -0
- data/examples/{rails_server → rails_openid}/test/functional/login_controller_test.rb +0 -0
- data/examples/{rails_server → rails_openid}/test/functional/server_controller_test.rb +0 -0
- data/examples/{rails_server → rails_openid}/test/test_helper.rb +0 -0
- data/lib/{hmac.rb → hmac/hmac.rb} +0 -0
- data/lib/{hmac-sha1.rb → hmac/sha1.rb} +1 -1
- data/lib/{hmac-sha2.rb → hmac/sha2.rb} +1 -1
- data/lib/openid/association.rb +213 -73
- data/lib/openid/consumer/associationmanager.rb +338 -0
- data/lib/openid/consumer/checkid_request.rb +175 -0
- data/lib/openid/consumer/discovery.rb +480 -0
- data/lib/openid/consumer/discovery_manager.rb +123 -0
- data/lib/openid/consumer/html_parse.rb +136 -0
- data/lib/openid/consumer/idres.rb +525 -0
- data/lib/openid/consumer/responses.rb +133 -0
- data/lib/openid/consumer.rb +280 -807
- data/lib/openid/cryptutil.rb +85 -0
- data/lib/openid/dh.rb +60 -23
- data/lib/openid/extension.rb +31 -0
- data/lib/openid/extensions/ax.rb +506 -0
- data/lib/openid/extensions/pape.rb +182 -0
- data/lib/openid/extensions/sreg.rb +275 -0
- data/lib/openid/extras.rb +11 -0
- data/lib/openid/fetchers.rb +132 -93
- data/lib/openid/kvform.rb +133 -0
- data/lib/openid/kvpost.rb +56 -0
- data/lib/openid/message.rb +534 -0
- data/lib/openid/protocolerror.rb +6 -0
- data/lib/openid/server.rb +1215 -666
- data/lib/openid/store/filesystem.rb +271 -0
- data/lib/openid/store/interface.rb +75 -0
- data/lib/openid/store/memory.rb +84 -0
- data/lib/openid/store/nonce.rb +68 -0
- data/lib/openid/trustroot.rb +314 -87
- data/lib/openid/urinorm.rb +37 -34
- data/lib/openid/util.rb +42 -220
- data/lib/openid/yadis/accept.rb +148 -0
- data/lib/openid/yadis/constants.rb +21 -0
- data/lib/openid/yadis/discovery.rb +153 -0
- data/lib/openid/yadis/filters.rb +205 -0
- data/lib/openid/{htmltokenizer.rb → yadis/htmltokenizer.rb} +1 -54
- data/lib/openid/yadis/parsehtml.rb +36 -0
- data/lib/openid/yadis/services.rb +42 -0
- data/lib/openid/yadis/xrds.rb +171 -0
- data/lib/openid/yadis/xri.rb +90 -0
- data/lib/openid/yadis/xrires.rb +106 -0
- data/lib/openid.rb +1 -4
- data/test/data/accept.txt +124 -0
- data/test/data/dh.txt +29 -0
- data/test/data/example-xrds.xml +14 -0
- data/test/data/linkparse.txt +587 -0
- data/test/data/n2b64 +650 -0
- data/test/data/test1-discover.txt +137 -0
- data/test/data/test1-parsehtml.txt +128 -0
- data/test/data/test_discover/openid.html +11 -0
- data/test/data/test_discover/openid2.html +11 -0
- data/test/data/test_discover/openid2_xrds.xml +12 -0
- data/test/data/test_discover/openid2_xrds_no_local_id.xml +11 -0
- data/test/data/test_discover/openid_1_and_2.html +11 -0
- data/test/data/test_discover/openid_1_and_2_xrds.xml +16 -0
- data/test/data/test_discover/openid_1_and_2_xrds_bad_delegate.xml +17 -0
- data/test/data/test_discover/openid_and_yadis.html +12 -0
- data/test/data/test_discover/openid_no_delegate.html +10 -0
- data/test/data/test_discover/yadis_0entries.xml +12 -0
- data/test/data/test_discover/yadis_2_bad_local_id.xml +15 -0
- data/test/data/test_discover/yadis_2entries_delegate.xml +22 -0
- data/test/data/test_discover/yadis_2entries_idp.xml +21 -0
- data/test/data/test_discover/yadis_another_delegate.xml +14 -0
- data/test/data/test_discover/yadis_idp.xml +12 -0
- data/test/data/test_discover/yadis_idp_delegate.xml +13 -0
- data/test/data/test_discover/yadis_no_delegate.xml +11 -0
- data/test/data/test_xrds/=j3h.2007.11.14.xrds +25 -0
- data/test/data/test_xrds/README +12 -0
- data/test/data/test_xrds/delegated-20060809-r1.xrds +34 -0
- data/test/data/test_xrds/delegated-20060809-r2.xrds +34 -0
- data/test/data/test_xrds/delegated-20060809.xrds +34 -0
- data/test/data/test_xrds/no-xrd.xml +7 -0
- data/test/data/test_xrds/not-xrds.xml +2 -0
- data/test/data/test_xrds/prefixsometimes.xrds +34 -0
- data/test/data/test_xrds/ref.xrds +109 -0
- data/test/data/test_xrds/sometimesprefix.xrds +34 -0
- data/test/data/test_xrds/spoof1.xrds +25 -0
- data/test/data/test_xrds/spoof2.xrds +25 -0
- data/test/data/test_xrds/spoof3.xrds +37 -0
- data/test/data/test_xrds/status222.xrds +9 -0
- data/test/data/test_xrds/valid-populated-xrds.xml +39 -0
- data/test/data/trustroot.txt +147 -0
- data/test/discoverdata.rb +131 -0
- data/test/test_accept.rb +170 -0
- data/test/test_association.rb +266 -0
- data/test/test_associationmanager.rb +899 -0
- data/test/test_ax.rb +587 -0
- data/test/test_checkid_request.rb +297 -0
- data/test/test_consumer.rb +257 -0
- data/test/test_cryptutil.rb +117 -0
- data/test/test_dh.rb +86 -0
- data/test/test_discover.rb +772 -0
- data/test/test_discovery_manager.rb +262 -0
- data/test/test_extras.rb +35 -0
- data/test/test_fetchers.rb +472 -0
- data/test/test_filters.rb +270 -0
- data/test/test_idres.rb +816 -0
- data/test/test_kvform.rb +165 -0
- data/test/test_kvpost.rb +65 -0
- data/test/test_linkparse.rb +101 -0
- data/test/test_message.rb +1058 -0
- data/test/test_nonce.rb +89 -0
- data/test/test_openid_yadis.rb +178 -0
- data/test/test_pape.rb +233 -0
- data/test/test_parsehtml.rb +80 -0
- data/test/test_responses.rb +63 -0
- data/test/test_server.rb +2270 -0
- data/test/test_sreg.rb +479 -0
- data/test/test_stores.rb +269 -0
- data/test/test_trustroot.rb +112 -0
- data/test/{urinorm.rb → test_urinorm.rb} +6 -3
- data/test/test_util.rb +144 -0
- data/test/test_xrds.rb +160 -0
- data/test/test_xri.rb +48 -0
- data/test/test_xrires.rb +63 -0
- data/test/test_yadis_discovery.rb +207 -0
- data/test/testutil.rb +116 -0
- data/test/util.rb +47 -50
- metadata +233 -143
- data/examples/consumer.rb +0 -290
- data/examples/rails_openid_login_generator/openid_login_generator-0.1.gem +0 -0
- data/examples/rails_server/app/controllers/server_controller.rb +0 -190
- data/examples/rails_server/app/views/server/decide.rhtml +0 -11
- data/examples/rails_server/public/images/rails.png +0 -0
- data/lib/hmac-md5.rb +0 -11
- data/lib/hmac-rmd160.rb +0 -11
- data/lib/openid/discovery.rb +0 -122
- data/lib/openid/filestore.rb +0 -315
- data/lib/openid/parse.rb +0 -23
- data/lib/openid/service.rb +0 -147
- data/lib/openid/stores.rb +0 -178
- data/test/assoc.rb +0 -38
- data/test/consumer.rb +0 -376
- data/test/data/brian.xrds +0 -16
- data/test/data/brianellin.mylid.xrds +0 -42
- data/test/dh.rb +0 -20
- data/test/extensions.rb +0 -30
- data/test/linkparse.rb +0 -305
- data/test/runtests.rb +0 -22
- data/test/server2.rb +0 -1053
- data/test/service.rb +0 -47
- data/test/storetestcase.rb +0 -172
- data/test/teststore.rb +0 -47
- data/test/trustroot.rb +0 -117
data/test/linkparse.rb
DELETED
@@ -1,305 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
|
3
|
-
require "openid/parse"
|
4
|
-
|
5
|
-
class LinkParseTestCase < Test::Unit::TestCase
|
6
|
-
|
7
|
-
def test_bad
|
8
|
-
cases = <<EOF
|
9
|
-
<foo>
|
10
|
-
|
11
|
-
<><barf
|
12
|
-
|
13
|
-
not even html
|
14
|
-
|
15
|
-
<link>
|
16
|
-
|
17
|
-
<html>
|
18
|
-
<link>
|
19
|
-
|
20
|
-
<head>
|
21
|
-
<link>
|
22
|
-
|
23
|
-
<html>
|
24
|
-
<head>
|
25
|
-
</head>
|
26
|
-
<link>
|
27
|
-
|
28
|
-
<html>
|
29
|
-
<link>
|
30
|
-
<head>
|
31
|
-
|
32
|
-
<link>
|
33
|
-
<html>
|
34
|
-
<head>
|
35
|
-
|
36
|
-
<html>
|
37
|
-
<head>
|
38
|
-
</head>
|
39
|
-
</html>
|
40
|
-
<link>
|
41
|
-
|
42
|
-
<html>
|
43
|
-
<head>
|
44
|
-
<html>
|
45
|
-
<link>
|
46
|
-
|
47
|
-
<head>
|
48
|
-
<html>
|
49
|
-
<link>
|
50
|
-
|
51
|
-
<html>
|
52
|
-
<head>
|
53
|
-
<body>
|
54
|
-
<link>
|
55
|
-
|
56
|
-
<html>
|
57
|
-
<head>
|
58
|
-
<head>
|
59
|
-
<link>
|
60
|
-
|
61
|
-
<html>
|
62
|
-
<head>
|
63
|
-
<script>
|
64
|
-
<link>
|
65
|
-
</script>
|
66
|
-
|
67
|
-
<html>
|
68
|
-
<head>
|
69
|
-
<!--
|
70
|
-
<link>
|
71
|
-
-->
|
72
|
-
|
73
|
-
<html>
|
74
|
-
<head>
|
75
|
-
<![CDATA[
|
76
|
-
<link>
|
77
|
-
]]>
|
78
|
-
|
79
|
-
<html>
|
80
|
-
<head>
|
81
|
-
<![cDaTa[
|
82
|
-
<link>
|
83
|
-
]]>
|
84
|
-
|
85
|
-
<htmlx>
|
86
|
-
<head>
|
87
|
-
<link>
|
88
|
-
|
89
|
-
<html:summer>
|
90
|
-
<head>
|
91
|
-
<link>
|
92
|
-
|
93
|
-
<html>
|
94
|
-
<head:zucchini>
|
95
|
-
<link>
|
96
|
-
|
97
|
-
<html/>
|
98
|
-
<head>
|
99
|
-
<link>
|
100
|
-
|
101
|
-
<html/>
|
102
|
-
<html>
|
103
|
-
<head>
|
104
|
-
<link>
|
105
|
-
|
106
|
-
<html>
|
107
|
-
<head/>
|
108
|
-
<link>
|
109
|
-
|
110
|
-
<html>
|
111
|
-
<head/>
|
112
|
-
<head>
|
113
|
-
<link>
|
114
|
-
|
115
|
-
<!-- Plain vanilla -->
|
116
|
-
<html>
|
117
|
-
<head>
|
118
|
-
<link>
|
119
|
-
|
120
|
-
<!-- Ignore tags in the <script:... > namespace -->
|
121
|
-
<html>
|
122
|
-
<head>
|
123
|
-
<script:paddypan>
|
124
|
-
<link>
|
125
|
-
</script:paddypan>
|
126
|
-
|
127
|
-
<!-- Short link tag -->
|
128
|
-
<html>
|
129
|
-
<head>
|
130
|
-
<link/>
|
131
|
-
|
132
|
-
<!-- Spaces in the HTML tag -->
|
133
|
-
<html >
|
134
|
-
<head>
|
135
|
-
<link>
|
136
|
-
|
137
|
-
<!-- Spaces in the head tag -->
|
138
|
-
<html>
|
139
|
-
<head >
|
140
|
-
<link>
|
141
|
-
|
142
|
-
<html>
|
143
|
-
<head>
|
144
|
-
<link >
|
145
|
-
|
146
|
-
<html><head><link>
|
147
|
-
|
148
|
-
<html>
|
149
|
-
<head>
|
150
|
-
<link>
|
151
|
-
</head>
|
152
|
-
|
153
|
-
<html>
|
154
|
-
<head>
|
155
|
-
<link>
|
156
|
-
</head>
|
157
|
-
<link>
|
158
|
-
|
159
|
-
<html>
|
160
|
-
<head>
|
161
|
-
<link>
|
162
|
-
<body>
|
163
|
-
<link>
|
164
|
-
|
165
|
-
<html>
|
166
|
-
<head>
|
167
|
-
<link>
|
168
|
-
</html>
|
169
|
-
|
170
|
-
<html>
|
171
|
-
<head>
|
172
|
-
<link>
|
173
|
-
</html>
|
174
|
-
<link>
|
175
|
-
|
176
|
-
<html>
|
177
|
-
<delicata>
|
178
|
-
<head>
|
179
|
-
<title>
|
180
|
-
<link>
|
181
|
-
|
182
|
-
<HtMl>
|
183
|
-
<hEaD>
|
184
|
-
<LiNk>
|
185
|
-
|
186
|
-
<butternut>
|
187
|
-
<html>
|
188
|
-
<summer>
|
189
|
-
<head>
|
190
|
-
<turban>
|
191
|
-
<link>
|
192
|
-
|
193
|
-
<html>
|
194
|
-
<head>
|
195
|
-
<script>
|
196
|
-
<link>
|
197
|
-
|
198
|
-
<html><head><script><link>
|
199
|
-
|
200
|
-
<html>
|
201
|
-
<head>
|
202
|
-
<!--
|
203
|
-
<link>
|
204
|
-
|
205
|
-
<html>
|
206
|
-
<head>
|
207
|
-
<![CDATA[
|
208
|
-
<link>
|
209
|
-
|
210
|
-
<html>
|
211
|
-
<head>
|
212
|
-
<![ACORN[
|
213
|
-
<link>
|
214
|
-
]]>
|
215
|
-
|
216
|
-
<html>
|
217
|
-
<head>
|
218
|
-
<link>
|
219
|
-
|
220
|
-
<html>
|
221
|
-
<head>
|
222
|
-
<link>
|
223
|
-
<link>
|
224
|
-
|
225
|
-
<html>
|
226
|
-
<gold nugget>
|
227
|
-
<head>
|
228
|
-
<link>
|
229
|
-
<link>
|
230
|
-
|
231
|
-
<html>
|
232
|
-
<head>
|
233
|
-
<link>
|
234
|
-
<LiNk>
|
235
|
-
<body>
|
236
|
-
<link>
|
237
|
-
EOF
|
238
|
-
|
239
|
-
|
240
|
-
results = []
|
241
|
-
cases.split("\n\n").each do |c|
|
242
|
-
parse_link_attrs(c){ |x| results << x }
|
243
|
-
end
|
244
|
-
|
245
|
-
results.each {|r| assert(r == {}, r.to_s)}
|
246
|
-
end
|
247
|
-
|
248
|
-
def test_good_rel
|
249
|
-
cases = [
|
250
|
-
"<html><head><link rel=openid.server>",
|
251
|
-
"<html><head><link rel=openid.server />",
|
252
|
-
"<html><head><link hubbard rel=openid.server>",
|
253
|
-
"<html><head><link hubbard rel=openid.server></link>",
|
254
|
-
"<html><head><link hubbard rel=openid.server />",
|
255
|
-
"<html><head><link / rel=openid.server>",
|
256
|
-
"<html><head><link rel='openid.server'>"
|
257
|
-
]
|
258
|
-
|
259
|
-
results = []
|
260
|
-
cases.each do |c|
|
261
|
-
parse_link_attrs(c) { |x| results << x }
|
262
|
-
end
|
263
|
-
|
264
|
-
assert_equal(cases.length, results.length)
|
265
|
-
results.each { |x| assert(x["rel"] == "openid.server", x["rel"]) }
|
266
|
-
end
|
267
|
-
|
268
|
-
def test_good
|
269
|
-
lj_test = <<EOF
|
270
|
-
<!DOCTYPE html
|
271
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
272
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
273
|
-
<html xmlns="http://www.w3.org/1999/xhtml">
|
274
|
-
<head>
|
275
|
-
<link rel="stylesheet" href="http://www.livejournal.com/~serotta/res/319998/stylesheet?1130478711" type="text/css" />
|
276
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
277
|
-
<meta name="foaf:maker" content="foaf:mbox_sha1sum '12f8abdacb5b1a806711e23249da592c0d316260'" />
|
278
|
-
<meta name="robots" content="noindex, nofollow, noarchive" />
|
279
|
-
<meta name="googlebot" content="nosnippet" />
|
280
|
-
<link rel="openid.server" href="http://www.livejournal.com/openid/server.bml" />
|
281
|
-
<title>Brian</title>
|
282
|
-
</head>
|
283
|
-
EOF
|
284
|
-
cases = [
|
285
|
-
["<html><head><link rel=\"openid.server\" href=\"http://www.myopenid.com/server\" /></head></html>", [{"rel"=>"openid.server","href"=>"http://www.myopenid.com/server"}]],
|
286
|
-
###
|
287
|
-
["<html><head><link rel='openid.server' href='http://www.myopenid.com/server' /><link rel='openid.delegate' href='http://example.myopenid.com/' /></head></html>",
|
288
|
-
[{"rel"=>"openid.server","href"=>"http://www.myopenid.com/server"},
|
289
|
-
{"rel"=>"openid.delegate","href"=>"http://example.myopenid.com/"}]],
|
290
|
-
###
|
291
|
-
[lj_test,
|
292
|
-
[{"rel"=>"stylesheet","type"=>"text/css","href"=>"http://www.livejournal.com/~serotta/res/319998/stylesheet?1130478711"},
|
293
|
-
{"rel"=>"openid.server","href"=>"http://www.livejournal.com/openid/server.bml"}]]
|
294
|
-
|
295
|
-
]
|
296
|
-
|
297
|
-
cases.each do |unparsed, expected|
|
298
|
-
actual = []
|
299
|
-
parse_link_attrs(unparsed) {|x| actual << x}
|
300
|
-
assert_equal(expected, actual)
|
301
|
-
end
|
302
|
-
|
303
|
-
end
|
304
|
-
|
305
|
-
end
|
data/test/runtests.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby
|
2
|
-
|
3
|
-
# the tests exploit some corner cases which generate warning messages
|
4
|
-
# on stderr. try and silence those messages to avoid unnecessarily concerning
|
5
|
-
# the library user.
|
6
|
-
begin
|
7
|
-
STDERR.reopen('/dev/null', 'w')
|
8
|
-
rescue
|
9
|
-
puts "\nPlease ignore the non Test::Unit error messages generated below.\n"
|
10
|
-
end
|
11
|
-
|
12
|
-
require "teststore"
|
13
|
-
require "assoc"
|
14
|
-
require "dh"
|
15
|
-
require "util"
|
16
|
-
require "linkparse"
|
17
|
-
require "trustroot"
|
18
|
-
require "assoc"
|
19
|
-
require "server2"
|
20
|
-
require "consumer"
|
21
|
-
require "service"
|
22
|
-
require "urinorm"
|