fix: move cookie-parser to main.ts for guaranteed execution before JWT strategy
This commit is contained in:
parent
ce0c04e7fa
commit
48755ecacd
@ -1,8 +1,7 @@
|
||||
import { Module, NestModule, MiddlewareConsumer } from '@nestjs/common';
|
||||
import { Module } from '@nestjs/common';
|
||||
import { ServeStaticModule } from '@nestjs/serve-static';
|
||||
import { ThrottlerModule } from '@nestjs/throttler';
|
||||
import { join } from 'path';
|
||||
import * as cookieParser from 'cookie-parser';
|
||||
import { PrismaModule } from './prisma/prisma.module';
|
||||
import { AuthModule } from './auth/auth.module';
|
||||
import { VaultModule } from './vault/vault.module';
|
||||
@ -28,9 +27,4 @@ import { RdpModule } from './rdp/rdp.module';
|
||||
}),
|
||||
],
|
||||
})
|
||||
export class AppModule implements NestModule {
|
||||
configure(consumer: MiddlewareConsumer) {
|
||||
// Cookie parser for JWT-in-cookie auth (C-2)
|
||||
consumer.apply(cookieParser()).forRoutes('*');
|
||||
}
|
||||
}
|
||||
export class AppModule {}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import helmet from 'helmet';
|
||||
import * as cookieParser from 'cookie-parser';
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { ValidationPipe } from '@nestjs/common';
|
||||
import { WsAdapter } from '@nestjs/platform-ws';
|
||||
@ -19,6 +20,7 @@ process.on('unhandledRejection', (reason: any) => {
|
||||
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create(AppModule);
|
||||
app.use(cookieParser());
|
||||
app.use(helmet({
|
||||
contentSecurityPolicy: {
|
||||
directives: {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user