pelle-ruby-openid 2.1.8 → 2.1.9

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile ADDED
@@ -0,0 +1,57 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = 'pelle-ruby-openid'
8
+ gem.author = 'JanRain, Inc'
9
+ gem.email = 'openid@janrain.com'
10
+ gem.homepage = 'http://openidenabled.com/ruby-openid/'
11
+ gem.summary = 'A library for consuming and serving OpenID identities.'
12
+ gem.extra_rdoc_files = ["LICENSE", "README", "INSTALL","UPGRADE","CHANGELOG", "CHANGES-2.1.0", "UPGRADE"]
13
+ gem.files.exclude "admin","_darcs","coverage",".gitignore","gemspec"
14
+ end
15
+ rescue LoadError
16
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
17
+ end
18
+
19
+ require 'rake/testtask'
20
+ Rake::TestTask.new(:test) do |test|
21
+ test.libs << 'lib' << 'test'
22
+ test.ruby_opts = ['-rtestutil']
23
+ test.pattern = 'test/**/test_*.rb'
24
+ test.verbose = true
25
+ end
26
+
27
+ begin
28
+ require 'rcov/rcovtask'
29
+ Rcov::RcovTask.new do |test|
30
+ test.libs << 'test'
31
+ test.ruby_opts = ['-rtestutil']
32
+ test.pattern = 'test/**/test_*.rb'
33
+ test.verbose = true
34
+ end
35
+ rescue LoadError
36
+ task :rcov do
37
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
38
+ end
39
+ end
40
+
41
+ task :test => :check_dependencies
42
+
43
+ task :default => :test
44
+
45
+ require 'rake/rdoctask'
46
+ Rake::RDocTask.new do |rdoc|
47
+ if File.exist?('VERSION')
48
+ version = File.read('VERSION')
49
+ else
50
+ version = ""
51
+ end
52
+
53
+ rdoc.rdoc_dir = 'rdoc'
54
+ rdoc.title = "ruby-openid #{version}"
55
+ rdoc.rdoc_files.include('README*')
56
+ rdoc.rdoc_files.include('lib/**/*.rb')
57
+ end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.1.8
1
+ 2.1.9
data/init.rb ADDED
@@ -0,0 +1 @@
1
+ require 'openid'
@@ -52,7 +52,7 @@ module OpenID
52
52
  # A OAuth request token response, sent from a provider
53
53
  # to a relying party
54
54
  class Response < Extension
55
- attr_accessor :request_token, :scope
55
+ attr_accessor :request_token, :scope, :ns_uri
56
56
  def initialize(request_token=nil, scope=nil)
57
57
  @ns_alias = 'oauth'
58
58
  @ns_uri = NS_URI
