omniauth-identity 3.0.0 → 3.0.5
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/CHANGELOG.md +64 -2
- data/LICENSE +2 -1
- data/README.md +81 -42
- data/lib/omniauth-identity.rb +2 -0
- data/lib/omniauth-identity/version.rb +3 -1
- data/lib/omniauth/identity.rb +4 -0
- data/lib/omniauth/identity/model.rb +85 -29
- data/lib/omniauth/identity/models/active_record.rb +2 -0
- data/lib/omniauth/identity/models/couch_potato.rb +3 -0
- data/lib/omniauth/identity/models/mongoid.rb +3 -0
- data/lib/omniauth/identity/models/no_brainer.rb +31 -0
- data/lib/omniauth/identity/models/sequel.rb +48 -0
- data/lib/omniauth/identity/secure_password.rb +2 -0
- data/lib/omniauth/strategies/identity.rb +100 -32
- data/spec/omniauth/identity/model_spec.rb +2 -0
- data/spec/omniauth/identity/models/active_record_spec.rb +3 -1
- data/spec/omniauth/identity/models/couch_potato_spec.rb +10 -6
- data/spec/omniauth/identity/models/mongoid_spec.rb +11 -7
- data/spec/omniauth/identity/models/no_brainer_spec.rb +17 -0
- data/spec/omniauth/identity/models/sequel_spec.rb +23 -0
- data/spec/omniauth/identity/secure_password_spec.rb +5 -3
- data/spec/omniauth/strategies/identity_spec.rb +10 -11
- data/spec/spec_helper.rb +1 -0
- metadata +33 -133
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e486fff1d58be9ad944402aa2952bfceca493c6e78f1ba8c1e29cf6142543b01
|
|
4
|
+
data.tar.gz: a4be9557b902ff9dfe779baea964477aaf127519f8e389b82aa3cd83af3041da
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3f4d5a82e3ee782716992b1183cac66e6a29cee8037a8491a56bb8dd832ee9f22946eee7900d9e1d8d20d9bc5dcce3336652f25f606f027e87d79be6a9a00c6d
|
|
7
|
+
data.tar.gz: f2de6f02475fe119947bd6ba2f66e9585664b522833180e5327fcda8aa3b92c8fcb95d3bfb6baf45724851c1dd6c2a8144fe473f70715c6399b8025d73b195b2
|
data/CHANGELOG.md
CHANGED
|
@@ -8,22 +8,84 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
8
8
|
|
|
9
9
|
## [Unreleased]
|
|
10
10
|
|
|
11
|
+
## [3.0.5] - 2021-03-19
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
|
|
15
|
+
- Fix breaking changes introduced by [#86's](https://github.com/omniauth/omniauth-identity/pull/86) introduction of `:on_validation`
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- Define `#save`, `#persisted?` and `::create` on `Omniauth::Identity::Model`
|
|
20
|
+
- Add `@since` YARD tags to interface methods
|
|
21
|
+
- Refactor `Omniauth::Strategies::Identity.registration_phase` to support `Omniauth::Identity::Model`-inheriting classes that do not define `#save`.
|
|
22
|
+
- This support will be dropped in v4.0.
|
|
23
|
+
|
|
24
|
+
## [3.0.4] - 2021-02-14
|
|
25
|
+
|
|
26
|
+
### Added
|
|
27
|
+
|
|
28
|
+
- Add support for [sequel ORM](http://sequel.jeremyevans.net/)
|
|
29
|
+
|
|
30
|
+
## [3.0.3] - 2021-02-14
|
|
31
|
+
|
|
32
|
+
### Added
|
|
33
|
+
|
|
34
|
+
- Add option `:on_validation`, which can be used to add a Captcha
|
|
35
|
+
- See [example here](https://github.com/omniauth/omniauth-identity/pull/86#issue-63225122)
|
|
36
|
+
- Add support for nobrainer, an ORM for RethinkDB
|
|
37
|
+
- Validation error message on invalid registration form submission
|
|
38
|
+
|
|
39
|
+
### Removed
|
|
40
|
+
|
|
41
|
+
- ruby-head build... simply too slow
|
|
42
|
+
|
|
43
|
+
## [3.0.2] - 2021-02-14
|
|
44
|
+
|
|
45
|
+
### Fixed
|
|
46
|
+
|
|
47
|
+
- Github Actions CI Build for Ruby 2.4, 3.0 and ruby-head
|
|
48
|
+
- Updated copyright
|
|
49
|
+
- Code style cleanup
|
|
50
|
+
- Added Code Climate "Quality"
|
|
51
|
+
- Updated Readme
|
|
52
|
+
|
|
53
|
+
## [3.0.1] - 2021-02-14
|
|
54
|
+
|
|
55
|
+
### Fixed
|
|
56
|
+
|
|
57
|
+
- Github Actions CI Build for various Rubies
|
|
58
|
+
|
|
59
|
+
## [3.0] - 2021-02-13
|
|
60
|
+
|
|
11
61
|
### Added
|
|
62
|
+
|
|
63
|
+
- Compatibility with Ruby 3
|
|
12
64
|
- Add option `:enable_login` to bypass OmniAuth disabling of GET method (default `true`)
|
|
13
65
|
- NOTE: This restores compatibility between this gem and the current, core, omniauth gem!
|
|
14
66
|
- README updates, including a rename to README.md
|
|
67
|
+
- CODE_OF_CONDUCT.md using v2
|
|
68
|
+
- Rubocop
|
|
69
|
+
- Github Actions for Continuous Integration
|
|
70
|
+
- Minimum Ruby version = 2.4
|
|
71
|
+
- Automatically adds "provider" => "identity" when "provider" column is detected
|
|
72
|
+
- Documentation in README.md
|
|
15
73
|
|
|
16
74
|
### Removed
|
|
17
|
-
|
|
18
|
-
-
|
|
75
|
+
|
|
76
|
+
- Support for Rubies < 2.4
|
|
77
|
+
- Support for DataMapper, which died long ago.
|
|
78
|
+
- Unwanted git artifacts
|
|
19
79
|
|
|
20
80
|
## [2.0] - 2020-09-01
|
|
21
81
|
|
|
22
82
|
### Added
|
|
83
|
+
|
|
23
84
|
- CHANGELOG to maintain a history of changes.
|
|
24
85
|
- Include mongoid-rspec gem.
|
|
25
86
|
|
|
26
87
|
### Changed
|
|
88
|
+
|
|
27
89
|
- Fix failing Specs
|
|
28
90
|
- Update Spec syntax to RSpec 3
|
|
29
91
|
- Fix deprecation Warnings
|
data/LICENSE
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
Copyright (c)
|
|
1
|
+
Copyright (c) 2021 OmniAuth-Identity Maintainers
|
|
2
|
+
Copyright (c) 2020 Peter Boling, Andrew Roberts, and Jellybooks Ltd.
|
|
2
3
|
Copyright (c) 2010-2015 Michael Bleigh and Intridea, Inc.
|
|
3
4
|
|
|
4
5
|
Permission is hereby granted, free of charge, to any person obtaining
|
data/README.md
CHANGED
|
@@ -1,16 +1,26 @@
|
|
|
1
1
|
# OmniAuth Identity
|
|
2
2
|
|
|
3
|
+
[](https://rubygems.org/gems/omniauth-identity)
|
|
4
|
+
[](https://depfu.com/github/omniauth/omniauth-identity?project_id=22381)
|
|
5
|
+
[](https://actions-badge.atrox.dev/omniauth/omniauth-identity/goto)
|
|
6
|
+
[](https://codeclimate.com/github/omniauth/omniauth-identity/maintainability)
|
|
7
|
+
[](https://codeclimate.com/github/omniauth/omniauth-identity/test_coverage)
|
|
8
|
+
[](https://opensource.org/licenses/MIT)
|
|
9
|
+
[](https://www.codetriage.com/omniauth/omniauth-identity)
|
|
10
|
+
[](https://rubygems.org/gems/omniauth-identity)
|
|
11
|
+
|
|
3
12
|
The OmniAuth Identity gem provides a way for applications to utilize a
|
|
4
|
-
traditional
|
|
13
|
+
traditional username/password based authentication system without the need
|
|
5
14
|
to give up the simple authentication flow provided by OmniAuth. Identity
|
|
6
15
|
is designed on purpose to be as featureless as possible: it provides the
|
|
7
16
|
basic construct for user management and then gets out of the way.
|
|
8
17
|
|
|
9
18
|
## Compatibility
|
|
10
19
|
|
|
11
|
-
This gem is compatible with, as of Feb 2021:
|
|
12
|
-
|
|
13
|
-
|
|
20
|
+
This gem is compatible with, as of Feb 2021, version 3:
|
|
21
|
+
|
|
22
|
+
* Latest released version of omniauth, v2.0.2
|
|
23
|
+
* Ruby 2.4, 2.5, 2.6, 2.7, 3.0, ruby-head
|
|
14
24
|
|
|
15
25
|
## Installation
|
|
16
26
|
|
|
@@ -48,6 +58,13 @@ with `:model` argument above) that will be able to persist the information
|
|
|
48
58
|
provided by the user. Luckily for you, there are pre-built models for popular
|
|
49
59
|
ORMs that make this dead simple.
|
|
50
60
|
|
|
61
|
+
Once you've got an `Identity` persistence model and the strategy up and
|
|
62
|
+
running, you can point users to `/auth/identity` and it will request
|
|
63
|
+
that they log in or give them the opportunity to sign up for an account.
|
|
64
|
+
Once they have authenticated with their identity, OmniAuth will call
|
|
65
|
+
through to `/auth/identity/callback` with the same kinds of information
|
|
66
|
+
it would had the user authenticated through an external provider.
|
|
67
|
+
|
|
51
68
|
**Note:** OmniAuth Identity is different from many other user authentication
|
|
52
69
|
systems in that it is *not* built to store authentication information in your primary
|
|
53
70
|
`User` model. Instead, the `Identity` model should be **associated** with your
|
|
@@ -68,52 +85,42 @@ class Identity < OmniAuth::Identity::Models::ActiveRecord
|
|
|
68
85
|
end
|
|
69
86
|
```
|
|
70
87
|
|
|
71
|
-
###
|
|
88
|
+
### Sequel
|
|
72
89
|
|
|
73
|
-
|
|
74
|
-
fields that you will need.
|
|
90
|
+
[Sequel](http://sequel.jeremyevans.net/) is an alternative to ActiveRecord.
|
|
75
91
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
include Mongoid::Document
|
|
79
|
-
include OmniAuth::Identity::Models::Mongoid
|
|
92
|
+
Just include `OmniAuth::Identity::Models::Sequel` mixin, and specify
|
|
93
|
+
whatever else you will need.
|
|
80
94
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
95
|
+
```ruby
|
|
96
|
+
class SequelTestIdentity < Sequel::Model
|
|
97
|
+
include OmniAuth::Identity::Models::Sequel
|
|
98
|
+
auth_key :email
|
|
99
|
+
# whatever else you want!
|
|
84
100
|
end
|
|
85
101
|
```
|
|
86
102
|
|
|
87
|
-
### MongoMapper
|
|
88
|
-
|
|
89
|
-
Unfortunately MongoMapper is **not supported** in `omniauth-identity` from >= v2.0 as a result of it
|
|
90
|
-
not being maintained for several years.
|
|
91
103
|
|
|
92
|
-
|
|
93
|
-
requirements. Therefore precedence was given to Mongoid as it is significantly more
|
|
94
|
-
popular and actively maintained.
|
|
95
|
-
|
|
96
|
-
### DataMapper
|
|
104
|
+
### Mongoid
|
|
97
105
|
|
|
98
|
-
Include the `OmniAuth::Identity::Models::
|
|
106
|
+
Include the `OmniAuth::Identity::Models::Mongoid` mixin and specify
|
|
99
107
|
fields that you will need.
|
|
100
108
|
|
|
101
109
|
```ruby
|
|
102
110
|
class Identity
|
|
103
|
-
include
|
|
104
|
-
include OmniAuth::Identity::Models::
|
|
105
|
-
|
|
106
|
-
property :id, Serial
|
|
107
|
-
property :email, String
|
|
108
|
-
property :password_digest, Text
|
|
111
|
+
include Mongoid::Document
|
|
112
|
+
include OmniAuth::Identity::Models::Mongoid
|
|
109
113
|
|
|
110
|
-
|
|
114
|
+
field :email, type: String
|
|
115
|
+
field :name, type: String
|
|
116
|
+
field :password_digest, type: String
|
|
111
117
|
end
|
|
112
118
|
```
|
|
113
119
|
|
|
114
120
|
### CouchPotato
|
|
115
121
|
|
|
116
|
-
Include the `OmniAuth::Identity::Models::CouchPotatoModule` mixin and specify
|
|
122
|
+
Include the `OmniAuth::Identity::Models::CouchPotatoModule` mixin and specify
|
|
123
|
+
fields that you will need.
|
|
117
124
|
|
|
118
125
|
```ruby
|
|
119
126
|
class Identity
|
|
@@ -131,13 +138,25 @@ class Identity
|
|
|
131
138
|
end
|
|
132
139
|
```
|
|
133
140
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
+
### NoBrainer
|
|
142
|
+
|
|
143
|
+
[NoBrainer](http://nobrainer.io/) is an ORM for [RethinkDB](https://rethinkdb.com/).
|
|
144
|
+
|
|
145
|
+
Include the `OmniAuth::Identity::Models::NoBrainer` mixin and specify
|
|
146
|
+
fields that you will need.
|
|
147
|
+
|
|
148
|
+
```ruby
|
|
149
|
+
class Identity
|
|
150
|
+
include NoBrainer::Document
|
|
151
|
+
include OmniAuth::Identity::Models::NoBrainer
|
|
152
|
+
|
|
153
|
+
auth_key :email
|
|
154
|
+
end
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Ruby Object Mapper
|
|
158
|
+
|
|
159
|
+
Would love to add a mixin for the [Ruby Object Mapper (ROM)](https://rom-rb.org/) if anyone wants to work on it!
|
|
141
160
|
|
|
142
161
|
## Custom Auth Model
|
|
143
162
|
|
|
@@ -226,12 +245,32 @@ Note: Be careful when customizing `locate_conditions`. The best way to modify t
|
|
|
226
245
|
to copy the default value, and then add to the hash. Removing the default condition will almost
|
|
227
246
|
always break things!
|
|
228
247
|
|
|
248
|
+
## Customizing Other Things
|
|
249
|
+
|
|
250
|
+
From the code - here are the options we have for you, a couple of which are documented above, and the rest are documented... in the specs we hope!?
|
|
251
|
+
```
|
|
252
|
+
option :fields, %i[name email]
|
|
253
|
+
|
|
254
|
+
# Primary Feature Switches:
|
|
255
|
+
option :enable_registration, true # See #other_phase and #request_phase
|
|
256
|
+
option :enable_login, true # See #other_phase
|
|
257
|
+
|
|
258
|
+
# Customization Options:
|
|
259
|
+
option :on_login, nil # See #request_phase
|
|
260
|
+
option :on_validation, nil # See #registration_phase
|
|
261
|
+
option :on_registration, nil # See #registration_phase
|
|
262
|
+
option :on_failed_registration, nil # See #registration_phase
|
|
263
|
+
option :locate_conditions, ->(req) { { model.auth_key => req['auth_key'] } }
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
Please contribute some documentation if you have the gumption! The maintainer's time is limited, and sometimes the authors of PRs with new options don't update the _this_ readme. 😭
|
|
267
|
+
|
|
229
268
|
## License
|
|
230
269
|
|
|
231
270
|
MIT License. See LICENSE for details.
|
|
232
271
|
|
|
233
272
|
## Copyright
|
|
234
273
|
|
|
235
|
-
Copyright (c) 2021 OmniAuth-Identity Maintainers
|
|
236
|
-
Copyright (c) 2020 Peter Boling, Andrew Roberts, and Jellybooks Ltd.
|
|
237
|
-
Copyright (c) 2010-2015 Michael Bleigh, and Intridea, Inc.
|
|
274
|
+
* Copyright (c) 2021 OmniAuth-Identity Maintainers
|
|
275
|
+
* Copyright (c) 2020 Peter Boling, Andrew Roberts, and Jellybooks Ltd.
|
|
276
|
+
* Copyright (c) 2010-2015 Michael Bleigh, and Intridea, Inc.
|
data/lib/omniauth-identity.rb
CHANGED
data/lib/omniauth/identity.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'omniauth'
|
|
2
4
|
|
|
3
5
|
module OmniAuth
|
|
@@ -12,6 +14,8 @@ module OmniAuth
|
|
|
12
14
|
autoload :ActiveRecord, 'omniauth/identity/models/active_record'
|
|
13
15
|
autoload :Mongoid, 'omniauth/identity/models/mongoid'
|
|
14
16
|
autoload :CouchPotatoModule, 'omniauth/identity/models/couch_potato'
|
|
17
|
+
autoload :NoBrainer, 'omniauth/identity/models/no_brainer'
|
|
18
|
+
autoload :Sequel, 'omniauth/identity/models/sequel'
|
|
15
19
|
end
|
|
16
20
|
end
|
|
17
21
|
end
|
|
@@ -1,24 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module OmniAuth
|
|
2
4
|
module Identity
|
|
3
5
|
# This module provides an includable interface for implementing the
|
|
4
6
|
# necessary API for OmniAuth Identity to properly locate identities
|
|
5
|
-
# and provide all necessary information.
|
|
6
|
-
#
|
|
7
|
-
#
|
|
7
|
+
# and provide all necessary information.
|
|
8
|
+
#
|
|
9
|
+
# All methods marked as abstract must be implemented in the
|
|
10
|
+
# including class for things to work properly.
|
|
11
|
+
#
|
|
12
|
+
### Singleton API
|
|
13
|
+
#
|
|
14
|
+
# * locate(key)
|
|
15
|
+
# * create(*args) - Deprecated in v3.0.5; Will be removed in v4.0
|
|
16
|
+
#
|
|
17
|
+
### Instance API
|
|
18
|
+
#
|
|
19
|
+
# * save
|
|
20
|
+
# * persisted?
|
|
21
|
+
# * authenticate(password)
|
|
22
|
+
#
|
|
8
23
|
module Model
|
|
24
|
+
SCHEMA_ATTRIBUTES = %w[name email nickname first_name last_name location description image phone].freeze
|
|
25
|
+
|
|
9
26
|
def self.included(base)
|
|
10
27
|
base.extend ClassMethods
|
|
11
28
|
end
|
|
12
29
|
|
|
13
30
|
module ClassMethods
|
|
14
|
-
|
|
15
|
-
#
|
|
16
|
-
# @abstract
|
|
17
|
-
# @param [String] key The unique login key.
|
|
18
|
-
# @return [Model] An instance of the identity model class.
|
|
19
|
-
def locate(key)
|
|
20
|
-
raise NotImplementedError
|
|
21
|
-
end
|
|
31
|
+
extend Gem::Deprecate
|
|
22
32
|
|
|
23
33
|
# Authenticate a user with the given key and password.
|
|
24
34
|
#
|
|
@@ -37,10 +47,57 @@ module OmniAuth
|
|
|
37
47
|
# @return [String] The method name.
|
|
38
48
|
def auth_key(method = false)
|
|
39
49
|
@auth_key = method.to_s unless method == false
|
|
40
|
-
@auth_key = nil if @auth_key == ''
|
|
50
|
+
@auth_key = nil if !defined?(@auth_key) || @auth_key == ''
|
|
41
51
|
|
|
42
52
|
@auth_key || 'email'
|
|
43
53
|
end
|
|
54
|
+
|
|
55
|
+
# Persists a new Identity object to the ORM.
|
|
56
|
+
# Defaults to calling super. Override as needed per ORM.
|
|
57
|
+
#
|
|
58
|
+
# @deprecated v4.0 will begin using {#new} with {#save} instead.
|
|
59
|
+
# @abstract
|
|
60
|
+
# @param [Hash] args Attributes of the new instance.
|
|
61
|
+
# @return [Model] An instance of the identity model class.
|
|
62
|
+
# @since 3.0.5
|
|
63
|
+
def create(*args)
|
|
64
|
+
raise NotImplementedError unless defined?(super)
|
|
65
|
+
|
|
66
|
+
super
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# Locate an identity given its unique login key.
|
|
70
|
+
#
|
|
71
|
+
# @abstract
|
|
72
|
+
# @param [String] key The unique login key.
|
|
73
|
+
# @return [Model] An instance of the identity model class.
|
|
74
|
+
def locate(key)
|
|
75
|
+
raise NotImplementedError
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Persists a new Identity object to the ORM.
|
|
80
|
+
# Default raises an error. Override as needed per ORM.
|
|
81
|
+
#
|
|
82
|
+
# @abstract
|
|
83
|
+
# @return [Model] An instance of the identity model class.
|
|
84
|
+
# @since 3.0.5
|
|
85
|
+
def save
|
|
86
|
+
raise NotImplementedError unless defined?(super)
|
|
87
|
+
|
|
88
|
+
super
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# Checks if the Identity object is persisted in the ORM.
|
|
92
|
+
# Defaults to calling super. Override as needed per ORM.
|
|
93
|
+
#
|
|
94
|
+
# @abstract
|
|
95
|
+
# @return [true or false] true if object exists, false if not.
|
|
96
|
+
# @since 3.0.5
|
|
97
|
+
def persisted?
|
|
98
|
+
raise NotImplementedError unless defined?(super)
|
|
99
|
+
|
|
100
|
+
super
|
|
44
101
|
end
|
|
45
102
|
|
|
46
103
|
# Returns self if the provided password is correct, false
|
|
@@ -53,22 +110,6 @@ module OmniAuth
|
|
|
53
110
|
raise NotImplementedError
|
|
54
111
|
end
|
|
55
112
|
|
|
56
|
-
SCHEMA_ATTRIBUTES = %w[name email nickname first_name last_name location description image phone]
|
|
57
|
-
# A hash of as much of the standard OmniAuth schema as is stored
|
|
58
|
-
# in this particular model. By default, this will call instance
|
|
59
|
-
# methods for each of the attributes it needs in turn, ignoring
|
|
60
|
-
# any for which `#respond_to?` is `false`.
|
|
61
|
-
#
|
|
62
|
-
# If `first_name`, `nickname`, and/or `last_name` is provided but
|
|
63
|
-
# `name` is not, it will be automatically calculated.
|
|
64
|
-
#
|
|
65
|
-
# @return [Hash] A string-keyed hash of user information.
|
|
66
|
-
def info
|
|
67
|
-
SCHEMA_ATTRIBUTES.each_with_object({}) do |attribute, hash|
|
|
68
|
-
hash[attribute] = send(attribute) if respond_to?(attribute)
|
|
69
|
-
end
|
|
70
|
-
end
|
|
71
|
-
|
|
72
113
|
# An identifying string that must be globally unique to the
|
|
73
114
|
# application. Defaults to stringifying the `id` method.
|
|
74
115
|
#
|
|
@@ -104,13 +145,28 @@ module OmniAuth
|
|
|
104
145
|
# @param [String] value The value to which the auth key should be
|
|
105
146
|
# set.
|
|
106
147
|
def auth_key=(value)
|
|
107
|
-
auth_key_setter =
|
|
148
|
+
auth_key_setter = "#{self.class.auth_key}=".to_sym
|
|
108
149
|
if respond_to?(auth_key_setter)
|
|
109
150
|
send(auth_key_setter, value)
|
|
110
151
|
else
|
|
111
152
|
raise NotImplementedError
|
|
112
153
|
end
|
|
113
154
|
end
|
|
155
|
+
|
|
156
|
+
# A hash of as much of the standard OmniAuth schema as is stored
|
|
157
|
+
# in this particular model. By default, this will call instance
|
|
158
|
+
# methods for each of the attributes it needs in turn, ignoring
|
|
159
|
+
# any for which `#respond_to?` is `false`.
|
|
160
|
+
#
|
|
161
|
+
# If `first_name`, `nickname`, and/or `last_name` is provided but
|
|
162
|
+
# `name` is not, it will be automatically calculated.
|
|
163
|
+
#
|
|
164
|
+
# @return [Hash] A string-keyed hash of user information.
|
|
165
|
+
def info
|
|
166
|
+
SCHEMA_ATTRIBUTES.each_with_object({}) do |attribute, hash|
|
|
167
|
+
hash[attribute] = send(attribute) if respond_to?(attribute)
|
|
168
|
+
end
|
|
169
|
+
end
|
|
114
170
|
end
|
|
115
171
|
end
|
|
116
172
|
end
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'couch_potato'
|
|
2
4
|
|
|
3
5
|
module OmniAuth
|
|
4
6
|
module Identity
|
|
5
7
|
module Models
|
|
6
8
|
# can not be named CouchPotato since there is a class with that name
|
|
9
|
+
# NOTE: CouchPotato is based on ActiveModel.
|
|
7
10
|
module CouchPotatoModule
|
|
8
11
|
def self.included(base)
|
|
9
12
|
base.class_eval do
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'nobrainer'
|
|
4
|
+
|
|
5
|
+
module OmniAuth
|
|
6
|
+
module Identity
|
|
7
|
+
module Models
|
|
8
|
+
# http://nobrainer.io/ an ORM for RethinkDB
|
|
9
|
+
# NOTE: NoBrainer is based on ActiveModel.
|
|
10
|
+
module NoBrainer
|
|
11
|
+
def self.included(base)
|
|
12
|
+
base.class_eval do
|
|
13
|
+
include ::OmniAuth::Identity::Model
|
|
14
|
+
include ::OmniAuth::Identity::SecurePassword
|
|
15
|
+
|
|
16
|
+
has_secure_password
|
|
17
|
+
|
|
18
|
+
def self.auth_key=(key)
|
|
19
|
+
super
|
|
20
|
+
validates_uniqueness_of key, case_sensitive: false
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def self.locate(search_hash)
|
|
24
|
+
where(search_hash).first
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'nobrainer'
|
|
4
|
+
|
|
5
|
+
module OmniAuth
|
|
6
|
+
module Identity
|
|
7
|
+
module Models
|
|
8
|
+
# http://sequel.jeremyevans.net/ an SQL ORM
|
|
9
|
+
# NOTE: Sequel is *not* based on ActiveModel, but supports the API we need, except for `persisted`:
|
|
10
|
+
# * create
|
|
11
|
+
# * save, but save is deprecated in favor of `save_changes`
|
|
12
|
+
module Sequel
|
|
13
|
+
def self.included(base)
|
|
14
|
+
base.class_eval do
|
|
15
|
+
# NOTE: Using the deprecated :validations_class_methods because it defines
|
|
16
|
+
# validates_confirmation_of, while current :validation_helpers does not.
|
|
17
|
+
# plugin :validation_helpers
|
|
18
|
+
plugin :validation_class_methods
|
|
19
|
+
|
|
20
|
+
include OmniAuth::Identity::Model
|
|
21
|
+
include ::OmniAuth::Identity::SecurePassword
|
|
22
|
+
|
|
23
|
+
has_secure_password
|
|
24
|
+
|
|
25
|
+
alias_method :persisted?, :valid?
|
|
26
|
+
|
|
27
|
+
def self.auth_key=(key)
|
|
28
|
+
super
|
|
29
|
+
validates_uniqueness_of :key, case_sensitive: false
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def self.locate(search_hash)
|
|
33
|
+
where(search_hash).first
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def persisted?
|
|
37
|
+
exists?
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def save
|
|
41
|
+
save_changes
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -1,33 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module OmniAuth
|
|
2
4
|
module Strategies
|
|
3
5
|
# The identity strategy allows you to provide simple internal
|
|
4
6
|
# user authentication using the same process flow that you
|
|
5
7
|
# use for external OmniAuth providers.
|
|
6
8
|
class Identity
|
|
9
|
+
DEFAULT_REGISTRATION_FIELDS = %i[password password_confirmation].freeze
|
|
7
10
|
include OmniAuth::Strategy
|
|
8
|
-
|
|
9
11
|
option :fields, %i[name email]
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
option :
|
|
13
|
-
option :
|
|
14
|
-
|
|
12
|
+
|
|
13
|
+
# Primary Feature Switches:
|
|
14
|
+
option :enable_registration, true # See #other_phase and #request_phase
|
|
15
|
+
option :enable_login, true # See #other_phase
|
|
16
|
+
|
|
17
|
+
# Customization Options:
|
|
18
|
+
option :on_login, nil # See #request_phase
|
|
19
|
+
option :on_validation, nil # See #registration_phase
|
|
20
|
+
option :on_registration, nil # See #registration_phase
|
|
21
|
+
option :on_failed_registration, nil # See #registration_phase
|
|
15
22
|
option :locate_conditions, ->(req) { { model.auth_key => req['auth_key'] } }
|
|
16
23
|
|
|
17
24
|
def request_phase
|
|
18
25
|
if options[:on_login]
|
|
19
26
|
options[:on_login].call(env)
|
|
20
27
|
else
|
|
21
|
-
|
|
22
|
-
title: (options[:title] || 'Identity Verification'),
|
|
23
|
-
url: callback_path
|
|
24
|
-
) do |f|
|
|
25
|
-
f.text_field 'Login', 'auth_key'
|
|
26
|
-
f.password_field 'Password', 'password'
|
|
27
|
-
if options[:enable_registration]
|
|
28
|
-
f.html "<p align='center'><a href='#{registration_path}'>Create an Identity</a></p>"
|
|
29
|
-
end
|
|
30
|
-
end.to_response
|
|
28
|
+
build_omniauth_login_form.to_response
|
|
31
29
|
end
|
|
32
30
|
end
|
|
33
31
|
|
|
@@ -58,36 +56,32 @@ module OmniAuth
|
|
|
58
56
|
end
|
|
59
57
|
end
|
|
60
58
|
|
|
61
|
-
def registration_form
|
|
59
|
+
def registration_form(validation_message = nil)
|
|
62
60
|
if options[:on_registration]
|
|
63
61
|
options[:on_registration].call(env)
|
|
64
62
|
else
|
|
65
|
-
|
|
66
|
-
options[:fields].each do |field|
|
|
67
|
-
f.text_field field.to_s.capitalize, field.to_s
|
|
68
|
-
end
|
|
69
|
-
f.password_field 'Password', 'password'
|
|
70
|
-
f.password_field 'Confirm Password', 'password_confirmation'
|
|
71
|
-
end.to_response
|
|
63
|
+
build_omniauth_registration_form(validation_message).to_response
|
|
72
64
|
end
|
|
73
65
|
end
|
|
74
66
|
|
|
75
67
|
def registration_phase
|
|
76
|
-
attributes = (options[:fields] +
|
|
68
|
+
attributes = (options[:fields] + DEFAULT_REGISTRATION_FIELDS).each_with_object({}) do |k, h|
|
|
77
69
|
h[k] = request[k.to_s]
|
|
78
70
|
end
|
|
79
71
|
if model.respond_to?(:column_names) && model.column_names.include?('provider')
|
|
80
72
|
attributes.reverse_merge!(provider: 'identity')
|
|
81
73
|
end
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
env['PATH_INFO'] = callback_path
|
|
85
|
-
callback_phase
|
|
86
|
-
elsif options[:on_failed_registration]
|
|
74
|
+
if saving_instead_of_creating?
|
|
75
|
+
@identity = model.new(attributes)
|
|
87
76
|
env['omniauth.identity'] = @identity
|
|
88
|
-
|
|
77
|
+
if !validating? || valid?
|
|
78
|
+
@identity.save
|
|
79
|
+
registration_result
|
|
80
|
+
else
|
|
81
|
+
registration_failure('Validation failed')
|
|
82
|
+
end
|
|
89
83
|
else
|
|
90
|
-
|
|
84
|
+
deprecated_registration(attributes)
|
|
91
85
|
end
|
|
92
86
|
end
|
|
93
87
|
|
|
@@ -115,6 +109,80 @@ module OmniAuth
|
|
|
115
109
|
def model
|
|
116
110
|
options[:model] || ::Identity
|
|
117
111
|
end
|
|
112
|
+
|
|
113
|
+
private
|
|
114
|
+
|
|
115
|
+
def build_omniauth_login_form
|
|
116
|
+
OmniAuth::Form.build(
|
|
117
|
+
title: (options[:title] || 'Identity Verification'),
|
|
118
|
+
url: callback_path
|
|
119
|
+
) do |f|
|
|
120
|
+
f.text_field 'Login', 'auth_key'
|
|
121
|
+
f.password_field 'Password', 'password'
|
|
122
|
+
if options[:enable_registration]
|
|
123
|
+
f.html "<p align='center'><a href='#{registration_path}'>Create an Identity</a></p>"
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
def build_omniauth_registration_form(validation_message)
|
|
129
|
+
OmniAuth::Form.build(title: 'Register Identity') do |f|
|
|
130
|
+
f.html "<p style='color:red'>#{validation_message}</p>" if validation_message
|
|
131
|
+
options[:fields].each do |field|
|
|
132
|
+
f.text_field field.to_s.capitalize, field.to_s
|
|
133
|
+
end
|
|
134
|
+
f.password_field 'Password', 'password'
|
|
135
|
+
f.password_field 'Confirm Password', 'password_confirmation'
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
def saving_instead_of_creating?
|
|
140
|
+
model.respond_to?(:save) && model.respond_to?(:persisted?)
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
# Validates the model before it is persisted
|
|
144
|
+
#
|
|
145
|
+
# @return [truthy or falsey] :on_validation option is truthy or falsey
|
|
146
|
+
def validating?
|
|
147
|
+
options[:on_validation]
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
# Validates the model before it is persisted
|
|
151
|
+
#
|
|
152
|
+
# @return [true or false] result of :on_validation call
|
|
153
|
+
def valid?
|
|
154
|
+
# on_validation may run a Captcha or other validation mechanism
|
|
155
|
+
# Must return true when validation passes, false otherwise
|
|
156
|
+
!!options[:on_validation].call(env: env)
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
def registration_failure(message)
|
|
160
|
+
if options[:on_failed_registration]
|
|
161
|
+
options[:on_failed_registration].call(env)
|
|
162
|
+
else
|
|
163
|
+
registration_form(message)
|
|
164
|
+
end
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
def registration_result
|
|
168
|
+
if @identity.persisted?
|
|
169
|
+
env['PATH_INFO'] = callback_path
|
|
170
|
+
callback_phase
|
|
171
|
+
else
|
|
172
|
+
registration_failure('One or more fields were invalid')
|
|
173
|
+
end
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
def deprecated_registration(attributes)
|
|
177
|
+
warn <<~CREATEDEP
|
|
178
|
+
[DEPRECATION] Please define '#{model.class}#save'.
|
|
179
|
+
Behavior based on '#{model.class}.create' will be removed in omniauth-identity v4.0.
|
|
180
|
+
See lib/omniauth/identity/model.rb
|
|
181
|
+
CREATEDEP
|
|
182
|
+
@identity = model.create(attributes)
|
|
183
|
+
env['omniauth.identity'] = @identity
|
|
184
|
+
registration_result
|
|
185
|
+
end
|
|
118
186
|
end
|
|
119
187
|
end
|
|
120
188
|
end
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
RSpec.describe(OmniAuth::Identity::Models::ActiveRecord, db: true) do
|
|
2
4
|
describe 'model', type: :model do
|
|
3
5
|
subject(:model_klass) do
|
|
4
6
|
AnonymousActiveRecord.generate(
|
|
5
7
|
parent_klass: 'OmniAuth::Identity::Models::ActiveRecord',
|
|
6
|
-
columns: %w[
|
|
8
|
+
columns: OmniAuth::Identity::Model::SCHEMA_ATTRIBUTES | %w[provider password_digest],
|
|
7
9
|
connection_params: { adapter: 'sqlite3', encoding: 'utf8', database: ':memory:' }
|
|
8
10
|
) do
|
|
9
11
|
def flower
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
include OmniAuth::Identity::Models::CouchPotatoModule
|
|
5
|
-
auth_key :ham_sandwich
|
|
6
|
-
end
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'couch_potato'
|
|
7
4
|
|
|
5
|
+
class CouchPotatoTestIdentity
|
|
6
|
+
include CouchPotato::Persistence
|
|
7
|
+
include OmniAuth::Identity::Models::CouchPotatoModule
|
|
8
|
+
auth_key :ham_sandwich
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
RSpec.describe(OmniAuth::Identity::Models::CouchPotatoModule, db: true) do
|
|
8
12
|
describe 'model', type: :model do
|
|
9
13
|
subject { CouchPotatoTestIdentity }
|
|
10
14
|
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
include OmniAuth::Identity::Models::Mongoid
|
|
5
|
-
auth_key :ham_sandwich
|
|
6
|
-
store_in database: 'db1', collection: 'mongoid_test_identities', client: 'secondary'
|
|
7
|
-
end
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'mongoid'
|
|
8
4
|
|
|
5
|
+
class MongoidTestIdentity
|
|
6
|
+
include Mongoid::Document
|
|
7
|
+
include OmniAuth::Identity::Models::Mongoid
|
|
8
|
+
auth_key :ham_sandwich
|
|
9
|
+
store_in database: 'db1', collection: 'mongoid_test_identities', client: 'secondary'
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
RSpec.describe(OmniAuth::Identity::Models::Mongoid, db: true) do
|
|
9
13
|
describe 'model', type: :model do
|
|
10
14
|
subject { MongoidTestIdentity }
|
|
11
15
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'nobrainer'
|
|
4
|
+
|
|
5
|
+
class NobrainerTestIdentity
|
|
6
|
+
include NoBrainer::Document
|
|
7
|
+
include OmniAuth::Identity::Models::NoBrainer
|
|
8
|
+
auth_key :ham_sandwich
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
RSpec.describe(OmniAuth::Identity::Models::NoBrainer, db: true) do
|
|
12
|
+
it 'delegates locate to the where query method' do
|
|
13
|
+
allow(NobrainerTestIdentity).to receive(:where).with('ham_sandwich' => 'open faced',
|
|
14
|
+
'category' => 'sandwiches').and_return(['wakka'])
|
|
15
|
+
expect(NobrainerTestIdentity.locate('ham_sandwich' => 'open faced', 'category' => 'sandwiches')).to eq('wakka')
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'sequel'
|
|
4
|
+
# Connect to an in-memory sqlite3 database.
|
|
5
|
+
DB = Sequel.sqlite
|
|
6
|
+
DB.create_table :sequel_test_identities do
|
|
7
|
+
primary_key :id
|
|
8
|
+
String :ham_sandwich, null: false
|
|
9
|
+
String :password_digest, null: false
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
class SequelTestIdentity < Sequel::Model
|
|
13
|
+
include OmniAuth::Identity::Models::Sequel
|
|
14
|
+
auth_key :ham_sandwich
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
RSpec.describe(OmniAuth::Identity::Models::Sequel, db: true) do
|
|
18
|
+
it 'delegates locate to the where query method' do
|
|
19
|
+
allow(SequelTestIdentity).to receive(:where).with('ham_sandwich' => 'open faced',
|
|
20
|
+
'category' => 'sandwiches').and_return(['wakka'])
|
|
21
|
+
expect(SequelTestIdentity.locate('ham_sandwich' => 'open faced', 'category' => 'sandwiches')).to eq('wakka')
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
class HasTheMethod
|
|
2
4
|
def self.has_secure_password; end
|
|
3
5
|
end
|
|
@@ -8,17 +10,17 @@ end
|
|
|
8
10
|
RSpec.describe OmniAuth::Identity::SecurePassword do
|
|
9
11
|
it 'extends with the class methods if it does not have the method' do
|
|
10
12
|
expect(DoesNotHaveTheMethod).to receive(:extend).with(OmniAuth::Identity::SecurePassword::ClassMethods)
|
|
11
|
-
DoesNotHaveTheMethod.include
|
|
13
|
+
DoesNotHaveTheMethod.include described_class
|
|
12
14
|
end
|
|
13
15
|
|
|
14
16
|
it 'does not extend if the method is already defined' do
|
|
15
17
|
expect(HasTheMethod).not_to receive(:extend)
|
|
16
|
-
HasTheMethod.include
|
|
18
|
+
HasTheMethod.include described_class
|
|
17
19
|
end
|
|
18
20
|
|
|
19
21
|
it 'responds to has_secure_password afterwards' do
|
|
20
22
|
[HasTheMethod, DoesNotHaveTheMethod].each do |klass|
|
|
21
|
-
klass.send(:include,
|
|
23
|
+
klass.send(:include, described_class)
|
|
22
24
|
expect(klass).to be_respond_to(:has_secure_password)
|
|
23
25
|
end
|
|
24
26
|
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
RSpec.describe OmniAuth::Strategies::Identity do
|
|
2
4
|
attr_accessor :app
|
|
3
5
|
|
|
@@ -6,7 +8,8 @@ RSpec.describe OmniAuth::Strategies::Identity do
|
|
|
6
8
|
let(:identity_options) { {} }
|
|
7
9
|
let(:anon_ar) do
|
|
8
10
|
AnonymousActiveRecord.generate(
|
|
9
|
-
|
|
11
|
+
parent_klass: 'OmniAuth::Identity::Models::ActiveRecord',
|
|
12
|
+
columns: OmniAuth::Identity::Model::SCHEMA_ATTRIBUTES | %w[provider password_digest],
|
|
10
13
|
connection_params: { adapter: 'sqlite3', encoding: 'utf8', database: ':memory:' }
|
|
11
14
|
) do
|
|
12
15
|
def balloon
|
|
@@ -201,16 +204,10 @@ RSpec.describe OmniAuth::Strategies::Identity do
|
|
|
201
204
|
}
|
|
202
205
|
end
|
|
203
206
|
|
|
204
|
-
before do
|
|
205
|
-
allow(anon_ar).to receive('auth_key').and_return('email')
|
|
206
|
-
m = double(uid: 'abc', name: 'Awesome Dude', email: 'awesome@example.com',
|
|
207
|
-
info: { name: 'DUUUUDE!' }, persisted?: true)
|
|
208
|
-
expect(anon_ar).to receive(:create).with(properties).and_return(m)
|
|
209
|
-
end
|
|
210
|
-
|
|
211
207
|
it 'sets the auth hash' do
|
|
212
208
|
post '/auth/identity/register', properties
|
|
213
|
-
expect(auth_hash['uid']).to
|
|
209
|
+
expect(auth_hash['uid']).to match(/\d+/)
|
|
210
|
+
expect(auth_hash['provider']).to eq('identity')
|
|
214
211
|
end
|
|
215
212
|
end
|
|
216
213
|
|
|
@@ -224,16 +221,17 @@ RSpec.describe OmniAuth::Strategies::Identity do
|
|
|
224
221
|
provider: 'identity'
|
|
225
222
|
}
|
|
226
223
|
end
|
|
227
|
-
let(:invalid_identity) { double(persisted?: false) }
|
|
224
|
+
let(:invalid_identity) { double(persisted?: false, save: false) }
|
|
228
225
|
|
|
229
226
|
before do
|
|
230
|
-
expect(anon_ar).to receive(:
|
|
227
|
+
expect(anon_ar).to receive(:new).with(properties).and_return(invalid_identity)
|
|
231
228
|
end
|
|
232
229
|
|
|
233
230
|
context 'default' do
|
|
234
231
|
it 'shows registration form' do
|
|
235
232
|
post '/auth/identity/register', properties
|
|
236
233
|
expect(last_response.body).to be_include('Register Identity')
|
|
234
|
+
expect(last_response.body).to be_include('One or more fields were invalid')
|
|
237
235
|
end
|
|
238
236
|
end
|
|
239
237
|
|
|
@@ -248,6 +246,7 @@ RSpec.describe OmniAuth::Strategies::Identity do
|
|
|
248
246
|
post '/auth/identity/register', properties
|
|
249
247
|
expect(identity_hash).to eq(invalid_identity)
|
|
250
248
|
expect(last_response.body).to be_include("FAIL'DOH!")
|
|
249
|
+
expect(last_response.body).not_to be_include('One or more fields were invalid')
|
|
251
250
|
end
|
|
252
251
|
end
|
|
253
252
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: omniauth-identity
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.0.
|
|
4
|
+
version: 3.0.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Peter Boling
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: exe
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2021-
|
|
13
|
+
date: 2021-03-20 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: bcrypt
|
|
@@ -41,61 +41,53 @@ dependencies:
|
|
|
41
41
|
- !ruby/object:Gem::Version
|
|
42
42
|
version: '0'
|
|
43
43
|
- !ruby/object:Gem::Dependency
|
|
44
|
-
name:
|
|
44
|
+
name: anonymous_active_record
|
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
|
46
46
|
requirements:
|
|
47
47
|
- - "~>"
|
|
48
48
|
- !ruby/object:Gem::Version
|
|
49
|
-
version: '
|
|
50
|
-
type: :development
|
|
51
|
-
prerelease: false
|
|
52
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
53
|
-
requirements:
|
|
54
|
-
- - "~>"
|
|
55
|
-
- !ruby/object:Gem::Version
|
|
56
|
-
version: '5'
|
|
57
|
-
- !ruby/object:Gem::Dependency
|
|
58
|
-
name: anonymous_active_record
|
|
59
|
-
requirement: !ruby/object:Gem::Requirement
|
|
60
|
-
requirements:
|
|
49
|
+
version: '1.0'
|
|
61
50
|
- - ">="
|
|
62
51
|
- !ruby/object:Gem::Version
|
|
63
|
-
version: 1.0.
|
|
52
|
+
version: 1.0.8
|
|
64
53
|
type: :development
|
|
65
54
|
prerelease: false
|
|
66
55
|
version_requirements: !ruby/object:Gem::Requirement
|
|
67
56
|
requirements:
|
|
57
|
+
- - "~>"
|
|
58
|
+
- !ruby/object:Gem::Version
|
|
59
|
+
version: '1.0'
|
|
68
60
|
- - ">="
|
|
69
61
|
- !ruby/object:Gem::Version
|
|
70
|
-
version: 1.0.
|
|
62
|
+
version: 1.0.8
|
|
71
63
|
- !ruby/object:Gem::Dependency
|
|
72
|
-
name:
|
|
64
|
+
name: mongoid
|
|
73
65
|
requirement: !ruby/object:Gem::Requirement
|
|
74
66
|
requirements:
|
|
75
67
|
- - "~>"
|
|
76
68
|
- !ruby/object:Gem::Version
|
|
77
|
-
version: '
|
|
69
|
+
version: '7'
|
|
78
70
|
type: :development
|
|
79
71
|
prerelease: false
|
|
80
72
|
version_requirements: !ruby/object:Gem::Requirement
|
|
81
73
|
requirements:
|
|
82
74
|
- - "~>"
|
|
83
75
|
- !ruby/object:Gem::Version
|
|
84
|
-
version: '
|
|
76
|
+
version: '7'
|
|
85
77
|
- !ruby/object:Gem::Dependency
|
|
86
|
-
name:
|
|
78
|
+
name: nobrainer
|
|
87
79
|
requirement: !ruby/object:Gem::Requirement
|
|
88
80
|
requirements:
|
|
89
81
|
- - "~>"
|
|
90
82
|
- !ruby/object:Gem::Version
|
|
91
|
-
version: '
|
|
83
|
+
version: '0'
|
|
92
84
|
type: :development
|
|
93
85
|
prerelease: false
|
|
94
86
|
version_requirements: !ruby/object:Gem::Requirement
|
|
95
87
|
requirements:
|
|
96
88
|
- - "~>"
|
|
97
89
|
- !ruby/object:Gem::Version
|
|
98
|
-
version: '
|
|
90
|
+
version: '0'
|
|
99
91
|
- !ruby/object:Gem::Dependency
|
|
100
92
|
name: rack-test
|
|
101
93
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -139,132 +131,34 @@ dependencies:
|
|
|
139
131
|
- !ruby/object:Gem::Version
|
|
140
132
|
version: '3'
|
|
141
133
|
- !ruby/object:Gem::Dependency
|
|
142
|
-
name:
|
|
134
|
+
name: sequel
|
|
143
135
|
requirement: !ruby/object:Gem::Requirement
|
|
144
136
|
requirements:
|
|
145
137
|
- - "~>"
|
|
146
138
|
- !ruby/object:Gem::Version
|
|
147
|
-
version: '
|
|
139
|
+
version: '5'
|
|
148
140
|
type: :development
|
|
149
141
|
prerelease: false
|
|
150
142
|
version_requirements: !ruby/object:Gem::Requirement
|
|
151
143
|
requirements:
|
|
152
144
|
- - "~>"
|
|
153
145
|
- !ruby/object:Gem::Version
|
|
154
|
-
version: '
|
|
155
|
-
- !ruby/object:Gem::Dependency
|
|
156
|
-
name: rubocop-md
|
|
157
|
-
requirement: !ruby/object:Gem::Requirement
|
|
158
|
-
requirements:
|
|
159
|
-
- - ">="
|
|
160
|
-
- !ruby/object:Gem::Version
|
|
161
|
-
version: '0'
|
|
162
|
-
type: :development
|
|
163
|
-
prerelease: false
|
|
164
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
165
|
-
requirements:
|
|
166
|
-
- - ">="
|
|
167
|
-
- !ruby/object:Gem::Version
|
|
168
|
-
version: '0'
|
|
169
|
-
- !ruby/object:Gem::Dependency
|
|
170
|
-
name: rubocop-minitest
|
|
171
|
-
requirement: !ruby/object:Gem::Requirement
|
|
172
|
-
requirements:
|
|
173
|
-
- - ">="
|
|
174
|
-
- !ruby/object:Gem::Version
|
|
175
|
-
version: '0'
|
|
176
|
-
type: :development
|
|
177
|
-
prerelease: false
|
|
178
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
179
|
-
requirements:
|
|
180
|
-
- - ">="
|
|
181
|
-
- !ruby/object:Gem::Version
|
|
182
|
-
version: '0'
|
|
183
|
-
- !ruby/object:Gem::Dependency
|
|
184
|
-
name: rubocop-packaging
|
|
185
|
-
requirement: !ruby/object:Gem::Requirement
|
|
186
|
-
requirements:
|
|
187
|
-
- - ">="
|
|
188
|
-
- !ruby/object:Gem::Version
|
|
189
|
-
version: '0'
|
|
190
|
-
type: :development
|
|
191
|
-
prerelease: false
|
|
192
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
193
|
-
requirements:
|
|
194
|
-
- - ">="
|
|
195
|
-
- !ruby/object:Gem::Version
|
|
196
|
-
version: '0'
|
|
197
|
-
- !ruby/object:Gem::Dependency
|
|
198
|
-
name: rubocop-performance
|
|
199
|
-
requirement: !ruby/object:Gem::Requirement
|
|
200
|
-
requirements:
|
|
201
|
-
- - ">="
|
|
202
|
-
- !ruby/object:Gem::Version
|
|
203
|
-
version: '0'
|
|
204
|
-
type: :development
|
|
205
|
-
prerelease: false
|
|
206
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
207
|
-
requirements:
|
|
208
|
-
- - ">="
|
|
209
|
-
- !ruby/object:Gem::Version
|
|
210
|
-
version: '0'
|
|
211
|
-
- !ruby/object:Gem::Dependency
|
|
212
|
-
name: rubocop-rake
|
|
213
|
-
requirement: !ruby/object:Gem::Requirement
|
|
214
|
-
requirements:
|
|
215
|
-
- - ">="
|
|
216
|
-
- !ruby/object:Gem::Version
|
|
217
|
-
version: '0'
|
|
218
|
-
type: :development
|
|
219
|
-
prerelease: false
|
|
220
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
221
|
-
requirements:
|
|
222
|
-
- - ">="
|
|
223
|
-
- !ruby/object:Gem::Version
|
|
224
|
-
version: '0'
|
|
225
|
-
- !ruby/object:Gem::Dependency
|
|
226
|
-
name: rubocop-rspec
|
|
227
|
-
requirement: !ruby/object:Gem::Requirement
|
|
228
|
-
requirements:
|
|
229
|
-
- - ">="
|
|
230
|
-
- !ruby/object:Gem::Version
|
|
231
|
-
version: '0'
|
|
232
|
-
type: :development
|
|
233
|
-
prerelease: false
|
|
234
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
235
|
-
requirements:
|
|
236
|
-
- - ">="
|
|
237
|
-
- !ruby/object:Gem::Version
|
|
238
|
-
version: '0'
|
|
146
|
+
version: '5'
|
|
239
147
|
- !ruby/object:Gem::Dependency
|
|
240
|
-
name:
|
|
148
|
+
name: sqlite3
|
|
241
149
|
requirement: !ruby/object:Gem::Requirement
|
|
242
150
|
requirements:
|
|
243
151
|
- - "~>"
|
|
244
152
|
- !ruby/object:Gem::Version
|
|
245
|
-
version: '
|
|
153
|
+
version: '1.4'
|
|
246
154
|
type: :development
|
|
247
155
|
prerelease: false
|
|
248
156
|
version_requirements: !ruby/object:Gem::Requirement
|
|
249
157
|
requirements:
|
|
250
158
|
- - "~>"
|
|
251
159
|
- !ruby/object:Gem::Version
|
|
252
|
-
version: '
|
|
253
|
-
|
|
254
|
-
name: sqlite3
|
|
255
|
-
requirement: !ruby/object:Gem::Requirement
|
|
256
|
-
requirements:
|
|
257
|
-
- - ">="
|
|
258
|
-
- !ruby/object:Gem::Version
|
|
259
|
-
version: '0'
|
|
260
|
-
type: :development
|
|
261
|
-
prerelease: false
|
|
262
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
263
|
-
requirements:
|
|
264
|
-
- - ">="
|
|
265
|
-
- !ruby/object:Gem::Version
|
|
266
|
-
version: '0'
|
|
267
|
-
description: Internal authentication handlers for OmniAuth.
|
|
160
|
+
version: '1.4'
|
|
161
|
+
description: Traditional username/password based authentication system for OmniAuth
|
|
268
162
|
email:
|
|
269
163
|
executables: []
|
|
270
164
|
extensions: []
|
|
@@ -281,12 +175,16 @@ files:
|
|
|
281
175
|
- lib/omniauth/identity/models/active_record.rb
|
|
282
176
|
- lib/omniauth/identity/models/couch_potato.rb
|
|
283
177
|
- lib/omniauth/identity/models/mongoid.rb
|
|
178
|
+
- lib/omniauth/identity/models/no_brainer.rb
|
|
179
|
+
- lib/omniauth/identity/models/sequel.rb
|
|
284
180
|
- lib/omniauth/identity/secure_password.rb
|
|
285
181
|
- lib/omniauth/strategies/identity.rb
|
|
286
182
|
- spec/omniauth/identity/model_spec.rb
|
|
287
183
|
- spec/omniauth/identity/models/active_record_spec.rb
|
|
288
184
|
- spec/omniauth/identity/models/couch_potato_spec.rb
|
|
289
185
|
- spec/omniauth/identity/models/mongoid_spec.rb
|
|
186
|
+
- spec/omniauth/identity/models/no_brainer_spec.rb
|
|
187
|
+
- spec/omniauth/identity/models/sequel_spec.rb
|
|
290
188
|
- spec/omniauth/identity/secure_password_spec.rb
|
|
291
189
|
- spec/omniauth/strategies/identity_spec.rb
|
|
292
190
|
- spec/spec_helper.rb
|
|
@@ -310,15 +208,17 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
310
208
|
- !ruby/object:Gem::Version
|
|
311
209
|
version: 1.3.6
|
|
312
210
|
requirements: []
|
|
313
|
-
rubygems_version: 3.2.
|
|
211
|
+
rubygems_version: 3.2.3
|
|
314
212
|
signing_key:
|
|
315
213
|
specification_version: 4
|
|
316
|
-
summary:
|
|
214
|
+
summary: Traditional username/password based authentication system for OmniAuth
|
|
317
215
|
test_files:
|
|
318
|
-
- spec/
|
|
319
|
-
- spec/omniauth/identity/models/mongoid_spec.rb
|
|
216
|
+
- spec/omniauth/identity/model_spec.rb
|
|
320
217
|
- spec/omniauth/identity/models/active_record_spec.rb
|
|
321
218
|
- spec/omniauth/identity/models/couch_potato_spec.rb
|
|
219
|
+
- spec/omniauth/identity/models/mongoid_spec.rb
|
|
220
|
+
- spec/omniauth/identity/models/no_brainer_spec.rb
|
|
221
|
+
- spec/omniauth/identity/models/sequel_spec.rb
|
|
322
222
|
- spec/omniauth/identity/secure_password_spec.rb
|
|
323
|
-
- spec/omniauth/identity/model_spec.rb
|
|
324
223
|
- spec/omniauth/strategies/identity_spec.rb
|
|
224
|
+
- spec/spec_helper.rb
|