ruby-openid 2.6.0 → 2.7.0

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 (49) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/lib/openid/association.rb +1 -1
  4. data/lib/openid/cryptutil.rb +5 -5
  5. data/lib/openid/message.rb +1 -1
  6. data/lib/openid/trustroot.rb +2 -2
  7. data/lib/openid/urinorm.rb +4 -6
  8. data/lib/openid/util.rb +0 -2
  9. data/lib/openid/version.rb +1 -1
  10. data/test/discoverdata.rb +1 -2
  11. data/test/test_accept.rb +4 -5
  12. data/test/test_association.rb +4 -3
  13. data/test/test_associationmanager.rb +22 -24
  14. data/test/test_ax.rb +9 -9
  15. data/test/test_checkid_request.rb +6 -8
  16. data/test/test_consumer.rb +5 -5
  17. data/test/test_cryptutil.rb +5 -5
  18. data/test/test_dh.rb +2 -2
  19. data/test/test_discover.rb +19 -23
  20. data/test/test_discovery_manager.rb +6 -7
  21. data/test/test_extension.rb +2 -2
  22. data/test/test_fetchers.rb +16 -16
  23. data/test/test_filters.rb +7 -7
  24. data/test/test_idres.rb +25 -40
  25. data/test/test_kvform.rb +5 -5
  26. data/test/test_kvpost.rb +2 -2
  27. data/test/test_linkparse.rb +3 -5
  28. data/test/test_message.rb +19 -19
  29. data/test/test_nonce.rb +2 -2
  30. data/test/test_oauth.rb +3 -3
  31. data/test/test_openid_yadis.rb +2 -2
  32. data/test/test_pape.rb +4 -4
  33. data/test/test_parsehtml.rb +3 -3
  34. data/test/test_responses.rb +2 -2
  35. data/test/test_server.rb +53 -53
  36. data/test/test_sreg.rb +6 -6
  37. data/test/test_stores.rb +12 -12
  38. data/test/test_trustroot.rb +2 -2
  39. data/test/test_ui.rb +2 -2
  40. data/test/test_urinorm.rb +2 -2
  41. data/test/test_util.rb +2 -2
  42. data/test/test_xrds.rb +15 -15
  43. data/test/test_xri.rb +4 -4
  44. data/test/test_xrires.rb +2 -2
  45. data/test/test_yadis_discovery.rb +5 -5
  46. data/test/testutil.rb +8 -1
  47. metadata +18 -7
  48. data/lib/openid/extras.rb +0 -13
  49. data/test/test_extras.rb +0 -35
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bd3bd50f7d5012fb0ca2dbac47882264537e2d0c
4
- data.tar.gz: 71049966e5a9e4994a8876ad89486d15c4afa495
3
+ metadata.gz: a42bebb6d79a5270a97ab8a8f7e408a2c606f19e
4
+ data.tar.gz: 37f0f842916738b876794d2836d6bf27a502a659
5
5
  SHA512:
6
- metadata.gz: dc63fe46a5f925792ba2c4f94c701363743cb590d3cf74f63eaa204f01bb364f5baf2a44e140eae7c26bf50175cbfb2a39848f49f9c8054658107b15315c4404
7
- data.tar.gz: 70fccef825665d1046c4f338ed735ff1b5fe841edadffdea955414381e1859a7bc74516a4938ef4cf60d64dff9a679f6301d11c76fe36059adf0d89296be7488
6
+ metadata.gz: ca1ee03431ac62f5ce84956a9cd522001fe44a9b1afe200ceca4d03060bb0a1c822955c96381fb25e6bdc876c6e20043574c407cf19be146a85349e1702a56b1
7
+ data.tar.gz: 10c21a26954a56214f1679af6beec7640ef13b66c1cd28fe308e235d2fcd6dd7e1ab9cc25004891e7792a786858f1e334327441d8cdd927b518878d900faa06a
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.7.0
4
+
5
+ * Use RFC 2396 compatible URI parser for trustroot - 7c84ec9ced3ccbdad575e02dbfa81e53b52f909e
6
+ See https://github.com/openid/ruby-openid/pull/85
7
+ * Use HMAC from OpenSSL rather than Digest - ce2e30d7ff3308f17ef7d8c19d6f4752f76c9c40
8
+ See https://github.com/openid/ruby-openid/pull/84
9
+ * Check if OpenSSL is loaded - 751e55820d958ee781f5abb466a576d83ddde6fd
10
+
3
11
  ## 2.6.0
4
12
 
5
13
  * More safely build filenames - 1c4a90630b183e7572b8ab5f2e3a3e0c0fecd2c7