data/test/test_ui.rb ADDED
@@ -0,0 +1,175 @@
1
+ require 'openid/extensions/oauth'
2
+ require 'openid/message'
3
+ require 'openid/server'
4
+ require 'openid/consumer/responses'
5
+ require 'openid/consumer/discovery'
6
+
7
+ module OpenID
8
+ module OAuthTest
9
+ class OAuthRequestTestCase < Test::Unit::TestCase
10
+ def setup
11
+ @req = OAuth::Request.new
12
+ end
13
+
14
+ def test_construct
15
+ assert_nil(@req.consumer)
16
+ assert_nil(@req.scope)
17
+ assert_equal('oauth', @req.ns_alias)
18
+
19
+ req2 = OAuth::Request.new("CONSUMER","http://sample.com/some_scope")
20
+ assert_equal("CONSUMER",req2.consumer)
21
+ assert_equal("http://sample.com/some_scope",req2.scope)
22
+ end
23
+
24
+ def test_add_consumer
25
+ @req.consumer="CONSUMER"
26
+ assert_equal("CONSUMER",@req.consumer)
27
+ end
28
+
29
+ def test_add_scope
30
+ @req.scope="http://sample.com/some_scope"
31
+ assert_equal("http://sample.com/some_scope",@req.scope)
32
+ end
33
+
34
+ def test_get_extension_args
35
+ assert_equal({}, @req.get_extension_args)
36
+ @req.consumer="CONSUMER"
37
+ assert_equal({'consumer' => 'CONSUMER'}, @req.get_extension_args)
38
+ @req.scope="http://sample.com/some_scope"
39
+ assert_equal({'consumer' => 'CONSUMER', 'scope' => 'http://sample.com/some_scope'}, @req.get_extension_args)
40
+ end
41
+
42
+ def test_parse_extension_args
43
+ args = {'consumer' => 'CONSUMER', 'scope' => 'http://sample.com/some_scope'}
44
+ @req.parse_extension_args(args)
45
+ assert_equal("CONSUMER",@req.consumer)
46
+ assert_equal("http://sample.com/some_scope",@req.scope)
47
+ end
48
+
49
+ def test_parse_extension_args_empty
50
+ @req.parse_extension_args({})
51
+ assert_nil( @req.consumer )
52
+ assert_nil( @req.scope )
53
+ end
54
+
55
+ def test_from_openid_request
56
+ openid_req_msg = Message.from_openid_args({
57
+ 'mode' => 'checkid_setup',
58
+ 'ns' => OPENID2_NS,
59
+ 'ns.oauth' => OAuth::NS_URI,
60
+ 'oauth.consumer' => 'CONSUMER',
61
+ 'oauth.scope' => "http://sample.com/some_scope"
62
+ })
63
+ oid_req = Server::OpenIDRequest.new
64
+ oid_req.message = openid_req_msg
65
+ req = OAuth::Request.from_openid_request(oid_req)
66
+ assert_equal("CONSUMER",req.consumer)
67
+ assert_equal("http://sample.com/some_scope",req.scope)
68
+ end
69
+
70
+ def test_from_openid_request_no_oauth
71
+ message = Message.new
72
+ openid_req = Server::OpenIDRequest.new
73
+ openid_req.message = message
74
+ oauth_req = OAuth::Request.from_openid_request(openid_req)
75
+ assert(oauth_req.nil?)
76
+ end
77
+
78
+ end
79
+
80
+ class DummySuccessResponse
81
+ attr_accessor :message
82
+
83
+ def initialize(message, signed_stuff)
84
+ @message = message
85
+ @signed_stuff = signed_stuff
86
+ end
87
+
88
+ def get_signed_ns(ns_uri)
89
+ return @signed_stuff
90
+ end
91
+
92
+ end
93
+
94
+ class OAuthResponseTestCase < Test::Unit::TestCase
95
+ def setup
96
+ @req = OAuth::Response.new
97
+ end
98
+
99
+ def test_construct
100
+ assert_nil(@req.request_token)
101
+ assert_nil(@req.scope)
102
+
103
+ req2 = OAuth::Response.new("REQUESTTOKEN","http://sample.com/some_scope")
104
+ assert_equal("REQUESTTOKEN",req2.request_token)
105
+ assert_equal("http://sample.com/some_scope",req2.scope)
106
+ end
107
+
108
+ def test_add_request_token
109
+ @req.request_token="REQUESTTOKEN"
110
+ assert_equal("REQUESTTOKEN",@req.request_token)
111
+ end
112
+
113
+ def test_add_scope
114
+ @req.scope="http://sample.com/some_scope"
115
+ assert_equal("http://sample.com/some_scope",@req.scope)
116
+ end
117
+
118
+ def test_get_extension_args
119
+ assert_equal({}, @req.get_extension_args)
120
+ @req.request_token="REQUESTTOKEN"
121
+ assert_equal({'request_token' => 'REQUESTTOKEN'}, @req.get_extension_args)
122
+ @req.scope="http://sample.com/some_scope"
123
+ assert_equal({'request_token' => 'REQUESTTOKEN', 'scope' => 'http://sample.com/some_scope'}, @req.get_extension_args)
124
+ end
125
+
126
+ def test_parse_extension_args
127
+ args = {'request_token' => 'REQUESTTOKEN', 'scope' => 'http://sample.com/some_scope'}
128
+ @req.parse_extension_args(args)
129
+ assert_equal("REQUESTTOKEN",@req.request_token)
130
+ assert_equal("http://sample.com/some_scope",@req.scope)
131
+ end
132
+
133
+ def test_parse_extension_args_empty
134
+ @req.parse_extension_args({})
135
+ assert_nil( @req.request_token )
136
+ assert_nil( @req.scope )
137
+ end
138
+
139
+ def test_from_success_response
140
+
141
+ openid_req_msg = Message.from_openid_args({
142
+ 'mode' => 'id_res',
143
+ 'ns' => OPENID2_NS,
144
+ 'ns.oauth' => OAuth::NS_URI,
145
+ 'ns.oauth' => OAuth::NS_URI,
146
+ 'oauth.request_token' => 'REQUESTTOKEN',
147
+ 'oauth.scope' => "http://sample.com/some_scope"
148
+ })
149
+ signed_stuff = {
150
+ 'request_token' => 'REQUESTTOKEN',
151
+ 'scope' => "http://sample.com/some_scope"
152
+ }
153
+ oid_req = DummySuccessResponse.new(openid_req_msg, signed_stuff)
154
+ req = OAuth::Response.from_success_response(oid_req)
155
+ assert_equal("REQUESTTOKEN",req.request_token)
156
+ assert_equal("http://sample.com/some_scope",req.scope)
157
+ end
158
+
159
+ def test_from_success_response_unsigned
160
+ openid_req_msg = Message.from_openid_args({
161
+ 'mode' => 'id_res',
162
+ 'ns' => OPENID2_NS,
163
+ 'ns.oauth' => OAuth::NS_URI,
164
+ 'oauth.request_token' => 'REQUESTTOKEN',
165
+ 'oauth.scope' => "http://sample.com/some_scope"
166
+ })
167
+ signed_stuff = {}
168
+ endpoint = OpenIDServiceEndpoint.new
169
+ oid_req = Consumer::SuccessResponse.new(endpoint, openid_req_msg, signed_stuff)
170
+ req = OAuth::Response.from_success_response(oid_req)
171
+ assert(req.nil?, req.inspect)
172
+ end
173
+ end
174
+ end
175
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pelle-ruby-openid
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.8
4
+ version: 2.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - JanRain, Inc
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-09-26 00:00:00 -07:00
12
+ date: 2010-02-03 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -33,6 +33,7 @@ files:
33
33
  - LICENSE
