Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { MailSenderModule } from '../mail-sender/mail-sender.module';
import { EmailVerification } from './email-verification.entity';
import { EmailChange } from './email-change.entity';
import { PasswordReset } from './password-reset.entity';
@Module({
imports: [
TypeOrmModule.forFeature([
User,
EmailVerification,
EmailChange,
PasswordReset,
]),
UserModule,
PassportModule.register({ defaultStrategy: 'jwt' }),
JwtModule.register({
secret: config.jwt.secretOrKey,
signOptions: {
expiresIn: config.jwt.expiresIn,
},
}),
MailSenderModule,
],
providers: [AuthService, JwtStrategy],
controllers: [AuthController],
})
export class AuthModule {}
import { OAuthStrategy } from './oauth.strategy';
import { UserModule } from '../core/user/user.module';
import { AuthModule } from './auth/auth.module';
import { ClientModule } from './client/client.module';
const jwtSettings = config.get('JWT_SETTINGS');
@Module({
imports: [
ClientModule,
AuthModule,
forwardRef(() => UserModule),
forwardRef(() => DatabaseModule),
PassportModule.register({ defaultStrategy: 'jwt' }),
JwtModule.register({
secretOrPrivateKey: jwtSettings.secretKey,
signOptions: {
expiresIn: jwtSettings.expiresIn,
},
}),
],
providers: [
OAuthService,
OAuthStrategy,
{
provide: LoggerService,
useValue: new LoggerService('OAuthController'),
},
],
controllers: [OAuthController],
exports: [ClientModule, AuthModule],
import { Module } from '@nestjs/common';
import { PassportModule } from '@nestjs/passport';
import { JwtModule } from '@nestjs/jwt';
import { AuthService } from './auth.service';
import { HttpStrategy } from './http.strategy';
import { AuthController } from './auth.controller';
import { JwtStrategy } from './jwt.strategy';
import { UsersModule } from './../users/users.module';
import * as passport from 'passport';
@Module({
imports: [
PassportModule.register({ defaultStrategy: 'jwt' }),
JwtModule.register({
secretOrPrivateKey: 'secretKey',
signOptions: {
expiresIn: 3600,
},
}),
UsersModule,
],
controllers: [AuthController],
providers: [
AuthService,
JwtStrategy,
HttpStrategy,
],
})
export class AuthModule {}
import { Module, forwardRef } from '@nestjs/common';
import { AuthService } from './auth.service';
import { AuthController } from './auth.controller';
import { JwtStrategy } from './jwt.strategy';
import { PassportModule } from '@nestjs/passport';
import { JwtModule } from '@nestjs/jwt';
import { UsersModule } from '../users/users.module';
@Module({
imports: [
PassportModule.register({ defaultStrategy: 'jwt' }),
JwtModule.register({
secretOrPrivateKey: 'secretKey',
signOptions: {
expiresIn: 3600,
},
}),
forwardRef(() => UsersModule),
],
controllers: [AuthController],
providers: [AuthService, JwtStrategy],
exports: [PassportModule, AuthService],
})
export class AuthModule {}
*/
import * as APP_CONFIG from '@app/app.config';
import * as jwt from 'jsonwebtoken';
import { Module } from '@nestjs/common';
import { JwtModule } from '@nestjs/jwt';
import { PassportModule } from '@nestjs/passport';
import { AuthController } from './auth.controller';
import { AuthProvider } from './auth.model';
import { AuthService } from './auth.service';
import { JwtStrategy } from './jwt.strategy';
@Module({
imports: [
PassportModule.register({ defaultStrategy: 'jwt' }),
JwtModule.register({
privateKey: APP_CONFIG.AUTH.jwtTokenSecret as jwt.Secret,
signOptions: {
expiresIn: APP_CONFIG.AUTH.expiresIn as number,
},
}),
],
controllers: [AuthController],
providers: [AuthProvider, AuthService, JwtStrategy],
exports: [AuthService],
})
export class AuthModule {}
import { PasswordService } from './../../services/password.service';
import { GqlAuthGuard } from '../../guards/gql-auth.guard';
import { PrismaModule } from '../../prisma/prisma.module';
import { AuthService } from '../../services/auth.service';
import { AuthResolver } from './auth.resolver';
import { Module } from '@nestjs/common';
import { JwtModule } from '@nestjs/jwt';
import { PassportModule } from '@nestjs/passport';
import { JwtStrategy } from './jwt.strategy';
import { authConstants } from './../../common/auth/constants';
@Module({
imports: [
PassportModule.register({ defaultStrategy: 'jwt' }),
JwtModule.register({
secret: authConstants.jwtSecret
}),
PrismaModule
],
providers: [
AuthService,
AuthResolver,
JwtStrategy,
GqlAuthGuard,
PasswordService
],
exports: [GqlAuthGuard]
})
export class AuthModule {}
CommentService,
UserService,
];
/**
* 系统中所有业务服务的提供者
*/
@Module({
imports: [
EventBusModule,
TypeOrmModule.forRoot(getConfig().dbConnectionOptions),
CacheModule,
PassportModule.register({
defaultStrategy: 'jwt',
}),
JwtModule.register({
secretOrPrivateKey: APP_CONFIG.AUTH.jwtTokenSecret as string,
signOptions: { expiresIn: APP_CONFIG.AUTH.expiresIn } as object,
}),
],
providers: [
...exportedProviders,
PasswordCiper,
],
exports: exportedProviders,
})
export class ServiceModule implements OnModuleInit {
constructor(
private optionService: OptionService,
) {
}
import { Module } from '@nestjs/common'
import { PassportModule } from '@nestjs/passport'
import { JwtModule } from '@nestjs/jwt'
import { AuthService } from './auth.service'
import { UserModule } from '../user/user.module'
import { LocalStrategy } from './local.strategy'
import { AuthController } from './auth.controller';
import { jwtConstants } from './constants'
import { JwtStrategy } from './jwt.strategy'
@Module({
imports: [
UserModule,
PassportModule,
JwtModule.register({
secret: jwtConstants.secret,
signOptions: { expiresIn: '43200s' },
})
],
providers: [AuthService, LocalStrategy, JwtStrategy],
controllers: [AuthController]
})
export class AuthModule {}