samlesa 4.7.6 → 4.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -118,18 +118,26 @@ function verifySignature(xml, signatureNodes, opts) {
118
118
  const publicKeys = resolvePublicCertificates(signatureNode, opts);
119
119
  let verifiedSig = null;
120
120
  let lastError = null;
121
+ const parentXml = signatureNode?.parentNode ? serializeWithInheritedNamespaces(signatureNode.parentNode) : '';
122
+ const rawParentXml = signatureNode?.parentNode?.toString?.() || '';
123
+ const xmlCandidates = uniqueXmlCandidates([xml, parentXml, rawParentXml]);
121
124
  for (const publicKey of publicKeys) {
122
- try {
123
- const sig = new SignedXml();
124
- sig.publicCert = publicKey;
125
- sig.loadSignature(signatureNode);
126
- if (sig.checkSignature(xml)) {
127
- verifiedSig = sig;
128
- break;
125
+ for (const xmlCandidate of xmlCandidates) {
126
+ try {
127
+ const sig = new SignedXml();
128
+ sig.publicCert = publicKey;
129
+ sig.loadSignature(signatureNode);
130
+ if (sig.checkSignature(xmlCandidate)) {
131
+ verifiedSig = sig;
132
+ break;
133
+ }
134
+ }
135
+ catch (error) {
136
+ lastError = error;
129
137
  }
130
138
  }
131
- catch (error) {
132
- lastError = error;
139
+ if (verifiedSig) {
140
+ break;
133
141
  }
134
142
  }
135
143
  if (!verifiedSig) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "samlesa",
3
- "version": "4.7.6",
3
+ "version": "4.8.0",
4
4
  "description": "High-level API for Single Sign On (SAML 2.0) baseed on samlify ",
5
5
  "main": "build/index.js",
6
6
  "keywords": [
@@ -1 +1 @@
1
- {"version":3,"file":"libsamlSoap.d.ts","sourceRoot":"","sources":["../../src/libsamlSoap.ts"],"names":[],"mappings":"AAKA,OAAgB,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AA2FjE,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,iBAAiB,GAAG,kBAAkB,CAAC;IAC7C,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,yBAAyB,CAAC,EAAE,MAAM,EAAE,CAAC;IACrC,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AA4ID,iBAAe,2BAA2B,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,wBAAwB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAoCpH;;;;AAED,wBAEE"}
1
+ {"version":3,"file":"libsamlSoap.d.ts","sourceRoot":"","sources":["../../src/libsamlSoap.ts"],"names":[],"mappings":"AAKA,OAAgB,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AA2FjE,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,iBAAiB,GAAG,kBAAkB,CAAC;IAC7C,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,yBAAyB,CAAC,EAAE,MAAM,EAAE,CAAC;IACrC,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAqJD,iBAAe,2BAA2B,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,wBAAwB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAoCpH;;;;AAED,wBAEE"}