summary refs log tree commit diff
path: root/src/middlewares/Authentication.ts
diff options
context:
space:
mode:
authorDiego Magdaleno <diegomagdaleno@protonmail.com>2021-05-22 18:51:46 -0500
committerDiego Magdaleno <diegomagdaleno@protonmail.com>2021-05-22 18:51:46 -0500
commitff7985ad7d214cd2c7b5c2341aaa878edc826d20 (patch)
tree6dde0f5357c25ea5c4f279f81b903d3b2386f6c3 /src/middlewares/Authentication.ts
parentFix merge issues, update to reflect config changes and package.json (diff)
downloadserver-ff7985ad7d214cd2c7b5c2341aaa878edc826d20.tar.xz
Config: Final config additons, now everything should work as desired
Diffstat (limited to 'src/middlewares/Authentication.ts')
-rw-r--r--src/middlewares/Authentication.ts6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/middlewares/Authentication.ts b/src/middlewares/Authentication.ts

index 0ecc1bc0..78533489 100644 --- a/src/middlewares/Authentication.ts +++ b/src/middlewares/Authentication.ts
@@ -1,6 +1,7 @@ import { NextFunction, Request, Response } from "express"; import { HTTPError } from "lambert-server"; import { checkToken } from "@fosscord/server-util"; +import * as Config from "../util/Config" export const NO_AUTHORIZATION_ROUTES = [ "/api/v8/auth/login", @@ -27,7 +28,10 @@ export async function Authentication(req: Request, res: Response, next: NextFunc // TODO: check if user is banned/token expired try { - const decoded: any = await checkToken(req.headers.authorization); + + const { jwtSecret } = (Config.apiConfig.getAll() as Config.DefaultOptions).security; + + const decoded: any = await checkToken(req.headers.authorization, jwtSecret); req.token = decoded; req.user_id = decoded.id;