omniauth-identity 3.0.9 → 3.1.1

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.
data/README.md CHANGED
@@ -1,13 +1,76 @@
1
- # OmniAuth Identity
2
-
3
- [![Version](https://img.shields.io/gem/v/omniauth-identity.svg)](https://rubygems.org/gems/omniauth-identity)
4
- [![Depfu](https://badges.depfu.com/badges/6c9b45362951b872127f9e46d39bed76/count.svg)](https://depfu.com/github/omniauth/omniauth-identity?project_id=22381)
5
- [![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fomniauth%2Fomniauth-identity%2Fbadge&style=flat)](https://actions-badge.atrox.dev/omniauth/omniauth-identity/goto)
6
- [![Maintainability](https://api.codeclimate.com/v1/badges/621d6211cb2e0959ce00/maintainability)](https://codeclimate.com/github/omniauth/omniauth-identity/maintainability)
7
- [![Test Coverage](https://api.codeclimate.com/v1/badges/621d6211cb2e0959ce00/test_coverage)](https://codeclimate.com/github/omniauth/omniauth-identity/test_coverage)
8
- [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
9
- [![Open Source Helpers](https://www.codetriage.com/omniauth/omniauth-identity/badges/users.svg)](https://www.codetriage.com/omniauth/omniauth-identity)
10
- [![Downloads Rank](https://img.shields.io/gem/rd/omniauth-identity.svg)](https://rubygems.org/gems/omniauth-identity)
1
+ # `OmniAuth::Identity`
2
+
3
+ [![Version][👽versioni]][👽version]
4
+ [![License: MIT][📄license-img]][📄license-ref]
5
+ [![Downloads Rank][👽dl-ranki]][👽dl-rank]
6
+ [![Open Source Helpers][👽oss-helpi]][👽oss-help]
7
+ [![Depfu][🔑depfui♻️]][🔑depfu]
8
+ [![CodeCov][🔑codecovi♻️]][🔑codecov]
9
+ [![Test Coverage][🔑cc-covi♻️]][🔑cc-cov]
10
+ [![Maintainability][🔑cc-mnti♻️]][🔑cc-mnt]
11
+ [![CI Supported Build][🚎6-s-wfi]][🚎6-s-wf]
12
+ [![CI Legacy Build][🚎4-lg-wfi]][🚎4-lg-wf]
13
+ [![CI Unsupported Build][🚎7-us-wfi]][🚎7-us-wf]
14
+ [![CI Heads Build][🚎3-hd-wfi]][🚎3-hd-wf]
15
+ [![CI Ancient Build][🚎1-an-wfi]][🚎1-an-wf]
16
+ [![CI Coverage Build][🚎2-cov-wfi]][🚎2-cov-wf]
17
+ [![CI Style Build][🚎5-st-wfi]][🚎5-st-wf]
18
+
19
+ <!--- ( 👽️ INFO LINKS ) -->
20
+
21
+ [👽dl-rank]: https://rubygems.org/gems/omniauth-identity
22
+ [👽dl-ranki]: https://img.shields.io/gem/rd/omniauth-identity.svg
23
+ [👽oss-help]: https://www.codetriage.com/omniauth/omniauth-identity
24
+ [👽oss-helpi]: https://www.codetriage.com/omniauth/omniauth-identity/badges/users.svg
25
+ [👽version]: https://rubygems.org/gems/omniauth-identity
26
+ [👽versioni]: https://img.shields.io/gem/v/omniauth-identity.svg
27
+
28
+ <!--- ( 🔑 KEYED LINKS ) -->
29
+
30
+ [🔑cc-mnt]: https://codeclimate.com/github/omniauth/omniauth-identity/maintainability
31
+ [🔑cc-mnti♻️]: https://api.codeclimate.com/v1/badges/621d6211cb2e0959ce00/maintainability
32
+ [🔑cc-cov]: https://codeclimate.com/github/omniauth/omniauth-identity/test_coverage
33
+ [🔑cc-covi♻️]: https://api.codeclimate.com/v1/badges/621d6211cb2e0959ce00/test_coverage
34
+ [🔑codecov]: https://codecov.io/gh/omniauth/omniauth-identity
35
+ [🔑codecovi♻️]: https://codecov.io/gh/omniauth/omniauth-identity/graph/badge.svg?token=cc6UdZCpAL
36
+ [🔑depfu]: https://depfu.com/github/omniauth/omniauth-identity
37
+ [🔑depfui♻️]: https://badges.depfu.com/badges/6c9b45362951b872127f9e46d39bed76/count.svg
38
+
39
+ <!--- ( 🚎 BUILD LINKS ) -->
40
+
41
+ [🚎1-an-wf]: https://github.com/omniauth/omniauth-identity/actions/workflows/ancient.yml
42
+ [🚎1-an-wfi]: https://github.com/omniauth/omniauth-identity/actions/workflows/ancient.yml/badge.svg
43
+ [🚎2-cov-wf]: https://github.com/omniauth/omniauth-identity/actions/workflows/coverage.yml
44
+ [🚎2-cov-wfi]: https://github.com/omniauth/omniauth-identity/actions/workflows/coverage.yml/badge.svg
45
+ [🚎3-hd-wf]: https://github.com/omniauth/omniauth-identity/actions/workflows/heads.yml
46
+ [🚎3-hd-wfi]: https://github.com/omniauth/omniauth-identity/actions/workflows/heads.yml/badge.svg
47
+ [🚎4-lg-wf]: https://github.com/omniauth/omniauth-identity/actions/workflows/legacy.yml
48
+ [🚎4-lg-wfi]: https://github.com/omniauth/omniauth-identity/actions/workflows/legacy.yml/badge.svg
49
+ [🚎5-st-wf]: https://github.com/omniauth/omniauth-identity/actions/workflows/style.yml
50
+ [🚎5-st-wfi]: https://github.com/omniauth/omniauth-identity/actions/workflows/style.yml/badge.svg
51
+ [🚎6-s-wf]: https://github.com/omniauth/omniauth-identity/actions/workflows/supported.yml
52
+ [🚎6-s-wfi]: https://github.com/omniauth/omniauth-identity/actions/workflows/supported.yml/badge.svg
53
+ [🚎7-us-wf]: https://github.com/omniauth/omniauth-identity/actions/workflows/unsupported.yml
54
+ [🚎7-us-wfi]: https://github.com/omniauth/omniauth-identity/actions/workflows/unsupported.yml/badge.svg
55
+
56
+ -----
57
+
58
+ [![Liberapay Patrons][⛳liberapay-img]][⛳liberapay]
59
+ [![Sponsor Me on Github][🖇sponsor-img]][🖇sponsor]
60
+ [![Polar Shield][🖇polar-img]][🖇polar]
61
+ [![Donate to my FLOSS or refugee efforts at ko-fi.com][🖇kofi-img]][🖇kofi]
62
+ [![Donate to my FLOSS or refugee efforts using Patreon][🖇patreon-img]][🖇patreon]
63
+
64
+ [⛳liberapay-img]: https://img.shields.io/liberapay/patrons/pboling.svg?logo=liberapay
65
+ [⛳liberapay]: https://liberapay.com/pboling/donate
66
+ [🖇sponsor-img]: https://img.shields.io/badge/Sponsor_Me!-pboling.svg?style=social&logo=github
67
+ [🖇sponsor]: https://github.com/sponsors/pboling
68
+ [🖇polar-img]: https://polar.sh/embed/seeks-funding-shield.svg?org=pboling
69
+ [🖇polar]: https://polar.sh/pboling
70
+ [🖇kofi-img]: https://img.shields.io/badge/buy%20me%20coffee-donate-yellow.svg
71
+ [🖇kofi]: https://ko-fi.com/O5O86SNP4
72
+ [🖇patreon-img]: https://img.shields.io/badge/patreon-donate-yellow.svg
73
+ [🖇patreon]: https://patreon.com/galtzo
11
74
 
12
75
  The OmniAuth Identity gem provides a way for applications to utilize a
13
76
  traditional username/password based authentication system without the need
@@ -15,36 +78,63 @@ to give up the simple authentication flow provided by OmniAuth. Identity
15
78
  is designed on purpose to be as featureless as possible: it provides the
16
79
  basic construct for user management and then gets out of the way.
17
80
 
18
- ## Compatibility
19
-
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
24
- * At least 5 different database ORM adapters, which connect to 15 different database clients!
25
-
26
- | Databases | Adapter Libraries |
27
- |--------- | -------- |
28
- | MySQL, PostgreSQL, SQLite3 | [ActiveRecord](https://guides.rubyonrails.org/active_record_basics.html) |
29
- | CouchDB | [CouchPotato](https://github.com/langalex/couch_potato) |
30
- | MongoDB | [Mongoid](https://github.com/mongodb/mongoid) |
31
- | RethinkDB | [NoBrainer](http://nobrainer.io/) |
32
- | ADO, Amalgalite, IBM_DB, JDBC, MySQL, Mysql2, ODBC, Oracle, PostgreSQL, SQLAnywhere, SQLite3, and TinyTDS | [Sequel](http://sequel.jeremyevans.net) |
81
+ | Primary Namespace | `OmniAuth::Identity` |
82
+ |-------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
83
+ | documentation | [on Github.com][homepage], [Latest release on RubyDoc.info][documentation], [HEAD on RubyDoc.info][documentation-head] |
84
+ | expert support | [![Get help on Codementor](https://cdn.codementor.io/badges/get_help_github.svg)](https://www.codementor.io/peterboling?utm_source=github&utm_medium=button&utm_term=peterboling&utm_campaign=github) |
85
+ | `...` 💖 | [![Follow Me on LinkedIn][🖇linkedin-img]][🖇linkedin] [![Find Me on WellFound:][✌️wellfound-img]][✌️wellfound] [![Find Me on CrunchBase][💲crunchbase-img]][💲crunchbase] [![My LinkTree][🌳linktree-img]][🌳linktree] [![Follow Me on Ruby.Social][🐘ruby-mast-img]][🐘ruby-mast] [![Tweet @ Peter][🐦tweet-img]][🐦tweet] [💻][coderme] [🌏][aboutme] |
86
+
87
+ <!--- 7️⃣ spread 💖 -->
88
+ [🐦tweet-img]: https://img.shields.io/twitter/follow/galtzo.svg?style=social&label=Follow%20%40galtzo
89
+ [🐦tweet]: http://twitter.com/galtzo
90
+ [🚎blog]: http://www.railsbling.com/tags/omniauth-identity/
91
+ [🚎blog-img]: https://img.shields.io/badge/blog-railsbling-brightgreen.svg?style=flat
92
+ [🖇linkedin]: http://www.linkedin.com/in/peterboling
93
+ [🖇linkedin-img]: https://img.shields.io/badge/PeterBoling-blue?style=plastic&logo=linkedin
94
+ [✌️wellfound]: https://angel.co/u/peter-boling
95
+ [✌️wellfound-img]: https://img.shields.io/badge/peter--boling-orange?style=plastic&logo=wellfound
96
+ [💲crunchbase]: https://www.crunchbase.com/person/peter-boling
97
+ [💲crunchbase-img]: https://img.shields.io/badge/peter--boling-purple?style=plastic&logo=crunchbase
98
+ [🐘ruby-mast]: https://ruby.social/@galtzo
99
+ [🐘ruby-mast-img]: https://img.shields.io/mastodon/follow/109447111526622197?domain=https%3A%2F%2Fruby.social&style=plastic&logo=mastodon&label=Ruby%20%40galtzo
100
+ [🌳linktree]: https://linktr.ee/galtzo
101
+ [🌳linktree-img]: https://img.shields.io/badge/galtzo-purple?style=plastic&logo=linktree
102
+
103
+ <!--- Maintainer Contact Links -->
104
+ [aboutme]: https://about.me/peter.boling
105
+ [coderme]: https://coderwall.com/Peter%20Boling
33
106
 
34
107
  ## Installation
35
108
 
36
- To acquire the latest release from RubyGems add the following to your `Gemfile`:
109
+ To acquire the latest release from RubyGems, and add this gem to your `Gemfile`, run:
37
110
 
38
- ```ruby
39
- gem 'omniauth-identity'
111
+ ```shell
112
+ bundle add omniauth-identity
40
113
  ```
41
114
 
42
115
  If the git repository has new commits not yet in an official release, simply specify the repo instead:
43
116
 
44
117
  ```ruby
45
- gem 'omniauth-identity', git: 'https://github.com/intridea/omniauth-identity.git'
118
+ gem "omniauth-identity", git: "https://github.com/omniauth/omniauth-identity.git"
46
119
  ```
47
120
 
121
+ ## Compatibility
122
+
123
+ This gem is compatible with a wide range of Ruby versions and Ruby ORMs, as of Nov 2024, version 3.1.
124
+
125
+ * Latest released version of omniauth, v2+
126
+ * Tested in CI against Ruby 2.5, 2.6, 2.7, 3.0, 3.1, 3.2, 3.3, ruby-head, truffleruby-head
127
+ * Probably also compatible with Ruby 2.4 and jruby-head
128
+ * At least 5 different database ORM adapters, which connect to 15 different database clients!
129
+
130
+ | Databases | Adapter Libraries |
131
+ |-----------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------|
132
+ | MySQL, PostgreSQL, SQLite3 | [ActiveRecord](https://guides.rubyonrails.org/active_record_basics.html) |
133
+ | CouchDB | [CouchPotato](https://github.com/langalex/couch_potato) |
134
+ | MongoDB | [Mongoid](https://github.com/mongodb/mongoid) |
135
+ | RethinkDB | [NoBrainer](http://nobrainer.io/) |
136
+ | ADO, Amalgalite, IBM_DB, JDBC, MySQL, Mysql2, ODBC, Oracle, PostgreSQL, SQLAnywhere, SQLite3, and TinyTDS | [Sequel](http://sequel.jeremyevans.net) |
137
+
48
138
  ## Usage
49
139
 
50
140
  This can be a bit hard to understand the first time. Luckily, Ryan Bates made
@@ -57,8 +147,8 @@ Rack middleware. In rails, this would be created by an initializer, such as
57
147
  ```ruby
58
148
  use OmniAuth::Builder do
59
149
  provider :identity, #mandatory: tells OA that the Identity strategy is being used
60
- model: Identity, # optional: specifies the name of the "Identity" model. Defaults to "Identity"
61
- fields: %i[email custom1 custom2] # optional: list of custom fields that are in the model's table
150
+ model: Identity, # optional: specifies the name of the "Identity" model. Defaults to "Identity"
151
+ fields: %i[email custom1 custom2] # optional: list of custom fields that are in the model's table
62
152
  end
63
153
  ```
64
154
 
@@ -109,7 +199,6 @@ class SequelTestIdentity < Sequel::Model(:identities)
109
199
  end
110
200
  ```
111
201
 
112
-
113
202
  ### Mongoid
114
203
 
115
204
  Include the `OmniAuth::Identity::Models::Mongoid` mixin and specify
@@ -221,8 +310,8 @@ fails. In your OmniAuth configuration, specify any valid rack endpoint in the
221
310
  ```ruby
222
311
  use OmniAuth::Builder do
223
312
  provider :identity,
224
- fields: [:email],
225
- on_failed_registration: UsersController.action(:new)
313
+ fields: [:email],
314
+ on_failed_registration: UsersController.action(:new)
226
315
  end
227
316
  ```
228
317
 
@@ -241,7 +330,7 @@ The default value is:
241
330
  ```ruby
242
331
  use OmniAuth::Builder do
243
332
  provider :identity,
244
- locate_conditions: ->(req) { { model.auth_key => req['auth_key'] } }
333
+ locate_conditions: ->(req) { {model.auth_key => req.params["auth_key"]} }
245
334
  # ...
246
335
  end
247
336
  ```
@@ -270,61 +359,123 @@ option :on_login, nil # See #request_phase
270
359
  option :on_validation, nil # See #registration_phase
271
360
  option :on_registration, nil # See #registration_phase
272
361
  option :on_failed_registration, nil # See #registration_phase
273
- option :locate_conditions, ->(req) { { model.auth_key => req['auth_key'] } }
362
+ option :locate_conditions, ->(req) { {model.auth_key => req.params["auth_key"]} }
274
363
  ```
275
364
 
276
365
  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. 😭
277
366
 
278
- ## Contributing
279
-
280
- 1. Fork it
281
- 2. Create your feature branch (`git checkout -b my-new-feature`)
282
- 3. Commit your changes (`git commit -am ‘Added some feature’`)
283
- 4. Push to the branch (`git push origin my-new-feature`)
284
- 5. Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.
285
- - NOTE: In order to run *all* the tests you will need to have the following databases installed, configured, and running.
286
- 1. [RethinkDB](https://rethinkdb.com), an open source, real-time, web database, [installed](https://rethinkdb.com/docs/install/) and [running](https://rethinkdb.com/docs/start-a-server/), e.g.
287
- ```bash
288
- brew install rethinkdb
289
- rethinkdb
290
- ```
291
- 2. [MongoDB](https://docs.mongodb.com/manual/administration/install-community/)
292
- ```bash
293
- brew tap mongodb/brew
294
- brew install mongodb-community@4.4
295
- mongod --config /usr/local/etc/mongod.conf
296
- ```
297
- 3. [CouchDB](https://couchdb.apache.org) (download the .app)
298
-
299
- To run all tests on all databases:
300
- ```bash
301
- bundle exec rake
302
- ```
303
- To run a specific DB:
304
- ```bash
305
- # CouchDB / CouchPotato
306
- bundle exec rspec spec spec_orms --tag 'couchdb'
307
-
308
- # ActiveRecord and Sequel, as they both use the in-memory SQLite driver.
309
- bundle exec rspec spec spec_orms --tag 'sqlite3'
310
-
311
- # NOTE - mongoid and nobrainer specs can't be isolated with "tag" because it still loads everything,
312
- # and the two libraries are fundamentally incompatible.
313
-
314
- # MongoDB / Mongoid
315
- bundle exec rspec spec_orms/mongoid_spec.rb
316
-
317
- # RethinkDB / NoBrainer
318
- bundle exec rspec spec_orms/nobrainer_spec.rb
319
- ```
320
- 6. Create new Pull Request
321
-
322
- ## License
323
-
324
- MIT License. See LICENSE for details.
325
-
326
- ## Copyright
327
-
328
- * Copyright (c) 2021 OmniAuth-Identity Maintainers
329
- * Copyright (c) 2020 Peter Boling, Andrew Roberts, and Jellybooks Ltd.
367
+ ## 🤝 Contributing
368
+
369
+ If you need some ideas of where to help, you could work on adding more code coverage,
370
+ or if it is already 💯 (see [below](#code-coverage)) then check [issues][🤝issues], or [PRs][🤝pulls],
371
+ or use the gem and think about how it could be better.
372
+
373
+ Also, see [CONTRIBUTING.md][🤝contributing].
374
+
375
+ [🤝issues]: https://github.com/omniauth/omniauth-identity/issues
376
+ [🤝pulls]: https://github.com/omniauth/omniauth-identity/pulls
377
+ [🤝contributing]: CONTRIBUTING.md
378
+
379
+ ### Code Coverage
380
+
381
+ [![Coverage Graph][🔑codecov-g]][🔑codecov]
382
+
383
+ [🔑codecov-g]: https://codecov.io/gh/omniauth/omniauth-identity/graphs/tree.svg?token=cc6UdZCpAL
384
+
385
+ ## 🌈 Contributors
386
+
387
+ [![Contributors][🖐contributors-img]][🖐contributors]
388
+
389
+ Made with [contributors-img][🖐contrib-rocks].
390
+
391
+ [🖐contrib-rocks]: https://contrib.rocks
392
+ [🖐contributors]: https://github.com/omniauth/omniauth-identity/graphs/contributors
393
+ [🖐contributors-img]: https://contrib.rocks/image?repo=omniauth/omniauth-identity
394
+
395
+ ## Star History
396
+
397
+ <a href="https://star-history.com/#omniauth/omniauth-identity&Date">
398
+ <picture>
399
+ <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=omniauth/omniauth-identity&type=Date&theme=dark" />
400
+ <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=omniauth/omniauth-identity&type=Date" />
401
+ <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=omniauth/omniauth-identity&type=Date" />
402
+ </picture>
403
+ </a>
404
+
405
+ ## 🪇 Code of Conduct
406
+
407
+ Everyone interacting in this project's codebases, issue trackers,
408
+ chat rooms and mailing lists is expected to follow the [code of conduct][🪇conduct].
409
+
410
+ [🪇conduct]: CODE_OF_CONDUCT.md
411
+
412
+ ## 📌 Versioning
413
+
414
+ This Library adheres to [Semantic Versioning 2.0.0][📌semver].
415
+ Violations of this scheme should be reported as bugs.
416
+ Specifically, if a minor or patch version is released that breaks backward compatibility,
417
+ a new version should be immediately released that restores compatibility.
418
+ Breaking changes to the public API will only be introduced with new major versions.
419
+
420
+ To get a better understanding of how SemVer is intended to work over a project's lifetime,
421
+ read this article from the creator of SemVer:
422
+
423
+ - ["Major Version Numbers are Not Sacred"][📌major-versions-not-sacred]
424
+
425
+ As a result of this policy, you can (and should) specify a dependency on these libraries using
426
+ the [Pessimistic Version Constraint][📌pvc] with two digits of precision.
427
+
428
+ For example:
429
+
430
+ ```ruby
431
+ spec.add_dependency("omniauth-identity", "~> 3.1")
432
+ ```
433
+
434
+ See [CHANGELOG.md][📌changelog] for list of releases.
435
+
436
+ <!--- ( 📌 VERSIONING LINKS ) -->
437
+
438
+ [📌pvc]: http://guides.rubygems.org/patterns/#pessimistic-version-constraint
439
+ [📌semver]: http://semver.org/
440
+ [📌major-versions-not-sacred]: https://tom.preston-werner.com/2022/05/23/major-version-numbers-are-not-sacred.html
441
+ [📌changelog]: CHANGELOG.md
442
+
443
+ ## 📄 License
444
+
445
+ The gem is available as open source under the terms of
446
+ the [MIT License][📄license] [![License: MIT][📄license-img]][📄license-ref].
447
+ See [LICENSE.txt][📄license] for the official [Copyright Notice][📄copyright-notice-explainer].
448
+
449
+ [comment]: <> ( 📄 LEGAL LINKS )
450
+
451
+ [📄copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
452
+ [📄license]: LICENSE.txt
453
+ [📄license-ref]: https://opensource.org/licenses/MIT
454
+ [📄license-img]: https://img.shields.io/badge/License-MIT-green.svg
455
+
456
+ ### © Copyright
457
+
458
+ * Copyright (c) 2021, 2024 [Peter H. Boling][peterboling], and OmniAuth-Identity Maintainers
459
+ * Copyright (c) 2020 [Peter H. Boling][peterboling], Andrew Roberts, and Jellybooks Ltd.
330
460
  * Copyright (c) 2010-2015 Michael Bleigh, and Intridea, Inc.
461
+
462
+ [railsbling]: http://www.railsbling.com
463
+ [peterboling]: http://www.peterboling.com
464
+ [bundle-group-pattern]: https://gist.github.com/pboling/4564780
465
+ [documentation]: http://rubydoc.info/gems/omniauth-identity
466
+ [documentation-head]: https://rubydoc.info/github/omniauth/omniauth-identity/main
467
+ [homepage]: https://github.com/omniauth/omniauth-identity
468
+
469
+ ## 🤑 One more thing
470
+
471
+ You made it to the bottom of the page,
472
+ so perhaps you'll indulge me for another 20 seconds.
473
+ I maintain many dozens of gems, including this one,
474
+ because I want Ruby to be a great place for people to solve problems, big and small.
475
+ Please consider supporting my efforts via the giant yellow link below,
476
+ or one of the others at the head of this README.
477
+
478
+ [![Buy me a latte][🖇buyme-img]][🖇buyme]
479
+
480
+ [🖇buyme-img]: https://img.buymeacoffee.com/button-api/?text=Buy%20me%20a%20latte&emoji=&slug=pboling&button_colour=FFDD00&font_colour=000000&font_family=Cookie&outline_colour=000000&coffee_colour=ffffff
481
+ [🖇buyme]: https://www.buymeacoffee.com/pboling
data/SECURITY.md ADDED
@@ -0,0 +1,23 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ | Version | Supported |
6
+ |---------|-----------|
7
+ | 3.1.x | ✅ |
8
+ | 3.0.x | ❌ |
9
+ | 2.x | ❌ |
10
+ | 1.x | ❌ |
11
+ | 0.x | ❌ |
12
+
13
+ ## Reporting a Vulnerability
14
+
15
+ Peter Boling is the primary maintainer of this gem. Please find a way
16
+ to [contact him directly](https://railsbling.com/contact) to report the issue. Include as much relevant information as
17
+ possible.
18
+
19
+ If you are interested in support for versions older than the latest release,
20
+ please consider sponsoring the project / maintainer @ https://liberapay.com/pboling/donate,
21
+ or find other sponsorship links in the [README].
22
+
23
+ [README]: README.md
@@ -2,7 +2,7 @@
2
2
 
3
3
  module OmniAuth
4
4
  module Identity
5
- # This module provides an includable interface for implementing the
5
+ # This module provides an include-able interface for implementing the
6
6
  # necessary API for OmniAuth Identity to properly locate identities
7
7
  # and provide all necessary information.
8
8
  #
@@ -23,20 +23,22 @@ module OmniAuth
23
23
  module Model
24
24
  SCHEMA_ATTRIBUTES = %w[name email nickname first_name last_name location description image phone].freeze
25
25
 
26
- def self.included(base)
27
- base.extend ClassMethods
28
- base.extend ClassCreateApi unless base.respond_to?(:create)
29
- im = base.instance_methods
30
- base.include InstanceSaveApi unless im.include?(:save)
31
- base.include InstancePersistedApi unless im.include?(:persisted?)
26
+ class << self
27
+ def included(base)
28
+ base.extend(ClassMethods)
29
+ base.extend(ClassCreateApi) unless base.respond_to?(:create)
30
+ i_methods = base.instance_methods
31
+ base.include(InstanceSaveApi) unless i_methods.include?(:save)
32
+ base.include(InstancePersistedApi) unless i_methods.include?(:persisted?)
33
+ end
32
34
  end
33
35
 
34
36
  module ClassMethods
35
37
  # Authenticate a user with the given key and password.
36
38
  #
37
- # @param [String] key The unique login key provided for a given identity.
39
+ # @param [String] conditions The unique login key provided for a given identity.
38
40
  # @param [String] password The presumed password for the identity.
39
- # @return [Model] An instance of the identity model class.
41
+ # @return [Model, false] An instance of the identity model class.
40
42
  def authenticate(conditions, password)
41
43
  instance = locate(conditions)
42
44
  return false unless instance
@@ -49,15 +51,15 @@ module OmniAuth
49
51
  # @return [String] The method name.
50
52
  def auth_key(method = false)
51
53
  @auth_key = method.to_s unless method == false
52
- @auth_key = nil if !defined?(@auth_key) || @auth_key == ''
54
+ @auth_key = nil if !defined?(@auth_key) || @auth_key == ""
53
55
 
54
- @auth_key || 'email'
56
+ @auth_key || "email"
55
57
  end
56
58
 
57
59
  # Locate an identity given its unique login key.
58
60
  #
59
61
  # @abstract
60
- # @param [String] key The unique login key.
62
+ # @param [String] _key The unique login key.
61
63
  # @return [Model] An instance of the identity model class.
62
64
  def locate(_key)
63
65
  raise NotImplementedError
@@ -71,7 +73,7 @@ module OmniAuth
71
73
  #
72
74
  # @deprecated v4.0 will begin using {#new} with {#save} instead.
73
75
  # @abstract
74
- # @param [Hash] args Attributes of the new instance.
76
+ # @param [Hash] _args Attributes of the new instance.
75
77
  # @return [Model] An instance of the identity model class.
76
78
  # @since 3.0.5
77
79
  def create(*_args)
@@ -109,7 +111,7 @@ module OmniAuth
109
111
  # otherwise.
110
112
  #
111
113
  # @abstract
112
- # @param [String] password The password to check.
114
+ # @param [String] _password The password to check.
113
115
  # @return [self or false] Self if authenticated, false if not.
114
116
  def authenticate(_password)
115
117
  raise NotImplementedError
@@ -121,7 +123,7 @@ module OmniAuth
121
123
  # @return [String] An identifier string unique to this identity.
122
124
  def uid
123
125
  if respond_to?(:id)
124
- return nil if id.nil?
126
+ return if id.nil?
125
127
 
126
128
  id.to_s
127
129
  else
@@ -172,8 +174,8 @@ module OmniAuth
172
174
  SCHEMA_ATTRIBUTES.each_with_object(info) do |attribute, hash|
173
175
  hash[attribute] = send(attribute) if respond_to?(attribute)
174
176
  end
175
- info['name'] ||= [info['first_name'], info['last_name']].join(' ').strip if info['first_name'] || info['last_name']
176
- info['name'] ||= info['nickname']
177
+ info["name"] ||= [info["first_name"], info["last_name"]].join(" ").strip if info["first_name"] || info["last_name"]
178
+ info["name"] ||= info["nickname"]
177
179
  info
178
180
  end
179
181
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'active_record'
3
+ require "active_record"
4
4
 
5
5
  module OmniAuth
6
6
  module Identity
@@ -13,15 +13,16 @@ module OmniAuth
13
13
  include ::OmniAuth::Identity::SecurePassword
14
14
 
15
15
  self.abstract_class = true
16
+ # validations: true (default) incurs a dependency on ActiveModel, but ActiveRecord is ActiveModel based.
16
17
  has_secure_password
17
18
 
18
19
  def self.auth_key=(key)
19
20
  super
20
- validates_uniqueness_of key, case_sensitive: false
21
+ validates_uniqueness_of(key, case_sensitive: false)
21
22
  end
22
23
 
23
24
  def self.locate(search_hash)
24
- search_hash = search_hash.reverse_merge!('provider' => 'identity') if column_names.include?('provider')
25
+ search_hash = search_hash.reverse_merge!("provider" => "identity") if column_names.include?("provider")
25
26
  where(search_hash).first
26
27
  end
27
28
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'couch_potato'
3
+ require "couch_potato"
4
4
 
5
5
  module OmniAuth
6
6
  module Identity
@@ -13,14 +13,15 @@ module OmniAuth
13
13
  module CouchPotatoModule
14
14
  def self.included(base)
15
15
  base.class_eval do
16
- include ::OmniAuth::Identity::Model
17
- include ::OmniAuth::Identity::SecurePassword
16
+ include(::OmniAuth::Identity::Model)
17
+ include(::OmniAuth::Identity::SecurePassword)
18
18
 
19
+ # validations: true (default) incurs a dependency on ActiveModel, but CouchPotato is ActiveModel based.
19
20
  has_secure_password
20
21
 
21
22
  def self.auth_key=(key)
22
23
  super
23
- validates_uniqueness_of key, case_sensitive: false
24
+ validates_uniqueness_of(key, case_sensitive: false)
24
25
  end
25
26
 
26
27
  def self.locate(search_hash)
@@ -28,7 +29,7 @@ module OmniAuth
28
29
  end
29
30
 
30
31
  def save
31
- CouchPotato.database.save(self)
32
+ CouchPotato.database.save_document(self)
32
33
  end
33
34
  end
34
35
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'mongoid'
3
+ require "mongoid"
4
4
 
5
5
  module OmniAuth
6
6
  module Identity
@@ -11,14 +11,15 @@ module OmniAuth
11
11
  module Mongoid
12
12
  def self.included(base)
13
13
  base.class_eval do
14
- include ::OmniAuth::Identity::Model
15
- include ::OmniAuth::Identity::SecurePassword
14
+ include(::OmniAuth::Identity::Model)
15
+ include(::OmniAuth::Identity::SecurePassword)
16
16
 
17
+ # validations: true (default) incurs a dependency on ActiveModel, but Mongoid is ActiveModel based.
17
18
  has_secure_password
18
19
 
19
20
  def self.auth_key=(key)
20
21
  super
21
- validates_uniqueness_of key, case_sensitive: false
22
+ validates_uniqueness_of(key, case_sensitive: false)
22
23
  end
23
24
 
24
25
  def self.locate(search_hash)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'nobrainer'
3
+ require "nobrainer"
4
4
 
5
5
  module OmniAuth
6
6
  module Identity
@@ -11,14 +11,15 @@ module OmniAuth
11
11
  module NoBrainer
12
12
  def self.included(base)
13
13
  base.class_eval do
14
- include ::OmniAuth::Identity::Model
15
- include ::OmniAuth::Identity::SecurePassword
14
+ include(::OmniAuth::Identity::Model)
15
+ include(::OmniAuth::Identity::SecurePassword)
16
16
 
17
+ # validations: true (default) incurs a dependency on ActiveModel, but NoBrainer is ActiveModel based.
17
18
  has_secure_password
18
19
 
19
20
  def self.auth_key=(key)
20
21
  super
21
- validates_uniqueness_of key, case_sensitive: false
22
+ validates_uniqueness_of(key, case_sensitive: false)
22
23
  end
23
24
 
24
25
  def self.locate(search_hash)