Skip to content

Commit

Permalink
Only check OIDC params in authorizations#new
Browse files Browse the repository at this point in the history
  • Loading branch information
toupeira committed Feb 15, 2019
1 parent 0a58fa1 commit 3893ea1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/doorkeeper/openid_connect/helpers/controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ module Controller

def authenticate_resource_owner!
super.tap do |owner|
next unless respond_to?(:pre_auth, true)

This comment has been minimized.

Copy link
@michaelglass

michaelglass Mar 5, 2019

Contributor

this breaks compatibility with 4.*
#mapping is introduced in 5
doorkeeper-gem/doorkeeper#1082

cc @bendansby

next unless pre_auth.client && pre_auth.scopes.include?('openid')
next unless controller_path == Doorkeeper::Rails::Routes.mapping[:authorizations][:controllers] &&
action_name == 'new'
next unless pre_auth.scopes.include?('openid')

handle_prompt_param!(owner)
handle_max_age_param!(owner)
Expand Down
6 changes: 6 additions & 0 deletions spec/controllers/doorkeeper/authorizations_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ def expect_successful_callback!
end

describe '#handle_prompt_param!' do
it 'is ignored when the openid scope is not present' do
authorize! scope: 'profile', prompt: 'invalid'

expect_authorization_form!
end

context 'with a prompt=none parameter' do
context 'and a matching token' do
before do
Expand Down

0 comments on commit 3893ea1

Please sign in to comment.