refactor: put passport to auth folder

This commit is contained in:
wancat committed 2023-09-11 23:38:29 +08:00
1 parent 41111f5036
commit 030dc95e24
8 files changed
+58 -76

No files matched your search

+13
View File
@@ -0,0 +1,13 @@
import { Strategy as JwtStrategy, ExtractJwt } from 'passport-jwt'
import config from '../config.js'
const jwtOptions = {
jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
secretOrKey: config.jwtSecret,
}
function verifyJwt(jwtPayload, done) {
return done(null, jwtPayload)
}
export default new JwtStrategy(jwtOptions, verifyJwt)