Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Markus Koller <markus-koller@gmx.ch>
  • Loading branch information
linhdangduy and toupeira committed May 25, 2020
1 parent 6e500d9 commit ddc0ede
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- [#114] Fix user_info endpoint when used in api mode
- [#112] Add grant_types_supported to discovery response
- [#111] Add configuration callbacks `select_account_for_resource_owner` to support param prompt=select_account
- [#111] Add configuration callback `select_account_for_resource_owner` to support the `prompt=select_account` param

## v1.7.2 (2020-05-20)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ The following settings are optional, but recommended for better client compatibi
- Required to support the `max_age` and `prompt=login` parameters.
- The block is executed in the controller's scope, so you have access to methods like `params`, `redirect_to` etc.
- `select_account_for_resource_owner`
- Defines how to trigger account selecting to choose the current login user
- Defines how to trigger account selection to choose the current login user.
- Required to support the `prompt=select_account` parameter.
- The block is executed in the controller's scope, so you have access to methods like `params`, `redirect_to` etc.

Expand Down
1 change: 0 additions & 1 deletion lib/doorkeeper/openid_connect/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class InvalidRequest < OpenidConnectError; end
class LoginRequired < OpenidConnectError; end
class ConsentRequired < OpenidConnectError; end
class InteractionRequired < OpenidConnectError; end
class AccountSelectionRequired < OpenidConnectError; end
end
end
end
6 changes: 3 additions & 3 deletions lib/doorkeeper/openid_connect/helpers/controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def handle_oidc_max_age_param!(owner)
end
end

def return_without_prompt_param(prompt_value)
def return_without_oidc_prompt_param(prompt_value)
return_to = URI.parse(request.path)
return_to.query = request.query_parameters.tap do |params|
params['prompt'] = params['prompt'].to_s.sub(/\b#{prompt_value}\s*\b/, '').strip
Expand All @@ -106,7 +106,7 @@ def return_without_prompt_param(prompt_value)
end

def reauthenticate_oidc_resource_owner(owner)
return_to = return_without_prompt_param('login')
return_to = return_without_oidc_prompt_param('login')

instance_exec(
owner,
Expand All @@ -122,7 +122,7 @@ def oidc_consent_required?
end

def select_account_for_oidc_resource_owner(owner)
return_to = return_without_prompt_param('select_account')
return_to = return_without_oidc_prompt_param('select_account')

instance_exec(
owner,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
# redirect_to new_user_session_url
end

# Depend on the configuration, the DoubleRenderError could be occurred
# because of render/redirect is called at some configuration before this configure is called.
# To avoid DoubleRenderError, you could adding these two lines at the beginning
# of this configuration: (Reference: https://github.com/rails/rails/issues/25106)
# Depending on your configuration, a DoubleRenderError could be raised
# if render/redirect_to is called at some point before this callback is executed.
# To avoid the DoubleRenderError, you could add these two lines at the beginning
# of this callback: (Reference: https://github.com/rails/rails/issues/25106)
# self.response_body = nil
# @_response_body = nil
select_account_for_resource_owner do |resource_owner, return_to|
Expand Down

0 comments on commit ddc0ede

Please sign in to comment.