diff --git a/utils/index.ts b/utils/index.ts index dfc5337..cb06a59 100644 --- a/utils/index.ts +++ b/utils/index.ts @@ -66,27 +66,59 @@ const extractCert = (certificate: string) => { .trim(); }; -// Create SAML Response XML -const createSAMLResponseXML = async (user: User): Promise => { - const xmlPath = path.join('data', 'saml-response.xml'); - const xml = await fs.readFile(xmlPath, 'utf8'); +// Create SAMLResponse +const createSAMLResponse = async (user: User): Promise => { + - return xml - .replace( - /idp_entity_id/g, - 'https://accounts.google.com/o/saml2?idpid=C02frd9s1' - ) - .replace('sp_acs_url', 'some-url') - .replace(/user_email/g, 'kiran@demo.com') - .replace('user_firstName', 'Kiran') - .replace('user_lastName', 'K'); + return ""; + + // const xmlPath = path.join('data', 'saml-response.xml'); + // const xml = await fs.readFile(xmlPath, 'utf8'); + + // return xml + // .replace( + // /idp_entity_id/g, + // 'https://accounts.google.com/o/saml2?idpid=C02frd9s1' + // ) + // .replace('sp_acs_url', 'some-url') + // .replace(/user_email/g, 'kiran@demo.com') + // .replace('user_firstName', 'Kiran') + // .replace('user_lastName', 'K'); +}; + +// +// base64 encode + +export const createResponseForm = (relayState: string, samlResponse: string, acsUrl: string) => { + const formElements = [ + '', + '', + '', + '', + '', + '', + '', + '', + '
', + '', + '', + '', + '
', + '', + '', + '', + ]; + + return formElements.join(''); }; export { parseXML, extractSAMLRequestAttributes, createIdPMetadataXML, - createSAMLResponseXML, + createSAMLResponse, createCertificate, extractCert, }; \ No newline at end of file