mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-04 00:18:01 +01:00
ff7be7696c
Co-authored-by: Ivar Conradi Østhus <ivarconr@gmail.com>
19 lines
528 B
TypeScript
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;
|