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
renovate[bot] f52f1cadac
chore(deps): update dependency eslint-config-airbnb-typescript to v16.1.0 (#1147)
* chore(deps): update dependency eslint-config-airbnb-typescript to v16.1.0

* chore: Update a few places with eslint-ignore due to new linter rules for optional parameters

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: sighphyre <liquidwicked64@gmail.com>
Co-authored-by: Ivar Conradi Østhus <ivarconr@gmail.com>
2022-04-25 13:14:43 +02:00

16 lines
436 B
TypeScript

import { Application } from 'express';
import NoAuthUser from '../types/no-auth-user';
// eslint-disable-next-line
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;