ruby-openid2 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +7 -0
  2. checksums.yaml.gz.sig +0 -0
  3. data/CHANGELOG.md +136 -0
  4. data/CODE_OF_CONDUCT.md +84 -0
  5. data/CONTRIBUTING.md +54 -0
  6. data/LICENSE.txt +210 -0
  7. data/README.md +81 -0
  8. data/SECURITY.md +15 -0
  9. data/lib/hmac/hmac.rb +110 -0
  10. data/lib/hmac/sha1.rb +11 -0
  11. data/lib/hmac/sha2.rb +25 -0
  12. data/lib/openid/association.rb +246 -0
  13. data/lib/openid/consumer/associationmanager.rb +354 -0
  14. data/lib/openid/consumer/checkid_request.rb +179 -0
  15. data/lib/openid/consumer/discovery.rb +516 -0
  16. data/lib/openid/consumer/discovery_manager.rb +144 -0
  17. data/lib/openid/consumer/html_parse.rb +142 -0
  18. data/lib/openid/consumer/idres.rb +513 -0
  19. data/lib/openid/consumer/responses.rb +147 -0
  20. data/lib/openid/consumer/session.rb +36 -0
  21. data/lib/openid/consumer.rb +406 -0
  22. data/lib/openid/cryptutil.rb +112 -0
  23. data/lib/openid/dh.rb +84 -0
  24. data/lib/openid/extension.rb +38 -0
  25. data/lib/openid/extensions/ax.rb +552 -0
  26. data/lib/openid/extensions/oauth.rb +88 -0
  27. data/lib/openid/extensions/pape.rb +170 -0
  28. data/lib/openid/extensions/sreg.rb +268 -0
  29. data/lib/openid/extensions/ui.rb +49 -0
  30. data/lib/openid/fetchers.rb +277 -0
  31. data/lib/openid/kvform.rb +113 -0
  32. data/lib/openid/kvpost.rb +62 -0
  33. data/lib/openid/message.rb +555 -0
  34. data/lib/openid/protocolerror.rb +7 -0
  35. data/lib/openid/server.rb +1571 -0
  36. data/lib/openid/store/filesystem.rb +260 -0
  37. data/lib/openid/store/interface.rb +73 -0
  38. data/lib/openid/store/memcache.rb +109 -0
  39. data/lib/openid/store/memory.rb +79 -0
  40. data/lib/openid/store/nonce.rb +72 -0
  41. data/lib/openid/trustroot.rb +597 -0
  42. data/lib/openid/urinorm.rb +72 -0
  43. data/lib/openid/util.rb +119 -0
  44. data/lib/openid/version.rb +5 -0
  45. data/lib/openid/yadis/accept.rb +141 -0
  46. data/lib/openid/yadis/constants.rb +16 -0
  47. data/lib/openid/yadis/discovery.rb +151 -0
  48. data/lib/openid/yadis/filters.rb +192 -0
  49. data/lib/openid/yadis/htmltokenizer.rb +290 -0
  50. data/lib/openid/yadis/parsehtml.rb +50 -0
  51. data/lib/openid/yadis/services.rb +44 -0
  52. data/lib/openid/yadis/xrds.rb +160 -0
  53. data/lib/openid/yadis/xri.rb +86 -0
  54. data/lib/openid/yadis/xrires.rb +87 -0
  55. data/lib/openid.rb +27 -0
  56. data/lib/ruby-openid.rb +1 -0
  57. data.tar.gz.sig +0 -0
  58. metadata +331 -0
  59. metadata.gz.sig +0 -0
