diff --git a/config/initializers/scimitar.rb b/config/initializers/scimitar.rb index de092a6efe2..fbfcfc9d84f 100644 --- a/config/initializers/scimitar.rb +++ b/config/initializers/scimitar.rb @@ -43,11 +43,22 @@ Rails.application.config.to_prepare do user = warden.authenticate(scope: :scim_v2) if user == nil if controller_path != "scimitar/service_provider_configurations" || - # it means authorization credentials were provided in ways expexcted by OpenProject, but the credentials were wrong. So, no user found. + # It means authorization credentials were provided in ways expected by OpenProject, but the credentials were wrong. + # So, no user found. warden.winning_strategy.present? throw(:warden) else - render json: OpenProjectScimitar::LimitedServiceProviderConfiguration.new + limited_service_provider_configuration = { + meta: Scimitar::Meta.new( + resourceType: "ServiceProviderConfig", + created: Time.zone.now, + lastModified: Time.zone.now, + version: "1" + ), + schemas: ["urn:ietf:params:scim:schemas:core:2.0:ServiceProviderConfig"], + authenticationSchemes: OpenProjectScimitar::AUTHENTICATION_SCHEMES + } + render json: limited_service_provider_configuration return end else diff --git a/lib/open_project_scimitar/limited_service_provider_configuration.rb b/lib/open_project_scimitar/limited_service_provider_configuration.rb deleted file mode 100644 index 3f9a5919170..00000000000 --- a/lib/open_project_scimitar/limited_service_provider_configuration.rb +++ /dev/null @@ -1,56 +0,0 @@ -# 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 OpenProjectScimitar - class LimitedServiceProviderConfiguration - include ActiveModel::Model - - attr_accessor( - :authenticationSchemes, - :meta, - :schemas - ) - - def initialize(attributes = {}) - defaults = { - meta: Scimitar::Meta.new( - resourceType: "ServiceProviderConfig", - created: Time.zone.now, - lastModified: Time.zone.now, - version: "1" - ), - schemas: ["urn:ietf:params:scim:schemas:core:2.0:ServiceProviderConfig"], - authenticationSchemes: AUTHENTICATION_SCHEMES - } - - super(defaults.merge(attributes)) - end - end -end