omniauth-identity 1.0.0.rc2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- omniauth-identity (1.0.0.beta1)
5
- omniauth (= 1.0.0.beta1)
4
+ omniauth-identity (1.0.0.rc2)
5
+ omniauth (~> 1.0.0.rc2)
6
6
 
7
7
  GEM
8
8
  remote: http://rubygems.org/
@@ -20,7 +20,7 @@ GEM
20
20
  multi_json (~> 1.0)
21
21
  arel (2.2.1)
22
22
  bcrypt-ruby (3.0.1)
23
- bson (1.4.1)
23
+ bson (1.3.1)
24
24
  bson_ext (1.4.1)
25
25
  builder (3.0.0)
26
26
  diff-lcs (1.1.3)
@@ -36,16 +36,22 @@ GEM
36
36
  i18n (0.6.0)
37
37
  maruku (0.6.0)
38
38
  syntax (>= 1.0.0)
39
- mongo (1.4.1)
40
- bson (= 1.4.1)
41
- mongoid (2.3.2)
42
- activemodel (~> 3.1)
43
- mongo (~> 1.4)
39
+ mongo (1.3.1)
40
+ bson (>= 1.3.1)
41
+ mongo_mapper (0.9.2)
42
+ activemodel (~> 3.0)
43
+ activesupport (~> 3.0)
44
+ plucky (~> 0.3.8)
45
+ mongoid (2.2.3)
46
+ activemodel (~> 3.0)
47
+ mongo (~> 1.3)
44
48
  tzinfo (~> 0.3.22)
45
49
  multi_json (1.0.3)
46
- omniauth (1.0.0.beta1)
50
+ omniauth (1.0.0.rc2)
47
51
  hashie (~> 1.2)
48
52
  rack
53
+ plucky (0.3.8)
54
+ mongo (~> 1.3)
49
55
  rack (1.3.5)
50
56
  rack-test (0.6.1)
51
57
  rack (>= 1.0)
@@ -79,7 +85,8 @@ DEPENDENCIES
79
85
  guard-bundler
80
86
  guard-rspec
81
87
  maruku (~> 0.6)
82
- mongoid (~> 2.3)
88
+ mongo_mapper
89
+ mongoid (~> 2.2.3)
83
90
  omniauth-identity!
84
91
  rack-test (~> 0.5)
85
92
  rake (~> 0.8)
@@ -18,25 +18,43 @@ look something like this:
18
18
 
19
19
  Next, you need to create a model (called `Identity by default`) that will be
20
20
  able to persist the information provided by the user. Luckily for you, there
21
- are pre-built models for popular ORMs that make this dead simple. You just
22
- need to subclass the relevant class:
21
+ are pre-built models for popular ORMs that make this dead simple.
22
+
23
+ ### ActiveRecord
24
+
25
+ Just subclass `OmniAuth::Identity::Models::ActiveRecord` and provide fields
26
+ in the database for all of the fields you are using.
23
27
 
24
28
  class Identity < OmniAuth::Identity::Models::ActiveRecord
25
29
  # Add whatever you like!
26
30
  end
27
31
 
28
- Adapters are provided for `ActiveRecord` and `MongoMapper` and are
29
- autoloaded on request (but not loaded by default so no dependencies are
30
- injected).
32
+ ### Mongoid
31
33
 
32
- You can also use `Mongoid`, but you need to include it in your class:
34
+ Include the `OmniAuth::Identity::Models::Mongoid` mixin and specify
35
+ fields that you will need.
33
36
 
34
37
  class Identity
35
38
  include Mongoid::Document
36
39
  include OmniAuth::Identity::Models::Mongoid
37
40
 
38
- # Add whatever you like!
39
-
41
+ field :email, type: String
42
+ field :name, type: String
43
+ field :password_digest, type: String
44
+ end
45
+
46
+ ### MongoMapper
47
+
48
+ Include the `OmniAuth::Identity::Models::MongoMapper` mixin and specify
49
+ fields that you will need.
50
+
51
+ class Identity
52
+ include MongoMapper::Document
53
+ include OmniAuth::Identity::Models::MongoMapper
54
+
55
+ key :email, String
56
+ key :name, String
57
+ key :password_digest, String
40
58
  end
41
59
 
42
60
  Once you've got an Identity persistence model and the strategy up and
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module Identity
3
- VERSION = '1.0.0.rc2'
3
+ VERSION = '1.0.0'
4
4
  end
5
5
  end
@@ -10,7 +10,7 @@ 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'
13
+ autoload :MongoMapper, 'omniauth/identity/models/mongo_mapper'
14
14
  autoload :Mongoid, 'omniauth/identity/models/mongoid'
15
15
  end
16
16
  end
@@ -0,0 +1,28 @@
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(key)
20
+ where(auth_key => key).first
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+
@@ -2,17 +2,18 @@
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', '~> 1.0.0.rc2'
5
+ gem.add_runtime_dependency 'omniauth', '~> 1.0'
6
6
 
7
7
  gem.add_development_dependency 'maruku', '~> 0.6'
8
8
  gem.add_development_dependency 'simplecov', '~> 0.4'
9
9
  gem.add_development_dependency 'rack-test', '~> 0.5'
10
10
  gem.add_development_dependency 'rake', '~> 0.8'
11
- gem.add_development_dependency 'rspec', '~> 2.5'
11
+ gem.add_development_dependency 'rspec', '~> 2.7'
12
12
  gem.add_development_dependency 'bcrypt-ruby', '~> 3.0'
13
13
  gem.add_development_dependency 'activerecord', '~> 3.1'
