Module: Cul::Omniauth::FileConfigurable::ClassMethods

Defined in:
lib/cul/omniauth/file_configurable.rb

Overview

OmniAuth::Strategies::CAS.configure(mod.cas_configuration_opts)

Instance Method Summary collapse

Instance Method Details

#cas_configuration_optsObject



9
10
11
12
13
14
15
16
# File 'lib/cul/omniauth/file_configurable.rb', line 9

def cas_configuration_opts
  @cas_opts ||= begin
    _opts = YAML.load_file(File.join(Rails.root,'config','cas.yml'))[Rails.env] || {}
    _opts = _opts.symbolize_keys
    _opts
  end
  @cas_opts
end

#configure_devise_omniauth(config, opts = nil) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/cul/omniauth/file_configurable.rb', line 17

def configure_devise_omniauth(config,opts=nil)
  opts ||= cas_configuration_opts
  opts = opts.dup
  provider = opts.delete(:provider)
  fetch_raw_info = opts.delete(:fetch_raw_info)
  fetch_raw_info = fetch_raw_info.to_sym if fetch_raw_info.is_a? String
  if fetch_raw_info.is_a? Symbol
    method = fetch_raw_info
    fetch_raw_info = lambda do |strategy, options, ticket, |
      send(method, strategy, options, ticket, )
    end
  end
  opts[:fetch_raw_info] = fetch_raw_info if fetch_raw_info
  config.omniauth provider, opts
  config.warden do |manager|
    manager.failure_app = Cul::Omniauth::FailureApp.for(provider)
  end
end


35
36
37
38
39
40
41
# File 'lib/cul/omniauth/file_configurable.rb', line 35

def print_raw_info(strategy, options, ticket, )
  puts "strategy: #{strategy.inspect}"
  puts "options: #{options.inspect}"
  puts "ticket: #{ticket.inspect}"
  puts "ticket_user_info: #{.inspect}"
  {} # for merge
end