google-code-export / rubycas-client

Automatically exported from code.google.com/p/rubycas-client
1 stars 1 forks source link

Support for empty extra attributes #30

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Put an empty extra attribute in the RubyCAS server response XML after
validating the service ticket (try to get an extra attribute, that has no
value)

What is the expected output? What do you see instead?

The error is: TypeError (instance of IO needed)
responses.rb does the following on line 74:

# unserialize extra attributes
@extra_attributes.each do |k, v|
  @extra_attributes[k] = YAML.load(v)
end

So, in case of an empty extra attribute, nil is passed to YAML.load, which
causes the error.

So maybe, you could put something in to check for nil values, like this:

# unserialize extra attributes
@extra_attributes.each do |k, v|
  @extra_attributes[k] = YAML.load(v) unless v.nil?
end

Original issue reported on code.google.com by pietzsch...@gmail.com on 22 Jul 2009 at 2:55

GoogleCodeExporter commented 9 years ago

Original comment by matt.zuk...@gmail.com on 22 Jul 2009 at 1:02

GoogleCodeExporter commented 9 years ago
Issue 31 has been merged into this issue.

Original comment by matt.zuk...@gmail.com on 18 Aug 2009 at 4:47

GoogleCodeExporter commented 9 years ago
This should no longer be an issue with newer versions of RubyCAS-Server (nil
extra_attribute values are now serialized as CDATA and come through as an empty
string), but just in case I've added a check to the extra_attribute 
unserialization
code in the client that prevents running blank values through YAML.load

See
http://github.com/gunark/rubycas-client/commit/4e3dbdc71197041eb00ff80c82336bc01
e60059b

Original comment by matt.zuk...@gmail.com on 18 Aug 2009 at 5:11