Class: OmniAuth::Strategies::WIND::ServiceTicketValidator
- Inherits:
-
CAS::ServiceTicketValidator
- Object
- CAS::ServiceTicketValidator
- OmniAuth::Strategies::WIND::ServiceTicketValidator
- Defined in:
- lib/omni_auth/strategies/w_i_n_d/service_ticket_validator.rb
Constant Summary collapse
- NS =
{wind: 'http://www.columbia.edu/acis/rad/authmethods/wind'}
Instance Method Summary collapse
Instance Method Details
#find_authentication_success(body) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/omni_auth/strategies/w_i_n_d/service_ticket_validator.rb', line 33 def find_authentication_success(body) return nil if body.nil? || body == '' begin doc = Nokogiri::XML(body) begin doc.xpath('/wind:serviceResponse/wind:authenticationSuccess', NS) rescue Nokogiri::XML::XPath::SyntaxError doc.xpath('/serviceResponse/authenticationSuccess') end rescue Nokogiri::XML::XPath::SyntaxError nil end end |
#parse_user_info(node) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/omni_auth/strategies/w_i_n_d/service_ticket_validator.rb', line 10 def parse_user_info(node) return nil if node.nil? {}.tap do |hash| node.children.each do |e| node_name = e.name.sub(/^wind:/, '') unless e.kind_of?(Nokogiri::XML::Text) || node_name == 'proxies' # There are no child elements if e.element_children.count == 0 hash[node_name] = e.content elsif e.element_children.count # WIND style affiliations if node_name == 'affiliations' hash.merge!(affiliations: e.xpath('wind:affil',NS).collect {|x| x.text}) else hash[node_name] = [] if hash[node_name].nil? hash[node_name].push(parse_user_info(e)) end end end end end end |