diff options
| author | Adam Soltys <[email protected]> | 2022-09-05 22:58:23 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2022-09-05 23:01:46 -0700 |
| commit | 412df5f844de11b3fc71bb7ffaf9c8e1d9f19d65 (patch) | |
| tree | 209296b3a93bc89b025e8ad0dcf846c23bb82746 /lib/passport.js | |
| parent | 8a82c69419dc358fbaeab322c32d18ee84656feb (diff) | |
| download | coinos-server-412df5f844de11b3fc71bb7ffaf9c8e1d9f19d65.tar.gz coinos-server-412df5f844de11b3fc71bb7ffaf9c8e1d9f19d65.zip | |
lightning api migration
Diffstat (limited to 'lib/passport.js')
| -rw-r--r-- | lib/passport.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/passport.js b/lib/passport.js index 7cf07962..68adbe08 100644 --- a/lib/passport.js +++ b/lib/passport.js @@ -1,4 +1,5 @@ import app from "$app"; +import db from "$db"; import Passport from "passport"; import jwt from "passport-jwt"; import { Op } from "@sequelize/core"; @@ -7,6 +8,7 @@ import fastifySecureSession from '@fastify/secure-session' import config from "$config"; import fs from "fs"; import path from "path"; +import { err } from "$lib/logging"; app.register(fastifySecureSession, { key: config.jwt @@ -58,9 +60,8 @@ export const optionalAuth = { preValidation: fastifyPassport.authenticate( "jwt", { session: false }, - function(err, user, info) { + function(req, res, err, user, info) { req.user = user; - next(); } ) }; @@ -69,10 +70,9 @@ export const adminAuth = { preValidation: fastifyPassport.authenticate( "jwt", { session: false }, - function(err, user, info) { + function(req, res, err, user, info) { if (!(user && user.admin)) return res.status(401).send("Unauthorized"); req.user = user; - next(); } ) }; |
