ruby-openid 1.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.
- data/COPYING +21 -0
- data/INSTALL +34 -0
- data/README +67 -0
- data/TODO +9 -0
- data/examples/README +54 -0
- data/examples/cacert.pem +7815 -0
- data/examples/consumer.rb +285 -0
- data/examples/openid-store/associations/http-localhost_3A3000_2Fserver-EMQbAy3NnHVzA.s0u5KAcplKGzo +6 -0
- data/examples/openid-store/auth_key +1 -0
- data/examples/rails_active_record_store/README +59 -0
- data/examples/rails_active_record_store/XX_add_openidstore.rb +30 -0
- data/examples/rails_active_record_store/models/openid_association.rb +12 -0
- data/examples/rails_active_record_store/models/openid_nonce.rb +3 -0
- data/examples/rails_active_record_store/models/openid_setting.rb +2 -0
- data/examples/rails_active_record_store/openid_helper.rb +91 -0
- data/examples/rails_active_record_store/openidstore_test.rb +15 -0
- data/examples/rails_active_record_store/schema.mysql.sql +22 -0
- data/examples/rails_active_record_store/schema.postgresql.sql +21 -0
- data/examples/rails_active_record_store/schema.sqlite.sql +21 -0
- data/examples/rails_openid_login_generator/USAGE +23 -0
- data/examples/rails_openid_login_generator/openid_login_generator.rb +36 -0
- data/examples/rails_openid_login_generator/templates/README +116 -0
- data/examples/rails_openid_login_generator/templates/controller.rb +116 -0
- data/examples/rails_openid_login_generator/templates/controller_test.rb +0 -0
- data/examples/rails_openid_login_generator/templates/helper.rb +2 -0
- data/examples/rails_openid_login_generator/templates/openid_login_system.rb +87 -0
- data/examples/rails_openid_login_generator/templates/user.rb +14 -0
- data/examples/rails_openid_login_generator/templates/user_test.rb +0 -0
- data/examples/rails_openid_login_generator/templates/users.yml +0 -0
- data/examples/rails_openid_login_generator/templates/view_login.rhtml +15 -0
- data/examples/rails_openid_login_generator/templates/view_logout.rhtml +10 -0
- data/examples/rails_openid_login_generator/templates/view_welcome.rhtml +9 -0
- data/examples/rails_server/README +153 -0
- data/examples/rails_server/Rakefile +10 -0
- data/examples/rails_server/app/controllers/application.rb +4 -0
- data/examples/rails_server/app/controllers/login_controller.rb +35 -0
- data/examples/rails_server/app/controllers/server_controller.rb +185 -0
- data/examples/rails_server/app/helpers/application_helper.rb +3 -0
- data/examples/rails_server/app/helpers/login_helper.rb +2 -0
- data/examples/rails_server/app/helpers/server_helper.rb +9 -0
- data/examples/rails_server/app/views/layouts/server.rhtml +61 -0
- data/examples/rails_server/app/views/login/index.rhtml +32 -0
- data/examples/rails_server/app/views/server/decide.rhtml +11 -0
- data/examples/rails_server/config/boot.rb +19 -0
- data/examples/rails_server/config/database.yml +85 -0
- data/examples/rails_server/config/environment.rb +53 -0
- data/examples/rails_server/config/environments/development.rb +19 -0
- data/examples/rails_server/config/environments/production.rb +19 -0
- data/examples/rails_server/config/environments/test.rb +19 -0
- data/examples/rails_server/config/routes.rb +23 -0
- data/examples/rails_server/db/openid-store/associations/http-localhost_2F_7Cnormal-YU.tkND1J4fEZhnuAoT5Zc0yCA0 +6 -0
- data/examples/rails_server/doc/README_FOR_APP +2 -0
- data/examples/rails_server/log/development.log +6059 -0
- data/examples/rails_server/log/production.log +0 -0
- data/examples/rails_server/log/server.log +0 -0
- data/examples/rails_server/log/test.log +0 -0
- data/examples/rails_server/public/404.html +8 -0
- data/examples/rails_server/public/500.html +8 -0
- data/examples/rails_server/public/dispatch.cgi +12 -0
- data/examples/rails_server/public/dispatch.fcgi +26 -0
- data/examples/rails_server/public/dispatch.rb +12 -0
- data/examples/rails_server/public/favicon.ico +0 -0
- data/examples/rails_server/public/images/rails.png +0 -0
- data/examples/rails_server/public/javascripts/controls.js +750 -0
- data/examples/rails_server/public/javascripts/dragdrop.js +584 -0
- data/examples/rails_server/public/javascripts/effects.js +854 -0
- data/examples/rails_server/public/javascripts/prototype.js +1785 -0
- data/examples/rails_server/public/robots.txt +1 -0
- data/examples/rails_server/script/about +3 -0
- data/examples/rails_server/script/breakpointer +3 -0
- data/examples/rails_server/script/console +3 -0
- data/examples/rails_server/script/destroy +3 -0
- data/examples/rails_server/script/generate +3 -0
- data/examples/rails_server/script/performance/benchmarker +3 -0
- data/examples/rails_server/script/performance/profiler +3 -0
- data/examples/rails_server/script/plugin +3 -0
- data/examples/rails_server/script/process/reaper +3 -0
- data/examples/rails_server/script/process/spawner +3 -0
- data/examples/rails_server/script/process/spinner +3 -0
- data/examples/rails_server/script/runner +3 -0
- data/examples/rails_server/script/server +3 -0
- data/examples/rails_server/test/functional/login_controller_test.rb +18 -0
- data/examples/rails_server/test/functional/server_controller_test.rb +18 -0
- data/examples/rails_server/test/test_helper.rb +28 -0
- data/lib/hmac-md5.rb +11 -0
- data/lib/hmac-rmd160.rb +11 -0
- data/lib/hmac-sha1.rb +11 -0
- data/lib/hmac-sha2.rb +25 -0
- data/lib/hmac.rb +112 -0
- data/lib/openid/association.rb +109 -0
- data/lib/openid/consumer.rb +928 -0
- data/lib/openid/dh.rb +48 -0
- data/lib/openid/discovery.rb +89 -0
- data/lib/openid/fetchers.rb +119 -0
- data/lib/openid/filestore.rb +315 -0
- data/lib/openid/htmltokenizer.rb +355 -0
- data/lib/openid/parse.rb +23 -0
- data/lib/openid/server.rb +951 -0
- data/lib/openid/service.rb +135 -0
- data/lib/openid/stores.rb +178 -0
- data/lib/openid/trustroot.rb +100 -0
- data/lib/openid/util.rb +273 -0
- data/test/assoc.rb +38 -0
- data/test/consumer.rb +384 -0
- data/test/dh.rb +20 -0
- data/test/extensions.rb +30 -0
- data/test/linkparse.rb +305 -0
- data/test/runtests.rb +11 -0
- data/test/server2.rb +1053 -0
- data/test/storetestcase.rb +172 -0
- data/test/teststore.rb +23 -0
- data/test/trustroot.rb +113 -0
- data/test/util.rb +56 -0
- metadata +218 -0
@@ -0,0 +1,172 @@
|
|
1
|
+
require 'openid/util'
|
2
|
+
require 'openid/association'
|
3
|
+
|
4
|
+
module StoreTestCase
|
5
|
+
|
6
|
+
@@allowed_handle = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~'
|
7
|
+
@@allowed_nonce = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
8
|
+
|
9
|
+
def _gen_nonce
|
10
|
+
OpenID::Util.random_string(8, @@allowed_nonce)
|
11
|
+
end
|
12
|
+
|
13
|
+
def _gen_handle(n)
|
14
|
+
OpenID::Util.random_string(n, @@allowed_handle)
|
15
|
+
end
|
16
|
+
|
17
|
+
def _gen_secret(n, chars=nil)
|
18
|
+
OpenID::Util.random_string(n, chars)
|
19
|
+
end
|
20
|
+
|
21
|
+
def _gen_assoc(issued, lifetime=600)
|
22
|
+
secret = _gen_secret(20)
|
23
|
+
handle = _gen_handle(128)
|
24
|
+
OpenID::Association.new(handle, secret, Time.now.to_i + issued, lifetime,
|
25
|
+
'HMAC-SHA1')
|
26
|
+
end
|
27
|
+
|
28
|
+
def _check_retrieve(url, handle=nil, expected=nil)
|
29
|
+
ret_assoc = @store.get_association(url, handle)
|
30
|
+
|
31
|
+
if expected.nil? or @store.dumb?
|
32
|
+
assert_nil(ret_assoc)
|
33
|
+
else
|
34
|
+
assert_equal(ret_assoc, expected)
|
35
|
+
assert_equal(ret_assoc.handle, expected.handle)
|
36
|
+
assert_equal(ret_assoc.secret, expected.secret)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def _check_remove(url, handle, expected)
|
41
|
+
present = @store.remove_association(url, handle)
|
42
|
+
expected_present = ((not @store.dumb?) and expected)
|
43
|
+
assert ((not expected_present and not present) or \
|
44
|
+
(expected_present and present))
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_store
|
48
|
+
server_url = "http://www.myopenid.com/openid"
|
49
|
+
assoc = _gen_assoc(issued=0)
|
50
|
+
|
51
|
+
# Make sure that a missing association returns no result
|
52
|
+
_check_retrieve(server_url)
|
53
|
+
|
54
|
+
# Check that after storage, getting returns the same result
|
55
|
+
@store.store_association(server_url, assoc)
|
56
|
+
_check_retrieve(server_url, nil, assoc)
|
57
|
+
|
58
|
+
# more than once
|
59
|
+
_check_retrieve(server_url, nil, assoc)
|
60
|
+
|
61
|
+
# Storing more than once has no ill effect
|
62
|
+
@store.store_association(server_url, assoc)
|
63
|
+
_check_retrieve(server_url, nil, assoc)
|
64
|
+
|
65
|
+
# Removing an association that does not exist returns not present
|
66
|
+
_check_remove(server_url, assoc.handle + 'x', false)
|
67
|
+
|
68
|
+
# Removing an association that does not exist returns not present
|
69
|
+
_check_remove(server_url + 'x', assoc.handle, false)
|
70
|
+
|
71
|
+
# Removing an association that is present returns present
|
72
|
+
_check_remove(server_url, assoc.handle, true)
|
73
|
+
|
74
|
+
# but not present on subsequent calls
|
75
|
+
_check_remove(server_url, assoc.handle, false)
|
76
|
+
|
77
|
+
# Put assoc back in the store
|
78
|
+
@store.store_association(server_url, assoc)
|
79
|
+
|
80
|
+
# More recent and expires after assoc
|
81
|
+
assoc2 = _gen_assoc(issued=1)
|
82
|
+
@store.store_association(server_url, assoc2)
|
83
|
+
|
84
|
+
# After storing an association with a different handle, but the
|
85
|
+
# same server_url, the handle with the later expiration is returned.
|
86
|
+
_check_retrieve(server_url, nil, assoc2)
|
87
|
+
|
88
|
+
# We can still retrieve the older association
|
89
|
+
_check_retrieve(server_url, assoc.handle, assoc)
|
90
|
+
|
91
|
+
# Plus we can retrieve the association with the later expiration
|
92
|
+
# explicitly
|
93
|
+
_check_retrieve(server_url, assoc2.handle, assoc2)
|
94
|
+
|
95
|
+
# More recent, and expires earlier than assoc2 or assoc. Make sure
|
96
|
+
# that we're picking the one with the latest issued date and not
|
97
|
+
# taking into account the expiration.
|
98
|
+
assoc3 = _gen_assoc(issued=2, lifetime=100)
|
99
|
+
@store.store_association(server_url, assoc3)
|
100
|
+
|
101
|
+
_check_retrieve(server_url, nil, assoc3)
|
102
|
+
_check_retrieve(server_url, assoc.handle, assoc)
|
103
|
+
_check_retrieve(server_url, assoc2.handle, assoc2)
|
104
|
+
_check_retrieve(server_url, assoc3.handle, assoc3)
|
105
|
+
|
106
|
+
_check_remove(server_url, assoc2.handle, true)
|
107
|
+
|
108
|
+
_check_retrieve(server_url, nil, assoc3)
|
109
|
+
_check_retrieve(server_url, assoc.handle, assoc)
|
110
|
+
_check_retrieve(server_url, assoc2.handle, nil)
|
111
|
+
_check_retrieve(server_url, assoc3.handle, assoc3)
|
112
|
+
|
113
|
+
_check_remove(server_url, assoc2.handle, false)
|
114
|
+
_check_remove(server_url, assoc3.handle, true)
|
115
|
+
|
116
|
+
_check_retrieve(server_url, nil, assoc)
|
117
|
+
_check_retrieve(server_url, assoc.handle, assoc)
|
118
|
+
_check_retrieve(server_url, assoc2.handle, nil)
|
119
|
+
_check_retrieve(server_url, assoc3.handle, nil)
|
120
|
+
|
121
|
+
_check_remove(server_url, assoc2.handle, false)
|
122
|
+
_check_remove(server_url, assoc.handle, true)
|
123
|
+
_check_remove(server_url, assoc3.handle, false)
|
124
|
+
|
125
|
+
_check_retrieve(server_url, nil, nil)
|
126
|
+
_check_retrieve(server_url, assoc.handle, nil)
|
127
|
+
_check_retrieve(server_url, assoc2.handle, nil)
|
128
|
+
_check_retrieve(server_url, assoc3.handle, nil)
|
129
|
+
|
130
|
+
_check_remove(server_url, assoc2.handle, false)
|
131
|
+
_check_remove(server_url, assoc.handle, false)
|
132
|
+
_check_remove(server_url, assoc3.handle, false)
|
133
|
+
end
|
134
|
+
|
135
|
+
def test_nonce
|
136
|
+
nonce1 = _gen_nonce
|
137
|
+
|
138
|
+
assert_not_nil(nonce1)
|
139
|
+
|
140
|
+
# a nonce is present by default
|
141
|
+
present = @store.use_nonce(nonce1)
|
142
|
+
assert_equal(present, false)
|
143
|
+
|
144
|
+
# Storing once causes use_nonce to return true the first, and only
|
145
|
+
# the first, time it is called after the store.
|
146
|
+
@store.store_nonce(nonce1)
|
147
|
+
present = @store.use_nonce(nonce1)
|
148
|
+
assert present
|
149
|
+
present = @store.use_nonce(nonce1)
|
150
|
+
assert_equal(present, false)
|
151
|
+
|
152
|
+
# Storing twice has the same effect as storing once.
|
153
|
+
@store.store_nonce(nonce1)
|
154
|
+
@store.store_nonce(nonce1)
|
155
|
+
present = @store.use_nonce(nonce1)
|
156
|
+
assert present
|
157
|
+
present = @store.use_nonce(nonce1)
|
158
|
+
assert_equal(present, false)
|
159
|
+
|
160
|
+
### Auth key stuff
|
161
|
+
|
162
|
+
# there is no key to start with, so generate a new key and return it
|
163
|
+
key = @store.get_auth_key
|
164
|
+
|
165
|
+
# the second time we should return the same key as before
|
166
|
+
key2 = @store.get_auth_key
|
167
|
+
assert key == key2
|
168
|
+
end
|
169
|
+
|
170
|
+
end
|
171
|
+
|
172
|
+
|
data/test/teststore.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'fileutils'
|
3
|
+
require 'pathname'
|
4
|
+
require 'tmpdir'
|
5
|
+
|
6
|
+
require 'openid/filestore'
|
7
|
+
require 'storetestcase'
|
8
|
+
|
9
|
+
class FileStoreTestCase < Test::Unit::TestCase
|
10
|
+
include StoreTestCase
|
11
|
+
|
12
|
+
@@dir = Pathname.new(Dir.tmpdir).join('filstoretest')
|
13
|
+
|
14
|
+
def setup
|
15
|
+
FileUtils.rm_rf(@@dir)
|
16
|
+
@store = OpenID::FilesystemStore.new(@@dir)
|
17
|
+
end
|
18
|
+
|
19
|
+
def teardown
|
20
|
+
FileUtils.rm_rf(@@dir)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
data/test/trustroot.rb
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'openid/trustroot'
|
3
|
+
|
4
|
+
class TrustRootTestCase < Test::Unit::TestCase
|
5
|
+
|
6
|
+
def test_parse_bad
|
7
|
+
|
8
|
+
def assert_bad(s)
|
9
|
+
tr = OpenID::TrustRoot.parse(s)
|
10
|
+
assert_nil(tr)
|
11
|
+
end
|
12
|
+
|
13
|
+
assert_bad('baz.org')
|
14
|
+
assert_bad('*.foo.com')
|
15
|
+
assert_bad('http://*.schtuff.*/')
|
16
|
+
assert_bad('ftp://foo.com')
|
17
|
+
assert_bad('ftp://*.foo.com')
|
18
|
+
assert_bad('http://*.foo.com:80:90/')
|
19
|
+
assert_bad('foo.*.com')
|
20
|
+
assert_bad('http://foo.*.com')
|
21
|
+
assert_bad('http://www.*')
|
22
|
+
assert_bad('')
|
23
|
+
assert_bad(' ')
|
24
|
+
assert_bad(' \t\n ')
|
25
|
+
assert_bad(nil)
|
26
|
+
assert_bad(5)
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_parse_good
|
30
|
+
|
31
|
+
def assert_good(s)
|
32
|
+
tr = OpenID::TrustRoot.parse(s)
|
33
|
+
assert_not_nil(tr)
|
34
|
+
end
|
35
|
+
|
36
|
+
assert_good('http://*/')
|
37
|
+
assert_good('https://*/')
|
38
|
+
assert_good('http://*.schtuff.com/')
|
39
|
+
assert_good('http://*.schtuff.com')
|
40
|
+
assert_good('http://www.schtuff.com/')
|
41
|
+
assert_good('http://www.schtuff.com')
|
42
|
+
assert_good('http://*.this.that.schtuff.com/')
|
43
|
+
assert_good('http://*.com/')
|
44
|
+
assert_good('http://*.com')
|
45
|
+
assert_good('http://*.foo.com/path')
|
46
|
+
assert_good('http://x.foo.com/path?action=foo2')
|
47
|
+
assert_good('http://*.foo.com/path?action=foo2')
|
48
|
+
assert_good('http://localhost:8081/')
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_sane
|
52
|
+
|
53
|
+
def assert_sane(s, expected)
|
54
|
+
tr = OpenID::TrustRoot.parse(s)
|
55
|
+
assert_not_nil(tr)
|
56
|
+
assert_equal(tr.sane?, expected)
|
57
|
+
end
|
58
|
+
|
59
|
+
assert_sane('http://*/', false)
|
60
|
+
assert_sane('https://*/', false)
|
61
|
+
assert_sane('http://*.schtuff.com/', true)
|
62
|
+
assert_sane('http://*.foo.schtuff.com/', true)
|
63
|
+
assert_sane('http://*.com/', false)
|
64
|
+
assert_sane('http://*.com.au/', false)
|
65
|
+
assert_sane('http://*.co.uk/', false)
|
66
|
+
assert_sane('http://localhost:8082/?action=openid', true)
|
67
|
+
assert_sane('http://*.foo.notatld', false)
|
68
|
+
assert_sane('http://*.museum/', false)
|
69
|
+
end
|
70
|
+
|
71
|
+
def test_validate
|
72
|
+
|
73
|
+
def assert_valid(s, url, expected)
|
74
|
+
tr = OpenID::TrustRoot.parse(s)
|
75
|
+
assert_not_nil(tr)
|
76
|
+
assert_equal(tr.sane?, true)
|
77
|
+
assert_equal(tr.validate_url(url), expected)
|
78
|
+
end
|
79
|
+
|
80
|
+
assert_valid('http://*.foo.com', 'http://b.foo.com', true)
|
81
|
+
assert_valid('http://*.foo.com', 'http://b.foo.com/', true)
|
82
|
+
assert_valid('http://*.foo.com', 'http://b.foo.com/', true)
|
83
|
+
assert_valid('http://*.foo.com', 'http://b.foo.com', true)
|
84
|
+
assert_valid('http://*.b.foo.com', 'http://b.foo.com', true)
|
85
|
+
assert_valid('http://*.b.foo.com', 'http://x.b.foo.com', true)
|
86
|
+
assert_valid('http://*.bar.co.uk', 'http://www.bar.co.uk', true)
|
87
|
+
assert_valid('http://*.uoregon.edu', 'http://x.cs.uoregon.edu', true)
|
88
|
+
|
89
|
+
assert_valid('http://*.cs.uoregon.edu', 'http://x.uoregon.edu', false)
|
90
|
+
assert_valid('http://*.foo.com', 'http://bar.com', false)
|
91
|
+
assert_valid('http://*.foo.com', 'http://www.bar.com', false)
|
92
|
+
assert_valid('http://*.bar.co.uk', 'http://xxx.co.uk', false)
|
93
|
+
|
94
|
+
# path validity
|
95
|
+
assert_valid('http://x.com/abc', 'http://x.com/', false)
|
96
|
+
assert_valid('http://x.com/abc', 'http://x.com/a', false)
|
97
|
+
assert_valid('http://*.x.com/abc', 'http://foo.x.com/abc', true)
|
98
|
+
assert_valid('http://*.x.com/abc', 'http://foo.x.com', false)
|
99
|
+
assert_valid('http://*.x.com', 'http://foo.x.com/gallery', true)
|
100
|
+
assert_valid('http://foo.x.com', 'http://foo.x.com/gallery', true)
|
101
|
+
assert_valid('http://foo.x.com/gallery', 'http://foo.x.com/gallery/xxx', true)
|
102
|
+
assert_valid('http://localhost:8081/x?action=openid',
|
103
|
+
'http://localhost:8081/x?action=openid', true)
|
104
|
+
assert_valid('http://*.x.com/gallery', 'http://foo.x.com/gallery', true)
|
105
|
+
|
106
|
+
assert_valid('http://localhost:8082/?action=openid',
|
107
|
+
'http://localhost:8082/?action=openid', true)
|
108
|
+
assert_valid('http://goathack.livejournal.org:8020/',
|
109
|
+
'http://goathack.livejournal.org:8020/openid/login.bml', true)
|
110
|
+
|
111
|
+
end
|
112
|
+
|
113
|
+
end
|
data/test/util.rb
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
|
3
|
+
require "openid/util"
|
4
|
+
|
5
|
+
class UtilTestCase < Test::Unit::TestCase
|
6
|
+
|
7
|
+
def test_rand
|
8
|
+
max = 155172898181473697471232257763715539915724801966915404479707795314057629378541917580651227423698188993727816152646631438561595825688188889951272158842675419950341258706556549803580104870537681476726513255747040765857479291291572334510643245094715007229621094194349783925984760375594985848253359305585439638443
|
9
|
+
r = OpenID::Util.rand(max)
|
10
|
+
assert(r < max)
|
11
|
+
assert(r >= 0)
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_kvform
|
15
|
+
kv = {
|
16
|
+
"foo" => "bar",
|
17
|
+
"baz" => "hat:pants"
|
18
|
+
}
|
19
|
+
|
20
|
+
parsed = OpenID::Util.kvform(kv)
|
21
|
+
unparsed = OpenID::Util.parsekv(parsed)
|
22
|
+
assert(kv == unparsed)
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_packing
|
26
|
+
cases = [1,2,4305783490578, 457092437545247574732543905702435734958]
|
27
|
+
cases.each { |c| assert(c == OpenID::Util.str_to_num(OpenID::Util.num_to_str(c))) }
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_base64
|
31
|
+
cases = [
|
32
|
+
"",
|
33
|
+
"\000",
|
34
|
+
"\001",
|
35
|
+
"\000" * 100,
|
36
|
+
OpenID::Util.random_string(100),
|
37
|
+
]
|
38
|
+
|
39
|
+
cases.each do |c|
|
40
|
+
encoded = OpenID::Util.to_base64(c)
|
41
|
+
decoded = OpenID::Util.from_base64(encoded)
|
42
|
+
assert(c == decoded)
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_shortcuts
|
48
|
+
max = 155172898181473697471232257763715539915724801966915404479707795314057629378541917580651227423698188993727816152646631438561595825688188889951272158842675419950341258706556549803580104870537681476726513255747040765857479291291572334510643245094715007229621094194349783925984760375594985848253359305585439638443
|
49
|
+
x = 5646357865294356435623409524357247359023479579052473
|
50
|
+
assert_equal(x, OpenID::Util.base64_to_num(OpenID::Util.num_to_base64(x)))
|
51
|
+
assert_equal(max, OpenID::Util.base64_to_num(OpenID::Util.num_to_base64(max)))
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
|
metadata
ADDED
@@ -0,0 +1,218 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
rubygems_version: 0.8.11
|
3
|
+
specification_version: 1
|
4
|
+
name: ruby-openid
|
5
|
+
version: !ruby/object:Gem::Version
|
6
|
+
version: "1.0"
|
7
|
+
date: 2006-05-10 00:00:00 -07:00
|
8
|
+
summary: A library for consuming and serving OpenID identities.
|
9
|
+
require_paths:
|
10
|
+
- lib
|
11
|
+
email: brian@janrian.com
|
12
|
+
homepage: http://www.openidenabled.com/openid/libraries/ruby
|
13
|
+
rubyforge_project:
|
14
|
+
description:
|
15
|
+
autorequire:
|
16
|
+
default_executable:
|
17
|
+
bindir: bin
|
18
|
+
has_rdoc: true
|
19
|
+
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.0.0
|
24
|
+
version:
|
25
|
+
platform: ruby
|
26
|
+
signing_key:
|
27
|
+
cert_chain:
|
28
|
+
authors:
|
29
|
+
- Brian Ellin (JanRain, Inc)
|
30
|
+
files:
|
31
|
+
- examples/rails_server
|
32
|
+
- examples/consumer.rb
|
33
|
+
- examples/README
|
34
|
+
- examples/cacert.pem
|
35
|
+
- examples/rails_openid_login_generator
|
36
|
+
- examples/rails_active_record_store
|
37
|
+
- examples/openid-store
|
38
|
+
- examples/rails_server/app
|
39
|
+
- examples/rails_server/config
|
40
|
+
- examples/rails_server/components
|
41
|
+
- examples/rails_server/db
|
42
|
+
- examples/rails_server/doc
|
43
|
+
- examples/rails_server/lib
|
44
|
+
- examples/rails_server/log
|
45
|
+
- examples/rails_server/public
|
46
|
+
- examples/rails_server/script
|
47
|
+
- examples/rails_server/test
|
48
|
+
- examples/rails_server/vendor
|
49
|
+
- examples/rails_server/Rakefile
|
50
|
+
- examples/rails_server/README
|
51
|
+
- examples/rails_server/app/controllers
|
52
|
+
- examples/rails_server/app/helpers
|
53
|
+
- examples/rails_server/app/models
|
54
|
+
- examples/rails_server/app/views
|
55
|
+
- examples/rails_server/app/controllers/application.rb
|
56
|
+
- examples/rails_server/app/controllers/login_controller.rb
|
57
|
+
- examples/rails_server/app/controllers/server_controller.rb
|
58
|
+
- examples/rails_server/app/helpers/application_helper.rb
|
59
|
+
- examples/rails_server/app/helpers/login_helper.rb
|
60
|
+
- examples/rails_server/app/helpers/server_helper.rb
|
61
|
+
- examples/rails_server/app/views/layouts
|
62
|
+
- examples/rails_server/app/views/login
|
63
|
+
- examples/rails_server/app/views/server
|
64
|
+
- examples/rails_server/app/views/layouts/server.rhtml
|
65
|
+
- examples/rails_server/app/views/login/index.rhtml
|
66
|
+
- examples/rails_server/app/views/server/decide.rhtml
|
67
|
+
- examples/rails_server/config/environments
|
68
|
+
- examples/rails_server/config/database.yml
|
69
|
+
- examples/rails_server/config/routes.rb
|
70
|
+
- examples/rails_server/config/boot.rb
|
71
|
+
- examples/rails_server/config/environment.rb
|
72
|
+
- examples/rails_server/config/environments/production.rb
|
73
|
+
- examples/rails_server/config/environments/development.rb
|
74
|
+
- examples/rails_server/config/environments/test.rb
|
75
|
+
- examples/rails_server/db/openid-server
|
76
|
+
- examples/rails_server/db/openid-store
|
77
|
+
- examples/rails_server/db/openid-server/nonces
|
78
|
+
- examples/rails_server/db/openid-server/associations
|
79
|
+
- examples/rails_server/db/openid-server/temp
|
80
|
+
- examples/rails_server/db/openid-store/nonces
|
81
|
+
- examples/rails_server/db/openid-store/associations
|
82
|
+
- examples/rails_server/db/openid-store/temp
|
83
|
+
- examples/rails_server/db/openid-store/associations/http-localhost_2F_7Cnormal-YU.tkND1J4fEZhnuAoT5Zc0yCA0
|
84
|
+
- examples/rails_server/doc/README_FOR_APP
|
85
|
+
- examples/rails_server/lib/tasks
|
86
|
+
- examples/rails_server/log/server.log
|
87
|
+
- examples/rails_server/log/production.log
|
88
|
+
- examples/rails_server/log/development.log
|
89
|
+
- examples/rails_server/log/test.log
|
90
|
+
- examples/rails_server/public/images
|
91
|
+
- examples/rails_server/public/javascripts
|
92
|
+
- examples/rails_server/public/stylesheets
|
93
|
+
- examples/rails_server/public/dispatch.rb
|
94
|
+
- examples/rails_server/public/dispatch.cgi
|
95
|
+
- examples/rails_server/public/dispatch.fcgi
|
96
|
+
- examples/rails_server/public/404.html
|
97
|
+
- examples/rails_server/public/500.html
|
98
|
+
- examples/rails_server/public/favicon.ico
|
99
|
+
- examples/rails_server/public/robots.txt
|
100
|
+
- examples/rails_server/public/images/rails.png
|
101
|
+
- examples/rails_server/public/javascripts/prototype.js
|
102
|
+
- examples/rails_server/public/javascripts/effects.js
|
103
|
+
- examples/rails_server/public/javascripts/dragdrop.js
|
104
|
+
- examples/rails_server/public/javascripts/controls.js
|
105
|
+
- examples/rails_server/script/performance
|
106
|
+
- examples/rails_server/script/process
|
107
|
+
- examples/rails_server/script/about
|
108
|
+
- examples/rails_server/script/breakpointer
|
109
|
+
- examples/rails_server/script/console
|
110
|
+
- examples/rails_server/script/destroy
|
111
|
+
- examples/rails_server/script/generate
|
112
|
+
- examples/rails_server/script/runner
|
113
|
+
- examples/rails_server/script/server
|
114
|
+
- examples/rails_server/script/plugin
|
115
|
+
- examples/rails_server/script/performance/benchmarker
|
116
|
+
- examples/rails_server/script/performance/profiler
|
117
|
+
- examples/rails_server/script/process/reaper
|
118
|
+
- examples/rails_server/script/process/spawner
|
119
|
+
- examples/rails_server/script/process/spinner
|
120
|
+
- examples/rails_server/test/fixtures
|
121
|
+
- examples/rails_server/test/functional
|
122
|
+
- examples/rails_server/test/mocks
|
123
|
+
- examples/rails_server/test/unit
|
124
|
+
- examples/rails_server/test/test_helper.rb
|
125
|
+
- examples/rails_server/test/functional/login_controller_test.rb
|
126
|
+
- examples/rails_server/test/functional/server_controller_test.rb
|
127
|
+
- examples/rails_server/test/mocks/development
|
128
|
+
- examples/rails_server/test/mocks/test
|
129
|
+
- examples/rails_openid_login_generator/templates
|
130
|
+
- examples/rails_openid_login_generator/USAGE
|
131
|
+
- examples/rails_openid_login_generator/openid_login_generator.rb
|
132
|
+
- examples/rails_openid_login_generator/templates/controller_test.rb
|
133
|
+
- examples/rails_openid_login_generator/templates/view_login.rhtml
|
134
|
+
- examples/rails_openid_login_generator/templates/controller.rb
|
135
|
+
- examples/rails_openid_login_generator/templates/README
|
136
|
+
- examples/rails_openid_login_generator/templates/helper.rb
|
137
|
+
- examples/rails_openid_login_generator/templates/user.rb
|
138
|
+
- examples/rails_openid_login_generator/templates/view_logout.rhtml
|
139
|
+
- examples/rails_openid_login_generator/templates/view_welcome.rhtml
|
140
|
+
- examples/rails_openid_login_generator/templates/user_test.rb
|
141
|
+
- examples/rails_openid_login_generator/templates/users.yml
|
142
|
+
- examples/rails_openid_login_generator/templates/openid_login_system.rb
|
143
|
+
- examples/rails_active_record_store/models
|
144
|
+
- examples/rails_active_record_store/README
|
145
|
+
- examples/rails_active_record_store/XX_add_openidstore.rb
|
146
|
+
- examples/rails_active_record_store/openid_helper.rb
|
147
|
+
- examples/rails_active_record_store/openidstore_test.rb
|
148
|
+
- examples/rails_active_record_store/schema.postgresql.sql
|
149
|
+
- examples/rails_active_record_store/schema.mysql.sql
|
150
|
+
- examples/rails_active_record_store/schema.sqlite.sql
|
151
|
+
- examples/rails_active_record_store/models/openid_association.rb
|
152
|
+
- examples/rails_active_record_store/models/openid_nonce.rb
|
153
|
+
- examples/rails_active_record_store/models/openid_setting.rb
|
154
|
+
- examples/openid-store/nonces
|
155
|
+
- examples/openid-store/associations
|
156
|
+
- examples/openid-store/temp
|
157
|
+
- examples/openid-store/auth_key
|
158
|
+
- examples/openid-store/associations/http-localhost_3A3000_2Fserver-EMQbAy3NnHVzA.s0u5KAcplKGzo
|
159
|
+
- lib/openid
|
160
|
+
- lib/hmac-sha2.rb
|
161
|
+
- lib/hmac.rb
|
162
|
+
- lib/hmac-sha1.rb
|
163
|
+
- lib/hmac-rmd160.rb
|
164
|
+
- lib/hmac-md5.rb
|
165
|
+
- lib/openid/consumer.rb
|
166
|
+
- lib/openid/dh.rb
|
167
|
+
- lib/openid/fetchers.rb
|
168
|
+
- lib/openid/filestore.rb
|
169
|
+
- lib/openid/parse.rb
|
170
|
+
- lib/openid/stores.rb
|
171
|
+
- lib/openid/util.rb
|
172
|
+
- lib/openid/server.rb
|
173
|
+
- lib/openid/association.rb
|
174
|
+
- lib/openid/trustroot.rb
|
175
|
+
- lib/openid/discovery.rb
|
176
|
+
- lib/openid/htmltokenizer.rb
|
177
|
+
- lib/openid/service.rb
|
178
|
+
- test/storetestcase.rb
|
179
|
+
- test/linkparse.rb
|
180
|
+
- test/assoc.rb
|
181
|
+
- test/dh.rb
|
182
|
+
- test/teststore.rb
|
183
|
+
- test/util.rb
|
184
|
+
- test/trustroot.rb
|
185
|
+
- test/extensions.rb
|
186
|
+
- test/consumer.rb
|
187
|
+
- test/runtests.rb
|
188
|
+
- test/server2.rb
|
189
|
+
- README
|
190
|
+
- INSTALL
|
191
|
+
- COPYING
|
192
|
+
- TODO
|
193
|
+
test_files:
|
194
|
+
- test/runtests.rb
|
195
|
+
rdoc_options:
|
196
|
+
- --main
|
197
|
+
- README
|
198
|
+
extra_rdoc_files:
|
199
|
+
- README
|
200
|
+
- INSTALL
|
201
|
+
- COPYING
|
202
|
+
- TODO
|
203
|
+
executables: []
|
204
|
+
|
205
|
+
extensions: []
|
206
|
+
|
207
|
+
requirements: []
|
208
|
+
|
209
|
+
dependencies:
|
210
|
+
- !ruby/object:Gem::Dependency
|
211
|
+
name: ruby-yadis
|
212
|
+
version_requirement:
|
213
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
214
|
+
requirements:
|
215
|
+
- - ">="
|
216
|
+
- !ruby/object:Gem::Version
|
217
|
+
version: "0.3"
|
218
|
+
version:
|