ruby-openid 2.1.7 → 2.1.8

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.

Files changed (38) hide show
  1. data/CHANGELOG +207 -27
  2. data/NOTICE +1 -1
  3. data/README +3 -4
  4. data/examples/discover +0 -0
  5. data/examples/rails_openid/app/controllers/consumer_controller.rb +1 -1
  6. data/examples/rails_openid/script/about +0 -0
  7. data/examples/rails_openid/script/breakpointer +0 -0
  8. data/examples/rails_openid/script/console +0 -0
  9. data/examples/rails_openid/script/destroy +0 -0
  10. data/examples/rails_openid/script/generate +0 -0
  11. data/examples/rails_openid/script/performance/benchmarker +0 -0
  12. data/examples/rails_openid/script/performance/profiler +0 -0
  13. data/examples/rails_openid/script/plugin +0 -0
  14. data/examples/rails_openid/script/process/reaper +0 -0
  15. data/examples/rails_openid/script/process/spawner +0 -0
  16. data/examples/rails_openid/script/process/spinner +0 -0
  17. data/examples/rails_openid/script/runner +0 -0
  18. data/examples/rails_openid/script/server +0 -0
  19. data/lib/openid.rb +1 -1
  20. data/lib/openid/association.rb +2 -2
  21. data/lib/openid/consumer.rb +1 -1
  22. data/lib/openid/consumer/associationmanager.rb +1 -1
  23. data/lib/openid/consumer/discovery.rb +1 -2
  24. data/lib/openid/consumer/html_parse.rb +1 -1
  25. data/lib/openid/consumer/idres.rb +3 -3
  26. data/lib/openid/consumer/responses.rb +1 -1
  27. data/lib/openid/cryptutil.rb +22 -4
  28. data/lib/openid/extensions/ax.rb +28 -5
  29. data/lib/openid/extensions/oauth.rb +91 -0
  30. data/lib/openid/fetchers.rb +22 -2
  31. data/lib/openid/yadis/xrires.rb +4 -11
  32. data/test/data/test_discover/openid_utf8.html +11 -0
  33. data/test/test_ax.rb +44 -2
  34. data/test/test_discover.rb +14 -0
  35. data/test/test_fetchers.rb +28 -1
  36. data/test/test_idres.rb +77 -36
  37. data/test/test_oauth.rb +175 -0
  38. metadata +206 -226
data/CHANGELOG CHANGED
@@ -1,35 +1,215 @@
1
- Wed Jul 1 15:07:23 PDT 2009 chowells@janrain.com
2
- tagged 2.1.7
3
- Ignore-this: 9bef91a9c9d6232961500dd4b9416c14
1
+ Mon Jan 23 12:48:00 PST 2006 brian@janrain.com
2
+ * fixed bug in expiresIn. added expired? method
4
3
 
5
- Wed Jul 1 14:43:24 PDT 2009 chowells@janrain.com
6
- * update version to 2.1.7
7
- Ignore-this: 9b158a7f5c948b1a042331bf8137e95d
4
+ M ./lib/openid/filestore.rb -1 +1
5
+ M ./lib/openid/stores.rb +4
8
6
 
9
- Wed Jul 1 12:23:50 PDT 2009 chowells@janrain.com
10
- * Handle malformed associate responses better in negotiate association
11
- Ignore-this: 13d2c5718f1f798d3e60ce9ffac9a135
7
+ Mon Jan 23 12:46:37 PST 2006 brian@janrain.com
8
+ * removed deps section from INSTALL file. deps are now included in lib because they are so small and to lower to bar of installing the library.
12
9
 
13
- Wed Jul 1 12:05:19 PDT 2009 chowells@janrain.com
14
- * whitespace
15
- Ignore-this: e4b91f8280dc1591726467448a468188
10
+ M ./INSTALL -9
16
11
 
17
- Mon Jun 29 15:19:08 PDT 2009 cygnus@janrain.com
18
- * Add memcache store implementation and tests
19
- Ignore-this: a8cde55ae2c28a9ba6f8c0a46436d336
12
+ Tue Jan 17 14:45:57 PST 2006 brian@janrain.com
13
+ * added better handling of non-URL input
20
14
 
21
- Mon Jun 29 15:18:41 PDT 2009 cygnus@janrain.com
22
- * Store tests: loosen get_association tests so that it is only asserting that we are not returning deleted associations rather than testing that we return a particular association
23
- Ignore-this: a2514be4e99da76ca8c55a78bf10817a
15
+ M ./lib/openid/consumer.rb -1 +5
24
16
 
