Skip to content

Commit

Permalink
Fix assertion and update test asset
Browse files Browse the repository at this point in the history
  • Loading branch information
niwsa committed Nov 12, 2023
1 parent 954704e commit 6081a64
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
16 changes: 8 additions & 8 deletions test/assets/saml20.validResponse.multicertsMetadata.xml
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<samlp:Response xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" Version="2.0" ID="_358c209884fefd445fcf" Destination="http://localhost:5225/api/oauth/saml" InResponseTo="_fbea42e00dd6b644fe49" IssueInstant="2023-11-12T11:28:33.547Z">
<samlp:Response xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" Version="2.0" ID="_b3aff6d60f0b2f08ebce" Destination="http://localhost:5225/api/oauth/saml" InResponseTo="_5565edebaaa9b541f631" IssueInstant="2023-11-12T16:27:08.435Z">
<saml:Issuer xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity">https://saml.example.com/entityid-localhost</saml:Issuer>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
<SignedInfo>
<CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"></CanonicalizationMethod>
<SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"></SignatureMethod>
<Reference URI="#_358c209884fefd445fcf">
<Reference URI="#_b3aff6d60f0b2f08ebce">
<Transforms>
<Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform>
<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"></Transform>
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
<DigestValue>7qRjBoC8UsfMhk+JPKeeoCA7H729qQf8pMb1sMoR32M=</DigestValue>
<DigestValue>QC5SPiqIu6l5yvHIJDTO8Ev7qNcMyCoW34xWm3gpr+E=</DigestValue>
</Reference>
</SignedInfo>
<SignatureValue>kO5oDQTe1U/UgSpQ+KSJCUIa70IxtS0tezkR5gIxrOGwYUSA5rztcBC2vY0JRfCHKemTFJ6Q7c40cArhEjFgoAHwtdigPiFOtKiajt9YEpAlbfSHBTwzc0EWwdS4IZLdK5OqwxhRoMXZh4E6BlvaiW+47u7kyySzcXn46ufx4liAbGt1ANlXmjS4g+wQzIJHh3XDYspGCwp26HCDDz9r+OcnH0G8r9lSl7kSJNCnNVhYs3JNKIxFXPK/GUgfPzpT0455veXss98pjS4AaD2HO63iGkCn1ZkiKO1wJaY+bnnaMcw70WK78SkLvqvdrtBH9IcXbTReMNEoZaLlCj0aQQ==</SignatureValue>
<SignatureValue>Zfdc2ALQ7CamXQlh+VLEAYWmtYSbqMP67akMSUh0kmHDTBwwX+eSjflGqZtcmtS1r2pz9X0LR+kI+IVIPkplIl24Ooxqo3C89SePXD42CzyyhmYON+vfvqwacs/JXBQZm1MJPtmZZh8iWxjX5s00EQ44/1NFZ7dJn4vLGomSEP3LfFLzXcx4du9ug08oQMQxT8NAgc5/y8tih5RpS+RfMp/tLdVWTu4G1ml9fPbX8oWTa0HDP6oIArjKuT15Cw4OxN/+m5LyJTIy0ZhV14NPp0EAFcQUTaJJJR1P6CV1bjw5luR15gBm5j+/c/B63WXfhpVyFAJQixQ39yqsVj4cQA==</SignatureValue>
</Signature>
<samlp:Status>
<samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"></samlp:StatusCode>
</samlp:Status>
<saml:Assertion xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" Version="2.0" ID="_74c85e15813f1b35c334" IssueInstant="2023-11-12T11:28:33.547Z">
<saml:Assertion xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" Version="2.0" ID="_a37c1d9d904ec4f0b9ca" IssueInstant="2023-11-12T16:27:08.435Z">
<saml:Issuer>https://saml.example.com/entityid-localhost</saml:Issuer>
<saml:Subject>
<saml:NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified">[email protected]</saml:NameID>
<saml:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer">
<saml:SubjectConfirmationData InResponseTo="_fbea42e00dd6b644fe49" NotOnOrAfter="2023-11-12T11:33:33.547Z" Recipient="http://localhost:5225/api/oauth/saml"></saml:SubjectConfirmationData>
<saml:SubjectConfirmationData InResponseTo="_5565edebaaa9b541f631" NotOnOrAfter="2023-11-12T16:32:08.435Z" Recipient="http://localhost:5225/api/oauth/saml"></saml:SubjectConfirmationData>
</saml:SubjectConfirmation>
</saml:Subject>
<saml:Conditions NotBefore="2023-11-12T11:23:33.547Z" NotOnOrAfter="2023-11-12T11:33:33.547Z">
<saml:Conditions NotBefore="2023-11-12T16:22:08.435Z" NotOnOrAfter="2023-11-12T16:32:08.435Z">
<saml:AudienceRestriction>
<saml:Audience>https://saml.boxyhq.com</saml:Audience>
</saml:AudienceRestriction>
</saml:Conditions>
<saml:AuthnStatement AuthnInstant="2023-11-12T11:28:33.547Z" SessionIndex="_YIlFoNFzLMDYxdwf-T_BuimfkGa5qhKg">
<saml:AuthnStatement AuthnInstant="2023-11-12T16:27:08.435Z" SessionIndex="_YIlFoNFzLMDYxdwf-T_BuimfkGa5qhKg">
<saml:AuthnContext>
<saml:AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:unspecified</saml:AuthnContextClassRef>
</saml:AuthnContext>
Expand Down
3 changes: 2 additions & 1 deletion test/lib/validateSignature.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ describe('validateSignature.ts', function () {
});

it('validate Response signature multicert metadata', function () {
expect(validateSignature(validResponseWithMultiCertsMetadata, multiPublicKey, null));
const value = validateSignature(validResponseWithMultiCertsMetadata, multiPublicKey, null);
expect(value).to.be.ok;
});

it('validateSignature public key not ok ', function () {
Expand Down

0 comments on commit 6081a64

Please sign in to comment.