@nathapp/nestjs-auth 1.0.0-rc.3 → 1.0.0-rc.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -27,7 +27,7 @@ let JwtModule = JwtModule_1 = class JwtModule {
|
|
|
27
27
|
provide: module_constant_1.AUTH_PROVIDER,
|
|
28
28
|
useClass: options.authProvider,
|
|
29
29
|
};
|
|
30
|
-
|
|
30
|
+
const strategyProvider = this.createStrategyProvider(options);
|
|
31
31
|
return {
|
|
32
32
|
module: JwtModule_1,
|
|
33
33
|
imports: [],
|
|
@@ -42,7 +42,7 @@ let JwtModule = JwtModule_1 = class JwtModule {
|
|
|
42
42
|
provide: module_constant_1.AUTH_PROVIDER,
|
|
43
43
|
useClass: options.authProvider,
|
|
44
44
|
};
|
|
45
|
-
|
|
45
|
+
const strategyProvider = this.createStrategyProvider(options);
|
|
46
46
|
return {
|
|
47
47
|
module: JwtModule_1,
|
|
48
48
|
imports: options.imports || [],
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Strategy } from "passport-jwt";
|
|
2
|
-
import { Request } from "express";
|
|
3
2
|
import { JwtStrategyProvider } from "./strategy-provider";
|
|
4
3
|
declare const JwtStrategy_base: new (...args: any[]) => Strategy;
|
|
5
4
|
export declare class JwtStrategy extends JwtStrategy_base {
|
|
6
5
|
private readonly strategyProvider;
|
|
7
6
|
constructor(strategyProvider: JwtStrategyProvider);
|
|
8
|
-
validate(
|
|
7
|
+
validate(arg1: any, arg2: any): Promise<import("..").IPrincipal>;
|
|
9
8
|
}
|
|
10
9
|
export {};
|
|
@@ -25,7 +25,9 @@ let JwtStrategy = class JwtStrategy extends (0, passport_1.PassportStrategy)(pas
|
|
|
25
25
|
});
|
|
26
26
|
this.strategyProvider = strategyProvider;
|
|
27
27
|
}
|
|
28
|
-
async validate(
|
|
28
|
+
async validate(arg1, arg2) {
|
|
29
|
+
const req = this.strategyProvider.passReqToCallback ? arg1 : {};
|
|
30
|
+
const payload = this.strategyProvider.passReqToCallback ? arg2 : arg1;
|
|
29
31
|
return this.strategyProvider.validate(req, payload);
|
|
30
32
|
}
|
|
31
33
|
};
|
|
@@ -20,7 +20,9 @@ class JwtStrategyProvider {
|
|
|
20
20
|
this.jwtProvider = new auth_1.JwtProvider(jwtOptions);
|
|
21
21
|
this.secretOrPrivateKey = this.jwtProvider.secretOrPrivateKey;
|
|
22
22
|
this.secretOrPublicKey = this.jwtProvider.secretOrPublicKey;
|
|
23
|
-
this.jwtFromRequestFunction = jwtOptions.jwtFromRequestFunction || passport_jwt_1.ExtractJwt.fromAuthHeaderAsBearerToken();
|
|
23
|
+
this.jwtFromRequestFunction = this.jwtOptions.jwtFromRequestFunction || passport_jwt_1.ExtractJwt.fromAuthHeaderAsBearerToken();
|
|
24
|
+
this.ignoreExpiration = this.jwtOptions.ignoreExpiration;
|
|
25
|
+
this.passReqToCallback = this.jwtOptions.passReqToCallback;
|
|
24
26
|
}
|
|
25
27
|
sign(payload) {
|
|
26
28
|
return this.jwtProvider.sign(payload);
|