Add prettier config and format files
This commit is contained in:
parent
e25bb86413
commit
4022901ea9
11
.prettierrc.js
Normal file
11
.prettierrc.js
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
module.exports = {
|
||||||
|
bracketSpacing: true,
|
||||||
|
bracketSameLine: true,
|
||||||
|
singleQuote: true,
|
||||||
|
jsxSingleQuote: true,
|
||||||
|
trailingComma: "es5",
|
||||||
|
semi: true,
|
||||||
|
printWidth: 110,
|
||||||
|
arrowParens: "always",
|
||||||
|
importOrderSeparation: true,
|
||||||
|
};
|
||||||
@ -6,4 +6,4 @@ export default {
|
|||||||
appUrl,
|
appUrl,
|
||||||
entityId,
|
entityId,
|
||||||
ssoUrl,
|
ssoUrl,
|
||||||
};
|
};
|
||||||
|
|||||||
9
pages/api/saml/auth.ts
Normal file
9
pages/api/saml/auth.ts
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import type { NextApiRequest, NextApiResponse } from "next";
|
||||||
|
|
||||||
|
export async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||||
|
if (req.method === "POST") {
|
||||||
|
res.status(200).json({ name: "John Doe" });
|
||||||
|
} else {
|
||||||
|
res.status(405).send(`Method ${req.method} Not Allowed`);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -3,15 +3,11 @@ import { fetchPublicKey, createIdPMetadataXML } from '../../../../utils';
|
|||||||
import { IdPMetadata } from '../../../../types';
|
import { IdPMetadata } from '../../../../types';
|
||||||
import stream from 'stream';
|
import stream from 'stream';
|
||||||
import { promisify } from 'util';
|
import { promisify } from 'util';
|
||||||
import config from '../../../../lib/env'
|
import config from '../../../../lib/env';
|
||||||
|
|
||||||
const pipeline = promisify(stream.pipeline);
|
const pipeline = promisify(stream.pipeline);
|
||||||
|
|
||||||
export default async function handler(
|
export default async function handler(req: NextApiRequest, res: NextApiResponse<IdPMetadata | string>) {
|
||||||
req: NextApiRequest,
|
|
||||||
res: NextApiResponse<IdPMetadata | string>
|
|
||||||
) {
|
|
||||||
|
|
||||||
switch (req.method) {
|
switch (req.method) {
|
||||||
case 'GET':
|
case 'GET':
|
||||||
return await downloadMetadata();
|
return await downloadMetadata();
|
||||||
@ -32,4 +28,4 @@ export default async function handler(
|
|||||||
|
|
||||||
await pipeline(xml, res);
|
await pipeline(xml, res);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,15 +1,11 @@
|
|||||||
import type { NextApiRequest, NextApiResponse } from 'next';
|
import type { NextApiRequest, NextApiResponse } from 'next';
|
||||||
import { createResponseForm, createResponseXML } from 'utils';
|
import { createResponseForm, createResponseXML, extractSAMLRequestAttributes } from 'utils';
|
||||||
import { User } from 'types';
|
import { User } from 'types';
|
||||||
import config from '../../../lib/env'
|
import config from '../../../lib/env';
|
||||||
import { signResponseXML } from 'utils/response';
|
import { signResponseXML } from 'utils/response';
|
||||||
import { fetchPrivateKey, fetchPublicKey } from 'utils/certificate';
|
import { fetchPrivateKey, fetchPublicKey } from 'utils/certificate';
|
||||||
|
|
||||||
export default async function handler(
|
export default async function handler(req: NextApiRequest, res: NextApiResponse<string>) {
|
||||||
req: NextApiRequest,
|
|
||||||
res: NextApiResponse<string>
|
|
||||||
) {
|
|
||||||
|
|
||||||
switch (req.method) {
|
switch (req.method) {
|
||||||
case 'GET':
|
case 'GET':
|
||||||
return await processSAMLRequest();
|
return await processSAMLRequest();
|
||||||
@ -48,4 +44,4 @@ export default async function handler(
|
|||||||
|
|
||||||
res.send(html);
|
res.send(html);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,7 +8,7 @@ const inflateRawAsync = promisify(inflateRaw);
|
|||||||
const parseXML = (xml: string): Promise<Record<string, any>> => {
|
const parseXML = (xml: string): Promise<Record<string, any>> => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
xml2js.parseString(xml, (err: Error, result: any) => {
|
xml2js.parseString(xml, (err: Error, result: any) => {
|
||||||
if(err) {
|
if (err) {
|
||||||
reject(err);
|
reject(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,7 +34,4 @@ const extractSAMLRequestAttributes = async (samlRequest: string) => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export { extractSAMLRequestAttributes };
|
||||||
export {
|
|
||||||
extractSAMLRequestAttributes,
|
|
||||||
}
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user