Browse Source

Bump doorkeeper from 5.3.3 to 5.4.0 (#13733)

* Bump doorkeeper from 5.3.3 to 5.4.0

Bumps [doorkeeper](https://github.com/doorkeeper-gem/doorkeeper) from 5.3.3 to 5.4.0.
- [Release notes](https://github.com/doorkeeper-gem/doorkeeper/releases)
- [Changelog](https://github.com/doorkeeper-gem/doorkeeper/blob/master/CHANGELOG.md)
- [Commits](https://github.com/doorkeeper-gem/doorkeeper/compare/v5.3.3...v5.4.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Fix tests

* Fix use of Doorkeeper::AccessToken.find_or_create_for

* Fix tests?

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Thibaut Girka <thib@sitedethib.com>
dependabot-preview[bot] 2 months ago
parent
commit
78202e9138
No account linked to committer's email address

+ 1
- 1
Gemfile View File

@@ -49,7 +49,7 @@ gem 'omniauth-saml', '~> 1.10'
49 49
 gem 'omniauth', '~> 1.9'
50 50
 
51 51
 gem 'discard', '~> 1.2'
52
-gem 'doorkeeper', '~> 5.3'
52
+gem 'doorkeeper', '~> 5.4'
53 53
 gem 'fast_blank', '~> 1.0'
54 54
 gem 'fastimage'
55 55
 gem 'goldfinger', '~> 2.1'

+ 2
- 2
Gemfile.lock View File

@@ -194,7 +194,7 @@ GEM
194 194
     docile (1.3.2)
195 195
     domain_name (0.5.20190701)
196 196
       unf (>= 0.0.5, < 1.0.0)
197
-    doorkeeper (5.3.3)
197
+    doorkeeper (5.4.0)
198 198
       railties (>= 5)
199 199
     dotenv (2.7.5)
200 200
     dotenv-rails (2.7.5)
@@ -697,7 +697,7 @@ DEPENDENCIES
697 697
   devise-two-factor (~> 3.1)
698 698
   devise_pam_authenticatable2 (~> 9.2)
699 699
   discard (~> 1.2)
700
-  doorkeeper (~> 5.3)
700
+  doorkeeper (~> 5.4)
701 701
   dotenv-rails (~> 2.7)
702 702
   e2mmap (~> 0.1.0)
703 703
   fabrication (~> 2.21)

+ 5
- 5
app/models/web/push_subscription.rb View File

@@ -94,11 +94,11 @@ class Web::PushSubscription < ApplicationRecord
94 94
 
95 95
   def find_or_create_access_token
96 96
     Doorkeeper::AccessToken.find_or_create_for(
97
-      Doorkeeper::Application.find_by(superapp: true),
98
-      session_activation.user_id,
99
-      Doorkeeper::OAuth::Scopes.from_string('read write follow push'),
100
-      Doorkeeper.configuration.access_token_expires_in,
101
-      Doorkeeper.configuration.refresh_token_enabled?
97
+      application: Doorkeeper::Application.find_by(superapp: true),
98
+      resource_owner: session_activation.user_id,
99
+      scopes: Doorkeeper::OAuth::Scopes.from_string('read write follow push'),
100
+      expires_in: Doorkeeper.configuration.access_token_expires_in,
101
+      use_refresh_token: Doorkeeper.configuration.refresh_token_enabled?
102 102
     )
103 103
   end
104 104
 end

+ 1
- 1
spec/controllers/api/v1/accounts_controller_spec.rb View File

@@ -21,7 +21,7 @@ RSpec.describe Api::V1::AccountsController, type: :controller do
21 21
 
22 22
   describe 'POST #create' do
23 23
     let(:app) { Fabricate(:application) }
24
-    let(:token) { Doorkeeper::AccessToken.find_or_create_for(app, nil, 'read write', nil, false) }
24
+    let(:token) { Doorkeeper::AccessToken.find_or_create_for(application: app, resource_owner: nil, scopes: 'read write', use_refresh_token: false) }
25 25
     let(:agreement) { nil }
26 26
 
27 27
     before do

+ 5
- 5
spec/controllers/oauth/authorizations_controller_spec.rb View File

@@ -41,11 +41,11 @@ RSpec.describe Oauth::AuthorizationsController, type: :controller do
41 41
       context 'when app is already authorized' do
42 42
         before do
43 43
           Doorkeeper::AccessToken.find_or_create_for(
44
-            app,
45
-            user.id,
46
-            app.scopes,
47
-            Doorkeeper.configuration.access_token_expires_in,
48
-            Doorkeeper.configuration.refresh_token_enabled?
44
+            application: app,
45
+            resource_owner: user.id,
46
+            scopes: app.scopes,
47
+            expires_in: Doorkeeper.configuration.access_token_expires_in,
48
+            use_refresh_token: Doorkeeper.configuration.refresh_token_enabled?
49 49
           )
50 50
         end
51 51
 

+ 3
- 2
spec/controllers/oauth/tokens_controller_spec.rb View File

@@ -5,11 +5,12 @@ require 'rails_helper'
5 5
 RSpec.describe Oauth::TokensController, type: :controller do
6 6
   describe 'POST #revoke' do
7 7
     let!(:user) { Fabricate(:user) }
8
-    let!(:access_token) { Fabricate(:accessible_access_token, resource_owner_id: user.id) }
8
+    let!(:application) { Fabricate(:application, confidential: false) }
9
+    let!(:access_token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, application: application) }
9 10
     let!(:web_push_subscription) { Fabricate(:web_push_subscription, user: user, access_token: access_token) }
10 11
 
11 12
     before do
12
-      post :revoke, params: { token: access_token.token }
13
+      post :revoke, params: { client_id: application.uid, token: access_token.token }
13 14
     end
14 15
 
15 16
     it 'revokes the token' do

Loading…
Cancel
Save