Fixed #291 Added OAuth2 for Office365 (GRN-32) (#293)

* <Added omniauth for office365>

* <Fixed code style>

* Update puma.rb

* <Inserted link to documentation>
This commit is contained in:
John Ma
2018-10-16 12:58:06 -04:00
committed by Jesus Federico
parent 90b965d03f
commit ec250f3ed5
7 changed files with 38 additions and 3 deletions

View File

@ -1,11 +1,13 @@
# frozen_string_literal: true
# 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.
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_microsoft_office365 = ENV['OFFICE365_KEY'].present? &&
ENV['OFFICE365_SECRET'].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_PASSWORD'].present?
@ -35,6 +37,8 @@ Rails.application.config.middleware.use OmniAuth::Builder do
name: 'google',
hd: ENV['GOOGLE_OAUTH2_HD'].blank? ? nil : ENV['GOOGLE_OAUTH2_HD']
provider :microsoft_office365, ENV['OFFICE365_KEY'], ENV['OFFICE365_SECRET']
provider :ldap,
host: ENV['LDAP_SERVER'],
port: ENV['LDAP_PORT'] || '389',