lib/doorkeeper/oauth/authorization/token.rb in doorkeeper-5.2.6 vs lib/doorkeeper/oauth/authorization/token.rb in doorkeeper-5.3.0

- old
+ new

@@ -17,11 +17,11 @@ end Doorkeeper::OAuth::Authorization::Context.new( oauth_client, grant_type, - scopes + scopes, ) end def access_token_expires_in(configuration, context) if configuration.option_defined?(:custom_access_token_expires_in) @@ -33,11 +33,11 @@ configuration.access_token_expires_in end end def refresh_token_enabled?(server, context) - if server.refresh_token_enabled?.respond_to? :call + if server.refresh_token_enabled?.respond_to?(:call) server.refresh_token_enabled?.call(context) else !!server.refresh_token_enabled? end end @@ -47,21 +47,24 @@ @pre_auth = pre_auth @resource_owner = resource_owner end def issue_token + return @token if defined?(@token) + context = self.class.build_context( pre_auth.client, Doorkeeper::OAuth::IMPLICIT, - pre_auth.scopes + pre_auth.scopes, ) - @token ||= AccessToken.find_or_create_for( + + @token = configuration.access_token_model.find_or_create_for( pre_auth.client, resource_owner.id, pre_auth.scopes, self.class.access_token_expires_in(configuration, context), - false + false, ) end def oob_redirect { @@ -72,10 +75,10 @@ end private def configuration - Doorkeeper.configuration + Doorkeeper.config end def controller @controller ||= begin mapping = Doorkeeper::Rails::Routes.mapping[:token_info] || {}