forked from fedi/mastodon
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>
This commit is contained in:
parent
d8bad8fbf6
commit
78202e9138
2
Gemfile
2
Gemfile
|
@ -49,7 +49,7 @@ gem 'omniauth-saml', '~> 1.10'
|
||||||
gem 'omniauth', '~> 1.9'
|
gem 'omniauth', '~> 1.9'
|
||||||
|
|
||||||
gem 'discard', '~> 1.2'
|
gem 'discard', '~> 1.2'
|
||||||
gem 'doorkeeper', '~> 5.3'
|
gem 'doorkeeper', '~> 5.4'
|
||||||
gem 'fast_blank', '~> 1.0'
|
gem 'fast_blank', '~> 1.0'
|
||||||
gem 'fastimage'
|
gem 'fastimage'
|
||||||
gem 'goldfinger', '~> 2.1'
|
gem 'goldfinger', '~> 2.1'
|
||||||
|
|
|
@ -194,7 +194,7 @@ GEM
|
||||||
docile (1.3.2)
|
docile (1.3.2)
|
||||||
domain_name (0.5.20190701)
|
domain_name (0.5.20190701)
|
||||||
unf (>= 0.0.5, < 1.0.0)
|
unf (>= 0.0.5, < 1.0.0)
|
||||||
doorkeeper (5.3.3)
|
doorkeeper (5.4.0)
|
||||||
railties (>= 5)
|
railties (>= 5)
|
||||||
dotenv (2.7.5)
|
dotenv (2.7.5)
|
||||||
dotenv-rails (2.7.5)
|
dotenv-rails (2.7.5)
|
||||||
|
@ -697,7 +697,7 @@ DEPENDENCIES
|
||||||
devise-two-factor (~> 3.1)
|
devise-two-factor (~> 3.1)
|
||||||
devise_pam_authenticatable2 (~> 9.2)
|
devise_pam_authenticatable2 (~> 9.2)
|
||||||
discard (~> 1.2)
|
discard (~> 1.2)
|
||||||
doorkeeper (~> 5.3)
|
doorkeeper (~> 5.4)
|
||||||
dotenv-rails (~> 2.7)
|
dotenv-rails (~> 2.7)
|
||||||
e2mmap (~> 0.1.0)
|
e2mmap (~> 0.1.0)
|
||||||
fabrication (~> 2.21)
|
fabrication (~> 2.21)
|
||||||
|
|
|
@ -94,11 +94,11 @@ class Web::PushSubscription < ApplicationRecord
|
||||||
|
|
||||||
def find_or_create_access_token
|
def find_or_create_access_token
|
||||||
Doorkeeper::AccessToken.find_or_create_for(
|
Doorkeeper::AccessToken.find_or_create_for(
|
||||||
Doorkeeper::Application.find_by(superapp: true),
|
application: Doorkeeper::Application.find_by(superapp: true),
|
||||||
session_activation.user_id,
|
resource_owner: session_activation.user_id,
|
||||||
Doorkeeper::OAuth::Scopes.from_string('read write follow push'),
|
scopes: Doorkeeper::OAuth::Scopes.from_string('read write follow push'),
|
||||||
Doorkeeper.configuration.access_token_expires_in,
|
expires_in: Doorkeeper.configuration.access_token_expires_in,
|
||||||
Doorkeeper.configuration.refresh_token_enabled?
|
use_refresh_token: Doorkeeper.configuration.refresh_token_enabled?
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -21,7 +21,7 @@ RSpec.describe Api::V1::AccountsController, type: :controller do
|
||||||
|
|
||||||
describe 'POST #create' do
|
describe 'POST #create' do
|
||||||
let(:app) { Fabricate(:application) }
|
let(:app) { Fabricate(:application) }
|
||||||
let(:token) { Doorkeeper::AccessToken.find_or_create_for(app, nil, 'read write', nil, false) }
|
let(:token) { Doorkeeper::AccessToken.find_or_create_for(application: app, resource_owner: nil, scopes: 'read write', use_refresh_token: false) }
|
||||||
let(:agreement) { nil }
|
let(:agreement) { nil }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
|
|
@ -41,11 +41,11 @@ RSpec.describe Oauth::AuthorizationsController, type: :controller do
|
||||||
context 'when app is already authorized' do
|
context 'when app is already authorized' do
|
||||||
before do
|
before do
|
||||||
Doorkeeper::AccessToken.find_or_create_for(
|
Doorkeeper::AccessToken.find_or_create_for(
|
||||||
app,
|
application: app,
|
||||||
user.id,
|
resource_owner: user.id,
|
||||||
app.scopes,
|
scopes: app.scopes,
|
||||||
Doorkeeper.configuration.access_token_expires_in,
|
expires_in: Doorkeeper.configuration.access_token_expires_in,
|
||||||
Doorkeeper.configuration.refresh_token_enabled?
|
use_refresh_token: Doorkeeper.configuration.refresh_token_enabled?
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -5,11 +5,12 @@ require 'rails_helper'
|
||||||
RSpec.describe Oauth::TokensController, type: :controller do
|
RSpec.describe Oauth::TokensController, type: :controller do
|
||||||
describe 'POST #revoke' do
|
describe 'POST #revoke' do
|
||||||
let!(:user) { Fabricate(:user) }
|
let!(:user) { Fabricate(:user) }
|
||||||
let!(:access_token) { Fabricate(:accessible_access_token, resource_owner_id: user.id) }
|
let!(:application) { Fabricate(:application, confidential: false) }
|
||||||
|
let!(:access_token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, application: application) }
|
||||||
let!(:web_push_subscription) { Fabricate(:web_push_subscription, user: user, access_token: access_token) }
|
let!(:web_push_subscription) { Fabricate(:web_push_subscription, user: user, access_token: access_token) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
post :revoke, params: { token: access_token.token }
|
post :revoke, params: { client_id: application.uid, token: access_token.token }
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'revokes the token' do
|
it 'revokes the token' do
|
||||||
|
|
Loading…
Reference in a new issue