omniauth-identity 1.1.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +3 -1
- data/.rspec +2 -1
- data/CHANGELOG.md +27 -0
- data/Gemfile +2 -0
- data/LICENSE +21 -0
- data/README.markdown +14 -12
- data/lib/omniauth-identity/version.rb +1 -1
- data/lib/omniauth/identity.rb +0 -1
- data/lib/omniauth/identity/model.rb +5 -4
- data/omniauth-identity.gemspec +12 -12
- data/spec/omniauth/identity/model_spec.rb +36 -38
- data/spec/omniauth/identity/models/active_record_spec.rb +10 -8
- data/spec/omniauth/identity/models/couch_potato_spec.rb +7 -6
- data/spec/omniauth/identity/models/data_mapper_spec.rb +8 -6
- data/spec/omniauth/identity/models/mongoid_spec.rb +13 -8
- data/spec/omniauth/identity/secure_password_spec.rb +3 -5
- data/spec/omniauth/strategies/identity_spec.rb +21 -23
- data/spec/spec_helper.rb +6 -0
- metadata +69 -62
- data/Gemfile.lock +0 -179
- data/lib/omniauth/identity/models/mongo_mapper.rb +0 -28
- data/spec/omniauth/identity/models/mongo_mapper_spec.rb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3ae0c6e9acba482e20f1284d42f157beb243b7efe00913b420e1d97ee158d0d2
|
4
|
+
data.tar.gz: c113d2a6e9f701ae8b7a524e7aede16bfce000f593f194e577b38a2cb02a10c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f8cbd06676c3b16661651bf161e4bf819e8b48529aec572d2a7ddb52e5a4dde87bf52e71933be86af22486f03b4a4d5710417db79803b1bba93357258122330
|
7
|
+
data.tar.gz: 36a5d520208b6d0754d5d3e7fb7990b27b9bd967b598039bf6d37bf0e8167e2e8c7689df79a8aeee9a6d9187b2a1d2653d02e99025444157183d0072323807ae
|
data/.gitignore
CHANGED
data/.rspec
CHANGED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
|
5
|
+
|
6
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
7
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
8
|
+
|
9
|
+
## [2.0] - 2020-09-01
|
10
|
+
|
11
|
+
### Added
|
12
|
+
- CHANGELOG to maintain a history of changes.
|
13
|
+
- Include mongoid-rspec gem.
|
14
|
+
|
15
|
+
### Changed
|
16
|
+
- Fix failing Specs
|
17
|
+
- Update Spec syntax to RSpec 3
|
18
|
+
- Fix deprecation Warnings
|
19
|
+
- Updated mongoid_spec.rb to leverage mongoid-rspec features.
|
20
|
+
- Fix security warning about missing secret in session cookie.
|
21
|
+
- Dependency version limits so that the most up-to-date gem dependencies are used. (rspec 3+, mongo 2+, mongoid 7+, rake 13+, rack 2+, json 2+)
|
22
|
+
- Updated copyright information.
|
23
|
+
- Updated MongoMapper section of README to reflect its discontinued support.
|
24
|
+
|
25
|
+
### Removed
|
26
|
+
- Gemfile.lock file
|
27
|
+
- MongoMapper support; unable to satisfy dependencies of both MongoMapper and Mongoig now that MongoMapper is no longer actively maintained.
|
data/Gemfile
CHANGED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
Copyright (c) 2020- Andrew Roberts, and Jellybooks Ltd.
|
2
|
+
Copyright (c) 2010-2015 Michael Bleigh and Intridea, Inc.
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
a copy of this software and associated documentation files (the
|
6
|
+
"Software"), to deal in the Software without restriction, including
|
7
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be
|
13
|
+
included in all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.markdown
CHANGED
@@ -60,19 +60,12 @@ end
|
|
60
60
|
|
61
61
|
### MongoMapper
|
62
62
|
|
63
|
-
|
64
|
-
|
63
|
+
Unfortunately MongoMapper is **not supported** in `omniauth-identity` from >= v2.0 as a result of it
|
64
|
+
not being maintained for several years.
|
65
65
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
include OmniAuth::Identity::Models::MongoMapper
|
70
|
-
|
71
|
-
key :email, String
|
72
|
-
key :name, String
|
73
|
-
key :password_digest, String
|
74
|
-
end
|
75
|
-
```
|
66
|
+
It wasn't possible to include Mongoid *and* MongoMapper due to incompatible gem version
|
67
|
+
requirements. Therefore precedence was given to Mongoid as it is significantly more
|
68
|
+
popular and actively maintained.
|
76
69
|
|
77
70
|
### DataMapper
|
78
71
|
|
@@ -200,3 +193,12 @@ object as a parameter. Note that model.auth_key defaults to 'email', but is al
|
|
200
193
|
Note: Be careful when customizing locate_conditions. The best way to modify the conditions is
|
201
194
|
to copy the default value, and then add to the hash. Removing the default condition will almost
|
202
195
|
always break things!
|
196
|
+
|
197
|
+
## License
|
198
|
+
|
199
|
+
MIT License. See LICENSE for details.
|
200
|
+
|
201
|
+
## Copyright
|
202
|
+
|
203
|
+
Copyright (c) 2020- Andrew Roberts, and Jellybooks Ltd.
|
204
|
+
Copyright (c) 2010-2015 Michael Bleigh, and Intridea, Inc.
|
data/lib/omniauth/identity.rb
CHANGED
@@ -10,7 +10,6 @@ module OmniAuth
|
|
10
10
|
autoload :SecurePassword, 'omniauth/identity/secure_password'
|
11
11
|
module Models
|
12
12
|
autoload :ActiveRecord, 'omniauth/identity/models/active_record'
|
13
|
-
autoload :MongoMapper, 'omniauth/identity/models/mongo_mapper'
|
14
13
|
autoload :Mongoid, 'omniauth/identity/models/mongoid'
|
15
14
|
autoload :DataMapper, 'omniauth/identity/models/data_mapper'
|
16
15
|
autoload :CouchPotatoModule, 'omniauth/identity/models/couch_potato'
|
@@ -75,7 +75,7 @@ module OmniAuth
|
|
75
75
|
#
|
76
76
|
# @return [String] An identifier string unique to this identity.
|
77
77
|
def uid
|
78
|
-
if respond_to?(
|
78
|
+
if respond_to?(:id)
|
79
79
|
return nil if self.id.nil?
|
80
80
|
self.id.to_s
|
81
81
|
else
|
@@ -90,7 +90,7 @@ module OmniAuth
|
|
90
90
|
# @return [String] An identifying string that will be entered by
|
91
91
|
# users upon sign in.
|
92
92
|
def auth_key
|
93
|
-
if respond_to?(self.class.auth_key)
|
93
|
+
if respond_to?(self.class.auth_key.to_sym)
|
94
94
|
send(self.class.auth_key)
|
95
95
|
else
|
96
96
|
raise NotImplementedError
|
@@ -104,8 +104,9 @@ module OmniAuth
|
|
104
104
|
# @param [String] value The value to which the auth key should be
|
105
105
|
# set.
|
106
106
|
def auth_key=(value)
|
107
|
-
|
108
|
-
|
107
|
+
auth_key_setter = (self.class.auth_key + '=').to_sym
|
108
|
+
if respond_to?(auth_key_setter)
|
109
|
+
send(auth_key_setter, value)
|
109
110
|
else
|
110
111
|
raise NotImplementedError
|
111
112
|
end
|
data/omniauth-identity.gemspec
CHANGED
@@ -2,28 +2,28 @@
|
|
2
2
|
require File.dirname(__FILE__) + '/lib/omniauth-identity/version'
|
3
3
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
|
-
gem.add_runtime_dependency 'omniauth'
|
6
|
-
gem.add_runtime_dependency 'bcrypt
|
5
|
+
gem.add_runtime_dependency 'omniauth'
|
6
|
+
gem.add_runtime_dependency 'bcrypt'
|
7
7
|
|
8
|
-
gem.add_development_dependency 'maruku'
|
9
|
-
gem.add_development_dependency 'simplecov'
|
10
|
-
gem.add_development_dependency 'rack-test'
|
11
|
-
gem.add_development_dependency 'rake'
|
12
|
-
gem.add_development_dependency 'rspec', '~>
|
13
|
-
gem.add_development_dependency 'activerecord'
|
8
|
+
gem.add_development_dependency 'maruku'
|
9
|
+
gem.add_development_dependency 'simplecov'
|
10
|
+
gem.add_development_dependency 'rack-test'
|
11
|
+
gem.add_development_dependency 'rake'
|
12
|
+
gem.add_development_dependency 'rspec', '~> 3'
|
13
|
+
gem.add_development_dependency 'activerecord'
|
14
14
|
gem.add_development_dependency 'mongoid'
|
15
|
-
gem.add_development_dependency 'mongo_mapper'
|
16
15
|
gem.add_development_dependency 'datamapper'
|
17
16
|
gem.add_development_dependency 'bson_ext'
|
17
|
+
gem.add_development_dependency 'byebug'
|
18
18
|
gem.add_development_dependency 'couch_potato'
|
19
19
|
|
20
20
|
gem.name = 'omniauth-identity'
|
21
21
|
gem.version = OmniAuth::Identity::VERSION
|
22
22
|
gem.description = %q{Internal authentication handlers for OmniAuth.}
|
23
23
|
gem.summary = gem.description
|
24
|
-
gem.
|
25
|
-
gem.
|
26
|
-
gem.
|
24
|
+
gem.homepage = 'http://github.com/omniauth/omniauth-identity'
|
25
|
+
gem.authors = ['Andrew Roberts', 'Michael Bleigh']
|
26
|
+
gem.license = 'MIT'
|
27
27
|
gem.executables = `git ls-files -- bin/*`.split("\n").map{|f| File.basename(f)}
|
28
28
|
gem.files = `git ls-files`.split("\n")
|
29
29
|
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
1
|
class ExampleModel
|
4
2
|
include OmniAuth::Identity::Model
|
5
3
|
end
|
@@ -9,25 +7,25 @@ describe OmniAuth::Identity::Model do
|
|
9
7
|
subject{ ExampleModel }
|
10
8
|
|
11
9
|
describe '.locate' do
|
12
|
-
it('should be abstract'){
|
10
|
+
it('should be abstract'){ expect{ subject.locate('abc') }.to raise_error(NotImplementedError) }
|
13
11
|
end
|
14
12
|
|
15
13
|
describe '.authenticate' do
|
16
14
|
it 'should call locate and then authenticate' do
|
17
|
-
mocked_instance =
|
18
|
-
subject.
|
19
|
-
subject.authenticate({'email' => 'example'},'pass').
|
15
|
+
mocked_instance = double('ExampleModel', :authenticate => 'abbadoo')
|
16
|
+
allow(subject).to receive(:locate).with('email' => 'example').and_return(mocked_instance)
|
17
|
+
expect(subject.authenticate({'email' => 'example'},'pass')).to eq('abbadoo')
|
20
18
|
end
|
21
19
|
|
22
20
|
it 'should call locate with additional scopes when provided' do
|
23
|
-
mocked_instance =
|
24
|
-
subject.
|
25
|
-
subject.authenticate({'email' => 'example', 'user_type' => 'admin'}, 'pass').
|
21
|
+
mocked_instance = double('ExampleModel', :authenticate => 'abbadoo')
|
22
|
+
allow(subject).to receive(:locate).with('email' => 'example', 'user_type' => 'admin').and_return(mocked_instance)
|
23
|
+
expect(subject.authenticate({'email' => 'example', 'user_type' => 'admin'}, 'pass')).to eq('abbadoo')
|
26
24
|
end
|
27
25
|
|
28
26
|
it 'should recover gracefully if locate is nil' do
|
29
|
-
subject.
|
30
|
-
subject.authenticate('blah','foo').
|
27
|
+
allow(subject).to receive(:locate).and_return(nil)
|
28
|
+
expect(subject.authenticate('blah','foo')).to be false
|
31
29
|
end
|
32
30
|
end
|
33
31
|
end
|
@@ -36,87 +34,87 @@ describe OmniAuth::Identity::Model do
|
|
36
34
|
subject{ ExampleModel.new }
|
37
35
|
|
38
36
|
describe '#authenticate' do
|
39
|
-
it('should be abstract'){
|
37
|
+
it('should be abstract'){ expect{ subject.authenticate('abc') }.to raise_error(NotImplementedError) }
|
40
38
|
end
|
41
39
|
|
42
40
|
describe '#uid' do
|
43
41
|
it 'should default to #id' do
|
44
|
-
subject.
|
45
|
-
subject.
|
46
|
-
subject.uid.
|
42
|
+
allow(subject).to receive(:respond_to?).with(:id).and_return(true)
|
43
|
+
allow(subject).to receive(:id).and_return 'wakka-do'
|
44
|
+
expect(subject.uid).to eq('wakka-do')
|
47
45
|
end
|
48
46
|
|
49
47
|
it 'should stringify it' do
|
50
|
-
subject.
|
51
|
-
subject.uid.
|
48
|
+
allow(subject).to receive(:id).and_return 123
|
49
|
+
expect(subject.uid).to eq('123')
|
52
50
|
end
|
53
51
|
|
54
52
|
it 'should raise NotImplementedError if #id is not defined' do
|
55
|
-
subject.
|
56
|
-
|
53
|
+
allow(subject).to receive(:respond_to?).with(:id).and_return(false)
|
54
|
+
expect{ subject.uid }.to raise_error(NotImplementedError)
|
57
55
|
end
|
58
56
|
end
|
59
57
|
|
60
58
|
describe '#auth_key' do
|
61
59
|
it 'should default to #email' do
|
62
|
-
subject.
|
63
|
-
subject.
|
64
|
-
subject.auth_key.
|
60
|
+
allow(subject).to receive(:respond_to?).with(:email).and_return(true)
|
61
|
+
allow(subject).to receive(:email).and_return('bob@bob.com')
|
62
|
+
expect(subject.auth_key).to eq('bob@bob.com')
|
65
63
|
end
|
66
64
|
|
67
65
|
it 'should use the class .auth_key' do
|
68
66
|
subject.class.auth_key 'login'
|
69
|
-
subject.
|
70
|
-
subject.auth_key.
|
67
|
+
allow(subject).to receive(:login).and_return 'bob'
|
68
|
+
expect(subject.auth_key).to eq('bob')
|
71
69
|
subject.class.auth_key nil
|
72
70
|
end
|
73
71
|
|
74
72
|
it 'should raise a NotImplementedError if the auth_key method is not defined' do
|
75
|
-
|
73
|
+
expect{ subject.auth_key }.to raise_error(NotImplementedError)
|
76
74
|
end
|
77
75
|
end
|
78
76
|
|
79
77
|
describe '#auth_key=' do
|
80
78
|
it 'should default to setting email' do
|
81
|
-
subject.
|
82
|
-
subject.
|
79
|
+
allow(subject).to receive(:respond_to?).with(:email=).and_return(true)
|
80
|
+
expect(subject).to receive(:email=).with 'abc'
|
83
81
|
|
84
82
|
subject.auth_key = 'abc'
|
85
83
|
end
|
86
84
|
|
87
85
|
it 'should use a custom .auth_key if one is provided' do
|
88
86
|
subject.class.auth_key 'login'
|
89
|
-
subject.
|
90
|
-
subject.
|
87
|
+
allow(subject).to receive(:respond_to?).with(:login=).and_return(true)
|
88
|
+
expect(subject).to receive(:login=).with('abc')
|
91
89
|
|
92
90
|
subject.auth_key = 'abc'
|
93
91
|
end
|
94
92
|
|
95
93
|
it 'should raise a NotImplementedError if the autH_key method is not defined' do
|
96
|
-
|
94
|
+
expect{ subject.auth_key = 'broken' }.to raise_error(NotImplementedError)
|
97
95
|
end
|
98
96
|
end
|
99
97
|
|
100
98
|
describe '#info' do
|
101
99
|
it 'should include attributes that are set' do
|
102
|
-
subject.
|
103
|
-
subject.
|
100
|
+
allow(subject).to receive(:name).and_return('Bob Bobson')
|
101
|
+
allow(subject).to receive(:nickname).and_return('bob')
|
104
102
|
|
105
|
-
subject.info.
|
103
|
+
expect(subject.info).to eq({
|
106
104
|
'name' => 'Bob Bobson',
|
107
105
|
'nickname' => 'bob'
|
108
|
-
}
|
106
|
+
})
|
109
107
|
end
|
110
108
|
|
111
109
|
it 'should automatically set name off of nickname' do
|
112
|
-
subject.
|
110
|
+
allow(subject).to receive(:nickname).and_return('bob')
|
113
111
|
subject.info['name'] == 'bob'
|
114
112
|
end
|
115
113
|
|
116
114
|
it 'should not overwrite a provided name' do
|
117
|
-
subject.
|
118
|
-
subject.
|
119
|
-
subject.info['name'].
|
115
|
+
allow(subject).to receive(:name).and_return('Awesome Dude')
|
116
|
+
allow(subject).to receive(:first_name).and_return('Frank')
|
117
|
+
expect(subject.info['name']).to eq('Awesome Dude')
|
120
118
|
end
|
121
119
|
end
|
122
120
|
end
|
@@ -1,14 +1,16 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
1
|
describe(OmniAuth::Identity::Models::ActiveRecord, :db => true) do
|
4
2
|
class TestIdentity < OmniAuth::Identity::Models::ActiveRecord; end
|
5
3
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
4
|
+
describe "model", type: :model do
|
5
|
+
subject { TestIdentity }
|
6
|
+
|
7
|
+
it 'should delegate locate to the where query method' do
|
8
|
+
allow(subject).to receive(:where).with('ham_sandwich' => 'open faced', 'category' => 'sandwiches').and_return(['wakka'])
|
9
|
+
expect(subject.locate('ham_sandwich' => 'open faced', 'category' => 'sandwiches')).to eq('wakka')
|
10
|
+
end
|
10
11
|
|
11
|
-
|
12
|
-
|
12
|
+
it 'should not use STI rules for its table name' do
|
13
|
+
expect(subject.table_name).to eq('test_identities')
|
14
|
+
end
|
13
15
|
end
|
14
16
|
end
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
1
|
describe(OmniAuth::Identity::Models::CouchPotatoModule, :db => true) do
|
4
2
|
class CouchPotatoTestIdentity
|
5
3
|
include CouchPotato::Persistence
|
@@ -7,9 +5,12 @@ describe(OmniAuth::Identity::Models::CouchPotatoModule, :db => true) do
|
|
7
5
|
auth_key :ham_sandwich
|
8
6
|
end
|
9
7
|
|
10
|
-
|
11
|
-
|
12
|
-
CouchPotatoTestIdentity.locate('ham_sandwich' => 'open faced', 'category' => 'sandwiches').should == 'wakka'
|
13
|
-
end
|
8
|
+
describe 'model', type: :model do
|
9
|
+
subject { CouchPotatoTestIdentity }
|
14
10
|
|
11
|
+
it 'should delegate locate to the where query method' do
|
12
|
+
allow(subject).to receive(:where).with('ham_sandwich' => 'open faced', 'category' => 'sandwiches').and_return(['wakka'])
|
13
|
+
expect(subject.locate('ham_sandwich' => 'open faced', 'category' => 'sandwiches')).to eq('wakka')
|
14
|
+
end
|
15
|
+
end
|
15
16
|
end
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
1
|
describe(OmniAuth::Identity::Models::DataMapper, :db => true) do
|
4
2
|
class DataMapperTestIdentity
|
5
3
|
include DataMapper::Resource
|
@@ -9,14 +7,18 @@ describe(OmniAuth::Identity::Models::DataMapper, :db => true) do
|
|
9
7
|
auth_key :ham_sandwich
|
10
8
|
end
|
11
9
|
|
12
|
-
DataMapper.finalize
|
13
10
|
|
14
11
|
before :all do
|
12
|
+
DataMapper.finalize
|
15
13
|
@resource = DataMapperTestIdentity.new
|
16
14
|
end
|
17
15
|
|
18
|
-
|
19
|
-
|
20
|
-
|
16
|
+
describe 'model', type: :model do
|
17
|
+
subject { DataMapperTestIdentity }
|
18
|
+
|
19
|
+
it 'should delegate locate to the all query method' do
|
20
|
+
allow(subject).to receive(:all).with('ham_sandwich' => 'open faced', 'category' => 'sandwiches').and_return(['wakka'])
|
21
|
+
expect(subject.locate('ham_sandwich' => 'open faced', 'category' => 'sandwiches')).to eq('wakka')
|
22
|
+
end
|
21
23
|
end
|
22
24
|
end
|
@@ -1,18 +1,23 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
1
|
describe(OmniAuth::Identity::Models::Mongoid, :db => true) do
|
4
2
|
class MongoidTestIdentity
|
5
3
|
include Mongoid::Document
|
6
4
|
include OmniAuth::Identity::Models::Mongoid
|
7
5
|
auth_key :ham_sandwich
|
6
|
+
store_in database: 'db1', collection: 'mongoid_test_identities', client: 'secondary'
|
8
7
|
end
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
9
|
+
describe "model", type: :model do
|
10
|
+
subject { MongoidTestIdentity }
|
11
|
+
|
12
|
+
it { is_expected.to be_mongoid_document }
|
13
|
+
|
14
|
+
it 'does not munge collection name' do
|
15
|
+
is_expected.to be_stored_in(database: 'db1', collection: 'mongoid_test_identities', client: 'secondary')
|
16
|
+
end
|
14
17
|
|
15
|
-
|
16
|
-
|
18
|
+
it 'should delegate locate to the where query method' do
|
19
|
+
allow(subject).to receive(:where).with('ham_sandwich' => 'open faced', 'category' => 'sandwiches').and_return(['wakka'])
|
20
|
+
expect(subject.locate('ham_sandwich' => 'open faced', 'category' => 'sandwiches')).to eq('wakka')
|
21
|
+
end
|
17
22
|
end
|
18
23
|
end
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
1
|
class HasTheMethod
|
4
2
|
def self.has_secure_password; end
|
5
3
|
end
|
@@ -9,19 +7,19 @@ end
|
|
9
7
|
|
10
8
|
describe OmniAuth::Identity::SecurePassword do
|
11
9
|
it 'should extend with the class methods if it does not have the method' do
|
12
|
-
DoesNotHaveTheMethod.
|
10
|
+
expect(DoesNotHaveTheMethod).to receive(:extend).with(OmniAuth::Identity::SecurePassword::ClassMethods)
|
13
11
|
DoesNotHaveTheMethod.send(:include, OmniAuth::Identity::SecurePassword)
|
14
12
|
end
|
15
13
|
|
16
14
|
it 'should not extend if the method is already defined' do
|
17
|
-
HasTheMethod.
|
15
|
+
expect(HasTheMethod).not_to receive(:extend)
|
18
16
|
HasTheMethod.send(:include, OmniAuth::Identity::SecurePassword)
|
19
17
|
end
|
20
18
|
|
21
19
|
it 'should respond to has_secure_password afterwards' do
|
22
20
|
[HasTheMethod,DoesNotHaveTheMethod].each do |klass|
|
23
21
|
klass.send(:include, OmniAuth::Identity::SecurePassword)
|
24
|
-
klass.
|
22
|
+
expect(klass).to be_respond_to(:has_secure_password)
|
25
23
|
end
|
26
24
|
end
|
27
25
|
end
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
1
|
class MockIdentity; end
|
4
2
|
|
5
3
|
describe OmniAuth::Strategies::Identity do
|
@@ -14,7 +12,7 @@ describe OmniAuth::Strategies::Identity do
|
|
14
12
|
identity_options = {:model => MockIdentity}.merge(identity_options)
|
15
13
|
old_app = self.app
|
16
14
|
self.app = Rack::Builder.app do
|
17
|
-
use Rack::Session::Cookie
|
15
|
+
use Rack::Session::Cookie, secret: '1234567890qwertyuiop'
|
18
16
|
use OmniAuth::Strategies::Identity, identity_options
|
19
17
|
run lambda{|env| [404, {'env' => env}, ["HELLO!"]]}
|
20
18
|
end
|
@@ -32,52 +30,52 @@ describe OmniAuth::Strategies::Identity do
|
|
32
30
|
describe '#request_phase' do
|
33
31
|
it 'should display a form' do
|
34
32
|
get '/auth/identity'
|
35
|
-
last_response.body.
|
33
|
+
expect(last_response.body).to be_include("<form")
|
36
34
|
end
|
37
35
|
end
|
38
36
|
|
39
37
|
describe '#callback_phase' do
|
40
|
-
let(:user){
|
38
|
+
let(:user){ double(:uid => 'user1', :info => {'name' => 'Rockefeller'})}
|
41
39
|
|
42
40
|
context 'with valid credentials' do
|
43
41
|
before do
|
44
|
-
MockIdentity.
|
45
|
-
MockIdentity.
|
42
|
+
allow(MockIdentity).to receive('auth_key').and_return('email')
|
43
|
+
expect(MockIdentity).to receive('authenticate').with({'email' => 'john'},'awesome').and_return(user)
|
46
44
|
post '/auth/identity/callback', :auth_key => 'john', :password => 'awesome'
|
47
45
|
end
|
48
46
|
|
49
47
|
it 'should populate the auth hash' do
|
50
|
-
auth_hash.
|
48
|
+
expect(auth_hash).to be_kind_of(Hash)
|
51
49
|
end
|
52
50
|
|
53
51
|
it 'should populate the uid' do
|
54
|
-
auth_hash['uid'].
|
52
|
+
expect(auth_hash['uid']).to eq('user1')
|
55
53
|
end
|
56
54
|
|
57
55
|
it 'should populate the info hash' do
|
58
|
-
auth_hash['info'].
|
56
|
+
expect(auth_hash['info']).to eq({'name' => 'Rockefeller'})
|
59
57
|
end
|
60
58
|
end
|
61
59
|
|
62
60
|
context 'with invalid credentials' do
|
63
61
|
before do
|
64
|
-
MockIdentity.
|
62
|
+
allow(MockIdentity).to receive('auth_key').and_return('email')
|
65
63
|
OmniAuth.config.on_failure = lambda{|env| [401, {}, [env['omniauth.error.type'].inspect]]}
|
66
|
-
MockIdentity.
|
64
|
+
expect(MockIdentity).to receive(:authenticate).with({'email' => 'wrong'},'login').and_return(false)
|
67
65
|
post '/auth/identity/callback', :auth_key => 'wrong', :password => 'login'
|
68
66
|
end
|
69
67
|
|
70
68
|
it 'should fail with :invalid_credentials' do
|
71
|
-
last_response.body.
|
69
|
+
expect(last_response.body).to eq(':invalid_credentials')
|
72
70
|
end
|
73
71
|
end
|
74
72
|
|
75
73
|
context 'with auth scopes' do
|
76
74
|
|
77
75
|
it 'should evaluate and pass through conditions proc' do
|
78
|
-
MockIdentity.
|
76
|
+
allow(MockIdentity).to receive('auth_key').and_return('email')
|
79
77
|
set_app!( :locate_conditions => lambda{|req| {model.auth_key => req['auth_key'], 'user_type' => 'admin'} } )
|
80
|
-
MockIdentity.
|
78
|
+
expect(MockIdentity).to receive('authenticate').with( {'email' => 'john', 'user_type' => 'admin'}, 'awesome' ).and_return(user)
|
81
79
|
post '/auth/identity/callback', :auth_key => 'john', :password => 'awesome'
|
82
80
|
end
|
83
81
|
end
|
@@ -86,7 +84,7 @@ describe OmniAuth::Strategies::Identity do
|
|
86
84
|
describe '#registration_form' do
|
87
85
|
it 'should trigger from /auth/identity/register by default' do
|
88
86
|
get '/auth/identity/register'
|
89
|
-
last_response.body.
|
87
|
+
expect(last_response.body).to be_include("Register Identity")
|
90
88
|
end
|
91
89
|
end
|
92
90
|
|
@@ -100,14 +98,14 @@ describe OmniAuth::Strategies::Identity do
|
|
100
98
|
} }
|
101
99
|
|
102
100
|
before do
|
103
|
-
MockIdentity.
|
104
|
-
m =
|
105
|
-
MockIdentity.
|
101
|
+
allow(MockIdentity).to receive('auth_key').and_return('email')
|
102
|
+
m = double(:uid => 'abc', :name => 'Awesome Dude', :email => 'awesome@example.com', :info => {:name => 'DUUUUDE!'}, :persisted? => true)
|
103
|
+
expect(MockIdentity).to receive(:create).with(properties).and_return(m)
|
106
104
|
end
|
107
105
|
|
108
106
|
it 'should set the auth hash' do
|
109
107
|
post '/auth/identity/register', properties
|
110
|
-
auth_hash['uid'].
|
108
|
+
expect(auth_hash['uid']).to eq('abc')
|
111
109
|
end
|
112
110
|
end
|
113
111
|
|
@@ -120,13 +118,13 @@ describe OmniAuth::Strategies::Identity do
|
|
120
118
|
} }
|
121
119
|
|
122
120
|
before do
|
123
|
-
MockIdentity.
|
121
|
+
expect(MockIdentity).to receive(:create).with(properties).and_return(double(:persisted? => false))
|
124
122
|
end
|
125
123
|
|
126
124
|
context 'default' do
|
127
125
|
it 'should show registration form' do
|
128
126
|
post '/auth/identity/register', properties
|
129
|
-
last_response.body.
|
127
|
+
expect(last_response.body).to be_include("Register Identity")
|
130
128
|
end
|
131
129
|
end
|
132
130
|
|
@@ -134,7 +132,7 @@ describe OmniAuth::Strategies::Identity do
|
|
134
132
|
it 'should set the identity hash' do
|
135
133
|
set_app!(:on_failed_registration => lambda{|env| [404, {'env' => env}, ["HELLO!"]]}) do
|
136
134
|
post '/auth/identity/register', properties
|
137
|
-
identity_hash.
|
135
|
+
expect(identity_hash).not_to be_nil
|
138
136
|
end
|
139
137
|
end
|
140
138
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -2,13 +2,19 @@ require 'rubygems'
|
|
2
2
|
require 'bundler'
|
3
3
|
Bundler.setup :default, :development, :test
|
4
4
|
|
5
|
+
# Third party gems to help with testing
|
5
6
|
require 'simplecov'
|
6
7
|
SimpleCov.start
|
7
8
|
|
8
9
|
require 'rack/test'
|
10
|
+
require 'mongoid-rspec'
|
11
|
+
require 'byebug'
|
12
|
+
|
13
|
+
# This gem
|
9
14
|
require 'omniauth/identity'
|
10
15
|
|
11
16
|
RSpec.configure do |config|
|
12
17
|
config.include Rack::Test::Methods
|
18
|
+
config.include Mongoid::Matchers, type: :model
|
13
19
|
end
|
14
20
|
|
metadata
CHANGED
@@ -1,209 +1,210 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-identity
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
+
- Andrew Roberts
|
7
8
|
- Michael Bleigh
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2020-09-01 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: omniauth
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
16
17
|
requirements:
|
17
|
-
- -
|
18
|
+
- - ">="
|
18
19
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
20
|
+
version: '0'
|
20
21
|
type: :runtime
|
21
22
|
prerelease: false
|
22
23
|
version_requirements: !ruby/object:Gem::Requirement
|
23
24
|
requirements:
|
24
|
-
- -
|
25
|
+
- - ">="
|
25
26
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
27
|
+
version: '0'
|
27
28
|
- !ruby/object:Gem::Dependency
|
28
|
-
name: bcrypt
|
29
|
+
name: bcrypt
|
29
30
|
requirement: !ruby/object:Gem::Requirement
|
30
31
|
requirements:
|
31
|
-
- -
|
32
|
+
- - ">="
|
32
33
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
34
|
+
version: '0'
|
34
35
|
type: :runtime
|
35
36
|
prerelease: false
|
36
37
|
version_requirements: !ruby/object:Gem::Requirement
|
37
38
|
requirements:
|
38
|
-
- -
|
39
|
+
- - ">="
|
39
40
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
41
|
+
version: '0'
|
41
42
|
- !ruby/object:Gem::Dependency
|
42
43
|
name: maruku
|
43
44
|
requirement: !ruby/object:Gem::Requirement
|
44
45
|
requirements:
|
45
|
-
- -
|
46
|
+
- - ">="
|
46
47
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0
|
48
|
+
version: '0'
|
48
49
|
type: :development
|
49
50
|
prerelease: false
|
50
51
|
version_requirements: !ruby/object:Gem::Requirement
|
51
52
|
requirements:
|
52
|
-
- -
|
53
|
+
- - ">="
|
53
54
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0
|
55
|
+
version: '0'
|
55
56
|
- !ruby/object:Gem::Dependency
|
56
57
|
name: simplecov
|
57
58
|
requirement: !ruby/object:Gem::Requirement
|
58
59
|
requirements:
|
59
|
-
- -
|
60
|
+
- - ">="
|
60
61
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0
|
62
|
+
version: '0'
|
62
63
|
type: :development
|
63
64
|
prerelease: false
|
64
65
|
version_requirements: !ruby/object:Gem::Requirement
|
65
66
|
requirements:
|
66
|
-
- -
|
67
|
+
- - ">="
|
67
68
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0
|
69
|
+
version: '0'
|
69
70
|
- !ruby/object:Gem::Dependency
|
70
71
|
name: rack-test
|
71
72
|
requirement: !ruby/object:Gem::Requirement
|
72
73
|
requirements:
|
73
|
-
- -
|
74
|
+
- - ">="
|
74
75
|
- !ruby/object:Gem::Version
|
75
|
-
version: '0
|
76
|
+
version: '0'
|
76
77
|
type: :development
|
77
78
|
prerelease: false
|
78
79
|
version_requirements: !ruby/object:Gem::Requirement
|
79
80
|
requirements:
|
80
|
-
- -
|
81
|
+
- - ">="
|
81
82
|
- !ruby/object:Gem::Version
|
82
|
-
version: '0
|
83
|
+
version: '0'
|
83
84
|
- !ruby/object:Gem::Dependency
|
84
85
|
name: rake
|
85
86
|
requirement: !ruby/object:Gem::Requirement
|
86
87
|
requirements:
|
87
|
-
- -
|
88
|
+
- - ">="
|
88
89
|
- !ruby/object:Gem::Version
|
89
|
-
version: '0
|
90
|
+
version: '0'
|
90
91
|
type: :development
|
91
92
|
prerelease: false
|
92
93
|
version_requirements: !ruby/object:Gem::Requirement
|
93
94
|
requirements:
|
94
|
-
- -
|
95
|
+
- - ">="
|
95
96
|
- !ruby/object:Gem::Version
|
96
|
-
version: '0
|
97
|
+
version: '0'
|
97
98
|
- !ruby/object:Gem::Dependency
|
98
99
|
name: rspec
|
99
100
|
requirement: !ruby/object:Gem::Requirement
|
100
101
|
requirements:
|
101
|
-
- - ~>
|
102
|
+
- - "~>"
|
102
103
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
104
|
+
version: '3'
|
104
105
|
type: :development
|
105
106
|
prerelease: false
|
106
107
|
version_requirements: !ruby/object:Gem::Requirement
|
107
108
|
requirements:
|
108
|
-
- - ~>
|
109
|
+
- - "~>"
|
109
110
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
111
|
+
version: '3'
|
111
112
|
- !ruby/object:Gem::Dependency
|
112
113
|
name: activerecord
|
113
114
|
requirement: !ruby/object:Gem::Requirement
|
114
115
|
requirements:
|
115
|
-
- -
|
116
|
+
- - ">="
|
116
117
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
118
|
+
version: '0'
|
118
119
|
type: :development
|
119
120
|
prerelease: false
|
120
121
|
version_requirements: !ruby/object:Gem::Requirement
|
121
122
|
requirements:
|
122
|
-
- -
|
123
|
+
- - ">="
|
123
124
|
- !ruby/object:Gem::Version
|
124
|
-
version: '
|
125
|
+
version: '0'
|
125
126
|
- !ruby/object:Gem::Dependency
|
126
127
|
name: mongoid
|
127
128
|
requirement: !ruby/object:Gem::Requirement
|
128
129
|
requirements:
|
129
|
-
- -
|
130
|
+
- - ">="
|
130
131
|
- !ruby/object:Gem::Version
|
131
132
|
version: '0'
|
132
133
|
type: :development
|
133
134
|
prerelease: false
|
134
135
|
version_requirements: !ruby/object:Gem::Requirement
|
135
136
|
requirements:
|
136
|
-
- -
|
137
|
+
- - ">="
|
137
138
|
- !ruby/object:Gem::Version
|
138
139
|
version: '0'
|
139
140
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
141
|
+
name: datamapper
|
141
142
|
requirement: !ruby/object:Gem::Requirement
|
142
143
|
requirements:
|
143
|
-
- -
|
144
|
+
- - ">="
|
144
145
|
- !ruby/object:Gem::Version
|
145
146
|
version: '0'
|
146
147
|
type: :development
|
147
148
|
prerelease: false
|
148
149
|
version_requirements: !ruby/object:Gem::Requirement
|
149
150
|
requirements:
|
150
|
-
- -
|
151
|
+
- - ">="
|
151
152
|
- !ruby/object:Gem::Version
|
152
153
|
version: '0'
|
153
154
|
- !ruby/object:Gem::Dependency
|
154
|
-
name:
|
155
|
+
name: bson_ext
|
155
156
|
requirement: !ruby/object:Gem::Requirement
|
156
157
|
requirements:
|
157
|
-
- -
|
158
|
+
- - ">="
|
158
159
|
- !ruby/object:Gem::Version
|
159
160
|
version: '0'
|
160
161
|
type: :development
|
161
162
|
prerelease: false
|
162
163
|
version_requirements: !ruby/object:Gem::Requirement
|
163
164
|
requirements:
|
164
|
-
- -
|
165
|
+
- - ">="
|
165
166
|
- !ruby/object:Gem::Version
|
166
167
|
version: '0'
|
167
168
|
- !ruby/object:Gem::Dependency
|
168
|
-
name:
|
169
|
+
name: byebug
|
169
170
|
requirement: !ruby/object:Gem::Requirement
|
170
171
|
requirements:
|
171
|
-
- -
|
172
|
+
- - ">="
|
172
173
|
- !ruby/object:Gem::Version
|
173
174
|
version: '0'
|
174
175
|
type: :development
|
175
176
|
prerelease: false
|
176
177
|
version_requirements: !ruby/object:Gem::Requirement
|
177
178
|
requirements:
|
178
|
-
- -
|
179
|
+
- - ">="
|
179
180
|
- !ruby/object:Gem::Version
|
180
181
|
version: '0'
|
181
182
|
- !ruby/object:Gem::Dependency
|
182
183
|
name: couch_potato
|
183
184
|
requirement: !ruby/object:Gem::Requirement
|
184
185
|
requirements:
|
185
|
-
- -
|
186
|
+
- - ">="
|
186
187
|
- !ruby/object:Gem::Version
|
187
188
|
version: '0'
|
188
189
|
type: :development
|
189
190
|
prerelease: false
|
190
191
|
version_requirements: !ruby/object:Gem::Requirement
|
191
192
|
requirements:
|
192
|
-
- -
|
193
|
+
- - ">="
|
193
194
|
- !ruby/object:Gem::Version
|
194
195
|
version: '0'
|
195
196
|
description: Internal authentication handlers for OmniAuth.
|
196
|
-
email:
|
197
|
-
- michael@intridea.com
|
197
|
+
email:
|
198
198
|
executables: []
|
199
199
|
extensions: []
|
200
200
|
extra_rdoc_files: []
|
201
201
|
files:
|
202
|
-
- .gitignore
|
203
|
-
- .rspec
|
202
|
+
- ".gitignore"
|
203
|
+
- ".rspec"
|
204
|
+
- CHANGELOG.md
|
204
205
|
- Gemfile
|
205
|
-
- Gemfile.lock
|
206
206
|
- Guardfile
|
207
|
+
- LICENSE
|
207
208
|
- README.markdown
|
208
209
|
- Rakefile
|
209
210
|
- lib/omniauth-identity.rb
|
@@ -213,7 +214,6 @@ files:
|
|
213
214
|
- lib/omniauth/identity/models/active_record.rb
|
214
215
|
- lib/omniauth/identity/models/couch_potato.rb
|
215
216
|
- lib/omniauth/identity/models/data_mapper.rb
|
216
|
-
- lib/omniauth/identity/models/mongo_mapper.rb
|
217
217
|
- lib/omniauth/identity/models/mongoid.rb
|
218
218
|
- lib/omniauth/identity/secure_password.rb
|
219
219
|
- lib/omniauth/strategies/identity.rb
|
@@ -222,13 +222,13 @@ files:
|
|
222
222
|
- spec/omniauth/identity/models/active_record_spec.rb
|
223
223
|
- spec/omniauth/identity/models/couch_potato_spec.rb
|
224
224
|
- spec/omniauth/identity/models/data_mapper_spec.rb
|
225
|
-
- spec/omniauth/identity/models/mongo_mapper_spec.rb
|
226
225
|
- spec/omniauth/identity/models/mongoid_spec.rb
|
227
226
|
- spec/omniauth/identity/secure_password_spec.rb
|
228
227
|
- spec/omniauth/strategies/identity_spec.rb
|
229
228
|
- spec/spec_helper.rb
|
230
|
-
homepage: http://github.com/
|
231
|
-
licenses:
|
229
|
+
homepage: http://github.com/omniauth/omniauth-identity
|
230
|
+
licenses:
|
231
|
+
- MIT
|
232
232
|
metadata: {}
|
233
233
|
post_install_message:
|
234
234
|
rdoc_options: []
|
@@ -236,19 +236,26 @@ require_paths:
|
|
236
236
|
- lib
|
237
237
|
required_ruby_version: !ruby/object:Gem::Requirement
|
238
238
|
requirements:
|
239
|
-
- -
|
239
|
+
- - ">="
|
240
240
|
- !ruby/object:Gem::Version
|
241
241
|
version: '0'
|
242
242
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
243
243
|
requirements:
|
244
|
-
- -
|
244
|
+
- - ">="
|
245
245
|
- !ruby/object:Gem::Version
|
246
246
|
version: 1.3.6
|
247
247
|
requirements: []
|
248
248
|
rubyforge_project:
|
249
|
-
rubygems_version: 2.
|
249
|
+
rubygems_version: 2.7.10
|
250
250
|
signing_key:
|
251
251
|
specification_version: 4
|
252
252
|
summary: Internal authentication handlers for OmniAuth.
|
253
|
-
test_files:
|
254
|
-
|
253
|
+
test_files:
|
254
|
+
- spec/omniauth/identity/model_spec.rb
|
255
|
+
- spec/omniauth/identity/models/active_record_spec.rb
|
256
|
+
- spec/omniauth/identity/models/couch_potato_spec.rb
|
257
|
+
- spec/omniauth/identity/models/data_mapper_spec.rb
|
258
|
+
- spec/omniauth/identity/models/mongoid_spec.rb
|
259
|
+
- spec/omniauth/identity/secure_password_spec.rb
|
260
|
+
- spec/omniauth/strategies/identity_spec.rb
|
261
|
+
- spec/spec_helper.rb
|
data/Gemfile.lock
DELETED
@@ -1,179 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
omniauth-identity (1.1.1)
|
5
|
-
bcrypt-ruby (~> 3.0)
|
6
|
-
omniauth (~> 1.0)
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: http://rubygems.org/
|
10
|
-
specs:
|
11
|
-
activemodel (3.2.13)
|
12
|
-
activesupport (= 3.2.13)
|
13
|
-
builder (~> 3.0.0)
|
14
|
-
activerecord (3.2.13)
|
15
|
-
activemodel (= 3.2.13)
|
16
|
-
activesupport (= 3.2.13)
|
17
|
-
arel (~> 3.0.2)
|
18
|
-
tzinfo (~> 0.3.29)
|
19
|
-
activesupport (3.2.13)
|
20
|
-
i18n (= 0.6.1)
|
21
|
-
multi_json (~> 1.0)
|
22
|
-
addressable (2.3.5)
|
23
|
-
arel (3.0.2)
|
24
|
-
bcrypt-ruby (3.0.1)
|
25
|
-
bson (1.9.0)
|
26
|
-
bson_ext (1.9.0)
|
27
|
-
bson (~> 1.9.0)
|
28
|
-
builder (3.0.4)
|
29
|
-
coderay (1.0.9)
|
30
|
-
couch_potato (1.0.1)
|
31
|
-
activemodel
|
32
|
-
couchrest (~> 1.2.0)
|
33
|
-
json (~> 1.6)
|
34
|
-
couchrest (1.2.0)
|
35
|
-
mime-types (~> 1.15)
|
36
|
-
multi_json (~> 1.0)
|
37
|
-
rest-client (~> 1.6.1)
|
38
|
-
datamapper (1.2.0)
|
39
|
-
dm-aggregates (~> 1.2.0)
|
40
|
-
dm-constraints (~> 1.2.0)
|
41
|
-
dm-core (~> 1.2.0)
|
42
|
-
dm-migrations (~> 1.2.0)
|
43
|
-
dm-serializer (~> 1.2.0)
|
44
|
-
dm-timestamps (~> 1.2.0)
|
45
|
-
dm-transactions (~> 1.2.0)
|
46
|
-
dm-types (~> 1.2.0)
|
47
|
-
dm-validations (~> 1.2.0)
|
48
|
-
diff-lcs (1.2.4)
|
49
|
-
dm-aggregates (1.2.0)
|
50
|
-
dm-core (~> 1.2.0)
|
51
|
-
dm-constraints (1.2.0)
|
52
|
-
dm-core (~> 1.2.0)
|
53
|
-
dm-core (1.2.1)
|
54
|
-
addressable (~> 2.3)
|
55
|
-
dm-migrations (1.2.0)
|
56
|
-
dm-core (~> 1.2.0)
|
57
|
-
dm-serializer (1.2.2)
|
58
|
-
dm-core (~> 1.2.0)
|
59
|
-
fastercsv (~> 1.5)
|
60
|
-
json (~> 1.6)
|
61
|
-
json_pure (~> 1.6)
|
62
|
-
multi_json (~> 1.0)
|
63
|
-
dm-timestamps (1.2.0)
|
64
|
-
dm-core (~> 1.2.0)
|
65
|
-
dm-transactions (1.2.0)
|
66
|
-
dm-core (~> 1.2.0)
|
67
|
-
dm-types (1.2.2)
|
68
|
-
bcrypt-ruby (~> 3.0)
|
69
|
-
dm-core (~> 1.2.0)
|
70
|
-
fastercsv (~> 1.5)
|
71
|
-
json (~> 1.6)
|
72
|
-
multi_json (~> 1.0)
|
73
|
-
stringex (~> 1.4)
|
74
|
-
uuidtools (~> 2.1)
|
75
|
-
dm-validations (1.2.0)
|
76
|
-
dm-core (~> 1.2.0)
|
77
|
-
fastercsv (1.5.5)
|
78
|
-
ffi (1.9.0)
|
79
|
-
formatador (0.2.4)
|
80
|
-
growl (1.0.3)
|
81
|
-
guard (1.8.1)
|
82
|
-
formatador (>= 0.2.4)
|
83
|
-
listen (>= 1.0.0)
|
84
|
-
lumberjack (>= 1.0.2)
|
85
|
-
pry (>= 0.9.10)
|
86
|
-
thor (>= 0.14.6)
|
87
|
-
guard-bundler (1.0.0)
|
88
|
-
bundler (~> 1.0)
|
89
|
-
guard (~> 1.1)
|
90
|
-
guard-rspec (3.0.2)
|
91
|
-
guard (>= 1.8)
|
92
|
-
rspec (~> 2.13)
|
93
|
-
hashie (2.0.5)
|
94
|
-
i18n (0.6.1)
|
95
|
-
json (1.8.0)
|
96
|
-
json_pure (1.8.0)
|
97
|
-
listen (1.2.2)
|
98
|
-
rb-fsevent (>= 0.9.3)
|
99
|
-
rb-inotify (>= 0.9)
|
100
|
-
rb-kqueue (>= 0.2)
|
101
|
-
lumberjack (1.0.4)
|
102
|
-
maruku (0.6.1)
|
103
|
-
syntax (>= 1.0.0)
|
104
|
-
method_source (0.8.1)
|
105
|
-
mime-types (1.23)
|
106
|
-
mongo (1.9.0)
|
107
|
-
bson (~> 1.9.0)
|
108
|
-
mongo_mapper (0.12.0)
|
109
|
-
activemodel (~> 3.0)
|
110
|
-
activesupport (~> 3.0)
|
111
|
-
plucky (~> 0.5.2)
|
112
|
-
mongoid (3.1.4)
|
113
|
-
activemodel (~> 3.2)
|
114
|
-
moped (~> 1.4)
|
115
|
-
origin (~> 1.0)
|
116
|
-
tzinfo (~> 0.3.22)
|
117
|
-
moped (1.5.0)
|
118
|
-
multi_json (1.7.7)
|
119
|
-
omniauth (1.1.4)
|
120
|
-
hashie (>= 1.2, < 3)
|
121
|
-
rack
|
122
|
-
origin (1.1.0)
|
123
|
-
plucky (0.5.2)
|
124
|
-
mongo (~> 1.5)
|
125
|
-
pry (0.9.12.2)
|
126
|
-
coderay (~> 1.0.5)
|
127
|
-
method_source (~> 0.8)
|
128
|
-
slop (~> 3.4)
|
129
|
-
rack (1.5.2)
|
130
|
-
rack-test (0.6.2)
|
131
|
-
rack (>= 1.0)
|
132
|
-
rake (0.9.6)
|
133
|
-
rb-fsevent (0.9.3)
|
134
|
-
rb-inotify (0.9.0)
|
135
|
-
ffi (>= 0.5.0)
|
136
|
-
rb-kqueue (0.2.0)
|
137
|
-
ffi (>= 0.5.0)
|
138
|
-
rest-client (1.6.7)
|
139
|
-
mime-types (>= 1.16)
|
140
|
-
rspec (2.13.0)
|
141
|
-
rspec-core (~> 2.13.0)
|
142
|
-
rspec-expectations (~> 2.13.0)
|
143
|
-
rspec-mocks (~> 2.13.0)
|
144
|
-
rspec-core (2.13.1)
|
145
|
-
rspec-expectations (2.13.0)
|
146
|
-
diff-lcs (>= 1.1.3, < 2.0)
|
147
|
-
rspec-mocks (2.13.1)
|
148
|
-
simplecov (0.7.1)
|
149
|
-
multi_json (~> 1.0)
|
150
|
-
simplecov-html (~> 0.7.1)
|
151
|
-
simplecov-html (0.7.1)
|
152
|
-
slop (3.4.5)
|
153
|
-
stringex (1.5.1)
|
154
|
-
syntax (1.0.0)
|
155
|
-
thor (0.18.1)
|
156
|
-
tzinfo (0.3.37)
|
157
|
-
uuidtools (2.1.4)
|
158
|
-
|
159
|
-
PLATFORMS
|
160
|
-
ruby
|
161
|
-
|
162
|
-
DEPENDENCIES
|
163
|
-
activerecord (~> 3.1)
|
164
|
-
bson_ext
|
165
|
-
couch_potato
|
166
|
-
datamapper
|
167
|
-
growl
|
168
|
-
guard
|
169
|
-
guard-bundler
|
170
|
-
guard-rspec
|
171
|
-
maruku (~> 0.6)
|
172
|
-
mongo_mapper
|
173
|
-
mongoid
|
174
|
-
omniauth-identity!
|
175
|
-
rack-test (~> 0.5)
|
176
|
-
rake (~> 0.8)
|
177
|
-
rb-fsevent
|
178
|
-
rspec (~> 2.7)
|
179
|
-
simplecov (~> 0.4)
|
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'mongo_mapper'
|
2
|
-
|
3
|
-
module OmniAuth
|
4
|
-
module Identity
|
5
|
-
module Models
|
6
|
-
module MongoMapper
|
7
|
-
def self.included(base)
|
8
|
-
base.class_eval do
|
9
|
-
include ::OmniAuth::Identity::Model
|
10
|
-
include ::OmniAuth::Identity::SecurePassword
|
11
|
-
|
12
|
-
has_secure_password
|
13
|
-
|
14
|
-
def self.auth_key=(key)
|
15
|
-
super
|
16
|
-
validates_uniqueness_of key, :case_sensitive => false
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.locate(search_hash)
|
20
|
-
where(search_hash).first
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe(OmniAuth::Identity::Models::MongoMapper, :db => true) do
|
4
|
-
class MongoMapperTestIdentity
|
5
|
-
include MongoMapper::Document
|
6
|
-
include OmniAuth::Identity::Models::MongoMapper
|
7
|
-
auth_key :ham_sandwich
|
8
|
-
end
|
9
|
-
|
10
|
-
|
11
|
-
it 'should delegate locate to the where query method' do
|
12
|
-
MongoMapperTestIdentity.should_receive(:where).with('ham_sandwich' => 'open faced', 'category' => 'sandwiches').and_return(['wakka'])
|
13
|
-
MongoMapperTestIdentity.locate('ham_sandwich' => 'open faced', 'category' => 'sandwiches').should == 'wakka'
|
14
|
-
end
|
15
|
-
end
|