forked from External/greenlight
able to handle launcher login with gem
This commit is contained in:
parent
2bb41977ed
commit
3c11aca1aa
2
Gemfile
2
Gemfile
|
@ -47,7 +47,6 @@ gem 'bcrypt', '~> 3.1.7'
|
|||
gem 'omniauth'
|
||||
gem 'omniauth-twitter'
|
||||
gem 'omniauth-google-oauth2'
|
||||
gem "omniauth-bn-launcher", git: "https://github.com/blindsidenetworks/omniauth-bn-launcher.git"
|
||||
|
||||
# BigBlueButton API wrapper.
|
||||
gem 'bigbluebutton-api-ruby'
|
||||
|
@ -65,6 +64,7 @@ gem 'rubocop', require: false
|
|||
group :production do
|
||||
# Use a postgres database in production.
|
||||
gem 'pg', '~> 0.18'
|
||||
gem "omniauth-bn-launcher", git: "https://github.com/blindsidenetworks/omniauth-bn-launcher.git", branch: "oauth2"
|
||||
end
|
||||
|
||||
group :development, :test do
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
GIT
|
||||
remote: https://github.com/blindsidenetworks/omniauth-bn-launcher.git
|
||||
revision: 52fbc3ff40c64ad5eef51f7e6c0beba2c666356f
|
||||
revision: d93b9fa51f920c733618ec4040c93458ff19951f
|
||||
branch: oauth2
|
||||
specs:
|
||||
omniauth-bn-launcher (0.1.0)
|
||||
omniauth (~> 1.3, >= 1.3.2)
|
||||
omniauth-oauth2 (= 1.5.0)
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
|
|
|
@ -7,7 +7,7 @@ class MainController < ApplicationController
|
|||
def index
|
||||
if current_user
|
||||
# Redirect authenticated users to their room.
|
||||
redirect_to room_path(current_user.room)
|
||||
redirect_to room_path(current_user.main_room)
|
||||
else
|
||||
# Redirect unauthenticated users to root.
|
||||
#TODO use env? for launcher login endpoint
|
||||
|
|
|
@ -67,19 +67,19 @@ class User < ApplicationRecord
|
|||
end
|
||||
|
||||
def bn_launcher_name(auth)
|
||||
auth['user_info']['username']
|
||||
auth['info']['name']
|
||||
end
|
||||
|
||||
def bn_launcher_username(auth)
|
||||
auth['user_info']['username']
|
||||
auth['info']['username']
|
||||
end
|
||||
|
||||
def bn_launcher_email(auth)
|
||||
auth['user_info']['email']
|
||||
auth['info']['email']
|
||||
end
|
||||
|
||||
def bn_launcher_image(auth)
|
||||
""
|
||||
auth['info']['image']
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
#!/bin/bash
|
||||
while [ "$RAILS_ENV" = "production" ] && ! curl http://$DB_HOST:5432/ 2>&1 | grep '52'
|
||||
do
|
||||
echo "Waiting for postgres to start up ..."
|
||||
sleep 1
|
||||
done
|
||||
|
||||
bundle exec rake db:create
|
||||
bundle exec rake db:migrate
|
||||
|
|
|
@ -10,8 +10,13 @@ Rails.application.config.omniauth_bn_launcher = (ENV["USE_LOADBALANCED_CONFIGURA
|
|||
|
||||
# Setup the Omniauth middleware.
|
||||
Rails.application.config.middleware.use OmniAuth::Builder do
|
||||
if Rails.env.production?
|
||||
provider :bn_launcher,
|
||||
client_id: ENV['BN_LAUNCHER_CLIENT_ID'],
|
||||
client_secret: ENV['BN_LAUNCHER_CLIENT_SECRET'],
|
||||
client_options: {site: ENV['BN_LAUNCHER_REDIRECT_URI']}
|
||||
end
|
||||
|
||||
provider :bn_launcher, ENV['LAUNCHER_SECRET'], (ENV['LAUNCHER_RELATIVE_URL_ROOT'] || '' + '/login')
|
||||
|
||||
provider :twitter, ENV['TWITTER_ID'], ENV['TWITTER_SECRET']
|
||||
|
||||
|
|
Loading…
Reference in New Issue