14
- gem.add_development_dependency 'mongoid', '~> 2.3'
15
- gem.add_development_dependency 'bson_ext', '~> 1.4'
14
+ gem.add_development_dependency 'mongoid'
15
+ gem.add_development_dependency 'mongo_mapper'
16
+ gem.add_development_dependency 'bson_ext'
16
17
 
17
18
  gem.name = 'omniauth-identity'
18
19
  gem.version = OmniAuth::Identity::VERSION
@@ -0,0 +1,14 @@
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
+ it 'should locate using the auth key using a where query' do
11
+ MongoMapperTestIdentity.should_receive(:where).with('ham_sandwich' => 'open faced').and_return(['wakka'])
12
+ MongoMapperTestIdentity.locate('open faced').should == 'wakka'
13
+ end
14
+ end
metadata CHANGED
@@ -1,30 +1,30 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-identity
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.rc2
5
- prerelease: 6
4
+ version: 1.0.0
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Michael Bleigh
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-28 00:00:00.000000000Z
12
+ date: 2011-11-02 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: omniauth
16
- requirement: &70150675915060 !ruby/object:Gem::Requirement
16
+ requirement: &70358092253920 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: 1.0.0.rc2
21
+ version: '1.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70150675915060
24
+ version_requirements: *70358092253920
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: maruku
27
- requirement: &70150675914520 !ruby/object:Gem::Requirement
27
+ requirement: &70358092252640 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0.6'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70150675914520
35
+ version_requirements: *70358092252640
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: simplecov
38
- requirement: &70150675913940 !ruby/object:Gem::Requirement
38
+ requirement: &70358092252120 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0.4'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70150675913940
46
+ version_requirements: *70358092252120
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rack-test
49
- requirement: &70150675913360 !ruby/object:Gem::Requirement
49
+ requirement: &70358092251580 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0.5'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70150675913360
57
+ version_requirements: *70358092251580
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rake
60
- requirement: &70150675912640 !ruby/object:Gem::Requirement
60
+ requirement: &70358092250860 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,21 +65,21 @@ dependencies:
65
65
  version: '0.8'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70150675912640
68
+ version_requirements: *70358092250860
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
- requirement: &70150675911880 !ruby/object:Gem::Requirement
71
+ requirement: &70358092249820 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
75
75
  - !ruby/object:Gem::Version
76
- version: '2.5'
76
+ version: '2.7'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70150675911880
79
+ version_requirements: *70358092249820
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: bcrypt-ruby
82
- requirement: &70150675911300 !ruby/object:Gem::Requirement
82
+ requirement: &70358092248940 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ~>
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '3.0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70150675911300
90
+ version_requirements: *70358092248940
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: activerecord
93
- requirement: &70150675910160 !ruby/object:Gem::Requirement
93
+ requirement: &70358092248120 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ~>
@@ -98,29 +98,40 @@ dependencies:
98
98
  version: '3.1'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *70150675910160
101
+ version_requirements: *70358092248120
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: mongoid
104
- requirement: &70150675903920 !ruby/object:Gem::Requirement
104
+ requirement: &70358092247540 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
- - - ~>
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: *70358092247540
113
+ - !ruby/object:Gem::Dependency
114
+ name: mongo_mapper
115
+ requirement: &70358092246700 !ruby/object:Gem::Requirement
116
+ none: false
117
+ requirements:
118
+ - - ! '>='
108
119
  - !ruby/object:Gem::Version
109
- version: '2.3'
120
+ version: '0'
110
121
  type: :development
111
122
  prerelease: false
112
- version_requirements: *70150675903920
123
+ version_requirements: *70358092246700
113
124
  - !ruby/object:Gem::Dependency
114
125
  name: bson_ext
115
- requirement: &70150675903280 !ruby/object:Gem::Requirement
126
+ requirement: &70358092246180 !ruby/object:Gem::Requirement
116
127
  none: false
117
128
  requirements:
118
- - - ~>
129
+ - - ! '>='
119
130
  - !ruby/object:Gem::Version
120
- version: '1.4'
131
+ version: '0'
121
132
  type: :development
122
133
  prerelease: false
123
- version_requirements: *70150675903280
134
+ version_requirements: *70358092246180
124
135
  description: Internal authentication handlers for OmniAuth.
125
136
  email:
126
137
  - michael@intridea.com
@@ -140,12 +151,14 @@ files:
140
151
  - lib/omniauth/identity.rb
141
152
  - lib/omniauth/identity/model.rb
142
153
  - lib/omniauth/identity/models/active_record.rb
154
+ - lib/omniauth/identity/models/mongo_mapper.rb
143
155
  - lib/omniauth/identity/models/mongoid.rb
144
156
  - lib/omniauth/identity/secure_password.rb
145
157
  - lib/omniauth/strategies/identity.rb
146
158
  - omniauth-identity.gemspec
147
159
  - spec/omniauth/identity/model_spec.rb
148
160
  - spec/omniauth/identity/models/active_record_spec.rb
161
+ - spec/omniauth/identity/models/mongo_mapper_spec.rb
149
162
  - spec/omniauth/identity/models/mongoid_spec.rb
150
163
  - spec/omniauth/identity/secure_password_spec.rb
151
164
  - spec/omniauth/strategies/identity_spec.rb
@@ -177,6 +190,7 @@ summary: Internal authentication handlers for OmniAuth.
177
190
  test_files:
178
191
  - spec/omniauth/identity/model_spec.rb
179
192
  - spec/omniauth/identity/models/active_record_spec.rb
193
+ - spec/omniauth/identity/models/mongo_mapper_spec.rb
180
194
  - spec/omniauth/identity/models/mongoid_spec.rb
181
195
  - spec/omniauth/identity/secure_password_spec.rb
182
196
  - spec/omniauth/strategies/identity_spec.rb