Class: OmniAuth::Strategies::BnLauncher

Inherits:
OAuth2
  • Object
show all
Defined in:
lib/omniauth/strategies/bn_launcher.rb,
lib/omniauth/strategies/launcher/validation_error.rb

Defined Under Namespace

Classes: ValidationError

Instance Method Summary collapse

Instance Method Details

#callback_phaseObject



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/omniauth/strategies/bn_launcher.rb', line 40

def callback_phase
  if request.base_url == options[:default_callback_url]
    response = Rack::Response.new
    response.redirect redirect_url
    response.finish
  elsif !request.params["message"].nil?
    fail!(request.params["message"])
  else
    super
  end
end

#callback_urlObject



18
19
20
21
22
23
24
25
# File 'lib/omniauth/strategies/bn_launcher.rb', line 18

def callback_url
  if options[:default_callback_url].nil?
    fail!(:callback_url_not_set)
  end
  options[:default_callback_url] + script_name + callback_path + query_string
rescue => e
  fail!(e.message)
end

#raw_infoObject



76
77
78
# File 'lib/omniauth/strategies/bn_launcher.rb', line 76

def raw_info
  @raw_info ||= access_token.get("/user").parsed
end

#redirect_urlObject



27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/omniauth/strategies/bn_launcher.rb', line 27

def redirect_url
  # Should remove the gl_redirect_url has that is used for the old launcher
  if !request.params["customer"].nil?
    customer_redirect_url = "#{request.scheme}://#{request.params["customer"]}.#{request.host}:#{request.port}"
    customer_redirect_url + script_name + callback_path + query_string
  else
    #should be changed to customer once the old launcher is removed
    fail!(:customer_not_set)
  end
rescue => e
  fail!(e.message)
end

#request_phaseObject



13
14
15
16
# File 'lib/omniauth/strategies/bn_launcher.rb', line 13

def request_phase
  options.authorize_params[:customer] = options[:customer]
  super
end