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
|
||||
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'
|
||||
|
|
|
|||
18
Gemfile.lock
18
Gemfile.lock
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1,7 +1,14 @@
|
|||
.text-center
|
||||
.btn-group.btn-group-lg#openid-btn-grp
|
||||
- omniauth_configured.each do |provider|
|
||||
= 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}"}
|
||||
- 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")
|
||||
|
|
|
|||
|
|
@ -1,25 +1,26 @@
|
|||
- if ENV['OSEM_ICHAIN_ENABLED'] != 'true'
|
||||
= form_tag(new_user_session_path, class: 'form-horizontal') do
|
||||
%legend
|
||||
%span
|
||||
Sign In
|
||||
.form-group
|
||||
%label{for: "user[login]", class: 'col-sm-2 control-label'}
|
||||
Username
|
||||
.col-sm-10
|
||||
= text_field_tag 'user[login]', nil, placeholder: 'Username', class: 'form-control', required: 'required'
|
||||
.form-group
|
||||
%label{for: "user[password]", class: 'col-sm-2 control-label'}
|
||||
Password
|
||||
.col-sm-10
|
||||
= password_field_tag 'user[password]', nil, placeholder: 'Password', class: 'form-control', required: 'required'
|
||||
.form-group
|
||||
.col-sm-12
|
||||
%button.btn.btn-success.pull-right
|
||||
Sign in
|
||||
= render partial: 'devise/shared/openid'
|
||||
%p.text-right
|
||||
%a.small.btn.btn-default{"data-toggle" => "collapse", "data-target" => "#devise-help-sign-in"}
|
||||
Need Help?
|
||||
#devise-help-sign-in.collapse
|
||||
= render partial: 'devise/shared/links'
|
||||
.container
|
||||
= form_tag(new_user_session_path, class: '') do
|
||||
%legend
|
||||
%span
|
||||
Sign In
|
||||
.form-group
|
||||
%label{for: "user[login]", class: 'col-sm-2 control-label'}
|
||||
Username
|
||||
.col-sm-10
|
||||
= text_field_tag 'user[login]', nil, placeholder: 'Username', class: 'form-control', required: 'required'
|
||||
.form-group
|
||||
%label{for: "user[password]", class: 'col-sm-2 control-label'}
|
||||
Password
|
||||
.col-sm-10
|
||||
= password_field_tag 'user[password]', nil, placeholder: 'Password', class: 'form-control', required: 'required'
|
||||
.form-group
|
||||
.col-sm-12
|
||||
%button.btn.btn-success.pull-right
|
||||
Sign in
|
||||
= render partial: 'devise/shared/openid'
|
||||
%p.text-right
|
||||
%a.small.btn.btn-default{"data-toggle" => "collapse", "data-target" => "#devise-help-sign-in"}
|
||||
Need Help?
|
||||
#devise-help-sign-in.collapse
|
||||
= render partial: 'devise/shared/links'
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue