Class: OmniAuth::Strategies::Shibboleth
- Inherits:
-
Object
- Object
- OmniAuth::Strategies::Shibboleth
- Includes:
- OmniAuth::Strategy
- Defined in:
- lib/omniauth/strategies/shibboleth.rb
Instance Method Summary collapse
- #callback_phase ⇒ Object
- #multi_value_handler(param_value) ⇒ Object
- #option_handler(option_field) ⇒ Object
- #request_param(key) ⇒ Object
- #request_params ⇒ Object
- #request_phase ⇒ Object
Instance Method Details
#callback_phase ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/omniauth/strategies/shibboleth.rb', line 62 def callback_phase if .debug # dump attributes return [ 200, { 'Content-Type' => 'text/plain' }, ["!!!!! This message is generated by omniauth-shibboleth. To remove it set :debug to false. !!!!!\n#{request_params.sort.map {|i| "#{i[0]}: #{i[1]}" }.join("\n")}"] ] end return fail!(:no_shibboleth_session) unless (request_param(.shib_session_id_field.to_s) || request_param(.shib_application_id_field.to_s)) return fail!(:empty_uid) if .fail_with_empty_uid && option_handler(.uid_field).empty? super end |
#multi_value_handler(param_value) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/omniauth/strategies/shibboleth.rb', line 50 def multi_value_handler(param_value) case .multi_values when :raw, 'raw' param_value when :first, 'first' return nil if param_value.nil? param_value.split(/(?<!\\);/).first.gsub('\\;', ';') else eval(.multi_values).call(param_value) end end |
#option_handler(option_field) ⇒ Object
78 79 80 81 82 83 84 85 |
# File 'lib/omniauth/strategies/shibboleth.rb', line 78 def option_handler(option_field) if option_field.class == String || option_field.class == Symbol request_param(option_field.to_s) elsif option_field.class == Proc option_field.call(self.method(:request_param)) end end |
#request_param(key) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/omniauth/strategies/shibboleth.rb', line 37 def request_param(key) multi_value_handler( case .request_type when :env, 'env' request.env[key] when :header, 'header' request.env["HTTP_#{key.upcase.gsub('-', '_')}"] when :params, 'params' request.params[key] end ) end |
#request_params ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/omniauth/strategies/shibboleth.rb', line 28 def request_params case .request_type when :env, 'env', :header, 'header' request.env when :params, 'params' request.params end end |
#request_phase ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/omniauth/strategies/shibboleth.rb', line 17 def request_phase [ 302, { 'Location' => script_name + callback_path + query_string, 'Content-Type' => 'text/plain' }, ["You are being redirected to Shibboleth SP/IdP for sign-in."] ] end |