ruby-openid 1.1.4 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (207) hide show
  1. data/INSTALL +0 -9
  2. data/README +21 -22
  3. data/UPGRADE +117 -0
  4. data/admin/runtests.rb +36 -0
  5. data/examples/README +13 -21
  6. data/examples/active_record_openid_store/README +8 -3
  7. data/examples/active_record_openid_store/XXX_add_open_id_store_to_db.rb +4 -8
  8. data/examples/active_record_openid_store/XXX_upgrade_open_id_store.rb +26 -0
  9. data/examples/active_record_openid_store/lib/association.rb +2 -0
  10. data/examples/active_record_openid_store/lib/openid_ar_store.rb +22 -47
  11. data/examples/active_record_openid_store/test/store_test.rb +78 -48
  12. data/examples/discover +46 -0
  13. data/examples/{rails_server → rails_openid}/README +0 -0
  14. data/examples/{rails_server → rails_openid}/Rakefile +0 -0
  15. data/examples/{rails_server → rails_openid}/app/controllers/application.rb +0 -0
  16. data/examples/rails_openid/app/controllers/consumer_controller.rb +115 -0
  17. data/examples/{rails_server → rails_openid}/app/controllers/login_controller.rb +10 -2
  18. data/examples/rails_openid/app/controllers/server_controller.rb +265 -0
  19. data/examples/{rails_server → rails_openid}/app/helpers/application_helper.rb +0 -0
  20. data/examples/{rails_server → rails_openid}/app/helpers/login_helper.rb +0 -0
  21. data/examples/{rails_server → rails_openid}/app/helpers/server_helper.rb +0 -0
  22. data/examples/rails_openid/app/views/consumer/index.rhtml +81 -0
  23. data/examples/rails_openid/app/views/consumer/start.rhtml +8 -0
  24. data/examples/{rails_server → rails_openid}/app/views/layouts/server.rhtml +0 -0
  25. data/examples/{rails_server → rails_openid}/app/views/login/index.rhtml +1 -1
  26. data/examples/rails_openid/app/views/server/decide.rhtml +26 -0
  27. data/examples/{rails_server → rails_openid}/config/boot.rb +0 -0
  28. data/examples/{rails_server → rails_openid}/config/database.yml +0 -0
  29. data/examples/{rails_server → rails_openid}/config/environment.rb +0 -0
  30. data/examples/{rails_server → rails_openid}/config/environments/development.rb +0 -0
  31. data/examples/{rails_server → rails_openid}/config/environments/production.rb +0 -0
  32. data/examples/{rails_server → rails_openid}/config/environments/test.rb +0 -0
  33. data/examples/{rails_server → rails_openid}/config/routes.rb +2 -1
  34. data/examples/{rails_server → rails_openid}/doc/README_FOR_APP +0 -0
  35. data/examples/{rails_server → rails_openid}/public/404.html +0 -0
  36. data/examples/{rails_server → rails_openid}/public/500.html +0 -0
  37. data/examples/{rails_server → rails_openid}/public/dispatch.cgi +0 -0
  38. data/examples/{rails_server → rails_openid}/public/dispatch.fcgi +0 -0
  39. data/examples/{rails_server → rails_openid}/public/dispatch.rb +0 -0
  40. data/examples/{rails_server → rails_openid}/public/favicon.ico +0 -0
  41. data/examples/rails_openid/public/images/openid_login_bg.gif +0 -0
  42. data/examples/{rails_server → rails_openid}/public/javascripts/controls.js +0 -0
  43. data/examples/{rails_server → rails_openid}/public/javascripts/dragdrop.js +0 -0
  44. data/examples/{rails_server → rails_openid}/public/javascripts/effects.js +0 -0
  45. data/examples/{rails_server → rails_openid}/public/javascripts/prototype.js +0 -0
  46. data/examples/{rails_server → rails_openid}/public/robots.txt +0 -0
  47. data/examples/{rails_server → rails_openid}/script/about +0 -0
  48. data/examples/{rails_server → rails_openid}/script/breakpointer +0 -0
  49. data/examples/{rails_server → rails_openid}/script/console +0 -0
  50. data/examples/{rails_server → rails_openid}/script/destroy +0 -0
  51. data/examples/{rails_server → rails_openid}/script/generate +0 -0
  52. data/examples/{rails_server → rails_openid}/script/performance/benchmarker +0 -0
  53. data/examples/{rails_server → rails_openid}/script/performance/profiler +0 -0
  54. data/examples/{rails_server → rails_openid}/script/plugin +0 -0
  55. data/examples/{rails_server → rails_openid}/script/process/reaper +0 -0
  56. data/examples/{rails_server → rails_openid}/script/process/spawner +0 -0
  57. data/examples/{rails_server → rails_openid}/script/process/spinner +0 -0
  58. data/examples/{rails_server → rails_openid}/script/runner +0 -0
  59. data/examples/{rails_server → rails_openid}/script/server +0 -0
  60. data/examples/{rails_server → rails_openid}/test/functional/login_controller_test.rb +0 -0
  61. data/examples/{rails_server → rails_openid}/test/functional/server_controller_test.rb +0 -0
  62. data/examples/{rails_server → rails_openid}/test/test_helper.rb +0 -0
  63. data/lib/{hmac.rb → hmac/hmac.rb} +0 -0
  64. data/lib/{hmac-sha1.rb → hmac/sha1.rb} +1 -1
  65. data/lib/{hmac-sha2.rb → hmac/sha2.rb} +1 -1
  66. data/lib/openid/association.rb +213 -73
  67. data/lib/openid/consumer/associationmanager.rb +338 -0
  68. data/lib/openid/consumer/checkid_request.rb +175 -0
  69. data/lib/openid/consumer/discovery.rb +480 -0
  70. data/lib/openid/consumer/discovery_manager.rb +123 -0
  71. data/lib/openid/consumer/html_parse.rb +136 -0
  72. data/lib/openid/consumer/idres.rb +525 -0
  73. data/lib/openid/consumer/responses.rb +133 -0
  74. data/lib/openid/consumer.rb +280 -807
  75. data/lib/openid/cryptutil.rb +85 -0
  76. data/lib/openid/dh.rb +60 -23
  77. data/lib/openid/extension.rb +31 -0
  78. data/lib/openid/extensions/ax.rb +506 -0
  79. data/lib/openid/extensions/pape.rb +182 -0
  80. data/lib/openid/extensions/sreg.rb +275 -0
  81. data/lib/openid/extras.rb +11 -0
  82. data/lib/openid/fetchers.rb +132 -93
  83. data/lib/openid/kvform.rb +133 -0
  84. data/lib/openid/kvpost.rb +56 -0
  85. data/lib/openid/message.rb +534 -0
  86. data/lib/openid/protocolerror.rb +6 -0
  87. data/lib/openid/server.rb +1215 -666
  88. data/lib/openid/store/filesystem.rb +271 -0
  89. data/lib/openid/store/interface.rb +75 -0
  90. data/lib/openid/store/memory.rb +84 -0
  91. data/lib/openid/store/nonce.rb +68 -0
  92. data/lib/openid/trustroot.rb +314 -87
  93. data/lib/openid/urinorm.rb +37 -34
  94. data/lib/openid/util.rb +42 -220
  95. data/lib/openid/yadis/accept.rb +148 -0
  96. data/lib/openid/yadis/constants.rb +21 -0
  97. data/lib/openid/yadis/discovery.rb +153 -0
  98. data/lib/openid/yadis/filters.rb +205 -0
  99. data/lib/openid/{htmltokenizer.rb → yadis/htmltokenizer.rb} +1 -54
  100. data/lib/openid/yadis/parsehtml.rb +36 -0
  101. data/lib/openid/yadis/services.rb +42 -0
  102. data/lib/openid/yadis/xrds.rb +171 -0
  103. data/lib/openid/yadis/xri.rb +90 -0
  104. data/lib/openid/yadis/xrires.rb +106 -0
  105. data/lib/openid.rb +1 -4
  106. data/test/data/accept.txt +124 -0
  107. data/test/data/dh.txt +29 -0
  108. data/test/data/example-xrds.xml +14 -0
  109. data/test/data/linkparse.txt +587 -0
  110. data/test/data/n2b64 +650 -0
  111. data/test/data/test1-discover.txt +137 -0
  112. data/test/data/test1-parsehtml.txt +128 -0
  113. data/test/data/test_discover/openid.html +11 -0
  114. data/test/data/test_discover/openid2.html +11 -0
  115. data/test/data/test_discover/openid2_xrds.xml +12 -0
  116. data/test/data/test_discover/openid2_xrds_no_local_id.xml +11 -0
  117. data/test/data/test_discover/openid_1_and_2.html +11 -0
  118. data/test/data/test_discover/openid_1_and_2_xrds.xml +16 -0
  119. data/test/data/test_discover/openid_1_and_2_xrds_bad_delegate.xml +17 -0
  120. data/test/data/test_discover/openid_and_yadis.html +12 -0
  121. data/test/data/test_discover/openid_no_delegate.html +10 -0
  122. data/test/data/test_discover/yadis_0entries.xml +12 -0
  123. data/test/data/test_discover/yadis_2_bad_local_id.xml +15 -0
  124. data/test/data/test_discover/yadis_2entries_delegate.xml +22 -0
  125. data/test/data/test_discover/yadis_2entries_idp.xml +21 -0
  126. data/test/data/test_discover/yadis_another_delegate.xml +14 -0
  127. data/test/data/test_discover/yadis_idp.xml +12 -0
  128. data/test/data/test_discover/yadis_idp_delegate.xml +13 -0
  129. data/test/data/test_discover/yadis_no_delegate.xml +11 -0
  130. data/test/data/test_xrds/=j3h.2007.11.14.xrds +25 -0
  131. data/test/data/test_xrds/README +12 -0
  132. data/test/data/test_xrds/delegated-20060809-r1.xrds +34 -0
  133. data/test/data/test_xrds/delegated-20060809-r2.xrds +34 -0
  134. data/test/data/test_xrds/delegated-20060809.xrds +34 -0
  135. data/test/data/test_xrds/no-xrd.xml +7 -0
  136. data/test/data/test_xrds/not-xrds.xml +2 -0
  137. data/test/data/test_xrds/prefixsometimes.xrds +34 -0
  138. data/test/data/test_xrds/ref.xrds +109 -0
  139. data/test/data/test_xrds/sometimesprefix.xrds +34 -0
  140. data/test/data/test_xrds/spoof1.xrds +25 -0
  141. data/test/data/test_xrds/spoof2.xrds +25 -0
  142. data/test/data/test_xrds/spoof3.xrds +37 -0
  143. data/test/data/test_xrds/status222.xrds +9 -0
  144. data/test/data/test_xrds/valid-populated-xrds.xml +39 -0
  145. data/test/data/trustroot.txt +147 -0
  146. data/test/discoverdata.rb +131 -0
  147. data/test/test_accept.rb +170 -0
  148. data/test/test_association.rb +266 -0
  149. data/test/test_associationmanager.rb +899 -0
  150. data/test/test_ax.rb +587 -0
  151. data/test/test_checkid_request.rb +297 -0
  152. data/test/test_consumer.rb +257 -0
  153. data/test/test_cryptutil.rb +117 -0
  154. data/test/test_dh.rb +86 -0
  155. data/test/test_discover.rb +772 -0
  156. data/test/test_discovery_manager.rb +262 -0
  157. data/test/test_extras.rb +35 -0
  158. data/test/test_fetchers.rb +472 -0
  159. data/test/test_filters.rb +270 -0
  160. data/test/test_idres.rb +816 -0
  161. data/test/test_kvform.rb +165 -0
  162. data/test/test_kvpost.rb +65 -0
  163. data/test/test_linkparse.rb +101 -0
  164. data/test/test_message.rb +1058 -0
  165. data/test/test_nonce.rb +89 -0
  166. data/test/test_openid_yadis.rb +178 -0
  167. data/test/test_pape.rb +233 -0
  168. data/test/test_parsehtml.rb +80 -0
  169. data/test/test_responses.rb +63 -0
  170. data/test/test_server.rb +2270 -0
  171. data/test/test_sreg.rb +479 -0
  172. data/test/test_stores.rb +269 -0
  173. data/test/test_trustroot.rb +112 -0
  174. data/test/{urinorm.rb → test_urinorm.rb} +6 -3
  175. data/test/test_util.rb +144 -0
  176. data/test/test_xrds.rb +160 -0
  177. data/test/test_xri.rb +48 -0
  178. data/test/test_xrires.rb +63 -0
  179. data/test/test_yadis_discovery.rb +207 -0
  180. data/test/testutil.rb +116 -0
  181. data/test/util.rb +47 -50
  182. metadata +233 -143
  183. data/examples/consumer.rb +0 -290
  184. data/examples/rails_openid_login_generator/openid_login_generator-0.1.gem +0 -0
  185. data/examples/rails_server/app/controllers/server_controller.rb +0 -190
  186. data/examples/rails_server/app/views/server/decide.rhtml +0 -11
  187. data/examples/rails_server/public/images/rails.png +0 -0
  188. data/lib/hmac-md5.rb +0 -11
  189. data/lib/hmac-rmd160.rb +0 -11
  190. data/lib/openid/discovery.rb +0 -122
  191. data/lib/openid/filestore.rb +0 -315
  192. data/lib/openid/parse.rb +0 -23
  193. data/lib/openid/service.rb +0 -147
  194. data/lib/openid/stores.rb +0 -178
  195. data/test/assoc.rb +0 -38
  196. data/test/consumer.rb +0 -376
  197. data/test/data/brian.xrds +0 -16
  198. data/test/data/brianellin.mylid.xrds +0 -42
  199. data/test/dh.rb +0 -20
  200. data/test/extensions.rb +0 -30
  201. data/test/linkparse.rb +0 -305
  202. data/test/runtests.rb +0 -22
  203. data/test/server2.rb +0 -1053
  204. data/test/service.rb +0 -47
  205. data/test/storetestcase.rb +0 -172
  206. data/test/teststore.rb +0 -47
  207. data/test/trustroot.rb +0 -117
