doorkeeper 5.9.1 → 5.9.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dd9d528da47dec74a5bb12a6e9ce672279cebd0a52cc6a714347df6c17828dfd
4
- data.tar.gz: 61e4dcc2434b3e1c0400e35bf80eef980b3adb81c2a33cbe74e9797fef3963b0
3
+ metadata.gz: 71a32b8766b44f5eff16fbc128cfff6ab676b5af9104d16d58f060a0ed6d894c
4
+ data.tar.gz: 864e07764f1ba86d6f52a10e5a081291c2748dcecbfb8bcc60b0f27baa4e616e
5
5
  SHA512:
6
- metadata.gz: 8a3e115278bfb5540ccde8b7ecc4084138935a4a7c928011f38684908c4e5cd0dadbfb14a93bcb4ce39da91a8bcaf599970d39de6d7953752e7c77aa6c03c31e
7
- data.tar.gz: b62a19e584648c28bd9d4a24e21d3501ac35c85c77de950050c8942bb82be4f821d241b41ebc8544b03c354f93f96e4588c051d1b4eafe77ce6b13c06941ab7c
6
+ metadata.gz: 4116cfa7e4e06a1bff79489ddeced66af1803dedd6f2e1b1b5edd67db0d90e444922a87cfc2215a4e61357e54ddf988606c3ecce40e50afb24fdd5e06808a2bd
7
+ data.tar.gz: 558ec2ac88215ba2cde034380a27d44d0c989841942c070e4ea02a746d154944b094ae2aa6a9284c7cca6d310705634fde4f6566fbf8a268a0c1b33e41937107
data/CHANGELOG.md CHANGED
@@ -7,7 +7,18 @@ User-visible changes worth mentioning.
7
7
 
8
8
  ## main
9
9
 
