lib/omniauth/strategies/cas/logout_request.rb in omniauth-cas-2.0.0 vs lib/omniauth/strategies/cas/logout_request.rb in omniauth-cas-3.0.0.beta.1
- old
+ new
@@ -1,49 +1,52 @@
+# frozen_string_literal: true
+
module OmniAuth
module Strategies
class CAS
class LogoutRequest
def initialize(strategy, request)
- @strategy, @request = strategy, request
+ @strategy = strategy
+ @request = request
end
def call(options = {})
@options = options
begin
result = single_sign_out_callback.call(*logout_request)
- rescue StandardError => err
- return @strategy.fail! :logout_request, err
+ rescue StandardError => e
+ @strategy.fail! :logout_request, e
else
- result = [200,{},'OK'] if result == true || result.nil?
+ result = [200, {}, 'OK'] if result == true || result.nil?
ensure
return unless result
# TODO: Why does ActionPack::Response return [status,headers,body]
# when Rack::Response#new wants [body,status,headers]? Additionally,
# why does Rack::Response differ in argument order from the usual
# Rack-like [status,headers,body] array?
- return Rack::Response.new(result[2],result[0],result[1]).finish
+ return Rack::Response.new(result[2], result[0], result[1]).finish
end
end
- private
+ private
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
- inject_params(name_id:name_id, session_index:sess_idx)
+ 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
+ rescue StandardError
# A no-op intended to ensure that the ensure block is run
raise
ensure
@request.env['rack.input'].rewind
end