Commit inicial - upload de todos os arquivos da pasta
This commit is contained in:
25
src/config/auth/auth-config.module.ts
Normal file
25
src/config/auth/auth-config.module.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { JwtModule } from '@nestjs/jwt';
|
||||
import { PassportModule } from '@nestjs/passport';
|
||||
import { EnvModule } from '../env/env.module';
|
||||
import { EnvService } from '../env/env.service';
|
||||
import { JwtAuthGuard } from './jwt-auth.guard';
|
||||
import { JwtStrategy } from './jwt.strategy';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
EnvModule,
|
||||
PassportModule.register({ defaultStrategy: 'jwt' }),
|
||||
JwtModule.registerAsync({
|
||||
imports: [EnvModule],
|
||||
inject: [EnvService],
|
||||
useFactory: (envService: EnvService) => ({
|
||||
secret: envService.jwtSecret,
|
||||
signOptions: { expiresIn: '8h' },
|
||||
}),
|
||||
}),
|
||||
],
|
||||
providers: [JwtStrategy, JwtAuthGuard],
|
||||
exports: [JwtModule, JwtStrategy, JwtAuthGuard],
|
||||
})
|
||||
export class AuthConfigModule {}
|
||||
Reference in New Issue
Block a user