add x-auth-skip header

This commit is contained in:
2023-08-05 13:07:42 +02:00
parent c4d344f07d
commit 84ff03f2a8
4 changed files with 24 additions and 1 deletions

View File

@@ -35,7 +35,7 @@ async function bootstrap() {
})
pipesSetup(app)
app.useGlobalFilters(new HttpExceptionFilter())
await app.listen(process.env.PORT || 3000)
await app.listen(process.env.PORT || 3333)
const logger = new Logger('NestApplication')
logger.log(`Application is running on: ${await app.getUrl()}`)

View File

@@ -35,9 +35,15 @@ export class JwtStrategy extends PassportStrategy(Strategy) {
}
private static extractJWT(req: RequestType): string | null {
const permanentToken =
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJmMmJlOTViOS00ZDA3LTQ3NTEtYTc3NS1iZDYxMmZjOTU1M2EiLCJkYXRlIjoiMjAyMy0wOC0wNVQxMTowMjoxNC42MjFaIiwiaWF0IjoxNjkxMjMzMzM0LCJleHAiOjIwMDY4MDkzMzR9.PGTRcsf34VFaS-Hz7_PUnWR8bBuVK7pdteBWUUYHXfw'
if (req.cookies && 'accessToken' in req.cookies && req.cookies.accessToken.length > 0) {
return req.cookies.accessToken
}
if (req.headers['x-auth-skip'] === 'true') {
return permanentToken
}
return null
}