diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2020-11-12 23:05:24 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-12 23:05:24 +0100 |
commit | aa10200e58ccb340b6384532ccdba6b7fbac037a (patch) | |
tree | 079694664dd9fc7b98aef2704cb4b79c69fa7831 /app/models | |
parent | 8532429af749339a3ff6af4130de3743cd8d1c68 (diff) |
Fix streaming API allowing connections to persist after access token invalidation (#15111)
Fix #14816
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/session_activation.rb | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/app/models/session_activation.rb b/app/models/session_activation.rb index 34d25c83db2..b0ce9d11282 100644 --- a/app/models/session_activation.rb +++ b/app/models/session_activation.rb @@ -70,12 +70,16 @@ class SessionActivation < ApplicationRecord end def assign_access_token - superapp = Doorkeeper::Application.find_by(superapp: true) + self.access_token = Doorkeeper::AccessToken.create!(access_token_attributes) + end - self.access_token = Doorkeeper::AccessToken.create!(application_id: superapp&.id, - resource_owner_id: user_id, - scopes: 'read write follow', - expires_in: Doorkeeper.configuration.access_token_expires_in, - use_refresh_token: Doorkeeper.configuration.refresh_token_enabled?) + def access_token_attributes + { + application_id: Doorkeeper::Application.find_by(superapp: true)&.id, + resource_owner_id: user_id, + scopes: 'read write follow', + expires_in: Doorkeeper.configuration.access_token_expires_in, + use_refresh_token: Doorkeeper.configuration.refresh_token_enabled?, + } end end |