Amazon SSO added
This commit is contained in:
parent
2a7491edcd
commit
65723d3063
7 changed files with 25 additions and 3 deletions
2
Gemfile
2
Gemfile
|
|
@ -117,7 +117,7 @@ gem "sprockets"
|
|||
|
||||
# Authentication against Google, Facebook and others
|
||||
gem 'omniauth'
|
||||
# gem 'omniauth-amazon'
|
||||
gem 'omniauth-amazon'
|
||||
gem 'omniauth-google-oauth2'
|
||||
# gem 'omniauth-github'
|
||||
# gem 'omniauth-twitter'
|
||||
|
|
|
|||
|
|
@ -170,6 +170,9 @@ GEM
|
|||
omniauth (1.6.1)
|
||||
hashie (>= 3.4.6, < 3.6.0)
|
||||
rack (>= 1.6.2, < 3)
|
||||
omniauth-amazon (1.0.1)
|
||||
omniauth (~> 1.0)
|
||||
omniauth-oauth2 (~> 1.1)
|
||||
omniauth-google-oauth2 (0.4.1)
|
||||
jwt (~> 1.5.2)
|
||||
multi_json (~> 1.3)
|
||||
|
|
@ -326,6 +329,7 @@ DEPENDENCIES
|
|||
minitest-rails
|
||||
minitest-reporters
|
||||
omniauth
|
||||
omniauth-amazon
|
||||
omniauth-google-oauth2
|
||||
omniauth-openid
|
||||
paperclip
|
||||
|
|
|
|||
|
|
@ -9,7 +9,11 @@ Documentation on omniauth:
|
|||
https://github.com/omniauth/omniauth/wiki/List-of-Strategies
|
||||
https://github.com/plataformatec/devise/wiki/OmniAuth:-Overview
|
||||
|
||||
## Google+
|
||||
List of strategies:
|
||||
|
||||
https://github.com/omniauth/omniauth/wiki/List-of-Strategies
|
||||
|
||||
## Google
|
||||
|
||||
The client ID for the debshots and the private key must be set as environment
|
||||
variables before running the application:
|
||||
|
|
@ -19,6 +23,13 @@ variables before running the application:
|
|||
|
||||
## Amazon
|
||||
|
||||
The client ID for the debshots and the secret must be set as environment
|
||||
variables before running the application:
|
||||
|
||||
* AMAZON_CLIENT_ID=…
|
||||
* AMAZON_CLIENT_SECRET=…
|
||||
|
||||
|
||||
Client ID:
|
||||
|
||||
amzn1.application-oa2-client.78d832919fc24456b0636762cf18efd9
|
||||
|
|
|
|||
|
|
@ -15,6 +15,10 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
|||
login_via 'Google'
|
||||
end
|
||||
|
||||
def amazon
|
||||
login_via 'Amazon'
|
||||
end
|
||||
|
||||
def login_via(provider_name)
|
||||
# You need to implement the method below in your model (e.g. app/models/user.rb)
|
||||
@user = User.from_omniauth(request.env["omniauth.auth"])
|
||||
|
|
|
|||
|
|
@ -13,7 +13,8 @@ class User < ApplicationRecord
|
|||
:omniauthable, :omniauth_providers => [
|
||||
:launchpad,
|
||||
:stackexchange,
|
||||
:google_oauth2
|
||||
:google_oauth2,
|
||||
:amazon
|
||||
]
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
= link_to "Sign in with Launchpad", user_launchpad_omniauth_authorize_path
|
||||
= link_to "Sign in with StackExchange", user_stackexchange_omniauth_authorize_path
|
||||
= link_to "Sign in with Google", user_google_oauth2_omniauth_authorize_path
|
||||
= link_to "Sign in with Amazon", user_amazon_omniauth_authorize_path
|
||||
|
||||
/ div
|
||||
/ = link_to image_tag('/images/sso/google.png'), user_google_oauth2_omniauth_authorize_path
|
||||
|
|
|
|||
|
|
@ -281,6 +281,7 @@ Devise.setup do |config|
|
|||
config.omniauth :open_id, name: :stackexchange, identifier: 'https://openid.stackexchange.com', :client_options => {:ssl => {:ca_path => '/etc/ssl/certs'}}
|
||||
config.omniauth :open_id, name: :launchpad, identifier: 'https://login.ubuntu.com', :client_options => {:ssl => {:ca_path => '/etc/ssl/certs'}}
|
||||
|
||||
config.omniauth :amazon, ENV['AMAZON_CLIENT_ID'], ENV['AMAZON_CLIENT_SECRET'], :client_options => {:ssl => {:ca_path => '/etc/ssl/certs'}}
|
||||
|
||||
# client_options: {ssl: {ca_path: '/etc/ssl/certs'}}
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue