Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/flow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,8 @@ async function postFlow(options: FlowOptions): Promise<FlowResult> {
} else if (decryptRequired && !verified) {
// Encrypted assertion, signature is on the assertion itself.
const result = await libsaml.decryptAssertion(self, samlContent);
const decryptedDoc = result[0];
const [decryptedDocVerified, verifiedDecryptedAssertion] = libsaml.verifySignature(decryptedDoc, verificationOptions);
samlContent = result[0];
const [decryptedDocVerified, verifiedDecryptedAssertion] = libsaml.verifySignature(samlContent, verificationOptions);
if (decryptedDocVerified) {
extractorFields = getDefaultExtractorFields(parserType, verifiedDecryptedAssertion);
} else {
Expand Down
3 changes: 1 addition & 2 deletions src/libsaml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -642,8 +642,7 @@ const libSaml = () => {
}

sig.loadSignature(signatureNode);

verified = sig.checkSignature(doc.toString());
verified = sig.checkSignature(xml);

if (!verified) {
continue;
Expand Down
3 changes: 3 additions & 0 deletions test/flow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ test('send response with signed assertion and parse it', async () => {
expect(typeof id).toBe('string');
expect(samlContent.startsWith('<samlp:Response')).toBe(true);
expect(samlContent.endsWith('/samlp:Response>')).toBe(true);
expect(samlContent).toContain('>user@esaml2.com</saml:NameID>')
expect(extract.nameID).toBe('user@esaml2.com');
expect(extract.response.inResponseTo).toBe('request_id');
});
Expand Down Expand Up @@ -955,6 +956,7 @@ test('send login response with encrypted non-signed assertion and parse it', asy
expect(typeof id).toBe('string');
expect(samlContent.startsWith('<samlp:Response')).toBe(true);
expect(samlContent.endsWith('/samlp:Response>')).toBe(true);
expect(samlContent).toContain('>user@esaml2.com</saml:NameID>')
expect(extract.nameID).toBe('user@esaml2.com');
expect(extract.response.inResponseTo).toBe('request_id');
});
Expand Down Expand Up @@ -1133,6 +1135,7 @@ test('send login response with encrypted non-signed assertion with EncryptThenSi
expect(typeof id).toBe('string');
expect(samlContent.startsWith('<samlp:Response')).toBe(true);
expect(samlContent.endsWith('/samlp:Response>')).toBe(true);
expect(samlContent).toContain('>user@esaml2.com</saml:NameID>')
expect(extract.nameID).toBe('user@esaml2.com');
});

Expand Down