Compare commits

..

No commits in common. "5c259484ee5a4063bcf71bd847413014ec848a00" and "993096741d5044a4f7d8c1b42d948733c76284e8" have entirely different histories.

2 changed files with 18 additions and 0 deletions

View File

@ -4,6 +4,14 @@ import { getConnectionManager } from 'typeorm';
import { IllegalJWTError, NoPermissionError, UserNonexistantOrRefreshtokenInvalidError } from './errors/AuthError';
import { User } from './models/entities/User';
// -----------
const sampletoken = jwt.sign({
"permissions": {
"TRACKS": ["read", "update", "delete", "add"]
// "TRACKS": []
}
}, "securekey")
console.log(`sampletoken: ${sampletoken}`);
// -----------
const authchecker = async (action: Action, permissions: string | string[]) => {
let required_permissions = undefined
if (typeof permissions === "string") {

10
src/routes/v1/test.ts Normal file
View File

@ -0,0 +1,10 @@
import { Router } from "express";
import jwtauth from "../../middlewares/jwtauth";
const router = Router();
router.use("*", jwtauth, async (req, res, next) => {
return res.send("ok");
});
export default router;