@@ -0,0 +1,34 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <XRDS ref="xri://@ootao*test1" xmlns="xri://$xrds">
3
+ <XRD xmlns="xri://$xrd*($v*2.0)">
4
+ <Query>*ootao</Query>
5
+ <Status code="100"/>
6
+ <Expires>2006-08-09T22:07:13.000Z</Expires>
7
+ <ProviderID>xri://@</ProviderID>
8
+ <LocalID priority="10">!5BAD.2AA.3C72.AF46</LocalID>
9
+ <CanonicalID priority="10">@!5BAD.2AA.3C72.AF46</CanonicalID>
10
+ <Service priority="10">
11
+ <Type>xri://$res*auth*($v*2.0)</Type>
12
+ <ProviderID/>
13
+ <MediaType>application/xrds+xml;trust=none</MediaType>
14
+ <URI priority="10">http://resolve.ezibroker.net/resolve/@ootao/</URI>
15
+ </Service>
16
+ <Service priority="10">
17
+ <Type select="true">http://openid.net/signon/1.0</Type>
18
+ <ProviderID/>
19
+ <URI append="qxri" priority="1">https://linksafe.ezibroker.net/server/</URI>
20
+ </Service>
21
+ </XRD>
22
+ <XRD xmlns="xri://$xrd*($v*2.0)">
23
+ <Query>*test1</Query>
24
+ <Status code="100">SUCCESS</Status>
25
+ <ProviderID>xri://!!1003</ProviderID>
26
+ <LocalID>!0000.0000.3B9A.CA01</LocalID>
27
+ <CanonicalID>@!5BAD.2AA.3C72.AF46!0000.0000.3B9A.CA01</CanonicalID>
28
+ <Service>
29
+ <Type select="true">http://openid.net/signon/1.0</Type>
30
+ <ProviderID/>
31
+ <URI append="qxri" priority="1">https://linksafe.ezibroker.net/server/</URI>
32
+ </Service>
33
+ </XRD>
34
+ </XRDS>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <xrds:XRDS
3
+ xmlns:xrds="xri://$xrds"
4
+ xmlns:openid="http://openid.net/xmlns/1.0"
5
+ xmlns:typekey="http://typekey.com/xmlns/1.0"
6
+ xmlns="xri://$xrd*($v*2.0)">
7
+ </xrds:XRDS>
@@ -0,0 +1,2 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <x></x>
@@ -0,0 +1,34 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <XRDS ref="xri://@ootao*test1" xmlns="xri://$xrds">
3
+ <XRD xmlns="xri://$xrd*($v*2.0)">
4
+ <Query>*ootao</Query>
5
+ <Status code="100"/>
6
+ <Expires>2006-08-09T22:07:13.000Z</Expires>
7
+ <ProviderID>xri://@</ProviderID>
8
+ <LocalID priority="10">!5BAD.2AA.3C72.AF46</LocalID>
9
+ <CanonicalID priority="10">@!5BAD.2AA.3C72.AF46</CanonicalID>
10
+ <Service priority="10">
11
+ <Type>xri://$res*auth*($v*2.0)</Type>
12
+ <ProviderID>xri://@!5BAD.2AA.3C72.AF46</ProviderID>
13
+ <MediaType>application/xrds+xml;trust=none</MediaType>
14
+ <URI priority="10">http://resolve.ezibroker.net/resolve/@ootao/</URI>
15
+ </Service>
16
+ <Service priority="10">
17
+ <Type select="true">http://openid.net/signon/1.0</Type>
18
+ <ProviderID/>
19
+ <URI append="qxri" priority="1">https://linksafe.ezibroker.net/server/</URI>
20
+ </Service>
21
+ </XRD>
22
+ <XRD xmlns="xri://$xrd*($v*2.0)">
23
+ <Query>*test1</Query>
24
+ <Status code="100">SUCCESS</Status>
25
+ <ProviderID>xri://@!5BAD.2AA.3C72.AF46</ProviderID>
26
+ <LocalID>!0000.0000.3B9A.CA01</LocalID>
27
+ <CanonicalID>xri://@!5BAD.2AA.3C72.AF46!0000.0000.3B9A.CA01</CanonicalID>
28
+ <Service>
29
+ <Type select="true">http://openid.net/signon/1.0</Type>
30
+ <ProviderID/>
31
+ <URI append="qxri" priority="1">https://linksafe.ezibroker.net/server/</URI>
32
+ </Service>
33
+ </XRD>
34
+ </XRDS>
@@ -0,0 +1,109 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <XRDS ref="xri://@ootao*test.ref" xmlns="xri://$xrds">
3
+ <XRD xmlns="xri://$xrd*($v*2.0)">
4
+ <Query>*ootao</Query>
5
+ <Status code="100"/>
6
+ <Expires>2006-08-15T18:56:09.000Z</Expires>
7
+ <ProviderID>xri://@</ProviderID>
8
+ <LocalID priority="10">!5BAD.2AA.3C72.AF46</LocalID>
9
+ <CanonicalID priority="10">@!5BAD.2AA.3C72.AF46</CanonicalID>
10
+ <Service priority="10">
11
+ <Type>xri://$res*auth*($v*2.0)</Type>
12
+ <ProviderID/>
13
+ <MediaType>application/xrds+xml;trust=none</MediaType>
14
+ <URI priority="10">http://resolve.ezibroker.net/resolve/@ootao/</URI>
15
+ </Service>
16
+ <Service priority="10">
17
+ <Type select="true">http://openid.net/signon/1.0</Type>
18
+ <ProviderID/>
19
+ <URI append="qxri" priority="1">https://linksafe.ezibroker.net/server/</URI>
20
+ </Service>
21
+ </XRD>
22
+ <XRD xmlns="xri://$xrd*($v*2.0)">
23
+ <Query>*test.ref</Query>
24
+ <Status code="100">SUCCESS</Status>
25
+ <ProviderID>xri://!!1003</ProviderID>
26
+ <LocalID>!0000.0000.3B9A.CA03</LocalID>
27
+ <CanonicalID>@!5BAD.2AA.3C72.AF46!0000.0000.3B9A.CA03</CanonicalID>
28
+ <Ref>@!BAE.A650.823B.2475</Ref>
29
+ <Service>
30
+ <Type select="true">http://openid.net/signon/1.0</Type>
31
+ <ProviderID/>
32
+ <URI append="qxri" priority="1">https://linksafe.ezibroker.net/server/</URI>
33
+ </Service>
34
+ </XRD>
35
+ <XRDS ref="xri://@!BAE.A650.823B.2475" xmlns="xri://$xrds">
36
+ <XRD xmlns="xri://$xrd*($v*2.0)">
37
+ <Query>!BAE.A650.823B.2475</Query>
38
+ <Status code="100"/>
39
+ <Expires>2006-08-15T18:56:10.000Z</Expires>
40
+ <ProviderID>xri://@</ProviderID>
41
+ <LocalID priority="10">!BAE.A650.823B.2475</LocalID>
42
+ <CanonicalID priority="10">@!BAE.A650.823B.2475</CanonicalID>
43
+ <Service priority="10">
44
+ <Type select="true">(+wdnc)</Type>
45
+ <ProviderID/>
46
+ <Path select="true">(+wdnc)</Path>
47
+ <URI append="none" priority="10">http://www.tcpacompliance.us</URI>
48
+ </Service>
49
+ <Service priority="10">
50
+ <Type match="content" select="true">xri://$res*auth*($v*2.0)</Type>
51
+ <ProviderID/>
52
+ <MediaType match="content" select="false">application/xrds+xml;trust=none</MediaType>
53
+ <URI priority="10">http://dev.dready.org/cgi-bin/xri</URI>
54
+ </Service>
55
+ <Service priority="10">
56
+ <Type match="content" select="true">(+i-name)</Type>
57
+ <ProviderID/>
58
+ <Path match="content" select="true">(+i-name)</Path>
59
+ <URI append="none" priority="10">http://www.inames.net</URI>
60
+ </Service>
61
+ <Service priority="10">
62
+ <Type select="true">xri://+i-service*(+contact)*($v*1.0)</Type>
63
+ <Type match="default" select="false"/>
64
+ <ProviderID>xri://!!1001</ProviderID>
65
+ <Path select="true">(+contact)</Path>
66
+ <Path match="null" select="false"/>
67
+ <MediaType select="false">text/html</MediaType>
68
+ <MediaType match="default" select="false"/>
69
+ <URI append="none" priority="10">http://www.neustar.biz</URI>
70
+ </Service>
71
+ </XRD>
72
+ </XRDS>
73
+ <XRD xmlns="xri://$xrd*($v*2.0)">
74
+ <Query>!BAE.A650.823B.2475</Query>
75
+ <Status code="100"/>
76
+ <Expires>2006-08-15T18:56:10.000Z</Expires>
77
+ <ProviderID>xri://@</ProviderID>
78
+ <LocalID priority="10">!BAE.A650.823B.2475</LocalID>
79
+ <CanonicalID priority="10">@!BAE.A650.823B.2475</CanonicalID>
80
+ <Service priority="10">
81
+ <Type select="true">(+wdnc)</Type>
82
+ <ProviderID/>
83
+ <Path select="true">(+wdnc)</Path>
84
+ <URI append="none" priority="10">http://www.tcpacompliance.us</URI>
85
+ </Service>
86
+ <Service priority="10">
87
+ <Type match="content" select="true">xri://$res*auth*($v*2.0)</Type>
88
+ <ProviderID/>
89
+ <MediaType match="content" select="false">application/xrds+xml;trust=none</MediaType>
90
+ <URI priority="10">http://dev.dready.org/cgi-bin/xri</URI>
91
+ </Service>
92
+ <Service priority="10">
93
+ <Type match="content" select="true">(+i-name)</Type>
94
+ <ProviderID/>
95
+ <Path match="content" select="true">(+i-name)</Path>
96
+ <URI append="none" priority="10">http://www.inames.net</URI>
97
+ </Service>
98
+ <Service priority="10">
99
+ <Type select="true">xri://+i-service*(+contact)*($v*1.0)</Type>
100
+ <Type match="default" select="false"/>
101
+ <ProviderID>xri://!!1001</ProviderID>
102
+ <Path select="true">(+contact)</Path>
103
+ <Path match="null" select="false"/>
104
+ <MediaType select="false">text/html</MediaType>
105
+ <MediaType match="default" select="false"/>
106
+ <URI append="none" priority="10">http://www.neustar.biz</URI>
107
+ </Service>
108
+ </XRD>
109
+ </XRDS>
@@ -0,0 +1,34 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <XRDS ref="xri://@ootao*test1" xmlns="xri://$xrds">
3
+ <XRD xmlns="xri://$xrd*($v*2.0)">
4
+ <Query>*ootao</Query>
5
+ <Status code="100"/>
6
+ <Expires>2006-08-09T22:07:13.000Z</Expires>
7
+ <ProviderID>xri://@</ProviderID>
8
+ <LocalID priority="10">!5BAD.2AA.3C72.AF46</LocalID>
9
+ <CanonicalID priority="10">xri://@!5BAD.2AA.3C72.AF46</CanonicalID>
10
+ <Service priority="10">
11
+ <Type>xri://$res*auth*($v*2.0)</Type>
12
+ <ProviderID>xri://@!5BAD.2AA.3C72.AF46</ProviderID>
13
+ <MediaType>application/xrds+xml;trust=none</MediaType>
14
+ <URI priority="10">http://resolve.ezibroker.net/resolve/@ootao/</URI>
15
+ </Service>
16
+ <Service priority="10">
17
+ <Type select="true">http://openid.net/signon/1.0</Type>
18
+ <ProviderID/>
19
+ <URI append="qxri" priority="1">https://linksafe.ezibroker.net/server/</URI>
20
+ </Service>
21
+ </XRD>
22
+ <XRD xmlns="xri://$xrd*($v*2.0)">
23
+ <Query>*test1</Query>
24
+ <Status code="100">SUCCESS</Status>
25
+ <ProviderID>xri://@!5BAD.2AA.3C72.AF46</ProviderID>
26
+ <LocalID>!0000.0000.3B9A.CA01</LocalID>
27
+ <CanonicalID>@!5BAD.2AA.3C72.AF46!0000.0000.3B9A.CA01</CanonicalID>
28
+ <Service>
29
+ <Type select="true">http://openid.net/signon/1.0</Type>
30
+ <ProviderID/>
31
+ <URI append="qxri" priority="1">https://linksafe.ezibroker.net/server/</URI>
32
+ </Service>
33
+ </XRD>
34
+ </XRDS>
@@ -0,0 +1,25 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <XRDS ref="xri://=keturn*isDrummond" xmlns="xri://$xrds">
3
+ <XRD xmlns="xri://$xrd*($v*2.0)">
4
+ <Query>*keturn</Query>
5
+ <ProviderID>xri://=</ProviderID>
6
+ <LocalID>!E4</LocalID>
7
+ <CanonicalID>=!E4</CanonicalID>
8
+
9
+ <Service>
10
+ <Type>xri://$res*auth*($v*2.0)</Type>
11
+ <URI>http://keturn.example.com/resolve/</URI>
12
+ <ProviderID>=!E4</ProviderID>
13
+ </Service>
14
+ </XRD>
15
+ <XRD xmlns="xri://$xrd*($v*2.0)">
16
+ <Query>*isDrummond</Query>
17
+ <ProviderID>=!E4</ProviderID>
18
+ <LocalID>!D2</LocalID>
19
+ <CanonicalID>=!D2</CanonicalID>
20
+ <Service>
21
+ <Type>http://openid.net/signon/1.0</Type>
22
+ <URI>http://keturn.example.com/openid</URI>
23
+ </Service>
24
+ </XRD>
25
+ </XRDS>
@@ -0,0 +1,25 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <XRDS ref="xri://=keturn*isDrummond" xmlns="xri://$xrds">
3
+ <XRD xmlns="xri://$xrd*($v*2.0)">
4
+ <Query>*keturn</Query>
5
+ <ProviderID>xri://=</ProviderID>
6
+ <LocalID>!E4</LocalID>
7
+ <CanonicalID>=!E4</CanonicalID>
8
+
9
+ <Service>
10
+ <Type>xri://$res*auth*($v*2.0)</Type>
11
+ <URI>http://keturn.example.com/resolve/</URI>
12
+ <ProviderID>xri://=</ProviderID>
13
+ </Service>
14
+ </XRD>
15
+ <XRD xmlns="xri://$xrd*($v*2.0)">
16
+ <Query>*isDrummond</Query>
17
+ <ProviderID>xri://=</ProviderID>
18
+ <LocalID>!D2</LocalID>
19
+ <CanonicalID>=!D2</CanonicalID>
20
+ <Service>
21
+ <Type>http://openid.net/signon/1.0</Type>
22
+ <URI>http://keturn.example.com/openid</URI>
23
+ </Service>
24
+ </XRD>
25
+ </XRDS>
@@ -0,0 +1,37 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <XRDS ref="xri://=keturn*isDrummond" xmlns="xri://$xrds">
3
+ <XRD xmlns="xri://$xrd*($v*2.0)">
4
+ <Query>*keturn</Query>
5
+ <ProviderID>xri://@</ProviderID>
6
+ <LocalID>@E4</LocalID>
7
+ <CanonicalID>@!E4</CanonicalID>
8
+
9
+ <Service>
10
+ <Type>xri://$res*auth*($v*2.0)</Type>
11
+ <URI>http://keturn.example.com/resolve/</URI>
12
+ <ProviderID>@!E4</ProviderID>
13
+ </Service>
14
+ </XRD>
15
+ <XRD xmlns="xri://$xrd*($v*2.0)">
16
+ <Query>*is</Query>
17
+ <ProviderID>@!E4</ProviderID>
18
+ <LocalID>!D2</LocalID>
19
+ <CanonicalID>=!C0</CanonicalID>
20
+ <CanonicalID>=!E4!01</CanonicalID>
21
+ <Service>
22
+ <Type>xri://$res*auth*($v*2.0)</Type>
23
+ <URI>http://keturn.example.com/resolve/</URI>
24
+ <ProviderID>@!C0</ProviderID>
25
+ </Service>
26
+ </XRD>
27
+ <XRD xmlns="xri://$xrd*($v*2.0)">
28
+ <Query>*drummond</Query>
29
+ <ProviderID>@!C0</ProviderID>
30
+ <LocalID>!D2</LocalID>
31
+ <CanonicalID>@!C0!D2</CanonicalID>
32
+ <Service>
33
+ <Type>http://openid.net/signon/1.0</Type>
34
+ <URI>http://keturn.example.com/openid</URI>
35
+ </Service>
36
+ </XRD>
37
+ </XRDS>
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <XRDS ref="xri://=x" xmlns="xri://$xrds">
3
+ <XRD xmlns="xri://$xrd*($v*2.0)">
4
+ <Query>*x</Query>
5
+ <Status code="222">The subsegment does not exist</Status>
6
+ <Expires>2006-08-18T00:02:35.000Z</Expires>
7
+ <ProviderID>xri://=</ProviderID>
8
+ </XRD>
9
+ </XRDS>
@@ -0,0 +1,39 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <xrds:XRDS
3
+ xmlns:xrds="xri://$xrds"
4
+ xmlns:openid="http://openid.net/xmlns/1.0"
5
+ xmlns:typekey="http://typekey.com/xmlns/1.0"
6
+ xmlns="xri://$xrd*($v*2.0)">
7
+ <XRD>
8
+
9
+ <Service priority="0">
10
+ <Type>http://openid.net/signon/1.0</Type>
11
+ <URI>http://www.myopenid.com/server</URI>
12
+ <openid:Delegate>http://josh.myopenid.com/</openid:Delegate>
13
+ </Service>
14
+
15
+ <Service priority="20">
16
+ <Type>http://lid.netmesh.org/sso/2.0b5</Type>
17
+ <Type>http://lid.netmesh.org/2.0b5</Type>
18
+ <URI>http://mylid.net/josh</URI>
19
+ </Service>
20
+
21
+ <Service priority="10">
22
+ <Type>http://openid.net/signon/1.0</Type>
23
+ <URI>http://www.livejournal.com/openid/server.bml</URI>
24
+ <openid:Delegate>http://www.livejournal.com/users/nedthealpaca/</openid:Delegate>
25
+ </Service>
26
+
27
+ <Service priority="15">
28
+ <Type>http://typekey.com/services/1.0</Type>
29
+ <typekey:MemberName>joshhoyt</typekey:MemberName>
30
+ </Service>
31
+
32
+ <Service priority="5">
33
+ <Type>http://openid.net/signon/1.0</Type>
34
+ <URI>http://www.schtuff.com/openid</URI>
35
+ <openid:Delegate>http://users.schtuff.com/josh</openid:Delegate>
36
+ </Service>
37
+
38
+ </XRD>
39
+ </xrds:XRDS>
@@ -0,0 +1,147 @@
1
+ ========================================
2
+ Trust root parsing checking
3
+ ========================================
4
+
5
+ ----------------------------------------
6
+ 19: Does not parse
7
+ ----------------------------------------
8
+ baz.org
9
+ *.foo.com
10
+ http://*.schtuff.*/
11
+ ftp://foo.com
12
+ ftp://*.foo.com
13
+ http://*.foo.com:80:90/
14
+ foo.*.com
15
+ http://foo.*.com
16
+ http://www.*
17
+ http://*foo.com/
18
+ http://foo.com/invalid#fragment
19
+ http://..it/
20
+ http://.it/
21
+ http://*:8081/
22
+ http://*:80
23
+
24
+
25
+
26
+ 5
27
+
28
+ ----------------------------------------
29
+ 14: Insane
30
+ ----------------------------------------
31
+ http:///
32
+ http://*/
33
+ https://*/
34
+ http://*.com
35
+ http://*.com/
36
+ https://*.com/
37
+ http://*.com.au/
38
+ http://*.co.uk/
39
+ http://*.foo.notatld/
40
+ https://*.foo.notatld/
41
+ http://*.museum/
42
+ https://*.museum/
43
+ http://www.schtuffcom/
44
+ http://it/
45
+
46
+ ----------------------------------------
47
+ 18: Sane
48
+ ----------------------------------------
49
+ http://*.schtuff.com./
50
+ http://*.schtuff.com/
51
+ http://*.foo.schtuff.com/
52
+ http://*.schtuff.com
53
+ http://www.schtuff.com/
54
+ http://www.schtuff.com./
55
+ http://www.schutff.com
56
+ http://*.this.that.schtuff.com/
57
+ http://*.foo.com/path
58
+ http://*.foo.com/path?action=foo2
59
+ http://x.foo.com/path?action=foo2
60
+ http://x.foo.com/path?action=%3D
61
+ http://localhost:8081/
62
+ http://localhost:8082/?action=openid
63
+ https://foo.com/
64
+ http://kink.fm/should/be/sane
65
+ http://beta.lingu.no/
66
+ http://goathack.livejournal.org:8020/openid/login.bml
67
+
68
+ ========================================
69
+ return_to matching
70
+ ========================================
71
+
72
+ ----------------------------------------
73
+ 44: matches
74
+ ----------------------------------------
75
+ http://*/ http://cnn.com/
76
+ http://*/ http://livejournal.com/
77
+ http://*/ http://met.museum/
78
+ http://localhost:8081/x?action=openid http://localhost:8081/x?action=openid
79
+ http://*.foo.com http://b.foo.com
80
+ http://*.foo.com http://b.foo.com/
81
+ http://*.foo.com/ http://b.foo.com
82
+ http://b.foo.com http://b.foo.com
83
+ http://b.foo.com http://b.foo.com/
84
+ http://b.foo.com/ http://b.foo.com
85
+ http://*.b.foo.com http://b.foo.com
86
+ http://*.b.foo.com http://b.foo.com/
87
+ http://*.b.foo.com/ http://b.foo.com
88
+ http://*.b.foo.com http://x.b.foo.com
89
+ http://*.b.foo.com http://w.x.b.foo.com
90
+ http://*.bar.co.uk http://www.bar.co.uk
91
+ http://*.uoregon.edu http://x.cs.uoregon.edu
92
+ http://x.com/abc http://x.com/abc
93
+ http://x.com/abc http://x.com/abc/def
94
+ http://*.x.com http://x.com/gallery
95
+ http://*.x.com http://foo.x.com/gallery
96
+ http://foo.x.com http://foo.x.com/gallery/xxx
97
+ http://*.x.com/gallery http://foo.x.com/gallery
98
+ http://localhost:8082/?action=openid http://localhost:8082/?action=openid
99
+ http://goathack.livejournal.org:8020/ http://goathack.livejournal.org:8020/openid/login.bml
100
+ https://foo.com https://foo.com
101
+ http://Foo.com http://foo.com
102
+ http://foo.com http://Foo.com
103
+ http://foo.com:80/ http://foo.com/
104
+ http://foo.com/?x=y http://foo.com/?x=y&a=b
105
+ http://foo.com/x http://foo.com/x?y
106
+ http://mylid.net/j3h. http://mylid.net/j3h.?x=y
107
+ http://j3h.us http://j3h.us?ride=unicycle
108
+ https://www.filmclans.com:443/mattmartin/FilmClans https://www.filmclans.com/mattmartin/FilmClans/Logon.aspx?nonce=BVjqSOee
109
+ http://foo.com:80 http://foo.com
110
+ http://foo.com http://foo.com:80
111
+ http://foo.com http://foo.com/
112
+ http://foo.com/ http://foo.com
113
+ http://foo.com/ http://foo.com:80
114
+ http://foo.com:80/ http://foo.com:80/stuff
115
+ http://foo.com:80/ http://foo.com/stuff
116
+ http://foo.com/path http://foo.com/path/extra
117
+ http://foo.com/path2 http://foo.com/path2?extra=query
118
+ http://foo.com/path2 http://foo.com/path2/?extra=query
119
+
120
+ ----------------------------------------
121
+ 25: does not match
122
+ ----------------------------------------
123
+ http://*/ ftp://foo.com/
124
+ http://*/ xxx
125
+ http://foo.com/ http://oo.com/
126
+ http://*.x.com/abc http://foo.x.com
127
+ http://*.x.com/abc http://*.x.com
128
+ http://*.com/ http://*.com/
129
+ http://x.com/abc http://x.com/
130
+ http://x.com/abc http://x.com/a
131
+ http://x.com/abc http://x.com/ab
132
+ http://x.com/abc http://x.com/abcd
133
+ http://*.cs.uoregon.edu http://x.uoregon.edu
134
+ http://*.foo.com http://bar.com
135
+ http://*.foo.com http://www.bar.com
136
+ http://*.bar.co.uk http://xxx.co.uk
137
+ https://foo.com http://foo.com
138
+ http://foo.com https://foo.com
139
+ http://foo.com:81 http://foo.com:80
140
+ http://foo.com/?a=b http://foo.com/?x=y
141
+ http://foo.com/?a=b http://foo.com/?x=y&a=b
142
+ http://foo.com/?a=b http://foo.com/
143
+ http://*.oo.com/ http://foo.com/
144
+ http://foo.com/* http://foo.com/anything
145
+ http://foo.com http://foo.com:443
146
+ https://foo.com https://foo.com:80
147
+ http://foo.com/path/xev http://foo.com/path?extra=more
@@ -0,0 +1,131 @@
1
+
2
+ require 'uri'
3
+ require 'openid/yadis/constants'
4
+ require 'openid/yadis/discovery'
5
+ require 'openid/extras'
6
+ require 'openid/util'
7
+
8
+ module OpenID
9
+
10
+ module DiscoverData
11
+
12
+ include TestDataMixin
13
+ include Util
14
+
15
+ TESTLIST = [
16
+ # success, input_name, id_name, result_name
17
+ [true, "equiv", "equiv", "xrds"],
18
+ [true, "header", "header", "xrds"],
19
+ [true, "lowercase_header", "lowercase_header", "xrds"],
20
+ [true, "xrds", "xrds", "xrds"],
21
+ [true, "xrds_ctparam", "xrds_ctparam", "xrds_ctparam"],
22
+ [true, "xrds_ctcase", "xrds_ctcase", "xrds_ctcase"],
23
+ [false, "xrds_html", "xrds_html", "xrds_html"],
24
+ [true, "redir_equiv", "equiv", "xrds"],
25
+ [true, "redir_header", "header", "xrds"],
26
+ [true, "redir_xrds", "xrds", "xrds"],
27
+ [false, "redir_xrds_html", "xrds_html", "xrds_html"],
28
+ [true, "redir_redir_equiv", "equiv", "xrds"],
29
+ [false, "404_server_response", nil, nil],
30
+ [false, "404_with_header", nil, nil],
31
+ [false, "404_with_meta", nil, nil],
32
+ [false, "201_server_response", nil, nil],
33
+ [false, "500_server_response", nil, nil],
34
+ ]
35
+
36
+ @@example_xrds_file = 'example-xrds.xml'
37
+ @@default_test_file = 'test1-discover.txt'
38
+ @@discover_tests = {}
39
+
40
+ def readTests(filename)
41
+ data = read_data_file(filename, false)
42
+ tests = {}
43
+ data.split("\f\n", -1).each { |case_|
44
+ name, content = case_.split("\n", 2)
45
+ tests[name] = content
46
+ }
47
+
48
+ return tests
49
+ end
50
+
51
+ def getData(filename, name)
52
+ if !@@discover_tests.member?(filename)
53
+ @@discover_tests[filename] = readTests(filename)
54
+ end
55
+
56
+ file_tests = @@discover_tests[filename]
57
+ return file_tests[name]
58
+ end
59
+
60
+ def fillTemplate(test_name, template, base_url, example_xrds)
61
+ mapping = [
62
+ ['URL_BASE/', base_url],
63
+ ['<XRDS Content>', example_xrds],
64
+ ['YADIS_HEADER', Yadis::YADIS_HEADER_NAME],
65
+ ['NAME', test_name],
66
+ ]
67
+
68
+ mapping.each { |k, v|
69
+ template = template.gsub(/#{k}/, v)
70
+ }
71
+
72
+ return template
73
+ end
74
+
75
+ def generateSample(test_name, base_url,
76
+ example_xrds=nil,
77
+ filename=@@default_test_file)
78
+ if example_xrds.nil?
79
+ example_xrds = read_data_file(@@example_xrds_file, false)
80
+ end
81
+
82
+ begin
83
+ template = getData(filename, test_name)
84
+ rescue Errno::ENOENT
85
+ raise ArgumentError(filename)
86
+ end
87
+
88
+ return fillTemplate(test_name, template, base_url, example_xrds)
89
+ end
90
+
91
+ def generateResult(base_url, input_name, id_name, result_name, success)
92
+ uri = URI::parse(base_url)
93
+
94
+ input_url = (uri + input_name).to_s
95
+
96
+ # If the name is None then we expect the protocol to fail, which
97
+ # we represent by None
98
+ if id_name.nil?
99
+ Util.assert(result_name.nil?)
100
+ return input_url, DiscoveryFailure
101
+ end
102
+
103
+ result = generateSample(result_name, base_url)
104
+ headers, content = result.split("\n\n", 2)
105
+ header_lines = headers.split("\n")
106
+
107
+ ctype = nil
108
+ header_lines.each { |header_line|
109
+ if header_line.starts_with?('Content-Type:')
110
+ _, ctype = header_line.split(':', 2)
111
+ ctype = ctype.strip()
112
+ break
113
+ else
114
+ ctype = nil
115
+ end
116
+ }
117
+
118
+ id_url = (uri + id_name).to_s
119
+ result = Yadis::DiscoveryResult.new(input_url)
120
+ result.normalized_uri = id_url
121
+
122
+ if success
123
+ result.xrds_uri = (uri + result_name).to_s
124
+ end
125
+
126
+ result.content_type = ctype
127
+ result.response_text = content
128
+ return [input_url, result]
129
+ end
130
+ end
131
+ end