mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-23 17:45:03 +00:00
Fix overzealous auth requirement in API
This commit is contained in:
parent
153674da7d
commit
e37987946f
2 changed files with 6 additions and 15 deletions
|
@ -134,13 +134,13 @@ export function initAuth(app: express.Express) {
|
|||
|
||||
res.json({ valid: true });
|
||||
});
|
||||
app.post("/auth/logout", ...getRequireAPITokenHandlers(), async (req: Request, res: Response) => {
|
||||
app.post("/auth/logout", ...apiTokenAuthHandlers(), async (req: Request, res: Response) => {
|
||||
await apiLogins.expireApiKey(req.user.apiKey);
|
||||
return ok(res);
|
||||
});
|
||||
}
|
||||
|
||||
function getRequireAPITokenHandlers() {
|
||||
export function apiTokenAuthHandlers() {
|
||||
return [
|
||||
passport.authenticate("api-token", { failWithError: true }),
|
||||
(err, req, res, next) => {
|
||||
|
@ -148,7 +148,3 @@ function getRequireAPITokenHandlers() {
|
|||
},
|
||||
];
|
||||
}
|
||||
|
||||
export function requireAPIToken(router: express.Router) {
|
||||
router.use(...getRequireAPITokenHandlers());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue