Fix idpIdentityId
This commit is contained in:
parent
55d12727cc
commit
4f777fd08d
@ -7,10 +7,10 @@ import {
|
|||||||
fetchPublicKey,
|
fetchPublicKey,
|
||||||
signResponseXML,
|
signResponseXML,
|
||||||
} from 'utils';
|
} from 'utils';
|
||||||
|
import config from 'lib/env';
|
||||||
|
|
||||||
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
|
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||||
if (req.method === 'POST') {
|
if (req.method === 'POST') {
|
||||||
console.log(req.body);
|
|
||||||
const email = req.body.email;
|
const email = req.body.email;
|
||||||
if (!email.endsWith('@example.com')) {
|
if (!email.endsWith('@example.com')) {
|
||||||
res.status(403).send(`${email} denied access`);
|
res.status(403).send(`${email} denied access`);
|
||||||
@ -22,10 +22,10 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
|||||||
firstName: id,
|
firstName: id,
|
||||||
lastName: id,
|
lastName: id,
|
||||||
};
|
};
|
||||||
console.log(`🕺🏻`, user);
|
console.log(`🏁`, user);
|
||||||
|
|
||||||
const xml = await createResponseXML({
|
const xml = await createResponseXML({
|
||||||
idpIdentityId: req.body.audience,
|
idpIdentityId: config.entityId,
|
||||||
audience: req.body.audience,
|
audience: req.body.audience,
|
||||||
acsUrl: req.body.acsUrl,
|
acsUrl: req.body.acsUrl,
|
||||||
user: user,
|
user: user,
|
||||||
@ -34,6 +34,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
|||||||
const signingKey = await fetchPrivateKey();
|
const signingKey = await fetchPrivateKey();
|
||||||
const publicKey = await fetchPublicKey();
|
const publicKey = await fetchPublicKey();
|
||||||
const xmlSigned = await signResponseXML(xml, signingKey, publicKey);
|
const xmlSigned = await signResponseXML(xml, signingKey, publicKey);
|
||||||
|
|
||||||
const encodedSamlResponse = Buffer.from(xmlSigned).toString('base64');
|
const encodedSamlResponse = Buffer.from(xmlSigned).toString('base64');
|
||||||
|
|
||||||
const html = createResponseForm(req.body.relayState, encodedSamlResponse, req.body.acsUrl);
|
const html = createResponseForm(req.body.relayState, encodedSamlResponse, req.body.acsUrl);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user