[#66434] Drop LimitedServiceProviderConfiguration.

No need in a class actually. Let's use a plain Hash instance instead.
This commit is contained in:
Pavel Balashou
2025-08-15 16:18:03 +02:00
parent 47049c156e
commit 64b493c9ff
2 changed files with 13 additions and 58 deletions
+13 -2
View File
@@ -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
@@ -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