10
- - Add here
10
+ - Please add here
11
+
12
+ ## 5.9.3
13
+
14
+ - [#1834] Fix default `allow_token_introspection` returning `false` when a custom `application_class` is configured. The default proc compared application objects with `==`, which fails when the authorized client and the introspected token's application are resolved as different classes (e.g. a base `Doorkeeper::Application` vs. a configured subclass) even though they reference the same record. It now compares application ids instead.
15
+ - [#1832] Fix confusing `belongs_to :owner` side effect: `Doorkeeper::Models::Ownership` is now included only when `enable_application_owner?` is set (read at include time), so models no longer expose a misleading `owner` association/reflection when the application owner feature is disabled and the schema lacks the owner columns.
16
+
17
+ ## 5.9.2
18
+
19
+ - [#1822][#1823][#1825] Update Rubocop config, auto-corrections and codebase cleanup.
20
+ - [#1830] Fix `NameError: uninitialized constant ApplicationRecord` on `rails db:seed` (and other non-eager-loading flows) caused by `on_load(:active_record)` firing re-entrantly during `ApplicationRecord` autoload. The orm hooks no longer depend on `ActiveSupport.on_load(:active_record)`; model concerns (`Ownership`, `PolymorphicResourceOwner::ForAccessGrant`, `PolymorphicResourceOwner::ForAccessToken`) are now wired up from each `Mixins::*` `included` block, which fires at parent-class autoload time — after `Doorkeeper.configure` has applied user settings and without re-entering the AR load chain.
21
+ - **Upgrade note**: fully custom model classes that don't include `Doorkeeper::Orm::ActiveRecord::Mixins::{Application,AccessToken,AccessGrant}` will no longer auto-receive `Ownership` / `PolymorphicResourceOwner` concerns (previously injected by `run_orm_hooks` via the configured class name). Either inherit from the Doorkeeper default model, include the corresponding `Mixins::*` module, or `include` the concerns directly.
11
22
 
12
23
  ## 5.9.1
13
24
 
@@ -444,9 +444,9 @@ module Doorkeeper
444
444
  option :allow_token_introspection,
445
445
  default: (lambda do |token, authorized_client, authorized_token|
446
446
  if authorized_token
447
- authorized_token.application == token&.application
447
+ authorized_token.application_id == token&.application_id
448
448
  elsif token&.application
449
- authorized_client == token.application
449
+ authorized_client.id == token.application_id
450
450
  else
451
451
  true
452
452
  end
@@ -9,6 +9,7 @@ module Doorkeeper::Orm::ActiveRecord::Mixins
9
9
  self.strict_loading_by_default = false if respond_to?(:strict_loading_by_default)
10
10
 
11
11
  include ::Doorkeeper::AccessGrantMixin
12
+ include ::Doorkeeper::Models::PolymorphicResourceOwner::ForAccessGrant
12
13
 
13
14
  belongs_to :application, class_name: Doorkeeper.config.application_class.to_s,
14
15
  optional: true,
@@ -9,6 +9,7 @@ module Doorkeeper::Orm::ActiveRecord::Mixins
9
9
  self.strict_loading_by_default = false if respond_to?(:strict_loading_by_default)
10
10
 
11
11
  include ::Doorkeeper::AccessTokenMixin
12
+ include ::Doorkeeper::Models::PolymorphicResourceOwner::ForAccessToken
12
13
 
13
14
  belongs_to :application, class_name: Doorkeeper.config.application_class.to_s,
14
15
  inverse_of: :access_tokens,
@@ -9,6 +9,12 @@ module Doorkeeper::Orm::ActiveRecord::Mixins
9
9
  self.strict_loading_by_default = false if respond_to?(:strict_loading_by_default)
10
10
 
11
11
  include ::Doorkeeper::ApplicationMixin
12
+ # `enable_application_owner?` is read once, at parent-class autoload
13
+ # time (#1831): with the feature off the model exposes no `:owner`
14
+ # association — avoiding a misleading reflection on schemas that lack
15
+ # the owner columns. The flag is therefore a load-time switch; turning
16
+ # it on later requires defining a fresh model class.
17
+ include ::Doorkeeper::Models::Ownership if Doorkeeper.config.enable_application_owner?
12
18
 
13
19
  has_many :access_grants,
14
20
  foreign_key: :application_id,
@@ -28,22 +28,14 @@ module Doorkeeper
28
28
  autoload :Application, "doorkeeper/orm/active_record/mixins/application"
29
29
  end
30
30
 
31
- def self.run_hooks
32
- initialize_configured_associations
33
- end
34
-
35
- def self.initialize_configured_associations
36
- # NOTE: on_load block is instance_exec'd on ActiveRecord::Base,
37
- # so use fully qualified references (e.g. Doorkeeper.config).
38
- ActiveSupport.on_load(:active_record) do
39
- if Doorkeeper.config.enable_application_owner?
40
- Doorkeeper.config.application_model.include ::Doorkeeper::Models::Ownership
41
- end
42
-
43
- Doorkeeper.config.access_grant_model.include ::Doorkeeper::Models::PolymorphicResourceOwner::ForAccessGrant
44
- Doorkeeper.config.access_token_model.include ::Doorkeeper::Models::PolymorphicResourceOwner::ForAccessToken
45
- end
46
- end
31
+ # Kept as a no-op so `Doorkeeper.run_orm_hooks` (and any plugin that
32
+ # checks `respond_to?(:run_hooks)`) stays quiet. The model concerns
33
+ # that used to be wired up here are now included from each Mixin's
34
+ # `included` block, which runs at parent-class autoload time — well
35
+ # after `Doorkeeper.configure` has applied user settings, and without
36
+ # touching `ActiveSupport.on_load(:active_record)` (whose re-entrant
37
+ # firing during `ApplicationRecord` autoload caused #1828).
38
+ def self.run_hooks; end
47
39
  end
48
40
  end
49
41
  end
@@ -5,7 +5,7 @@ module Doorkeeper
5
5
  # Semantic versioning
6
6
  MAJOR = 5
7
7
  MINOR = 9
8
- TINY = 1
8
+ TINY = 3
9
9
  PRE = nil
10
10
 
11
11
  # Full version number
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: doorkeeper
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.9.1
4
+ version: 5.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felipe Elias Philipp