@authhero/saml 0.4.8 → 0.5.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.
- package/LICENSE +661 -21
- package/dist/core.cjs +4 -4
- package/dist/core.mjs +1661 -622
- package/dist/local-signer.mjs +15 -15
- package/dist/saml.cjs +4 -4
- package/dist/saml.mjs +1666 -627
- package/dist/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +3 -2
package/dist/local-signer.mjs
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
//#region src/signers/local.ts
|
|
2
|
-
var e = "http://www.w3.org/2001/10/xml-exc-c14n#",
|
|
3
|
-
async signSAML(
|
|
2
|
+
var e = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256", t = "http://www.w3.org/2001/04/xmlenc#sha256", n = "http://www.w3.org/2001/10/xml-exc-c14n#", r = class {
|
|
3
|
+
async signSAML(r, i, a) {
|
|
4
4
|
try {
|
|
5
|
-
let
|
|
6
|
-
if (!
|
|
7
|
-
let
|
|
8
|
-
privateKey:
|
|
9
|
-
publicCert:
|
|
5
|
+
let o = await import("xml-crypto"), s = o.SignedXml || o.default?.SignedXml;
|
|
6
|
+
if (!s) throw Error("SignedXml not found in xml-crypto module");
|
|
7
|
+
let c = new s({
|
|
8
|
+
privateKey: i,
|
|
9
|
+
publicCert: a
|
|
10
10
|
});
|
|
11
|
-
|
|
11
|
+
c.canonicalizationAlgorithm = n, c.addReference({
|
|
12
12
|
xpath: "(/*[local-name()='Response']/*[local-name()='Assertion'])[1]",
|
|
13
|
-
digestAlgorithm:
|
|
14
|
-
transforms: ["http://www.w3.org/2000/09/xmldsig#enveloped-signature",
|
|
15
|
-
}),
|
|
16
|
-
let
|
|
17
|
-
return
|
|
13
|
+
digestAlgorithm: t,
|
|
14
|
+
transforms: ["http://www.w3.org/2000/09/xmldsig#enveloped-signature", n]
|
|
15
|
+
}), c.signatureAlgorithm = e;
|
|
16
|
+
let l = a.replace(/-----BEGIN CERTIFICATE-----|-----END CERTIFICATE-----/g, "").replace(/\s/g, "");
|
|
17
|
+
return c.keyInfoProvider = { getKeyInfo: () => `<X509Data><X509Certificate>${l}</X509Certificate></X509Data>` }, c.computeSignature(r, { location: {
|
|
18
18
|
reference: "/*[local-name()='Response']/*[local-name()='Assertion']/*[local-name()='Issuer']",
|
|
19
19
|
action: "after"
|
|
20
|
-
} }),
|
|
20
|
+
} }), c.getSignedXml();
|
|
21
21
|
} catch (e) {
|
|
22
22
|
throw Error(`Failed to sign SAML locally. Make sure xml-crypto is installed. Error: ${e}`);
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
26
|
//#endregion
|
|
27
|
-
export {
|
|
27
|
+
export { r as LocalSamlSigner };
|