Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for namespaces declared outside of the root element in single sign out requests #33

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions lib/omniauth/strategies/cas/logout_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down