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
[#64183] Add SharePoint storage validators and tests (#19792)
Yauheni Suhakou450fb32d3c35
diff --git a/.env.test.local.example b/.env.test.local.exampleindex 4c6076b4ae0..44a57195ff1 100644--- a/.env.test.local.example+++ b/.env.test.local.example@@ -48,3 +48,12 @@ ONE_DRIVE_TEST_OAUTH_CLIENT_SECRET=ONE_DRIVE_TEST_OAUTH_CLIENT_ACCESS_TOKEN=ONE_DRIVE_TEST_OAUTH_CLIENT_REFRESH_TOKEN=++SHARE_POINT_TEST_HOST=+SHARE_POINT_TEST_TENANT_ID=++SHARE_POINT_TEST_OAUTH_CLIENT_ID=+SHARE_POINT_TEST_OAUTH_CLIENT_SECRET=++SHARE_POINT_TEST_OAUTH_CLIENT_ACCESS_TOKEN=+SHARE_POINT_TEST_OAUTH_CLIENT_REFRESH_TOKEN=diff --git a/app/controllers/oauth_clients_controller.rb b/app/controllers/oauth_clients_controller.rbindex 52a2698faa1..fd56e57e468 100644--- a/app/controllers/oauth_clients_controller.rb+++ b/app/controllers/oauth_clients_controller.rb@@ -221,7 +221,7 @@ class OAuthClientsController < ApplicationControllerdef redirect_user_or_admin(redirect_uri = nil)# This needs to be modified as soon as we support more integration types.- if User.current.admin && redirect_uri && (nextcloud? || one_drive?)+ if User.current.admin && redirect_uri && (nextcloud? || one_drive? || share_point?)yieldelsif redirect_uriflash[:error] = [t(:"oauth_client.errors.oauth_issue_contact_admin")]@@ -236,7 +236,11 @@ class OAuthClientsController < ApplicationControllerenddef one_drive?- @oauth_client&.integration&.provider_type == ::Storages::Storage::PROVIDER_TYPE_ONE_DRIVE+ @oauth_client&.integration&.provider_type == ::Storages::OneDriveStorage.name+ end++ def share_point?+ @oauth_client&.integration&.provider_type == ::Storages::SharePointStorage.nameenddef get_redirect_uridiff --git a/modules/storages/app/common/storages/adapters/providers/one_drive/validators/authentication_validator.rb b/modules/storages/app/common/storages/adapters/providers/one_drive/validators/authentication_validator.rbindex 7547096462d..2aebf5c66a4 100644--- a/modules/storages/app/common/storages/adapters/providers/one_drive/validators/authentication_validator.rb+++ b/modules/storages/app/common/storages/adapters/providers/one_drive/validators/authentication_validator.rb@@ -45,7 +45,6 @@ module Storagesdef validateregister_checks(:existing_token, :user_bound_request)-oauth_tokenuser_bound_requestenddiff --git a/modules/storages/app/common/storages/adapters/providers/share_point/validators/authentication_validator.rb b/modules/storages/app/common/storages/adapters/providers/share_point/validators/authentication_validator.rbnew file mode 100644index 00000000000..a59b7edde3c--- /dev/null+++ b/modules/storages/app/common/storages/adapters/providers/share_point/validators/authentication_validator.rb@@ -0,0 +1,73 @@+# frozen_string_literal: true++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 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 Adapters+ module Providers+ module SharePoint+ module Validators+ class AuthenticationValidator < ConnectionValidators::BaseValidatorGroup+ def self.key = :authentication++ def initialize(storage)+ super+ @user = User.current+ end++ private++ def validate+ register_checks(:existing_token, :user_bound_request)+ oauth_token+ user_bound_request+ end++ def oauth_token+ if OAuthClientToken.for_user_and_client(@user, @storage.oauth_client).exists?+ pass_check(:existing_token)+ else+ warn_check(:existing_token, :sp_oauth_token_missing, halt_validation: true)+ end+ end++ def user_bound_request+ Registry["share_point.queries.user"].call(storage: @storage, auth_strategy:).either(+ ->(_) { pass_check(:user_bound_request) },+ -> { fail_check(:user_bound_request, :"sp_oauth_request_#{it.code}") }+ )+ end++ def auth_strategy = Registry["share_point.authentication.user_bound"].call(@user, @storage)+ end+ end+ end+ end+ end+enddiff --git a/modules/storages/app/common/storages/adapters/providers/share_point/validators/connection_validator.rb b/modules/storages/app/common/storages/adapters/providers/share_point/validators/connection_validator.rbindex bfc511bdf34..bd6b92720b0 100644--- a/modules/storages/app/common/storages/adapters/providers/share_point/validators/connection_validator.rb+++ b/modules/storages/app/common/storages/adapters/providers/share_point/validators/connection_validator.rb@@ -34,7 +34,9 @@ module Storagesmodule SharePointmodule Validatorsclass ConnectionValidator < ConnectionValidators::BaseConnectionValidator- # TODO: #64183 Implement the connection validation logic for SharePoint+ register_group StorageConfigurationValidator+ register_group AuthenticationValidator,+ precondition: ->(_, result) { result.group(:base_configuration).non_failure? }endendenddiff --git a/modules/storages/app/common/storages/adapters/providers/share_point/validators/storage_configuration_validator.rb b/modules/storages/app/common/storages/adapters/providers/share_point/validators/storage_configuration_validator.rbnew file mode 100644index 00000000000..b4f591c4a64--- /dev/null+++ b/modules/storages/app/common/storages/adapters/providers/share_point/validators/storage_configuration_validator.rb@@ -0,0 +1,134 @@+# frozen_string_literal: true++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 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 Adapters+ module Providers+ module SharePoint+ module Validators+ class StorageConfigurationValidator < ConnectionValidators::BaseValidatorGroup+ def self.key = :base_configuration++ private++ def validate+ register_checks :storage_configured,+ :diagnostic_request,+ :host,+ :tenant_id,+ :client_secret,+ :client_id++ storage_configuration_status+ diagnostic_request+ check_host+ check_tenant_id+ check_client_secret+ check_client_id+ end++ def storage_configuration_status+ if @storage.configured?+ pass_check(:storage_configured)+ else+ fail_check(:storage_configured, :not_configured)+ end+ end++ def diagnostic_request+ if query_result.failure? && query_result.failure.code == :error+ error "Connection validation failed with unknown error:\n" \+ "\tstorage: ##{@storage.id} #{@storage.name}\n" \+ "\tstatus: #{query_result.failure}\n" \+ "\tresponse: #{query_result.failure.payload}"++ fail_check(:diagnostic_request, :unknown_error)+ else+ pass_check :diagnostic_request+ end+ end++ def check_host+ if @storage.host.present?+ pass_check(:host)+ else+ fail_check(:host, :sp_host_missing)+ end+ end++ def check_tenant_id+ return pass_check(:tenant_id) if query_result.success?++ tenant_id_regex = /tenant (?:identifier )?'#{@storage.tenant_id}' (?:not found|is neither)/i++ if error_payload[:error] == "invalid_request" && error_payload[:error_description].match?(tenant_id_regex)+ fail_check(:tenant_id, :sp_tenant_id_invalid)+ else+ pass_check(:tenant_id)+ end+ end++ def check_client_id+ return pass_check(:client_id) if query_result.success?++ if error_payload[:error] == "unauthorized_client"+ fail_check(:client_id, :client_id_invalid)+ else+ pass_check(:client_id)+ end+ end++ def check_client_secret+ return pass_check(:client_secret) if query_result.success?++ if error_payload[:error] == "invalid_client"+ fail_check(:client_secret, :client_secret_invalid)+ else+ pass_check(:client_secret)+ end+ end++ def query_result+ @query_result ||= Input::Files.build(folder: "/").bind do |input_data|+ Registry["#{@storage}.queries.files"].call(storage: @storage, auth_strategy:, input_data:)+ end+ end++ def auth_strategy = Registry["share_point.authentication.userless"].call++ def error_payload+ @error_payload ||= query_result.either(->(_) { {} }, -> { MultiJson.load(it.payload, symbolize_keys: true) })+ end+ end+ end+ end+ end+ end+enddiff --git a/modules/storages/app/models/storages/share_point_storage.rb b/modules/storages/app/models/storages/share_point_storage.rbindex 3370cac228b..a7b5550e262 100644--- a/modules/storages/app/models/storages/share_point_storage.rb+++ b/modules/storages/app/models/storages/share_point_storage.rb@@ -62,10 +62,6 @@ module Storagesendend- def configuration_checks- { all: true }- end-def uri@uri ||= URI("https://graph.microsoft.com").normalizeenddiff --git a/modules/storages/config/locales/en.yml b/modules/storages/config/locales/en.ymlindex dacdda6edd5..284a9635906 100644--- a/modules/storages/config/locales/en.yml+++ b/modules/storages/config/locales/en.yml@@ -320,6 +320,15 @@ en:oidc_token_acquisition_failed: Your OpenID Connect setup doesn't provide the necessary audience, nor does it provide token exchange capabilities. Please check out our documentation for more information.oidc_token_exchange_failed: There seems to be a problem with the Token Exchange setup on your OpenID Connect Provider. Please check its configuration and try again.oidc_token_refresh_failed: There was an error while trying to check your access to the storage. Please check the server logs for further information.+ sp_client_cant_delete_folder: The client is having trouble deleting folders in SharePoint. Please check the setup documentation for your storage.+ sp_client_id_missing: The configured OAuth 2 client id is missing for SharePoint. Please check the configuration.+ sp_client_secret_missing: The configured OAuth 2 client secret is missing for SharePoint. Please check the configuration.+ sp_client_write_permission_missing: The client seems to have write permissions missing in SharePoint. Please check the setup documentation for your storage.+ sp_existing_test_folder: The folder %{folder_name} needed for testing already exists in SharePoint. Please delete it and try again.+ sp_oauth_request_error: The user-bound request to SharePoint failed. Please check the server logs for further information.+ sp_oauth_token_missing: OpenProject cannot test the user level communication with SharePoint as the user did not yet link their SharePoint account.+ sp_tenant_id_missing: The configured directory (tenant) id is missing for SharePoint. Please check the configuration.+ sp_unexpected_content: Unexpected content found in the SharePoint drive.unknown_error: The connection could not be validated. An unknown error occurred. Please check the server logs for further information.label_error: Errorlabel_failed: Faileddiff --git a/modules/storages/spec/common/storages/adapters/providers/share_point/commands/create_folder_command_spec.rb b/modules/storages/spec/common/storages/adapters/providers/share_point/commands/create_folder_command_spec.rbindex b9d4ee53d17..12361805ae1 100644--- a/modules/storages/spec/common/storages/adapters/providers/share_point/commands/create_folder_command_spec.rb+++ b/modules/storages/spec/common/storages/adapters/providers/share_point/commands/create_folder_command_spec.rb@@ -37,7 +37,7 @@ module Storagesmodule SharePointmodule CommandsRSpec.describe CreateFolderCommand, :webmock do- let(:storage) { create(:share_point_dev_storage) }+ let(:storage) { create(:share_point_storage, :sandbox) }let(:auth_strategy) { Registry.resolve("share_point.authentication.userless").call(false) }let(:base_drive) { "b!FeOZEMfQx0eGQKqVBLcP__BG8mq-4-9FuRqOyk3MXY9jo6leJDqrT7muzvmiWjFW" }let(:input_data) { Input::CreateFolder.build(folder_name:, parent_location:).value! }diff --git a/modules/storages/spec/common/storages/adapters/providers/share_point/commands/delete_folder_command_spec.rb b/modules/storages/spec/common/storages/adapters/providers/share_point/commands/delete_folder_command_spec.rbindex 147f851f7dc..5150855c17c 100644--- a/modules/storages/spec/common/storages/adapters/providers/share_point/commands/delete_folder_command_spec.rb+++ b/modules/storages/spec/common/storages/adapters/providers/share_point/commands/delete_folder_command_spec.rb@@ -37,7 +37,7 @@ module Storagesmodule SharePointmodule CommandsRSpec.describe DeleteFolderCommand, :vcr, :webmock do- let(:storage) { create(:share_point_dev_storage) }+ let(:storage) { create(:share_point_storage, :sandbox) }let(:auth_strategy) { Registry["share_point.authentication.userless"].call }let(:base_drive) { "b!FeOZEMfQx0eGQKqVBLcP__BG8mq-4-9FuRqOyk3MXY9jo6leJDqrT7muzvmiWjFW" }diff --git a/modules/storages/spec/common/storages/adapters/providers/share_point/queries/download_link_query_spec.rb b/modules/storages/spec/common/storages/adapters/providers/share_point/queries/download_link_query_spec.rbindex 333140fd042..fc68a3c39e5 100644--- a/modules/storages/spec/common/storages/adapters/providers/share_point/queries/download_link_query_spec.rb+++ b/modules/storages/spec/common/storages/adapters/providers/share_point/queries/download_link_query_spec.rb@@ -38,7 +38,7 @@ module Storagesmodule QueriesRSpec.describe DownloadLinkQuery, :vcr, :webmock dolet(:user) { create(:user) }- let(:storage) { create(:share_point_dev_storage, oauth_client_token_user: user) }+ let(:storage) { create(:share_point_storage, :sandbox, oauth_client_token_user: user) }let(:auth_strategy) { Registry["one_drive.authentication.user_bound"].call(user, storage) }let(:drive_id) { "b!FeOZEMfQx0eGQKqVBLcP__BG8mq-4-9FuRqOyk3MXY87vnZ6fgfvQanZHX-XCAyw" }diff --git a/modules/storages/spec/common/storages/adapters/providers/share_point/queries/files_query_spec.rb b/modules/storages/spec/common/storages/adapters/providers/share_point/queries/files_query_spec.rbindex 2dcc7af588a..53430fbe563 100644--- a/modules/storages/spec/common/storages/adapters/providers/share_point/queries/files_query_spec.rb+++ b/modules/storages/spec/common/storages/adapters/providers/share_point/queries/files_query_spec.rb@@ -38,7 +38,7 @@ module Storagesmodule QueriesRSpec.describe FilesQuery, :webmock dolet(:user) { create(:admin) }- let(:storage) { create(:share_point_dev_storage, oauth_client_token_user: user) }+ let(:storage) { create(:share_point_storage, :sandbox, oauth_client_token_user: user) }let(:auth_strategy) { Registry["share_point.authentication.userless"].call(false) }let(:input_data) { Input::Files.build(folder:).value! }diff --git a/modules/storages/spec/common/storages/adapters/providers/share_point/validators/authentication_validator_spec.rb b/modules/storages/spec/common/storages/adapters/providers/share_point/validators/authentication_validator_spec.rbnew file mode 100644index 00000000000..4d56d4fc2b6--- /dev/null+++ b/modules/storages/spec/common/storages/adapters/providers/share_point/validators/authentication_validator_spec.rb@@ -0,0 +1,41 @@+# frozen_string_literal: true++require "spec_helper"+require_module_spec_helper++RSpec.describe Storages::Adapters::Providers::SharePoint::Validators::AuthenticationValidator, :webmock do+ subject(:validator) { described_class.new(storage) }++ context "when using OAuth2" do+ let(:user) { create(:user) }+ let(:storage) { create(:share_point_storage, :sandbox, oauth_client_token_user: user) }+ let(:error) { Storages::Adapters::Results::Error.new(code: :unauthorized, source: self) }++ before { User.current = user }++ it "has the correct key" do+ expect(described_class.key).to eq(:authentication)+ end++ it "passes when the user has a token and the request works", vcr: "share_point/user_query_success" do+ expect(validator.call).to be_success+ end++ it "returns a warning when there's no token for the current user" do+ User.current = create(:user)+ result = validator.call++ expect(result[:existing_token]).to be_a_warning+ expect(result[:existing_token].code).to eq(:sp_oauth_token_missing)+ expect(result[:user_bound_request]).to be_skipped+ end++ it "returns a failure if the remote call failed" do+ Storages::Adapters::Registry.stub("share_point.queries.user", ->(_) { Failure(error) })++ result = validator.call+ expect(result[:user_bound_request]).to be_a_failure+ expect(result[:user_bound_request].code).to eq(:sp_oauth_request_unauthorized)+ end+ end+enddiff --git a/modules/storages/spec/common/storages/adapters/providers/share_point/validators/storage_configuration_validator_spec.rb b/modules/storages/spec/common/storages/adapters/providers/share_point/validators/storage_configuration_validator_spec.rbnew file mode 100644index 00000000000..5dddfef3e3c--- /dev/null+++ b/modules/storages/spec/common/storages/adapters/providers/share_point/validators/storage_configuration_validator_spec.rb@@ -0,0 +1,89 @@+# frozen_string_literal: true++require "spec_helper"+require_module_spec_helper++module Storages+ module Adapters+ module Providers+ module SharePoint+ module Validators+ RSpec.describe StorageConfigurationValidator, :webmock do+ let(:storage) { create(:share_point_storage, :sandbox, :as_automatically_managed) }+ let(:error) { Results::Error.new(code: error_code, source: self) }++ subject(:validator) { described_class.new(storage) }++ describe "success", vcr: "share_point/files_query_userless" do+ it "returns a GroupValidationResult" do+ results = validator.call++ expect(results).to be_a(ConnectionValidators::ValidationGroupResult)+ expect(results).to be_success+ end+ end++ describe "failure" do+ let(:files_double) { class_double(Queries::FilesQuery) }+ let(:auth_strategy) { Registry["share_point.authentication.userless"].call }+ let(:input_data) { Input::Files.build(folder: "/").value! }+ let(:result) { Success() }++ before do+ allow(files_double).to receive(:call).with(storage:, auth_strategy:, input_data:).and_return(result)+ end++ context "when the storage isn't configured" do+ let(:storage) { create(:share_point_storage) }++ it "the check fails" do+ results = validator.call+ expect(results[:storage_configured]).to be_a_failure+ expect(results[:storage_configured].code).to eq(:not_configured)+ end+ end++ context "when the tenant id is wrong" do+ it "but looks like an actual valid value", vcr: "share_point/validation_wrong_tenant_id" do+ storage.tenant_id = "itdoesnotexists9000.sharepoint.com"+ results = described_class.new(storage).call++ expect(results[:tenant_id]).to be_a_failure+ expect(results[:tenant_id].code).to eq(:sp_tenant_id_invalid)+ end++ it "but is blatantly wrong", vcr: "share_point/validation_absurd_tenant_id" do+ storage.tenant_id = "wrong"+ results = described_class.new(storage).call++ expect(results[:tenant_id]).to be_a_failure+ expect(results[:tenant_id].code).to eq(:sp_tenant_id_invalid)+ end+ end++ context "when the client secret is wrong" do+ it "fails the check", vcr: "share_point/validation_wrong_client_secret" do+ storage.oauth_client.client_secret = "wrong"+ results = described_class.new(storage).call++ expect(results[:client_secret]).to be_a_failure+ expect(results[:client_secret].code).to eq(:client_secret_invalid)+ end+ end++ context "when the client id is wrong" do+ it "fails the check", vcr: "share_point/validation_wrong_client_id" do+ storage.oauth_client.client_id = "wrong"+ results = described_class.new(storage).call++ expect(results[:client_id]).to be_a_failure+ expect(results[:client_id].code).to eq(:client_id_invalid)+ end+ end+ end+ end+ end+ end+ end+ end+enddiff --git a/modules/storages/spec/factories/storage_factory.rb b/modules/storages/spec/factories/storage_factory.rbindex a3edbca5036..6804928ed57 100644--- a/modules/storages/spec/factories/storage_factory.rb+++ b/modules/storages/spec/factories/storage_factory.rb@@ -208,7 +208,8 @@ FactoryBot.define doafter(:create) do |storage, evaluator|create(:oauth_client,- client_id: ENV.fetch("ONE_DRIVE_TEST_OAUTH_CLIENT_ID", "MISSING_ONE_DRIVE_TEST_OAUTH_CLIENT_ID"),+ client_id: ENV.fetch("ONE_DRIVE_TEST_OAUTH_CLIENT_ID",+ "MISSING_ONE_DRIVE_TEST_OAUTH_CLIENT_ID"),client_secret: ENV.fetch("ONE_DRIVE_TEST_OAUTH_CLIENT_SECRET","MISSING_ONE_DRIVE_TEST_OAUTH_CLIENT_SECRET"),integration: storage)@@ -233,29 +234,36 @@ FactoryBot.define dotrait :with_tenant_id dotenant_id { SecureRandom.uuid }end- end-- factory :share_point_dev_storage, parent: :storage, class: "::Storages::SharePointStorage" do- tenant_id { ENV.fetch("SHARE_POINT_TEST_TENANT_ID", "e36f1dbc-fdae-427e-b61b-0d96ddfb81a4") }- host { ENV.fetch("SHARE_POINT_TEST_HOST", "https://ymt6d.sharepoint.com/sites/OPTest") }- transient do- oauth_client_token_user { association :user }+ trait :as_automatically_managed do+ automatically_managed { true }end- after(:create) do |storage, evaluator|- create(:oauth_client,- client_id: ENV.fetch("SHARE_POINT_TEST_OAUTH_CLIENT_ID", "MISSING_SHARE_POINT_TEST_OAUTH_CLIENT_ID"),- client_secret: ENV.fetch("SHARE_POINT_TEST_OAUTH_CLIENT_SECRET", "MISSING_SHARE_POINT_TEST_OAUTH_CLIENT_SECRET"),- integration: storage)-- create(:oauth_client_token,- oauth_client: storage.oauth_client,- user: evaluator.oauth_client_token_user,- access_token: ENV.fetch("SHARE_POINT_TEST_OAUTH_CLIENT_ACCESS_TOKEN", "SHARE_POINT_TEST_OAUTH_CLIENT_ACCESS_TOKEN"),- refresh_token: ENV.fetch("SHARE_POINT_TEST_OAUTH_CLIENT_REFRESH_TOKEN",- "MISSING_SHARE_POINT_TEST_OAUTH_CLIENT_REFRESH_TOKEN"),- token_type: "bearer")+ trait :sandbox do+ tenant_id { ENV.fetch("SHARE_POINT_TEST_TENANT_ID", "e36f1dbc-fdae-427e-b61b-0d96ddfb81a4") }+ host { ENV.fetch("SHARE_POINT_TEST_HOST", "https://ymt6d.sharepoint.com/sites/OPTest") }++ transient do+ oauth_client_token_user { association :user }+ end++ after(:create) do |storage, evaluator|+ create(:oauth_client,+ client_id: ENV.fetch("SHARE_POINT_TEST_OAUTH_CLIENT_ID",+ "MISSING_SHARE_POINT_TEST_OAUTH_CLIENT_ID"),+ client_secret: ENV.fetch("SHARE_POINT_TEST_OAUTH_CLIENT_SECRET",+ "MISSING_SHARE_POINT_TEST_OAUTH_CLIENT_SECRET"),+ integration: storage)++ create(:oauth_client_token,+ oauth_client: storage.oauth_client,+ user: evaluator.oauth_client_token_user,+ access_token: ENV.fetch("SHARE_POINT_TEST_OAUTH_CLIENT_ACCESS_TOKEN",+ "MISSING_SHARE_POINT_TEST_OAUTH_CLIENT_ACCESS_TOKEN"),+ refresh_token: ENV.fetch("SHARE_POINT_TEST_OAUTH_CLIENT_REFRESH_TOKEN",+ "MISSING_SHARE_POINT_TEST_OAUTH_CLIENT_REFRESH_TOKEN"),+ token_type: "bearer")+ endendendenddiff --git a/modules/storages/spec/support/fixtures/vcr_cassettes/share_point/files_query_userless.yml b/modules/storages/spec/support/fixtures/vcr_cassettes/share_point/files_query_userless.ymlnew file mode 100644index 00000000000..86bfd872858--- /dev/null+++ b/modules/storages/spec/support/fixtures/vcr_cassettes/share_point/files_query_userless.yml@@ -0,0 +1,114 @@+---+http_interactions:+- request:+ method: post+ uri: https://login.microsoftonline.com/e36f1dbc-fdae-427e-b61b-0d96ddfb81a4/oauth2/v2.0/token+ body:+ encoding: ASCII-8BIT+ string: grant_type=client_credentials&scope=https%3A%2F%2Fgraph.microsoft.com%2F.default+offline_access&client_id=MISSING_SHARE_POINT_TEST_OAUTH_CLIENT_ID&client_secret=MISSING_SHARE_POINT_TEST_OAUTH_CLIENT_SECRET+ headers:+ User-Agent:+ - httpx.rb/1.3.4+ Accept:+ - "*/*"+ Accept-Encoding:+ - gzip, deflate+ Content-Type:+ - application/x-www-form-urlencoded+ Content-Length:+ - '205'+ response:+ status:+ code: 200+ message: OK+ 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:+ - b50c2aba-1a4b-4915-a71e-b29d53290900+ X-Ms-Ests-Server:+ - 2.1.20393.4 - SEC ProdSlices+ X-Ms-Srs:+ - 1.P+ Content-Security-Policy-Report-Only:+ - object-src 'none'; base-uri 'self'; script-src 'self' 'nonce-3sWFN2meJ8S-bmklrr6Kbg'+ 'unsafe-inline' 'unsafe-eval' https://*.msauth.net https://*.msftauth.net+ https://*.msftauthimages.net https://*.msauthimages.net https://*.msidentity.com+ https://*.microsoftonline-p.com https://*.microsoftazuread-sso.com https://*.azureedge.net+ https://*.outlook.com https://*.office.com https://*.office365.com https://*.microsoft.com+ https://*.bing.com 'report-sample'; report-uri https://csp.microsoft.com/report/ESTS-UX-All+ X-Xss-Protection:+ - '0'+ Set-Cookie:+ - fpc=AqVrum5XuR9KsQqo956mtLBRVKK0AQAAAG24hd8OAAAA; expires=Wed, 07-May-2025+ 12:13:34 GMT; path=/; secure; HttpOnly; SameSite=None, x-ms-gateway-slice=estsfd;+ path=/; secure; samesite=none; httponly, stsservicecookie=estsfd; path=/;+ secure; samesite=none; httponly+ Date:+ - Mon, 07 Apr 2025 12:13:33 GMT+ Content-Length:+ - '1696'+ body:+ encoding: UTF-8+ string: '{"token_type":"Bearer","expires_in":3599,"ext_expires_in":3599,"access_token":"<ACCESS_TOKEN>"}'+ recorded_at: Tue, 05 Aug 2025 13:20:20 GMT+- request:+ method: get+ uri: https://graph.microsoft.com/v1.0/sites/ymt6d.sharepoint.com:/sites/OPTest:/lists?$expand=drive&$select=id,name,drive+ body:+ encoding: US-ASCII+ string: ''+ headers:+ User-Agent:+ - httpx.rb/1.3.4+ Accept:+ - "*/*"+ Accept-Encoding:+ - gzip, deflate+ Authorization:+ - Bearer <BEARER TOKEN>+ response:+ status:+ code: 200+ message: OK+ headers:+ Cache-Control:+ - no-store, no-cache+ Content-Type:+ - application/json; odata.metadata=minimal; odata.streaming=true; IEEE754Compatible=false;+ charset=utf-8+ Content-Encoding:+ - gzip+ Strict-Transport-Security:+ - max-age=31536000+ Request-Id:+ - 9625a92b-e916-425f-b889-e4f0f06ec4e1+ Client-Request-Id:+ - 9625a92b-e916-425f-b889-e4f0f06ec4e1+ X-Ms-Ags-Diagnostic:+ - '{"ServerInfo":{"DataCenter":"Germany West Central","Slice":"E","Ring":"4","ScaleUnit":"001","RoleInstance":"FR2PEPF000001EE"}}'+ Date:+ - Mon, 07 Apr 2025 12:13:33 GMT+ body:+ encoding: UTF-8+ string: '{"@odata.context":"https://graph.microsoft.com/v1.0/$metadata#Collection(driveItem)","value":[{"@odata.etag":"\"{8DA9DCAF-43E4-419C-B52E-F1303A0D3372},1\"","createdBy":{"user":{"email":"[email protected]","id":"5b5a7dc4-4539-41ba-9fa9-100f0a26acb7","displayName":"Eric+ Schubert"}},"id":"01ANJ53W5P3SUY3ZCDTRA3KLXRGA5A2M3S","lastModifiedBy":{"user":{"email":"[email protected]","id":"5b5a7dc4-4539-41ba-9fa9-100f0a26acb7","displayName":"Eric+ Schubert"}},"name":"data","parentReference":{"driveType":"documentLibrary","driveId":"b!dmVLG22QlE2PSW0AqVB7UOhZ8n7tjkVGkgqLNnuw2OBb-brzKzZAR4DYT1k9KPXs","id":"01ANJ53W56Y2GOVW7725BZO354PWSELRRZ","name":"Marcello+ VCR","path":"/drives/b!dmVLG22QlE2PSW0AqVB7UOhZ8n7tjkVGkgqLNnuw2OBb-brzKzZAR4DYT1k9KPXs/root:","siteId":"1099e315-d0c7-47c7-8640-aa9504b70fff"},"webUrl":"https://ymt6d.sharepoint.com/sites/OPTest/Marcello%20VCR/data","fileSystemInfo":{"createdDateTime":"2025-04-07T12:02:26Z","lastModifiedDateTime":"2025-04-07T12:02:26Z"},"folder":{"childCount":0},"size":0},{"@odata.etag":"\"{992C5835-AA54-4B71-B3AF-197B1F4578E8},1\"","createdBy":{"user":{"email":"[email protected]","id":"5b5a7dc4-4539-41ba-9fa9-100f0a26acb7","displayName":"Eric+ Schubert"}},"id":"01ANJ53WZVLAWJSVFKOFF3HLYZPMPUK6HI","lastModifiedBy":{"user":{"email":"[email protected]","id":"5b5a7dc4-4539-41ba-9fa9-100f0a26acb7","displayName":"Eric+ Schubert"}},"name":"simply_oidc.jpg","parentReference":{"driveType":"documentLibrary","driveId":"b!dmVLG22QlE2PSW0AqVB7UOhZ8n7tjkVGkgqLNnuw2OBb-brzKzZAR4DYT1k9KPXs","id":"01ANJ53W56Y2GOVW7725BZO354PWSELRRZ","name":"Marcello+ VCR","path":"/drives/b!dmVLG22QlE2PSW0AqVB7UOhZ8n7tjkVGkgqLNnuw2OBb-brzKzZAR4DYT1k9KPXs/root:","siteId":"1099e315-d0c7-47c7-8640-aa9504b70fff"},"webUrl":"https://ymt6d.sharepoint.com/sites/OPTest/Marcello%20VCR/simply_oidc.jpg","file":{"hashes":{"quickXorHash":"qzqT/ZJgJnvhu77aF+2RcdH62Sc="},"mimeType":"image/jpeg"},"fileSystemInfo":{"createdDateTime":"2025-04-07T12:02:42Z","lastModifiedDateTime":"2025-04-07T12:02:42Z"},"size":56483}]}'+ recorded_at: Tue, 05 Aug 2025 13:20:20 GMT+recorded_with: VCR 6.3.1diff --git a/modules/storages/spec/support/fixtures/vcr_cassettes/share_point/user_query_success.yml b/modules/storages/spec/support/fixtures/vcr_cassettes/share_point/user_query_success.ymlnew file mode 100644index 00000000000..309518fe217--- /dev/null+++ b/modules/storages/spec/support/fixtures/vcr_cassettes/share_point/user_query_success.yml@@ -0,0 +1,50 @@+---+http_interactions:+- request:+ method: get+ uri: https://graph.microsoft.com/v1.0/me+ body:+ encoding: US-ASCII+ string: ''+ headers:+ Authorization:+ - Bearer <BEARER TOKEN>+ User-Agent:+ - httpx.rb/1.4.0+ Accept:+ - "*/*"+ Accept-Encoding:+ - gzip, deflate+ response:+ status:+ code: 200+ message: OK+ headers:+ Cache-Control:+ - no-cache+ Content-Type:+ - application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8+ Content-Encoding:+ - gzip+ Vary:+ - Accept-Encoding+ Strict-Transport-Security:+ - max-age=31536000+ Request-Id:+ - cd945df0-d5ae-4364-b92e-e660f2d8692f+ Client-Request-Id:+ - cd945df0-d5ae-4364-b92e-e660f2d8692f+ X-Ms-Ags-Diagnostic:+ - '{"ServerInfo":{"DataCenter":"Germany West Central","Slice":"E","Ring":"4","ScaleUnit":"002","RoleInstance":"FR3PEPF000009EA"}}'+ X-Ms-Resource-Unit:+ - '1'+ Odata-Version:+ - '4.0'+ Date:+ - Wed, 12 Feb 2025 08:43:54 GMT+ body:+ encoding: UTF-8+ string: '{"@odata.context":"https://graph.microsoft.com/v1.0/$metadata#users/$entity","businessPhones":[],"displayName":"OP+ Member","givenName":"OP","jobTitle":null,"mail":"[email protected]","mobilePhone":null,"officeLocation":null,"preferredLanguage":null,"surname":"Member","userPrincipalName":"[email protected]","id":"a9023fd0-c421-4695-b83c-bb3ba67708d6"}'+ recorded_at: Wed, 12 Feb 2025 08:43:54 GMT+recorded_with: VCR 6.3.1diff --git a/modules/storages/spec/support/fixtures/vcr_cassettes/share_point/validation_absurd_tenant_id.yml b/modules/storages/spec/support/fixtures/vcr_cassettes/share_point/validation_absurd_tenant_id.ymlnew file mode 100644index 00000000000..10ae73176cf--- /dev/null+++ b/modules/storages/spec/support/fixtures/vcr_cassettes/share_point/validation_absurd_tenant_id.yml@@ -0,0 +1,71 @@+---+http_interactions:+- request:+ method: post+ uri: https://login.microsoftonline.com/wrong/oauth2/v2.0/token+ body:+ encoding: ASCII-8BIT+ string: grant_type=client_credentials&scope=https%3A%2F%2Fgraph.microsoft.com%2F.default+offline_access&client_id=MISSING_SHARE_POINT_TEST_OAUTH_CLIENT_ID&client_secret=MISSING_SHARE_POINT_TEST_OAUTH_CLIENT_SECRET+ headers:+ User-Agent:+ - httpx.rb/1.3.4+ Accept:+ - "*/*"+ Accept-Encoding:+ - gzip, deflate+ Content-Type:+ - application/x-www-form-urlencoded+ Content-Length:+ - '205'+ 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:+ - 0d8e094d-bf49-42ad-8b6e-677ece661300+ X-Ms-Ests-Server:+ - 2.1.21470.11 - WEULR1 ProdSlices+ X-Ms-Srs:+ - 1.P+ Content-Security-Policy-Report-Only:+ - object-src 'none'; base-uri 'self'; script-src 'self' 'nonce-HKi3EGElocyMfDLvNKm_gQ'+ 'unsafe-inline' 'unsafe-eval' https://*.msauth.net https://*.msftauth.net+ https://*.msftauthimages.net https://*.msauthimages.net https://*.msidentity.com+ https://*.microsoftonline-p.com https://*.microsoftazuread-sso.com https://*.azureedge.net+ https://*.outlook.com https://*.office.com https://*.office365.com https://*.microsoft.com+ https://*.bing.com 'report-sample'; report-uri https://csp.microsoft.com/report/ESTS-UX-All+ X-Xss-Protection:+ - '0'+ Set-Cookie:+ - fpc=AitILJrTjEBLlVgOsH3ITlc; expires=Thu, 04-Sep-2025 10:04:27 GMT; path=/;+ secure; HttpOnly; SameSite=None, x-ms-gateway-slice=estsfd; path=/; secure;+ samesite=none; httponly, stsservicecookie=estsfd; path=/; secure; samesite=none;+ httponly+ Date:+ - Tue, 05 Aug 2025 10:04:27 GMT+ Content-Length:+ - '519'+ body:+ encoding: UTF-8+ string: '{"error":"invalid_request","error_description":"AADSTS900023: Specified+ tenant identifier ''wrong'' is neither a valid DNS name, nor a valid external+ domain. Trace ID: 0d8e094d-bf49-42ad-8b6e-677ece661300 Correlation ID: 44e3e981-e91a-428d-9583-b7cb9d6a7722+ Timestamp: 2025-08-05 10:04:27Z","error_codes":[900023],"timestamp":"2025-08-05+ 10:04:27Z","trace_id":"0d8e094d-bf49-42ad-8b6e-677ece661300","correlation_id":"44e3e981-e91a-428d-9583-b7cb9d6a7722","error_uri":"https://login.microsoftonline.com/error?code=900023"}'+ recorded_at: Tue, 05 Aug 2025 10:04:27 GMT+recorded_with: VCR 6.3.1diff --git a/modules/storages/spec/support/fixtures/vcr_cassettes/share_point/validation_wrong_client_id.yml b/modules/storages/spec/support/fixtures/vcr_cassettes/share_point/validation_wrong_client_id.ymlnew file mode 100644index 00000000000..f1dffadc619--- /dev/null+++ b/modules/storages/spec/support/fixtures/vcr_cassettes/share_point/validation_wrong_client_id.yml@@ -0,0 +1,73 @@+---+http_interactions:+- request:+ method: post+ uri: https://login.microsoftonline.com/e36f1dbc-fdae-427e-b61b-0d96ddfb81a4/oauth2/v2.0/token+ body:+ encoding: ASCII-8BIT+ string: grant_type=client_credentials&scope=https%3A%2F%2Fgraph.microsoft.com%2F.default+offline_access&client_id=wrong&client_secret=MISSING_SHARE_POINT_TEST_OAUTH_CLIENT_SECRET+ headers:+ User-Agent:+ - httpx.rb/1.3.4+ Accept:+ - "*/*"+ Accept-Encoding:+ - gzip, deflate+ Content-Type:+ - application/x-www-form-urlencoded+ Content-Length:+ - '170'+ 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:+ - b9b5e557-3dd1-4dc4-9e59-5e74874a6d00+ X-Ms-Ests-Server:+ - 2.1.21415.9 - WEULR1 ProdSlices+ X-Ms-Srs:+ - 1.P+ Content-Security-Policy-Report-Only:+ - object-src 'none'; base-uri 'self'; script-src 'self' 'nonce-jBhpk_0765VVucQFbOM0LQ'+ 'unsafe-inline' 'unsafe-eval' https://*.msauth.net https://*.msftauth.net+ https://*.msftauthimages.net https://*.msauthimages.net https://*.msidentity.com+ https://*.microsoftonline-p.com https://*.microsoftazuread-sso.com https://*.azureedge.net+ https://*.outlook.com https://*.office.com https://*.office365.com https://*.microsoft.com+ https://*.bing.com 'report-sample'; report-uri https://csp.microsoft.com/report/ESTS-UX-All+ X-Xss-Protection:+ - '0'+ Set-Cookie:+ - fpc=AnT_CCHlhq5DrGfLgYOcDn9kaFwcAQAAACvOI-AOAAAA; expires=Thu, 04-Sep-2025+ 10:04:28 GMT; path=/; secure; HttpOnly; SameSite=None, x-ms-gateway-slice=estsfd;+ path=/; secure; samesite=none; httponly, stsservicecookie=estsfd; path=/;+ secure; samesite=none; httponly+ Date:+ - Tue, 05 Aug 2025 10:04:28 GMT+ Content-Length:+ - '707'+ body:+ encoding: UTF-8+ string: '{"error":"unauthorized_client","error_description":"AADSTS700016: Application+ with identifier ''wrong'' was not found in the directory ''MSFT''. 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: b9b5e557-3dd1-4dc4-9e59-5e74874a6d00+ Correlation ID: d0596f2e-6188-4936-b844-41d86bc0a099 Timestamp: 2025-08-05+ 10:04:28Z","error_codes":[700016],"timestamp":"2025-08-05 10:04:28Z","trace_id":"b9b5e557-3dd1-4dc4-9e59-5e74874a6d00","correlation_id":"d0596f2e-6188-4936-b844-41d86bc0a099","error_uri":"https://login.microsoftonline.com/error?code=700016"}'+ recorded_at: Tue, 05 Aug 2025 10:04:28 GMT+recorded_with: VCR 6.3.1diff --git a/modules/storages/spec/support/fixtures/vcr_cassettes/share_point/validation_wrong_client_secret.yml b/modules/storages/spec/support/fixtures/vcr_cassettes/share_point/validation_wrong_client_secret.ymlnew file mode 100644index 00000000000..0f0efab7673--- /dev/null+++ b/modules/storages/spec/support/fixtures/vcr_cassettes/share_point/validation_wrong_client_secret.yml@@ -0,0 +1,72 @@+---+http_interactions:+- request:+ method: post+ uri: https://login.microsoftonline.com/e36f1dbc-fdae-427e-b61b-0d96ddfb81a4/oauth2/v2.0/token+ body:+ encoding: ASCII-8BIT+ string: grant_type=client_credentials&scope=https%3A%2F%2Fgraph.microsoft.com%2F.default+offline_access&client_id=b8a5bb54-5fb2-4e0e-9427-9d24dbac32ff&client_secret=wrong+ headers:+ User-Agent:+ - httpx.rb/1.3.4+ Accept:+ - "*/*"+ Accept-Encoding:+ - gzip, deflate+ Content-Type:+ - application/x-www-form-urlencoded+ Content-Length:+ - '166'+ 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:+ - a6f0383f-bbcb-48f5-a08d-36a574b40d00+ X-Ms-Ests-Server:+ - 2.1.20465.4 - WEULR1 ProdSlices+ X-Ms-Srs:+ - 1.P+ Content-Security-Policy-Report-Only:+ - object-src 'none'; base-uri 'self'; script-src 'self' 'nonce-qNTRKH43OU5V1dsSJzZDuQ'+ 'unsafe-inline' 'unsafe-eval' https://*.msauth.net https://*.msftauth.net+ https://*.msftauthimages.net https://*.msauthimages.net https://*.msidentity.com+ https://*.microsoftonline-p.com https://*.microsoftazuread-sso.com https://*.azureedge.net+ https://*.outlook.com https://*.office.com https://*.office365.com https://*.microsoft.com+ https://*.bing.com 'report-sample'; report-uri https://csp.microsoft.com/report/ESTS-UX-All+ X-Xss-Protection:+ - '0'+ Set-Cookie:+ - fpc=AsH2DTOUkrFPnjpcckwANXxRVKK0AQAAAMnIhd8OAAAA; expires=Wed, 07-May-2025+ 13:23:21 GMT; path=/; secure; HttpOnly; SameSite=None, x-ms-gateway-slice=estsfd;+ path=/; secure; samesite=none; httponly, stsservicecookie=estsfd; path=/;+ secure; samesite=none; httponly+ Date:+ - Mon, 07 Apr 2025 13:23:21 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 ''b8a5bb54-5fb2-4e0e-9427-9d24dbac32ff''.+ Trace ID: a6f0383f-bbcb-48f5-a08d-36a574b40d00 Correlation ID: 80ce0729-9980-4683-a4f8-39cfd3e9c96c+ Timestamp: 2025-04-07 13:23:21Z","error_codes":[7000215],"timestamp":"2025-04-07+ 13:23:21Z","trace_id":"a6f0383f-bbcb-48f5-a08d-36a574b40d00","correlation_id":"80ce0729-9980-4683-a4f8-39cfd3e9c96c","error_uri":"https://login.microsoftonline.com/error?code=7000215"}'+ recorded_at: Mon, 07 Apr 2025 13:23:21 GMT+recorded_with: VCR 6.3.1diff --git a/modules/storages/spec/support/fixtures/vcr_cassettes/share_point/validation_wrong_tenant_id.yml b/modules/storages/spec/support/fixtures/vcr_cassettes/share_point/validation_wrong_tenant_id.ymlnew file mode 100644index 00000000000..1d09403965d--- /dev/null+++ b/modules/storages/spec/support/fixtures/vcr_cassettes/share_point/validation_wrong_tenant_id.yml@@ -0,0 +1,73 @@+---+http_interactions:+- request:+ method: post+ uri: https://login.microsoftonline.com/itdoesnotexists9000.sharepoint.com/oauth2/v2.0/token+ body:+ encoding: ASCII-8BIT+ string: grant_type=client_credentials&scope=https%3A%2F%2Fgraph.microsoft.com%2F.default+offline_access&client_id=MISSING_SHARE_POINT_TEST_OAUTH_CLIENT_ID&client_secret=MISSING_SHARE_POINT_TEST_OAUTH_CLIENT_SECRET+ headers:+ User-Agent:+ - httpx.rb/1.3.4+ Accept:+ - "*/*"+ Accept-Encoding:+ - gzip, deflate+ Content-Type:+ - application/x-www-form-urlencoded+ Content-Length:+ - '205'+ 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:+ - 110187b2-d610-48b4-8536-dd201de05b00+ X-Ms-Ests-Server:+ - 2.1.21415.9 - FRC ProdSlices+ X-Ms-Srs:+ - 1.P+ Content-Security-Policy-Report-Only:+ - object-src 'none'; base-uri 'self'; script-src 'self' 'nonce-A816OK4Zcz_SzEDAHsxkJQ'+ 'unsafe-inline' 'unsafe-eval' https://*.msauth.net https://*.msftauth.net+ https://*.msftauthimages.net https://*.msauthimages.net https://*.msidentity.com+ https://*.microsoftonline-p.com https://*.microsoftazuread-sso.com https://*.azureedge.net+ https://*.outlook.com https://*.office.com https://*.office365.com https://*.microsoft.com+ https://*.bing.com 'report-sample'; report-uri https://csp.microsoft.com/report/ESTS-UX-All+ X-Xss-Protection:+ - '0'+ Set-Cookie:+ - fpc=ApoB-EekEgBFt8IMWQ8Hj0hkMvydAQAAAO3NI-AOAAAA; expires=Thu, 04-Sep-2025+ 10:03:25 GMT; path=/; secure; HttpOnly; SameSite=None, x-ms-gateway-slice=estsfd;+ path=/; secure; samesite=none; httponly, stsservicecookie=estsfd; path=/;+ secure; samesite=none; httponly+ Date:+ - Tue, 05 Aug 2025 10:03:24 GMT+ Content-Length:+ - '680'+ body:+ encoding: UTF-8+ string: '{"error":"invalid_request","error_description":"AADSTS90002: Tenant+ ''itdoesnotexists9000.sharepoint.com'' not found. Check to make sure you have+ the correct tenant ID and are signing into the correct cloud. Check with your+ subscription administrator, this may happen if there are no active subscriptions+ for the tenant. Trace ID: 110187b2-d610-48b4-8536-dd201de05b00 Correlation+ ID: 83a0cf0e-413f-4170-b63d-1c4ebd9d5069 Timestamp: 2025-08-05 10:03:25Z","error_codes":[90002],"timestamp":"2025-08-05+ 10:03:25Z","trace_id":"110187b2-d610-48b4-8536-dd201de05b00","correlation_id":"83a0cf0e-413f-4170-b63d-1c4ebd9d5069","error_uri":"https://login.microsoftonline.com/error?code=90002"}'+ recorded_at: Tue, 05 Aug 2025 10:03:25 GMT+recorded_with: VCR 6.3.1