Compare commits
No commits in common. "5c259484ee5a4063bcf71bd847413014ec848a00" and "993096741d5044a4f7d8c1b42d948733c76284e8" have entirely different histories.
5c259484ee
...
993096741d
@ -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
10
src/routes/v1/test.ts
Normal 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;
|
Loading…
x
Reference in New Issue
Block a user