Skip to content
Closed
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
2 changes: 1 addition & 1 deletion src/flow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ async function postFlow(options): Promise<FlowResult> {
checkSignature &&
from.entitySetting.messageSigningOrder === MessageSignatureOrder.ETS
) {
const [verified, verifiedAssertionNode] = libsaml.verifySignature(samlContent, verificationOptions);
const [verified, verifiedAssertionNode] = libsaml.verifySignature(samlContent, verificationOptions, decryptRequired);
if (!verified) {
return Promise.reject('ERR_FAIL_TO_VERIFY_ETS_SIGNATURE');
}
Expand Down
5 changes: 4 additions & 1 deletion src/libsaml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ const libSaml = () => {
* - The first element is `true` if the signature is valid, `false` otherwise.
* - The second element is the cryptographically authenticated assertion node as a string, or `null` if not found.
*/
verifySignature(xml: string, opts: SignatureVerifierOptions) {
verifySignature(xml: string, opts: SignatureVerifierOptions, isAssertionEncrypted: boolean = false) {
const { dom } = getContext();
const doc = dom.parseFromString(xml);

Expand Down Expand Up @@ -485,6 +485,9 @@ const libSaml = () => {
// now we can process the assertion as an assertion
if (assertions.length === 1) {
return [true, assertions[0].toString()];
} else if (isAssertionEncrypted) {
// if the assertions are encrypted there will be no 'Assertion' nodes
return [true, null];
}
} else if (rootNode.localName === 'Assertion') {
return [true, rootNode.toString()];
Expand Down