-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauth.module.ts
More file actions
executable file
·35 lines (34 loc) · 1.29 KB
/
auth.module.ts
File metadata and controls
executable file
·35 lines (34 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { Module } from '@nestjs/common';
import { JwtModule } from '@nestjs/jwt';
import { PassportModule } from '@nestjs/passport';
import { PasswordService } from './password.service';
import { AuthService } from './auth.service';
import { AuthController } from './auth.controller';
//import { JwtStrategy } from './jwt.strategy';
import { SecurityConfig } from '../common/configs/config.interface';
import { RedisModule } from '../common/redis/redis.module';
import { ConfigModule } from '../common/configs/config.module';
import { ConfigService } from '../common/configs/config.service';
@Module({
imports: [
PassportModule.register({ defaultStrategy: 'jwt' }),
RedisModule.forRoot(),
ConfigModule,
JwtModule.registerAsync({
useFactory: (configService: ConfigService) => {
return {
secret: process.env.JWT_ACCESS_SECRET || 'nestjsPrismaAccessSecret',
// jsonwebtoken types may require a specific StringValue type; cast to any to satisfy types
signOptions: {
expiresIn: (process.env.JWT_EXPIRATION_TIME || '60m') as any,
},
} as any;
},
inject: [ConfigService],
}),
],
providers: [AuthService, PasswordService], //JwtStrategy
controllers: [AuthController],
exports: [],
})
export class AuthModule {}