@@ -0,0 +1,87 @@
1
+ # stdlib
2
+ require "cgi"
3
+
4
+ # This library
5
+ require_relative "xri"
6
+ require_relative "xrds"
7
+ require_relative "../fetchers"
8
+
9
+ module OpenID
10
+ module Yadis
11
+ module XRI
12
+ class XRIHTTPError < StandardError; end
13
+
14
+ class ProxyResolver
15
+ DEFAULT_PROXY = "http://proxy.xri.net/"
16
+
17
+ def initialize(proxy_url = nil)
18
+ @proxy_url = proxy_url || DEFAULT_PROXY
19
+
20
+ @proxy_url += "/" unless @proxy_url.match?("/$")
21
+ end
22
+
23
+ def query_url(xri, service_type = nil)
24
+ # URI normal form has a leading xri://, but we need to strip
25
+ # that off again for the QXRI. This is under discussion for
26
+ # XRI Resolution WD 11.
27
+ qxri = XRI.to_uri_normal(xri)[6..-1]
28
+ hxri = @proxy_url + qxri
29
+ args = {"_xrd_r" => "application/xrds+xml"}
30
+ if service_type
31
+ args["_xrd_t"] = service_type
32
+ else
33
+ # don't perform service endpoint selection
34
+ args["_xrd_r"] += ";sep=false"
35
+ end
36
+
37
+ XRI.append_args(hxri, args)
38
+ end
39
+
40
+ def query(xri)
41
+ # these can be query args or http headers, needn't be both.
42
+ # headers = {'Accept' => 'application/xrds+xml;sep=true'}
43
+ url = query_url(xri)
44
+ begin
45
+ response = OpenID.fetch(url)
46
+ rescue StandardError
47
+ raise XRIHTTPError, "Could not fetch #{xri}, #{$!}"
48
+ end
49
+ raise XRIHTTPError, "Could not fetch #{xri}" if response.nil?
50
+
51
+ xrds = Yadis.parseXRDS(response.body)
52
+ canonical_id = Yadis.get_canonical_id(xri, xrds)
53
+
54
+ [canonical_id, Yadis.services(xrds)]
55
+ # TODO:
56
+ # * If we do get hits for multiple service_types, we're almost
57
+ # certainly going to have duplicated service entries and
58
+ # broken priority ordering.
59
+ end
60
+ end
61
+
62
+ def self.urlencode(args)
63
+ a = []
64
+ args.each do |key, val|
65
+ a << (CGI.escape(key) + "=" + CGI.escape(val))
66
+ end
67
+ a.join("&")
68
+ end
69
+
70
+ def self.append_args(url, args)
71
+ return url if args.empty?
72
+
73
+ # rstrip question marks
74
+ rstripped = url.dup
75
+ rstripped = rstripped[0...rstripped.length - 1] while rstripped[-1].chr == "?"
76
+
77
+ sep = if rstripped.index("?")
78
+ "&"
79
+ else
80
+ "?"
81
+ end
82
+
83
+ url + sep + XRI.urlencode(args)
84
+ end
85
+ end
86
+ end
87
+ end
data/lib/openid.rb ADDED
@@ -0,0 +1,27 @@
1
+ # Copyright 2006-2007 JanRain, Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License"); you
4
+ # may not use this file except in compliance with the License. You may
5
+ # obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12
+ # implied. See the License for the specific language governing
13
+ # permissions and limitations under the License.
14
+
15
+ # External Libraries
16
+ require "version_gem"
17
+
18
+ module OpenID
19
+ end
20
+
21
+ require_relative "openid/version"
22
+ require_relative "openid/consumer"
23
+ require_relative "openid/server"
24
+
25
+ OpenID::Version.class_eval do
26
+ extend VersionGem::Basic
27
+ end
@@ -0,0 +1 @@
1
+ require "openid"
data.tar.gz.sig ADDED
Binary file
metadata ADDED
@@ -0,0 +1,331 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ruby-openid2
3
+ version: !ruby/object:Gem::Version
4
+ version: 3.0.0
5
+ platform: ruby
6
+ authors:
7
+ - JanRain, Inc
8
+ - Peter Boling
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain:
12
+ - |
13
+ -----BEGIN CERTIFICATE-----
14
+ MIIEgDCCAuigAwIBAgIBATANBgkqhkiG9w0BAQsFADBDMRUwEwYDVQQDDAxwZXRl
15
+ ci5ib2xpbmcxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkW
16
+ A2NvbTAeFw0yMzA5MjAxNzMwMjhaFw0yNDA5MTkxNzMwMjhaMEMxFTATBgNVBAMM
17
+ DHBldGVyLmJvbGluZzEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPy
18
+ LGQBGRYDY29tMIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEA+a9UvHo3
19
+ 84k96WgU5Kk5HB+cLZs/modjorsTfqY67MJF5nNvAoqcKTUBW4uG+Zpfnm3jaDO5
20
+ GxhJEIZWfndYzycHT2KMVQ1uTP82ba8ZaKrPlPIafkbui3mdds47qsmqHiblKERg
21
+ U532lkwfqHDlJwE7OBZQ59EwWWLynlT/yAUHpOBbqIuHKUxdpmBI+sIjrZcD1e05
22
+ WmjkO6fwIdC5oM757aoPxIgXD587VOViH11Vkm2doskj4T8yONtwVHlcrrhJ9Bzd
23
+ /zdp6vEn7GZQrABvpOlqwWxQ72ZnFhJe/RJZf6CXOPOh69Ai0QKYl2a1sYuCJKS3
24
+ nsBnxXJINEEznjR7rZjNUmYD+CZqfjzgPqedRxTlASe7iA4w7xZOqMDzcuhNwcUQ
25
+ tMEH6BTktxKP3jXZPXRfHCf6s+HRVb6vezAonTBVyydf5Xp5VwWkd6cwm+2BzHl5
26
+ 7kc/3lLxKMcsyEUprAsk8LdHohwZdC267l+RS++AP6Cz6x+nB3oGob19AgMBAAGj
27
+ fzB9MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQWBBQCSSas60GqqMjt
28
+ xR7LoY1gucEvtzAhBgNVHREEGjAYgRZwZXRlci5ib2xpbmdAZ21haWwuY29tMCEG
29
+ A1UdEgQaMBiBFnBldGVyLmJvbGluZ0BnbWFpbC5jb20wDQYJKoZIhvcNAQELBQAD
30
+ ggGBAMl9ifcw5p+PdvB7dCPoNKoVdp/2LbC9ztETHuYL2gUMJB6UoS3o9c/piSuR
31
+ V3ZMQaijmNu6ms1bWAtJ66LjmYrVflJtf9yp31Kierr9LpisMSUx2qbMOHGa8d2Z
32
+ vCUWPF8E9Cg0mP3GAyZ6qql8jDh/anUKeksPXqJvNxNPDu2DVYsa/IWdl96whzS4
33
+ Bl7SwB1E7agps40UcshCSKaVDOU0M+XN6SrnJMElnBic+KSAkBkVFbzS0BE4ODZM
34
+ BgE6nYzQ05qhuvbE+oGdACTlemNtDDWCh0uw+7x0q2PocGIDU5zsPn/WNTkCXPmB
35
+ CHGvqDNWq4M7ncTKAaS2XExgyb7uPdq9fKiOW8nmH+zCiGzJXzBWwZlKf7L4Ht9E
36
+ a3f0e5C+zvee9Z5Ng9ciyfav9/fcXgYt5MjoBv27THr5XfBhgOCIHSYW2tqJmWKi
37
+ KuxrfYrN+9HvMdm+nZ6TypmKftHY3Gj+/uu+g8Icm/zrvTWAEE0mcJOkfrIoNPJb
38
+ pF8dMA==
39
+ -----END CERTIFICATE-----
40
+ date: 2024-09-04 00:00:00.000000000 Z
41
+ dependencies:
42
+ - !ruby/object:Gem::Dependency
43
+ name: version_gem
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: '1.1'
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: 1.1.4
52
+ type: :runtime
53
+ prerelease: false
54
+ version_requirements: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - "~>"
57
+ - !ruby/object:Gem::Version
58
+ version: '1.1'
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 1.1.4
62
+ - !ruby/object:Gem::Dependency
63
+ name: minitest
64
+ requirement: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '5'
69
+ type: :development
70
+ prerelease: false
71
+ version_requirements: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '5'
76
+ - !ruby/object:Gem::Dependency
77
+ name: rake
78
+ requirement: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '13'
83
+ type: :development
84
+ prerelease: false
85
+ version_requirements: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '13'
90
+ - !ruby/object:Gem::Dependency
91
+ name: rexml
92
+ requirement: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.2'
97
+ type: :development
98
+ prerelease: false
99
+ version_requirements: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '3.2'
104
+ - !ruby/object:Gem::Dependency
105
+ name: webrick
106
+ requirement: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '1.8'
111
+ type: :development
112
+ prerelease: false
113
+ version_requirements: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '1.8'
118
+ - !ruby/object:Gem::Dependency
119
+ name: kettle-soup-cover
120
+ requirement: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '1.0'
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ version: 1.0.2
128
+ type: :development
129
+ prerelease: false
130
+ version_requirements: !ruby/object:Gem::Requirement
131
+ requirements:
132
+ - - "~>"
133
+ - !ruby/object:Gem::Version
134
+ version: '1.0'
135
+ - - ">="
136
+ - !ruby/object:Gem::Version
137
+ version: 1.0.2
138
+ - !ruby/object:Gem::Dependency
139
+ name: rubocop-lts
140
+ requirement: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - "~>"
143
+ - !ruby/object:Gem::Version
144
+ version: '18.2'
145
+ - - ">="
146
+ - !ruby/object:Gem::Version
147
+ version: 18.2.1
148
+ type: :development
149
+ prerelease: false
150
+ version_requirements: !ruby/object:Gem::Requirement
151
+ requirements:
152
+ - - "~>"
153
+ - !ruby/object:Gem::Version
154
+ version: '18.2'
155
+ - - ">="
156
+ - !ruby/object:Gem::Version
157
+ version: 18.2.1
158
+ - !ruby/object:Gem::Dependency
159
+ name: rubocop-minitest
160
+ requirement: !ruby/object:Gem::Requirement
161
+ requirements:
162
+ - - "~>"
163
+ - !ruby/object:Gem::Version
164
+ version: '0.36'
165
+ type: :development
166
+ prerelease: false
167
+ version_requirements: !ruby/object:Gem::Requirement
168
+ requirements:
169
+ - - "~>"
170
+ - !ruby/object:Gem::Version
171
+ version: '0.36'
172
+ - !ruby/object:Gem::Dependency
173
+ name: rubocop-packaging
174
+ requirement: !ruby/object:Gem::Requirement
175
+ requirements:
176
+ - - "~>"
177
+ - !ruby/object:Gem::Version
178
+ version: '0.5'
179
+ - - ">="
180
+ - !ruby/object:Gem::Version
181
+ version: 0.5.2
182
+ type: :development
183
+ prerelease: false
184
+ version_requirements: !ruby/object:Gem::Requirement
185
+ requirements:
186
+ - - "~>"
187
+ - !ruby/object:Gem::Version
188
+ version: '0.5'
189
+ - - ">="
190
+ - !ruby/object:Gem::Version
191
+ version: 0.5.2
192
+ - !ruby/object:Gem::Dependency
193
+ name: standard
194
+ requirement: !ruby/object:Gem::Requirement
195
+ requirements:
196
+ - - ">="
197
+ - !ruby/object:Gem::Version
198
+ version: 1.35.1
199
+ type: :development
200
+ prerelease: false
201
+ version_requirements: !ruby/object:Gem::Requirement
202
+ requirements:
203
+ - - ">="
204
+ - !ruby/object:Gem::Version
205
+ version: 1.35.1
206
+ - !ruby/object:Gem::Dependency
207
+ name: yard
208
+ requirement: !ruby/object:Gem::Requirement
209
+ requirements:
210
+ - - "~>"
211
+ - !ruby/object:Gem::Version
212
+ version: '0.9'
213
+ - - ">="
214
+ - !ruby/object:Gem::Version
215
+ version: 0.9.34
216
+ type: :development
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - "~>"
221
+ - !ruby/object:Gem::Version
222
+ version: '0.9'
223
+ - - ">="
224
+ - !ruby/object:Gem::Version
225
+ version: 0.9.34
226
+ - !ruby/object:Gem::Dependency
227
+ name: yard-junk
228
+ requirement: !ruby/object:Gem::Requirement
229
+ requirements:
230
+ - - "~>"
231
+ - !ruby/object:Gem::Version
232
+ version: '0.0'
233
+ type: :development
234
+ prerelease: false
235
+ version_requirements: !ruby/object:Gem::Requirement
236
+ requirements:
237
+ - - "~>"
238
+ - !ruby/object:Gem::Version
239
+ version: '0.0'
240
+ description:
241
+ email: peter.boling@gmail.com
242
+ executables: []
243
+ extensions: []
244
+ extra_rdoc_files: []
245
+ files:
246
+ - CHANGELOG.md
247
+ - CODE_OF_CONDUCT.md
248
+ - CONTRIBUTING.md
249
+ - LICENSE.txt
250
+ - README.md
251
+ - SECURITY.md
252
+ - lib/hmac/hmac.rb
253
+ - lib/hmac/sha1.rb
254
+ - lib/hmac/sha2.rb
255
+ - lib/openid.rb
256
+ - lib/openid/association.rb
257
+ - lib/openid/consumer.rb
258
+ - lib/openid/consumer/associationmanager.rb
259
+ - lib/openid/consumer/checkid_request.rb
260
+ - lib/openid/consumer/discovery.rb
261
+ - lib/openid/consumer/discovery_manager.rb
262
+ - lib/openid/consumer/html_parse.rb
263
+ - lib/openid/consumer/idres.rb
264
+ - lib/openid/consumer/responses.rb
265
+ - lib/openid/consumer/session.rb
266
+ - lib/openid/cryptutil.rb
267
+ - lib/openid/dh.rb
268
+ - lib/openid/extension.rb
269
+ - lib/openid/extensions/ax.rb
270
+ - lib/openid/extensions/oauth.rb
271
+ - lib/openid/extensions/pape.rb
272
+ - lib/openid/extensions/sreg.rb
273
+ - lib/openid/extensions/ui.rb
274
+ - lib/openid/fetchers.rb
275
+ - lib/openid/kvform.rb
276
+ - lib/openid/kvpost.rb
277
+ - lib/openid/message.rb
278
+ - lib/openid/protocolerror.rb
279
+ - lib/openid/server.rb
280
+ - lib/openid/store/filesystem.rb
281
+ - lib/openid/store/interface.rb
282
+ - lib/openid/store/memcache.rb
283
+ - lib/openid/store/memory.rb
284
+ - lib/openid/store/nonce.rb
285
+ - lib/openid/trustroot.rb
286
+ - lib/openid/urinorm.rb
287
+ - lib/openid/util.rb
288
+ - lib/openid/version.rb
289
+ - lib/openid/yadis/accept.rb
290
+ - lib/openid/yadis/constants.rb
291
+ - lib/openid/yadis/discovery.rb
292
+ - lib/openid/yadis/filters.rb
293
+ - lib/openid/yadis/htmltokenizer.rb
294
+ - lib/openid/yadis/parsehtml.rb
295
+ - lib/openid/yadis/services.rb
296
+ - lib/openid/yadis/xrds.rb
297
+ - lib/openid/yadis/xri.rb
298
+ - lib/openid/yadis/xrires.rb
299
+ - lib/ruby-openid.rb
300
+ homepage: https://github.com/VitalConnectInc/ruby-openid2
301
+ licenses:
302
+ - Ruby
303
+ - Apache Software License 2.0
304
+ metadata:
305
+ homepage_uri: https://github.com/VitalConnectInc/ruby-openid2
306
+ source_code_uri: https://github.com/VitalConnectInc/ruby-openid2/tree/v3.0.0
307
+ changelog_uri: https://github.com/VitalConnectInc/ruby-openid2/blob/v3.0.0/CHANGELOG.md
308
+ bug_tracker_uri: https://github.com/VitalConnectInc/ruby-openid2/issues
309
+ documentation_uri: https://www.rubydoc.info/gems/ruby-openid2/3.0.0
310
+ wiki_uri: https://github.com/VitalConnectInc/ruby-openid2/wiki
311
+ rubygems_mfa_required: 'true'
312
+ post_install_message:
313
+ rdoc_options: []
314
+ require_paths:
315
+ - lib
316
+ required_ruby_version: !ruby/object:Gem::Requirement
317
+ requirements:
318
+ - - ">="
319
+ - !ruby/object:Gem::Version
320
+ version: 2.7.0
321
+ required_rubygems_version: !ruby/object:Gem::Requirement
322
+ requirements:
323
+ - - ">="
324
+ - !ruby/object:Gem::Version
325
+ version: '0'
326
+ requirements: []
327
+ rubygems_version: 3.4.22
328
+ signing_key:
329
+ specification_version: 4
330
+ summary: A library for consuming and serving OpenID identities.
331
+ test_files: []
metadata.gz.sig ADDED
Binary file