Skip to content

Commit

Permalink
Add support for the new launcher (#1)
Browse files Browse the repository at this point in the history
* Add support for the new launcher

* Update the version
  • Loading branch information
shawn-higgins1 authored and jfederico committed Jul 9, 2019
1 parent afe3722 commit 8ef1f51
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/omniauth-bn-launcher/version.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module OmniAuth
module Bn
module Launcher
VERSION = "0.1.0"
VERSION = "0.1.1"
end
end
end
17 changes: 13 additions & 4 deletions lib/omniauth/strategies/bn_launcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@ class BnLauncher < OmniAuth::Strategies::OAuth2
option :name, 'bn_launcher'
option :customer, nil
option :default_callback_url, nil
option :gl_redirect_url, nil
option :customer_redirect_url, nil
#Exists to support the old launcher should be removed
option :checksum, nil

def request_phase
options.authorize_params[:customer] = options[:customer]
options.authorize_params[:gl_redirect_url] = options[:gl_redirect_url]
options.authorize_params[:customer_redirect_url] = options[:customer_redirect_url]

# These options exists to support the old launcher and should eventually be removed
options.authorize_params[:gl_redirect_url] = options[:customer_redirect_url]
options.authorize_params[:checksum] = options[:checksum]
super
end
Expand All @@ -29,10 +33,15 @@ def callback_url
end

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

0 comments on commit 8ef1f51

Please sign in to comment.