diff --git a/Gemfile b/Gemfile index e10984f536b..680a0738b99 100644 --- a/Gemfile +++ b/Gemfile @@ -89,7 +89,7 @@ gem 'rails-i18n', '~> 7.0' # two-factor authentication gem 'devise-two-factor', '>= 5.0.0' # authorization -gem 'jwt' +gem 'jwt', '~> 2.10', '>= 2.10.3' gem 'pundit' # super admin diff --git a/Gemfile.lock b/Gemfile.lock index 4da0e584759..0479393b0ba 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -301,7 +301,7 @@ GEM railties (>= 5.0.0) faker (3.2.0) i18n (>= 1.8.11, < 2) - faraday (2.14.1) + faraday (2.14.2) faraday-net_http (>= 2.0, < 3.5) json logger @@ -491,7 +491,7 @@ GEM judoscale-sidekiq (1.8.2) judoscale-ruby (= 1.8.2) sidekiq (>= 5.0) - jwt (2.10.1) + jwt (2.10.3) base64 kaminari (1.2.2) activesupport (>= 4.1.0) @@ -1102,7 +1102,7 @@ DEPENDENCIES json_schemer judoscale-rails judoscale-sidekiq - jwt + jwt (~> 2.10, >= 2.10.3) kaminari koala letter_opener diff --git a/spec/controllers/google/callbacks_controller_spec.rb b/spec/controllers/google/callbacks_controller_spec.rb index a898ab3950e..b38fcfb593e 100644 --- a/spec/controllers/google/callbacks_controller_spec.rb +++ b/spec/controllers/google/callbacks_controller_spec.rb @@ -8,12 +8,12 @@ RSpec.describe 'Google::CallbacksController', type: :request do describe 'GET /google/callback' do let(:response_body_success) do - { id_token: JWT.encode({ email: email, name: 'test' }, false), access_token: SecureRandom.hex(10), token_type: 'Bearer', + { id_token: JWT.encode({ email: email, name: 'test' }, nil, 'none'), access_token: SecureRandom.hex(10), token_type: 'Bearer', refresh_token: SecureRandom.hex(10) } end let(:response_body_success_without_name) do - { id_token: JWT.encode({ email: email }, false), access_token: SecureRandom.hex(10), token_type: 'Bearer', + { id_token: JWT.encode({ email: email }, nil, 'none'), access_token: SecureRandom.hex(10), token_type: 'Bearer', refresh_token: SecureRandom.hex(10) } end diff --git a/spec/controllers/microsoft/callbacks_controller_spec.rb b/spec/controllers/microsoft/callbacks_controller_spec.rb index 6bd9a058384..129cfa383d8 100644 --- a/spec/controllers/microsoft/callbacks_controller_spec.rb +++ b/spec/controllers/microsoft/callbacks_controller_spec.rb @@ -8,12 +8,12 @@ RSpec.describe 'Microsoft::CallbacksController', type: :request do describe 'GET /microsoft/callback' do let(:response_body_success) do - { id_token: JWT.encode({ email: email, name: 'test' }, false), access_token: SecureRandom.hex(10), token_type: 'Bearer', + { id_token: JWT.encode({ email: email, name: 'test' }, nil, 'none'), access_token: SecureRandom.hex(10), token_type: 'Bearer', refresh_token: SecureRandom.hex(10) } end let(:response_body_success_without_name) do - { id_token: JWT.encode({ email: email }, false), access_token: SecureRandom.hex(10), token_type: 'Bearer', + { id_token: JWT.encode({ email: email }, nil, 'none'), access_token: SecureRandom.hex(10), token_type: 'Bearer', refresh_token: SecureRandom.hex(10) } end diff --git a/spec/helpers/instagram/integration_helper_spec.rb b/spec/helpers/instagram/integration_helper_spec.rb index 7a8bb30a4ce..25ec46b58ed 100644 --- a/spec/helpers/instagram/integration_helper_spec.rb +++ b/spec/helpers/instagram/integration_helper_spec.rb @@ -82,6 +82,7 @@ RSpec.describe Instagram::IntegrationHelper do context 'when client secret is not configured' do let(:client_secret) { nil } + let(:valid_token) { 'any-token' } it 'returns nil' do expect(verify_instagram_token(valid_token)).to be_nil diff --git a/spec/helpers/linear/integration_helper_spec.rb b/spec/helpers/linear/integration_helper_spec.rb index 4f0f65c312e..958baa4bf56 100644 --- a/spec/helpers/linear/integration_helper_spec.rb +++ b/spec/helpers/linear/integration_helper_spec.rb @@ -65,6 +65,7 @@ RSpec.describe Linear::IntegrationHelper do context 'when client secret is not configured' do let(:client_secret) { nil } + let(:valid_token) { 'any-token' } it 'returns nil' do expect(verify_linear_token(valid_token)).to be_nil diff --git a/spec/helpers/shopify/integration_helper_spec.rb b/spec/helpers/shopify/integration_helper_spec.rb index 15b7120d4cb..bfad66d9ae6 100644 --- a/spec/helpers/shopify/integration_helper_spec.rb +++ b/spec/helpers/shopify/integration_helper_spec.rb @@ -65,6 +65,7 @@ RSpec.describe Shopify::IntegrationHelper do context 'when client secret is not configured' do let(:client_secret) { nil } + let(:valid_token) { 'any-token' } it 'returns nil' do expect(verify_shopify_token(valid_token)).to be_nil