doorkeeper-mongodb 5.2.2 → 5.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -27
- data/lib/doorkeeper/orm/concerns/mongoid/ownership.rb +1 -1
- data/lib/doorkeeper/orm/concerns/mongoid/resource_ownerable.rb +1 -1
- data/lib/doorkeeper/orm/mongoid4.rb +18 -0
- data/lib/doorkeeper/orm/mongoid5.rb +18 -0
- data/lib/doorkeeper/orm/mongoid6.rb +18 -0
- data/lib/doorkeeper/orm/mongoid7.rb +18 -0
- data/lib/doorkeeper-mongodb/mixins/mongoid/access_grant_mixin.rb +6 -6
- data/lib/doorkeeper-mongodb/mixins/mongoid/access_token_mixin.rb +7 -5
- data/lib/doorkeeper-mongodb/mixins/mongoid/application_mixin.rb +6 -5
- data/lib/doorkeeper-mongodb/version.rb +1 -1
- data/spec/controllers/application_metal_controller_spec.rb +0 -0
- data/spec/controllers/applications_controller_spec.rb +0 -0
- data/spec/controllers/authorizations_controller_spec.rb +0 -0
- data/spec/controllers/protected_resources_controller_spec.rb +0 -0
- data/spec/controllers/token_info_controller_spec.rb +0 -0
- data/spec/controllers/tokens_controller_spec.rb +0 -0
- data/spec/doorkeeper/redirect_uri_validator_spec.rb +0 -0
- data/spec/doorkeeper/server_spec.rb +0 -0
- data/spec/doorkeeper/stale_records_cleaner_spec.rb +0 -0
- data/spec/doorkeeper/version_spec.rb +0 -0
- data/spec/dummy/app/assets/config/manifest.js +0 -0
- data/spec/dummy/app/controllers/application_controller.rb +0 -0
- data/spec/dummy/app/controllers/custom_authorizations_controller.rb +0 -0
- data/spec/dummy/app/controllers/full_protected_resources_controller.rb +0 -0
- data/spec/dummy/app/controllers/home_controller.rb +0 -0
- data/spec/dummy/app/controllers/metal_controller.rb +0 -0
- data/spec/dummy/app/controllers/semi_protected_resources_controller.rb +0 -0
- data/spec/dummy/app/helpers/application_helper.rb +0 -0
- data/spec/dummy/app/models/user.rb +0 -1
- data/spec/dummy/app/views/home/index.html.erb +0 -0
- data/spec/dummy/app/views/layouts/application.html.erb +0 -0
- data/spec/dummy/config/application.rb +0 -0
- data/spec/dummy/config/boot.rb +0 -0
- data/spec/dummy/config/database.yml +0 -0
- data/spec/dummy/config/environment.rb +0 -0
- data/spec/dummy/config/environments/development.rb +0 -0
- data/spec/dummy/config/environments/production.rb +0 -0
- data/spec/dummy/config/environments/test.rb +0 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -0
- data/spec/dummy/config/initializers/doorkeeper.rb +0 -0
- data/spec/dummy/config/initializers/secret_token.rb +0 -0
- data/spec/dummy/config/initializers/session_store.rb +0 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +0 -0
- data/spec/dummy/config/locales/doorkeeper.en.yml +0 -0
- data/spec/dummy/config/mongo.yml +2 -2
- data/spec/dummy/config/routes.rb +0 -0
- data/spec/dummy/config.ru +0 -0
- data/spec/dummy/db/migrate/20111122132257_create_users.rb +0 -0
- data/spec/dummy/db/migrate/20120312140401_add_password_to_users.rb +0 -0
- data/spec/dummy/db/migrate/20151223192035_create_doorkeeper_tables.rb +0 -0
- data/spec/dummy/db/migrate/20151223200000_add_owner_to_application.rb +0 -0
- data/spec/dummy/db/migrate/20160320211015_add_previous_refresh_token_to_access_tokens.rb +0 -0
- data/spec/dummy/db/migrate/20170822064514_enable_pkce.rb +0 -0
- data/spec/dummy/db/migrate/20180210183654_add_confidential_to_applications.rb +0 -0
- data/spec/dummy/db/schema.rb +0 -0
- data/spec/dummy/public/404.html +0 -0
- data/spec/dummy/public/422.html +0 -0
- data/spec/dummy/public/500.html +0 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/-o/-ofn45zIfO5vx4VD6m6NXesLf6da5usA-Sbw2SVju3o.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/0_/0_ouGcG_o_1zmVmBe-tdQYk594LBwVa1bumjrKtdfEw.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/2X/2XMMcHbyTSRqh1GkV0xzyIETNtt-zgN6iniziShaKmQ.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/4Q/4QQw-pMQ98JIj3xdcFhGBQdysdGPY9rWffRqWMmyjew.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/7H/7HjRsym0tTpXFCVhWt6kteMs_-CozKVbr9s5syHm8es.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/8B/8BxJyv22HPFHu1se_l2J8qW1N9NzZ16UOWOy1YMSgs4.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/8D/8DJG7JfPvShfLLyeSom6NZ_TcQc6QH27tJ7prEWZPfI.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/9x/9xjtGv-yKjj62x9uFwBZg8pTSh9ERPAgANwNo9uwIaA.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/Bt/BtXO7f0PZ8DNt3TMLYM-zY7LkbWa_KgyB0v1V98M1CQ.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/E0/E02f1Q2tutWumMulGCFNfqQNjvEP_hMAK_5E83eWepI.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/EZ/EZGpd6pUEJZxO6uT2yIS4Fpn5KX7VDgC9VB3AaemF5Q.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/FJ/FJlQpfMtpRbrM5P8A7d2FAelFKwo6GrVs2xks8z5GKU.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/L8/L8mOWakJlWKr6MU85rj0V7yGFfNyIR6vE6YXtqArPGw.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/Lk/LklIq5hrBAPESXVUpFMwQ9L-1qTj90sPVi6U19_Xi-Q.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/MB/MBWRxa9S470ee8suxVKp0jYgv6K6FQOqKGV0kPGQNMs.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/Ma/MaK3K1AoZZ4xM5fOOifhROd73hfZJpP4yGbkGdoYtEk.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/PA/PAH_jI20wRw12tngeJ-V619c30avNLDu5U9Z-9Pc5SQ.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/Ph/Ph7RtH_NvG2I8XpTa8mA8SBQXZDzBPVIh4CH6g7OXJ0.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/Pm/PmheG0PGFqDws1qgFOxOyIL-gpMof3Ar9eSRKVLYuik.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/Pn/PnXU_mkG2fLZFm9BwiZ03BZdBTjKuInP-cRXjHS7yJo.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/Qs/QsVgO6vM5Yn9oeYTYlrqtyVnK6sdVDWDa083N7zpfHw.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/So/So59ksdx2dw-_A3-zFZ6Palr7fROjm7_0JDZb04temw.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/Wt/WtXL_iDofLeTH_v0Yf3PM421r9b1V0g-VBvMPeu9KA0.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/b6/b6QRH6ZdCc0e6bUWu4qni_kZmptaMgWciO8Jl9q6_p8.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/dX/dX6FDdUIy8yBCOoaoXcjf71rX9N_bpiXGJ4Urt32NTk.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/jC/jCTZ1jAldKBn4OTANBBmCKzxLrDgok1ur4meoTqlDNg.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/qT/qTQIQsmS0Wbbg2JxNn9rxdI5qVOTg5SfyQdaTvr9vLo.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/yN/yNOFGOsnHmxXNMkuEAWuL1u3jlmdvrdeoTx6DDJ1in8.cache +0 -0
- data/spec/factories.rb +0 -0
- data/spec/grape/grape_integration_spec.rb +0 -0
- data/spec/helpers/doorkeeper/dashboard_helper_spec.rb +0 -0
- data/spec/lib/config_spec.rb +0 -0
- data/spec/lib/doorkeeper_spec.rb +0 -0
- data/spec/lib/models/expirable_spec.rb +0 -0
- data/spec/lib/models/reusable_spec.rb +0 -0
- data/spec/lib/models/revocable_spec.rb +0 -0
- data/spec/lib/models/scopes_spec.rb +0 -0
- data/spec/lib/models/secret_storable_spec.rb +0 -0
- data/spec/lib/oauth/authorization/uri_builder_spec.rb +0 -0
- data/spec/lib/oauth/authorization_code_request_spec.rb +0 -0
- data/spec/lib/oauth/base_request_spec.rb +0 -0
- data/spec/lib/oauth/base_response_spec.rb +0 -0
- data/spec/lib/oauth/client/credentials_spec.rb +0 -0
- data/spec/lib/oauth/client_credentials/creator_spec.rb +0 -0
- data/spec/lib/oauth/client_credentials/issuer_spec.rb +0 -0
- data/spec/lib/oauth/client_credentials/validation_spec.rb +0 -0
- data/spec/lib/oauth/client_credentials_integration_spec.rb +0 -0
- data/spec/lib/oauth/client_credentials_request_spec.rb +0 -0
- data/spec/lib/oauth/client_spec.rb +0 -0
- data/spec/lib/oauth/code_request_spec.rb +0 -0
- data/spec/lib/oauth/code_response_spec.rb +0 -0
- data/spec/lib/oauth/error_response_spec.rb +0 -0
- data/spec/lib/oauth/error_spec.rb +0 -0
- data/spec/lib/oauth/forbidden_token_response_spec.rb +0 -0
- data/spec/lib/oauth/helpers/scope_checker_spec.rb +0 -0
- data/spec/lib/oauth/helpers/unique_token_spec.rb +0 -0
- data/spec/lib/oauth/helpers/uri_checker_spec.rb +0 -0
- data/spec/lib/oauth/invalid_request_response_spec.rb +0 -0
- data/spec/lib/oauth/invalid_token_response_spec.rb +0 -0
- data/spec/lib/oauth/password_access_token_request_spec.rb +0 -0
- data/spec/lib/oauth/pre_authorization_spec.rb +0 -0
- data/spec/lib/oauth/refresh_token_request_spec.rb +0 -0
- data/spec/lib/oauth/scopes_spec.rb +0 -0
- data/spec/lib/oauth/token_request_spec.rb +0 -0
- data/spec/lib/oauth/token_response_spec.rb +0 -0
- data/spec/lib/oauth/token_spec.rb +0 -0
- data/spec/lib/option_spec.rb +0 -0
- data/spec/lib/request/strategy_spec.rb +0 -0
- data/spec/lib/secret_storing/base_spec.rb +0 -0
- data/spec/lib/secret_storing/bcrypt_spec.rb +0 -0
- data/spec/lib/secret_storing/plain_spec.rb +0 -0
- data/spec/lib/secret_storing/sha256_hash_spec.rb +0 -0
- data/spec/models/doorkeeper/access_grant_spec.rb +0 -0
- data/spec/models/doorkeeper/access_token_spec.rb +0 -0
- data/spec/models/doorkeeper/application_spec.rb +0 -0
- data/spec/requests/applications/applications_request_spec.rb +0 -0
- data/spec/requests/applications/authorized_applications_spec.rb +0 -0
- data/spec/requests/endpoints/authorization_spec.rb +0 -0
- data/spec/requests/endpoints/token_spec.rb +0 -0
- data/spec/requests/flows/authorization_code_errors_spec.rb +0 -0
- data/spec/requests/flows/authorization_code_spec.rb +0 -0
- data/spec/requests/flows/client_credentials_spec.rb +0 -0
- data/spec/requests/flows/implicit_grant_errors_spec.rb +0 -0
- data/spec/requests/flows/implicit_grant_spec.rb +0 -0
- data/spec/requests/flows/password_spec.rb +0 -0
- data/spec/requests/flows/refresh_token_spec.rb +0 -0
- data/spec/requests/flows/revoke_token_spec.rb +0 -0
- data/spec/requests/flows/skip_authorization_spec.rb +0 -0
- data/spec/requests/protected_resources/metal_spec.rb +0 -0
- data/spec/requests/protected_resources/private_api_spec.rb +0 -0
- data/spec/routing/custom_controller_routes_spec.rb +0 -0
- data/spec/routing/default_routes_spec.rb +0 -0
- data/spec/routing/scoped_routes_spec.rb +0 -0
- data/spec/spec_helper.rb +0 -0
- data/spec/spec_helper_integration.rb +0 -0
- data/spec/support/dependencies/factory_bot.rb +0 -0
- data/spec/support/doorkeeper_rspec.rb +0 -0
- data/spec/support/helpers/access_token_request_helper.rb +0 -0
- data/spec/support/helpers/authorization_request_helper.rb +0 -0
- data/spec/support/helpers/config_helper.rb +0 -0
- data/spec/support/helpers/model_helper.rb +0 -0
- data/spec/support/helpers/request_spec_helper.rb +0 -0
- data/spec/support/helpers/url_helper.rb +0 -0
- data/spec/support/orm/active_record.rb +0 -0
- data/spec/support/orm/mongoid4.rb +1 -1
- data/spec/support/orm/mongoid5.rb +1 -1
- data/spec/support/orm/mongoid6.rb +1 -1
- data/spec/support/orm/mongoid7.rb +1 -1
- data/spec/support/shared/controllers_shared_context.rb +0 -0
- data/spec/support/shared/hashing_shared_context.rb +0 -0
- data/spec/support/shared/models_shared_examples.rb +0 -0
- metadata +148 -164
- data/spec/dummy/log/test.log +0 -6144
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2798483ff1a989a1b8cefc2e94771e735c08f52879675c69b1808a912e2f730
|
4
|
+
data.tar.gz: ee24b6384a5378b6353a0a9006648feea656ab9d2c17d5fd596f6bf8637cadc9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 260955b7a8b92403cf62913ee6eea0cd230b7f19cb030d8432a04916c821e392609641fc13f080e097703a1c96a8139df6e1800034e499b342c53940fdf40054
|
7
|
+
data.tar.gz: 3c79d4fdfbc2968716d2940c5f732a3476950cb5bcbc4120b040538fbd246299e398069a81fc5b2a001277af0fe2d4e48dcd08d0a7fc9a972de2e3e0ac82817d
|
data/README.md
CHANGED
@@ -9,26 +9,15 @@ of doorkeeper-mongodb you are using in: https://github.com/doorkeeper-gem/doorke
|
|
9
9
|
|
10
10
|
## Installation
|
11
11
|
|
12
|
-
`doorkeeper-mongodb` provides [Doorkeeper](https://github.com/doorkeeper-gem/doorkeeper) support
|
13
|
-
|
14
|
-
|
12
|
+
`doorkeeper-mongodb` provides [Doorkeeper](https://github.com/doorkeeper-gem/doorkeeper) support
|
13
|
+
for [Mongoid](https://github.com/mongodb/mongoid) versions 6 and later. Earlier versions of Mongoid
|
14
|
+
are supported on earlier versions of `doorkeeper-mongodb`.
|
15
15
|
|
16
|
-
|
17
|
-
# For Doorkeeper >= 5.2
|
18
|
-
gem 'doorkeeper', '~> 5.2'
|
19
|
-
gem 'doorkeeper-mongodb', '~> 5.2'
|
16
|
+
To start using it, add both `doorkeeper` and `doorkeeper-mongodb` to your Gemfile:
|
20
17
|
|
21
|
-
|
22
|
-
gem 'doorkeeper'
|
23
|
-
gem 'doorkeeper-mongodb'
|
24
|
-
|
25
|
-
# For Doorkeeper >= 4.4 && < 5.0
|
26
|
-
gem 'doorkeeper', '~> 4.4'
|
27
|
-
gem 'doorkeeper-mongodb', '~> 4.2'
|
28
|
-
|
29
|
-
# For Doorkeeper < 4.4
|
30
|
-
gem 'doorkeeper', '~> 4.3'
|
31
|
-
gem 'doorkeeper-mongodb', '~> 4.1.0'
|
18
|
+
```ruby
|
19
|
+
gem 'doorkeeper'
|
20
|
+
gem 'doorkeeper-mongodb'
|
32
21
|
|
33
22
|
# or if you want to use cutting edge version:
|
34
23
|
# gem 'doorkeeper-mongodb', github: 'doorkeeper-gem/doorkeeper-mongodb'
|
@@ -36,7 +25,9 @@ gem 'doorkeeper-mongodb', '~> 4.1.0'
|
|
36
25
|
|
37
26
|
Run [doorkeeper’s installation generator]:
|
38
27
|
|
39
|
-
|
28
|
+
```bash
|
29
|
+
$ rails generate doorkeeper:install
|
30
|
+
```
|
40
31
|
|
41
32
|
[doorkeeper’s installation generator]: https://github.com/doorkeeper-gem/doorkeeper#installation
|
42
33
|
|
@@ -45,20 +36,14 @@ This will install the doorkeeper initializer into
|
|
45
36
|
|
46
37
|
Set the ORM configuration:
|
47
38
|
|
48
|
-
```
|
39
|
+
```ruby
|
49
40
|
Doorkeeper.configure do
|
50
41
|
orm :mongoid7 # or any other version of mongoid
|
51
42
|
end
|
52
43
|
```
|
53
44
|
|
54
|
-
## MongoMapper
|
55
|
-
|
56
|
-
**NOTE**: Support of MongoMapper gem was dropped.
|
57
|
-
|
58
45
|
## Indexes
|
59
46
|
|
60
|
-
### Mongoid
|
61
|
-
|
62
47
|
Make sure you create indexes for doorkeeper models. You can do this either by
|
63
48
|
running `rake db:mongoid:create_indexes` or (if you're using Mongoid 2) by
|
64
49
|
adding `autocreate_indexes: true` to your `config/mongoid.yml`
|
@@ -71,7 +56,7 @@ variables defined in `.travis.yml` file.
|
|
71
56
|
|
72
57
|
To run locally, you need to choose a gemfile, with a command similar to:
|
73
58
|
|
74
|
-
```
|
59
|
+
```bash
|
75
60
|
$ export RAILS=5.1
|
76
61
|
$ export BUNDLE_GEMFILE=$PWD/gemfiles/Gemfile.mongoid6.rb
|
77
62
|
```
|
@@ -13,7 +13,7 @@ module Doorkeeper
|
|
13
13
|
belongs_to_options[:optional] = true if ::Mongoid::VERSION[0].to_i >= 6
|
14
14
|
|
15
15
|
belongs_to :owner, belongs_to_options
|
16
|
-
|
16
|
+
validates_presence_of :owner, if: :validate_owner?
|
17
17
|
end
|
18
18
|
|
19
19
|
def validate_owner?
|
@@ -19,7 +19,7 @@ module Doorkeeper
|
|
19
19
|
#
|
20
20
|
def by_resource_owner(resource_owner)
|
21
21
|
if DoorkeeperMongodb.doorkeeper_version?(5, 3) &&
|
22
|
-
|
22
|
+
Doorkeeper.configuration.try(:polymorphic_resource_owner?)
|
23
23
|
where(resource_owner: resource_owner)
|
24
24
|
else
|
25
25
|
where(resource_owner_id: resource_owner_id_for(resource_owner))
|
@@ -5,7 +5,22 @@ require "active_support/lazy_load_hooks"
|
|
5
5
|
module Doorkeeper
|
6
6
|
module Orm
|
7
7
|
module Mongoid4
|
8
|
+
def self.run_hooks
|
9
|
+
lazy_load do
|
10
|
+
require "doorkeeper/orm/mongoid4/access_grant"
|
11
|
+
require "doorkeeper/orm/mongoid4/access_token"
|
12
|
+
require "doorkeeper/orm/mongoid4/application"
|
13
|
+
require "doorkeeper/orm/mongoid4/stale_records_cleaner"
|
14
|
+
require "doorkeeper/orm/concerns/mongoid/ownership"
|
15
|
+
Doorkeeper::Application.include Doorkeeper::Orm::Concerns::Mongoid::Ownership
|
16
|
+
end
|
17
|
+
@initialized_hooks = true
|
18
|
+
end
|
19
|
+
|
20
|
+
# @deprecated
|
8
21
|
def self.initialize_models!
|
22
|
+
return if @initialized_hooks
|
23
|
+
|
9
24
|
lazy_load do
|
10
25
|
require "doorkeeper/orm/mongoid4/access_grant"
|
11
26
|
require "doorkeeper/orm/mongoid4/access_token"
|
@@ -14,7 +29,10 @@ module Doorkeeper
|
|
14
29
|
end
|
15
30
|
end
|
16
31
|
|
32
|
+
# @deprecated
|
17
33
|
def self.initialize_application_owner!
|
34
|
+
return if @initialized_hooks
|
35
|
+
|
18
36
|
lazy_load do
|
19
37
|
require "doorkeeper/orm/concerns/mongoid/ownership"
|
20
38
|
|
@@ -5,7 +5,22 @@ require "active_support/lazy_load_hooks"
|
|
5
5
|
module Doorkeeper
|
6
6
|
module Orm
|
7
7
|
module Mongoid5
|
8
|
+
def self.run_hooks
|
9
|
+
lazy_load do
|
10
|
+
require "doorkeeper/orm/mongoid5/access_grant"
|
11
|
+
require "doorkeeper/orm/mongoid5/access_token"
|
12
|
+
require "doorkeeper/orm/mongoid5/application"
|
13
|
+
require "doorkeeper/orm/mongoid5/stale_records_cleaner"
|
14
|
+
require "doorkeeper/orm/concerns/mongoid/ownership"
|
15
|
+
Doorkeeper::Application.include Doorkeeper::Orm::Concerns::Mongoid::Ownership
|
16
|
+
end
|
17
|
+
@initialized_hooks = true
|
18
|
+
end
|
19
|
+
|
20
|
+
# @deprecated
|
8
21
|
def self.initialize_models!
|
22
|
+
return if @initialized_hooks
|
23
|
+
|
9
24
|
lazy_load do
|
10
25
|
require "doorkeeper/orm/mongoid5/access_grant"
|
11
26
|
require "doorkeeper/orm/mongoid5/access_token"
|
@@ -14,7 +29,10 @@ module Doorkeeper
|
|
14
29
|
end
|
15
30
|
end
|
16
31
|
|
32
|
+
# @deprecated
|
17
33
|
def self.initialize_application_owner!
|
34
|
+
return if @initialized_hooks
|
35
|
+
|
18
36
|
lazy_load do
|
19
37
|
require "doorkeeper/orm/concerns/mongoid/ownership"
|
20
38
|
|
@@ -5,7 +5,22 @@ require "active_support/lazy_load_hooks"
|
|
5
5
|
module Doorkeeper
|
6
6
|
module Orm
|
7
7
|
module Mongoid6
|
8
|
+
def self.run_hooks
|
9
|
+
lazy_load do
|
10
|
+
require "doorkeeper/orm/mongoid6/access_grant"
|
11
|
+
require "doorkeeper/orm/mongoid6/access_token"
|
12
|
+
require "doorkeeper/orm/mongoid6/application"
|
13
|
+
require "doorkeeper/orm/mongoid6/stale_records_cleaner"
|
14
|
+
require "doorkeeper/orm/concerns/mongoid/ownership"
|
15
|
+
Doorkeeper::Application.include Doorkeeper::Orm::Concerns::Mongoid::Ownership
|
16
|
+
end
|
17
|
+
@initialized_hooks = true
|
18
|
+
end
|
19
|
+
|
20
|
+
# @deprecated
|
8
21
|
def self.initialize_models!
|
22
|
+
return if @initialized_hooks
|
23
|
+
|
9
24
|
lazy_load do
|
10
25
|
require "doorkeeper/orm/mongoid6/access_grant"
|
11
26
|
require "doorkeeper/orm/mongoid6/access_token"
|
@@ -14,7 +29,10 @@ module Doorkeeper
|
|
14
29
|
end
|
15
30
|
end
|
16
31
|
|
32
|
+
# @deprecated
|
17
33
|
def self.initialize_application_owner!
|
34
|
+
return if @initialized_hooks
|
35
|
+
|
18
36
|
lazy_load do
|
19
37
|
require "doorkeeper/orm/concerns/mongoid/ownership"
|
20
38
|
|
@@ -5,7 +5,22 @@ require "active_support/lazy_load_hooks"
|
|
5
5
|
module Doorkeeper
|
6
6
|
module Orm
|
7
7
|
module Mongoid7
|
8
|
+
def self.run_hooks
|
9
|
+
lazy_load do
|
10
|
+
require "doorkeeper/orm/mongoid7/access_grant"
|
11
|
+
require "doorkeeper/orm/mongoid7/access_token"
|
12
|
+
require "doorkeeper/orm/mongoid7/application"
|
13
|
+
require "doorkeeper/orm/mongoid7/stale_records_cleaner"
|
14
|
+
require "doorkeeper/orm/concerns/mongoid/ownership"
|
15
|
+
Doorkeeper::Application.include Doorkeeper::Orm::Concerns::Mongoid::Ownership
|
16
|
+
end
|
17
|
+
@initialized_hooks = true
|
18
|
+
end
|
19
|
+
|
20
|
+
# @deprecated
|
8
21
|
def self.initialize_models!
|
22
|
+
return if @initialized_hooks
|
23
|
+
|
9
24
|
lazy_load do
|
10
25
|
require "doorkeeper/orm/mongoid7/access_grant"
|
11
26
|
require "doorkeeper/orm/mongoid7/access_token"
|
@@ -14,7 +29,10 @@ module Doorkeeper
|
|
14
29
|
end
|
15
30
|
end
|
16
31
|
|
32
|
+
# @deprecated
|
17
33
|
def self.initialize_application_owner!
|
34
|
+
return if @initialized_hooks
|
35
|
+
|
18
36
|
lazy_load do
|
19
37
|
require "doorkeeper/orm/concerns/mongoid/ownership"
|
20
38
|
|
@@ -36,8 +36,9 @@ module DoorkeeperMongodb
|
|
36
36
|
belongs_to :resource_owner, polymorphic: true
|
37
37
|
end
|
38
38
|
|
39
|
-
|
40
|
-
|
39
|
+
validates_presence_of :resource_owner_id, :application_id, :token,
|
40
|
+
:expires_in, :redirect_uri
|
41
|
+
validates_uniqueness_of :token
|
41
42
|
|
42
43
|
before_validation :generate_token, on: :create
|
43
44
|
end
|
@@ -123,15 +124,14 @@ module DoorkeeperMongodb
|
|
123
124
|
|
124
125
|
# @param code_verifier [#to_s] a one time use value (any object that responds to `#to_s`)
|
125
126
|
#
|
126
|
-
# @return [#to_s] An encoded code challenge based on the provided verifier suitable
|
127
|
+
# @return [#to_s] An encoded code challenge based on the provided verifier suitable
|
128
|
+
# for PKCE validation
|
127
129
|
def generate_code_challenge(code_verifier)
|
128
130
|
padded_result = Base64.urlsafe_encode64(Digest::SHA256.digest(code_verifier))
|
129
131
|
padded_result.split("=")[0] # Remove any trailing '='
|
130
132
|
end
|
131
133
|
|
132
|
-
|
133
|
-
new.pkce_supported?
|
134
|
-
end
|
134
|
+
delegate :pkce_supported?, to: :new
|
135
135
|
|
136
136
|
##
|
137
137
|
# Determines the secret storing transformer
|
@@ -41,8 +41,9 @@ module DoorkeeperMongodb
|
|
41
41
|
belongs_to :resource_owner, opts
|
42
42
|
end
|
43
43
|
|
44
|
-
|
45
|
-
|
44
|
+
validates_presence_of :token
|
45
|
+
validates_uniqueness_of :token
|
46
|
+
validates_uniqueness_of :refresh_token, if: :use_refresh_token?
|
46
47
|
|
47
48
|
# @attr_writer [Boolean, nil] use_refresh_token
|
48
49
|
# indicates the possibility of using refresh token
|
@@ -368,10 +369,10 @@ module DoorkeeperMongodb
|
|
368
369
|
# and clears `:previous_refresh_token` attribute.
|
369
370
|
#
|
370
371
|
def revoke_previous_refresh_token!
|
371
|
-
return
|
372
|
+
return if !self.class.refresh_token_revoked_on_use? || previous_refresh_token.blank?
|
372
373
|
|
373
374
|
old_refresh_token&.revoke
|
374
|
-
|
375
|
+
update_attribute(:previous_refresh_token, "")
|
375
376
|
end
|
376
377
|
|
377
378
|
private
|
@@ -419,7 +420,8 @@ module DoorkeeperMongodb
|
|
419
420
|
|
420
421
|
return generator if generator.respond_to?(:generate)
|
421
422
|
|
422
|
-
raise Doorkeeper::Errors::UnableToGenerateToken,
|
423
|
+
raise Doorkeeper::Errors::UnableToGenerateToken,
|
424
|
+
"#{generator} does not respond to `.generate`."
|
423
425
|
rescue NameError
|
424
426
|
raise Doorkeeper::Errors::TokenGeneratorNotFound, "#{generator_name} not found"
|
425
427
|
end
|
@@ -36,8 +36,8 @@ module DoorkeeperMongodb
|
|
36
36
|
has_many :access_grants, has_many_options.merge(class_name: access_grants_class_name)
|
37
37
|
has_many :access_tokens, has_many_options.merge(class_name: access_tokens_class_name)
|
38
38
|
|
39
|
-
|
40
|
-
|
39
|
+
validates_presence_of :name, :secret, :uid
|
40
|
+
validates_uniqueness_of :uid
|
41
41
|
|
42
42
|
# Before Doorkeeper 5.2.3
|
43
43
|
if defined?(::RedirectUriValidator)
|
@@ -46,7 +46,7 @@ module DoorkeeperMongodb
|
|
46
46
|
validates :redirect_uri, "doorkeeper/redirect_uri": true
|
47
47
|
end
|
48
48
|
|
49
|
-
|
49
|
+
validates_inclusion_of :confidential, in: [true, false]
|
50
50
|
|
51
51
|
validate :scopes_match_configured, if: :enforce_scopes?
|
52
52
|
|
@@ -242,7 +242,7 @@ module DoorkeeperMongodb
|
|
242
242
|
end
|
243
243
|
|
244
244
|
def generate_secret
|
245
|
-
return
|
245
|
+
return if secret.present?
|
246
246
|
|
247
247
|
@raw_secret = UniqueToken.generate
|
248
248
|
secret_strategy.store_secret(self, :secret, @raw_secret)
|
@@ -250,7 +250,8 @@ module DoorkeeperMongodb
|
|
250
250
|
|
251
251
|
def scopes_match_configured
|
252
252
|
if scopes.present? &&
|
253
|
-
!ScopeChecker.valid?(scope_str: scopes.to_s,
|
253
|
+
!ScopeChecker.valid?(scope_str: scopes.to_s,
|
254
|
+
server_scopes: Doorkeeper.configuration.scopes,)
|
254
255
|
errors.add(:scopes, :not_match_configured)
|
255
256
|
end
|
256
257
|
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/spec/dummy/config/boot.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/spec/dummy/config/mongo.yml
CHANGED
data/spec/dummy/config/routes.rb
CHANGED
File without changes
|
data/spec/dummy/config.ru
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/spec/dummy/db/schema.rb
CHANGED
File without changes
|
data/spec/dummy/public/404.html
CHANGED
File without changes
|
data/spec/dummy/public/422.html
CHANGED
File without changes
|
data/spec/dummy/public/500.html
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/spec/factories.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
data/spec/lib/config_spec.rb
CHANGED
File without changes
|
data/spec/lib/doorkeeper_spec.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|