Skip to content

Commit

Permalink
Merge pull request #173 from doorkeeper-gem/prepend-in-to-prepare-block
Browse files Browse the repository at this point in the history
Extend AuthorizationsController in a to_prepare block
  • Loading branch information
nbulaj authored Jul 13, 2022
2 parents f86f8bd + b1eb091 commit a16c9e0
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 17 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
## Unreleased

- [#] Add here
- [#168] Allow to use custom doorkeeper access grant model (thanks @nov).
- [#170] Controllers inherit `Doorkeeper::AppliactionMetalController` (thanks @sato11).
- [#171] Correctly override `AuthorizationsController` params (thanks to @nbulaj).

## v1.8.1 (2022-02-09)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module Doorkeeper
module OpenidConnect
module AuthorizationsExtension
private

def pre_auth_param_fields
super.append(:nonce)
end
end
end
end

17 changes: 0 additions & 17 deletions app/controllers/doorkeeper/authorizations_controller.rb

This file was deleted.

4 changes: 4 additions & 0 deletions lib/doorkeeper/openid_connect/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ class Engine < ::Rails::Engine
initializer 'doorkeeper.openid_connect.routes' do
Doorkeeper::OpenidConnect::Rails::Routes.install!
end

config.to_prepare do
Doorkeeper::AuthorizationsController.prepend Doorkeeper::OpenidConnect::AuthorizationsExtension
end
end
end
end
1 change: 1 addition & 0 deletions spec/models/access_grant_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
expect(association.options).to eq({
class_name: 'Doorkeeper::OpenidConnect::Request',
inverse_of: :access_grant,
foreign_key: "access_grant_id",
dependent: :delete,
})
end
Expand Down

0 comments on commit a16c9e0

Please sign in to comment.