Work on omniauth setup

This commit is contained in:
Michael Ball 2019-12-19 03:06:12 -08:00
parent 8a35bb377e
commit 4d4bdd00c6
5 changed files with 49 additions and 50 deletions

View file

@ -40,10 +40,11 @@ gem 'devise_ichain_authenticatable'
# for openID authentication
gem 'omniauth'
gem 'omniauth-facebook'
gem 'omniauth-github'
# gem 'omniauth-facebook'
# gem 'omniauth-github'
gem 'omniauth-google-oauth2'
gem 'omniauth-openid'
# gem 'omniauth-openid'
gem 'omniauth-discourse'
# Bot-filtering
gem 'recaptcha', require: 'recaptcha/rails'

View file

@ -323,11 +323,8 @@ GEM
omniauth (1.9.0)
hashie (>= 3.4.6, < 3.7.0)
rack (>= 1.6.2, < 3)
omniauth-facebook (5.0.0)
omniauth-oauth2 (~> 1.2)
omniauth-github (1.3.0)
omniauth (~> 1.5)
omniauth-oauth2 (>= 1.4.0, < 2.0)
omniauth-discourse (1.0.0)
omniauth (~> 1.0)
omniauth-google-oauth2 (0.6.1)
jwt (>= 2.0)
omniauth (>= 1.1.1)
@ -335,9 +332,6 @@ GEM
omniauth-oauth2 (1.6.0)
oauth2 (~> 1.1)
omniauth (~> 1.9)
omniauth-openid (1.0.1)
omniauth (~> 1.0)
rack-openid (~> 1.3.1)
open4 (1.3.4)
orm_adapter (0.5.0)
paper_trail (10.3.1)
@ -379,9 +373,6 @@ GEM
public_suffix (3.1.1)
puma (3.12.2)
rack (2.0.7)
rack-openid (1.3.1)
rack (>= 1.1.0)
ruby-openid (>= 2.1.8)
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (5.2.3)
@ -498,7 +489,6 @@ GEM
rubocop-rspec (1.36.0)
rubocop (>= 0.68.1)
ruby-oembed (0.12.0)
ruby-openid (2.9.2)
ruby-progressbar (1.10.1)
ruby-rc4 (0.1.5)
ruby_dep (1.5.0)
@ -666,10 +656,8 @@ DEPENDENCIES
money-rails
nokogiri (>= 1.8.1)
omniauth
omniauth-facebook
omniauth-github
omniauth-discourse
omniauth-google-oauth2
omniauth-openid
paper_trail
pdf-inspector
pg

View file

@ -1,7 +1,14 @@
.text-center
.btn-group.btn-group-lg#openid-btn-grp
- omniauth_configured.each do |provider|
- if provider == :discourse
= link_to "user_#{provider}_omniauth_authorize".to_sym, class: "btn btn-success btn-lg",
id: "omniauth-#{provider}",
title: "Your #{provider} login" do
%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")

View file

@ -1,5 +1,6 @@
- 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
%span
Sign In

View file

@ -6,13 +6,15 @@ Devise.setup do |config|
# 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)
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),
name: 'google',
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 :github, (ENV['OSEM_GITHUB_KEY'] || Rails.application.secrets.github_key), (ENV['OSEM_GITHUB_SECRET'] || Rails.application.secrets.github_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 :discourse,
sso_url: "https://forum.snap.berkeley.edu/session/sso_provider",
sso_secret: ENV['OSEM_DISCOURSE_SECRET']
# ==> Mailer Configuration
# 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.