Skip to content
This repository has been archived by the owner on Jul 24, 2023. It is now read-only.

revert serializer changes #73

Merged
merged 2 commits into from
Jan 29, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions lib/openid/consumer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
require "openid/message"
require "openid/yadis/discovery"
require "openid/store/nonce"
require "openid/serializer"

module OpenID
# OpenID support for Relying Parties (aka Consumers).
Expand Down Expand Up @@ -298,17 +297,11 @@ def complete(query, current_url)
protected

def session_get(name)
value = @session[session_key(name)]

if value.is_a?(Array) # new serialized format
Serializer.deserialize(*value)
else # deprecated object format
value
end
@session[session_key(name)]
end

def session_set(name, val)
@session[session_key(name)] = Serializer.serialize(val)
@session[session_key(name)] = val
end

def session_key(suffix)
Expand Down
4 changes: 2 additions & 2 deletions lib/openid/consumer/discovery.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def initialize
def display_identifier
return @display_identifier if @display_identifier

return @claimed_id if @claimed_id.nil?
return @claimed_id if @claimed_id.nil?

begin
parsed_identifier = URI.parse(@claimed_id)
Expand Down Expand Up @@ -376,7 +376,7 @@ def self.discover_yadis(uri)
#
# @param uri: normalized identity URL
# @type uri: str
#
#
# @return: (claimed_id, services)
# @rtype: (str, list(OpenIDServiceEndpoint))
#
Expand Down
21 changes: 0 additions & 21 deletions lib/openid/serializer.rb

This file was deleted.

18 changes: 4 additions & 14 deletions test/test_consumer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,14 @@ module OpenID
class Consumer
module TestConsumer
class TestLastEndpoint < Test::Unit::TestCase
def all_instance_variables(object)
object.instance_variables.map { |v| [v.to_s, object.instance_variable_get(v)] }
end

def test_set_get
stored = OpenID::OpenIDServiceEndpoint.new
stored.server_url = "test"
session = {}

consumer = Consumer.new(session, nil)
consumer.send(:last_requested_endpoint=, stored)

consumer.send(:last_requested_endpoint=, :endpoint)
ep = consumer.send(:last_requested_endpoint)
assert_equal(all_instance_variables(stored), all_instance_variables(ep))

assert_equal(:endpoint, ep)
ep = consumer.send(:last_requested_endpoint)
assert_equal(all_instance_variables(stored), all_instance_variables(ep))

assert_equal(:endpoint, ep)
consumer.send(:cleanup_last_requested_endpoint)
ep = consumer.send(:last_requested_endpoint)
assert_equal(nil, ep)
Expand Down Expand Up @@ -120,7 +110,7 @@ def call_begin_without_discovery
result = consumer.begin_without_discovery(@service, @anonymous)
assert(result.instance_of?(CheckIDRequest))
assert_equal(@anonymous, result.anonymous)
assert_equal(@service.claimed_id, consumer.send(:last_requested_endpoint).claimed_id)
assert_equal(@service, consumer.send(:last_requested_endpoint))
assert_equal(result.instance_variable_get(:@assoc), @assoc)
return result
end
Expand Down