diff --git a/lib/omniauth/strategies/cas/logout_request.rb b/lib/omniauth/strategies/cas/logout_request.rb index eba676c..9fa1654 100644 --- a/lib/omniauth/strategies/cas/logout_request.rb +++ b/lib/omniauth/strategies/cas/logout_request.rb @@ -31,22 +31,18 @@ def call(options = {}) def logout_request @logout_request ||= begin saml = Nokogiri.parse(@request.params['logoutRequest']) - name_id = saml.xpath('//saml:NameID').text - sess_idx = saml.xpath('//samlp:SessionIndex').text + ns = saml.collect_namespaces + name_id = saml.xpath('//saml:NameID', ns).text + sess_idx = saml.xpath('//samlp:SessionIndex', ns).text inject_params(name_id:name_id, session_index:sess_idx) @request end end def inject_params(new_params) - rack_input = @request.env['rack.input'].read - params = Rack::Utils.parse_query(rack_input, '&').merge new_params - @request.env['rack.input'] = StringIO.new(Rack::Utils.build_query(params)) - rescue - # A no-op intended to ensure that the ensure block is run - raise - ensure - @request.env['rack.input'].rewind + new_params.each do |k,v| + @request.update_param(k,v) + end end def single_sign_out_callback