able to handle launcher login

This commit is contained in:
bruckwubete
2018-06-29 10:07:06 -04:00
parent 3748bb2140
commit e3e32365d0
9 changed files with 69 additions and 29 deletions

View File

@ -19,29 +19,20 @@ module Greenlight
config.loadbalanced_configuration = (ENV["USE_LOADBALANCED_CONFIGURATION"] == "true")
# Setup BigBlueButton configuration.
if config.loadbalanced_configuration
# Fetch credentials from a loadbalancer based on provider.
config.loadbalancer_endpoint = ENV["LOADBALANCER_ENDPOINT"]
config.loadbalancer_secret = ENV["LOADBALANCER_SECRET"]
else
# Default credentials (test-install.blindsidenetworks.com/bigbluebutton).
config.bigbluebutton_endpoint_default = "http://test-install.blindsidenetworks.com/bigbluebutton/api/"
config.bigbluebutton_secret_default = "8cd8ef52e8e101574e400365b55e11a6"
# Use standalone BigBlueButton server.
config.bigbluebutton_endpoint = ENV["BIGBLUEBUTTON_ENDPOINT"]
config.bigbluebutton_secret = ENV["BIGBLUEBUTTON_SECRET"]
# Default credentials (test-install.blindsidenetworks.com/bigbluebutton).
config.bigbluebutton_endpoint_default = "http://test-install.blindsidenetworks.com/bigbluebutton/api"
config.bigbluebutton_secret_default = "8cd8ef52e8e101574e400365b55e11a6"
# Fallback to testing credentails.
if config.bigbluebutton_endpoint.blank?
config.bigbluebutton_endpoint = config.bigbluebutton_endpoint_default
config.bigbluebutton_secret = config.bigbluebutton_secret_default
end
# Fix endpoint format if required.
config.bigbluebutton_endpoint += "api/" unless config.bigbluebutton_endpoint.ends_with?('api/')
end
# Fetch credentials from a loadbalancer based on provider.
config.loadbalancer_endpoint = ENV["LOADBALANCER_ENDPOINT"]
config.loadbalancer_secret = ENV["LOADBALANCER_SECRET"]
# Use standalone BigBlueButton server.
config.bigbluebutton_endpoint = ENV["BIGBLUEBUTTON_ENDPOINT"] || config.bigbluebutton_endpoint_default
config.bigbluebutton_endpoint += "api" unless config.bigbluebutton_endpoint.ends_with?('api')
config.bigbluebutton_secret = ENV["BIGBLUEBUTTON_SECRET"] || config.bigbluebutton_secret_default
# Determine if GreenLight should allow non-omniauth signup/login.
config.allow_user_signup = (ENV['ALLOW_GREENLIGHT_ACCOUNTS'] == "true")

View File

@ -1,14 +1,18 @@
# frozen_string_literal: true
# List of supported Omniauth providers.
Rails.application.config.providers = [:google, :twitter]
Rails.application.config.providers = [:google, :twitter, :bn_launcher]
# Set which providers are configured.
Rails.application.config.omniauth_google = ENV['GOOGLE_OAUTH2_ID'].present? && ENV['GOOGLE_OAUTH2_SECRET'].present?
Rails.application.config.omniauth_twitter = ENV['TWITTER_ID'].present? && ENV['TWITTER_SECRET'].present?
Rails.application.config.omniauth_bn_launcher = (ENV["USE_LOADBALANCED_CONFIGURATION"] == "true")
# Setup the Omniauth middleware.
Rails.application.config.middleware.use OmniAuth::Builder do
provider :bn_launcher, ENV['LAUNCHER_SECRET'], (ENV['LAUNCHER_RELATIVE_URL_ROOT'] || '' + '/login')
provider :twitter, ENV['TWITTER_ID'], ENV['TWITTER_SECRET']
provider :google_oauth2, ENV['GOOGLE_OAUTH2_ID'], ENV['GOOGLE_OAUTH2_SECRET'],