@@ -165,7 +165,7 @@ module OpenID
165
165
 
166
166
  signed_list = []
167
167
  message_keys.each { |k|
168
- if k.starts_with?('openid.')
168
+ if k.start_with?('openid.')
169
169
  signed_list << k[7..-1]
170
170
  end
171
171
  }
@@ -2,7 +2,7 @@ require "openid/util"
2
2
  require "digest/sha1"
3
3
  require "digest/sha2"
4
4
  begin
5
- require "digest/hmac"
5
+ require "openssl"
6
6
  rescue LoadError
7
7
  begin
8
8
  # Try loading the ruby-hmac files if they exist
@@ -37,8 +37,8 @@ module OpenID
37
37
  end
38
38
 
39
39
  def CryptUtil.hmac_sha1(key, text)
40
- if Digest.const_defined? :HMAC
41
- Digest::HMAC.new(key,Digest::SHA1).update(text).digest
40
+ if defined? OpenSSL
41
+ OpenSSL::HMAC.digest(OpenSSL::Digest::SHA1.new, key, text)
42
42
  else
43
43
  return HMAC::SHA1.digest(key, text)
44
44
  end
@@ -49,8 +49,8 @@ module OpenID
49
49
  end
50
50
 
51
51
  def CryptUtil.hmac_sha256(key, text)
52
- if Digest.const_defined? :HMAC
53
- Digest::HMAC.new(key,Digest::SHA256).update(text).digest
52
+ if defined? OpenSSL
53
+ OpenSSL::HMAC.digest(OpenSSL::Digest::SHA256.new, key, text)
54
54
  else
55
55
  return HMAC::SHA256.digest(key, text)
56
56
  end
@@ -254,7 +254,7 @@ module OpenID
254
254
  post_args = self.to_post_args
255
255
  kvargs = {}
