1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-04 00:18:01 +01:00
unleash.unleash/src/lib/middleware/no-authentication.ts
Christopher Kolstad ff7be7696c
fix: Stores as typescript and with interfaces. (#902)
Co-authored-by: Ivar Conradi Østhus <ivarconr@gmail.com>
2021-08-12 15:04:37 +02:00

19 lines
528 B
TypeScript

import { Application } from 'express';
import { ADMIN } from '../types/permissions';
import ApiUser from '../types/api-user';
function noneAuthentication(basePath = '', app: Application): void {
app.use(`${basePath}/api/admin/`, (req, res, next) => {
// @ts-ignore
if (!req.user) {
// @ts-ignore
req.user = new ApiUser({
username: 'unknown',
permissions: [ADMIN],
});
}
next();
});
}
export default noneAuthentication;