25
- Mon Jun 29 15:17:04 PDT 2009 cygnus@janrain.com
26
- * Store tests: separate cleanup tests from other store tests
27
- Ignore-this: 49ce6bc616af0deb063d8b1a9633ee0a
17
+ Sat Jan 14 19:39:57 PST 2006 brian@janrain.com
18
+ * added html and hmac deps into lib since they are so small
28
19
 
29
- Mon Jun 29 15:15:49 PDT 2009 cygnus@janrain.com
30
- * whitespace
31
- Ignore-this: a69795c5131e0cf6f687ccc8dfbba61a
20
+ A ./lib/hmac-md5.rb
21
+ A ./lib/hmac-rmd160.rb
22
+ A ./lib/hmac-sha1.rb
23
+ A ./lib/hmac-sha2.rb
24
+ A ./lib/hmac.rb
25
+ A ./lib/html/
26
+ A ./lib/html/htmltokenizer.rb
32
27
 
33
- Tue Apr 21 11:42:57 PDT 2009 cygnus@janrain.com
34
- tagged 2.1.6
35
- Ignore-this: b97ef05fbb348ace2f86513a5de7db46
28
+ Mon Jan 16 15:04:05 PST 2006 Josh Hoyt <josh@janrain.com>
29
+ * Add script that will prepare the repository for release
30
+
31
+ A ./admin/fixperms
32
+ A ./admin/prepare-release
33
+
34
+ Mon Jan 16 14:35:27 PST 2006 Josh Hoyt <josh@janrain.com>
35
+ * Add custom boring file
36
+
37
+ A ./admin/darcs-ignore
38
+
39
+ Mon Jan 16 14:07:13 PST 2006 Josh Hoyt <josh@janrain.com>
40
+ * Put the build-docs script into the admin directory
41
+
42
+ ./build-docs -> ./admin/build-docs
43
+ A ./admin/
44
+
45
+ Mon Jan 16 14:05:47 PST 2006 Josh Hoyt <josh@janrain.com>
46
+ * Add script to build documentation
47
+
48
+ A ./build-docs
49
+
50
+ Wed Jan 4 16:06:41 PST 2006 brian@janrain.com
51
+ tagged ruby-openid-0.9.2
52
+
53
+
54
+ Wed Jan 4 16:02:32 PST 2006 brian@janrain.com
55
+ * added openid_login_generator rails generator to examples
56
+
57
+ A ./examples/openid_login_generator/
58
+ A ./examples/openid_login_generator/USAGE
59
+ A ./examples/openid_login_generator/openid_login_generator.rb
60
+ A ./examples/openid_login_generator/templates/
61
+ A ./examples/openid_login_generator/templates/README
62
+ A ./examples/openid_login_generator/templates/controller.rb
63
+ A ./examples/openid_login_generator/templates/helper.rb
64
+ A ./examples/openid_login_generator/templates/login_system.rb
65
+ A ./examples/openid_login_generator/templates/user.rb
66
+ A ./examples/openid_login_generator/templates/view_login.rhtml
67
+ A ./examples/openid_login_generator/templates/view_logout.rhtml
68
+ A ./examples/openid_login_generator/templates/view_signup.rhtml
69
+ A ./examples/openid_login_generator/templates/view_welcome.rhtml
70
+
71
+ Wed Jan 4 16:01:12 PST 2006 brian@janrain.com
72
+ * updated examples README to include openid_login_generator
73
+
74
+ M ./examples/README +11
75
+
76
+ Wed Jan 4 14:58:24 PST 2006 brian@janrain.com
77
+ * added link to ruby library from consumer.rb example
78
+
79
+ M ./examples/consumer.rb -1 +1
80
+
81
+ Wed Jan 4 10:56:45 PST 2006 brian@janrain.com
82
+ * ensure Content-type header is present for POSTs
83
+
84
+ M ./lib/openid/fetchers.rb -1 +2
85
+
86
+ Fri Dec 30 17:05:25 PST 2005 brian@janrain.com
87
+ tagged ruby-openid-0.9.1
88
+
89
+
90
+ Fri Dec 30 17:03:54 PST 2005 brian@janrain.com
91
+ * added Ruby on Rails example consumer
92
+
93
+ M ./examples/README -1 +14
94
+ A ./examples/openid_rails.tar.gz
95
+
96
+ Thu Dec 29 16:00:20 PST 2005 brian@janrain.com
97
+ tagged ruby-openid-0.9.0
98
+
99
+
100
+ Thu Dec 29 15:43:07 PST 2005 brian@janrain.com
101
+ * removed docs directory. generated rdoc html will be added manually to tarballs, and not be kept in repository
102
+
103
+ R ./docs/
104
+ R ./docs/README
105
+
106
+ Thu Dec 29 15:21:21 PST 2005 brian@janrain.com
107
+ * added more docs for stores
108
+
109
+ M ./TODO -2 +4
110
+ M ./lib/openid/filestore.rb -16 +3
111
+ M ./lib/openid/stores.rb -9 +1
112
+
113
+ Thu Dec 29 14:58:52 PST 2005 brian@janrain.com
114
+ * Huge documentation patch
115
+
116
+ M ./INSTALL -12 +22
117
+ M ./README -1 +1
118
+ M ./lib/openid/consumer.rb -24 +370
119
+ M ./lib/openid/fetchers.rb -2 +1
120
+ M ./lib/openid/filestore.rb -6 +4
121
+ M ./lib/openid/stores.rb -2 +1
122
+
123
+ Thu Dec 29 10:59:54 PST 2005 brian@janrain.com
124
+ * added more info and rdoc formatting to README
125
+
126
+ M ./README -10 +26
127
+
128
+ Thu Dec 29 09:45:51 PST 2005 brian@janrain.com
129
+ * fixed bad comment
130
+
131
+ M ./examples/consumer.rb -1 +1
132
+
133
+ Wed Dec 28 17:59:48 PST 2005 brian@janrain.com
134
+ * added platform agnositc temp dir discovery
135
+
136
+ M ./examples/consumer.rb -1 +5
137
+
138
+ Wed Dec 28 17:13:21 PST 2005 brian@janrain.com
139
+ * moved getOpenIDParamerters to util
140
+
141
+ M ./lib/openid/consumer.rb -10 +2
142
+ M ./lib/openid/util.rb +8
143
+
144
+ Wed Dec 28 15:47:51 PST 2005 brian@janrain.com
145
+ * code cleanup
146
+
147
+ M ./lib/openid/consumer.rb -5
148
+
149
+ Wed Dec 28 15:29:31 PST 2005 brian@janrain.com
150
+ * added linkparse to test suite script
151
+
152
+ M ./test/runtests -1 +1
153
+
154
+ Wed Dec 28 15:29:07 PST 2005 brian@janrain.com
155
+ * added link parsing tests, lots of em
156
+
157
+ A ./test/linkparse.rb
158
+
159
+ Wed Dec 28 15:28:07 PST 2005 brian@janrain.com
160
+ * link parsing more robust: handle non-html data, and make sure link tag is in head
161
+
162
+ M ./lib/openid/parse.rb -5 +13
163
+
164
+ Tue Dec 27 16:11:09 PST 2005 brian@janrain.com
165
+ * added more tests for openid/util
166
+
167
+ M ./test/dh.rb -2 +1
168
+ M ./test/runtests +1
169
+ A ./test/util.rb
170
+
171
+ Tue Dec 27 16:10:28 PST 2005 brian@janrain.com
172
+ * change util methods to use all use /dev/urandom if available
173
+
174
+ M ./lib/openid/util.rb -15 +35
175
+
176
+ Tue Dec 27 16:09:53 PST 2005 brian@janrain.com
177
+ * changed tmp pathname to something more useful
178
+
179
+ M ./examples/consumer.rb -1 +1
180
+
181
+ Fri Dec 16 09:04:59 PST 2005 Josh Hoyt <josh@janrain.com>
182
+ * Removed (now obsolete) interface.rb
183
+
184
+ This has been subsumed by consumer.rb
185
+
186
+ R ./lib/openid/interface.rb
187
+
188
+ Thu Dec 15 18:25:04 PST 2005 brian@janrain.com
189
+ * initial checkin
190
+
191
+ A ./COPYING
192
+ A ./INSTALL
193
+ A ./README
194
+ A ./TODO
195
+ A ./docs/
196
+ A ./docs/README
197
+ A ./examples/
198
+ A ./examples/README
199
+ A ./examples/consumer.rb
200
+ A ./lib/
201
+ A ./lib/openid/
202
+ A ./lib/openid/consumer.rb
203
+ A ./lib/openid/dh.rb
204
+ A ./lib/openid/fetchers.rb
205
+ A ./lib/openid/filestore.rb
206
+ A ./lib/openid/interface.rb
207
+ A ./lib/openid/parse.rb
208
+ A ./lib/openid/stores.rb
209
+ A ./lib/openid/util.rb
210
+ A ./setup.rb
211
+ A ./test/
212
+ A ./test/assoc.rb
213
+ A ./test/dh.rb
214
+ A ./test/runtests
215
+ A ./test/teststore.rb
data/NOTICE CHANGED
@@ -1,2 +1,2 @@
1
1
  This product includes software developed by JanRain,