256
256
  post_args.each { |k,v|
257
- if !k.starts_with?('openid.')
257
+ if !k.start_with?('openid.')
258
258
  raise ArgumentError, "This message can only be encoded as a POST, because it contains arguments that are not prefixed with 'openid.'"
259
259
  else
260
260
  kvargs[k[7..-1]] = v
@@ -178,7 +178,7 @@ module OpenID
178
178
  end
179
179
 
180
180
  begin
181
- parsed = URI::parse(url)
181
+ parsed = URI::DEFAULT_PARSER.parse(url)
182
182
  rescue URI::InvalidURIError
183
183
  return nil
184
184
  end
@@ -315,7 +315,7 @@ module OpenID
315
315
  return false
316
316
  end
317
317
  elsif ((@host != '') and
318
- (!host.ends_with?('.' + @host)) and
318
+ (!host.end_with?('.' + @host)) and
319
319
  (host != @host))
320
320
  return false
321
321
  end
@@ -1,7 +1,5 @@
1
1
  require 'uri'
2
2
 
3
- require "openid/extras"
4
-
5
3
  module OpenID
6
4
 
7
5
  module URINorm
@@ -42,15 +40,15 @@ module OpenID
42
40
  result_segments = []
43
41
 
44
42
  while path.length > 0
45
- if path.starts_with?('../')
43
+ if path.start_with?('../')
46
44
  path = path[3..-1]
47
- elsif path.starts_with?('./')
45
+ elsif path.start_with?('./')
48
46
  path = path[2..-1]
49
- elsif path.starts_with?('/./')
47
+ elsif path.start_with?('/./')
50
48
  path = path[2..-1]
51
49
  elsif path == '/.'
52
50
  path = '/'
53
- elsif path.starts_with?('/../')
51
+ elsif path.start_with?('/../')
54
52
  path = path[3..-1]
55
53
  result_segments.pop if result_segments.length > 0
56
54
  elsif path == '/..'
@@ -2,8 +2,6 @@ require "cgi"
2
2
  require "uri"
3
3
  require "logger"
4
4
 
5
- require "openid/extras"
6
-
7
5
  # See OpenID::Consumer or OpenID::Server modules, as well as the store classes
8
6
  module OpenID
9
7
  class AssertionError < Exception
@@ -1,3 +1,3 @@
1
1
  module OpenID
2
- VERSION = "2.6.0"
2
+ VERSION = "2.7.0"
3
3
  end
@@ -2,7 +2,6 @@
2
2
  require 'uri'
3
3
  require 'openid/yadis/constants'
4
4
  require 'openid/yadis/discovery'
5
- require 'openid/extras'
6
5
  require 'openid/util'
7
6
 
8
7
  module OpenID
@@ -106,7 +105,7 @@ module OpenID
106
105
 
107
106
  ctype = nil
108
107
  header_lines.each { |header_line|
109
- if header_line.starts_with?('Content-Type:')
108
+ if header_line.start_with?('Content-Type:')
110
109
  _, ctype = header_line.split(':', 2)
111
110
  ctype = ctype.strip()
112
111
  break
@@ -1,12 +1,11 @@
1
- require 'test/unit'
1
+ require 'minitest/autorun'
2
2
  require 'testutil'
3
3
  require 'openid/yadis/accept'
4
- require 'openid/extras'
5
4
  require 'openid/util'
6
5
 
7
6
  module OpenID
8
7
 
9
- class AcceptTest < Test::Unit::TestCase
8
+ class AcceptTest < Minitest::Test
10
9
  include TestDataMixin
11
10
 
12
11
  def getTestData()
@@ -30,7 +29,7 @@ module OpenID
30
29
  chunk = []
31
30
  lines.each { |lineno, line|
32
31
  stripped = line.strip()
33
- if (stripped == '') or stripped.starts_with?('#')
32
+ if (stripped == '') or stripped.start_with?('#')
34
33
  if chunk.length > 0
35
34
  chunks << chunk
36
35
  chunk = []
@@ -154,7 +153,7 @@ module OpenID
154
153
  ].each { |input, expected_header|
155
154
 
156
155
  if expected_header.nil?
157
- assert_raise(ArgumentError) {
156
+ assert_raises(ArgumentError) {
158
157
  Yadis.generate_accept_header(*input)
159
158
  }
160
159
  else
@@ -1,8 +1,9 @@
1
- require "test/unit"
1
+ require "minitest/autorun"
2
2
  require "openid/association"
3
+ require "openid/protocolerror"
3
4
 
4
5
  module OpenID
5
- class AssociationTestCase < Test::Unit::TestCase
6
+ class AssociationTestCase < Minitest::Test
6
7
  def setup
7
8
  # Use this funny way of getting a time so that it does not have
8
9
  # fractional seconds, and so can be serialized exactly using our
@@ -202,7 +203,7 @@ module OpenID
202
203
  end
203
204
  end
204
205
 
205
- class AssociationNegotiatorTestCase < Test::Unit::TestCase
206
+ class AssociationNegotiatorTestCase < Minitest::Test
206
207
  def assert_equal_under(item1, item2)
207
208
  val1 = yield(item1)
208
209
  val2 = yield(item2)
@@ -1,23 +1,23 @@
1
- require "test/unit"
1
+ require "minitest/autorun"
2
+ require "testutil"
2
3
  require "openid/consumer/associationmanager"
3
4
  require "openid/association"
4
5
  require "openid/dh"
5
6
  require "openid/util"
6
7
  require "openid/cryptutil"
7
8
  require "openid/message"
9
+ require "openid/protocolerror"
8
10
  require "openid/store/memory"
9
11
  require "util"
10
12
  require "time"
11
13
 
12
14
  module OpenID
13
- class DHAssocSessionTest < Test::Unit::TestCase
15
+ class DHAssocSessionTest < Minitest::Test
14
16
  def test_sha1_get_request
15
17
  # Initialized without an explicit DH gets defaults
16
18
  sess = Consumer::DiffieHellmanSHA1Session.new
17
19
  assert_equal(['dh_consumer_public'], sess.get_request.keys)
18
- assert_nothing_raised do
19
- Util::from_base64(sess.get_request['dh_consumer_public'])
20
- end
20
+ Util::from_base64(sess.get_request['dh_consumer_public'])
21
21
  end
22
22
 
23
23
  def test_sha1_get_request_custom_dh
@@ -28,9 +28,7 @@ module OpenID
28
28
  req.keys.sort)
29
29
  assert_equal(dh.modulus, CryptUtil.base64_to_num(req['dh_modulus']))
30
30
  assert_equal(dh.generator, CryptUtil.base64_to_num(req['dh_gen']))
31
- assert_nothing_raised do
32
- Util::from_base64(req['dh_consumer_public'])
33
- end
31
+ Util::from_base64(req['dh_consumer_public'])
34
32
  end
35
33
  end
36
34
 
@@ -102,7 +100,7 @@ module OpenID
102
100
  end
103
101
  end
104
102
 
105
- class TestConsumerOpenID1DHSHA1 < Test::Unit::TestCase
103
+ class TestConsumerOpenID1DHSHA1 < Minitest::Test
106
104
  include TestDiffieHellmanResponseParametersMixin
107
105
  class << self
108
106
  attr_reader :session_cls, :message_namespace
@@ -112,7 +110,7 @@ module OpenID
112
110
  @message_namespace = OPENID1_NS
113
111
  end
114
112
 
115
- class TestConsumerOpenID2DHSHA1 < Test::Unit::TestCase
113
+ class TestConsumerOpenID2DHSHA1 < Minitest::Test
116
114
  include TestDiffieHellmanResponseParametersMixin
117
115
  class << self
118
116
  attr_reader :session_cls, :message_namespace
@@ -122,7 +120,7 @@ module OpenID
122
120
  @message_namespace = OPENID2_NS
123
121
  end
124
122
 
125
- class TestConsumerOpenID2DHSHA256 < Test::Unit::TestCase
123
+ class TestConsumerOpenID2DHSHA256 < Minitest::Test
126
124
  include TestDiffieHellmanResponseParametersMixin
127
125
  class << self
128
126
  attr_reader :session_cls, :message_namespace
@@ -132,7 +130,7 @@ module OpenID
132
130
  @message_namespace = OPENID2_NS
133
131
  end
134
132
 
135
- class TestConsumerNoEncryptionSession < Test::Unit::TestCase
133
+ class TestConsumerNoEncryptionSession < Minitest::Test
136
134
  def setup
137
135
  @sess = Consumer::NoEncryptionSession.new
138
136
  end
@@ -149,7 +147,7 @@ module OpenID
149
147
  end
150
148
  end
151
149
 
152
- class TestCreateAssociationRequest < Test::Unit::TestCase
150
+ class TestCreateAssociationRequest < Minitest::Test
153
151
  def setup
154
152
  @server_url = 'http://invalid/'
155
153
  @assoc_manager = Consumer::AssociationManager.new(nil, @server_url)
@@ -203,7 +201,7 @@ module OpenID
203
201
 
204
202
  # This is a random base-64 value, so just check that it's
205
203
  # present.
206
- assert_not_nil(args.get_arg(OPENID1_NS, 'dh_consumer_public'))
204
+ refute_nil(args.get_arg(OPENID1_NS, 'dh_consumer_public'))
207
205
  args.del_arg(OPENID1_NS, 'dh_consumer_public')
208
206
 
209
207
  # OK, session_type is set here and not for no-encryption
@@ -216,7 +214,7 @@ module OpenID
216
214
  end
217
215
  end
218
216
 
219
- class TestAssociationManagerExpiresIn < Test::Unit::TestCase
217
+ class TestAssociationManagerExpiresIn < Minitest::Test
220
218
  def expires_in_msg(val)
221
219
  msg = Message.from_openid_args({'expires_in' => val})
222
220
  Consumer::AssociationManager.extract_expires_in(msg)
@@ -248,7 +246,7 @@ module OpenID
248
246
  end
249
247
  end
250
248
 
251
- class TestAssociationManagerCreateSession < Test::Unit::TestCase
249
+ class TestAssociationManagerCreateSession < Minitest::Test
252
250
  def test_invalid
253
251
  assert_raises(ArgumentError) {
254
252
  Consumer::AssociationManager.create_session('monkeys')
@@ -292,7 +290,7 @@ module OpenID
292
290
 
293
291
  # Test the session type negotiation behavior of an OpenID 2
294
292
  # consumer.
295
- class TestOpenID2SessionNegotiation < Test::Unit::TestCase
293
+ class TestOpenID2SessionNegotiation < Minitest::Test
296
294
  include NegotiationTestMixin
297
295
 
298
296
  Compat = false
@@ -413,7 +411,7 @@ module OpenID
413
411
  # oidutil.log. See the calls to self.failUnlessLogMatches. Some of
414
412
  # these tests pass openid2-style messages to the openid 1
415
413
  # association processing logic to be sure it ignores the extra data.
416
- class TestOpenID1SessionNegotiation < Test::Unit::TestCase
414
+ class TestOpenID1SessionNegotiation < Minitest::Test
417
415
  include NegotiationTestMixin
418
416
 
419
417
  Compat = true
@@ -498,7 +496,7 @@ module OpenID
498
496
  end
499
497
 
500
498
 
501
- class TestExtractAssociation < Test::Unit::TestCase
499
+ class TestExtractAssociation < Minitest::Test
502
500
  include ProtocolErrorMixin
503
501
 
504
502
  # An OpenID associate response (without the namespace)
@@ -619,7 +617,7 @@ module OpenID
619
617
  end
620
618
  end
621
619
 
622
- class GetOpenIDSessionTypeTest < Test::Unit::TestCase
620
+ class GetOpenIDSessionTypeTest < Minitest::Test
623
621
  include TestUtil
624
622
 
625
623
  SERVER_URL = 'http://invalid/'
@@ -666,7 +664,7 @@ module OpenID
666
664
  end
667
665
  end
668
666
 
669
- class ExtractAssociationTest < Test::Unit::TestCase
667
+ class ExtractAssociationTest < Minitest::Test
670
668
  include ProtocolErrorMixin
671
669
 
672
670
  SERVER_URL = 'http://invalid/'
@@ -740,7 +738,7 @@ module OpenID
740
738
  end
741
739
  end
742
740
 
743
- class TestExtractAssociationDiffieHellman < Test::Unit::TestCase
741
+ class TestExtractAssociationDiffieHellman < Minitest::Test
744
742
  include ProtocolErrorMixin
745
743
 
746
744
  SECRET = 'x' * 20
@@ -799,7 +797,7 @@ module OpenID
799
797
  end
800
798
  end
801
799
 
802
- class TestAssocManagerGetAssociation < Test::Unit::TestCase
800
+ class TestAssocManagerGetAssociation < Minitest::Test
803
801
  include FetcherMixin
804
802
  include TestUtil
805
803
 
@@ -859,7 +857,7 @@ module OpenID
859
857
  end
860
858
  end
861
859
 
862
- class TestAssocManagerRequestAssociation < Test::Unit::TestCase
860
+ class TestAssocManagerRequestAssociation < Minitest::Test
863
861
  include FetcherMixin
864
862
  include TestUtil
865
863
 
@@ -1,4 +1,4 @@
1
- require 'test/unit'
1
+ require 'minitest/autorun'
2
2
  require 'openid/extensions/ax'
3
3
  require 'openid/message'
4
4
  require 'openid/consumer/responses'
@@ -23,7 +23,7 @@ module OpenID
23
23
  end
24
24
  end
25
25
 
26
- class AXMessageTest < Test::Unit::TestCase
26
+ class AXMessageTest < Minitest::Test
27
27
  def setup
28
28
  @bax = BogusAXMessage.new
29
29
  end
@@ -38,7 +38,7 @@ module OpenID
38
38
  end
39
39
  end
40
40
 
41
- class AttrInfoTest < Test::Unit::TestCase
41
+ class AttrInfoTest < Minitest::Test
42
42
  def test_construct
43
43
  assert_raises(ArgumentError) { AttrInfo.new }
44
44
  type_uri = 'uri geller'
@@ -51,7 +51,7 @@ module OpenID
51
51
  end
52
52
  end
53
53
 
54
- class ToTypeURIsTest < Test::Unit::TestCase
54
+ class ToTypeURIsTest < Minitest::Test
55
55
  def setup
56
56
  @aliases = NamespaceMap.new
57
57
  end
@@ -91,7 +91,7 @@ module OpenID
91
91
  end
92
92
  end
93
93
 
94
- class ParseAXValuesTest < Test::Unit::TestCase
94
+ class ParseAXValuesTest < Minitest::Test
95
95
  def ax_values(ax_args, expected_args)
96
96
  msg = KeyValueMessage.new
97
97
  msg.parse_extension_args(ax_args)
@@ -221,7 +221,7 @@ module OpenID
221
221
  end
222
222
  end
223
223
 
224
- class FetchRequestTest < Test::Unit::TestCase
224
+ class FetchRequestTest < Minitest::Test
225
225
  def setup
226
226
  @msg = FetchRequest.new
227
227
  @type_a = 'http://janrain.example.com/a'
@@ -483,7 +483,7 @@ module OpenID
483
483
  end
484
484
  end
485
485
 
486
- class FetchResponseTest < Test::Unit::TestCase
486
+ class FetchResponseTest < Minitest::Test
487
487
  def setup
488
488
  @msg = FetchResponse.new
489
489
  @value_a = 'commodity'
@@ -675,7 +675,7 @@ module OpenID
675
675
  end
676
676
  end
677
677
 
678
- class StoreRequestTest < Test::Unit::TestCase
678
+ class StoreRequestTest < Minitest::Test
679
679
  def setup
680
680
  @msg = StoreRequest.new
681
681
  @type_a = 'http://oranges.are.for/'
@@ -729,7 +729,7 @@ module OpenID
729
729
  end
730
730
  end
731
731
 
732
- class StoreResponseTest < Test::Unit::TestCase
732
+ class StoreResponseTest < Minitest::Test
733
733
  def test_success
734
734
  msg = StoreResponse.new
735
735
  assert(msg.succeeded?)