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
Sections
Oliver Günthere04897454e24
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.rbindex a6cc07f82f1..8d7c13d4bb2 100644--- a/modules/auth_saml/app/components/saml/providers/sections/configuration_component.rb+++ b/modules/auth_saml/app/components/saml/providers/sections/configuration_component.rb@@ -29,13 +29,6 @@#++#module Saml::Providers::Sections- class ConfigurationComponent < ApplicationComponent- include OpPrimer::ComponentHelpers-- attr_reader :provider-- def initialize(provider)- @provider = provider- end+ class ConfigurationComponent < SectionComponentendenddiff --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.rbindex f2506fd3e04..dd773546a62 100644--- 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.rb@@ -29,13 +29,6 @@#++#module Saml::Providers::Sections- class ConfigurationFormComponent < ApplicationComponent- include OpPrimer::ComponentHelpers-- attr_reader :provider-- def initialize(provider)- @provider = provider- end+ class ConfigurationFormComponent < SectionComponentendenddiff --git a/modules/auth_saml/app/components/saml/providers/sections/encryption_component.html.erb b/modules/auth_saml/app/components/saml/providers/sections/encryption_component.html.erbnew file mode 100644index 00000000000..0f269019421--- /dev/null+++ b/modules/auth_saml/app/components/saml/providers/sections/encryption_component.html.erb@@ -0,0 +1,36 @@+<%=+ 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.label_configuration_encryption") }+ if provider.configured?+ concat render(Primer::Beta::Label.new(scheme: :success, ml: 1)) { t(:label_completed) }+ elsif provider.persisted?+ 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.encryption")+ end+ end++ if provider.persisted?+ 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: :encryption),+ aria: { label: I18n.t(:label_edit) }+ )+ )+ end+ end+ end+ end+ end+%>diff --git a/modules/auth_saml/app/components/saml/providers/sections/encryption_component.rb b/modules/auth_saml/app/components/saml/providers/sections/encryption_component.rbnew file mode 100644index 00000000000..d863aa41499--- /dev/null+++ b/modules/auth_saml/app/components/saml/providers/sections/encryption_component.rb@@ -0,0 +1,34 @@+# 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 EncryptionComponent < SectionComponent+ end+enddiff --git a/modules/auth_saml/app/components/saml/providers/sections/encryption_form_component.html.erb b/modules/auth_saml/app/components/saml/providers/sections/encryption_form_component.html.erbnew file mode 100644index 00000000000..e6cbdf4dd7b--- /dev/null+++ b/modules/auth_saml/app/components/saml/providers/sections/encryption_form_component.html.erb@@ -0,0 +1,24 @@+<%=+ primer_form_with(+ model: provider,+ url: saml_provider_path(provider, state: :encryption),+ method: :put+ ) 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.encryption_form")+ end+ end++ flex.with_row do+ render(Saml::Providers::EncryptionForm.new(form, provider:))+ end++ flex.with_row(mt: 4) do+ render(Saml::Providers::SubmitOrCancelForm.new(form,+ provider:))+ end+ end+ end+%>diff --git a/modules/auth_saml/app/components/saml/providers/sections/encryption_form_component.rb b/modules/auth_saml/app/components/saml/providers/sections/encryption_form_component.rbnew file mode 100644index 00000000000..9b904da0aff--- /dev/null+++ b/modules/auth_saml/app/components/saml/providers/sections/encryption_form_component.rb@@ -0,0 +1,34 @@+# 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 EncryptionFormComponent < SectionComponent+ end+enddiff --git a/modules/auth_saml/app/components/saml/providers/sections/mapping_component.rb b/modules/auth_saml/app/components/saml/providers/sections/mapping_component.rbindex ceaeb06c8d8..572d79b76fe 100644--- a/modules/auth_saml/app/components/saml/providers/sections/mapping_component.rb+++ b/modules/auth_saml/app/components/saml/providers/sections/mapping_component.rb@@ -29,13 +29,6 @@#++#module Saml::Providers::Sections- class MappingComponent < ApplicationComponent- include OpPrimer::ComponentHelpers-- attr_reader :provider-- def initialize(provider)- @provider = provider- end+ class MappingComponent < SectionComponentendenddiff --git a/modules/auth_saml/app/components/saml/providers/sections/mapping_form_component.rb b/modules/auth_saml/app/components/saml/providers/sections/mapping_form_component.rbindex bb6ebe1d1e6..bcc2eb7ff3d 100644--- a/modules/auth_saml/app/components/saml/providers/sections/mapping_form_component.rb+++ b/modules/auth_saml/app/components/saml/providers/sections/mapping_form_component.rb@@ -29,13 +29,6 @@#++#module Saml::Providers::Sections- class MappingFormComponent < ApplicationComponent- include OpPrimer::ComponentHelpers-- attr_reader :provider-- def initialize(provider)- @provider = provider- end+ class MappingFormComponent < SectionComponentendenddiff --git a/modules/auth_saml/app/components/saml/providers/sections/metadata_component.rb b/modules/auth_saml/app/components/saml/providers/sections/metadata_component.rbindex 15e825edfd1..601e831e185 100644--- a/modules/auth_saml/app/components/saml/providers/sections/metadata_component.rb+++ b/modules/auth_saml/app/components/saml/providers/sections/metadata_component.rb@@ -29,13 +29,6 @@#++#module Saml::Providers::Sections- class MetadataComponent < ApplicationComponent- include OpPrimer::ComponentHelpers-- attr_reader :provider-- def initialize(provider)- @provider = provider- end+ class MetadataComponent < SectionComponentendenddiff --git a/modules/auth_saml/app/components/saml/providers/sections/metadata_form_component.rb b/modules/auth_saml/app/components/saml/providers/sections/metadata_form_component.rbindex a5065554b68..516a559e0b4 100644--- a/modules/auth_saml/app/components/saml/providers/sections/metadata_form_component.rb+++ b/modules/auth_saml/app/components/saml/providers/sections/metadata_form_component.rb@@ -29,13 +29,6 @@#++#module Saml::Providers::Sections- class MetadataFormComponent < ApplicationComponent- include OpPrimer::ComponentHelpers-- attr_reader :provider-- def initialize(provider)- @provider = provider- end+ class MetadataFormComponent < SectionComponentendenddiff --git a/modules/auth_saml/app/components/saml/providers/sections/name_component.rb b/modules/auth_saml/app/components/saml/providers/sections/name_component.rbindex 0d33cb2e5dc..d7ea52c9b49 100644--- a/modules/auth_saml/app/components/saml/providers/sections/name_component.rb+++ b/modules/auth_saml/app/components/saml/providers/sections/name_component.rb@@ -29,13 +29,6 @@#++#module Saml::Providers::Sections- class NameComponent < ApplicationComponent- include OpPrimer::ComponentHelpers-- attr_reader :provider-- def initialize(provider)- @provider = provider- end+ class NameComponent < SectionComponentendenddiff --git a/modules/auth_saml/app/components/saml/providers/sections/name_form_component.rb b/modules/auth_saml/app/components/saml/providers/sections/name_form_component.rbindex 4f0abfb0523..1a5f6b98557 100644--- a/modules/auth_saml/app/components/saml/providers/sections/name_form_component.rb+++ b/modules/auth_saml/app/components/saml/providers/sections/name_form_component.rb@@ -29,13 +29,6 @@#++#module Saml::Providers::Sections- class NameFormComponent < ApplicationComponent- include OpPrimer::ComponentHelpers-- attr_reader :provider-- def initialize(provider)- @provider = provider- end+ class NameFormComponent < SectionComponentendenddiff --git a/modules/auth_saml/app/components/saml/providers/sections/request_attributes_component.rb b/modules/auth_saml/app/components/saml/providers/sections/request_attributes_component.rbindex 69548e99d33..578831c8c50 100644--- a/modules/auth_saml/app/components/saml/providers/sections/request_attributes_component.rb+++ b/modules/auth_saml/app/components/saml/providers/sections/request_attributes_component.rb@@ -29,13 +29,6 @@#++#module Saml::Providers::Sections- class RequestAttributesComponent < ApplicationComponent- include OpPrimer::ComponentHelpers-- attr_reader :provider-- def initialize(provider)- @provider = provider- end+ class RequestAttributesComponent < SectionComponentendenddiff --git a/modules/auth_saml/app/components/saml/providers/sections/request_attributes_form_component.rb b/modules/auth_saml/app/components/saml/providers/sections/request_attributes_form_component.rbindex 52e02e7b28c..14a1ef01dd7 100644--- a/modules/auth_saml/app/components/saml/providers/sections/request_attributes_form_component.rb+++ b/modules/auth_saml/app/components/saml/providers/sections/request_attributes_form_component.rb@@ -29,13 +29,6 @@#++#module Saml::Providers::Sections- class RequestAttributesFormComponent < ApplicationComponent- include OpPrimer::ComponentHelpers-- attr_reader :provider-- def initialize(provider)- @provider = provider- end+ class RequestAttributesFormComponent < SectionComponentendenddiff --git a/modules/auth_saml/app/components/saml/providers/sections/section_component.rb b/modules/auth_saml/app/components/saml/providers/sections/section_component.rbnew file mode 100644index 00000000000..acad97d22cd--- /dev/null+++ b/modules/auth_saml/app/components/saml/providers/sections/section_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 SectionComponent < ApplicationComponent+ include OpPrimer::ComponentHelpers++ attr_reader :provider++ def initialize(provider)+ @provider = provider+ end+ end+enddiff --git a/modules/auth_saml/app/components/saml/providers/view_component.html.erb b/modules/auth_saml/app/components/saml/providers/view_component.html.erbindex ae7efeec42c..703a20aac5d 100644--- a/modules/auth_saml/app/components/saml/providers/view_component.html.erb+++ b/modules/auth_saml/app/components/saml/providers/view_component.html.erb@@ -36,6 +36,14 @@endend+ component.with_row(scheme: :default) do+ if edit_state == :encryption+ render(Saml::Providers::Sections::EncryptionFormComponent.new(provider))+ else+ render(Saml::Providers::Sections::EncryptionComponent.new(provider))+ end+ end+component.with_row(scheme: :neutral, color: :muted) dorender(Primer::Beta::Text.new(font_weight: :semibold)) { I18n.t('saml.providers.section_headers.attributes') }enddiff --git a/modules/auth_saml/app/forms/saml/providers/encryption_form.rb b/modules/auth_saml/app/forms/saml/providers/encryption_form.rbnew file mode 100644index 00000000000..c9efb9d9d4c--- /dev/null+++ b/modules/auth_saml/app/forms/saml/providers/encryption_form.rb@@ -0,0 +1,80 @@+#-- 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+ module Providers+ class EncryptionForm < ApplicationForm+ form do |f|+ f.check_box(+ name: :authn_requests_signed,+ label: I18n.t("activemodel.attributes.saml/provider.authn_requests_signed"),+ caption: I18n.t("saml.instructions.authn_requests_signed"),+ required: true+ )+ f.text_area(+ name: :sp_certificate,+ rows: 10,+ label: I18n.t("activemodel.attributes.saml/provider.sp_certificate"),+ caption: I18n.t("saml.instructions.sp_certificate"),+ required: false,+ input_width: :large+ )+ f.text_area(+ name: :sp_certificate,+ rows: 10,+ label: I18n.t("activemodel.attributes.saml/provider.sp_certificate"),+ caption: I18n.t("saml.instructions.idp_cert"),+ required: false,+ input_width: :large+ )+ f.select_list(+ name: "name_identifier_format",+ label: I18n.t("activemodel.attributes.saml/provider.name_identifier_format"),+ input_width: :large,+ caption: I18n.t("saml.instructions.name_identifier_format")+ ) do |list|+ Saml::Defaults::NAME_IDENTIFIER_FORMATS.each do |format|+ list.option(label: format, value: format)+ end+ end+ f.check_box(+ name: :limit_self_registration,+ label: I18n.t("activemodel.attributes.saml/provider.limit_self_registration"),+ caption: I18n.t("saml.instructions.limit_self_registration"),+ required: false,+ input_width: :large+ )+ end++ def initialize(provider:)+ super()+ @provider = provider+ end+ end+ end+enddiff --git a/modules/auth_saml/app/models/saml/provider.rb b/modules/auth_saml/app/models/saml/provider.rbindex c56b90f6db7..3c7578fa455 100644--- a/modules/auth_saml/app/models/saml/provider.rb+++ b/modules/auth_saml/app/models/saml/provider.rb@@ -15,6 +15,10 @@ module Samlstore_attribute :options, :idp_cert, :stringstore_attribute :options, :idp_cert_fingerprint, :string+ store_attribute :options, :authn_requests_signed, :boolean+ store_attribute :options, :want_assertions_signed, :boolean+ store_attribute :options, :want_assertions_encrypted, :boolean+store_attribute :options, :mapping_login, :stringstore_attribute :options, :mapping_mail, :stringstore_attribute :options, :mapping_firstname, :string@@ -63,7 +67,10 @@ module Saml.merge(name: slug,display_name:,- assertion_consumer_service_url:+ assertion_consumer_service_url:,+ check_idp_cert_expiration: true,+ check_sp_cert_expiration: true,+ metadata_signed: true)endenddiff --git a/modules/auth_saml/config/locales/en.yml b/modules/auth_saml/config/locales/en.ymlindex 4043a5398bb..b8c4489de49 100644--- a/modules/auth_saml/config/locales/en.yml+++ b/modules/auth_saml/config/locales/en.yml@@ -13,6 +13,7 @@ en:idp_sso_service_url: Identity provider login endpointidp_slo_service_url: Identity provider logout endpointidp_cert: Public certificate of identity provider+ authn_requests_signed: Sign SAML AuthnRequestsformat: "Format"saml:menu_title: SAML providers@@ -31,6 +32,7 @@ en:label_metadata: Metadatalabel_metadata_endpoint: Metadata endpointlabel_configuration_details: "Identity provider endpoints and certificates"+ label_configuration_encryption: "Signatures and Encryption"label_add_new: New SAML identity providerlabel_edit: Edit SAML identity provider %{name}label_uid: Internal user id@@ -60,6 +62,8 @@ en: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."+ encryption: "Configure assertion signatures and encryption for SAML requests and responses."+ encryption_form: "You may optionally want to encrypt the assertion response, or have requests from OpenProject signed."mapping: "Manually adjust the mapping between the SAML response and user attributes in OpenProject."requested_attributes: "Define the set of attributes to be requested in the SAML request sent to your identity provider."settings:@@ -112,3 +116,5 @@ en:requested_format: >The format of the requested attribute. This is used to specify the format of the attribute in the SAML request.Please see [documentation on configuring requested attributes](docs_url) for more information.+ authn_requests_signed: >+ If enabled, OpenProject will sign the SAML AuthnRequest. You will have to provide a signing certificate and private key using the fields below.