Skip to content

Commit

Permalink
Use Application#confidential? to determine revocation auth eligibility
Browse files Browse the repository at this point in the history
OAuth applications that obtain an access token using the "implicit" grant flow will have their ID set on the token record. Unfortunately this causes the revocation controller code to think it's as confidential application. Because of this, Doorkeeper enforces oauth client authentication and the revocation call fails.

Fixes doorkeeper-gem#891
  • Loading branch information
Justin Bull committed Jul 10, 2018
1 parent f4472bc commit e015002
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions app/controllers/doorkeeper/tokens_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,15 @@ def introspect
# https://tools.ietf.org/html/rfc6749#section-2.1
# https://tools.ietf.org/html/rfc7009
def authorized?
if token.present?
# Client is confidential, therefore client authentication & authorization
# is required
if token.application_id?
# We authorize client by checking token's application
server.client && server.client.application == token.application
else
# Client is public, authentication unnecessary
true
end
return unless token.present?
# Client is confidential, therefore client authentication & authorization
# is required
if token.application_id? && token.application.confidential?
# We authorize client by checking token's application
server.client && server.client.application == token.application
else
# Client is public, authentication unnecessary
true
end
end

Expand Down

0 comments on commit e015002

Please sign in to comment.