lib/doorkeeper/oauth/authorization/token.rb in doorkeeper-5.3.3 vs lib/doorkeeper/oauth/authorization/token.rb in doorkeeper-5.4.0.rc1
- old
+ new
@@ -2,11 +2,11 @@
module Doorkeeper
module OAuth
module Authorization
class Token
- attr_accessor :pre_auth, :resource_owner, :token
+ attr_reader :pre_auth, :resource_owner, :token
class << self
def build_context(pre_auth_or_oauth_client, grant_type, scopes)
oauth_client = if pre_auth_or_oauth_client.respond_to?(:application)
pre_auth_or_oauth_client.application
@@ -55,16 +55,16 @@
pre_auth.client,
Doorkeeper::OAuth::IMPLICIT,
pre_auth.scopes,
)
- @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,
+ @token = Doorkeeper.config.access_token_model.find_or_create_for(
+ application: pre_auth.client,
+ resource_owner: resource_owner,
+ scopes: pre_auth.scopes,
+ expires_in: self.class.access_token_expires_in(Doorkeeper.config, context),
+ use_refresh_token: false,
)
end
def oob_redirect
{
@@ -73,13 +73,9 @@
access_token: token.plaintext_token,
}
end
private
-
- def configuration
- Doorkeeper.config
- end
def controller
@controller ||= begin
mapping = Doorkeeper::Rails::Routes.mapping[:token_info] || {}
mapping[:controllers] || "doorkeeper/token_info"