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
Fix remaining specs
Oliver Günther6a9fc6e2eec9
diff --git a/.github/workflows/test-core.yml b/.github/workflows/test-core.ymlindex 30d3d658d32..da196cdf94b 100644--- a/.github/workflows/test-core.yml+++ b/.github/workflows/test-core.yml@@ -24,7 +24,7 @@ jobs:name: Units + Featuresif: github.repository == 'opf/openproject'runs-on:- labels:+ labels- runs-on- runner=32cpu-linux-x64- family=m7diff --git a/modules/auth_saml/app/models/saml/provider.rb b/modules/auth_saml/app/models/saml/provider.rbindex 6e081d79e83..4191bd0db79 100644--- a/modules/auth_saml/app/models/saml/provider.rb+++ b/modules/auth_saml/app/models/saml/provider.rb@@ -104,7 +104,7 @@ module Samldef idp_cert=(cert)formatted =- if cert.include?("BEGIN CERTIFICATE")+ if cert.nil? || cert.include?("BEGIN CERTIFICATE")certelseOneLogin::RubySaml::Utils.format_cert(cert)diff --git a/modules/auth_saml/spec/factories/saml_provider_factory.rb b/modules/auth_saml/spec/factories/saml_provider_factory.rbindex d0daf5f25fb..848da24df12 100644--- a/modules/auth_saml/spec/factories/saml_provider_factory.rb+++ b/modules/auth_saml/spec/factories/saml_provider_factory.rb@@ -33,7 +33,11 @@ FactoryBot.define dosequence(:display_name) { |n| "Saml Provider #{n}" }creator factory: :useravailable { true }+idp_cert { CertificateHelper.valid_certificate.to_pem }+ idp_cert_fingerprint { nil }++ sp_entity_id { "http://#{Setting.host_name}" }idp_sso_service_url { "https://example.com/sso" }idp_slo_service_url { "https://example.com/slo" }diff --git a/modules/auth_saml/spec/fixtures/idp_cert_plain.txt b/modules/auth_saml/spec/fixtures/idp_cert_plain.txtindex bb5ce9674d6..a220aa26967 100644--- a/modules/auth_saml/spec/fixtures/idp_cert_plain.txt+++ b/modules/auth_saml/spec/fixtures/idp_cert_plain.txt@@ -1 +1 @@-MIIDHTCCAgWgAwIBAgIJaPVOFuER4IyxMA0GCSqGSIb3DQEBCwUAMCwxKjAoBgNVBAMTIWRldi10eXQzaDZkNTZjeTB4aXA3LnVzLmF1dGgwLmNvbTAeFw0yMzA0MjUwODU0MThaFw0zNzAxMDEwODU0MThaMCwxKjAoBgNVBAMTIWRldi10eXQzaDZkNTZjeTB4aXA3LnVzLmF1dGgwLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAK/2idoD9sJDzYukmOCVC2Qp4nLm2WGkIbdAudSDzb3hEDVTebAUXeDUqi9nQMtXjS5lvXYVQMIHdq1yRLGciSBviO+qT/FGNRm/VncpWYt0mVvf6t/9Y1PJ1krFlo/72FN3VBEClqAccVryPq+pjwswZMWbgBi3BsMdi+HYW2mgPRKeAemaEYcPwPyUpCBiVQo/6cCSlBB+Kigyp33LAJZVakwNA5pxEfnhUwifiyBzO+xH5m4ol8mcDznsmiBYddxqVQ7qaYds4HSpwSzArdxLnlFj1nVwusJyGsjZD4pCMZuoWXLGPs4ldBgzLH5Dq6UtsCKPZGhRzYA4Au7qVGcCAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUrh9OF0EmZv3h3BmcuCF05qLDYokwDgYDVR0PAQH/BAQDAgKEMA0GCSqGSIb3DQEBCwUAA4IBAQAoo/z1LTjEmGrm9ilObVDzPSWlvOqDq1lkP8nrROpYkghDPxXQl+8nJ4J0gKwDP6BgTjWzhMk8MyoeCn8wZGI7oBOeBPOeJCbc6WYW2HGvtc86nO3JHHdvDYMO3HbR9LFoxBXhF95nWwgmPd+9uxdHrdfQ1CIXasATWToQgud6rkCgMcNP25LFds36iMCzXDxKiYvn54JaXmGo567U1Rx6O4AwnCG1RHTdtx/CdiIuPAOBl/xUnnsVeCPQgqNl53/6Qtmk9kg15GeeFDsjJoHoZuLZANaGMUBLRMzLU4al3/SRgPJLaEq46BaRq/oX0WvWlGiVegHNWjpOJ5ZSEeS5+MIICpzCCAhACCQDuFX0Db5iljDANBgkqhkiG9w0BAQsFADCBlzELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExEjAQBgNVBAcMCVBhbG8gQWx0bzEQMA4GA1UECgwHU2FtbGluZzEPMA0GA1UECwwGU2FsaW5nMRQwEgYDVQQDDAtjYXByaXphLmNvbTEmMCQGCSqGSIb3DQEJARYXZW5naW5lZXJpbmdAY2Fwcml6YS5jb20wHhcNMTgwNTE1MTgxMTEwWhcNMjgwNTEyMTgxMTEwWjCBlzELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExEjAQBgNVBAcMCVBhbG8gQWx0bzEQMA4GA1UECgwHU2FtbGluZzEPMA0GA1UECwwGU2FsaW5nMRQwEgYDVQQDDAtjYXByaXphLmNvbTEmMCQGCSqGSIb3DQEJARYXZW5naW5lZXJpbmdAY2Fwcml6YS5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAJEBNDJKH5nXr0hZKcSNIY1l4HeYLPBEKJLXyAnoFTdgGrvi40YyIx9lHh0LbDVWCgxJp21BmKll0CkgmeKidvGlr3FUwtETro44L+SgmjiJNbftvFxhNkgA26O2GDQuBoQwgSiagVadWXwJKkodH8tx4ojBPYK1pBO8fHf3wOnxAgMBAAEwDQYJKoZIhvcNAQELBQADgYEACIylhvh6T758hcZjAQJiV7rMRg+Omb68iJI4L9f0cyBcJENR+1LQNgUGyFDMm9Wm9o81CuIKBnfpEE2Jfcs76YVWRJy5xJ11GFKJJ5T0NEB7txbUQPoJOeNoE736lF5vYw6YKp8fJqPW0L2PLWe9qTn8hxpdnjo3k6r5gXyl8tk=diff --git a/modules/auth_saml/spec/fixtures/saml_response.xml b/modules/auth_saml/spec/fixtures/saml_response.xmlindex b995b7f130f..691b6b8a1c6 100644--- a/modules/auth_saml/spec/fixtures/saml_response.xml+++ b/modules/auth_saml/spec/fixtures/saml_response.xml@@ -1 +1 @@-<samlp:Response xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" Version="2.0" ID="_e8f268dc07dad48281a3318e83ad962ccb8e3dc75b" IssueInstant="2023-04-19T09:36:03.256Z" Destination="http://localhost:3000/auth/saml/callback"><saml:Issuer>https://foobar.org</saml:Issuer><ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#"><ds:SignedInfo><ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/><ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/><ds:Reference URI="#_e8f268dc07dad48281a3318e83ad962ccb8e3dc75b"><ds:Transforms><ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/><ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/></ds:Transforms><ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/><ds:DigestValue>/B4p7Ab3QK9Y3XQ5LoUMcJ3hxWkBoFTLMVKmBNS01e0=</ds:DigestValue></ds:Reference></ds:SignedInfo><ds:SignatureValue>f4WLA8kcPXYTIn/8Ra1PjByizB8fqM22H+AJXGfPoO2ZqXEkQzWNcS66FluYns/3XOSP/8yTk5fK7AhOAssXCif6O94XCdk7+roj/Xl+AG9BrgHDQU9ytblNmTU0Q0EFEarlgAuPocCimBqjLcvRFLzyr/nia6XGoREx77bRjSw=</ds:SignatureValue><ds:KeyInfo><ds:X509Data><ds:X509Certificate>MIICpzCCAhACCQDuFX0Db5iljDANBgkqhkiG9w0BAQsFADCBlzELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExEjAQBgNVBAcMCVBhbG8gQWx0bzEQMA4GA1UECgwHU2FtbGluZzEPMA0GA1UECwwGU2FsaW5nMRQwEgYDVQQDDAtjYXByaXphLmNvbTEmMCQGCSqGSIb3DQEJARYXZW5naW5lZXJpbmdAY2Fwcml6YS5jb20wHhcNMTgwNTE1MTgxMTEwWhcNMjgwNTEyMTgxMTEwWjCBlzELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExEjAQBgNVBAcMCVBhbG8gQWx0bzEQMA4GA1UECgwHU2FtbGluZzEPMA0GA1UECwwGU2FsaW5nMRQwEgYDVQQDDAtjYXByaXphLmNvbTEmMCQGCSqGSIb3DQEJARYXZW5naW5lZXJpbmdAY2Fwcml6YS5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAJEBNDJKH5nXr0hZKcSNIY1l4HeYLPBEKJLXyAnoFTdgGrvi40YyIx9lHh0LbDVWCgxJp21BmKll0CkgmeKidvGlr3FUwtETro44L+SgmjiJNbftvFxhNkgA26O2GDQuBoQwgSiagVadWXwJKkodH8tx4ojBPYK1pBO8fHf3wOnxAgMBAAEwDQYJKoZIhvcNAQELBQADgYEACIylhvh6T758hcZjAQJiV7rMRg+Omb68iJI4L9f0cyBcJENR+1LQNgUGyFDMm9Wm9o81CuIKBnfpEE2Jfcs76YVWRJy5xJ11GFKJJ5T0NEB7txbUQPoJOeNoE736lF5vYw6YKp8fJqPW0L2PLWe9qTn8hxpdnjo3k6r5gXyl8tk=</ds:X509Certificate></ds:X509Data></ds:KeyInfo></ds:Signature><samlp:Status><samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"/></samlp:Status><saml:Assertion xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" Version="2.0" ID="_f96ef8785bff51f9c198f768e2b7401af51556c0ca" IssueInstant="2023-04-19T09:36:03.193Z"><saml:Issuer>https://foobar.org</saml:Issuer><ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#"><ds:SignedInfo><ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/><ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/><ds:Reference URI="#_f96ef8785bff51f9c198f768e2b7401af51556c0ca"><ds:Transforms><ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/><ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/></ds:Transforms><ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/><ds:DigestValue>Ztp3jfFiai++82S52hLRZZMUEAm0gYpkSonPC0aVV7I=</ds:DigestValue></ds:Reference></ds:SignedInfo><ds:SignatureValue>bQuXxqLvkyFZuEpD8jab4xBGOz0Xg2i1DhZheCR2CN12VM8PcLhvWjZF7APvNsI6D7HC1SmBQIg2dAQUB1TGO5+ZD5TDDQd90qiKvesW1uYWWh5QP7rvphKvJl/cBXH8w3hbMnC/noC9DMQVL1ugjpa5y7Gzsj6JwNYhjWDPjHc=</ds:SignatureValue><ds:KeyInfo><ds:X509Data><ds:X509Certificate>MIICpzCCAhACCQDuFX0Db5iljDANBgkqhkiG9w0BAQsFADCBlzELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExEjAQBgNVBAcMCVBhbG8gQWx0bzEQMA4GA1UECgwHU2FtbGluZzEPMA0GA1UECwwGU2FsaW5nMRQwEgYDVQQDDAtjYXByaXphLmNvbTEmMCQGCSqGSIb3DQEJARYXZW5naW5lZXJpbmdAY2Fwcml6YS5jb20wHhcNMTgwNTE1MTgxMTEwWhcNMjgwNTEyMTgxMTEwWjCBlzELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExEjAQBgNVBAcMCVBhbG8gQWx0bzEQMA4GA1UECgwHU2FtbGluZzEPMA0GA1UECwwGU2FsaW5nMRQwEgYDVQQDDAtjYXByaXphLmNvbTEmMCQGCSqGSIb3DQEJARYXZW5naW5lZXJpbmdAY2Fwcml6YS5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAJEBNDJKH5nXr0hZKcSNIY1l4HeYLPBEKJLXyAnoFTdgGrvi40YyIx9lHh0LbDVWCgxJp21BmKll0CkgmeKidvGlr3FUwtETro44L+SgmjiJNbftvFxhNkgA26O2GDQuBoQwgSiagVadWXwJKkodH8tx4ojBPYK1pBO8fHf3wOnxAgMBAAEwDQYJKoZIhvcNAQELBQADgYEACIylhvh6T758hcZjAQJiV7rMRg+Omb68iJI4L9f0cyBcJENR+1LQNgUGyFDMm9Wm9o81CuIKBnfpEE2Jfcs76YVWRJy5xJ11GFKJJ5T0NEB7txbUQPoJOeNoE736lF5vYw6YKp8fJqPW0L2PLWe9qTn8hxpdnjo3k6r5gXyl8tk=</ds:X509Certificate></ds:X509Data></ds:KeyInfo></ds:Signature><saml:Subject><saml:NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress">testuser</saml:NameID><saml:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer"><saml:SubjectConfirmationData NotOnOrAfter="2023-04-19T09:46:03.193Z" Recipient="http://localhost:3000/auth/saml/callback"/></saml:SubjectConfirmation></saml:Subject><saml:Conditions NotBefore="2023-04-19T09:36:03.193Z" NotOnOrAfter="2023-04-19T09:46:03.193Z"/><saml:AuthnStatement AuthnInstant="2023-04-19T09:36:03.193Z" SessionNotOnOrAfter="2023-04-19T09:46:03.188Z" SessionIndex="_samling_2425237_5964826476"><saml:AuthnContext><saml:AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:unspecified</saml:AuthnContextClassRef></saml:AuthnContext></saml:AuthnStatement><saml:AttributeStatement xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><saml:Attribute Name="email"><saml:AttributeValue xsi:type="xs:anyType">[email protected]</saml:AttributeValue></saml:Attribute><saml:Attribute Name="givenName"><saml:AttributeValue xsi:type="xs:anyType">test</saml:AttributeValue></saml:Attribute><saml:Attribute Name="sn"><saml:AttributeValue xsi:type="xs:anyType">user</saml:AttributeValue></saml:Attribute></saml:AttributeStatement></saml:Assertion></samlp:Response>+<samlp:Response xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" Version="2.0" ID="_a5cf455f621ef91a5719a088857007282eb9081061" IssueInstant="2024-08-22T09:21:53.578Z" Destination="http://test.host/auth/saml/callback"><saml:Issuer>https://foobar.org</saml:Issuer><ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#"><ds:SignedInfo><ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/><ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/><ds:Reference URI="#_a5cf455f621ef91a5719a088857007282eb9081061"><ds:Transforms><ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/><ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/></ds:Transforms><ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/><ds:DigestValue>1vN2lq+9ndeRFBMdkGaZxQdubvqu2NbLN0tW15WVDAk=</ds:DigestValue></ds:Reference></ds:SignedInfo><ds:SignatureValue>cJp2jnvy7FanTRJGh7cvZhywfspxyJSvNpK5HJntIkaxgCoviApZRk0zdTuiJUiV/dSfp9MvGh0tAQ2cUWwlnMuBXASR6RIsd9itBQAoyCQwHyi7/cDKgreF2M/so6G9Phyglek154759mh/7EvTu+P5+KAgof+YB41zQdsi8EY=</ds:SignatureValue><ds:KeyInfo><ds:X509Data><ds:X509Certificate>MIICpzCCAhACCQDuFX0Db5iljDANBgkqhkiG9w0BAQsFADCBlzELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExEjAQBgNVBAcMCVBhbG8gQWx0bzEQMA4GA1UECgwHU2FtbGluZzEPMA0GA1UECwwGU2FsaW5nMRQwEgYDVQQDDAtjYXByaXphLmNvbTEmMCQGCSqGSIb3DQEJARYXZW5naW5lZXJpbmdAY2Fwcml6YS5jb20wHhcNMTgwNTE1MTgxMTEwWhcNMjgwNTEyMTgxMTEwWjCBlzELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExEjAQBgNVBAcMCVBhbG8gQWx0bzEQMA4GA1UECgwHU2FtbGluZzEPMA0GA1UECwwGU2FsaW5nMRQwEgYDVQQDDAtjYXByaXphLmNvbTEmMCQGCSqGSIb3DQEJARYXZW5naW5lZXJpbmdAY2Fwcml6YS5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAJEBNDJKH5nXr0hZKcSNIY1l4HeYLPBEKJLXyAnoFTdgGrvi40YyIx9lHh0LbDVWCgxJp21BmKll0CkgmeKidvGlr3FUwtETro44L+SgmjiJNbftvFxhNkgA26O2GDQuBoQwgSiagVadWXwJKkodH8tx4ojBPYK1pBO8fHf3wOnxAgMBAAEwDQYJKoZIhvcNAQELBQADgYEACIylhvh6T758hcZjAQJiV7rMRg+Omb68iJI4L9f0cyBcJENR+1LQNgUGyFDMm9Wm9o81CuIKBnfpEE2Jfcs76YVWRJy5xJ11GFKJJ5T0NEB7txbUQPoJOeNoE736lF5vYw6YKp8fJqPW0L2PLWe9qTn8hxpdnjo3k6r5gXyl8tk=</ds:X509Certificate></ds:X509Data></ds:KeyInfo></ds:Signature><samlp:Status><samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"/></samlp:Status><saml:Assertion xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" Version="2.0" ID="_af4373732bcc61e83a3906f056cfae0e6b808a8221" IssueInstant="2024-08-22T09:21:53.536Z"><saml:Issuer>https://foobar.org</saml:Issuer><ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#"><ds:SignedInfo><ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/><ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/><ds:Reference URI="#_af4373732bcc61e83a3906f056cfae0e6b808a8221"><ds:Transforms><ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/><ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/></ds:Transforms><ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/><ds:DigestValue>kavIddInjlzr6lJ6iGeIUU2DerATKPNhZcnezG60seE=</ds:DigestValue></ds:Reference></ds:SignedInfo><ds:SignatureValue>Y2SLLZ2+M4wX0dTd+b/MS+wt9wrPiyi32kL/qTSNIIW9xBHRYkp21xqJ+kwFyk3EjPbcpUUvrAxztlJ6GHsc/rUrWfykHZp/NSFDKtaSeRL44m8jH+AA5lDFIWWl8Zw/OIWKJLfE4IfQTfvjDZz12SiJaj4wgby2enXkvLlUxC8=</ds:SignatureValue><ds:KeyInfo><ds:X509Data><ds:X509Certificate>MIICpzCCAhACCQDuFX0Db5iljDANBgkqhkiG9w0BAQsFADCBlzELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExEjAQBgNVBAcMCVBhbG8gQWx0bzEQMA4GA1UECgwHU2FtbGluZzEPMA0GA1UECwwGU2FsaW5nMRQwEgYDVQQDDAtjYXByaXphLmNvbTEmMCQGCSqGSIb3DQEJARYXZW5naW5lZXJpbmdAY2Fwcml6YS5jb20wHhcNMTgwNTE1MTgxMTEwWhcNMjgwNTEyMTgxMTEwWjCBlzELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExEjAQBgNVBAcMCVBhbG8gQWx0bzEQMA4GA1UECgwHU2FtbGluZzEPMA0GA1UECwwGU2FsaW5nMRQwEgYDVQQDDAtjYXByaXphLmNvbTEmMCQGCSqGSIb3DQEJARYXZW5naW5lZXJpbmdAY2Fwcml6YS5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAJEBNDJKH5nXr0hZKcSNIY1l4HeYLPBEKJLXyAnoFTdgGrvi40YyIx9lHh0LbDVWCgxJp21BmKll0CkgmeKidvGlr3FUwtETro44L+SgmjiJNbftvFxhNkgA26O2GDQuBoQwgSiagVadWXwJKkodH8tx4ojBPYK1pBO8fHf3wOnxAgMBAAEwDQYJKoZIhvcNAQELBQADgYEACIylhvh6T758hcZjAQJiV7rMRg+Omb68iJI4L9f0cyBcJENR+1LQNgUGyFDMm9Wm9o81CuIKBnfpEE2Jfcs76YVWRJy5xJ11GFKJJ5T0NEB7txbUQPoJOeNoE736lF5vYw6YKp8fJqPW0L2PLWe9qTn8hxpdnjo3k6r5gXyl8tk=</ds:X509Certificate></ds:X509Data></ds:KeyInfo></ds:Signature><saml:Subject><saml:NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress">foo</saml:NameID><saml:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer"><saml:SubjectConfirmationData NotOnOrAfter="2024-08-22T09:31:53.536Z" Recipient="http://test.host/auth/saml/callback"/></saml:SubjectConfirmation></saml:Subject><saml:Conditions NotBefore="2024-08-22T09:21:53.536Z" NotOnOrAfter="2024-08-22T09:31:53.536Z"/><saml:AuthnStatement AuthnInstant="2024-08-22T09:21:53.536Z" SessionNotOnOrAfter="2024-08-22T09:31:53.533Z" SessionIndex="_samling_4157567_3255997756"><saml:AuthnContext><saml:AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:unspecified</saml:AuthnContextClassRef></saml:AuthnContext></saml:AuthnStatement><saml:AttributeStatement xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><saml:Attribute Name="email"><saml:AttributeValue xsi:type="xs:anyType">[email protected]</saml:AttributeValue></saml:Attribute><saml:Attribute Name="givenName"><saml:AttributeValue xsi:type="xs:anyType">Foo</saml:AttributeValue></saml:Attribute><saml:Attribute Name="sn"><saml:AttributeValue xsi:type="xs:anyType">User</saml:AttributeValue></saml:Attribute><saml:Attribute Name="login"><saml:AttributeValue xsi:type="xs:anyType">foo_user</saml:AttributeValue></saml:Attribute></saml:AttributeStatement></saml:Assertion></samlp:Response>diff --git a/modules/auth_saml/spec/requests/saml_provider_callback_spec.rb b/modules/auth_saml/spec/requests/saml_provider_callback_spec.rbindex fdf296962b5..5a1a32eafb8 100644--- a/modules/auth_saml/spec/requests/saml_provider_callback_spec.rb+++ b/modules/auth_saml/spec/requests/saml_provider_callback_spec.rb@@ -28,6 +28,7 @@require "spec_helper"require "rack/test"+require_relative "../support/certificate_helper"RSpec.describe "SAML provider callback",type: :rails_request,@@ -35,6 +36,19 @@ RSpec.describe "SAML provider callback",include Rack::Test::Methodsinclude API::V3::Utilities::PathHelper+ let!(:provider) do+ create(:saml_provider,+ display_name: "SAML",+ slug: "saml",+ digest_method: "http://www.w3.org/2001/04/xmlenc#sha256",+ sp_entity_id: "https://foobar.org",+ idp_cert:,+ idp_cert_fingerprint:)+ end++ let(:idp_cert) { nil }+ let(:idp_cert_fingerprint) { "B7:11:A4:22:A0:57:9D:A6:30:06:3C:BF:AC:44:8F:90:BE:5A:E2:3F" }+let(:saml_response) doxml = File.read("#{File.dirname(__FILE__)}/../fixtures/saml_response.xml")Base64.encode64(xml)@@ -44,41 +58,12 @@ RSpec.describe "SAML provider callback",{ SAMLResponse: saml_response }end- let(:issuer) { "https://foobar.org" }- let(:fingerprint) { "b711a422a0579da630063cbfac448f90be5ae23f" }-- let(:config) do- {- "name" => "saml",- "display_name" => "SAML",- "assertion_consumer_service_url" => "http://localhost:3000/auth/saml/callback",- "issuer" => issuer,- "idp_cert_fingerprint" => fingerprint,- "idp_sso_target_url" => "https://foobar.org/login",- "idp_slo_target_url" => "https://foobar.org/logout",- "security" => {- "digest_method" => "http://www.w3.org/2001/04/xmlenc#sha256",- "check_idp_cert_expiration" => false- },- "attribute_statements" => {- "email" => ["email", "urn:oid:0.9.2342.19200300.100.1.3"],- "login" => ["uid", "email", "urn:oid:0.9.2342.19200300.100.1.3"],- "first_name" => ["givenName", "urn:oid:2.5.4.42"],- "last_name" => ["sn", "urn:oid:2.5.4.4"]- }- }+ let(:request) do+ post "/auth/saml/callback", bodyend- let(:request) { post "/auth/saml/callback", body }-subject do- Timecop.freeze("2023-04-19T09:37:00Z".to_datetime) { request }- end-- before do- Setting.plugin_openproject_auth_saml = {- "providers" => { "saml" => config }- }+ Timecop.freeze("2024-08-22T09:22:00Z".to_datetime) { request }endshared_examples "request fails" do |message|@@ -89,9 +74,15 @@ RSpec.describe "SAML provider callback",endend- it "redirects user when no errors occured" do- expect(subject.status).to eq(302)- expect(subject.headers["Location"]).to eq("http://#{Setting.host_name}/two_factor_authentication/request")+ shared_examples "request succeeds" do+ it "redirects user when no errors occured" do+ expect(subject.status).to eq(302)+ expect(subject.headers["Location"]).to eq("http://#{Setting.host_name}/two_factor_authentication/request")+ end+ end++ context "with valid basic configuration" do+ it_behaves_like "request succeeds"endcontext "with an invalid timestamp" do@@ -105,7 +96,21 @@ RSpec.describe "SAML provider callback",endcontext "with an invalid fingerprint" do- let(:fingerprint) { "invalid" }+ let(:idp_cert_fingerprint) { "invalid" }++ it_behaves_like "request fails"+ end++ context "when providing the valid certificate" do+ let(:idp_cert) { File.read(Rails.root.join("modules/auth_saml/spec/fixtures/idp_cert_plain.txt").to_s) }+ let(:idp_cert_fingerprint) { nil }++ it_behaves_like "request succeeds"+ end++ context "when providing an invalid certificate" do+ let(:idp_cert) { CertificateHelper.expired_certificate.to_pem }+ let(:idp_cert_fingerprint) { nil }it_behaves_like "request fails", "Fingerprint mismatch"end