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
Validate cert only if present
Oliver Günthera4bcc206bce9
diff --git a/modules/auth_saml/app/contracts/saml/providers/base_contract.rb b/modules/auth_saml/app/contracts/saml/providers/base_contract.rbindex 6ac62cb2271..2ddd4762aa7 100644--- a/modules/auth_saml/app/contracts/saml/providers/base_contract.rb+++ b/modules/auth_saml/app/contracts/saml/providers/base_contract.rb@@ -55,7 +55,7 @@ module Samlvalidates_presence_of :idp_cert,if: -> { model.idp_cert_changed? }validate :idp_cert_is_valid,- if: -> { model.idp_cert_changed? }+ if: -> { model.idp_cert_changed? && model.idp_cert.present? }attribute :authn_requests_signedvalidate :authn_requests_signed_requires_cert@@ -69,7 +69,7 @@ module Samlmodel.loaded_idp_certificates.each do |cert|if OneLogin::RubySaml::Utils.is_cert_expired(cert)errors.add :certificate, :certificate_expired- return+ breakendendrescue OpenSSL::X509::CertificateError => ediff --git a/modules/auth_saml/app/models/saml/provider/hash_builder.rb b/modules/auth_saml/app/models/saml/provider/hash_builder.rbindex c208b94e53f..68954119e0b 100644--- a/modules/auth_saml/app/models/saml/provider/hash_builder.rb+++ b/modules/auth_saml/app/models/saml/provider/hash_builder.rb@@ -23,16 +23,20 @@ module Samlreturn { idp_cert_fingerprint: }end- certificates = loaded_idp_certificates.map(&:to_pem)- if certificates.count > 1- {- idp_cert_multi: {- signing: certificates,- encryption: certificates+ if idp_cert.present?+ certificates = loaded_idp_certificates.map(&:to_pem)+ if certificates.count > 1+ {+ idp_cert_multi: {+ signing: certificates,+ encryption: certificates+ }}- }+ else+ { idp_cert: certificates.first }+ endelse- { idp_cert: certificates.first }+ {}endend