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
Configuration
Oliver Güntherbf8193967d63
diff --git a/modules/auth_saml/app/components/saml/providers/sections/configuration_component.html.erb b/modules/auth_saml/app/components/saml/providers/sections/configuration_component.html.erbnew file mode 100644index 00000000000..2ccdef7b008--- /dev/null+++ b/modules/auth_saml/app/components/saml/providers/sections/configuration_component.html.erb@@ -0,0 +1,34 @@+<%=+ grid_layout('op-saml-view-row', tag: :div, align_items: :center) do |grid|+ grid.with_area(:title, mr: 3) do+ concat render(Primer::Beta::Text.new(font_weight: :bold)) { t("saml.providers.section_headers.configuration") }+ if provider.configured?+ concat render(Primer::Beta::Label.new(scheme: :success, ml: 1)) { t(:label_completed) }+ else+ concat render(Primer::Beta::Label.new(scheme: :attention, ml: 1)) { t(:label_incomplete) }+ end+ end++ grid.with_area(:description) do+ render(Primer::Beta::Text.new(tag: :p, font_size: :small, color: :subtle)) do+ t("saml.providers.section_texts.configuration")+ end+ end++ grid.with_area(:action) do+ flex_layout(justify_content: :flex_end) do |icons_container|+ icons_container.with_column do+ render(+ Primer::Beta::IconButton.new(+ icon: :pencil,+ tag: :a,+ scheme: :invisible,+ href: edit_saml_provider_path(provider, edit_state: :configuration),+ aria: { label: I18n.t(:label_edit) }+ )+ )+ end+ end+ end+ end+%>diff --git a/modules/auth_saml/app/components/saml/providers/sections/configuration_component.rb b/modules/auth_saml/app/components/saml/providers/sections/configuration_component.rbnew file mode 100644index 00000000000..a6cc07f82f1--- /dev/null+++ b/modules/auth_saml/app/components/saml/providers/sections/configuration_component.rb@@ -0,0 +1,41 @@+# 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 Saml::Providers::Sections+ class ConfigurationComponent < ApplicationComponent+ include OpPrimer::ComponentHelpers++ attr_reader :provider++ def initialize(provider)+ @provider = provider+ end+ end+enddiff --git a/modules/auth_saml/app/components/saml/providers/sections/configuration_form_component.html.erb b/modules/auth_saml/app/components/saml/providers/sections/configuration_form_component.html.erbnew file mode 100644index 00000000000..09b26b4060e--- /dev/null+++ b/modules/auth_saml/app/components/saml/providers/sections/configuration_form_component.html.erb@@ -0,0 +1,36 @@+<%=+ primer_form_with(+ model: provider,+ url: import_metadata_saml_provider_path(provider),+ data: {+ controller: "show-when-checked"+ },+ method: :post,+ ) do |form|+ flex_layout do |flex|+ flex.with_row do+ render(Primer::Beta::Text.new(tag: :p, mb: 4, font_size: :small)) do+ t("saml.providers.section_texts.metadata_form")+ end+ end++ flex.with_row do+ render(Saml::Providers::MetadataCheckboxForm.new(form, provider:))+ end++ flex.with_row(mt: 2, hidden: !provider.has_metadata?, data: { 'show-when-checked-target': "effect" }) do+ render(Saml::Providers::MetadataUrlForm.new(form))+ end++ flex.with_row(mt: 2, hidden: !provider.has_metadata?, data: { 'show-when-checked-target': "effect" }) do+ render(Saml::Providers::MetadataXmlForm.new(form))+ end++ flex.with_row(mt: 4) do+ render(Saml::Providers::SubmitOrCancelForm.new(form,+ provider:,+ state: :metadata))+ end+ end+ end+%>diff --git a/modules/auth_saml/app/components/saml/providers/sections/configuration_form_component.rb b/modules/auth_saml/app/components/saml/providers/sections/configuration_form_component.rbnew file mode 100644index 00000000000..f2506fd3e04--- /dev/null+++ b/modules/auth_saml/app/components/saml/providers/sections/configuration_form_component.rb@@ -0,0 +1,41 @@+# 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 Saml::Providers::Sections+ class ConfigurationFormComponent < ApplicationComponent+ include OpPrimer::ComponentHelpers++ attr_reader :provider++ def initialize(provider)+ @provider = provider+ end+ end+enddiff --git a/modules/auth_saml/app/models/saml/provider.rb b/modules/auth_saml/app/models/saml/provider.rbindex c5d678be92e..5681a963e5e 100644--- a/modules/auth_saml/app/models/saml/provider.rb+++ b/modules/auth_saml/app/models/saml/provider.rb@@ -12,6 +12,9 @@ module Samlstore_attribute :options, :idp_sso_service_url, :stringstore_attribute :options, :idp_slo_service_url, :string+ store_attribute :options, :idp_cert, :string+ store_attribute :options, :idp_cert_fingerprint, :string+store_attribute :options, :mapping_login, :jsonstore_attribute :options, :mapping_mail, :jsonstore_attribute :options, :mapping_firstname, :json@@ -21,6 +24,7 @@ module Samlstore_attribute :options, :request_attributes, :jsonattr_accessor :readonly+validates_presence_of :display_namedef slug@@ -35,12 +39,20 @@ module Samlmetadata_xml.present? || metadata_url.present?end+ def configured?+ idp_sso_service_url.present? && certificate_configured?+ end++ def certificate_configured?+ idp_cert.present? || idp_cert_fingerprint.present?+ end+def to_hoptions.merge(name: slug,display_name:,- assertion_consumer_service_url:,+ assertion_consumer_service_url:)endenddiff --git a/modules/auth_saml/config/locales/en.yml b/modules/auth_saml/config/locales/en.ymlindex b15892f3545..558918bfc5f 100644--- a/modules/auth_saml/config/locales/en.yml+++ b/modules/auth_saml/config/locales/en.yml@@ -41,10 +41,13 @@ en:legend: 'These attributes are added to the SAML XML metadata to signify to the identify provider which attributes OpenProject requires.'name: 'Requested attribute key'format: 'Attribute format'+ section_headers:+ configuration: "Primary configuration"section_texts:display_name: "Configure the display name of the SAML provider."metadata: "Pre-fill configuration using a metadata URL or by pasting metadata XML"metadata_form: "If your identity provider has a metadata endpoint or XML download, add it below to pre-fill configuration."+ configuration: "Configure the endpoint URLs for the identity provider, certificates, and further SAML options."settings:metadata_checkbox: "I have metadata (optional)"metadata_url: "Metadata URL"