2
- available from http://openidenabled.com/
2
+ available from http://github.com/openid/ruby-openid
data/README CHANGED
@@ -48,18 +48,17 @@ look at the library itself if there's anything you don't understand in
48
48
  the examples.
49
49
 
50
50
  ==Homepage
51
- http://openidenabled.com/ruby-openid/
51
+ http://github.com/openid/ruby-openid
52
52
 
53
53
  See also:
54
54
  http://openid.net/
55
- http://openidenabled.com/
56
55
 
57
56
  ==Community
58
57
  Discussion regarding the Ruby OpenID library and other JanRain OpenID
59
58
  libraries takes place on the the OpenID mailing list on
60
- openidenabled.com.
59
+ openid.net.
61
60
 
62
- http://lists.openidenabled.com/mailman/listinfo/dev
61
+ http://openid.net/developers/dev-mailing-lists/
63
62
 
64
63
  Please join this list to discuss, ask implementation questions, report
65
64
  bugs, etc. Also check out the openid channel on the freenode IRC
File without changes
@@ -46,7 +46,7 @@ class ConsumerController < ApplicationController
46
46
  oidreq.return_to_args['force_post']='x'*2048
47
47
  end
48
48
  return_to = url_for :action => 'complete', :only_path => false
49
- realm = url_for :action => 'index', :only_path => false
49
+ realm = url_for :action => 'index', :id => nil, :only_path => false
50
50
 
