ruby-openid 2.3.0 → 2.4.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.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 960a9b7585a6a770e6f7e99dd3ed8f64af0fb325
4
- data.tar.gz: d9eb9ac0de887467777f10bf2f366aff41a1ed92
3
+ metadata.gz: 9fbaf8c0eb91738a8f831057ca44c96803c50e46
4
+ data.tar.gz: b8ba0a1278cb1f452734608ea079baf63e9772ac
5
5
  SHA512:
6
- metadata.gz: c56446c19163fe6b11c54103221759fe166221d488e267c86b66195311c45d5e190447b8d76be994dc6e9d23b95d21a10a7ba534fa612ad063fcbc0bca82029b
7
- data.tar.gz: 1e84491b6d4912d92950ff161d9662cbe56b4ae67897361ef9bf0851431ca5bb21a32f0885cc439c0c755368101019226b93fd3b76148eac4afbe24c04b11715
6
+ metadata.gz: dfad5f054b6b04f6d488584b2902aac70d10636ff9ba7c53140c61f7474dc6a463f771ce8a07c2cda0ae501a0a45db745b927427625407873ed35b22b2eb4572
7
+ data.tar.gz: e4f5e210aceead1e8c7502304b4d45746daf600d0ac4ba2bd65133b446d6dcf0355d4f7a1a636289b4f5221beecf7ca5b7b8d3904862198fe895bcac197fd9e0
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.4.0
4
+
5
+ * Allow expecting a parameter to be nil during return_to verification - 708e992ab3e6c26d478283fc11faa6a0a74bfec0
6
+ * Serialize to objects that can be stored as json - db1d8f7b171a333dec4e861fe0fa53ac1d98b188
7
+ * Fixed missing XRDS HTTP header in sample provider - dc15fa07fd59fdcf46d659cce34c6ef7a6768fde
8
+
3
9
  ## 2.3.0
4
10
 
5
11
  * Deprecated Ruby 1.8 support - 0694bebc83de0313cfef73a5d0ffd9a293ae71a0
@@ -207,8 +207,7 @@ EOS
207
207
  </xrds:XRDS>
208
208
  EOS
209
209
 
210
- response.headers['content-type'] = 'application/xrds+xml'
211
- render :text => yadis
210
+ render :text => yadis, :content_type => 'application/xrds+xml'
212
211
  end
213
212
 
214
213
  def add_sreg(oidreq, oidresp)
@@ -7,6 +7,7 @@ require "openid/consumer/discovery"
7
7
  require "openid/message"
8
8
  require "openid/yadis/discovery"
9
9
  require "openid/store/nonce"
10
+ require "openid/serializer"
10
11
 
11
12
  module OpenID
12
13
  # OpenID support for Relying Parties (aka Consumers).
@@ -297,11 +298,17 @@ module OpenID
297
298
  protected
298
299
 
299
300
  def session_get(name)
300
- @session[session_key(name)]
301
+ value = @session[session_key(name)]
302
+
303
+ if value.is_a?(Array) # new serialized format
304
+ Serializer.deserialize(*value)
305
+ else # deprecated object format
306
+ value
307
+ end
301
308
  end
302
309
 
303
310
  def session_set(name, val)
304
- @session[session_key(name)] = val
311
+ @session[session_key(name)] = Serializer.serialize(val)
305
312
  end
306
313
 
307
314
  def session_key(suffix)
@@ -58,7 +58,7 @@ module OpenID
58
58
  def display_identifier
59
59
  return @display_identifier if @display_identifier
60
60
 
61
- return @claimed_id if @claimed_id.nil?
61
+ return @claimed_id if @claimed_id.nil?
62
62
 
63
63
  begin
64
64
  parsed_identifier = URI.parse(@claimed_id)
@@ -376,7 +376,7 @@ module OpenID
376
376
  #
377
377
  # @param uri: normalized identity URL
378
378
  # @type uri: str
379
- #
379
+ #
380
380
  # @return: (claimed_id, services)
381
381
  # @rtype: (str, list(OpenIDServiceEndpoint))
382
382
  #
@@ -160,7 +160,7 @@ module OpenID
160
160
  query = @message.to_post_args
161
161
  return_to_parsed_query.each_pair do |rt_key, rt_val|
