1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-10-27 11:02:16 +01:00
unleash.unleash/src/lib/middleware/no-authentication.ts
Christopher Kolstad ace3214777 fix: configure user endpoint when AuthType is NONE (#1403)
Co-authored-by: Fredrik Oseberg <fredrik.no@gmail.com>
2022-03-02 09:33:49 +01:00

15 lines
408 B
TypeScript

import { Application } from 'express';
import NoAuthUser from '../types/no-auth-user';
function noneAuthentication(basePath = '', app: Application): void {
app.use(`${basePath}/api/admin/`, (req, res, next) => {
// @ts-ignore
if (!req.user) {
// @ts-expect-error
req.user = new NoAuthUser();
}
next();
});
}
export default noneAuthentication;