forked from External/greenlight
GRN-80: Allow local accounts on multitenant (#428)
* Changed the way the omniauth providers are declared * Allow local authentication for multitenant mode based on customer settings * Cleanead up code mandated by rubocop * Completed implementation for signin and added the one for signup * Fixed issue with rubocop * Renamed customer_name to lb_user * Renamed lb_user -> user_domain, fixed issue with signup controller, email verification WAS NOT implemented * Completed implementation of email_verification * Fixed rubocop issue * Final update * Fix for test with loadbalancer * Make sure loadbalancer mockup is only used when env defined * Fix for test on rooms_controller * Fixed most of the test failing on multitenant env * Fixed issue detected by rubocop * Fixed issue with activation tockens not working on resend * Fixed new issue found by rubocop * Updated travis script * Harcoded credentials for mockup * Updated expectation on start_session * Fixed issue with duplication of home room * Updated script for rubocop * Restored Gemfile
This commit is contained in:
@ -16,8 +16,11 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License along
|
||||
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
require 'bbb_api'
|
||||
|
||||
module ApplicationHelper
|
||||
include MeetingsHelper
|
||||
include BbbApi
|
||||
|
||||
# Gets all configured omniauth providers.
|
||||
def configured_providers
|
||||
@ -71,4 +74,14 @@ module ApplicationHelper
|
||||
|
||||
markdown.render(text).html_safe
|
||||
end
|
||||
|
||||
def allow_greenlight_accounts?
|
||||
return true unless Rails.configuration.loadbalanced_configuration
|
||||
return false unless Rails.configuration.allow_user_signup
|
||||
# No need to retrieve the provider info if the provider is whitelisted
|
||||
return true if launcher_allow_user_signup_whitelisted?(@user_domain)
|
||||
# Proceed with retrieving the provider info
|
||||
provider_info = retrieve_provider_info(@user_domain, 'api2', 'getUserGreenlightCredentials')
|
||||
provider_info['provider'] == 'greenlight'
|
||||
end
|
||||
end
|
||||
|
@ -31,7 +31,7 @@ module SessionsHelper
|
||||
|
||||
# If email verification is disabled, or the user has verified, go to their room
|
||||
def check_email_verified(user)
|
||||
if !Rails.configuration.enable_email_verification || user.email_verified
|
||||
if user.activated?
|
||||
redirect_to user.main_room
|
||||
else
|
||||
redirect_to resend_path
|
||||
@ -48,24 +48,24 @@ module SessionsHelper
|
||||
@current_user ||= User.find_by(id: session[:user_id])
|
||||
end
|
||||
|
||||
def generate_checksum(customer_name, redirect_url, secret)
|
||||
string = customer_name + redirect_url + secret
|
||||
def generate_checksum(user_domain, redirect_url, secret)
|
||||
string = user_domain + redirect_url + secret
|
||||
OpenSSL::Digest.digest('sha1', string).unpack("H*").first
|
||||
end
|
||||
|
||||
def parse_customer_name(hostname)
|
||||
provider = hostname.split('.')
|
||||
provider.first == 'www' ? provider.second : provider.first
|
||||
def parse_user_domain(hostname)
|
||||
hostname.split('.').first
|
||||
end
|
||||
|
||||
def omniauth_options(env)
|
||||
gl_redirect_url = (Rails.env.production? ? "https" : env["rack.url_scheme"]) + "://" + env["SERVER_NAME"] + ":" +
|
||||
env["SERVER_PORT"]
|
||||
env['omniauth.strategy'].options[:customer] = parse_customer_name env["SERVER_NAME"]
|
||||
user_domain = parse_user_domain(env["SERVER_NAME"])
|
||||
env['omniauth.strategy'].options[:customer] = user_domain
|
||||
env['omniauth.strategy'].options[:gl_redirect_url] = gl_redirect_url
|
||||
env['omniauth.strategy'].options[:default_callback_url] = Rails.configuration.gl_callback_url
|
||||
env['omniauth.strategy'].options[:checksum] = generate_checksum parse_customer_name(env["SERVER_NAME"]),
|
||||
gl_redirect_url, Rails.configuration.launcher_secret
|
||||
env['omniauth.strategy'].options[:checksum] = generate_checksum(user_domain, gl_redirect_url,
|
||||
Rails.configuration.launcher_secret)
|
||||
end
|
||||
|
||||
def google_omniauth_hd(env, hd)
|
||||
|
Reference in New Issue
Block a user