lib/doorkeeper/oauth/authorization/token.rb in doorkeeper-5.4.0 vs lib/doorkeeper/oauth/authorization/token.rb in doorkeeper-5.5.0.rc1
- old
+ new
@@ -5,23 +5,24 @@
module Authorization
class Token
attr_reader :pre_auth, :resource_owner, :token
class << self
- def build_context(pre_auth_or_oauth_client, grant_type, scopes)
+ def build_context(pre_auth_or_oauth_client, grant_type, scopes, resource_owner)
oauth_client = if pre_auth_or_oauth_client.respond_to?(:application)
pre_auth_or_oauth_client.application
elsif pre_auth_or_oauth_client.respond_to?(:client)
pre_auth_or_oauth_client.client
else
pre_auth_or_oauth_client
end
Doorkeeper::OAuth::Authorization::Context.new(
- oauth_client,
- grant_type,
- scopes,
+ client: oauth_client,
+ grant_type: grant_type,
+ scopes: scopes,
+ resource_owner: resource_owner,
)
end
def access_token_expires_in(configuration, context)
if configuration.option_defined?(:custom_access_token_expires_in)
@@ -53,9 +54,10 @@
context = self.class.build_context(
pre_auth.client,
Doorkeeper::OAuth::IMPLICIT,
pre_auth.scopes,
+ resource_owner,
)
@token = Doorkeeper.config.access_token_model.find_or_create_for(
application: pre_auth.client,
resource_owner: resource_owner,