Fix the signing -wip

This commit is contained in:
Kiran 2022-02-21 21:37:39 +05:30
parent b53c3b41b7
commit 631a3b6884
2 changed files with 1 additions and 5 deletions

View File

@ -42,8 +42,7 @@ export default async function handler(
const signingKey = await fetchPrivateKey();
const publicKey = await fetchPublicKey();
const xmlSigned = await signResponseXML(xml, signingKey, publicKey);
const encodedSamlResponse = Buffer.from(xmlSigned).toString('base64');
const encodedSamlResponse = Buffer.from(xmlSigned).toString('base64');
const html = createResponseForm(relayState, encodedSamlResponse, acsUrl);

View File

@ -147,9 +147,6 @@ const signResponseXML = async (xml: string, signingKey: any, publicKey: any): Pr
const responseXPath = '/*[local-name(.)="Response" and namespace-uri(.)="urn:oasis:names:tc:SAML:2.0:protocol"]';
const issuerXPath = '/*[local-name(.)="Issuer" and namespace-uri(.)="urn:oasis:names:tc:SAML:2.0:assertion"]';
publicKey = publicKey.replace(/\\n/gm, '\n');
signingKey = signingKey.replace(/\\n/gm, '\n');
console.log({publicKey, signingKey})
sig.signatureAlgorithm = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256';