diff --git a/lib/interfaces/jwt-module-options.interface.ts b/lib/interfaces/jwt-module-options.interface.ts index 6d451c26..70a5bb2b 100644 --- a/lib/interfaces/jwt-module-options.interface.ts +++ b/lib/interfaces/jwt-module-options.interface.ts @@ -7,6 +7,7 @@ export enum JwtSecretRequestType { } export interface JwtModuleOptions { + global?: boolean; signOptions?: jwt.SignOptions; secret?: string | Buffer; publicKey?: string | Buffer; @@ -28,6 +29,7 @@ export interface JwtOptionsFactory { } export interface JwtModuleAsyncOptions extends Pick { + global?: boolean; useExisting?: Type; useClass?: Type; useFactory?: (...args: any[]) => Promise | JwtModuleOptions; diff --git a/lib/jwt.module.ts b/lib/jwt.module.ts index e4833a76..1fc0c700 100644 --- a/lib/jwt.module.ts +++ b/lib/jwt.module.ts @@ -16,6 +16,7 @@ export class JwtModule { static register(options: JwtModuleOptions): DynamicModule { return { module: JwtModule, + global: options.global, providers: createJwtProvider(options) }; } @@ -23,6 +24,7 @@ export class JwtModule { static registerAsync(options: JwtModuleAsyncOptions): DynamicModule { return { module: JwtModule, + global: options.global, imports: options.imports || [], providers: this.createAsyncProviders(options) };