51
51
  if oidreq.send_redirect?(realm, return_to, params[:immediate])
52
52
  redirect_to oidreq.redirect_url(realm, return_to, params[:immediate])
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -13,7 +13,7 @@
13
13
  # permissions and limitations under the License.
14
14
 
15
15
  module OpenID
16
- VERSION = "2.1.7"
16
+ VERSION = "2.1.8"
17
17
  end
18
18
 
19
19
  require "openid/consumer"
@@ -125,7 +125,7 @@ module OpenID
125
125
  raise ProtocolError, "#{message} has no sig."
126
126
  end
127
127
  calculated_sig = get_message_signature(message)
128
- return calculated_sig == message_sig
128
+ return CryptUtil.const_eq(calculated_sig, message_sig)
129
129
  end
130
130
 
131
131
  # Get the signature for this message
@@ -134,7 +134,7 @@ module OpenID
134
134
  end
135
135
 
136
136
  def ==(other)
137
- (other.class == self.class and
137
+ (other.class == self.class and
138
138
  other.handle == self.handle and
139
139
  other.secret == self.secret and
140
140
 
@@ -376,7 +376,7 @@ module OpenID
376
376
 
377
377
  def complete_id_res(message, current_url)
378
378
  if message.is_openid1
379
- setup_url = message.get_arg(OPENID1_NS, 'user_setup_url')
379
+ setup_url = message.get_arg(OPENID_NS, 'user_setup_url')
380
380
  if !setup_url.nil?
381
381
  return SetupNeededResponse.new(last_requested_endpoint, setup_url)
382
382
  end
@@ -246,7 +246,7 @@ module OpenID
246
246
  def get_openid1_session_type(assoc_response)
247
247
  # If it's an OpenID 1 message, allow session_type to default
248
248
  # to nil (which signifies "no-encryption")
249
- session_type = assoc_response.get_arg(OPENID1_NS, 'session_type')
249
+ session_type = assoc_response.get_arg(OPENID_NS, 'session_type')
250
250
 
251
251
  # Handle the differences between no-encryption association
252
252
  # respones in OpenID 1 and 2:
@@ -421,8 +421,7 @@ module OpenID
421
421
  iname = self.normalize_xri(iname)
422
422
 
423
423
  begin
424
- canonical_id, services = Yadis::XRI::ProxyResolver.new().query(
425
- iname, OpenIDServiceEndpoint::OPENID_TYPE_URIS)
424
+ canonical_id, services = Yadis::XRI::ProxyResolver.new().query( iname )
426
425
 
427
426
  if canonical_id.nil?
428
427
  raise Yadis::XRDSError.new(sprintf('No CanonicalID found for XRI %s', iname))
@@ -18,7 +18,7 @@ module OpenID
18
18
 
19
19
  [^>]*>.*?<\/script>
20
20
 
21
- /mixu
21
+ /mix
22
22
 
23
23
  def OpenID.openid_unescape(s)
24
24
  s.gsub('&amp;','&').gsub('&lt;','<').gsub('&gt;','>').gsub('&quot;','"')
@@ -115,7 +115,7 @@ module OpenID
115
115
  require_fields = basic_fields + ['op_endpoint']
116
116
  require_sigs = basic_sig_fields +
117
117
  ['response_nonce', 'claimed_id', 'assoc_handle', 'op_endpoint']
118
- when OPENID1_NS
118
+ when OPENID1_NS, OPENID11_NS
119
119
  require_fields = basic_fields + ['identity']
120
120
  require_sigs = basic_sig_fields
121
121
  else
@@ -276,7 +276,7 @@ module OpenID
276
276
 
277
277
  def check_nonce
278
278
  case openid_namespace
279
- when OPENID1_NS
279
+ when OPENID1_NS, OPENID11_NS
280
280
  nonce =
281
281
  @message.get_arg(BARE_NS, Consumer.openid1_return_to_nonce_name)
282
282
 
@@ -309,7 +309,7 @@ module OpenID
309
309
  def verify_discovery_results
310
310
  begin
311
311
  case openid_namespace
312
- when OPENID1_NS
312
+ when OPENID1_NS, OPENID11_NS
313
313
  verify_discovery_results_openid1
314
314
  when OPENID2_NS
315
315
  verify_discovery_results_openid2
@@ -83,7 +83,7 @@ module OpenID
83
83
  # Return the specified signed field if available, otherwise
84
84
  # return default
85
85
  def get_signed(ns_uri, ns_key, default=nil)
86
- if singed?(ns_uri, ns_key)
86
+ if signed?(ns_uri, ns_key)
87
87
  return @message.get_arg(ns_uri, ns_key, default)
88
88
  else
89
89
  return default
@@ -4,8 +4,15 @@ require "digest/sha2"
4
4
  begin
5
5
  require "digest/hmac"
6
6
  rescue LoadError
7
- require "hmac/sha1"
8
- require "hmac/sha2"
7
+ begin
8
+ # Try loading the ruby-hmac files if they exist
9
+ require "hmac-sha1"
10
+ require "hmac-sha2"
11
+ rescue LoadError
12
+ # Nothing exists use included hmac files
13
+ require "hmac/sha1"
14
+ require "hmac/sha2"
15
+ end
9
16
  end
10
17
 
11
18
  module OpenID
@@ -30,7 +37,7 @@ module OpenID
30
37
  end
31
38
 
32
39
  def CryptUtil.hmac_sha1(key, text)
33
- if Digest.const_defined? :HMAC
40
+ if Digest.const_defined? :HMAC
34
41
  Digest::HMAC.new(key,Digest::SHA1).update(text).digest
35
42
  else
36
43
  return HMAC::SHA1.digest(key, text)
@@ -42,7 +49,7 @@ module OpenID
42
49
  end
43
50
 
44
51
  def CryptUtil.hmac_sha256(key, text)
45
- if Digest.const_defined? :HMAC
52
+ if Digest.const_defined? :HMAC
46
53
  Digest::HMAC.new(key,Digest::SHA256).update(text).digest
47
54
  else
48
55
  return HMAC::SHA256.digest(key, text)
@@ -93,5 +100,16 @@ module OpenID
93
100
  def CryptUtil.base64_to_num(s)
94
101
  return binary_to_num(OpenID::Util.from_base64(s))
95
102
  end
103
+
104
+ def CryptUtil.const_eq(s1, s2)
105
+ if s1.length != s2.length
106
+ return false
107
+ end
108
+ result = true
109
+ s1.length.times do |i|
110
+ result &= (s1[i] == s2[i])
111
+ end
112
+ return result
113
+ end
96
114
  end
97
115
  end