lib/doorkeeper/oauth/token.rb in doorkeeper-4.4.3 vs lib/doorkeeper/oauth/token.rb in doorkeeper-5.0.0.rc1
- old
+ new
@@ -1,20 +1,23 @@
module Doorkeeper
module OAuth
class Token
class << self
def from_request(request, *methods)
- methods.inject(nil) do |credentials, method|
+ methods.inject(nil) do |_, method|
method = self.method(method) if method.is_a?(Symbol)
credentials = method.call(request)
break credentials unless credentials.blank?
end
end
def authenticate(request, *methods)
if (token = from_request(request, *methods))
access_token = AccessToken.by_token(token)
- access_token.revoke_previous_refresh_token! if access_token
+ refresh_token_enabled = Doorkeeper.configuration.refresh_token_enabled?
+ if access_token.present? && refresh_token_enabled
+ access_token.revoke_previous_refresh_token!
+ end
access_token
end
end
def from_access_token_param(request)