diff --git a/pages/api/saml/sso.ts b/pages/api/saml/sso.ts index e51f7a0..6d0f477 100644 --- a/pages/api/saml/sso.ts +++ b/pages/api/saml/sso.ts @@ -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); diff --git a/utils/response.ts b/utils/response.ts index cc4cd5d..11dc157 100644 --- a/utils/response.ts +++ b/utils/response.ts @@ -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';