34
34
  - NOTICE
35
35
  - README
36
+ - Rakefile
36
37
  - UPGRADE
37
38
  - VERSION
38
39
  - examples/README
@@ -96,6 +97,7 @@ files:
96
97
  - examples/rails_openid/test/functional/login_controller_test.rb
97
98
  - examples/rails_openid/test/functional/server_controller_test.rb
98
99
  - examples/rails_openid/test/test_helper.rb
100
+ - init.rb
99
101
  - lib/hmac/hmac.rb
100
102
  - lib/hmac/sha1.rb
101
103
  - lib/hmac/sha2.rb
@@ -223,9 +225,10 @@ files:
223
225
  - test/test_yadis_discovery.rb
224
226
  - test/testutil.rb
225
227
  - test/util.rb
226
- has_rdoc: false
228
+ has_rdoc: true
227
229
  homepage: http://openidenabled.com/ruby-openid/
228
- licenses:
230
+ licenses: []
231
+
229
232
  post_install_message:
230
233
  rdoc_options:
231
234
  - --charset=UTF-8
@@ -281,6 +284,7 @@ test_files:
281
284
  - test/test_sreg.rb
282
285
  - test/test_stores.rb
283
286
  - test/test_trustroot.rb
287
+ - test/test_ui.rb
284
288
  - test/test_urinorm.rb
285
289
  - test/test_util.rb
286
290
  - test/test_xrds.rb