Skip to content

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

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.rb
index 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 < SectionComponent
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.rb
index 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 < SectionComponent
end
end
diff --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.erb
new file mode 100644
index 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.rb
new file mode 100644
index 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
+end
diff --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.erb
new file mode 100644
index 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.rb
new file mode 100644
index 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
+end
diff --git a/modules/auth_saml/app/components/saml/providers/sections/mapping_component.rb b/modules/auth_saml/app/components/saml/providers/sections/mapping_component.rb
index 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 < SectionComponent
end
end
diff --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.rb
index 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 < SectionComponent
end
end
diff --git a/modules/auth_saml/app/components/saml/providers/sections/metadata_component.rb b/modules/auth_saml/app/components/saml/providers/sections/metadata_component.rb
index 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 < SectionComponent
end
end
diff --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.rb
index 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 < SectionComponent
end
end
diff --git a/modules/auth_saml/app/components/saml/providers/sections/name_component.rb b/modules/auth_saml/app/components/saml/providers/sections/name_component.rb
index 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 < SectionComponent
end
end
diff --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.rb
index 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 < SectionComponent
end
end
diff --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.rb
index 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 < SectionComponent
end
end
diff --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.rb
index 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 < SectionComponent
end
end
diff --git a/modules/auth_saml/app/components/saml/providers/sections/section_component.rb b/modules/auth_saml/app/components/saml/providers/sections/section_component.rb
new file mode 100644
index 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
+end
diff --git a/modules/auth_saml/app/components/saml/providers/view_component.html.erb b/modules/auth_saml/app/components/saml/providers/view_component.html.erb
index 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 @@
end
end
+ 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) do
render(Primer::Beta::Text.new(font_weight: :semibold)) { I18n.t('saml.providers.section_headers.attributes') }
end
diff --git a/modules/auth_saml/app/forms/saml/providers/encryption_form.rb b/modules/auth_saml/app/forms/saml/providers/encryption_form.rb
new file mode 100644
index 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
+end
diff --git a/modules/auth_saml/app/models/saml/provider.rb b/modules/auth_saml/app/models/saml/provider.rb
index 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 Saml
store_attribute :options, :idp_cert, :string
store_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, :string
store_attribute :options, :mapping_mail, :string
store_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
)
end
end
diff --git a/modules/auth_saml/config/locales/en.yml b/modules/auth_saml/config/locales/en.yml
index 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 endpoint
idp_slo_service_url: Identity provider logout endpoint
idp_cert: Public certificate of identity provider
+ authn_requests_signed: Sign SAML AuthnRequests
format: "Format"
saml:
menu_title: SAML providers
@@ -31,6 +32,7 @@ en:
label_metadata: Metadata
label_metadata_endpoint: Metadata endpoint
label_configuration_details: "Identity provider endpoints and certificates"
+ label_configuration_encryption: "Signatures and Encryption"
label_add_new: New SAML identity provider
label_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.