fix(striker-ui-api): add default authentication handler for private /api/*

main
Tsu-ba-me 2 years ago
parent 193727b93f
commit d8a2c77cf0
  1. 2
      striker-ui-api/src/lib/assertAuthentication.ts
  2. 4
      striker-ui-api/src/routes/auth.ts

@ -35,3 +35,5 @@ export const assertAuthentication: (options?: {
next(); next();
}; };
}; };
export const authenticationHandler = assertAuthentication();

@ -1,6 +1,6 @@
import express from 'express'; import express from 'express';
import { assertAuthentication } from '../lib/assertAuthentication'; import { authenticationHandler } from '../lib/assertAuthentication';
import { login, logout } from '../lib/request_handlers/auth'; import { login, logout } from '../lib/request_handlers/auth';
import passport from '../passport'; import passport from '../passport';
@ -8,6 +8,6 @@ const router = express.Router();
router router
.post('/login', passport.authenticate('login'), login) .post('/login', passport.authenticate('login'), login)
.put('/logout', assertAuthentication(), logout); .put('/logout', authenticationHandler, logout);
export default router; export default router;

Loading…
Cancel
Save