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
[#61178] Replace AuthCheckQuery with UserQuery.
Pavel Balashoua48813f2a801
diff --git a/app/models/oauth_client.rb b/app/models/oauth_client.rbindex 3b25763d6b0..60b01ed552f 100644--- a/app/models/oauth_client.rb+++ b/app/models/oauth_client.rb@@ -1,3 +1,5 @@+# frozen_string_literal: true+#-- copyright# OpenProject is an open source project management software.# Copyright (C) the OpenProject GmbH@@ -29,6 +31,7 @@class OAuthClient < ApplicationRecordbelongs_to :integration, polymorphic: truehas_many :remote_identities, dependent: :destroy+ has_many :oauth_client_tokens, dependent: :destroydef redirect_uriFile.join(Rails.application.root_url, "oauth_clients", client_id, "callback")diff --git a/app/services/oauth_clients/connection_manager.rb b/app/services/oauth_clients/connection_manager.rbindex e1faa40dd4e..e18b5b5ff59 100644--- a/app/services/oauth_clients/connection_manager.rb+++ b/app/services/oauth_clients/connection_manager.rb@@ -103,14 +103,24 @@ module OAuthClientselserack_access_token = service_result.resultOAuthClientToken.transaction do- oauth_client_token = create_client_token(rack_access_token)-+ oauth_client_token = OAuthClientToken.new(+ user: @user,+ oauth_client: @oauth_client,+ access_token: rack_access_token.access_token,+ token_type: rack_access_token.token_type, # :bearer+ refresh_token: rack_access_token.refresh_token,+ expires_in: rack_access_token.raw_attributes[:expires_in],+ scope: rack_access_token.scope+ )oauth_client_token.save!- RemoteIdentities::CreateService.call(user: @user, oauth_config: @config, oauth_token: rack_access_token)- .on_failure { raise ActiveRecord::Rollback }++ RemoteIdentities::CreateService+ .call(user: @user, oauth_config: @config, oauth_client_token:)+ .on_failure { raise ActiveRecord::Rollback }end- ServiceResult.new(success: oauth_client_token.errors.empty?, result: oauth_client_token,+ ServiceResult.new(success: oauth_client_token.errors.empty?,+ result: oauth_client_token,errors: oauth_client_token.errors)endend@@ -136,20 +146,6 @@ module OAuthClientsprivate- # @param rack_access_token [Rack::OAuth2::Token] - rack token to be used as a base- # @return [OAuthClientToken]- def create_client_token(rack_access_token)- OAuthClientToken.new(- user: @user,- oauth_client: @oauth_client,- access_token: rack_access_token.access_token,- token_type: rack_access_token.token_type, # :bearer- refresh_token: rack_access_token.refresh_token,- expires_in: rack_access_token.raw_attributes[:expires_in],- scope: rack_access_token.scope- )- end-# Check if a OAuthClientToken already exists and return nil otherwise.# Don't handle the case of an expired token.def get_existing_tokendiff --git a/app/services/remote_identities/create_service.rb b/app/services/remote_identities/create_service.rbindex 21d3dae439d..3542a8f9925 100644--- a/app/services/remote_identities/create_service.rb+++ b/app/services/remote_identities/create_service.rb@@ -1,3 +1,5 @@+# frozen_string_literal: true+#-- copyright# OpenProject is an open source project management software.# Copyright (C) the OpenProject GmbH@@ -30,21 +32,21 @@ module RemoteIdentitiesclass CreateServiceattr_reader :user, :model- def self.call(user:, oauth_config:, oauth_token:)- new(user:, oauth_config:, oauth_token:).call+ def self.call(user:, oauth_config:, oauth_client_token:)+ new(user:, oauth_config:, oauth_client_token:).callend- def initialize(user:, oauth_config:, oauth_token:)+ def initialize(user:, oauth_config:, oauth_client_token:)@user = user@oauth_config = oauth_config- @oauth_token = oauth_token+ @oauth_client_token = oauth_client_token@model = RemoteIdentity.find_or_initialize_by(user:, oauth_client: oauth_config.oauth_client)@result = ServiceResult.success(result: @model, errors: @model.errors)enddef call- @model.origin_user_id = @oauth_config.extract_origin_user_id(@oauth_token)+ @model.origin_user_id = @oauth_config.extract_origin_user_id(@oauth_client_token)if @model.saveemit_event(@oauth_config.oauth_client.integration)elsediff --git a/modules/storages/app/common/storages/peripherals/nextcloud_registry.rb b/modules/storages/app/common/storages/peripherals/nextcloud_registry.rbindex 29fd50b82a9..4bb5d62a25b 100644--- a/modules/storages/app/common/storages/peripherals/nextcloud_registry.rb+++ b/modules/storages/app/common/storages/peripherals/nextcloud_registry.rb@@ -32,7 +32,7 @@ module Storagesmodule PeripheralsNextcloudRegistry = Dry::Container::Namespace.new("nextcloud") donamespace("queries") do- register(:auth_check, StorageInteraction::Nextcloud::AuthCheckQuery)+ register(:user, StorageInteraction::Nextcloud::UserQuery)register(:capabilities, StorageInteraction::Nextcloud::CapabilitiesQuery)register(:download_link, StorageInteraction::Nextcloud::DownloadLinkQuery)register(:file_info, StorageInteraction::Nextcloud::FileInfoQuery)diff --git a/modules/storages/app/common/storages/peripherals/oauth_configurations/configuration_interface.rb b/modules/storages/app/common/storages/peripherals/oauth_configurations/configuration_interface.rbindex 64cb2bb73ed..699f3da46aa 100644--- a/modules/storages/app/common/storages/peripherals/oauth_configurations/configuration_interface.rb+++ b/modules/storages/app/common/storages/peripherals/oauth_configurations/configuration_interface.rb@@ -32,6 +32,8 @@ module Storagesmodule Peripheralsmodule OAuthConfigurationsclass ConfigurationInterface+ using ServiceResultRefinements+def scope = raise ::Storages::Errors::SubclassResponsibilitydef basic_rack_oauth_client = raise ::Storages::Errors::SubclassResponsibility@@ -41,6 +43,21 @@ module Storagesdef authorization_uri(state: nil)basic_rack_oauth_client.authorization_uri(scope:, state:)end++ def extract_origin_user_id(oauth_client_token)+ auth_strategy = Registry+ .resolve("#{storage_name}.authentication.user_bound")+ .call(user: oauth_client_token.user)+ Registry+ .resolve("#{storage_name}.queries.user")+ .call(auth_strategy:, storage: @storage)+ .match(+ on_success: ->(user) { user[:id] },+ on_failure: ->(error) { raise "UserQuery responed with #{error}" }+ )+ end++ def storage_name = raise ::Storages::Errors::SubclassResponsibilityendendenddiff --git a/modules/storages/app/common/storages/peripherals/oauth_configurations/nextcloud_configuration.rb b/modules/storages/app/common/storages/peripherals/oauth_configurations/nextcloud_configuration.rbindex b46cf60c353..bab25bd16e0 100644--- a/modules/storages/app/common/storages/peripherals/oauth_configurations/nextcloud_configuration.rb+++ b/modules/storages/app/common/storages/peripherals/oauth_configurations/nextcloud_configuration.rb@@ -47,8 +47,8 @@ module Storages# rubocop:enable Lint/MissingSuper- def extract_origin_user_id(rack_access_token)- rack_access_token.raw_attributes[:user_id]+ def storage_name+ "nextcloud"enddef to_httpx_oauth_configdiff --git a/modules/storages/app/common/storages/peripherals/oauth_configurations/one_drive_configuration.rb b/modules/storages/app/common/storages/peripherals/oauth_configurations/one_drive_configuration.rbindex 6fd9dfbed7e..2a274685f2f 100644--- a/modules/storages/app/common/storages/peripherals/oauth_configurations/one_drive_configuration.rb+++ b/modules/storages/app/common/storages/peripherals/oauth_configurations/one_drive_configuration.rb@@ -51,11 +51,8 @@ module Storages# rubocop:enable Lint/MissingSuper- def extract_origin_user_id(rack_access_token)- OpenProject.httpx.get(- UrlBuilder.url(@storage.uri, "/v1.0/me"),- headers: { "Authorization" => "Bearer #{rack_access_token.access_token}", "Accept" => "application/json" }- ).raise_for_status.json["id"]+ def storage_name+ "one_drive"enddef to_httpx_oauth_configdiff --git a/modules/storages/app/common/storages/peripherals/one_drive_registry.rb b/modules/storages/app/common/storages/peripherals/one_drive_registry.rbindex 5b4cd94b1d3..35547090b28 100644--- a/modules/storages/app/common/storages/peripherals/one_drive_registry.rb+++ b/modules/storages/app/common/storages/peripherals/one_drive_registry.rb@@ -32,7 +32,7 @@ module Storagesmodule PeripheralsOneDriveRegistry = Dry::Container::Namespace.new("one_drive") donamespace("queries") do- register(:auth_check, StorageInteraction::OneDrive::AuthCheckQuery)+ register(:user, StorageInteraction::OneDrive::UserQuery)register(:download_link, StorageInteraction::OneDrive::DownloadLinkQuery)register(:files, StorageInteraction::OneDrive::FilesQuery)register(:file_info, StorageInteraction::OneDrive::FileInfoQuery)diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/authentication.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/authentication.rbindex 34650890de2..9595353b8ab 100644--- a/modules/storages/app/common/storages/peripherals/storage_interaction/authentication.rb+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/authentication.rb@@ -62,7 +62,7 @@ module Storagesauth_strategy = AuthenticationStrategies::OAuthUserToken.strategy.with_user(user)Registry- .resolve("#{storage}.queries.auth_check")+ .resolve("#{storage}.queries.user").call(storage:, auth_strategy:).match(on_success: ->(*) { :connected },diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/auth_check_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/user_query.rbsimilarity index 77%rename from modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/auth_check_query.rbrename to modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/user_query.rbindex 3749cb095ce..edfb52df00c 100644--- a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/auth_check_query.rb+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/user_query.rb@@ -32,7 +32,7 @@ module Storagesmodule Peripheralsmodule StorageInteractionmodule Nextcloud- class AuthCheckQuery+ class UserQueryusing ServiceResultRefinementsdef self.call(storage:, auth_strategy:)@@ -45,7 +45,7 @@ module Storagesdef call(auth_strategy:)Authentication[auth_strategy].call(storage: @storage, http_options: Util.ocs_api_request) do |http|- handle_response http.get(UrlBuilder.url(@storage.uri, "/ocs/v1.php/cloud/user"))+ handle_response(http.get(UrlBuilder.url(@storage.uri, "/ocs/v1.php/cloud/user")))endend@@ -54,7 +54,7 @@ module Storagesdef handle_response(response)case responsein { status: 200..299 }- ServiceResult.success+ handle_success_response(response)in { status: 401 }ServiceResult.failure(result: :unauthorized, errors: StorageError.new(code: :unauthorized))else@@ -62,6 +62,19 @@ module StoragesServiceResult.failure(result: :error, errors: StorageError.new(code: :error, data:))endend++ def handle_success_response(response)+ error_data = StorageErrorData.new(source: self.class, payload: response)+ xml = Nokogiri::XML(response.body.to_s)+ statuscode = xml.xpath("/ocs/meta/statuscode").text++ case statuscode+ when "100"+ ServiceResult.success(result: { id: xml.xpath("/ocs/data/id").text })+ else+ Util.error(:error, "Unknown response body", error_data)+ end+ endendendenddiff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/auth_check_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/user_query.rbsimilarity index 96%rename from modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/auth_check_query.rbrename to modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/user_query.rbindex e2a1d528eb3..3996c20a643 100644--- a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/auth_check_query.rb+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/user_query.rb@@ -32,7 +32,7 @@ module Storagesmodule Peripheralsmodule StorageInteractionmodule OneDrive- class AuthCheckQuery+ class UserQuerydef self.call(storage:, auth_strategy:)new(storage).call(auth_strategy:)end@@ -52,7 +52,7 @@ module Storagesdef handle_response(response)case responsein { status: 200..299 }- ServiceResult.success+ ServiceResult.success(result: { id: response.json["id"] })in { status: 401 }ServiceResult.failure(result: :unauthorized, errors: StorageError.new(code: :unauthorized))in { status: 403 }diff --git a/modules/storages/spec/common/storages/peripherals/storage_interaction/nextcloud/user_query_spec.rb b/modules/storages/spec/common/storages/peripherals/storage_interaction/nextcloud/user_query_spec.rbnew file mode 100644index 00000000000..a2a551db258--- /dev/null+++ b/modules/storages/spec/common/storages/peripherals/storage_interaction/nextcloud/user_query_spec.rb@@ -0,0 +1,74 @@+# 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.+#++++require "spec_helper"+require_module_spec_helper++RSpec.describe Storages::Peripherals::StorageInteraction::Nextcloud::UserQuery, :webmock do+ let(:user) { create(:user) }+ # let(:storage) do+ # create(:nextcloud_storage_with_local_connection, :as_not_automatically_managed, oauth_client_token_user: user)+ # end+ let(:storage) do+ create(:nextcloud_storage_with_local_connection,+ :as_automatically_managed,+ username: "vcr",+ oauth_client_token_user: user)+ end+ let(:userless_strategy) { Storages::Peripherals::Registry.resolve("nextcloud.authentication.userless").call }+ let(:user_bound_strategy) { Storages::Peripherals::Registry.resolve("nextcloud.authentication.user_bound").call(user:) }++ it "is registered as queries.group_users" do+ expect(Storages::Peripherals::Registry+ .resolve("#{storage}.queries.user")).to eq(described_class)+ end++ it "responds to #call with correct parameters" do+ expect(described_class).to respond_to(:call)++ method = described_class.method(:call)+ expect(method.parameters).to contain_exactly(%i[keyreq storage],+ %i[keyreq auth_strategy])+ end++ it "responds with failure with invalid token", vcr: "nextcloud/user_query_unauthorized" do+ result = described_class.call(storage:, auth_strategy: userless_strategy)++ expect(result).to be_failure+ expect(result.result).to eq(:unauthorized)+ end++ it "responds with success with valid token", vcr: "nextcloud/user_query_success" do+ result = described_class.call(storage:, auth_strategy: user_bound_strategy)++ expect(result).to be_success+ expect(result.result).to eq(id: "admin")+ end+enddiff --git a/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/user_query_spec.rb b/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/user_query_spec.rbnew file mode 100644index 00000000000..9bac434c6d1--- /dev/null+++ b/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/user_query_spec.rb@@ -0,0 +1,71 @@+# 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.+#++++require "spec_helper"+require_module_spec_helper++RSpec.describe Storages::Peripherals::StorageInteraction::OneDrive::UserQuery, :webmock do+ let(:storage) do+ create(:sharepoint_dev_drive_storage,+ oauth_client_token_user: user)+ end+ let(:user) { create(:user) }+ let(:user_bound_strategy) { Storages::Peripherals::Registry.resolve("one_drive.authentication.user_bound").call(user:) }+ let(:auth_strategy) { user_bound_strategy }++ it "is registered" do+ expect(Storages::Peripherals::Registry.resolve("one_drive.queries.user")).to eq(described_class)+ end++ it "responds to .call" do+ expect(described_class).to respond_to(:call)+ end++ it ".call takes required parameters" do+ method = described_class.method(:call)++ expect(method.parameters).to contain_exactly(%i[keyreq auth_strategy],+ %i[keyreq storage])+ end++ it "responds with user details if request is successful", vcr: "one_drive/user_query_success" do+ command_result = described_class.call(auth_strategy:, storage:)++ expect(command_result).to be_success+ expect(command_result.result).to eq(id: "a9023fd0-c421-4695-b83c-bb3ba67708d6")+ end++ it "responds with unauthorized if request is unauthorized", vcr: "one_drive/user_query_unauthorized" do+ command_result = described_class.call(auth_strategy:, storage:)++ expect(command_result).to be_failure+ expect(command_result.result).to eq(:unauthorized)+ end+enddiff --git a/modules/storages/spec/features/create_file_links_spec.rb b/modules/storages/spec/features/create_file_links_spec.rbindex 5dac613cef5..c16a9d41cff 100644--- a/modules/storages/spec/features/create_file_links_spec.rb+++ b/modules/storages/spec/features/create_file_links_spec.rb@@ -63,7 +63,7 @@ RSpec.describe "Managing file links in work package", :js, :webmock doallow(Storages::FileLinkSyncService).to receive(:new).and_return(sync_service)Storages::Peripherals::Registry.stub(- "#{storage}.queries.auth_check",+ "#{storage}.queries.user",->(_) { ServiceResult.success })diff --git a/modules/storages/spec/features/show_file_links_spec.rb b/modules/storages/spec/features/show_file_links_spec.rbindex 74562ff1520..22be1d91cc7 100644--- a/modules/storages/spec/features/show_file_links_spec.rb+++ b/modules/storages/spec/features/show_file_links_spec.rb@@ -49,7 +49,7 @@ RSpec.describe "Showing of file links in work package", :js dobefore doStorages::Peripherals::Registry.stub(- "#{storage}.queries.auth_check",+ "#{storage}.queries.user",->(_) { authorization_state })diff --git a/modules/storages/spec/lib/api/v3/storages/storages_representer_rendering_spec.rb b/modules/storages/spec/lib/api/v3/storages/storages_representer_rendering_spec.rbindex ffc4b5ab7be..1126f2300c5 100644--- a/modules/storages/spec/lib/api/v3/storages/storages_representer_rendering_spec.rb+++ b/modules/storages/spec/lib/api/v3/storages/storages_representer_rendering_spec.rb@@ -41,7 +41,7 @@ RSpec.describe API::V3::Storages::StorageRepresenter, "rendering" dobefore doStorages::Peripherals::Registry.stub(- "#{storage}.queries.auth_check",+ "#{storage}.queries.user",->(_) { auth_check_result })enddiff --git a/modules/storages/spec/requests/api/v3/storages/storages_api_spec.rb b/modules/storages/spec/requests/api/v3/storages/storages_api_spec.rbindex e964dc79082..844a1a3d8db 100644--- a/modules/storages/spec/requests/api/v3/storages/storages_api_spec.rb+++ b/modules/storages/spec/requests/api/v3/storages/storages_api_spec.rb@@ -1,3 +1,5 @@+# frozen_string_literal: true+#-- copyright# OpenProject is an open source project management software.# Copyright (C) the OpenProject GmbH@@ -53,7 +55,7 @@ RSpec.describe "API v3 storages resource", :webmock, content_type: :json doendbefore do- Storages::Peripherals::Registry.stub("nextcloud.queries.auth_check", ->(_) { auth_check_result })+ Storages::Peripherals::Registry.stub("nextcloud.queries.user", ->(_) { auth_check_result })login_as current_userenddiff --git a/modules/storages/spec/requests/storages/project_settings/oauth_access_grant_flow_spec.rb b/modules/storages/spec/requests/storages/project_settings/oauth_access_grant_flow_spec.rbindex b647cf18df9..ded566ee71e 100644--- a/modules/storages/spec/requests/storages/project_settings/oauth_access_grant_flow_spec.rb+++ b/modules/storages/spec/requests/storages/project_settings/oauth_access_grant_flow_spec.rb@@ -1,3 +1,5 @@+# frozen_string_literal: true+#-- copyright# OpenProject is an open source project management software.# Copyright (C) the OpenProject GmbH@@ -94,7 +96,7 @@ RSpec.describe "GET /projects/:project_id/settings/project_storages/:id/oauth_acshared_let(:oauth_client_token) { create(:oauth_client_token, oauth_client: storage.oauth_client, user:) }before do- Storages::Peripherals::Registry.stub("nextcloud.queries.auth_check", ->(_) { ServiceResult.success })+ Storages::Peripherals::Registry.stub("nextcloud.queries.user", ->(_) { ServiceResult.success })endit "redirects to destination_url" dodiff --git a/modules/storages/spec/support/fixtures/vcr_cassettes/nextcloud/user_query_success.yml b/modules/storages/spec/support/fixtures/vcr_cassettes/nextcloud/user_query_success.ymlnew file mode 100644index 00000000000..e9913287401--- /dev/null+++ b/modules/storages/spec/support/fixtures/vcr_cassettes/nextcloud/user_query_success.yml@@ -0,0 +1,146 @@+---+http_interactions:+- request:+ method: get+ uri: https://nextcloud.local/ocs/v1.php/cloud/user+ body:+ encoding: US-ASCII+ string: ''+ headers:+ Ocs-Apirequest:+ - 'true'+ Authorization:+ - Bearer <BEARER TOKEN>+ User-Agent:+ - httpx.rb/1.4.0+ Accept:+ - "*/*"+ Accept-Encoding:+ - gzip, deflate+ response:+ status:+ code: 200+ message: OK+ headers:+ Access-Control-Allow-Credentials:+ - 'true'+ 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/xml; charset=utf-8+ Date:+ - Tue, 11 Feb 2025 09:58:54 GMT+ Feature-Policy:+ - autoplay 'none';camera 'none';fullscreen 'none';geolocation 'none';microphone+ 'none';payment 'none'+ Referrer-Policy:+ - no-referrer+ Server:+ - Apache/2.4.62 (Debian)+ Set-Cookie:+ - oci9gtsdjpci=f09bbad85eaf6bb3225b29ecc12c883e; path=/; secure; HttpOnly; SameSite=Lax,+ oc_sessionPassphrase=HpK4zuI%2BdLbggwoH6McyIHJwAuzb7sEqsH06hIJROE8v1dNbS%2Fy1RI%2Ff7HTp34se0B1zt1e9Bo7vx2BkBQnWe0n1m5Q3Zdbb4k3E4fA%2FjN89XRXCbHgoIVM1IeABa66S;+ path=/; secure; HttpOnly; SameSite=Lax, oci9gtsdjpci=f09bbad85eaf6bb3225b29ecc12c883e;+ 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, oci9gtsdjpci=f09bbad85eaf6bb3225b29ecc12c883e;+ path=/; secure; HttpOnly; SameSite=Lax, oci9gtsdjpci=f09bbad85eaf6bb3225b29ecc12c883e;+ path=/; secure; HttpOnly; SameSite=Lax, oci9gtsdjpci=f09bbad85eaf6bb3225b29ecc12c883e;+ path=/; secure; HttpOnly; SameSite=Lax, oci9gtsdjpci=f09bbad85eaf6bb3225b29ecc12c883e;+ path=/; secure; HttpOnly; SameSite=Lax, oci9gtsdjpci=f09bbad85eaf6bb3225b29ecc12c883e;+ path=/; secure; HttpOnly; SameSite=Lax, oci9gtsdjpci=f09bbad85eaf6bb3225b29ecc12c883e;+ path=/; secure; HttpOnly; SameSite=Lax, oci9gtsdjpci=f09bbad85eaf6bb3225b29ecc12c883e;+ path=/; secure; HttpOnly; SameSite=Lax+ Vary:+ - Origin+ X-Content-Type-Options:+ - nosniff+ X-Frame-Options:+ - SAMEORIGIN+ X-Permitted-Cross-Domain-Policies:+ - none+ X-Powered-By:+ - PHP/8.2.27+ X-Request-Id:+ - MisuHidmzYYjL8tBO3ng+ X-Robots-Tag:+ - noindex, nofollow+ X-Xss-Protection:+ - 1; mode=block+ Content-Length:+ - '650'+ body:+ encoding: UTF-8+ string: |+ <?xml version="1.0"?>+ <ocs>+ <meta>+ <status>ok</status>+ <statuscode>100</statuscode>+ <message>OK</message>+ <totalitems></totalitems>+ <itemsperpage></itemsperpage>+ </meta>+ <data>+ <enabled>1</enabled>+ <storageLocation>/var/www/html/data/admin</storageLocation>+ <id>admin</id>+ <lastLogin>1738833138000</lastLogin>+ <backend>Database</backend>+ <subadmin/>+ <quota>+ <free>447793922048</free>+ <used>37754592</used>+ <total>447831676640</total>+ <relative>0.01</relative>+ <quota>-3</quota>+ </quota>+ <manager></manager>+ <avatarScope>v2-federated</avatarScope>+ <email/>+ <emailScope>v2-federated</emailScope>+ <additional_mail/>+ <additional_mailScope/>+ <displayname>admin</displayname>+ <display-name>admin</display-name>+ <displaynameScope>v2-federated</displaynameScope>+ <phone></phone>+ <phoneScope>v2-local</phoneScope>+ <address></address>+ <addressScope>v2-local</addressScope>+ <website></website>+ <websiteScope>v2-local</websiteScope>+ <twitter></twitter>+ <twitterScope>v2-local</twitterScope>+ <fediverse></fediverse>+ <fediverseScope>v2-local</fediverseScope>+ <organisation></organisation>+ <organisationScope>v2-local</organisationScope>+ <role></role>+ <roleScope>v2-local</roleScope>+ <headline></headline>+ <headlineScope>v2-local</headlineScope>+ <biography></biography>+ <biographyScope>v2-local</biographyScope>+ <profile_enabled>1</profile_enabled>+ <profile_enabledScope>v2-local</profile_enabledScope>+ <groups>+ <element>admin</element>+ <element>OpenProject</element>+ </groups>+ <language>en</language>+ <locale></locale>+ <notify_email/>+ <backendCapabilities>+ <setDisplayName>1</setDisplayName>+ <setPassword>1</setPassword>+ </backendCapabilities>+ </data>+ </ocs>+ recorded_at: Tue, 11 Feb 2025 09:58:55 GMT+recorded_with: VCR 6.3.1diff --git a/modules/storages/spec/support/fixtures/vcr_cassettes/nextcloud/user_query_unauthorized.yml b/modules/storages/spec/support/fixtures/vcr_cassettes/nextcloud/user_query_unauthorized.ymlnew file mode 100644index 00000000000..4fd3827d79d--- /dev/null+++ b/modules/storages/spec/support/fixtures/vcr_cassettes/nextcloud/user_query_unauthorized.yml@@ -0,0 +1,84 @@+---+http_interactions:+- request:+ method: get+ uri: https://nextcloud.local/ocs/v1.php/cloud/user+ body:+ encoding: US-ASCII+ string: ''+ headers:+ Ocs-Apirequest:+ - 'true'+ Authorization:+ - Bearer <BEARER TOKEN>+ User-Agent:+ - httpx.rb/1.4.0+ Accept:+ - "*/*"+ Accept-Encoding:+ - gzip, deflate+ response:+ status:+ code: 401+ message: Unauthorized+ headers:+ Access-Control-Allow-Credentials:+ - 'true'+ 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/xml; charset=utf-8+ Date:+ - Tue, 11 Feb 2025 08:56:04 GMT+ Feature-Policy:+ - autoplay 'none';camera 'none';fullscreen 'none';geolocation 'none';microphone+ 'none';payment 'none'+ Referrer-Policy:+ - no-referrer+ Server:+ - Apache/2.4.62 (Debian)+ Set-Cookie:+ - oci9gtsdjpci=6e7c780f6af8bb0d346094b71255ee4b; path=/; secure; HttpOnly; SameSite=Lax,+ oc_sessionPassphrase=n7qCYbFI%2B3TYcpOpD3q9YHxgqtvhBKT5MhfWYS6y7%2FBuJuvyVb2S02AnoMl3gyOy%2FRtjqtOE2E5sQROIqeSLhq1V%2B1XtnGVBp2fO5GUOF7nNxdw113EbgcRlo3SvuUul;+ path=/; secure; HttpOnly; SameSite=Lax, oci9gtsdjpci=6e7c780f6af8bb0d346094b71255ee4b;+ 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, oci9gtsdjpci=6e7c780f6af8bb0d346094b71255ee4b;+ path=/; secure; HttpOnly; SameSite=Lax+ Vary:+ - Origin+ X-Content-Type-Options:+ - nosniff+ X-Frame-Options:+ - SAMEORIGIN+ X-Permitted-Cross-Domain-Policies:+ - none+ X-Powered-By:+ - PHP/8.2.27+ X-Request-Id:+ - NwKLa7eSZZu9COPzO421+ X-Robots-Tag:+ - noindex, nofollow+ X-Xss-Protection:+ - 1; mode=block+ Content-Length:+ - '230'+ body:+ encoding: UTF-8+ string: |+ <?xml version="1.0"?>+ <ocs>+ <meta>+ <status>failure</status>+ <statuscode>997</statuscode>+ <message>Current user is not logged in</message>+ <totalitems></totalitems>+ <itemsperpage></itemsperpage>+ </meta>+ <data/>+ </ocs>+ recorded_at: Tue, 11 Feb 2025 08:56:04 GMT+recorded_with: VCR 6.3.1diff --git a/modules/storages/spec/support/fixtures/vcr_cassettes/one_drive/user_query_success.yml b/modules/storages/spec/support/fixtures/vcr_cassettes/one_drive/user_query_success.ymlnew file mode 100644index 00000000000..309518fe217--- /dev/null+++ b/modules/storages/spec/support/fixtures/vcr_cassettes/one_drive/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/one_drive/user_query_unauthorized.yml b/modules/storages/spec/support/fixtures/vcr_cassettes/one_drive/user_query_unauthorized.ymlnew file mode 100644index 00000000000..1d641c8d33e--- /dev/null+++ b/modules/storages/spec/support/fixtures/vcr_cassettes/one_drive/user_query_unauthorized.yml@@ -0,0 +1,117 @@+---+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: 401+ message: Unauthorized+ headers:+ Content-Type:+ - application/json+ Content-Encoding:+ - gzip+ Vary:+ - Accept-Encoding+ Strict-Transport-Security:+ - max-age=31536000+ Request-Id:+ - 1c749aa9-446f-4fc8-88b8-2e9e471d83d5+ Client-Request-Id:+ - 1c749aa9-446f-4fc8-88b8-2e9e471d83d5+ X-Ms-Ags-Diagnostic:+ - '{"ServerInfo":{"DataCenter":"Germany West Central","Slice":"E","Ring":"4","ScaleUnit":"003","RoleInstance":"FR1PEPF00000C2C"}}'+ Www-Authenticate:+ - Bearer realm="", authorization_uri="https://login.microsoftonline.com/common/oauth2/authorize",+ client_id="00000003-0000-0000-c000-000000000000", PoP realm="", authorization_uri="https://login.microsoftonline.com/common/oauth2/authorize",+ client_id="00000003-0000-0000-c000-000000000000", nonce="eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IjREMzlFRkU5OUIyRDhGRTcyMEQzMTI3MjEzQjU2ODVCNUU5Mjc5Q0QifQ.eyJ0cyI6MTczOTM1MTg4MH0.kt3dPPtjBJx9uWX7_Wq8eYING42nz_qYzinWHZPaRiXdTJrCkmifV2BBTbPFqvqqRCB57ULYs8Qo2g_K1X2VMBFN2uMVS31jN1qPKc0wsGtvTS3sPVddu37o74juPCYT5UMhc-VXT0VjV8eEHxu9XbejVsKOG7YUV4kLqaH2D0cSXEe8n_XlpooT5hEEWh948aqHFHihtg8yh6ZtEFyKRWu1JRPINAb81UserbOtXgFBNT05Mb0tjT1ImuQxh1IgGg_6HKPQbhBg_lKcsuHK2GzfF-hq_b6xgWVdNwwgLu5X_HnU6B40YSHhXPvtopGjwRYwmMtIUR46DFAiXg7lDg"+ Date:+ - Wed, 12 Feb 2025 09:18:37 GMT+ body:+ encoding: UTF-8+ string: '{"error":{"code":"InvalidAuthenticationToken","message":"IDX14102:+ Unable to decode the header ''[PII of type ''Microsoft.IdentityModel.Logging.SecurityArtifact''+ is hidden. For more details, see https://aka.ms/IdentityModel/PII.]'' as Base64Url+ encoded string.","innerError":{"date":"2025-02-12T09:18:37","request-id":"1c749aa9-446f-4fc8-88b8-2e9e471d83d5","client-request-id":"1c749aa9-446f-4fc8-88b8-2e9e471d83d5"}}}'+ recorded_at: Wed, 12 Feb 2025 09:18:37 GMT+- request:+ method: post+ uri: https://login.microsoftonline.com/e36f1dbc-fdae-427e-b61b-0d96ddfb81a4/oauth2/v2.0/token+ body:+ encoding: ASCII-8BIT+ string: grant_type=refresh_token&scope=https%3A%2F%2Fgraph.microsoft.com%2F.default+offline_access&client_id=b8a5bb54-5fb2-4e0e-9427-9d24dbac32ff&client_secret=nB58Q%7EwWf6.4zUIojn2nzkrpzDWlkQtDSWPcLa6R&refresh_token=1.Aa8AvB1v4679fkK2Gw2W3fuBpFS7pbiyXw5OlCedJNusMv9KAU6vAA.AgABAwEAAABVrSpeuWamRam2jAF1XRQEAwDs_wUA9P9fuYdbTREQpkZ8rD4xDnTo87QINqdVLwMCTvvfK8qm8E8jqHUQI1vNcWnBxLcz9sLzbFQyYSMWPJfcutVWA6TGcRyChH--auYHFJdWuQVhY-IDHSlr9he4HvBKxu-XHTQe7qIQt-rGsX1S33_s0uhSyGuyx7Yp4IODhR5GAZPTROZVJQ0wm1eizjMNLHN4kBolD0ygtTQYVgxSPHF-DOI-2i-nirY2Vu-9LkNgwHL3N_fAOWCMXXyqzHI__FeqBYlD_r-1WlHOM8mCnFHU1gFU8Uhpo9S1xxrwL6C72znEKIo2ofVfRSNY0ZSiY8wqnR2U08DalYNiTlpm1rZOfwK4pnLws3y4oCHr9MKppUR6ujtl1SqaVmBGhh5B8dbUK4Yk7Rb6bY1r_xChL8Nn97RNvFy0vZ9P2L_iQgp4bOMTboEgX4zxMs8eg98CJZTvKjH431QCXQD81GAmofCH0i_BbSNQt8MWws7F9HfYDf111oz5MBVrHdhSxN-nOXYHy-3_wtyoSpIzkKzUG1uct9YKms8xr-vNLdYWzN8V0C3QgZE6GKKyxNoeZNbuvzl5Bgk7AEYnbLIJDHuRdidaEvNOGB8ppryZqPirTy1ekFYrWSl31nvsi6YKF1APhoePpGLB_5Odw41CmadE9VGx8RCOk2RozTvYXHs5pVx8DEcYW8f9muNudCKNohmHwwehXitXy_BWnNJmdJsZlPgyoycDcuWpgHPr6vsyXehPsuzoWwyFBa9lrIpvHRGE5xTfmZUSkFSkBjAPIzcae6StZTR_mgi3Ro8YZE+ headers:+ User-Agent:+ - httpx.rb/1.4.0+ Accept:+ - "*/*"+ Accept-Encoding:+ - gzip, deflate+ Content-Type:+ - application/x-www-form-urlencoded+ Content-Length:+ - '1108'+ 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:+ - efbbc4bf-7965-4ada-bf13-cc5b0ad80900+ X-Ms-Ests-Server:+ - 2.1.20003.9 - WEULR1 ProdSlices+ X-Ms-Srs:+ - 1.P+ Content-Security-Policy-Report-Only:+ - object-src 'none'; base-uri 'self'; script-src 'self' 'nonce-BWX41QpOKELW_L5Wtr1q_Q'+ '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=AhGFSuHL20lJk-bGh8Sd7JA; expires=Fri, 14-Mar-2025 09:18:37 GMT; path=/;+ secure; HttpOnly; SameSite=None, x-ms-gateway-slice=estsfd; path=/; secure;+ samesite=none; httponly, stsservicecookie=estsfd; path=/; secure; samesite=none;+ httponly+ Date:+ - Wed, 12 Feb 2025 09:18:37 GMT+ Content-Length:+ - '476'+ body:+ encoding: UTF-8+ string: '{"error":"invalid_grant","error_description":"AADSTS9002313: Invalid+ request. Request is malformed or invalid. Trace ID: efbbc4bf-7965-4ada-bf13-cc5b0ad80900+ Correlation ID: aadcc87f-2440-458c-882a-56376dd209fb Timestamp: 2025-02-12+ 09:18:37Z","error_codes":[9002313],"timestamp":"2025-02-12 09:18:37Z","trace_id":"efbbc4bf-7965-4ada-bf13-cc5b0ad80900","correlation_id":"aadcc87f-2440-458c-882a-56376dd209fb","error_uri":"https://login.microsoftonline.com/error?code=9002313"}'+ recorded_at: Wed, 12 Feb 2025 09:18:37 GMT+recorded_with: VCR 6.3.1diff --git a/spec/requests/oauth_clients/ensure_connection_flow_spec.rb b/spec/requests/oauth_clients/ensure_connection_flow_spec.rbindex b7ac2e2943e..3e61d35a78a 100644--- a/spec/requests/oauth_clients/ensure_connection_flow_spec.rb+++ b/spec/requests/oauth_clients/ensure_connection_flow_spec.rb@@ -38,7 +38,7 @@ RSpec.describe "/oauth_clients/:oauth_client_id/ensure_connection endpoint", :webefore doStorages::Peripherals::Registry.stub(- "#{storage}.queries.auth_check",+ "#{storage}.queries.user",->(_) { ServiceResult.success })end@@ -66,7 +66,7 @@ RSpec.describe "/oauth_clients/:oauth_client_id/ensure_connection endpoint", :webefore doStorages::Peripherals::Registry.stub(- "#{storage}.queries.auth_check",+ "#{storage}.queries.user",->(_) { ServiceResult.failure(errors: Storages::StorageError.new(code: :unauthorized)) })diff --git a/spec/services/oauth_clients/connection_manager_one_drive_spec.rb b/spec/services/oauth_clients/connection_manager_one_drive_spec.rbindex 6d84888110b..b23e921e3be 100644--- a/spec/services/oauth_clients/connection_manager_one_drive_spec.rb+++ b/spec/services/oauth_clients/connection_manager_one_drive_spec.rb@@ -75,7 +75,7 @@ RSpec.describe OAuthClients::ConnectionManager, :oauth_connection_helpers, :webmendit "raises an error" do- expect { subject.code_to_token(code) }.to raise_error(HTTPX::HTTPError)+ expect { subject.code_to_token(code) }.to raise_error(RuntimeError, /Storages::StorageErrorData.*@status=404/)endendenddiff --git a/spec/services/oauth_clients/connection_manager_spec.rb b/spec/services/oauth_clients/connection_manager_spec.rbindex 0c073509ed8..826f2343f76 100644--- a/spec/services/oauth_clients/connection_manager_spec.rb+++ b/spec/services/oauth_clients/connection_manager_spec.rb@@ -110,6 +110,79 @@ RSpec.describe OAuthClients::ConnectionManager, :webmock, type: :model do}.to_jsonstub_request(:any, File.join(host, "/index.php/apps/oauth2/api/v1/token")).to_return(status: 200, body: response_body, headers: { "content-type" => "application/json; charset=utf-8" })++ stub_request(:get, File.join(host, "/ocs/v1.php/cloud/user")).with(+ headers: {+ "Authorization" => "Bearer yjTDZ...RYvRH",+ "Ocs-Apirequest" => "true"+ }+ ).to_return(status: 200, body: <<~XML, headers: {})+ <?xml version="1.0"?>+ <ocs>+ <meta>+ <status>ok</status>+ <statuscode>100</statuscode>+ <message>OK</message>+ <totalitems></totalitems>+ <itemsperpage></itemsperpage>+ </meta>+ <data>+ <enabled>1</enabled>+ <storageLocation>/var/www/html/data/admin</storageLocation>+ <id>admin</id>+ <lastLogin>1738833138000</lastLogin>+ <backend>Database</backend>+ <subadmin/>+ <quota>+ <free>447793922048</free>+ <used>37754592</used>+ <total>447831676640</total>+ <relative>0.01</relative>+ <quota>-3</quota>+ </quota>+ <manager></manager>+ <avatarScope>v2-federated</avatarScope>+ <email/>+ <emailScope>v2-federated</emailScope>+ <additional_mail/>+ <additional_mailScope/>+ <displayname>admin</displayname>+ <display-name>admin</display-name>+ <displaynameScope>v2-federated</displaynameScope>+ <phone></phone>+ <phoneScope>v2-local</phoneScope>+ <address></address>+ <addressScope>v2-local</addressScope>+ <website></website>+ <websiteScope>v2-local</websiteScope>+ <twitter></twitter>+ <twitterScope>v2-local</twitterScope>+ <fediverse></fediverse>+ <fediverseScope>v2-local</fediverseScope>+ <organisation></organisation>+ <organisationScope>v2-local</organisationScope>+ <role></role>+ <roleScope>v2-local</roleScope>+ <headline></headline>+ <headlineScope>v2-local</headlineScope>+ <biography></biography>+ <biographyScope>v2-local</biographyScope>+ <profile_enabled>1</profile_enabled>+ <profile_enabledScope>v2-local</profile_enabledScope>+ <groups>+ <element>admin</element>+ <element>OpenProject</element>+ </groups>+ <language>en</language>+ <locale></locale>+ <notify_email/>+ <backendCapabilities>+ <setDisplayName>1</setDisplayName>+ <setPassword>1</setPassword>+ </backendCapabilities>+ </data>+ </ocs>+ XMLendit "returns a valid ClientToken object and issues an appropriate event" do