Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent 500 when required parameters are not present #77

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/doorkeeper/openid_connect/helpers/controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ def authenticate_resource_owner!
super.tap do |owner|
next unless controller_path == Doorkeeper::Rails::Routes.mapping[:authorizations][:controllers] &&
action_name == 'new'
raise Errors::OpenidConnectError unless pre_auth.valid?
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will still fail on line 37 if we're missing a redirect_uri in our error_response

next unless pre_auth.scopes.include?('openid')

handle_prompt_param!(owner)
Expand Down
7 changes: 7 additions & 0 deletions spec/controllers/doorkeeper/authorizations_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -262,4 +262,11 @@ def reauthenticate!
end
end
end

describe 'when params are missing' do
it 'responds with 4xx' do
authorize!({ scope: nil, current_user: nil, client_id: nil })
expect(response.status).to be(401)
end
end
end