forked from External/greenlight
* <Added omniauth for office365> * <Fixed code style> * Update puma.rb * <Inserted link to documentation>
This commit is contained in:
parent
90b965d03f
commit
ec250f3ed5
1
Gemfile
1
Gemfile
|
@ -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-microsoft-office365', '~> 0.0.7'
|
||||||
gem 'omniauth-ldap'
|
gem 'omniauth-ldap'
|
||||||
gem 'omniauth-bn-launcher', '~> 0.1.0'
|
gem 'omniauth-bn-launcher', '~> 0.1.0'
|
||||||
|
|
||||||
|
|
|
@ -160,6 +160,9 @@ GEM
|
||||||
omniauth (~> 1.8.1)
|
omniauth (~> 1.8.1)
|
||||||
pyu-ruby-sasl (~> 0.0.3.3)
|
pyu-ruby-sasl (~> 0.0.3.3)
|
||||||
rubyntlm (~> 0.6.2)
|
rubyntlm (~> 0.6.2)
|
||||||
|
omniauth-microsoft-office365 (0.0.7)
|
||||||
|
omniauth
|
||||||
|
omniauth-oauth2
|
||||||
omniauth-oauth (1.1.0)
|
omniauth-oauth (1.1.0)
|
||||||
oauth
|
oauth
|
||||||
omniauth (~> 1.0)
|
omniauth (~> 1.0)
|
||||||
|
@ -338,6 +341,7 @@ DEPENDENCIES
|
||||||
omniauth-bn-launcher (~> 0.1.0)
|
omniauth-bn-launcher (~> 0.1.0)
|
||||||
omniauth-google-oauth2
|
omniauth-google-oauth2
|
||||||
omniauth-ldap
|
omniauth-ldap
|
||||||
|
omniauth-microsoft-office365 (~> 0.0.7)
|
||||||
omniauth-twitter
|
omniauth-twitter
|
||||||
pg (~> 0.18)
|
pg (~> 0.18)
|
||||||
puma (~> 3.0)
|
puma (~> 3.0)
|
||||||
|
|
|
@ -60,7 +60,12 @@ class User < ApplicationRecord
|
||||||
|
|
||||||
# Provider attributes.
|
# Provider attributes.
|
||||||
def auth_name(auth)
|
def auth_name(auth)
|
||||||
auth['info']['name']
|
case auth['provider']
|
||||||
|
when :microsoft_office365
|
||||||
|
auth['info']['display_name']
|
||||||
|
else
|
||||||
|
auth['info']['name']
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def auth_username(auth)
|
def auth_username(auth)
|
||||||
|
@ -83,7 +88,7 @@ class User < ApplicationRecord
|
||||||
when :twitter
|
when :twitter
|
||||||
auth['info']['image'].gsub("http", "https").gsub("_normal", "")
|
auth['info']['image'].gsub("http", "https").gsub("_normal", "")
|
||||||
else
|
else
|
||||||
auth['info']['image']
|
auth['info']['image'] unless auth['provider'] == :microsoft_office365
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -41,6 +41,12 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
<% if configured_providers.include? :microsoft_office365 %>
|
||||||
|
<%= link_to omniauth_login_url(:microsoft_office365), class: "btn btn-pill btn-primary btn-block" do %>
|
||||||
|
<i class="fab fa-windows"></i> <%= t("modal.login.with", provider: "Office365") %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<div class="or-line my-6">
|
<div class="or-line my-6">
|
||||||
<div>
|
<div>
|
||||||
<span class="text-uppercase">
|
<span class="text-uppercase">
|
||||||
|
|
|
@ -40,6 +40,12 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
<% if configured_providers.include? :microsoft_office365 %>
|
||||||
|
<%= link_to omniauth_login_url(:microsoft_office365), class: "btn btn-pill btn-primary btn-block" do %>
|
||||||
|
<i class="fab fa-windows"></i> <%= t("signup.with", provider: "Office365") %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<div class="or-line my-3">
|
<div class="or-line my-3">
|
||||||
<div>
|
<div>
|
||||||
<span class="text-uppercase" style="background-color: #F5F7FB;">
|
<span class="text-uppercase" style="background-color: #F5F7FB;">
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# List of supported Omniauth providers.
|
# List of supported Omniauth providers.
|
||||||
Rails.application.config.providers = [:google, :twitter, :ldap]
|
Rails.application.config.providers = [:google, :twitter, :microsoft_office365, :ldap]
|
||||||
|
|
||||||
# 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_microsoft_office365 = ENV['OFFICE365_KEY'].present? &&
|
||||||
|
ENV['OFFICE365_SECRET'].present?
|
||||||
Rails.application.config.omniauth_ldap = ENV['LDAP_SERVER'].present? && ENV['LDAP_UID'].present? &&
|
Rails.application.config.omniauth_ldap = ENV['LDAP_SERVER'].present? && ENV['LDAP_UID'].present? &&
|
||||||
ENV['LDAP_BASE'].present? && ENV['LDAP_BIND_DN'].present? &&
|
ENV['LDAP_BASE'].present? && ENV['LDAP_BIND_DN'].present? &&
|
||||||
ENV['LDAP_PASSWORD'].present?
|
ENV['LDAP_PASSWORD'].present?
|
||||||
|
@ -35,6 +37,8 @@ Rails.application.config.middleware.use OmniAuth::Builder do
|
||||||
name: 'google',
|
name: 'google',
|
||||||
hd: ENV['GOOGLE_OAUTH2_HD'].blank? ? nil : ENV['GOOGLE_OAUTH2_HD']
|
hd: ENV['GOOGLE_OAUTH2_HD'].blank? ? nil : ENV['GOOGLE_OAUTH2_HD']
|
||||||
|
|
||||||
|
provider :microsoft_office365, ENV['OFFICE365_KEY'], ENV['OFFICE365_SECRET']
|
||||||
|
|
||||||
provider :ldap,
|
provider :ldap,
|
||||||
host: ENV['LDAP_SERVER'],
|
host: ENV['LDAP_SERVER'],
|
||||||
port: ENV['LDAP_PORT'] || '389',
|
port: ENV['LDAP_PORT'] || '389',
|
||||||
|
|
|
@ -38,6 +38,15 @@ GOOGLE_OAUTH2_HD=
|
||||||
TWITTER_ID=
|
TWITTER_ID=
|
||||||
TWITTER_SECRET=
|
TWITTER_SECRET=
|
||||||
|
|
||||||
|
# Microsoft Office365 Login Provider (optional)
|
||||||
|
#
|
||||||
|
# For in-depth steps on setting up a Office 365 Login Provider, see:
|
||||||
|
#
|
||||||
|
# http://docs.bigbluebutton.org/install/greenlight-v2.html#office365-oauth2
|
||||||
|
#
|
||||||
|
OFFICE365_KEY=
|
||||||
|
OFFICE365_SECRET=
|
||||||
|
|
||||||
# LDAP Login Provider (optional)
|
# LDAP Login Provider (optional)
|
||||||
#
|
#
|
||||||
# You can enable LDAP authentication by providing values for the variables below.
|
# You can enable LDAP authentication by providing values for the variables below.
|
||||||
|
|
Loading…
Reference in New Issue