devise-multi_auth 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +5 -0
- data/.travis.yml +14 -0
- data/Gemfile +13 -0
- data/LICENSE +1 -1
- data/app/controllers/devise/multi_auth/{authentications_controller.rb → omniauth_callbacks_controller.rb} +1 -1
- data/app/services/devise/multi_auth/capture_successful_external_authentication.rb +5 -13
- data/bin/rails +8 -0
- data/devise-multi_auth.gemspec +35 -0
- data/lib/devise/multi_auth/version.rb +1 -1
- data/lib/generators/devise/multi_auth/install/install_generator.rb +1 -1
- data/spec/controllers/devise/multi_auth/omniauth_callbacks_controller_spec.rb +40 -0
- data/spec/factories/authentications.rb +9 -0
- data/spec/factories/users.rb +9 -0
- data/spec/lib/devise/multi_auth/exceptions_spec.rb +21 -0
- data/spec/lib/devise/multi_auth_spec.rb +32 -0
- data/spec/lib/devise_multi_auth_spec.rb +32 -0
- data/spec/models/devise/multi_auth/authentication_spec.rb +93 -0
- data/spec/services/devise/multi_auth/capture_successful_external_authentication_spec.rb +30 -0
- data/spec/spec_helper.rb +73 -0
- data/spec/support/devise_support.rb +3 -0
- data/spec/test_app_templates/Gemfile.extra +3 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +23 -0
- metadata +65 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 924b94e63a554cdfcec790815eb4ef6c5b31d656
|
4
|
+
data.tar.gz: b07a406b75377d253880a7b65fd331673d3ce304
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff4c2444fdf4c281aa3db2d90cbfdd91c1e2190e3e88cdaed320e81290b16d9a7d215d8baaa7a3db7629857915be8367d78731c4f9bf7f37530de5bf01e42d64
|
7
|
+
data.tar.gz: 26a30de405894e8c669e86cace2d4fd0f5b7f67f116b48e426d0b0aaa5012eea8a1049189833fcd2df230f99799bdf8c277f1fe159415cfcd749d98f4fe58fd3
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
# Declare your gem's dependencies in devise-multi_auth.gemspec.
|
4
|
+
# Bundler will treat runtime dependencies like base dependencies, and
|
5
|
+
# development dependencies will be added by default to the :development group.
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
# Declare any dependencies that are still in development here instead of in
|
9
|
+
# your gemspec. These might include edge Rails or gems from your path or
|
10
|
+
# Git. Remember to move these dependencies to your gemspec before releasing
|
11
|
+
# your gem to rubygems.org.
|
12
|
+
|
13
|
+
# To use debugger
|
data/LICENSE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
##########################################################################
|
2
2
|
#
|
3
|
-
# Copyright 2014
|
3
|
+
# Copyright 2014 University of Notre Dame
|
4
4
|
#
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
6
|
# you may not use this file except in compliance with the License.
|
@@ -1,18 +1,10 @@
|
|
1
1
|
module Devise::MultiAuth
|
2
|
-
|
3
|
-
|
2
|
+
module CaptureSuccessfulExternalAuthentication
|
3
|
+
module_function
|
4
|
+
def call(user, auth = {})
|
4
5
|
return true unless auth.present?
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
attr_accessor :user, :auth
|
9
|
-
def initialize(user, auth)
|
10
|
-
@user = user
|
11
|
-
@auth = auth
|
12
|
-
end
|
13
|
-
|
14
|
-
def call
|
15
|
-
object = Authentication.where(user: user).where(auth.slice(:provider, :uid)).first_or_initialize
|
6
|
+
where_conditions = { user: user, provider: auth.fetch(:provider), uid: auth.fetch(:uid) }
|
7
|
+
object = Authentication.where(where_conditions).first_or_initialize
|
16
8
|
object.access_token = auth.fetch(:credentials)[:token]
|
17
9
|
object.refresh_token = auth.fetch(:credentials)[:refresh_token]
|
18
10
|
object.save!
|
data/bin/rails
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 4 gems installed from the root of your application.
|
3
|
+
|
4
|
+
ENGINE_ROOT = File.expand_path('../..', __FILE__)
|
5
|
+
ENGINE_PATH = File.expand_path('../../lib/devise/multi_auth/engine', __FILE__)
|
6
|
+
|
7
|
+
require 'rails/all'
|
8
|
+
require 'rails/engine/commands'
|
@@ -0,0 +1,35 @@
|
|
1
|
+
$:.push File.expand_path("../lib", __FILE__)
|
2
|
+
|
3
|
+
# Maintain your gem's version:
|
4
|
+
require "devise/multi_auth/version"
|
5
|
+
|
6
|
+
# Describe your gem and declare its dependencies:
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = "devise-multi_auth"
|
9
|
+
s.version = Devise::MultiAuth::VERSION
|
10
|
+
s.authors = ["jeremy.n.friesen@gmail.com"]
|
11
|
+
s.email = ["jeremy.n.friesen@gmail.com"]
|
12
|
+
s.homepage = "https://github.com/jeremyf/devise-multi_auth"
|
13
|
+
s.summary = "A Devise plugin for exposing multiple authentication providers via omniauth."
|
14
|
+
s.description = "A Devise plugin for exposing multiple authentication providers via omniauth."
|
15
|
+
|
16
|
+
s.files = `git ls-files -z`.split("\x0")
|
17
|
+
# Deliberately removing bin executables as it appears to relate to
|
18
|
+
# https://github.com/cbeer/engine_cart/issues/9
|
19
|
+
s.executables = s.executables = s.files.grep(%r{^bin/}) do |f|
|
20
|
+
f == 'bin/rails' ? nil : File.basename(f)
|
21
|
+
end.compact
|
22
|
+
s.test_files = s.files.grep(/^(test|spec|features)\//)
|
23
|
+
s.require_paths = ['lib']
|
24
|
+
|
25
|
+
s.add_dependency "rails", "~> 4.0"
|
26
|
+
s.add_dependency "devise", "~> 3.2"
|
27
|
+
s.add_dependency "omniauth", "~> 1.2"
|
28
|
+
|
29
|
+
s.add_development_dependency 'database_cleaner', '1.0.1'
|
30
|
+
s.add_development_dependency "sqlite3"
|
31
|
+
s.add_development_dependency "engine_cart"
|
32
|
+
s.add_development_dependency "rspec-rails", '~> 2.12'
|
33
|
+
s.add_development_dependency "omniauth-github"
|
34
|
+
s.add_development_dependency "factory_girl"
|
35
|
+
end
|
@@ -27,7 +27,7 @@ module Devise::MultiAuth
|
|
27
27
|
if options[:with_omniauth_github]
|
28
28
|
gem "omniauth-github"
|
29
29
|
end
|
30
|
-
routing_code = %(, controllers: { omniauth_callbacks: 'devise/multi_auth/
|
30
|
+
routing_code = %(, controllers: { omniauth_callbacks: 'devise/multi_auth/omniauth_callbacks' }\n)
|
31
31
|
insert_into_file 'config/routes.rb', routing_code, { :after => /devise_for :users/, :verbose => false }
|
32
32
|
end
|
33
33
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Devise::MultiAuth
|
4
|
+
describe OmniauthCallbacksController do
|
5
|
+
let(:provider) { :github }
|
6
|
+
let(:uid) { '12345' }
|
7
|
+
before(:each) do
|
8
|
+
@request.env["devise.mapping"] = Devise.mappings[:user]
|
9
|
+
OmniAuth.config.add_mock(provider, {uid: uid, credentials: {}})
|
10
|
+
request.env["omniauth.auth"] = OmniAuth.config.mock_auth[provider]
|
11
|
+
end
|
12
|
+
|
13
|
+
context 'GET provider (as callback)' do
|
14
|
+
context 'without a registered user' do
|
15
|
+
before(:each) do
|
16
|
+
Authentication.should_receive(:find_user_by_provider_and_uid).with(provider.to_s, uid).and_return(nil)
|
17
|
+
end
|
18
|
+
it 'should redirect to signup' do
|
19
|
+
get provider
|
20
|
+
expect(response).to redirect_to('/users/sign_up')
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'with a registered user' do
|
25
|
+
let(:user) { FactoryGirl.create(:devise_multi_auth_user) }
|
26
|
+
before(:each) do
|
27
|
+
Authentication.should_receive(:find_user_by_provider_and_uid).with(provider.to_s, uid).and_return(user)
|
28
|
+
end
|
29
|
+
# Adding an ID because this request is hitting the database.
|
30
|
+
# Trying to figure out why.
|
31
|
+
it 'should assign the user and redirect to home' do
|
32
|
+
get provider
|
33
|
+
expect(flash[:notice]).to_not match(/translation missing/i)
|
34
|
+
expect(assigns(:user)).to eq(user)
|
35
|
+
expect(response).to be_redirect
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Devise::MultiAuth
|
4
|
+
describe AccessTokenError do
|
5
|
+
let(:parameters) { {provider: 'provider', uid: 'uid' }}
|
6
|
+
subject { described_class.new(parameters) }
|
7
|
+
it { should be_a_kind_of(AccessTokenError)}
|
8
|
+
end
|
9
|
+
|
10
|
+
describe AccessTokenNotFound do
|
11
|
+
let(:parameters) { {provider: 'provider', uid: 'uid' }}
|
12
|
+
subject { described_class.new(parameters) }
|
13
|
+
it { should be_a_kind_of(AccessTokenError)}
|
14
|
+
end
|
15
|
+
|
16
|
+
describe AccessTokenUnverified do
|
17
|
+
let(:parameters) { {provider: 'provider', uid: 'uid' }}
|
18
|
+
subject { described_class.new(parameters) }
|
19
|
+
it { should be_a_kind_of(AccessTokenError)}
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Devise::MultiAuth do
|
4
|
+
|
5
|
+
context '.oauth_client_for' do
|
6
|
+
context 'for registered oauth client' do
|
7
|
+
let(:provider) { 'github' }
|
8
|
+
subject { described_class.oauth_client_for(provider) }
|
9
|
+
its(:client_credentials) { should respond_to :get_token }
|
10
|
+
end
|
11
|
+
|
12
|
+
context 'for unregistered oauth client' do
|
13
|
+
let(:provider) { 'not_github' }
|
14
|
+
it 'raises an exception' do
|
15
|
+
expect {
|
16
|
+
described_class.oauth_client_for(provider)
|
17
|
+
}.to raise_error KeyError
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
context '.capture_successful_external_authentication' do
|
23
|
+
let(:service) { double('Service') }
|
24
|
+
let(:user) { double('User') }
|
25
|
+
let(:auth) { double('Auth') }
|
26
|
+
it 'should delegate to the associated service' do
|
27
|
+
service.should_receive(:call).with(user, auth)
|
28
|
+
described_class.capture_successful_external_authentication(user, auth, service: service)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Devise::MultiAuth do
|
4
|
+
|
5
|
+
context '.oauth_client_for' do
|
6
|
+
context 'for registered oauth client' do
|
7
|
+
let(:provider) { 'github' }
|
8
|
+
subject { described_class.oauth_client_for(provider) }
|
9
|
+
its(:client_credentials) { should respond_to :get_token }
|
10
|
+
end
|
11
|
+
|
12
|
+
context 'for unregistered oauth client' do
|
13
|
+
let(:provider) { 'not_github' }
|
14
|
+
it 'raises an exception' do
|
15
|
+
expect {
|
16
|
+
described_class.oauth_client_for(provider)
|
17
|
+
}.to raise_error KeyError
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
context '.capture_successful_external_authentication' do
|
23
|
+
let(:service) { double('Service') }
|
24
|
+
let(:user) { double('User') }
|
25
|
+
let(:auth) { double('Auth') }
|
26
|
+
it 'should delegate to the associated service' do
|
27
|
+
service.should_receive(:call).with(user, auth)
|
28
|
+
described_class.capture_successful_external_authentication(user, auth, service: service)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Devise::MultiAuth
|
4
|
+
describe Authentication do
|
5
|
+
let(:provider) { 'orcid' }
|
6
|
+
let(:uid) { '0000-0002-1117-8571' }
|
7
|
+
|
8
|
+
let(:attributes) {
|
9
|
+
{
|
10
|
+
"user_id"=>1,
|
11
|
+
"provider"=>provider,
|
12
|
+
"uid"=>uid,
|
13
|
+
"access_token"=>"4a8e9a1a-e53a-448b-b81d-e541c347a711",
|
14
|
+
"refresh_token"=>"b39b89ce-92df-4d99-bd25-309a869d201a"
|
15
|
+
}
|
16
|
+
}
|
17
|
+
|
18
|
+
context '.to_access_token' do
|
19
|
+
let(:client) { double('Client') }
|
20
|
+
context 'with a created token'do
|
21
|
+
before(:each) do
|
22
|
+
described_class.create!(attributes)
|
23
|
+
end
|
24
|
+
subject { described_class.to_access_token(uid: uid, provider: provider, client: client) }
|
25
|
+
it { should respond_to :get }
|
26
|
+
it { should respond_to :post }
|
27
|
+
it { should respond_to :refresh! }
|
28
|
+
it { should respond_to :expires? }
|
29
|
+
it { should respond_to :expires? }
|
30
|
+
end
|
31
|
+
|
32
|
+
context 'with a missing token' do
|
33
|
+
it 'raises an error' do
|
34
|
+
expect{ described_class.to_access_token(uid: uid, provider: provider, client: client) }.to raise_error(AccessTokenNotFound)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
context '#to_access_token' do
|
40
|
+
let(:client) { double('Client') }
|
41
|
+
subject { described_class.new(attributes) }
|
42
|
+
|
43
|
+
context 'without verified authentication' do
|
44
|
+
its(:verified?) { should eq(true) }
|
45
|
+
it { expect(subject.to_access_token(client: client)).to respond_to :get }
|
46
|
+
it { expect(subject.to_access_token(client: client)).to respond_to :post }
|
47
|
+
it { expect(subject.to_access_token(client: client)).to respond_to :refresh! }
|
48
|
+
it { expect(subject.to_access_token(client: client)).to respond_to :expires? }
|
49
|
+
end
|
50
|
+
|
51
|
+
context 'without verified authentication' do
|
52
|
+
subject { described_class.new(attributes) }
|
53
|
+
let(:attributes) {
|
54
|
+
{
|
55
|
+
"user_id"=>1,
|
56
|
+
"provider"=>provider,
|
57
|
+
"uid"=>uid,
|
58
|
+
}
|
59
|
+
}
|
60
|
+
its(:verified?) { should eq(false) }
|
61
|
+
it {
|
62
|
+
expect { subject.to_access_token(client: client) }.to raise_error(Devise::MultiAuth::AccessTokenUnverified)
|
63
|
+
}
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
context '.find_by_provider_and_uid' do
|
68
|
+
it 'retrieves the object' do
|
69
|
+
authentication = Authentication.create!(attributes)
|
70
|
+
|
71
|
+
expect(described_class.find_by_provider_and_uid(provider, uid)).to eq(authentication)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
context '.find_user_by_provider_and_uid' do
|
76
|
+
let(:user) { mock_model(User) }
|
77
|
+
let(:authentication) { described_class.new(user: user) }
|
78
|
+
|
79
|
+
it 'returns a user if it matches' do
|
80
|
+
described_class.should_receive(:find_by_provider_and_uid).with(provider, uid).and_return(authentication)
|
81
|
+
expect(
|
82
|
+
described_class.find_user_by_provider_and_uid(provider, uid)
|
83
|
+
).to eq(user)
|
84
|
+
end
|
85
|
+
|
86
|
+
it 'returns nil if there are no match' do
|
87
|
+
described_class.should_receive(:find_by_provider_and_uid).with(provider, uid).and_return(nil)
|
88
|
+
expect(described_class.find_user_by_provider_and_uid(provider, uid)).to eq(nil)
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Devise::MultiAuth
|
4
|
+
describe CaptureSuccessfulExternalAuthentication do
|
5
|
+
context '.call' do
|
6
|
+
let(:user) { FactoryGirl.build_stubbed(:devise_multi_auth_user) }
|
7
|
+
let(:orcid_profile_id) { '0100-0012' }
|
8
|
+
let(:auth) {
|
9
|
+
{
|
10
|
+
provider: 'orcid',
|
11
|
+
uid: orcid_profile_id,
|
12
|
+
credentials: {
|
13
|
+
token: "453d7dc4-cfed-4e8e-a06d-e035bbb2b835",
|
14
|
+
refresh_token: "1ae4a374-d3ac-4e3f-b1b3-72956cc37f49",
|
15
|
+
expires_at: 2023450872,
|
16
|
+
expires: true
|
17
|
+
}
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
it 'creates an authentication' do
|
22
|
+
CaptureSuccessfulExternalAuthentication.call(user, auth)
|
23
|
+
|
24
|
+
authentication = Authentication.last
|
25
|
+
expect(authentication.access_token).to eq auth[:credentials][:token]
|
26
|
+
expect(authentication.refresh_token).to eq auth[:credentials][:refresh_token]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
2
|
+
ENV["RAILS_ENV"] ||= 'test'
|
3
|
+
if ENV['COVERAGE']
|
4
|
+
require 'simplecov'
|
5
|
+
SimpleCov.start 'rails'
|
6
|
+
SimpleCov.command_name "spec"
|
7
|
+
end
|
8
|
+
|
9
|
+
require 'engine_cart'
|
10
|
+
require 'omniauth-github'
|
11
|
+
|
12
|
+
require File.expand_path("../internal/config/environment.rb", __FILE__)
|
13
|
+
|
14
|
+
EngineCart.load_application!
|
15
|
+
require 'rspec/rails'
|
16
|
+
require 'rspec/autorun'
|
17
|
+
require 'database_cleaner'
|
18
|
+
require 'factory_girl'
|
19
|
+
|
20
|
+
# Requires supporting ruby files with custom matchers and macros, etc,
|
21
|
+
# in spec/support/ and its subdirectories.
|
22
|
+
Dir[File.expand_path("../support/**/*.rb",__FILE__)].each {|f| require f}
|
23
|
+
Dir[File.expand_path("../factories/**/*.rb",__FILE__)].each {|f| require f}
|
24
|
+
|
25
|
+
# From https://github.com/plataformatec/devise/wiki/How-To:-Stub-authentication-in-controller-specs
|
26
|
+
module ControllerHelpers
|
27
|
+
def sign_in(user = double('user'))
|
28
|
+
if user.nil?
|
29
|
+
request.env['warden'].stub(:authenticate!).
|
30
|
+
and_throw(:warden, {:scope => :user})
|
31
|
+
controller.stub :current_user => nil
|
32
|
+
else
|
33
|
+
request.env['warden'].stub :authenticate! => user
|
34
|
+
controller.stub :current_user => user
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
RSpec.configure do |config|
|
40
|
+
config.include ControllerHelpers, type: :controller
|
41
|
+
|
42
|
+
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
43
|
+
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
44
|
+
|
45
|
+
config.infer_spec_type_from_file_location!
|
46
|
+
|
47
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
48
|
+
# examples within a transaction, remove the following line or assign false
|
49
|
+
# instead of true.
|
50
|
+
config.use_transactional_fixtures = true
|
51
|
+
|
52
|
+
# If true, the base class of anonymous controllers will be inferred
|
53
|
+
# automatically. This will be the default behavior in future versions of
|
54
|
+
# rspec-rails.
|
55
|
+
config.infer_base_class_for_anonymous_controllers = false
|
56
|
+
|
57
|
+
# Run specs in random order to surface order dependencies. If you find an
|
58
|
+
# order dependency and want to debug it, you can fix the order by providing
|
59
|
+
# the seed, which is printed after each run.
|
60
|
+
# --seed 1234
|
61
|
+
config.order = "random"
|
62
|
+
|
63
|
+
config.before(:suite) do
|
64
|
+
DatabaseCleaner.strategy = :truncation
|
65
|
+
end
|
66
|
+
config.before(:each) do
|
67
|
+
OmniAuth.config.test_mode = true
|
68
|
+
DatabaseCleaner.start
|
69
|
+
end
|
70
|
+
config.after(:each) do
|
71
|
+
DatabaseCleaner.clean
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
class TestAppGenerator < Rails::Generators::Base
|
4
|
+
source_root "spec/test_app_templates"
|
5
|
+
|
6
|
+
def install_devise_multi_auth
|
7
|
+
generate 'devise:multi_auth:install --install_devise --skip_migrate --with_omniauth_github'
|
8
|
+
end
|
9
|
+
|
10
|
+
def install_omniauth_strategies
|
11
|
+
config_code = ", :omniauthable, :omniauth_providers => [:github]"
|
12
|
+
insert_into_file 'app/models/user.rb', config_code, { :after => /:validatable *$/, :verbose => false }
|
13
|
+
|
14
|
+
init_code = %(\n config.omniauth :github, ENV['GITHUB_APP_ID'], ENV['GITHUB_APP_SECRET'], :scope => 'user,public_repo')
|
15
|
+
insert_into_file 'config/initializers/devise.rb', init_code, {after: /Devise\.setup.*$/, verbose: true}
|
16
|
+
end
|
17
|
+
|
18
|
+
def install_migrate
|
19
|
+
rake 'db:migrate'
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
metadata
CHANGED
@@ -1,57 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devise-multi_auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jeremy.n.friesen@gmail.com
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 4.0
|
19
|
+
version: '4.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 4.0
|
26
|
+
version: '4.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: devise
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 3.2
|
33
|
+
version: '3.2'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 3.2
|
40
|
+
version: '3.2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: omniauth
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.2
|
47
|
+
version: '1.2'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.2
|
54
|
+
version: '1.2'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: database_cleaner
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -70,70 +70,70 @@ dependencies:
|
|
70
70
|
name: sqlite3
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: engine_cart
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rspec-rails
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
103
|
+
version: '2.12'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
110
|
+
version: '2.12'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: omniauth-github
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: factory_girl
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- -
|
129
|
+
- - ">="
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '0'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- -
|
136
|
+
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
description: A Devise plugin for exposing multiple authentication providers via omniauth.
|
@@ -143,21 +143,38 @@ executables: []
|
|
143
143
|
extensions: []
|
144
144
|
extra_rdoc_files: []
|
145
145
|
files:
|
146
|
-
-
|
146
|
+
- ".gitignore"
|
147
|
+
- ".travis.yml"
|
148
|
+
- Gemfile
|
149
|
+
- LICENSE
|
150
|
+
- README.md
|
151
|
+
- Rakefile
|
152
|
+
- app/controllers/devise/multi_auth/omniauth_callbacks_controller.rb
|
147
153
|
- app/models/devise/multi_auth/authentication.rb
|
148
154
|
- app/services/devise/multi_auth/capture_successful_external_authentication.rb
|
155
|
+
- bin/rails
|
149
156
|
- db/migrate/20140204141526_create_authentications.rb
|
157
|
+
- devise-multi_auth.gemspec
|
158
|
+
- lib/devise-multi_auth.rb
|
159
|
+
- lib/devise/multi_auth.rb
|
150
160
|
- lib/devise/multi_auth/engine.rb
|
151
161
|
- lib/devise/multi_auth/exceptions.rb
|
152
162
|
- lib/devise/multi_auth/version.rb
|
153
|
-
- lib/devise/multi_auth.rb
|
154
|
-
- lib/devise-multi_auth.rb
|
155
163
|
- lib/devise_multi_auth.rb
|
156
164
|
- lib/generators/devise/multi_auth/install/install_generator.rb
|
157
165
|
- lib/tasks/devise-multi_auth_tasks.rake
|
158
|
-
-
|
159
|
-
-
|
160
|
-
-
|
166
|
+
- spec/controllers/devise/multi_auth/omniauth_callbacks_controller_spec.rb
|
167
|
+
- spec/factories/authentications.rb
|
168
|
+
- spec/factories/users.rb
|
169
|
+
- spec/lib/devise/multi_auth/exceptions_spec.rb
|
170
|
+
- spec/lib/devise/multi_auth_spec.rb
|
171
|
+
- spec/lib/devise_multi_auth_spec.rb
|
172
|
+
- spec/models/devise/multi_auth/authentication_spec.rb
|
173
|
+
- spec/services/devise/multi_auth/capture_successful_external_authentication_spec.rb
|
174
|
+
- spec/spec_helper.rb
|
175
|
+
- spec/support/devise_support.rb
|
176
|
+
- spec/test_app_templates/Gemfile.extra
|
177
|
+
- spec/test_app_templates/lib/generators/test_app_generator.rb
|
161
178
|
homepage: https://github.com/jeremyf/devise-multi_auth
|
162
179
|
licenses: []
|
163
180
|
metadata: {}
|
@@ -167,18 +184,30 @@ require_paths:
|
|
167
184
|
- lib
|
168
185
|
required_ruby_version: !ruby/object:Gem::Requirement
|
169
186
|
requirements:
|
170
|
-
- -
|
187
|
+
- - ">="
|
171
188
|
- !ruby/object:Gem::Version
|
172
189
|
version: '0'
|
173
190
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
174
191
|
requirements:
|
175
|
-
- -
|
192
|
+
- - ">="
|
176
193
|
- !ruby/object:Gem::Version
|
177
194
|
version: '0'
|
178
195
|
requirements: []
|
179
196
|
rubyforge_project:
|
180
|
-
rubygems_version: 2.
|
197
|
+
rubygems_version: 2.2.2
|
181
198
|
signing_key:
|
182
199
|
specification_version: 4
|
183
200
|
summary: A Devise plugin for exposing multiple authentication providers via omniauth.
|
184
|
-
test_files:
|
201
|
+
test_files:
|
202
|
+
- spec/controllers/devise/multi_auth/omniauth_callbacks_controller_spec.rb
|
203
|
+
- spec/factories/authentications.rb
|
204
|
+
- spec/factories/users.rb
|
205
|
+
- spec/lib/devise/multi_auth/exceptions_spec.rb
|
206
|
+
- spec/lib/devise/multi_auth_spec.rb
|
207
|
+
- spec/lib/devise_multi_auth_spec.rb
|
208
|
+
- spec/models/devise/multi_auth/authentication_spec.rb
|
209
|
+
- spec/services/devise/multi_auth/capture_successful_external_authentication_spec.rb
|
210
|
+
- spec/spec_helper.rb
|
211
|
+
- spec/support/devise_support.rb
|
212
|
+
- spec/test_app_templates/Gemfile.extra
|
213
|
+
- spec/test_app_templates/lib/generators/test_app_generator.rb
|