forked from External/greenlight
able to handle launcher login
This commit is contained in:
parent
3748bb2140
commit
e3e32365d0
|
@ -29,3 +29,7 @@
|
||||||
|
|
||||||
# Ignore environment configuration.
|
# Ignore environment configuration.
|
||||||
.env
|
.env
|
||||||
|
|
||||||
|
# IDEs
|
||||||
|
.idea
|
||||||
|
.idea/**
|
||||||
|
|
|
@ -5,6 +5,7 @@ RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
|
||||||
|
|
||||||
# Set an environment variable for the install location.
|
# Set an environment variable for the install location.
|
||||||
ENV RAILS_ROOT /usr/src/app
|
ENV RAILS_ROOT /usr/src/app
|
||||||
|
RUN bundle config github.com 0e54e86c4228294d867a0831bff53f95a31d4af2:x-oauth-basic
|
||||||
|
|
||||||
# Make the directory and set as working.
|
# Make the directory and set as working.
|
||||||
RUN mkdir -p $RAILS_ROOT
|
RUN mkdir -p $RAILS_ROOT
|
||||||
|
|
3
Gemfile
3
Gemfile
|
@ -26,7 +26,7 @@ gem 'uglifier', '>= 1.3.0'
|
||||||
gem 'coffee-rails', '~> 4.2'
|
gem 'coffee-rails', '~> 4.2'
|
||||||
|
|
||||||
# See https://github.com/rails/execjs#readme for more supported runtimes
|
# See https://github.com/rails/execjs#readme for more supported runtimes
|
||||||
# gem 'therubyracer', platforms: :ruby
|
gem 'therubyracer', platforms: :ruby
|
||||||
|
|
||||||
# Use jquery as the JavaScript library
|
# Use jquery as the JavaScript library
|
||||||
gem 'jquery-rails'
|
gem 'jquery-rails'
|
||||||
|
@ -47,6 +47,7 @@ gem 'bcrypt', '~> 3.1.7'
|
||||||
gem 'omniauth'
|
gem 'omniauth'
|
||||||
gem 'omniauth-twitter'
|
gem 'omniauth-twitter'
|
||||||
gem 'omniauth-google-oauth2'
|
gem 'omniauth-google-oauth2'
|
||||||
|
gem "omniauth-bn-launcher", git: "https://github.com/blindsidenetworks/omniauth-bn-launcher.git"
|
||||||
|
|
||||||
# BigBlueButton API wrapper.
|
# BigBlueButton API wrapper.
|
||||||
gem 'bigbluebutton-api-ruby'
|
gem 'bigbluebutton-api-ruby'
|
||||||
|
|
28
Gemfile.lock
28
Gemfile.lock
|
@ -1,3 +1,10 @@
|
||||||
|
GIT
|
||||||
|
remote: https://github.com/blindsidenetworks/omniauth-bn-launcher.git
|
||||||
|
revision: 52fbc3ff40c64ad5eef51f7e6c0beba2c666356f
|
||||||
|
specs:
|
||||||
|
omniauth-bn-launcher (0.1.0)
|
||||||
|
omniauth (~> 1.3, >= 1.3.2)
|
||||||
|
|
||||||
GEM
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
|
@ -42,7 +49,7 @@ GEM
|
||||||
tzinfo (~> 1.1)
|
tzinfo (~> 1.1)
|
||||||
arel (7.1.4)
|
arel (7.1.4)
|
||||||
ast (2.4.0)
|
ast (2.4.0)
|
||||||
autoprefixer-rails (8.6.2)
|
autoprefixer-rails (8.6.4)
|
||||||
execjs
|
execjs
|
||||||
bcrypt (3.1.12)
|
bcrypt (3.1.12)
|
||||||
bigbluebutton-api-ruby (1.6.0)
|
bigbluebutton-api-ruby (1.6.0)
|
||||||
|
@ -64,9 +71,9 @@ GEM
|
||||||
concurrent-ruby (1.0.5)
|
concurrent-ruby (1.0.5)
|
||||||
crass (1.0.4)
|
crass (1.0.4)
|
||||||
diff-lcs (1.3)
|
diff-lcs (1.3)
|
||||||
dotenv (2.4.0)
|
dotenv (2.5.0)
|
||||||
dotenv-rails (2.4.0)
|
dotenv-rails (2.5.0)
|
||||||
dotenv (= 2.4.0)
|
dotenv (= 2.5.0)
|
||||||
railties (>= 3.2, < 6.0)
|
railties (>= 3.2, < 6.0)
|
||||||
erubis (2.7.0)
|
erubis (2.7.0)
|
||||||
execjs (2.7.0)
|
execjs (2.7.0)
|
||||||
|
@ -94,6 +101,7 @@ GEM
|
||||||
railties (>= 4.2.0)
|
railties (>= 4.2.0)
|
||||||
thor (>= 0.14, < 2.0)
|
thor (>= 0.14, < 2.0)
|
||||||
jwt (1.5.6)
|
jwt (1.5.6)
|
||||||
|
libv8 (3.16.14.19)
|
||||||
listen (3.0.8)
|
listen (3.0.8)
|
||||||
rb-fsevent (~> 0.9, >= 0.9.4)
|
rb-fsevent (~> 0.9, >= 0.9.4)
|
||||||
rb-inotify (~> 0.9, >= 0.9.7)
|
rb-inotify (~> 0.9, >= 0.9.7)
|
||||||
|
@ -110,7 +118,7 @@ GEM
|
||||||
multi_xml (0.6.0)
|
multi_xml (0.6.0)
|
||||||
multipart-post (2.0.0)
|
multipart-post (2.0.0)
|
||||||
nio4r (2.3.1)
|
nio4r (2.3.1)
|
||||||
nokogiri (1.8.2)
|
nokogiri (1.8.3)
|
||||||
mini_portile2 (~> 2.3.0)
|
mini_portile2 (~> 2.3.0)
|
||||||
oauth (0.5.4)
|
oauth (0.5.4)
|
||||||
oauth2 (1.4.0)
|
oauth2 (1.4.0)
|
||||||
|
@ -178,6 +186,7 @@ GEM
|
||||||
rb-inotify (0.9.10)
|
rb-inotify (0.9.10)
|
||||||
ffi (>= 0.5.0, < 2)
|
ffi (>= 0.5.0, < 2)
|
||||||
redis (3.3.5)
|
redis (3.3.5)
|
||||||
|
ref (2.0.0)
|
||||||
rspec-core (3.7.1)
|
rspec-core (3.7.1)
|
||||||
rspec-support (~> 3.7.0)
|
rspec-support (~> 3.7.0)
|
||||||
rspec-expectations (3.7.0)
|
rspec-expectations (3.7.0)
|
||||||
|
@ -222,7 +231,7 @@ GEM
|
||||||
spring-watcher-listen (2.0.1)
|
spring-watcher-listen (2.0.1)
|
||||||
listen (>= 2.7, < 4.0)
|
listen (>= 2.7, < 4.0)
|
||||||
spring (>= 1.2, < 3.0)
|
spring (>= 1.2, < 3.0)
|
||||||
sprockets (3.7.1)
|
sprockets (3.7.2)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
rack (> 1, < 3)
|
rack (> 1, < 3)
|
||||||
sprockets-rails (3.2.1)
|
sprockets-rails (3.2.1)
|
||||||
|
@ -232,6 +241,9 @@ GEM
|
||||||
sqlite3 (1.3.13)
|
sqlite3 (1.3.13)
|
||||||
tabler-rubygem (0.1.2)
|
tabler-rubygem (0.1.2)
|
||||||
autoprefixer-rails (>= 6.0.3)
|
autoprefixer-rails (>= 6.0.3)
|
||||||
|
therubyracer (0.12.3)
|
||||||
|
libv8 (~> 3.16.14.15)
|
||||||
|
ref
|
||||||
thor (0.20.0)
|
thor (0.20.0)
|
||||||
thread_safe (0.3.6)
|
thread_safe (0.3.6)
|
||||||
tilt (2.0.8)
|
tilt (2.0.8)
|
||||||
|
@ -240,7 +252,7 @@ GEM
|
||||||
turbolinks-source (5.1.0)
|
turbolinks-source (5.1.0)
|
||||||
tzinfo (1.2.5)
|
tzinfo (1.2.5)
|
||||||
thread_safe (~> 0.1)
|
thread_safe (~> 0.1)
|
||||||
uglifier (4.1.11)
|
uglifier (4.1.12)
|
||||||
execjs (>= 0.3.0, < 3)
|
execjs (>= 0.3.0, < 3)
|
||||||
unicode-display_width (1.4.0)
|
unicode-display_width (1.4.0)
|
||||||
web-console (3.6.2)
|
web-console (3.6.2)
|
||||||
|
@ -270,6 +282,7 @@ DEPENDENCIES
|
||||||
jquery-rails
|
jquery-rails
|
||||||
listen (~> 3.0.5)
|
listen (~> 3.0.5)
|
||||||
omniauth
|
omniauth
|
||||||
|
omniauth-bn-launcher!
|
||||||
omniauth-google-oauth2
|
omniauth-google-oauth2
|
||||||
omniauth-twitter
|
omniauth-twitter
|
||||||
pg (~> 0.18)
|
pg (~> 0.18)
|
||||||
|
@ -285,6 +298,7 @@ DEPENDENCIES
|
||||||
spring-watcher-listen (~> 2.0.0)
|
spring-watcher-listen (~> 2.0.0)
|
||||||
sqlite3
|
sqlite3
|
||||||
tabler-rubygem
|
tabler-rubygem
|
||||||
|
therubyracer
|
||||||
turbolinks (~> 5)
|
turbolinks (~> 5)
|
||||||
tzinfo-data
|
tzinfo-data
|
||||||
uglifier (>= 1.3.0)
|
uglifier (>= 1.3.0)
|
||||||
|
|
|
@ -6,6 +6,7 @@ class ApplicationController < ActionController::Base
|
||||||
include SessionsHelper
|
include SessionsHelper
|
||||||
|
|
||||||
protect_from_forgery with: :exception
|
protect_from_forgery with: :exception
|
||||||
|
skip_before_filter :verify_authenticity_token
|
||||||
|
|
||||||
MEETING_NAME_LIMIT = 90
|
MEETING_NAME_LIMIT = 90
|
||||||
USER_NAME_LIMIT = 30
|
USER_NAME_LIMIT = 30
|
||||||
|
|
|
@ -5,6 +5,14 @@ class MainController < ApplicationController
|
||||||
|
|
||||||
# GET /
|
# GET /
|
||||||
def index
|
def index
|
||||||
|
if current_user
|
||||||
|
# Redirect authenticated users to their room.
|
||||||
|
redirect_to room_path(current_user.room)
|
||||||
|
else
|
||||||
|
# Redirect unauthenticated users to root.
|
||||||
|
#TODO use env? for launcher login endpoint
|
||||||
|
redirect_to "#{Rails.configuration.relative_url_root}/auth/bn_launcher"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -65,6 +65,22 @@ class User < ApplicationRecord
|
||||||
def google_image(auth)
|
def google_image(auth)
|
||||||
auth['info']['image']
|
auth['info']['image']
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def bn_launcher_name(auth)
|
||||||
|
auth['user_info']['username']
|
||||||
|
end
|
||||||
|
|
||||||
|
def bn_launcher_username(auth)
|
||||||
|
auth['user_info']['username']
|
||||||
|
end
|
||||||
|
|
||||||
|
def bn_launcher_email(auth)
|
||||||
|
auth['user_info']['email']
|
||||||
|
end
|
||||||
|
|
||||||
|
def bn_launcher_image(auth)
|
||||||
|
""
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Retrives a list of all a users rooms that are not the main room, sorted by last session date.
|
# Retrives a list of all a users rooms that are not the main room, sorted by last session date.
|
||||||
|
|
|
@ -19,29 +19,20 @@ module Greenlight
|
||||||
|
|
||||||
config.loadbalanced_configuration = (ENV["USE_LOADBALANCED_CONFIGURATION"] == "true")
|
config.loadbalanced_configuration = (ENV["USE_LOADBALANCED_CONFIGURATION"] == "true")
|
||||||
|
|
||||||
# Setup BigBlueButton configuration.
|
|
||||||
if config.loadbalanced_configuration
|
# Default credentials (test-install.blindsidenetworks.com/bigbluebutton).
|
||||||
|
config.bigbluebutton_endpoint_default = "http://test-install.blindsidenetworks.com/bigbluebutton/api"
|
||||||
|
config.bigbluebutton_secret_default = "8cd8ef52e8e101574e400365b55e11a6"
|
||||||
|
|
||||||
|
|
||||||
# Fetch credentials from a loadbalancer based on provider.
|
# Fetch credentials from a loadbalancer based on provider.
|
||||||
config.loadbalancer_endpoint = ENV["LOADBALANCER_ENDPOINT"]
|
config.loadbalancer_endpoint = ENV["LOADBALANCER_ENDPOINT"]
|
||||||
config.loadbalancer_secret = ENV["LOADBALANCER_SECRET"]
|
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.
|
# Use standalone BigBlueButton server.
|
||||||
config.bigbluebutton_endpoint = ENV["BIGBLUEBUTTON_ENDPOINT"]
|
config.bigbluebutton_endpoint = ENV["BIGBLUEBUTTON_ENDPOINT"] || config.bigbluebutton_endpoint_default
|
||||||
config.bigbluebutton_secret = ENV["BIGBLUEBUTTON_SECRET"]
|
config.bigbluebutton_endpoint += "api" unless config.bigbluebutton_endpoint.ends_with?('api')
|
||||||
|
config.bigbluebutton_secret = ENV["BIGBLUEBUTTON_SECRET"] || config.bigbluebutton_secret_default
|
||||||
# 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
|
|
||||||
|
|
||||||
# Determine if GreenLight should allow non-omniauth signup/login.
|
# Determine if GreenLight should allow non-omniauth signup/login.
|
||||||
config.allow_user_signup = (ENV['ALLOW_GREENLIGHT_ACCOUNTS'] == "true")
|
config.allow_user_signup = (ENV['ALLOW_GREENLIGHT_ACCOUNTS'] == "true")
|
||||||
|
|
|
@ -1,14 +1,18 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# List of supported Omniauth providers.
|
# List of supported Omniauth providers.
|
||||||
Rails.application.config.providers = [:google, :twitter]
|
Rails.application.config.providers = [:google, :twitter, :bn_launcher]
|
||||||
|
|
||||||
# Set which providers are configured.
|
# Set which providers are configured.
|
||||||
Rails.application.config.omniauth_google = ENV['GOOGLE_OAUTH2_ID'].present? && ENV['GOOGLE_OAUTH2_SECRET'].present?
|
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_twitter = ENV['TWITTER_ID'].present? && ENV['TWITTER_SECRET'].present?
|
||||||
|
Rails.application.config.omniauth_bn_launcher = (ENV["USE_LOADBALANCED_CONFIGURATION"] == "true")
|
||||||
|
|
||||||
# Setup the Omniauth middleware.
|
# Setup the Omniauth middleware.
|
||||||
Rails.application.config.middleware.use OmniAuth::Builder do
|
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 :twitter, ENV['TWITTER_ID'], ENV['TWITTER_SECRET']
|
||||||
|
|
||||||
provider :google_oauth2, ENV['GOOGLE_OAUTH2_ID'], ENV['GOOGLE_OAUTH2_SECRET'],
|
provider :google_oauth2, ENV['GOOGLE_OAUTH2_ID'], ENV['GOOGLE_OAUTH2_SECRET'],
|
||||||
|
|
Loading…
Reference in New Issue