in src/app.ts [74:100]
function withPandaAuth(
getPanda: () => PanDomainAuthentication,
req: express.Request,
res: express.Response,
onSuccess: (result: AuthenticationResult) => unknown,
onFailure: () => unknown,
) {
const panda = getPanda();
panda
.verify(getCookieString(req))
.then((panAuthResult) => {
if (panAuthResult.status === AuthenticationStatus.AUTHORISED) {
onSuccess(panAuthResult);
} else {
onFailure();
}
})
.catch((ex: unknown) => {
res.status(500).send({
error: 'Pan domain auth error',
ex: ex,
});
})
.finally(() => {
panda.stop();
});
}