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
make sure limit_self_registration is included in saml provider hash
Markus Kahlf42fbc735a29
diff --git a/modules/auth_saml/app/contracts/saml/providers/base_contract.rb b/modules/auth_saml/app/contracts/saml/providers/base_contract.rbindex 3e2a24ac82f..2375f66cfb1 100644--- a/modules/auth_saml/app/contracts/saml/providers/base_contract.rb+++ b/modules/auth_saml/app/contracts/saml/providers/base_contract.rb@@ -64,6 +64,8 @@ module Samlattribute :authn_requests_signedvalidate :valid_certificate_key_pair+ attribute :limit_self_registration+%i[mapping_mail mapping_login mapping_firstname mapping_lastname].each do |attr|attribute attrvalidates_presence_of attr, if: -> { model.public_send(:"#{attr}_changed?") }diff --git a/modules/auth_saml/app/models/saml/provider/hash_builder.rb b/modules/auth_saml/app/models/saml/provider/hash_builder.rbindex d6bfc89f6b5..5cbf13df8d5 100644--- a/modules/auth_saml/app/models/saml/provider/hash_builder.rb+++ b/modules/auth_saml/app/models/saml/provider/hash_builder.rb@@ -72,6 +72,7 @@ module Samlname_identifier_format:,certificate:,private_key:,+ limit_self_registration:,attribute_statements: formatted_attribute_statements,request_attributes: formatted_request_attributes,uid_attribute: mapping_uid.presencediff --git a/modules/auth_saml/spec/factories/saml_provider_factory.rb b/modules/auth_saml/spec/factories/saml_provider_factory.rbindex a53c2c6857c..1862fd4adca 100644--- a/modules/auth_saml/spec/factories/saml_provider_factory.rb+++ b/modules/auth_saml/spec/factories/saml_provider_factory.rb@@ -43,6 +43,8 @@ FactoryBot.define doidp_sso_service_url { "https://example.com/sso" }idp_slo_service_url { "https://example.com/slo" }+ limit_self_registration { true }+mapping_login { Saml::Defaults::MAIL_MAPPING }mapping_mail { Saml::Defaults::MAIL_MAPPING }mapping_firstname { Saml::Defaults::FIRSTNAME_MAPPING }diff --git a/modules/auth_saml/spec/lib/open_project/auth_saml_spec.rb b/modules/auth_saml/spec/lib/open_project/auth_saml_spec.rbindex 263cd698e03..baf4378b02e 100644--- a/modules/auth_saml/spec/lib/open_project/auth_saml_spec.rb+++ b/modules/auth_saml/spec/lib/open_project/auth_saml_spec.rb@@ -15,6 +15,7 @@ RSpec.describe OpenProject::AuthSaml doexpect(subject[:assertion_consumer_service_url]).to eq "http://#{Setting.host_name}/auth/my-saml/callback"expect(subject[:idp_sso_service_url]).to eq "https://example.com/sso"expect(subject[:idp_slo_service_url]).to eq "https://example.com/slo"+ expect(subject[:limit_self_registration]).to be trueattributes = subject[:attribute_statements]expect(attributes[:email]).to eq Saml::Defaults::MAIL_MAPPING.split("\n")diff --git a/modules/auth_saml/spec/requests/saml_provider_callback_spec.rb b/modules/auth_saml/spec/requests/saml_provider_callback_spec.rbindex 4069e63b822..eabbb252d35 100644--- a/modules/auth_saml/spec/requests/saml_provider_callback_spec.rb+++ b/modules/auth_saml/spec/requests/saml_provider_callback_spec.rb@@ -42,7 +42,8 @@ RSpec.describe "SAML provider callback",digest_method: "http://www.w3.org/2001/04/xmlenc#sha256",sp_entity_id: "https://foobar.org",idp_cert:,- idp_cert_fingerprint:)+ idp_cert_fingerprint:,+ limit_self_registration: false)endlet(:idp_cert) { nil }