mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 11:30:13 +08:00
refactor: auth
This commit is contained in:
1 parent
d6c95cea4a
commit
5489de2432
8 files changed
+120
-22
No files matched your search
@@ -0,0 +1,14 @@
|
||||
import { Strategy as JwtStrategy, ExtractJwt } from 'passport-jwt'
|
||||
import type { VerifyCallback } from 'passport-jwt'
|
||||
import config from '../config.js'
|
||||
|
||||
const jwtOptions = {
|
||||
jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
|
||||
secretOrKey: config.secret,
|
||||
}
|
||||
|
||||
function verifyJwt(jwtPayload: any, done: VerifyCallback) {
|
||||
return done(null, jwtPayload)
|
||||
}
|
||||
|
||||
export default new JwtStrategy(jwtOptions, verifyJwt)
|
||||
Reference in new issue
Block a user