OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
[#53368] add authentication for storage interaction
Eric Schubert9aaf8ca3a3c8
diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/authentication.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/authentication.rbnew file mode 100644index 00000000000..908ea6a6eec--- /dev/null+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/authentication.rb@@ -0,0 +1,69 @@+# frozen_string_literal:true++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2012-2024 the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+#++++module Storages+ module Peripherals+ module StorageInteraction+ class Authentication+ using ::Storages::Peripherals::ServiceResultRefinements++ def self.[](strategy)+ case strategy.key+ when :basic_auth+ AuthenticationStrategies::BasicAuth.new+ when :oauth_user_token+ AuthenticationStrategies::OAuthUserToken.new(strategy.user)+ when :oauth_client_credentials+ AuthenticationStrategies::OAuthClientCredentials.new+ else+ raise "Invalid authentication strategy '#{strategy}'"+ end+ end++ # Checks for the current authorization state of a user on a specific file storage.+ # Returns one of three results:+ # - :connected If a valid user token is available+ # - :failed_authorization If a user token is available, which is invalid and not refreshable+ # - :error If an unexpected error occurred+ def self.authorization_state(storage:, user:)+ auth_strategy = AuthenticationStrategies::OAuthUserToken.strategy.with_user(user)++ ::Storages::Peripherals::Registry+ .resolve("#{storage.short_provider_type}.queries.auth_check")+ .call(storage:, auth_strategy:)+ .match(+ on_success: ->(result) { result },+ on_failure: ->(error) { error.code == :unauthorized ? :failed_authorization : :error }+ )+ end+ end+ end+ end+enddiff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/authentication_strategies/basic_auth.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/authentication_strategies/basic_auth.rbnew file mode 100644index 00000000000..8093a3c0a02--- /dev/null+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/authentication_strategies/basic_auth.rb@@ -0,0 +1,56 @@+# frozen_string_literal:true++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2012-2024 the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+#++++module Storages+ module Peripherals+ module StorageInteraction+ module AuthenticationStrategies+ class BasicAuth+ def self.strategy+ Strategy.new(:basic_auth)+ end++ def call(storage:, http_options: {})+ username = storage.username+ password = storage.password++ if username.blank? || password.blank?+ log_message = 'Cannot authenticate storage with basic auth. Password or username not configured.'+ data = ::Storages::StorageErrorData.new(source: self, payload: storage)+ return Error.create(code: :error, log_message:, data:)+ end++ yield OpenProject.httpx.basic_auth(username, password).with(http_options)+ end+ end+ end+ end+ end+enddiff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/authentication_strategies/error.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/authentication_strategies/error.rbnew file mode 100644index 00000000000..e7781834155--- /dev/null+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/authentication_strategies/error.rb@@ -0,0 +1,44 @@+# frozen_string_literal:true++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2012-2024 the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+#++++module Storages+ module Peripherals+ module StorageInteraction+ module AuthenticationStrategies+ class Error+ def self.create(code:, log_message:, data:)+ storage_error = ::Storages::StorageError.new(code:, log_message:, data:)+ ServiceResult.failure(result: code, errors: storage_error)+ end+ end+ end+ end+ end+enddiff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/authentication_strategies/o_auth_client_credentials.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/authentication_strategies/o_auth_client_credentials.rbnew file mode 100644index 00000000000..900d9d5ff06--- /dev/null+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/authentication_strategies/o_auth_client_credentials.rb@@ -0,0 +1,81 @@+# frozen_string_literal:true++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2012-2024 the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+#++++module Storages+ module Peripherals+ module StorageInteraction+ module AuthenticationStrategies+ class OAuthClientCredentials+ def self.strategy+ Strategy.new(:oauth_client_credentials)+ end++ def call(storage:, http_options: {})+ config = storage.oauth_configuration.to_httpx_oauth_config++ if config.complete?+ create_http_and_yield(issuer: config.issuer,+ client_id: config.client_id,+ client_secret: config.client_secret,+ scope: config.scope,+ http_options:)+ else+ log_message = 'Cannot authenticate storage with client credential oauth flow. Storage not configured.'+ data = ::Storages::StorageErrorData.new(source: self, payload: storage)+ Error.create(code: :error, log_message:, data:)+ end+ end++ private++ def create_http_and_yield(issuer:, client_id:, client_secret:, scope:, http_options:)+ begin+ http = OpenProject.httpx+ .oauth_auth(issuer:,+ client_id:,+ client_secret:,+ scope:,+ token_endpoint_auth_method: 'client_secret_post')+ .with_access_token+ .with(http_options)+ rescue HTTPX::HTTPError => e+ data = ::Storages::StorageErrorData.new(source: self, payload: e.response.json)+ return Error.create(code: :unauthorized,+ log_message: 'Error while fetching OAuth access token.',+ data:)+ end++ yield http+ end+ end+ end+ end+ end+enddiff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/authentication_strategies/o_auth_configuration.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/authentication_strategies/o_auth_configuration.rbnew file mode 100644index 00000000000..0d11b3a331c--- /dev/null+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/authentication_strategies/o_auth_configuration.rb@@ -0,0 +1,55 @@+# frozen_string_literal:true++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2012-2024 the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+#++++module Storages+ module Peripherals+ module StorageInteraction+ module AuthenticationStrategies+ class OAuthConfiguration+ attr_reader :scope, :issuer, :client_secret, :client_id++ def initialize(client_id: nil,+ client_secret: nil,+ issuer: nil,+ scope: nil)+ @client_id = client_id+ @client_secret = client_secret+ @issuer = issuer+ @scope = scope+ end++ def complete?+ [@client_id, @client_secret, @issuer].all?(&:present?)+ end+ end+ end+ end+ end+enddiff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/authentication_strategies/o_auth_user_token.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/authentication_strategies/o_auth_user_token.rbnew file mode 100644index 00000000000..3c567193f0b--- /dev/null+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/authentication_strategies/o_auth_user_token.rb@@ -0,0 +1,117 @@+# frozen_string_literal:true++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2012-2024 the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+#++++module Storages+ module Peripherals+ module StorageInteraction+ module AuthenticationStrategies+ class OAuthUserToken+ def self.strategy+ Strategy.new(:oauth_user_token)+ end++ def initialize(user)+ super()+ @user = user+ end++ # rubocop:disable Metrics/AbcSize+ def call(storage:, http_options: {}, &)+ config = storage.oauth_configuration+ current_token = OAuthClientToken.find_by(user_id: @user, oauth_client_id: config.oauth_client.id)+ if current_token.nil?+ data = ::Storages::StorageErrorData.new(source: self)+ return Error.create(code: :unauthorized,+ log_message: 'Authorization failed. No user access token found.',+ data:)+ end++ opts = http_options.merge({ headers: { 'Authorization' => "Bearer #{current_token.access_token}" } })+ response_with_current_token = yield OpenProject.httpx.with(opts)++ if response_with_current_token.success? || response_with_current_token.result != :unauthorized+ response_with_current_token+ else+ refresh_and_retry(config.to_httpx_oauth_config, http_options, current_token, &)+ end+ end++ # rubocop:enable Metrics/AbcSize++ private++ # rubocop:disable Metrics/AbcSize+ def refresh_and_retry(config, http_options, token, &)+ begin+ http_session = OpenProject.httpx+ .oauth_auth(issuer: config.issuer,+ client_id: config.client_id,+ client_secret: config.client_secret,+ scope: config.scope,+ refresh_token: token.refresh_token,+ token_endpoint_auth_method: 'client_secret_post')+ .with_access_token+ .with(http_options)+ rescue HTTPX::HTTPError => e+ data = ::Storages::StorageErrorData.new(source: self, payload: e.response.json)+ return Error.create(code: :unauthorized,+ log_message: 'Error while refreshing OAuth token.',+ data:)+ end++ response = yield http_session++ if response.success?+ success = update_refreshed_token(token, http_session)+ unless success+ data = ::Storages::StorageErrorData.new(source: self)+ return Error.create(code: :error,+ log_message: 'Error while persisting updated access token.',+ data:)+ end+ end++ response+ end++ # rubocop:enable Metrics/AbcSize++ def update_refreshed_token(token, http_session)+ oauth = http_session.instance_variable_get(:@options).oauth_session+ access_token = oauth.access_token+ refresh_token = oauth.refresh_token++ token.update(access_token:, refresh_token:)+ end+ end+ end+ end+ end+enddiff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/authentication_strategies/strategy.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/authentication_strategies/strategy.rbnew file mode 100644index 00000000000..a95b0d2eef8--- /dev/null+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/authentication_strategies/strategy.rb@@ -0,0 +1,50 @@+# frozen_string_literal: true++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2012-2024 the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+#++++module Storages+ module Peripherals+ module StorageInteraction+ module AuthenticationStrategies+ class Strategy+ attr_reader :key, :user++ def initialize(key)+ @key = key+ end++ def with_user(user)+ @user = user+ self+ end+ end+ end+ end+ end+enddiff --git a/modules/storages/spec/common/storages/peripherals/storage_interaction/authentication_spec.rb b/modules/storages/spec/common/storages/peripherals/storage_interaction/authentication_spec.rbnew file mode 100644index 00000000000..34d6eed2125--- /dev/null+++ b/modules/storages/spec/common/storages/peripherals/storage_interaction/authentication_spec.rb@@ -0,0 +1,226 @@+# frozen_string_literal: true++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2012-2024 the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+#++++require 'spec_helper'+require_module_spec_helper++RSpec.describe Storages::Peripherals::StorageInteraction::Authentication, :webmock do+ using Storages::Peripherals::ServiceResultRefinements++ let(:user) { create(:user) }++ context 'with a Nextcloud storage' do+ let(:storage) do+ create(:nextcloud_storage_with_local_connection, :as_not_automatically_managed, oauth_client_token_user: user)+ end+ let(:folder) { Storages::Peripherals::ParentFolder.new('/') }++ subject do+ Storages::Peripherals::StorageInteraction::Nextcloud::FilesQuery.new(storage)+ end++ context 'with basic auth strategy' do+ let(:auth_strategy) { Storages::Peripherals::StorageInteraction::AuthenticationStrategies::BasicAuth.strategy }++ subject do+ Storages::Peripherals::StorageInteraction::Nextcloud::GroupUsersQuery.new(storage)+ end++ context 'with empty username and password' do+ it 'must return error' do+ result = subject.call(auth_strategy:, group: storage.group)+ expect(result).to be_failure+ expect(result.error_source)+ .to be_a(Storages::Peripherals::StorageInteraction::AuthenticationStrategies::BasicAuth)++ result.match(+ on_failure: ->(error) { expect(error.code).to eq(:error) },+ on_success: ->(file_infos) { fail "Expected failure, got #{file_infos}" }+ )+ end+ end++ context 'with invalid username and password', vcr: 'auth/nextcloud/storage_query_basic_auth_password_invalid' do+ before do+ storage.password = 'IAmInvalid'+ end++ it 'must return unauthorized' do+ result = subject.call(auth_strategy:, group: storage.group)+ expect(result).to be_failure+ expect(result.error_source)+ .to be_a(Storages::Peripherals::StorageInteraction::Nextcloud::GroupUsersQuery)++ result.match(+ on_failure: ->(error) { expect(error.code).to eq(:unauthorized) },+ on_success: ->(file_infos) { fail "Expected failure, got #{file_infos}" }+ )+ end+ end+ end++ context 'with user token strategy' do+ let(:auth_strategy) do+ Storages::Peripherals::StorageInteraction::AuthenticationStrategies::OAuthUserToken.strategy.with_user(user)+ end++ context 'with not existent oauth token' do+ let(:user_without_token) { create(:user) }+ let(:auth_strategy) do+ Storages::Peripherals::StorageInteraction::AuthenticationStrategies::OAuthUserToken+ .strategy+ .with_user(user_without_token)+ end++ it 'must return unauthorized' do+ result = subject.call(auth_strategy:, folder:)+ expect(result).to be_failure+ expect(result.error_source)+ .to be_a(Storages::Peripherals::StorageInteraction::AuthenticationStrategies::OAuthUserToken)++ result.match(+ on_failure: ->(error) { expect(error.code).to eq(:unauthorized) },+ on_success: ->(file_infos) { fail "Expected failure, got #{file_infos}" }+ )+ end+ end++ context 'with invalid oauth refresh token', vcr: 'auth/nextcloud/storage_query_user_token_refresh_token_invalid' do+ it 'must return unauthorized' do+ result = subject.call(auth_strategy:, folder:)+ expect(result).to be_failure+ expect(result.error_source)+ .to be_a(Storages::Peripherals::StorageInteraction::AuthenticationStrategies::OAuthUserToken)++ result.match(+ on_failure: ->(error) { expect(error.code).to eq(:unauthorized) },+ on_success: ->(file_infos) { fail "Expected failure, got #{file_infos}" }+ )+ end+ end++ context 'with invalid oauth access token', vcr: 'auth/nextcloud/storage_query_user_token_access_token_invalid' do+ it 'must refresh token and return success' do+ result = subject.call(auth_strategy:, folder:)+ expect(result).to be_success++ result.match(+ on_failure: ->(error) { fail "Expected success, got #{error}" },+ on_success: ->(file_infos) { expect(file_infos).to be_a(Storages::StorageFiles) }+ )+ end+ end+ end+ end++ context 'with a OneDrive/SharePoint storage' do+ let(:storage) { create(:sharepoint_dev_drive_storage, oauth_client_token_user: user) }+ let(:folder) { Storages::Peripherals::ParentFolder.new('/') }++ subject do+ Storages::Peripherals::StorageInteraction::OneDrive::FilesQuery.new(storage)+ end++ context 'with client credentials strategy' do+ let(:auth_strategy) do+ Storages::Peripherals::StorageInteraction::AuthenticationStrategies::OAuthClientCredentials.strategy+ end++ context 'with invalid oauth credentials', vcr: 'auth/one_drive/storage_query_client_credentials_invalid' do+ it 'must return unauthorized' do+ result = subject.call(auth_strategy:, folder:)+ expect(result).to be_failure+ expect(result.error_source)+ .to be_a(Storages::Peripherals::StorageInteraction::AuthenticationStrategies::OAuthClientCredentials)++ result.match(+ on_failure: ->(error) { expect(error.code).to eq(:unauthorized) },+ on_success: ->(file_infos) { fail "Expected failure, got #{file_infos}" }+ )+ end+ end+ end++ context 'with user token strategy' do+ let(:auth_strategy) do+ Storages::Peripherals::StorageInteraction::AuthenticationStrategies::OAuthUserToken.strategy.with_user(user)+ end++ context 'with not existent oauth token' do+ let(:user_without_token) { create(:user) }+ let(:auth_strategy) do+ Storages::Peripherals::StorageInteraction::AuthenticationStrategies::OAuthUserToken+ .strategy+ .with_user(user_without_token)+ end++ it 'must return unauthorized' do+ result = subject.call(auth_strategy:, folder:)+ expect(result).to be_failure+ expect(result.error_source)+ .to be_a(Storages::Peripherals::StorageInteraction::AuthenticationStrategies::OAuthUserToken)++ result.match(+ on_failure: ->(error) { expect(error.code).to eq(:unauthorized) },+ on_success: ->(file_infos) { fail "Expected failure, got #{file_infos}" }+ )+ end+ end++ context 'with invalid oauth refresh token', vcr: 'auth/one_drive/storage_query_user_token_refresh_token_invalid' do+ it 'must return unauthorized' do+ result = subject.call(auth_strategy:, folder:)+ expect(result).to be_failure+ expect(result.error_source)+ .to be_a(Storages::Peripherals::StorageInteraction::AuthenticationStrategies::OAuthUserToken)++ result.match(+ on_failure: ->(error) { expect(error.code).to eq(:unauthorized) },+ on_success: ->(file_infos) { fail "Expected failure, got #{file_infos}" }+ )+ end+ end++ context 'with invalid oauth access token', vcr: 'auth/one_drive/storage_query_user_token_access_token_invalid' do+ it 'must return unauthorized' do+ result = subject.call(auth_strategy:, folder:)+ expect(result).to be_failure+ expect(result.error_source)+ .to be_a(Storages::Peripherals::StorageInteraction::AuthenticationStrategies::OAuthUserToken)++ result.match(+ on_failure: ->(error) { expect(error.code).to eq(:unauthorized) },+ on_success: ->(file_infos) { fail "Expected failure, got #{file_infos}" }+ )+ end+ end+ end+ end+enddiff --git a/modules/storages/spec/common/storages/peripherals/storage_interaction/network_error_spec.rb b/modules/storages/spec/common/storages/peripherals/storage_interaction/network_error_spec.rbnew file mode 100644index 00000000000..9767b57f222--- /dev/null+++ b/modules/storages/spec/common/storages/peripherals/storage_interaction/network_error_spec.rb@@ -0,0 +1,65 @@+# frozen_string_literal: true++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2012-2024 the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+#++++require 'spec_helper'+require_module_spec_helper++# rubocop:disable RSpec/DescribeClass+RSpec.describe 'network errors for storage interaction' do+ using Storages::Peripherals::ServiceResultRefinements++ let(:user) { create(:user) }+ let(:storage) { create(:sharepoint_dev_drive_storage, oauth_client_token_user: user) }+ let(:folder) { Storages::Peripherals::ParentFolder.new('/') }+ let(:auth_strategy) do+ Storages::Peripherals::StorageInteraction::AuthenticationStrategies::OAuthUserToken.strategy.with_user(user)+ end++ subject do+ Storages::Peripherals::StorageInteraction::OneDrive::FilesQuery.new(storage)+ end++ context 'if a timeout happens' do+ before do+ request = HTTPX::Request.new(:get, 'https://my.timeout.org/')+ httpx_double = class_double(HTTPX, get: HTTPX::ErrorResponse.new(request, 'Timeout happens', {}))+ allow(httpx_double).to receive(:with).and_return(httpx_double)+ allow(OpenProject).to receive(:httpx).and_return(httpx_double)+ end++ it 'must return an error with wrapped network error response' do+ error = subject.call(auth_strategy:, folder:)+ expect(error).to be_failure+ expect(error.result).to eq(:error)+ expect(error.error_payload).to be_a(HTTPX::ErrorResponse)+ end+ end+end+# rubocop:enable RSpec/DescribeClassdiff --git a/modules/storages/spec/support/fixtures/vcr_cassettes/auth/nextcloud/storage_query_basic_auth_password_invalid.yml b/modules/storages/spec/support/fixtures/vcr_cassettes/auth/nextcloud/storage_query_basic_auth_password_invalid.ymlnew file mode 100644index 00000000000..27fd58dda63--- /dev/null+++ b/modules/storages/spec/support/fixtures/vcr_cassettes/auth/nextcloud/storage_query_basic_auth_password_invalid.yml@@ -0,0 +1,84 @@+---+http_interactions:+- request:+ method: get+ uri: https://nextcloud.local/ocs/v1.php/cloud/groups/OpenProject+ body:+ encoding: US-ASCII+ string: ''+ headers:+ Authorization:+ - Basic <BASIC_AUTH>+ Ocs-Apirequest:+ - 'true'+ User-Agent:+ - httpx.rb/1.2.2+ Accept:+ - "*/*"+ Accept-Encoding:+ - gzip, deflate+ response:+ status:+ code: 401+ message: Unauthorized+ headers:+ Cache-Control:+ - no-store, no-cache, must-revalidate+ Content-Security-Policy:+ - 'default-src ''self''; script-src ''self'' ''nonce-MlBWVkx0OTRucDI2ZzNNNjcyY0QwcUszaGNBR0NKeVpSdzlNdmd3NzFNOD06aXFBY2FQQUI5UExaeVNsYnZWWmdtWkQ2NUpkTlE5TERBMm9oMzJSV3BMVT0='';+ style-src ''self'' ''unsafe-inline''; frame-src *; img-src * data: blob:;+ font-src ''self'' data:; media-src *; connect-src *; object-src ''none'';+ base-uri ''self'';'+ Content-Type:+ - text/xml; charset=UTF-8+ Date:+ - Fri, 01 Mar 2024 11:51:53 GMT+ Expires:+ - Thu, 19 Nov 1981 08:52:00 GMT+ Pragma:+ - no-cache+ Referrer-Policy:+ - no-referrer+ Server:+ - Apache/2.4.57 (Debian)+ Set-Cookie:+ - ocirabgzify6=1243e73f02538153799a5103dc5ccbc8; path=/; secure; HttpOnly; SameSite=Lax,+ oc_sessionPassphrase=rGY6Ym5TcXWshiC1sm1E4HEQI21he%2FXIcfSnbF%2FSlKS8xqT%2FtjUCAgJq15gzLi7BCo0ueyxTYXMV2RRvWxXlFovOPT85MH%2Bntot5zsdESeHYYrkc9fLqrMvcpdXqvfjm;+ path=/; secure; HttpOnly; SameSite=Lax, ocirabgzify6=1243e73f02538153799a5103dc5ccbc8;+ path=/; secure; HttpOnly; SameSite=Lax, __Host-nc_sameSiteCookielax=true;+ path=/; httponly;secure; expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=lax,+ __Host-nc_sameSiteCookiestrict=true; path=/; httponly;secure; expires=Fri,+ 31-Dec-2100 23:59:59 GMT; SameSite=strict, ocirabgzify6=1243e73f02538153799a5103dc5ccbc8;+ path=/; secure; HttpOnly; SameSite=Lax, ocirabgzify6=1243e73f02538153799a5103dc5ccbc8;+ path=/; secure; HttpOnly; SameSite=Lax, ocirabgzify6=f17b35b274189a0a408d176d9fa1ad3e;+ path=/; secure; HttpOnly; SameSite=Lax+ Www-Authenticate:+ - Basic realm="Authorisation Required"+ X-Content-Type-Options:+ - nosniff+ X-Frame-Options:+ - SAMEORIGIN+ X-Permitted-Cross-Domain-Policies:+ - none+ X-Powered-By:+ - PHP/8.2.16+ X-Robots-Tag:+ - noindex, nofollow+ X-Xss-Protection:+ - 1; mode=block+ Content-Length:+ - '153'+ body:+ encoding: UTF-8+ string: |+ <?xml version="1.0"?>+ <ocs>+ <meta>+ <status>failure</status>+ <statuscode>997</statuscode>+ <message>Unauthorised</message>+ </meta>+ <data/>+ </ocs>+ recorded_at: Fri, 01 Mar 2024 11:51:53 GMT+recorded_with: VCR 6.2.0diff --git a/modules/storages/spec/support/fixtures/vcr_cassettes/auth/nextcloud/storage_query_user_token_access_token_invalid.yml b/modules/storages/spec/support/fixtures/vcr_cassettes/auth/nextcloud/storage_query_user_token_access_token_invalid.ymlnew file mode 100644index 00000000000..3969acfe4e0--- /dev/null+++ b/modules/storages/spec/support/fixtures/vcr_cassettes/auth/nextcloud/storage_query_user_token_access_token_invalid.yml@@ -0,0 +1,261 @@+---+http_interactions:+- request:+ method: propfind+ uri: https://nextcloud.local/remote.php/dav/files/admin/+ body:+ encoding: UTF-8+ string: |+ <?xml version="1.0"?>+ <d:propfind xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns">+ <d:prop>+ <oc:fileid/>+ <oc:size/>+ <d:getcontenttype/>+ <d:getlastmodified/>+ <oc:permissions/>+ <oc:owner-display-name/>+ </d:prop>+ </d:propfind>+ headers:+ Authorization:+ - Bearer <BEARER TOKEN>+ User-Agent:+ - httpx.rb/1.2.2+ Accept:+ - "*/*"+ Accept-Encoding:+ - gzip, deflate+ Content-Type:+ - application/xml; charset=utf-8+ Content-Length:+ - '253'+ response:+ status:+ code: 401+ message: Unauthorized+ headers:+ Cache-Control:+ - no-store, no-cache, must-revalidate+ Content-Security-Policy:+ - default-src 'none';+ Content-Type:+ - application/xml; charset=utf-8+ Date:+ - Fri, 01 Mar 2024 11:39:54 GMT+ Expires:+ - Thu, 19 Nov 1981 08:52:00 GMT+ Pragma:+ - no-cache+ Referrer-Policy:+ - no-referrer+ Server:+ - Apache/2.4.57 (Debian)+ Set-Cookie:+ - ocirabgzify6=0c26a8a2642946f639fd6453c7de04ea; path=/; secure; HttpOnly; SameSite=Lax,+ oc_sessionPassphrase=PHTV0jbG1sdbqHpXYR%2Fr%2FyjuWh2jnFdEORpc3sXXOEkBfLO18HzxgHBYfxxGH0tJObXa3twDQotJnxLSnMyFXSa%2B9RKwNvB%2FRC23jGGnIYGHcAx8fpSzX7PkBWB9OlMg;+ path=/; secure; HttpOnly; SameSite=Lax, ocirabgzify6=0c26a8a2642946f639fd6453c7de04ea;+ path=/; secure; HttpOnly; SameSite=Lax, __Host-nc_sameSiteCookielax=true;+ path=/; httponly;secure; expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=lax,+ __Host-nc_sameSiteCookiestrict=true; path=/; httponly;secure; expires=Fri,+ 31-Dec-2100 23:59:59 GMT; SameSite=strict, ocirabgzify6=0c26a8a2642946f639fd6453c7de04ea;+ path=/; secure; HttpOnly; SameSite=Lax+ Www-Authenticate:+ - Basic realm="Nextcloud", charset="UTF-8"+ X-Content-Type-Options:+ - nosniff+ X-Frame-Options:+ - SAMEORIGIN+ X-Permitted-Cross-Domain-Policies:+ - none+ X-Powered-By:+ - PHP/8.2.16+ X-Robots-Tag:+ - noindex, nofollow+ X-Xss-Protection:+ - 1; mode=block+ Content-Length:+ - '476'+ body:+ encoding: UTF-8+ string: |+ <?xml version="1.0" encoding="utf-8"?>+ <d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">+ <s:exception>Sabre\DAV\Exception\NotAuthenticated</s:exception>+ <s:message>No public access to this resource., No 'Authorization: Basic' header found. Either the client didn't send one, or the server is misconfigured, Bearer token was incorrect, No 'Authorization: Basic' header found. Either the client didn't send one, or the server is misconfigured</s:message>+ </d:error>+ recorded_at: Fri, 01 Mar 2024 11:39:54 GMT+- request:+ method: post+ uri: https://nextcloud.local/index.php/apps/oauth2/api/v1/token+ body:+ encoding: ASCII-8BIT+ string: grant_type=refresh_token&scope=&client_id=7fj7lpG0GOqwOGhHAyfGwd1oEgtbTto7mctu0IaSN3SE79o9Xs0q8k3kDiEwXDrM&client_secret=j7RoyauWeIpMc7cYdY3lewCGKxdgiAowonpGzmAuj9iRSvYBAGXhP7hvz9Hp7skR&refresh_token=ZlV7mLctFD0v4OeCBn06zlEmw73fAAFstNQMoXc6saygAQofq7UIRtNlMil135zIOJiQhOnb2p6IvxVQHcmrKUi5aAUuQT4jAyaASjRJ2C4IkCWtXgSMhnIYU6UY7FQV+ headers:+ User-Agent:+ - httpx.rb/1.2.2+ Accept:+ - "*/*"+ Accept-Encoding:+ - gzip, deflate+ Content-Type:+ - application/x-www-form-urlencoded+ Content-Length:+ - '328'+ response:+ status:+ code: 200+ message: OK+ headers:+ Cache-Control:+ - no-cache, no-store, must-revalidate+ Content-Encoding:+ - gzip+ Content-Security-Policy:+ - default-src 'none';base-uri 'none';manifest-src 'self';frame-ancestors 'none'+ Content-Type:+ - application/json; charset=utf-8+ Date:+ - Fri, 01 Mar 2024 11:39:54 GMT+ Expires:+ - Thu, 19 Nov 1981 08:52:00 GMT+ Feature-Policy:+ - autoplay 'none';camera 'none';fullscreen 'none';geolocation 'none';microphone+ 'none';payment 'none'+ Pragma:+ - no-cache+ Referrer-Policy:+ - no-referrer+ Server:+ - Apache/2.4.57 (Debian)+ Set-Cookie:+ - ocirabgzify6=449aa06d53a6740137cd9168e055008a; path=/; secure; HttpOnly; SameSite=Lax,+ oc_sessionPassphrase=pRvOu2EI27JoozdRZR5PQRb0i9eWVvzTt4CBlDqjEHJOT5qPWs4%2BbMn0Y6CsSQ3hhUxfD8sdgzH4KHz5Bgx9Rt54T8OpxBQNyxfPCR2X0WrrFeOPqwLkMmHiOxwaB5hy;+ path=/; secure; HttpOnly; SameSite=Lax, ocirabgzify6=449aa06d53a6740137cd9168e055008a;+ path=/; secure; HttpOnly; SameSite=Lax, __Host-nc_sameSiteCookielax=true;+ path=/; httponly;secure; expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=lax,+ __Host-nc_sameSiteCookiestrict=true; path=/; httponly;secure; expires=Fri,+ 31-Dec-2100 23:59:59 GMT; SameSite=strict, ocirabgzify6=449aa06d53a6740137cd9168e055008a;+ path=/; secure; HttpOnly; SameSite=Lax+ X-Content-Type-Options:+ - nosniff+ X-Frame-Options:+ - SAMEORIGIN+ X-Nextcloud-Bruteforce-Throttled:+ - 200ms+ X-Permitted-Cross-Domain-Policies:+ - none+ X-Powered-By:+ - PHP/8.2.16+ X-Request-Id:+ - Gujm8lul9Vyrsn0Gl9S1+ X-Robots-Tag:+ - noindex, nofollow+ X-Xss-Protection:+ - 1; mode=block+ Content-Length:+ - '270'+ body:+ encoding: UTF-8+ string: '{"access_token":"<ACCESS_TOKEN>","token_type":"Bearer","expires_in":3600,"refresh_token":"JN6au2g29hG5JCHQ2l6vY4XWXiC6x9flSS1jvElxLrIX43uPo2vmXvts2MV61DGZeErBOaylvk49qUgRCNGhco8BLfaC66c5SAeI8CBtvBYNruS2VyKwryGdAeLaknBb","user_id":"admin"}'+ recorded_at: Fri, 01 Mar 2024 11:39:55 GMT+- request:+ method: propfind+ uri: https://nextcloud.local/remote.php/dav/files/admin/+ body:+ encoding: UTF-8+ string: |+ <?xml version="1.0"?>+ <d:propfind xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns">+ <d:prop>+ <oc:fileid/>+ <oc:size/>+ <d:getcontenttype/>+ <d:getlastmodified/>+ <oc:permissions/>+ <oc:owner-display-name/>+ </d:prop>+ </d:propfind>+ headers:+ Depth:+ - '1'+ User-Agent:+ - httpx.rb/1.2.2+ Accept:+ - "*/*"+ Accept-Encoding:+ - gzip, deflate+ Content-Type:+ - application/xml; charset=utf-8+ Content-Length:+ - '253'+ Authorization:+ - Bearer <BEARER TOKEN>+ response:+ status:+ code: 207+ message: Multi-Status+ headers:+ Cache-Control:+ - no-store, no-cache, must-revalidate+ Content-Encoding:+ - gzip+ Content-Security-Policy:+ - default-src 'none';+ Content-Type:+ - application/xml; charset=utf-8+ Date:+ - Fri, 01 Mar 2024 11:39:55 GMT+ Dav:+ - 1, 3, extended-mkcol, access-control, calendarserver-principal-property-search,+ nextcloud-checksum-update, nc-calendar-search, nc-enable-birthday-calendar+ Expires:+ - Thu, 19 Nov 1981 08:52:00 GMT+ Pragma:+ - no-cache+ Referrer-Policy:+ - no-referrer+ Server:+ - Apache/2.4.57 (Debian)+ Set-Cookie:+ - ocirabgzify6=15d744fa45a317048358f011499b04ab; path=/; secure; HttpOnly; SameSite=Lax,+ oc_sessionPassphrase=KaiakX9dozfF%2B3dxgfPXY2pVDcJ5N%2FQcZmt7qaBAzAmBiUtgnujEQykS%2Be54zvCrxqt7ALGJAs%2F%2FBFqxduKUxj9n7kSTTXb5oZAWEkqbVnoIFgfjIVTFDV5U9U8SmObE;+ path=/; secure; HttpOnly; SameSite=Lax, ocirabgzify6=15d744fa45a317048358f011499b04ab;+ path=/; secure; HttpOnly; SameSite=Lax, __Host-nc_sameSiteCookielax=true;+ path=/; httponly;secure; expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=lax,+ __Host-nc_sameSiteCookiestrict=true; path=/; httponly;secure; expires=Fri,+ 31-Dec-2100 23:59:59 GMT; SameSite=strict, ocirabgzify6=15d744fa45a317048358f011499b04ab;+ path=/; secure; HttpOnly; SameSite=Lax, ocirabgzify6=15d744fa45a317048358f011499b04ab;+ path=/; secure; HttpOnly; SameSite=Lax, ocirabgzify6=15d744fa45a317048358f011499b04ab;+ path=/; secure; HttpOnly; SameSite=Lax, ocirabgzify6=15d744fa45a317048358f011499b04ab;+ path=/; secure; HttpOnly; SameSite=Lax, ocirabgzify6=15d744fa45a317048358f011499b04ab;+ path=/; secure; HttpOnly; SameSite=Lax, ocirabgzify6=15d744fa45a317048358f011499b04ab;+ path=/; secure; HttpOnly; SameSite=Lax, ocirabgzify6=15d744fa45a317048358f011499b04ab;+ path=/; secure; HttpOnly; SameSite=Lax+ Vary:+ - Brief,Prefer+ X-Content-Type-Options:+ - nosniff+ X-Debug-Token:+ - OIm5cgowur7aVMwi44Jz+ X-Frame-Options:+ - SAMEORIGIN+ X-Permitted-Cross-Domain-Policies:+ - none+ X-Powered-By:+ - PHP/8.2.16+ X-Request-Id:+ - OIm5cgowur7aVMwi44Jz+ X-Robots-Tag:+ - noindex, nofollow+ X-Xss-Protection:+ - 1; mode=block+ Content-Length:+ - '544'+ body:+ encoding: UTF-8+ string: |+ <?xml version="1.0"?>+ <d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns"><d:response><d:href>/remote.php/dav/files/admin/</d:href><d:propstat><d:prop><oc:fileid>2</oc:fileid><oc:size>1137306515</oc:size><d:getlastmodified>Wed, 29 Nov 2023 15:42:21 GMT</d:getlastmodified><oc:permissions>RGDNVCK</oc:permissions><oc:owner-display-name>admin</oc:owner-display-name></d:prop><d:status>HTTP/1.1 200 OK</d:status></d:propstat><d:propstat><d:prop><d:getcontenttype/></d:prop><d:status>HTTP/1.1 404 Not Found</d:status></d:propstat></d:response><d:response><d:href>/remote.php/dav/files/admin/Folder/</d:href><d:propstat><d:prop><oc:fileid>172</oc:fileid><oc:size>982713473</oc:size><d:getlastmodified>Wed, 29 Nov 2023 15:31:30 GMT</d:getlastmodified><oc:permissions>RGDNVCK</oc:permissions><oc:owner-display-name>admin</oc:owner-display-name></d:prop><d:status>HTTP/1.1 200 OK</d:status></d:propstat><d:propstat><d:prop><d:getcontenttype/></d:prop><d:status>HTTP/1.1 404 Not Found</d:status></d:propstat></d:response><d:response><d:href>/remote.php/dav/files/admin/Folder%20with%20spaces/</d:href><d:propstat><d:prop><oc:fileid>173</oc:fileid><oc:size>74</oc:size><d:getlastmodified>Wed, 29 Nov 2023 15:42:21 GMT</d:getlastmodified><oc:permissions>RGDNVCK</oc:permissions><oc:owner-display-name>admin</oc:owner-display-name></d:prop><d:status>HTTP/1.1 200 OK</d:status></d:propstat><d:propstat><d:prop><d:getcontenttype/></d:prop><d:status>HTTP/1.1 404 Not Found</d:status></d:propstat></d:response><d:response><d:href>/remote.php/dav/files/admin/Practical_guide_to_BAGGM_Digital.pdf</d:href><d:propstat><d:prop><oc:fileid>211</oc:fileid><oc:size>154592937</oc:size><d:getcontenttype>application/pdf</d:getcontenttype><d:getlastmodified>Tue, 09 Aug 2022 06:53:12 GMT</d:getlastmodified><oc:permissions>RGDNVW</oc:permissions><oc:owner-display-name>admin</oc:owner-display-name></d:prop><d:status>HTTP/1.1 200 OK</d:status></d:propstat></d:response><d:response><d:href>/remote.php/dav/files/admin/Readme.md</d:href><d:propstat><d:prop><oc:fileid>178</oc:fileid><oc:size>31</oc:size><d:getcontenttype>text/markdown</d:getcontenttype><d:getlastmodified>Wed, 29 Nov 2023 15:29:16 GMT</d:getlastmodified><oc:permissions>RGDNVW</oc:permissions><oc:owner-display-name>admin</oc:owner-display-name></d:prop><d:status>HTTP/1.1 200 OK</d:status></d:propstat></d:response></d:multistatus>+ recorded_at: Fri, 01 Mar 2024 11:39:55 GMT+recorded_with: VCR 6.2.0diff --git a/modules/storages/spec/support/fixtures/vcr_cassettes/auth/nextcloud/storage_query_user_token_refresh_token_invalid.yml b/modules/storages/spec/support/fixtures/vcr_cassettes/auth/nextcloud/storage_query_user_token_refresh_token_invalid.ymlnew file mode 100644index 00000000000..d7d693dde2e--- /dev/null+++ b/modules/storages/spec/support/fixtures/vcr_cassettes/auth/nextcloud/storage_query_user_token_refresh_token_invalid.yml@@ -0,0 +1,160 @@+---+http_interactions:+- request:+ method: propfind+ uri: https://nextcloud.local/remote.php/dav/files/admin/+ body:+ encoding: UTF-8+ string: |+ <?xml version="1.0"?>+ <d:propfind xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns">+ <d:prop>+ <oc:fileid/>+ <oc:size/>+ <d:getcontenttype/>+ <d:getlastmodified/>+ <oc:permissions/>+ <oc:owner-display-name/>+ </d:prop>+ </d:propfind>+ headers:+ Authorization:+ - Bearer <BEARER TOKEN>+ User-Agent:+ - httpx.rb/1.2.2+ Accept:+ - "*/*"+ Accept-Encoding:+ - gzip, deflate+ Content-Type:+ - application/xml; charset=utf-8+ Content-Length:+ - '253'+ response:+ status:+ code: 401+ message: Unauthorized+ headers:+ Cache-Control:+ - no-store, no-cache, must-revalidate+ Content-Security-Policy:+ - default-src 'none';+ Content-Type:+ - application/xml; charset=utf-8+ Date:+ - Fri, 01 Mar 2024 11:42:04 GMT+ Expires:+ - Thu, 19 Nov 1981 08:52:00 GMT+ Pragma:+ - no-cache+ Referrer-Policy:+ - no-referrer+ Server:+ - Apache/2.4.57 (Debian)+ Set-Cookie:+ - ocirabgzify6=2c7e26704de33116d7308fa7d7503ed3; path=/; secure; HttpOnly; SameSite=Lax,+ oc_sessionPassphrase=p36BGC1iWfB3QXlLc3TB6YcIstkzCfMi8keNP1rdmlYArhXCRlzS5UMMfhdhcR7tUFTcu8X0pGddscZ8M4vFbBEsCADRPGq5dph%2FHzGOtMfG9L3Y78r2sqfgA6cP2kD2;+ path=/; secure; HttpOnly; SameSite=Lax, ocirabgzify6=2c7e26704de33116d7308fa7d7503ed3;+ path=/; secure; HttpOnly; SameSite=Lax, __Host-nc_sameSiteCookielax=true;+ path=/; httponly;secure; expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=lax,+ __Host-nc_sameSiteCookiestrict=true; path=/; httponly;secure; expires=Fri,+ 31-Dec-2100 23:59:59 GMT; SameSite=strict, ocirabgzify6=2c7e26704de33116d7308fa7d7503ed3;+ path=/; secure; HttpOnly; SameSite=Lax+ Www-Authenticate:+ - Basic realm="Nextcloud", charset="UTF-8"+ X-Content-Type-Options:+ - nosniff+ X-Frame-Options:+ - SAMEORIGIN+ X-Permitted-Cross-Domain-Policies:+ - none+ X-Powered-By:+ - PHP/8.2.16+ X-Robots-Tag:+ - noindex, nofollow+ X-Xss-Protection:+ - 1; mode=block+ Content-Length:+ - '476'+ body:+ encoding: UTF-8+ string: |+ <?xml version="1.0" encoding="utf-8"?>+ <d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">+ <s:exception>Sabre\DAV\Exception\NotAuthenticated</s:exception>+ <s:message>No public access to this resource., No 'Authorization: Basic' header found. Either the client didn't send one, or the server is misconfigured, Bearer token was incorrect, No 'Authorization: Basic' header found. Either the client didn't send one, or the server is misconfigured</s:message>+ </d:error>+ recorded_at: Fri, 01 Mar 2024 11:42:04 GMT+- request:+ method: post+ uri: https://nextcloud.local/index.php/apps/oauth2/api/v1/token+ body:+ encoding: ASCII-8BIT+ string: grant_type=refresh_token&scope=&client_id=7fj7lpG0GOqwOGhHAyfGwd1oEgtbTto7mctu0IaSN3SE79o9Xs0q8k3kDiEwXDrM&client_secret=j7RoyauWeIpMc7cYdY3lewCGKxdgiAowonpGzmAuj9iRSvYBAGXhP7hvz9Hp7skR&refresh_token=ZlV7mLctFD0v4OeCBn06zlEmw73fAAFstNQMoXc6saygAQofq7UIRtNlMil135zIOJiQhOnb2p6IvxVQHcmrKUi5aAUuQT4jAyaASjRJ2C4IkCWtXgSMhnIYU6UY7FQV+ headers:+ User-Agent:+ - httpx.rb/1.2.2+ Accept:+ - "*/*"+ Accept-Encoding:+ - gzip, deflate+ Content-Type:+ - application/x-www-form-urlencoded+ Content-Length:+ - '328'+ response:+ status:+ code: 400+ message: Bad Request+ headers:+ Cache-Control:+ - no-cache, no-store, must-revalidate+ Content-Security-Policy:+ - default-src 'none';base-uri 'none';manifest-src 'self';frame-ancestors 'none'+ Content-Type:+ - application/json; charset=utf-8+ Date:+ - Fri, 01 Mar 2024 11:42:04 GMT+ Expires:+ - Thu, 19 Nov 1981 08:52:00 GMT+ Feature-Policy:+ - autoplay 'none';camera 'none';fullscreen 'none';geolocation 'none';microphone+ 'none';payment 'none'+ Pragma:+ - no-cache+ Referrer-Policy:+ - no-referrer+ Server:+ - Apache/2.4.57 (Debian)+ Set-Cookie:+ - ocirabgzify6=c35c70252b26c94577f0f5c591a90803; path=/; secure; HttpOnly; SameSite=Lax,+ oc_sessionPassphrase=q0%2Bduzpzc4KZSBskoRUC%2BjJvD7RhVe0d1CMorStCi7H2d4zjILTIVL2g%2FAFPY2%2BkW98C4hCmm5iuCyZQ%2Byr1jj%2Fc1lmkO9exOAGoN%2F6upDIp26qcUSRFiyLILA3Urc1S;+ path=/; secure; HttpOnly; SameSite=Lax, ocirabgzify6=c35c70252b26c94577f0f5c591a90803;+ path=/; secure; HttpOnly; SameSite=Lax, __Host-nc_sameSiteCookielax=true;+ path=/; httponly;secure; expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=lax,+ __Host-nc_sameSiteCookiestrict=true; path=/; httponly;secure; expires=Fri,+ 31-Dec-2100 23:59:59 GMT; SameSite=strict, ocirabgzify6=c35c70252b26c94577f0f5c591a90803;+ path=/; secure; HttpOnly; SameSite=Lax+ X-Content-Type-Options:+ - nosniff+ X-Frame-Options:+ - SAMEORIGIN+ X-Nextcloud-Bruteforce-Throttled:+ - 600ms+ X-Permitted-Cross-Domain-Policies:+ - none+ X-Powered-By:+ - PHP/8.2.16+ X-Request-Id:+ - bTdOQhJPyfQnf5ueUtaT+ X-Robots-Tag:+ - noindex, nofollow+ X-Xss-Protection:+ - 1; mode=block+ Content-Length:+ - '27'+ body:+ encoding: UTF-8+ string: '{"error":"invalid_request"}'+ recorded_at: Fri, 01 Mar 2024 11:42:05 GMT+recorded_with: VCR 6.2.0diff --git a/modules/storages/spec/support/fixtures/vcr_cassettes/auth/one_drive/storage_query_client_credentials_invalid.yml b/modules/storages/spec/support/fixtures/vcr_cassettes/auth/one_drive/storage_query_client_credentials_invalid.ymlnew file mode 100644index 00000000000..a99e5988761--- /dev/null+++ b/modules/storages/spec/support/fixtures/vcr_cassettes/auth/one_drive/storage_query_client_credentials_invalid.yml@@ -0,0 +1,63 @@+---+http_interactions:+- request:+ method: post+ uri: https://login.microsoftonline.com/4d44bf36-9b56-45c0-8807-bbf386dd047f/oauth2/v2.0/token+ body:+ encoding: ASCII-8BIT+ string: grant_type=client_credentials&scope=https%3A%2F%2Fgraph.microsoft.com%2F.default&client_id=4262df2b-77bb-49c2-a5df-28355da676d2&client_secret=Vwk8Q%7EJTuPh.pAjvPiWBQBdTFMDK%7EAIwxbj9_axB___+ headers:+ User-Agent:+ - httpx.rb/1.2.2+ Accept:+ - "*/*"+ Accept-Encoding:+ - gzip, deflate+ Content-Type:+ - application/x-www-form-urlencoded+ Content-Length:+ - '189'+ response:+ status:+ code: 401+ message: Unauthorized+ headers:+ Cache-Control:+ - no-store, no-cache+ Pragma:+ - no-cache+ Content-Type:+ - application/json; charset=utf-8+ Expires:+ - "-1"+ Strict-Transport-Security:+ - max-age=31536000; includeSubDomains+ X-Content-Type-Options:+ - nosniff+ P3p:+ - CP="DSP CUR OTPi IND OTRi ONL FIN"+ X-Ms-Request-Id:+ - 14a966d5-3442-4869-9db3-e6e8629c4200+ X-Ms-Ests-Server:+ - 2.1.17396.8 - WEULR1 ProdSlices+ X-Xss-Protection:+ - '0'+ Set-Cookie:+ - fpc=Atu5xSIz8pxPqDL299wsTSGkbDoXAQAAAHVxct0OAAAA; expires=Sat, 30-Mar-2024+ 12:37:10 GMT; path=/; secure; HttpOnly; SameSite=None, x-ms-gateway-slice=estsfd;+ path=/; secure; samesite=none; httponly, stsservicecookie=estsfd; path=/;+ secure; samesite=none; httponly+ Date:+ - Thu, 29 Feb 2024 12:37:10 GMT+ Content-Length:+ - '623'+ body:+ encoding: UTF-8+ string: '{"error":"invalid_client","error_description":"AADSTS7000215: Invalid+ client secret provided. Ensure the secret being sent in the request is the+ client secret value, not the client secret ID, for a secret added to app ''4262df2b-77bb-49c2-a5df-28355da676d2''.+ Trace ID: 14a966d5-3442-4869-9db3-e6e8629c4200 Correlation ID: e856fa17-a5dd-45d3-baf2-ec1b74695dc5+ Timestamp: 2024-02-29 12:37:10Z","error_codes":[7000215],"timestamp":"2024-02-29+ 12:37:10Z","trace_id":"14a966d5-3442-4869-9db3-e6e8629c4200","correlation_id":"e856fa17-a5dd-45d3-baf2-ec1b74695dc5","error_uri":"https://login.microsoftonline.com/error?code=7000215"}'+ recorded_at: Thu, 29 Feb 2024 12:37:10 GMT+recorded_with: VCR 6.2.0diff --git a/modules/storages/spec/support/fixtures/vcr_cassettes/auth/one_drive/storage_query_user_token_access_token_invalid.yml b/modules/storages/spec/support/fixtures/vcr_cassettes/auth/one_drive/storage_query_user_token_access_token_invalid.ymlnew file mode 100644index 00000000000..e536bf2eb9e--- /dev/null+++ b/modules/storages/spec/support/fixtures/vcr_cassettes/auth/one_drive/storage_query_user_token_access_token_invalid.yml@@ -0,0 +1,115 @@+---+http_interactions:+- request:+ method: get+ uri: https://graph.microsoft.com/v1.0/drives/b!dmVLG22QlE2PSW0AqVB7UOhZ8n7tjkVGkgqLNnuw2OBb-brzKzZAR4DYT1k9KPXs/root/children?$select=id,name,size,webUrl,lastModifiedBy,createdBy,fileSystemInfo,file,folder,parentReference+ body:+ encoding: US-ASCII+ string: ''+ headers:+ Authorization:+ - Bearer <BEARER TOKEN>+ User-Agent:+ - httpx.rb/1.2.2+ Accept:+ - "*/*"+ Accept-Encoding:+ - gzip, deflate+ response:+ status:+ code: 401+ message: Unauthorized+ headers:+ Transfer-Encoding:+ - chunked+ Content-Type:+ - application/json+ Content-Encoding:+ - gzip+ Vary:+ - Accept-Encoding+ Strict-Transport-Security:+ - max-age=31536000+ Request-Id:+ - d5185685-fc2f-4279-ae6e-6a63258b67ed+ Client-Request-Id:+ - d5185685-fc2f-4279-ae6e-6a63258b67ed+ X-Ms-Ags-Diagnostic:+ - '{"ServerInfo":{"DataCenter":"Germany West Central","Slice":"E","Ring":"5","ScaleUnit":"003","RoleInstance":"FR1PEPF00000BA2"}}'+ Www-Authenticate:+ - Bearer realm="", authorization_uri="https://login.microsoftonline.com/common/oauth2/authorize",+ client_id="00000003-0000-0000-c000-000000000000"+ Date:+ - Thu, 29 Feb 2024 12:38:09 GMT+ body:+ encoding: UTF-8+ string: '{"error":{"code":"InvalidAuthenticationToken","message":"IDX14100:+ JWT is not well formed, there are no dots (.).\nThe token needs to be in JWS+ or JWE Compact Serialization Format. (JWS): ''EncodedHeader.EndcodedPayload.EncodedSignature''.+ (JWE): ''EncodedProtectedHeader.EncodedEncryptedKey.EncodedInitializationVector.EncodedCiphertext.EncodedAuthenticationTag''.","innerError":{"date":"2024-02-29T12:38:10","request-id":"d5185685-fc2f-4279-ae6e-6a63258b67ed","client-request-id":"d5185685-fc2f-4279-ae6e-6a63258b67ed"}}}'+ recorded_at: Thu, 29 Feb 2024 12:38:10 GMT+- request:+ method: post+ uri: https://login.microsoftonline.com/4d44bf36-9b56-45c0-8807-bbf386dd047f/oauth2/v2.0/token+ body:+ encoding: ASCII-8BIT+ string: grant_type=refresh_token&scope=offline_access+files.readwrite.all+user.read+sites.readwrite.all&refresh_token=0.Aa8AvB1v4679fkK2Gw2W3fuBpFS7pbiyXw5OlCedJNusMv-sAHQ.AgABAAEAAAAmoFfGtYxvRrNriQdPKIZ-AgDs_wUA9P-Mp5TT3fmzX4h_Z_8H-KOxCYkum88ASW9CO1tuPwkkup84TCH74-BLVZNO9ZTSIDsuVhonDreRsFENTve6MWVBF5khUHFBXlH3XLGlkYC3gukCFk9JKNo24Pwn7v4sm-vYzSL_aY-9jAQYHdRJxMbizrQsy3RcqoAYgkgfLzHZ2mrXe63awdSubmHX1hkKk3tCy1FGx5UMC1z2gV6Un7nQMe8aMP_oHTZtYagj10Hb3J2dwRM6dV4HnWeMpiQ7hZMPd0vVFmpFRN_F21LzDTtMHXqxWc5ySYfRehA4g9biXDqDwpGE1oTQ9oNOeMSkUDjj7NtkfDjPbePsf1dlcHfPrRaO1jAVMu3_RuNjXl3gWRle8HjsZoDQ2upOZyB7--rWhJUvVW_rrkJVaKoNz580kdHzi3W5qvGwZEIsNXB4xZJNQqVKpGUciQNtSxb98-n2FySqudn3Vv-NnFIejSvNgyCFmo1OV_F9IxBPipP2Xh64DXm873u49AovkfKNokrCmrCaq-xITjXTyPWgpPcwYFBLiAUQ-Lpb3876y4GyeEs7Qb-q1uAqlfFWsCsRnGsAA3Wp_MHxQxOm_-dS1FnY3zhnZ0DENIKDPcADFEQZPSCUtHaR5E-Dabt8sQJ0JSHbMFOKQuEEa0zFhllwOOymnCgNcGPS9Yf3nLz6z6U_vB3auh30GWTZmdRJV4R4EX3Wcn0p7W7npAIanEo0-AxAtHwF-jGkq0YjHGZhH46qt3i_4W5MMP4IIBVwTdkSluyPijJr3MeEUd_lYjdnYgHPP-HrEzEh7DU+ headers:+ Authorization:+ - Basic <BASIC_AUTH>+ User-Agent:+ - httpx.rb/1.2.2+ Accept:+ - "*/*"+ Accept-Encoding:+ - gzip, deflate+ Content-Type:+ - application/x-www-form-urlencoded+ Content-Length:+ - '1007'+ response:+ status:+ code: 400+ message: Bad Request+ headers:+ Cache-Control:+ - no-store, no-cache+ Pragma:+ - no-cache+ Content-Type:+ - application/json; charset=utf-8+ Expires:+ - "-1"+ Strict-Transport-Security:+ - max-age=31536000; includeSubDomains+ X-Content-Type-Options:+ - nosniff+ P3p:+ - CP="DSP CUR OTPi IND OTRi ONL FIN"+ X-Ms-Request-Id:+ - a0b681be-6bf3-4ed7-9ea8-dbf0cce04700+ X-Ms-Ests-Server:+ - 2.1.17396.8 - SEC ProdSlices+ X-Xss-Protection:+ - '0'+ Set-Cookie:+ - fpc=AnLzwxk4nExOnBBp3dgv426Zv0u5AQAAALFxct0OAAAA; expires=Sat, 30-Mar-2024+ 12:38:10 GMT; path=/; secure; HttpOnly; SameSite=None, x-ms-gateway-slice=estsfd;+ path=/; secure; samesite=none; httponly, stsservicecookie=estsfd; path=/;+ secure; samesite=none; httponly+ Date:+ - Thu, 29 Feb 2024 12:38:09 GMT+ Content-Length:+ - '750'+ body:+ encoding: UTF-8+ string: '{"error":"unauthorized_client","error_description":"AADSTS700016: Application+ with identifier ''b8a5bb54-5fb2-4e0e-9427-9d24dbac32ff'' was not found in+ the directory ''OpenProject GmbH''. This can happen if the application has+ not been installed by the administrator of the tenant or consented to by any+ user in the tenant. You may have sent your authentication request to the wrong+ tenant. Trace ID: a0b681be-6bf3-4ed7-9ea8-dbf0cce04700 Correlation ID: 78c735f4-2c64-4957-85bf-f0259b38587f+ Timestamp: 2024-02-29 12:38:10Z","error_codes":[700016],"timestamp":"2024-02-29+ 12:38:10Z","trace_id":"a0b681be-6bf3-4ed7-9ea8-dbf0cce04700","correlation_id":"78c735f4-2c64-4957-85bf-f0259b38587f","error_uri":"https://login.microsoftonline.com/error?code=700016"}'+ recorded_at: Thu, 29 Feb 2024 12:38:10 GMT+recorded_with: VCR 6.2.0diff --git a/modules/storages/spec/support/fixtures/vcr_cassettes/auth/one_drive/storage_query_user_token_refresh_token_invalid.yml b/modules/storages/spec/support/fixtures/vcr_cassettes/auth/one_drive/storage_query_user_token_refresh_token_invalid.ymlnew file mode 100644index 00000000000..bb0ac78cbd4--- /dev/null+++ b/modules/storages/spec/support/fixtures/vcr_cassettes/auth/one_drive/storage_query_user_token_refresh_token_invalid.yml@@ -0,0 +1,109 @@+---+http_interactions:+- request:+ method: get+ uri: https://graph.microsoft.com/v1.0/drives/b!dmVLG22QlE2PSW0AqVB7UOhZ8n7tjkVGkgqLNnuw2OBb-brzKzZAR4DYT1k9KPXs/root/children?$select=id,name,size,webUrl,lastModifiedBy,createdBy,fileSystemInfo,file,folder,parentReference+ body:+ encoding: US-ASCII+ string: ''+ headers:+ Authorization:+ - Bearer <BEARER TOKEN>+ User-Agent:+ - httpx.rb/1.2.2+ Accept:+ - "*/*"+ Accept-Encoding:+ - gzip, deflate+ response:+ status:+ code: 401+ message: Unauthorized+ headers:+ Transfer-Encoding:+ - chunked+ Content-Type:+ - application/json+ Content-Encoding:+ - gzip+ Vary:+ - Accept-Encoding+ Strict-Transport-Security:+ - max-age=31536000+ Request-Id:+ - a01f06ab-2304-4aee-a19d-62842bc72d54+ Client-Request-Id:+ - a01f06ab-2304-4aee-a19d-62842bc72d54+ X-Ms-Ags-Diagnostic:+ - '{"ServerInfo":{"DataCenter":"Germany West Central","Slice":"E","Ring":"5","ScaleUnit":"005","RoleInstance":"FR3PEPF000002E8"}}'+ Www-Authenticate:+ - Bearer realm="", authorization_uri="https://login.microsoftonline.com/common/oauth2/authorize",+ client_id="00000003-0000-0000-c000-000000000000"+ Date:+ - Thu, 29 Feb 2024 12:36:16 GMT+ body:+ encoding: UTF-8+ string: '{"error":{"code":"InvalidAuthenticationToken","message":"Lifetime validation+ failed, the token is expired.","innerError":{"date":"2024-02-29T12:36:17","request-id":"a01f06ab-2304-4aee-a19d-62842bc72d54","client-request-id":"a01f06ab-2304-4aee-a19d-62842bc72d54"}}}'+ recorded_at: Thu, 29 Feb 2024 12:36:17 GMT+- request:+ method: post+ uri: https://login.microsoftonline.com/4d44bf36-9b56-45c0-8807-bbf386dd047f/oauth2/v2.0/token+ body:+ encoding: ASCII-8BIT+ string: grant_type=refresh_token&scope=offline_access+files.readwrite.all+user.read+sites.readwrite.all&refresh_token=0.Aa8AvB1v4679fkK2Gw2W3fuBpFS7pbiyXw5OlCedJNusMv-sAHQ.AgABAAEAAAAmoFfGtYxvRrNriQdPKIZ-AgDs_wUA9P-Mp5TT3fmzX4h_Z_8H-KOxCYkum88ASW9CO1tuPwkkup84TCH74-BLVZNO9ZTSIDsuVhonDreRsFENTve6MWVBF5khUHFBXlH3XLGlkYC3gukCFk9JKNo24Pwn7v4sm-vYzSL_aY-9jAQYHdRJxMbizrQsy3RcqoAYgkgfLzHZ2mrXe63awdSubmHX1hkKk3tCy1FGx5UMC1z2gV6Un7nQMe8aMP_oHTZtYagj10Hb3J2dwRM6dV4HnWeMpiQ7hZMPd0vVFmpFRN_F21LzDTtMHXqxWc5ySYfRehA4g9biXDqDwpGE1oTQ9oNOeMSkUDjj7NtkfDjPbePsf1dlcHfPrRaO1jAVMu3_RuNjXl3gWRle8HjsZoDQ2upOZyB7--rWhJUvVW_rrkJVaKoNz580kdHzi3W5qvGwZEIsNXB4xZJNQqVKpGUciQNtSxb98-n2FySqudn3Vv-NnFIejSvNgyCFmo1OV_F9IxBPipP2Xh64DXm873u49AovkfKNokrCmrCaq-xITjXTyPWgpPcwYFBLiAUQ-Lpb3876y4GyeEs7Qb-q1uAqlfFWsCsRnGsAA3Wp_MHxQxOm_-dS1FnY3zhnZ0DENIKDPcADFEQZPSCUtHaR5E-Dabt8sQJ0JSHbMFOKQuEEa0zFhllwOOymnCgNcGPS9Yf3nLz6z6U_vB3auh30GWTZmdRJV4R4EX3Wcn0p7W7npAIanEo0-AxAtHwF-jGkq0YjHGZhH46qt3i_4W5MMP4IIBVwTdkSluyPijJr3MeEUd_lYjdnYgHPP-HrEzEh7DU%2Fa+ headers:+ Authorization:+ - Basic <BASIC_AUTH>+ User-Agent:+ - httpx.rb/1.2.2+ Accept:+ - "*/*"+ Accept-Encoding:+ - gzip, deflate+ Content-Type:+ - application/x-www-form-urlencoded+ Content-Length:+ - '1011'+ response:+ status:+ code: 400+ message: Bad Request+ headers:+ Cache-Control:+ - no-store, no-cache+ Pragma:+ - no-cache+ Content-Type:+ - application/json; charset=utf-8+ Expires:+ - "-1"+ Strict-Transport-Security:+ - max-age=31536000; includeSubDomains+ X-Content-Type-Options:+ - nosniff+ P3p:+ - CP="DSP CUR OTPi IND OTRi ONL FIN"+ X-Ms-Request-Id:+ - 26662a10-45e0-4d01-ba67-a2003e9f9700+ X-Ms-Ests-Server:+ - 2.1.17396.8 - WEULR1 ProdSlices+ X-Xss-Protection:+ - '0'+ Set-Cookie:+ - fpc=Aput8wtsE-NOheSWU3cAheA; expires=Sat, 30-Mar-2024 12:36:17 GMT; path=/;+ secure; HttpOnly; SameSite=None, x-ms-gateway-slice=estsfd; path=/; secure;+ samesite=none; httponly, stsservicecookie=estsfd; path=/; secure; samesite=none;+ httponly+ Date:+ - Thu, 29 Feb 2024 12:36:17 GMT+ Content-Length:+ - '476'+ body:+ encoding: UTF-8+ string: '{"error":"invalid_grant","error_description":"AADSTS9002313: Invalid+ request. Request is malformed or invalid. Trace ID: 26662a10-45e0-4d01-ba67-a2003e9f9700+ Correlation ID: f293dcd1-526e-48b1-8d52-d84ff3a5866d Timestamp: 2024-02-29+ 12:36:17Z","error_codes":[9002313],"timestamp":"2024-02-29 12:36:17Z","trace_id":"26662a10-45e0-4d01-ba67-a2003e9f9700","correlation_id":"f293dcd1-526e-48b1-8d52-d84ff3a5866d","error_uri":"https://login.microsoftonline.com/error?code=9002313"}'+ recorded_at: Thu, 29 Feb 2024 12:36:17 GMT+recorded_with: VCR 6.2.0