Skip to content

Commit bc21928

Browse files
committed
Fix genrateNameID tests
1 parent 516ab9d commit bc21928

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

tests/src/OneLogin/Saml2/UtilsTest.php

+12-7
Original file line numberDiff line numberDiff line change
@@ -855,13 +855,14 @@ public function testGenerateNameIdWithSPNameQualifier()
855855
$key
856856
);
857857

858-
$nameidExpectedEnc = '<saml:EncryptedID><xenc:EncryptedData xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" Type="http://www.w3.org/2001/04/xmlenc#Element"><xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#aes128-cbc"/><dsig:KeyInfo xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"><xenc:EncryptedKey><xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/><xenc:CipherData><xenc:CipherValue>';
858+
$nameidExpectedEncId = '<saml:EncryptedID><xenc:EncryptedData xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"';
859+
$nameidExpectedEncData = '<xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#aes128-cbc"/><dsig:KeyInfo xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"><xenc:EncryptedKey><xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/><xenc:CipherData><xenc:CipherValue>';
859860

860-
$this->assertStringContainsString($nameidExpectedEnc, $nameIdEnc);
861+
$this->assertStringContainsString($nameidExpectedEncId, $nameIdEnc);
862+
$this->assertStringContainsString($nameidExpectedEncData, $nameIdEnc);
861863

862864
// Check AES128_GCM support
863-
864-
$nameidExpectedEnc = '<saml:EncryptedID><xenc:EncryptedData xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" Type="http://www.w3.org/2001/04/xmlenc#Element"><xenc:EncryptionMethod Algorithm="http://www.w3.org/2009/xmlenc11#aes128-gcm"/><dsig:KeyInfo xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"><xenc:EncryptedKey><xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p"/><xenc:CipherData><xenc:CipherValue>';
865+
$nameidExpectedEncData = '<xenc:EncryptionMethod Algorithm="http://www.w3.org/2009/xmlenc11#aes128-gcm"/><dsig:KeyInfo xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"><xenc:EncryptedKey><xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p"/><xenc:CipherData><xenc:CipherValue>';
865866

866867
$nameIdEnc = Utils::generateNameId(
867868
$nameIdValue,
@@ -871,7 +872,8 @@ public function testGenerateNameIdWithSPNameQualifier()
871872
null,
872873
XMLSecurityKey::AES128_GCM
873874
);
874-
$this->assertStringContainsString($nameidExpectedEnc, $nameIdEnc);
875+
$this->assertStringContainsString($nameidExpectedEncId, $nameIdEnc);
876+
$this->assertStringContainsString($nameidExpectedEncData, $nameIdEnc);
875877
}
876878

877879
/**
@@ -928,8 +930,11 @@ public function testGenerateNameIdWithoutSPNameQualifier()
928930
$key
929931
);
930932

931-
$nameidExpectedEnc = '<saml:EncryptedID><xenc:EncryptedData xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" Type="http://www.w3.org/2001/04/xmlenc#Element"><xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#aes128-cbc"/><dsig:KeyInfo xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"><xenc:EncryptedKey><xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/><xenc:CipherData><xenc:CipherValue>';
932-
$this->assertStringContainsString($nameidExpectedEnc, $nameIdEnc);
933+
$nameidExpectedEncId = '<saml:EncryptedID><xenc:EncryptedData xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"';
934+
$nameidExpectedEncData = '<xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#aes128-cbc"/><dsig:KeyInfo xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"><xenc:EncryptedKey><xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/><xenc:CipherData><xenc:CipherValue>';
935+
936+
$this->assertStringContainsString($nameidExpectedEncId, $nameIdEnc);
937+
$this->assertStringContainsString($nameidExpectedEncData, $nameIdEnc);
933938
}
934939

935940
/**

0 commit comments

Comments
 (0)