Work on omniauth setup
This commit is contained in:
parent
8a35bb377e
commit
4d4bdd00c6
5 changed files with 49 additions and 50 deletions
7
Gemfile
7
Gemfile
|
|
@ -40,10 +40,11 @@ gem 'devise_ichain_authenticatable'
|
||||||
|
|
||||||
# for openID authentication
|
# for openID authentication
|
||||||
gem 'omniauth'
|
gem 'omniauth'
|
||||||
gem 'omniauth-facebook'
|
# gem 'omniauth-facebook'
|
||||||
gem 'omniauth-github'
|
# gem 'omniauth-github'
|
||||||
gem 'omniauth-google-oauth2'
|
gem 'omniauth-google-oauth2'
|
||||||
gem 'omniauth-openid'
|
# gem 'omniauth-openid'
|
||||||
|
gem 'omniauth-discourse'
|
||||||
|
|
||||||
# Bot-filtering
|
# Bot-filtering
|
||||||
gem 'recaptcha', require: 'recaptcha/rails'
|
gem 'recaptcha', require: 'recaptcha/rails'
|
||||||
|
|
|
||||||
18
Gemfile.lock
18
Gemfile.lock
|
|
@ -323,11 +323,8 @@ GEM
|
||||||
omniauth (1.9.0)
|
omniauth (1.9.0)
|
||||||
hashie (>= 3.4.6, < 3.7.0)
|
hashie (>= 3.4.6, < 3.7.0)
|
||||||
rack (>= 1.6.2, < 3)
|
rack (>= 1.6.2, < 3)
|
||||||
omniauth-facebook (5.0.0)
|
omniauth-discourse (1.0.0)
|
||||||
omniauth-oauth2 (~> 1.2)
|
omniauth (~> 1.0)
|
||||||
omniauth-github (1.3.0)
|
|
||||||
omniauth (~> 1.5)
|
|
||||||
omniauth-oauth2 (>= 1.4.0, < 2.0)
|
|
||||||
omniauth-google-oauth2 (0.6.1)
|
omniauth-google-oauth2 (0.6.1)
|
||||||
jwt (>= 2.0)
|
jwt (>= 2.0)
|
||||||
omniauth (>= 1.1.1)
|
omniauth (>= 1.1.1)
|
||||||
|
|
@ -335,9 +332,6 @@ GEM
|
||||||
omniauth-oauth2 (1.6.0)
|
omniauth-oauth2 (1.6.0)
|
||||||
oauth2 (~> 1.1)
|
oauth2 (~> 1.1)
|
||||||
omniauth (~> 1.9)
|
omniauth (~> 1.9)
|
||||||
omniauth-openid (1.0.1)
|
|
||||||
omniauth (~> 1.0)
|
|
||||||
rack-openid (~> 1.3.1)
|
|
||||||
open4 (1.3.4)
|
open4 (1.3.4)
|
||||||
orm_adapter (0.5.0)
|
orm_adapter (0.5.0)
|
||||||
paper_trail (10.3.1)
|
paper_trail (10.3.1)
|
||||||
|
|
@ -379,9 +373,6 @@ GEM
|
||||||
public_suffix (3.1.1)
|
public_suffix (3.1.1)
|
||||||
puma (3.12.2)
|
puma (3.12.2)
|
||||||
rack (2.0.7)
|
rack (2.0.7)
|
||||||
rack-openid (1.3.1)
|
|
||||||
rack (>= 1.1.0)
|
|
||||||
ruby-openid (>= 2.1.8)
|
|
||||||
rack-test (1.1.0)
|
rack-test (1.1.0)
|
||||||
rack (>= 1.0, < 3)
|
rack (>= 1.0, < 3)
|
||||||
rails (5.2.3)
|
rails (5.2.3)
|
||||||
|
|
@ -498,7 +489,6 @@ GEM
|
||||||
rubocop-rspec (1.36.0)
|
rubocop-rspec (1.36.0)
|
||||||
rubocop (>= 0.68.1)
|
rubocop (>= 0.68.1)
|
||||||
ruby-oembed (0.12.0)
|
ruby-oembed (0.12.0)
|
||||||
ruby-openid (2.9.2)
|
|
||||||
ruby-progressbar (1.10.1)
|
ruby-progressbar (1.10.1)
|
||||||
ruby-rc4 (0.1.5)
|
ruby-rc4 (0.1.5)
|
||||||
ruby_dep (1.5.0)
|
ruby_dep (1.5.0)
|
||||||
|
|
@ -666,10 +656,8 @@ DEPENDENCIES
|
||||||
money-rails
|
money-rails
|
||||||
nokogiri (>= 1.8.1)
|
nokogiri (>= 1.8.1)
|
||||||
omniauth
|
omniauth
|
||||||
omniauth-facebook
|
omniauth-discourse
|
||||||
omniauth-github
|
|
||||||
omniauth-google-oauth2
|
omniauth-google-oauth2
|
||||||
omniauth-openid
|
|
||||||
paper_trail
|
paper_trail
|
||||||
pdf-inspector
|
pdf-inspector
|
||||||
pg
|
pg
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,14 @@
|
||||||
.text-center
|
.text-center
|
||||||
.btn-group.btn-group-lg#openid-btn-grp
|
.btn-group.btn-group-lg#openid-btn-grp
|
||||||
- omniauth_configured.each do |provider|
|
- omniauth_configured.each do |provider|
|
||||||
|
- if provider == :discourse
|
||||||
= link_to "user_#{provider}_omniauth_authorize".to_sym, class: "btn btn-success btn-lg",
|
= link_to "user_#{provider}_omniauth_authorize".to_sym, class: "btn btn-success btn-lg",
|
||||||
id: "omniauth-#{provider}",
|
id: "omniauth-#{provider}",
|
||||||
title: "Your #{provider} login" do
|
title: "Your #{provider} login" do
|
||||||
%i{class: "fa fa-#{provider}"}
|
%i{class: "fa fa-#{provider}"}
|
||||||
|
- else
|
||||||
|
= link_to("Snap! Account",
|
||||||
|
"user_#{provider}_omniauth_authorize".to_sym,
|
||||||
|
class: "btn btn-success btn-lg",
|
||||||
|
id: "omniauth-#{provider}",
|
||||||
|
title: "Your #{provider} login")
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
- if ENV['OSEM_ICHAIN_ENABLED'] != 'true'
|
- if ENV['OSEM_ICHAIN_ENABLED'] != 'true'
|
||||||
= form_tag(new_user_session_path, class: 'form-horizontal') do
|
.container
|
||||||
|
= form_tag(new_user_session_path, class: '') do
|
||||||
%legend
|
%legend
|
||||||
%span
|
%span
|
||||||
Sign In
|
Sign In
|
||||||
|
|
|
||||||
|
|
@ -6,13 +6,15 @@ Devise.setup do |config|
|
||||||
# Define the available openID providers that can be used to log in
|
# Define the available openID providers that can be used to log in
|
||||||
# Pass each provider to User model in :omniauth_providers (for open_id providers use their name)
|
# Pass each provider to User model in :omniauth_providers (for open_id providers use their name)
|
||||||
|
|
||||||
config.omniauth :open_id, name: 'suse', identifier: 'http://www.opensuse.org/openid/user'
|
# config.omniauth :open_id, name: 'suse', identifier: 'http://www.opensuse.org/openid/user'
|
||||||
config.omniauth :google_oauth2, (ENV['OSEM_GOOGLE_KEY'] || Rails.application.secrets.google_key), (ENV['OSEM_GOOGLE_SECRET'] || Rails.application.secrets.google_secret),
|
config.omniauth :google_oauth2, (ENV['OSEM_GOOGLE_KEY'] || Rails.application.secrets.google_key), (ENV['OSEM_GOOGLE_SECRET'] || Rails.application.secrets.google_secret),
|
||||||
name: 'google',
|
name: 'google',
|
||||||
scope: 'email'
|
scope: 'email'
|
||||||
config.omniauth :facebook, (ENV['OSEM_FACEBOOK_KEY'] || Rails.application.secrets.facebook_key), (ENV['OSEM_FACEBOOK_SECRET'] || Rails.application.secrets.facebook_secret)
|
# config.omniauth :facebook, (ENV['OSEM_FACEBOOK_KEY'] || Rails.application.secrets.facebook_key), (ENV['OSEM_FACEBOOK_SECRET'] || Rails.application.secrets.facebook_secret)
|
||||||
config.omniauth :github, (ENV['OSEM_GITHUB_KEY'] || Rails.application.secrets.github_key), (ENV['OSEM_GITHUB_SECRET'] || Rails.application.secrets.github_secret)
|
# config.omniauth :github, (ENV['OSEM_GITHUB_KEY'] || Rails.application.secrets.github_key), (ENV['OSEM_GITHUB_SECRET'] || Rails.application.secrets.github_secret)
|
||||||
|
config.omniauth :discourse,
|
||||||
|
sso_url: "https://forum.snap.berkeley.edu/session/sso_provider",
|
||||||
|
sso_secret: ENV['OSEM_DISCOURSE_SECRET']
|
||||||
# ==> Mailer Configuration
|
# ==> Mailer Configuration
|
||||||
# Configure the e-mail address which will be shown in Devise::Mailer,
|
# Configure the e-mail address which will be shown in Devise::Mailer,
|
||||||
# note that it will be overwritten if you use your own mailer class with default "from" parameter.
|
# note that it will be overwritten if you use your own mailer class with default "from" parameter.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue