This repository has been archived on 2023-05-17. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
auth/lib/server/middleware/authenication.ts
mifi dc72cefece
Some checks failed
continuous-integration/drone/push Build is failing
Reorganizing
2023-05-03 11:12:59 -04:00

13 lines
336 B
TypeScript

import { Middleware } from 'koa';
import { LOGIN_ROUTE } from '../../constants/constants';
export const authenticated = (): Middleware => {
return (ctx, next) => {
if (ctx.isAuthenticated()) {
return next();
} else {
ctx.redirect(process.env.LOGIN_ROUTE || LOGIN_ROUTE);
}
};
};