ruby-openid 2.6.0 → 2.7.0
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.
Potentially problematic release.
This version of ruby-openid might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/openid/association.rb +1 -1
- data/lib/openid/cryptutil.rb +5 -5
- data/lib/openid/message.rb +1 -1
- data/lib/openid/trustroot.rb +2 -2
- data/lib/openid/urinorm.rb +4 -6
- data/lib/openid/util.rb +0 -2
- data/lib/openid/version.rb +1 -1
- data/test/discoverdata.rb +1 -2
- data/test/test_accept.rb +4 -5
- data/test/test_association.rb +4 -3
- data/test/test_associationmanager.rb +22 -24
- data/test/test_ax.rb +9 -9
- data/test/test_checkid_request.rb +6 -8
- data/test/test_consumer.rb +5 -5
- data/test/test_cryptutil.rb +5 -5
- data/test/test_dh.rb +2 -2
- data/test/test_discover.rb +19 -23
- data/test/test_discovery_manager.rb +6 -7
- data/test/test_extension.rb +2 -2
- data/test/test_fetchers.rb +16 -16
- data/test/test_filters.rb +7 -7
- data/test/test_idres.rb +25 -40
- data/test/test_kvform.rb +5 -5
- data/test/test_kvpost.rb +2 -2
- data/test/test_linkparse.rb +3 -5
- data/test/test_message.rb +19 -19
- data/test/test_nonce.rb +2 -2
- data/test/test_oauth.rb +3 -3
- data/test/test_openid_yadis.rb +2 -2
- data/test/test_pape.rb +4 -4
- data/test/test_parsehtml.rb +3 -3
- data/test/test_responses.rb +2 -2
- data/test/test_server.rb +53 -53
- data/test/test_sreg.rb +6 -6
- data/test/test_stores.rb +12 -12
- data/test/test_trustroot.rb +2 -2
- data/test/test_ui.rb +2 -2
- data/test/test_urinorm.rb +2 -2
- data/test/test_util.rb +2 -2
- data/test/test_xrds.rb +15 -15
- data/test/test_xri.rb +4 -4
- data/test/test_xrires.rb +2 -2
- data/test/test_yadis_discovery.rb +5 -5
- data/test/testutil.rb +8 -1
- metadata +18 -7
- data/lib/openid/extras.rb +0 -13
- data/test/test_extras.rb +0 -35
@@ -1,4 +1,4 @@
|
|
1
|
-
require "
|
1
|
+
require "minitest/autorun"
|
2
2
|
require "openid/consumer/checkid_request"
|
3
3
|
require "openid/message"
|
4
4
|
require "testutil"
|
@@ -135,7 +135,7 @@ module OpenID
|
|
135
135
|
end
|
136
136
|
end
|
137
137
|
|
138
|
-
class TestCheckIDRequestOpenID2 < Test
|
138
|
+
class TestCheckIDRequestOpenID2 < Minitest::Test
|
139
139
|
include CheckIDTestMixin
|
140
140
|
|
141
141
|
def immediate
|
@@ -167,8 +167,8 @@ module OpenID
|
|
167
167
|
# OpenID Checkid_Requests should be able to set 'anonymous' to true.
|
168
168
|
def test_set_anonymous_works_for_openid2
|
169
169
|
assert(@checkid_req.message.is_openid2)
|
170
|
-
|
171
|
-
|
170
|
+
@checkid_req.anonymous = true
|
171
|
+
@checkid_req.anonymous = false
|
172
172
|
end
|
173
173
|
|
174
174
|
def test_user_anonymous_ignores_identfier
|
@@ -207,7 +207,7 @@ module OpenID
|
|
207
207
|
end
|
208
208
|
end
|
209
209
|
|
210
|
-
class TestCheckIDRequestOpenID1 < Test
|
210
|
+
class TestCheckIDRequestOpenID1 < Minitest::Test
|
211
211
|
include CheckIDTestMixin
|
212
212
|
|
213
213
|
def immediate
|
@@ -248,9 +248,7 @@ module OpenID
|
|
248
248
|
assert_raises(ArgumentError) {
|
249
249
|
@checkid_req.anonymous = true
|
250
250
|
}
|
251
|
-
|
252
|
-
@checkid_req.anonymous = false
|
253
|
-
}
|
251
|
+
@checkid_req.anonymous = false
|
254
252
|
end
|
255
253
|
|
256
254
|
# Identfier select SHOULD NOT be sent, but this pathway is in
|
data/test/test_consumer.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
require "
|
1
|
+
require "minitest/autorun"
|
2
2
|
require "testutil"
|
3
3
|
require "openid/consumer"
|
4
4
|
|
5
5
|
module OpenID
|
6
6
|
class Consumer
|
7
7
|
module TestConsumer
|
8
|
-
class TestLastEndpoint < Test
|
8
|
+
class TestLastEndpoint < Minitest::Test
|
9
9
|
def test_set_get
|
10
10
|
session = {}
|
11
11
|
consumer = Consumer.new(session, nil)
|
@@ -20,7 +20,7 @@ module OpenID
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
class TestBegin < Test
|
23
|
+
class TestBegin < Minitest::Test
|
24
24
|
attr_accessor :user_input, :anonymous, :services,
|
25
25
|
:discovered_identifier, :checkid_request, :service
|
26
26
|
|
@@ -79,7 +79,7 @@ module OpenID
|
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
82
|
-
class TestBeginWithoutDiscovery < Test
|
82
|
+
class TestBeginWithoutDiscovery < Minitest::Test
|
83
83
|
attr_reader :assoc
|
84
84
|
def setup
|
85
85
|
@session = {}
|
@@ -154,7 +154,7 @@ module OpenID
|
|
154
154
|
end
|
155
155
|
end
|
156
156
|
|
157
|
-
class TestComplete < Test
|
157
|
+
class TestComplete < Minitest::Test
|
158
158
|
def setup
|
159
159
|
@session = {}
|
160
160
|
@consumer = Consumer.new(@session, nil)
|
data/test/test_cryptutil.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# coding: ASCII-8BIT
|
2
|
-
require "
|
2
|
+
require "minitest/autorun"
|
3
3
|
require "openid/cryptutil"
|
4
4
|
require "pathname"
|
5
5
|
|
6
|
-
class CryptUtilTestCase < Test
|
6
|
+
class CryptUtilTestCase < Minitest::Test
|
7
7
|
BIG = 2 ** 256
|
8
8
|
|
9
9
|
def test_rand
|
@@ -16,7 +16,7 @@ class CryptUtilTestCase < Test::Unit::TestCase
|
|
16
16
|
b = OpenID::CryptUtil.rand(BIG)
|
17
17
|
assert(a.is_a?(Bignum))
|
18
18
|
assert(b.is_a?(Bignum))
|
19
|
-
|
19
|
+
refute_equal(a, b)
|
20
20
|
end
|
21
21
|
|
22
22
|
def test_rand_doesnt_depend_on_srand
|
@@ -24,7 +24,7 @@ class CryptUtilTestCase < Test::Unit::TestCase
|
|
24
24
|
a = OpenID::CryptUtil.rand(BIG)
|
25
25
|
Kernel.srand(1)
|
26
26
|
b = OpenID::CryptUtil.rand(BIG)
|
27
|
-
|
27
|
+
refute_equal(a, b)
|
28
28
|
end
|
29
29
|
|
30
30
|
def test_random_binary_convert
|
@@ -89,7 +89,7 @@ class CryptUtilTestCase < Test::Unit::TestCase
|
|
89
89
|
assert_equal(42, s1.length)
|
90
90
|
s2 = OpenID::CryptUtil.random_string(42)
|
91
91
|
assert_equal(42, s2.length)
|
92
|
-
|
92
|
+
refute_equal(s1, s2)
|
93
93
|
end
|
94
94
|
|
95
95
|
def test_randomstring_population
|
data/test/test_dh.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'minitest/autorun'
|
2
2
|
require 'testutil'
|
3
3
|
require 'openid/dh'
|
4
4
|
|
@@ -9,7 +9,7 @@ module OpenID
|
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
|
-
class DiffieHellmanTestCase < Test
|
12
|
+
class DiffieHellmanTestCase < Minitest::Test
|
13
13
|
include OpenID::TestDataMixin
|
14
14
|
|
15
15
|
NUL = "\x00"
|
data/test/test_discover.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'minitest/autorun'
|
2
2
|
require 'testutil'
|
3
3
|
require 'util'
|
4
4
|
require 'openid/fetchers'
|
@@ -26,7 +26,7 @@ module OpenID
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
class TestDiscoveryFailure < Test
|
29
|
+
class TestDiscoveryFailure < Minitest::Test
|
30
30
|
def initialize(*args)
|
31
31
|
super(*args)
|
32
32
|
|
@@ -80,7 +80,7 @@ module OpenID
|
|
80
80
|
# Custom exception just to make sure it's not handled differently
|
81
81
|
end
|
82
82
|
|
83
|
-
class TestFetchException < Test
|
83
|
+
class TestFetchException < Minitest::Test
|
84
84
|
# Discovery should only raise DiscoveryFailure
|
85
85
|
|
86
86
|
def initialize(*args)
|
@@ -107,7 +107,7 @@ module OpenID
|
|
107
107
|
|
108
108
|
### Tests for openid.consumer.discover.discover
|
109
109
|
|
110
|
-
class TestNormalization < Test
|
110
|
+
class TestNormalization < Minitest::Test
|
111
111
|
def test_addingProtocol
|
112
112
|
f = ErrorRaisingFetcher.new(RuntimeError.new())
|
113
113
|
OpenID.fetcher = f
|
@@ -152,7 +152,7 @@ module OpenID
|
|
152
152
|
end
|
153
153
|
end
|
154
154
|
|
155
|
-
class BaseTestDiscovery < Test
|
155
|
+
class BaseTestDiscovery < Minitest::Test
|
156
156
|
attr_accessor :id_url, :fetcher_class
|
157
157
|
|
158
158
|
def initialize(*args)
|
@@ -247,7 +247,7 @@ module OpenID
|
|
247
247
|
end
|
248
248
|
|
249
249
|
def test_404
|
250
|
-
|
250
|
+
assert_raises(DiscoveryFailure) {
|
251
251
|
OpenID.discover(@id_url + '/404')
|
252
252
|
}
|
253
253
|
end
|
@@ -475,7 +475,7 @@ module OpenID
|
|
475
475
|
end
|
476
476
|
|
477
477
|
def test_yadis2BadLocalID
|
478
|
-
|
478
|
+
assert_raises(DiscoveryFailure) {
|
479
479
|
_discover('application/xrds+xml',
|
480
480
|
read_data_file('test_discover/yadis_2_bad_local_id.xml', false),
|
481
481
|
1)
|
@@ -497,7 +497,7 @@ module OpenID
|
|
497
497
|
end
|
498
498
|
|
499
499
|
def test_yadis1And2BadLocalID
|
500
|
-
|
500
|
+
assert_raises(DiscoveryFailure) {
|
501
501
|
_discover('application/xrds+xml',
|
502
502
|
read_data_file('test_discover/openid_1_and_2_xrds_bad_delegate.xml', false),
|
503
503
|
1)
|
@@ -525,7 +525,7 @@ module OpenID
|
|
525
525
|
"mean to do that.")
|
526
526
|
end
|
527
527
|
|
528
|
-
if xri.
|
528
|
+
if xri.start_with?('/')
|
529
529
|
xri = xri[1..-1]
|
530
530
|
end
|
531
531
|
|
@@ -641,7 +641,7 @@ module OpenID
|
|
641
641
|
end
|
642
642
|
end
|
643
643
|
|
644
|
-
class TestPreferredNamespace < Test
|
644
|
+
class TestPreferredNamespace < Minitest::Test
|
645
645
|
def initialize(*args)
|
646
646
|
super(*args)
|
647
647
|
|
@@ -670,7 +670,7 @@ module OpenID
|
|
670
670
|
end
|
671
671
|
end
|
672
672
|
|
673
|
-
class TestIsOPIdentifier < Test
|
673
|
+
class TestIsOPIdentifier < Minitest::Test
|
674
674
|
def setup
|
675
675
|
@endpoint = OpenIDServiceEndpoint.new()
|
676
676
|
end
|
@@ -713,7 +713,7 @@ module OpenID
|
|
713
713
|
end
|
714
714
|
end
|
715
715
|
|
716
|
-
class TestFromOPEndpointURL < Test
|
716
|
+
class TestFromOPEndpointURL < Minitest::Test
|
717
717
|
def setup
|
718
718
|
@op_endpoint_url = 'http://example.com/op/endpoint'
|
719
719
|
@endpoint = OpenIDServiceEndpoint.from_op_endpoint_url(@op_endpoint_url)
|
@@ -741,18 +741,14 @@ module OpenID
|
|
741
741
|
end
|
742
742
|
end
|
743
743
|
|
744
|
-
class TestDiscoverFunction < Test
|
744
|
+
class TestDiscoverFunction < Minitest::Test
|
745
745
|
def test_discover_function
|
746
746
|
# XXX these were all different tests in python, but they're
|
747
747
|
# combined here so I only have to use with_method_overridden
|
748
748
|
# once.
|
749
|
-
discoverXRI = Proc.new { |identifier|
|
750
|
-
return 'XRI'
|
751
|
-
}
|
749
|
+
discoverXRI = Proc.new { |identifier| 'XRI' }
|
752
750
|
|
753
|
-
discoverURI = Proc.new { |identifier|
|
754
|
-
return 'URI'
|
755
|
-
}
|
751
|
+
discoverURI = Proc.new { |identifier| 'URI' }
|
756
752
|
|
757
753
|
OpenID.extend(OverrideMethodMixin)
|
758
754
|
|
@@ -767,7 +763,7 @@ module OpenID
|
|
767
763
|
end
|
768
764
|
end
|
769
765
|
|
770
|
-
class TestEndpointSupportsType < Test
|
766
|
+
class TestEndpointSupportsType < Minitest::Test
|
771
767
|
def setup
|
772
768
|
@endpoint = OpenIDServiceEndpoint.new()
|
773
769
|
end
|
@@ -830,7 +826,7 @@ module OpenID
|
|
830
826
|
end
|
831
827
|
end
|
832
828
|
|
833
|
-
class TestEndpointDisplayIdentifier < Test
|
829
|
+
class TestEndpointDisplayIdentifier < Minitest::Test
|
834
830
|
def test_strip_fragment
|
835
831
|
@endpoint = OpenIDServiceEndpoint.new()
|
836
832
|
@endpoint.claimed_id = 'http://recycled.invalid/#123'
|
@@ -839,9 +835,9 @@ module OpenID
|
|
839
835
|
end
|
840
836
|
|
841
837
|
|
842
|
-
class TestNormalizeURL < Test
|
838
|
+
class TestNormalizeURL < Minitest::Test
|
843
839
|
def test_no_host
|
844
|
-
|
840
|
+
assert_raises(DiscoveryFailure) {
|
845
841
|
OpenID::normalize_url('http:///too-many.invalid/slashes')
|
846
842
|
}
|
847
843
|
end
|
@@ -1,10 +1,9 @@
|
|
1
|
-
require '
|
2
|
-
require 'openid/consumer
|
3
|
-
require 'openid/extras'
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require 'openid/consumer'
|
4
3
|
require 'testutil'
|
5
4
|
|
6
5
|
module OpenID
|
7
|
-
class TestDiscoveredServices < Test
|
6
|
+
class TestDiscoveredServices < Minitest::Test
|
8
7
|
def setup
|
9
8
|
@starting_url = "http://starting.url.com/"
|
10
9
|
@yadis_url = "http://starting.url.com/xrds"
|
@@ -64,7 +63,7 @@ module OpenID
|
|
64
63
|
end
|
65
64
|
end
|
66
65
|
|
67
|
-
class TestDiscoveryManager < Test
|
66
|
+
class TestDiscoveryManager < Minitest::Test
|
68
67
|
def setup
|
69
68
|
session = {}
|
70
69
|
@session = OpenID::Consumer::Session.new(session, OpenID::Consumer::DiscoveredServices)
|
@@ -198,7 +197,7 @@ module OpenID
|
|
198
197
|
|
199
198
|
# Calling create_manager with a preexisting manager should
|
200
199
|
# result in StandardError.
|
201
|
-
|
200
|
+
assert_raises(StandardError) {
|
202
201
|
@manager.create_manager(@yadis_url, services)
|
203
202
|
}
|
204
203
|
|
@@ -234,7 +233,7 @@ module OpenID
|
|
234
233
|
end
|
235
234
|
|
236
235
|
def test_session_key
|
237
|
-
assert(@manager.session_key.
|
236
|
+
assert(@manager.session_key.end_with?(
|
238
237
|
@manager.instance_variable_get("@session_key_suffix")))
|
239
238
|
end
|
240
239
|
|
data/test/test_extension.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'minitest/autorun'
|
2
2
|
require 'openid/extension'
|
3
3
|
require 'openid/message'
|
4
4
|
|
@@ -16,7 +16,7 @@ module OpenID
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
class ToMessageTest < Test
|
19
|
+
class ToMessageTest < Minitest::Test
|
20
20
|
def test_OpenID1
|
21
21
|
oid1_msg = Message.new(OPENID1_NS)
|
22
22
|
ext = DummyExtension.new
|
data/test/test_fetchers.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
require '
|
2
|
+
require 'minitest/autorun'
|
3
3
|
require 'net/http'
|
4
4
|
require 'webrick'
|
5
5
|
require 'testutil'
|
@@ -35,7 +35,7 @@ class BogusFetcher
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
-
class FetcherTestCase < Test
|
38
|
+
class FetcherTestCase < Minitest::Test
|
39
39
|
include HttpResultAssertions
|
40
40
|
include OpenID::TestUtil
|
41
41
|
|
@@ -107,7 +107,7 @@ class FetcherTestCase < Test::Unit::TestCase
|
|
107
107
|
resp.status = 302
|
108
108
|
resp['Location'] = _uri_build('/redirect_loop')
|
109
109
|
resp.body = "Fetched #{@_redirect_counter} times."
|
110
|
-
|
110
|
+
assert @_redirect_counter < 10, "Fetched too many times."
|
111
111
|
}
|
112
112
|
end
|
113
113
|
|
@@ -243,8 +243,8 @@ EOHTML
|
|
243
243
|
def test_redirect_limit
|
244
244
|
@_redirect_counter = 0
|
245
245
|
uri = _uri_build('/redirect_loop')
|
246
|
-
|
247
|
-
@fetcher.fetch(uri)
|
246
|
+
assert_raises(OpenID::HTTPRedirectLimitReached) {
|
247
|
+
@fetcher.fetch(uri, body=nil, headers=nil, redirect_limit=0)
|
248
248
|
}
|
249
249
|
end
|
250
250
|
|
@@ -294,7 +294,7 @@ EOHTML
|
|
294
294
|
|
295
295
|
begin
|
296
296
|
assert_http_result_is expected, result
|
297
|
-
rescue
|
297
|
+
rescue Minitest::Assertion => err
|
298
298
|
if result.code == '500' && expected_code != 500
|
299
299
|
# Looks like our WEBrick harness broke.
|
300
300
|
msg = <<EOF
|
@@ -306,7 +306,7 @@ EOF
|
|
306
306
|
|
307
307
|
# Wrap failure messages so we can tell which case failed.
|
308
308
|
new_msg = "#{path}: #{err.message.to_s}"
|
309
|
-
new_err =
|
309
|
+
new_err = Minitest::Assertion.new(new_msg)
|
310
310
|
new_err.set_backtrace(err.backtrace)
|
311
311
|
raise new_err
|
312
312
|
end
|
@@ -399,7 +399,7 @@ EOF
|
|
399
399
|
nil
|
400
400
|
end
|
401
401
|
|
402
|
-
|
402
|
+
assert_raises(RuntimeError) {
|
403
403
|
f.make_connection(URI::parse("http://example.com/"))
|
404
404
|
}
|
405
405
|
end
|
@@ -412,7 +412,7 @@ EOF
|
|
412
412
|
"not a Net::HTTP object"
|
413
413
|
end
|
414
414
|
|
415
|
-
|
415
|
+
assert_raises(RuntimeError) {
|
416
416
|
f.make_connection(URI::parse("http://example.com/"))
|
417
417
|
}
|
418
418
|
end
|
@@ -431,7 +431,7 @@ EOF
|
|
431
431
|
BrokenSSLConnection.new
|
432
432
|
end
|
433
433
|
|
434
|
-
|
434
|
+
assert_raises(OpenID::SSLFetchingError) {
|
435
435
|
f.fetch("https://bogus.com/")
|
436
436
|
}
|
437
437
|
end
|
@@ -450,7 +450,7 @@ EOF
|
|
450
450
|
TimeoutConnection.new
|
451
451
|
end
|
452
452
|
|
453
|
-
|
453
|
+
assert_raises(OpenID::FetchingError) {
|
454
454
|
f.fetch("https://bogus.com/")
|
455
455
|
}
|
456
456
|
end
|
@@ -494,7 +494,7 @@ EOF
|
|
494
494
|
end
|
495
495
|
|
496
496
|
# post_connection_check should not be called.
|
497
|
-
|
497
|
+
assert_raises(TestingException) {
|
498
498
|
f.fetch("https://bogus.com/")
|
499
499
|
}
|
500
500
|
end
|
@@ -508,7 +508,7 @@ EOF
|
|
508
508
|
end
|
509
509
|
|
510
510
|
# post_connection_check should not be called.
|
511
|
-
|
511
|
+
assert_raises(TestingException) {
|
512
512
|
f.fetch("https://bogus.com/")
|
513
513
|
}
|
514
514
|
end
|
@@ -538,13 +538,13 @@ EOF
|
|
538
538
|
end
|
539
539
|
|
540
540
|
# post_connection_check should be called.
|
541
|
-
|
541
|
+
assert_raises(PostConnectionCheckException) {
|
542
542
|
f.fetch("https://bogus.com/")
|
543
543
|
}
|
544
544
|
end
|
545
545
|
end
|
546
546
|
|
547
|
-
class DefaultFetcherTest < Test
|
547
|
+
class DefaultFetcherTest < Minitest::Test
|
548
548
|
def setup
|
549
549
|
OpenID.fetcher = nil
|
550
550
|
end
|
@@ -564,7 +564,7 @@ class DefaultFetcherTest < Test::Unit::TestCase
|
|
564
564
|
end
|
565
565
|
end
|
566
566
|
|
567
|
-
class ProxyTest < Test
|
567
|
+
class ProxyTest < Minitest::Test
|
568
568
|
def test_proxy_unreachable
|
569
569
|
begin
|
570
570
|
f = OpenID::StandardFetcher.new('127.0.0.1', 1)
|