Class: RackCAS::ServiceValidationResponse
- Inherits:
-
Object
- Object
- RackCAS::ServiceValidationResponse
- Defined in:
- lib/rack-cas/service_validation_response.rb
Constant Summary collapse
- REQUEST_HEADERS =
{ 'Accept' => '*/*' }
Instance Method Summary collapse
- #extra_attributes ⇒ Object
-
#initialize(url) ⇒ ServiceValidationResponse
constructor
A new instance of ServiceValidationResponse.
- #user ⇒ Object
Constructor Details
#initialize(url) ⇒ ServiceValidationResponse
Returns a new instance of ServiceValidationResponse.
5 6 7 |
# File 'lib/rack-cas/service_validation_response.rb', line 5 def initialize(url) @url = URL.parse(url) end |
Instance Method Details
#extra_attributes ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/rack-cas/service_validation_response.rb', line 13 def extra_attributes attrs = {} # Jasig style if attr_node = xml.at('/cas:serviceResponse/cas:authenticationSuccess/cas:attributes') attr_node.children.each do |node| if node.is_a? Nokogiri::XML::Element attrs[node.name] = node.text end end # RubyCas-Server style else xml.at('/cas:serviceResponse/cas:authenticationSuccess').children.each do |node| if node.is_a? Nokogiri::XML::Element if !node.namespace || !node.namespace.prefix == 'cas' # TODO: support JSON encoding attrs[node.name] = YAML.load node.text.strip end end end end attrs end |
#user ⇒ Object
9 10 11 |
# File 'lib/rack-cas/service_validation_response.rb', line 9 def user xml.xpath('/cas:serviceResponse/cas:authenticationSuccess/cas:user').text end |