162
162
  msg_val = query[rt_key]
163
- if msg_val.nil?
163
+ if msg_val.nil? && !rt_val.nil?
164
164
  raise ProtocolError, "Message missing return_to argument '#{rt_key}'"
165
165
  elsif msg_val != rt_val
166
166
  raise ProtocolError, ("Parameter '#{rt_key}' value "\
@@ -0,0 +1,21 @@
1
+ module OpenID
2
+ class Serializer
3
+ SERIALIZABLE = {
4
+ "OpenID::OpenIDServiceEndpoint" => [OpenID::OpenIDServiceEndpoint, 0],
5
+ "OpenID::Consumer::DiscoveredServices" => [OpenID::Consumer::DiscoveredServices, 3]
6
+ }
7
+
8
+ def self.serialize(instance)
9
+ klass = instance.class.name
10
+ raise "unable to serialize #{klass}" unless SERIALIZABLE[klass]
11
+ [klass, instance.instance_variables.map { |v| [v.to_s, instance.instance_variable_get(v)] }]
12
+ end
13
+
14
+ def self.deserialize(klass, data)
15
+ klass, arguments = SERIALIZABLE[klass] || raise("unable to deserialize #{klass}")
16
+ instance = klass.new(*Array.new(arguments))
17
+ data.each { |k,v| instance.instance_variable_set(k,v) }
18
+ instance
19
+ end
20
+ end
21
+ end
@@ -94,7 +94,7 @@ module OpenID
94
94
  if result.is_a? String
95
95
  return !!(result =~ /^DELETED/)
96
96
  else
97
- return result == true
97
+ return !!(result)
98
98
  end
99
99
  end
100
100
 
@@ -1,3 +1,3 @@
1
1
  module OpenID
2
- VERSION = "2.3.0"
2
+ VERSION = "2.4.0"
3
3
  end
@@ -6,14 +6,24 @@ module OpenID
6
6
  class Consumer
7
7
  module TestConsumer
8
8
  class TestLastEndpoint < Test::Unit::TestCase
9
+ def all_instance_variables(object)
10
+ object.instance_variables.map { |v| [v.to_s, object.instance_variable_get(v)] }
11
+ end
12
+
9
13
  def test_set_get
14
+ stored = OpenID::OpenIDServiceEndpoint.new
15
+ stored.server_url = "test"
10
16
  session = {}
17
+
11
18
  consumer = Consumer.new(session, nil)
12
- consumer.send(:last_requested_endpoint=, :endpoint)
19
+ consumer.send(:last_requested_endpoint=, stored)
20
+
13
21
  ep = consumer.send(:last_requested_endpoint)
14
- assert_equal(:endpoint, ep)
22
+ assert_equal(all_instance_variables(stored), all_instance_variables(ep))
23
+
15
24
  ep = consumer.send(:last_requested_endpoint)
16
- assert_equal(:endpoint, ep)
25
+ assert_equal(all_instance_variables(stored), all_instance_variables(ep))
26
+
17
27
  consumer.send(:cleanup_last_requested_endpoint)
18
28
  ep = consumer.send(:last_requested_endpoint)
19
29
  assert_equal(nil, ep)
@@ -110,7 +120,7 @@ module OpenID
110
120
  result = consumer.begin_without_discovery(@service, @anonymous)
111
121
  assert(result.instance_of?(CheckIDRequest))
112
122
  assert_equal(@anonymous, result.anonymous)
113
- assert_equal(@service, consumer.send(:last_requested_endpoint))
123
+ assert_equal(@service.claimed_id, consumer.send(:last_requested_endpoint).claimed_id)
114
124
  assert_equal(result.instance_variable_get(:@assoc), @assoc)
115
125
  return result
116
126
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-openid
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - JanRain, Inc
8
8
  autorequire: openid
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-14 00:00:00.000000000 Z
11
+ date: 2014-01-27 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: openid@janrain.com
@@ -115,6 +115,7 @@ files:
115
115
  - lib/openid/kvpost.rb
116
116
  - lib/openid/message.rb
117
117
  - lib/openid/protocolerror.rb
118
+ - lib/openid/serializer.rb
118
119
  - lib/openid/server.rb
119
120
  - lib/openid/store/filesystem.rb
120
121
  - lib/openid/store/interface.rb