Skip to content

Instantly share code, notes, and snippets.

@hannahwhy
Created December 7, 2010 20:54
Show Gist options
  • Select an option

  • Save hannahwhy/732391 to your computer and use it in GitHub Desktop.

Select an option

Save hannahwhy/732391 to your computer and use it in GitHub Desktop.
responses.rb:68-81 from rubycas-client 2.2.1
@extra_attributes = {}
@xml.elements.to_a('//cas:authenticationSuccess/*').each do |el|
# generating the hash requires prefixes to be defined, so add all of the namespaces
el.namespaces.each {|k,v| el.add_namespace(k,v)}
@extra_attributes.merge!(Hash.from_xml(el.to_s)) unless (el == cas_user)
end
@extra_attributes.each do |k, v|
if v.blank?
@extra_attributes[k] = nil
else
@extra_attributes[k] = YAML.load(v)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment