Pārlūkot izejas kodu

Merge pull request #22824 from overleaf/jel-saml-tests

[web] SAML test helper update

GitOrigin-RevId: 6a721901b0026286e0ef28ed9168c8b97cd4a200
Jessica Lawshe 1 gadu atpakaļ
vecāks
revīzija
76c0e6f84d

+ 3 - 1
services/web/test/acceptance/src/helpers/SAMLHelper.mjs

@@ -57,7 +57,9 @@ function createMockSamlAssertion(samlData = {}, opts = {}) {
   const { signedAssertion = true } = opts
   const { signedAssertion = true } = opts
 
 
   const userIdAttributeName = samlData.userIdAttribute || 'uniqueId'
   const userIdAttributeName = samlData.userIdAttribute || 'uniqueId'
-  const userIdAttribute = `<saml:AttributeStatement>
+  const userIdAttribute =
+    uniqueId &&
+    `<saml:AttributeStatement>
     <saml:Attribute Name="${userIdAttributeName}" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified">
     <saml:Attribute Name="${userIdAttributeName}" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified">
       <saml:AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">${uniqueId}</saml:AttributeValue>
       <saml:AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">${uniqueId}</saml:AttributeValue>
     </saml:Attribute>
     </saml:Attribute>