nestjs-authentication 0.4.3 → 0.5.0
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.
- package/CHANGELOG.md +77 -2
- package/README.md +108 -0
- package/SECURITY.md +15 -0
- package/dist/classes/email.password.user.d.ts +13 -0
- package/dist/classes/email.password.user.d.ts.map +1 -0
- package/dist/classes/email.password.user.js +3 -0
- package/dist/classes/email.password.user.js.map +1 -0
- package/dist/constants.d.ts +13 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +14 -1
- package/dist/constants.js.map +1 -1
- package/dist/context/auth.context.d.ts +38 -0
- package/dist/context/auth.context.d.ts.map +1 -0
- package/dist/context/auth.context.js +39 -0
- package/dist/context/auth.context.js.map +1 -0
- package/dist/context/decorators.d.ts +25 -0
- package/dist/context/decorators.d.ts.map +1 -0
- package/dist/context/decorators.js +38 -0
- package/dist/context/decorators.js.map +1 -0
- package/dist/context/index.d.ts +5 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/context/index.js +21 -0
- package/dist/context/index.js.map +1 -0
- package/dist/context/interceptor.d.ts +15 -0
- package/dist/context/interceptor.d.ts.map +1 -0
- package/dist/context/interceptor.js +51 -0
- package/dist/context/interceptor.js.map +1 -0
- package/dist/context/service.d.ts +18 -0
- package/dist/context/service.d.ts.map +1 -0
- package/dist/context/service.js +45 -0
- package/dist/context/service.js.map +1 -0
- package/dist/encryptor.d.ts +20 -0
- package/dist/encryptor.d.ts.map +1 -1
- package/dist/encryptor.js +36 -6
- package/dist/encryptor.js.map +1 -1
- package/dist/encryptors/index.d.ts +3 -0
- package/dist/encryptors/index.d.ts.map +1 -0
- package/dist/encryptors/index.js +19 -0
- package/dist/encryptors/index.js.map +1 -0
- package/dist/encryptors/migrating.d.ts +28 -0
- package/dist/encryptors/migrating.d.ts.map +1 -0
- package/dist/encryptors/migrating.js +72 -0
- package/dist/encryptors/migrating.js.map +1 -0
- package/dist/encryptors/scrypt.d.ts +42 -0
- package/dist/encryptors/scrypt.d.ts.map +1 -0
- package/dist/encryptors/scrypt.js +85 -0
- package/dist/encryptors/scrypt.js.map +1 -0
- package/dist/errors.d.ts +32 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +63 -0
- package/dist/errors.js.map +1 -0
- package/dist/guard.d.ts +115 -15
- package/dist/guard.d.ts.map +1 -1
- package/dist/guard.js +302 -90
- package/dist/guard.js.map +1 -1
- package/dist/index.d.ts +10 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -4
- package/dist/index.js.map +1 -1
- package/dist/injection.d.ts +3 -0
- package/dist/injection.d.ts.map +1 -0
- package/dist/injection.js +9 -0
- package/dist/injection.js.map +1 -0
- package/dist/interfaces/auth.user.d.ts +16 -5
- package/dist/interfaces/auth.user.d.ts.map +1 -1
- package/dist/interfaces/auth.user.js +6 -0
- package/dist/interfaces/auth.user.js.map +1 -1
- package/dist/interfaces/encrypt.d.ts +29 -1
- package/dist/interfaces/encrypt.d.ts.map +1 -1
- package/dist/interfaces/options.d.ts +52 -5
- package/dist/interfaces/options.d.ts.map +1 -1
- package/dist/interfaces/provider.d.ts +26 -3
- package/dist/interfaces/provider.d.ts.map +1 -1
- package/dist/module.d.ts +48 -6
- package/dist/module.d.ts.map +1 -1
- package/dist/module.js +153 -50
- package/dist/module.js.map +1 -1
- package/dist/providers/auth.provider.d.ts +12 -4
- package/dist/providers/auth.provider.d.ts.map +1 -1
- package/dist/providers/auth.provider.js +7 -1
- package/dist/providers/auth.provider.js.map +1 -1
- package/dist/providers/email.password.auth.provider.d.ts +75 -0
- package/dist/providers/email.password.auth.provider.d.ts.map +1 -0
- package/dist/providers/email.password.auth.provider.js +120 -0
- package/dist/providers/email.password.auth.provider.js.map +1 -0
- package/dist/providers/memory.user.provider.d.ts +39 -6
- package/dist/providers/memory.user.provider.d.ts.map +1 -1
- package/dist/providers/memory.user.provider.js +70 -15
- package/dist/providers/memory.user.provider.js.map +1 -1
- package/dist/scopes/decorators.d.ts +41 -0
- package/dist/scopes/decorators.d.ts.map +1 -0
- package/dist/scopes/decorators.js +44 -0
- package/dist/scopes/decorators.js.map +1 -0
- package/dist/scopes/index.d.ts +4 -0
- package/dist/scopes/index.d.ts.map +1 -0
- package/dist/scopes/index.js +20 -0
- package/dist/scopes/index.js.map +1 -0
- package/dist/scopes/service.d.ts +32 -0
- package/dist/scopes/service.d.ts.map +1 -0
- package/dist/scopes/service.js +90 -0
- package/dist/scopes/service.js.map +1 -0
- package/dist/scopes/utils.d.ts +8 -0
- package/dist/scopes/utils.d.ts.map +1 -0
- package/dist/scopes/utils.js +29 -0
- package/dist/scopes/utils.js.map +1 -0
- package/dist/service.d.ts +25 -6
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +36 -5
- package/dist/service.js.map +1 -1
- package/dist/session/index.d.ts +3 -0
- package/dist/session/index.d.ts.map +1 -0
- package/dist/session/index.js +19 -0
- package/dist/session/index.js.map +1 -0
- package/dist/session/manager.d.ts +32 -0
- package/dist/session/manager.d.ts.map +1 -0
- package/dist/session/manager.js +131 -0
- package/dist/session/manager.js.map +1 -0
- package/dist/session/request.d.ts +14 -0
- package/dist/session/request.d.ts.map +1 -0
- package/dist/session/request.js +59 -0
- package/dist/session/request.js.map +1 -0
- package/dist/strategies/emailpassword.d.ts +20 -7
- package/dist/strategies/emailpassword.d.ts.map +1 -1
- package/dist/strategies/emailpassword.js +42 -19
- package/dist/strategies/emailpassword.js.map +1 -1
- package/dist/strategies/extract.d.ts +23 -0
- package/dist/strategies/extract.d.ts.map +1 -0
- package/dist/strategies/extract.js +57 -0
- package/dist/strategies/extract.js.map +1 -0
- package/dist/strategies/index.d.ts +8 -0
- package/dist/strategies/index.d.ts.map +1 -0
- package/dist/strategies/index.js +24 -0
- package/dist/strategies/index.js.map +1 -0
- package/dist/strategies/interfaces.d.ts +65 -0
- package/dist/strategies/interfaces.d.ts.map +1 -0
- package/dist/{classes/memory.user.js → strategies/interfaces.js} +1 -1
- package/dist/strategies/interfaces.js.map +1 -0
- package/dist/strategies/jwt.d.ts +87 -15
- package/dist/strategies/jwt.d.ts.map +1 -1
- package/dist/strategies/jwt.js +140 -9
- package/dist/strategies/jwt.js.map +1 -1
- package/dist/strategies/passport.d.ts +22 -0
- package/dist/strategies/passport.d.ts.map +1 -0
- package/dist/strategies/passport.js +90 -0
- package/dist/strategies/passport.js.map +1 -0
- package/dist/strategies/registry.d.ts +33 -0
- package/dist/strategies/registry.d.ts.map +1 -0
- package/dist/strategies/registry.js +67 -0
- package/dist/strategies/registry.js.map +1 -0
- package/dist/strategies/session.d.ts +18 -0
- package/dist/strategies/session.d.ts.map +1 -0
- package/dist/strategies/session.js +79 -0
- package/dist/strategies/session.js.map +1 -0
- package/dist/transports/graphql.d.ts +28 -0
- package/dist/transports/graphql.d.ts.map +1 -0
- package/dist/transports/graphql.js +59 -0
- package/dist/transports/graphql.js.map +1 -0
- package/dist/transports/http.d.ts +13 -0
- package/dist/transports/http.d.ts.map +1 -0
- package/dist/transports/http.js +31 -0
- package/dist/transports/http.js.map +1 -0
- package/dist/transports/index.d.ts +8 -0
- package/dist/transports/index.d.ts.map +1 -0
- package/dist/transports/index.js +24 -0
- package/dist/transports/index.js.map +1 -0
- package/dist/transports/interfaces.d.ts +36 -0
- package/dist/transports/interfaces.d.ts.map +1 -0
- package/dist/transports/interfaces.js +3 -0
- package/dist/transports/interfaces.js.map +1 -0
- package/dist/transports/registry.d.ts +25 -0
- package/dist/transports/registry.d.ts.map +1 -0
- package/dist/transports/registry.js +55 -0
- package/dist/transports/registry.js.map +1 -0
- package/dist/transports/rpc.d.ts +23 -0
- package/dist/transports/rpc.d.ts.map +1 -0
- package/dist/transports/rpc.js +54 -0
- package/dist/transports/rpc.js.map +1 -0
- package/dist/transports/utils.d.ts +21 -0
- package/dist/transports/utils.d.ts.map +1 -0
- package/dist/transports/utils.js +86 -0
- package/dist/transports/utils.js.map +1 -0
- package/dist/transports/ws.d.ts +31 -0
- package/dist/transports/ws.d.ts.map +1 -0
- package/dist/transports/ws.js +52 -0
- package/dist/transports/ws.js.map +1 -0
- package/package.json +101 -58
- package/dist/classes/memory.user.d.ts +0 -7
- package/dist/classes/memory.user.d.ts.map +0 -1
- package/dist/classes/memory.user.js.map +0 -1
- package/dist/providers/auth.memory.user.provider.d.ts +0 -15
- package/dist/providers/auth.memory.user.provider.d.ts.map +0 -1
- package/dist/providers/auth.memory.user.provider.js +0 -30
- package/dist/providers/auth.memory.user.provider.js.map +0 -1
- package/dist/user.serializer.d.ts +0 -10
- package/dist/user.serializer.d.ts.map +0 -1
- package/dist/user.serializer.js +0 -53
- package/dist/user.serializer.js.map +0 -1
package/dist/strategies/jwt.d.ts
CHANGED
|
@@ -1,22 +1,94 @@
|
|
|
1
|
-
import { Secret, SignOptions } from 'jsonwebtoken';
|
|
2
|
-
import {
|
|
1
|
+
import { Algorithm, Secret, SignOptions, VerifyOptions } from 'jsonwebtoken';
|
|
2
|
+
import { AuthUserPayload } from '../interfaces/auth.user';
|
|
3
3
|
import { AuthService } from '../service';
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
import { AuthRequest } from '../transports/interfaces';
|
|
5
|
+
import { JwtFromRequestFunction } from './extract';
|
|
6
|
+
import { AuthStrategy, AuthStrategyContext, AuthStrategyResult } from './interfaces';
|
|
7
|
+
/**
|
|
8
|
+
* Returns the key that verifies a token: with a promise, or with the `done` callback of passport-jwt
|
|
9
|
+
* (so `passportJwtSecret()` of jwks-rsa works for JWKS: Auth0, Cognito, Keycloak, Entra ID...).
|
|
10
|
+
*/
|
|
11
|
+
export type SecretOrKeyProvider = (request: AuthRequest, rawJwtToken: string, done: (err: any, secretOrKey?: Secret) => void) => void | Promise<Secret | undefined>;
|
|
12
|
+
/**
|
|
13
|
+
* Options of the {@link JwtStrategy}, the option names of passport-jwt.
|
|
14
|
+
*/
|
|
15
|
+
export interface JwtStrategyOptions {
|
|
16
|
+
/** The key that verifies (and signs) the tokens: a secret (HS256...) or a public key (RS256, ES256...). */
|
|
17
|
+
secretOrKey?: Secret;
|
|
18
|
+
/** Returns the key of a token (key rotation, JWKS). */
|
|
19
|
+
secretOrKeyProvider?: SecretOrKeyProvider;
|
|
20
|
+
/** Reads the token. Default: the `authorization` header (`Bearer <token>`). */
|
|
21
|
+
jwtFromRequest?: JwtFromRequestFunction;
|
|
22
|
+
/** The accepted algorithms. Recommended: by default jsonwebtoken accepts the algorithms of the key type. */
|
|
23
|
+
algorithms?: Algorithm[];
|
|
24
|
+
/** The accepted issuer(s). */
|
|
25
|
+
issuer?: string | string[];
|
|
26
|
+
/** The accepted audience(s). */
|
|
27
|
+
audience?: string | RegExp | (string | RegExp)[];
|
|
28
|
+
/** Accepts the expired tokens. Default `false`. */
|
|
29
|
+
ignoreExpiration?: boolean;
|
|
30
|
+
/** Other jsonwebtoken verify options (`clockTolerance`, `maxAge`, `subject`...). */
|
|
31
|
+
jsonWebTokenOptions?: VerifyOptions;
|
|
32
|
+
/**
|
|
33
|
+
* Loads the users of all the tokens with the auth provider of this namespace (the `namespace` claim is ignored).
|
|
34
|
+
* Use it for the tokens of an identity provider, whose `sub` is not one of your ids. Default: the `namespace`
|
|
35
|
+
* claim of the token, else `default`.
|
|
36
|
+
*/
|
|
37
|
+
namespace?: string;
|
|
38
|
+
/** The name of the strategy, for a second jwt strategy (e.g. `auth0`). Default `jwt`. */
|
|
39
|
+
name?: string;
|
|
40
|
+
}
|
|
41
|
+
/** Returns the scopes of a token payload: `scope` (space separated), `scp` or `scopes` (array or string). */
|
|
42
|
+
export declare function getTokenScopes(payload: Record<string, unknown>): string[];
|
|
43
|
+
/**
|
|
44
|
+
* The `jwt` strategy, built on jsonwebtoken: verifies the token and loads the user of its payload with the auth
|
|
45
|
+
* provider of `payload.namespace` (`default` if not set). The `scope` / `scp` claims are the scopes of the request.
|
|
46
|
+
*
|
|
47
|
+
* Provided by the {@link AuthModule} when the `jwt` option is set.
|
|
48
|
+
*/
|
|
49
|
+
export declare class JwtStrategy<User = any> implements AuthStrategy<User> {
|
|
6
50
|
protected readonly authService: AuthService;
|
|
7
|
-
protected readonly options:
|
|
8
|
-
|
|
9
|
-
protected
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
51
|
+
protected readonly options: JwtStrategyOptions;
|
|
52
|
+
readonly name: string;
|
|
53
|
+
protected readonly jwtFromRequest: JwtFromRequestFunction;
|
|
54
|
+
constructor(authService: AuthService, options: JwtStrategyOptions);
|
|
55
|
+
protected getNamespace(payload: AuthUserPayload): string;
|
|
56
|
+
/** Returns the key of a token. */
|
|
57
|
+
protected getKey(request: AuthRequest, token: string): Promise<Secret | undefined>;
|
|
58
|
+
/** Verifies a token. Returns its payload, or `undefined` if it is not valid. */
|
|
59
|
+
verify(token: string, request?: AuthRequest): Promise<AuthUserPayload | undefined>;
|
|
60
|
+
/**
|
|
61
|
+
* Loads the user of a verified payload.
|
|
62
|
+
* Returns the user (`undefined` fails the authentication) and the auth info.
|
|
63
|
+
*/
|
|
64
|
+
validate(payload: AuthUserPayload): Promise<[User | undefined, {
|
|
15
65
|
namespace: string;
|
|
16
66
|
}]>;
|
|
17
|
-
|
|
67
|
+
authenticate({ request }: AuthStrategyContext): Promise<AuthStrategyResult<User> | undefined>;
|
|
68
|
+
/**
|
|
69
|
+
* Signs a token for a user: its payload (see {@link AuthService.serializeUser}), the scopes and the claims.
|
|
70
|
+
*
|
|
71
|
+
* ```ts
|
|
72
|
+
* jwt.signUser(user, { expiresIn: '1h', scope: ['orders:read'] });
|
|
73
|
+
* ```
|
|
74
|
+
*
|
|
75
|
+
* @param options the jsonwebtoken sign options, the `namespace` of the user (default `default`), its `scope`,
|
|
76
|
+
* other `claims`, and the `secretOrPrivateKey` (default: the `secretOrKey` option)
|
|
77
|
+
*/
|
|
78
|
+
signUser(user: User, options?: SignOptions & {
|
|
18
79
|
namespace?: string;
|
|
19
|
-
|
|
80
|
+
scope?: string | string[];
|
|
81
|
+
claims?: Record<string, unknown>;
|
|
82
|
+
secretOrPrivateKey?: Secret;
|
|
83
|
+
}): string;
|
|
84
|
+
/**
|
|
85
|
+
* Signs a token (jsonwebtoken).
|
|
86
|
+
*
|
|
87
|
+
* @param payload the payload: the user (see {@link signUser}), the `scope` claim...
|
|
88
|
+
* @param secretOrPrivateKey the key, the `secretOrKey` option of the strategy if not set
|
|
89
|
+
* @param options the jsonwebtoken sign options (`expiresIn`, `algorithm`, `audience`, `issuer`...)
|
|
90
|
+
* @throws Error if there is no key
|
|
91
|
+
*/
|
|
92
|
+
sign(payload: AuthUserPayload, secretOrPrivateKey?: Secret, options?: SignOptions): string;
|
|
20
93
|
}
|
|
21
|
-
export {};
|
|
22
94
|
//# sourceMappingURL=jwt.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jwt.d.ts","sourceRoot":"","sources":["../../src/strategies/jwt.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"jwt.d.ts","sourceRoot":"","sources":["../../src/strategies/jwt.ts"],"names":[],"mappings":"AAAA,OAAY,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAGlF,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAc,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAErF;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAC9B,OAAO,EAAE,WAAW,EACpB,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,WAAW,CAAC,EAAE,MAAM,KAAK,IAAI,KAC7C,IAAI,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,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E,WAAW,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAaxF,gFAAgF;IAC1E,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,WAA6B,GAAG,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC;IAwBzG;;;OAGG;IACG,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,CAAC,IAAI,GAAG,SAAS,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAMtF,YAAY,CAAC,EAAE,OAAO,EAAE,EAAE,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC;IAgBnG;;;;;;;;;OASG;IACH,QAAQ,CACJ,IAAI,EAAE,IAAI,EACV,OAAO,GAAE,WAAW,GAAG;QACnB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;QAC1B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACjC,kBAAkB,CAAC,EAAE,MAAM,CAAC;KAC1B,GACP,MAAM;IAYT;;;;;;;OAOG;IACH,IAAI,CAAC,OAAO,EAAE,eAAe,EAAE,kBAAkB,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,MAAM;CAO7F"}
|
package/dist/strategies/jwt.js
CHANGED
|
@@ -8,32 +8,163 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
+
t[p] = s[p];
|
|
15
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
+
t[p[i]] = s[p[i]];
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
};
|
|
11
22
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
23
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
24
|
};
|
|
14
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
26
|
exports.JwtStrategy = void 0;
|
|
16
|
-
|
|
27
|
+
exports.getTokenScopes = getTokenScopes;
|
|
17
28
|
const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
|
|
18
|
-
const
|
|
19
|
-
|
|
29
|
+
const constants_1 = require("../constants");
|
|
30
|
+
const extract_1 = require("./extract");
|
|
31
|
+
/** Returns the scopes of a token payload: `scope` (space separated), `scp` or `scopes` (array or string). */
|
|
32
|
+
function getTokenScopes(payload) {
|
|
33
|
+
var _a, _b;
|
|
34
|
+
const value = (_b = (_a = payload.scope) !== null && _a !== void 0 ? _a : payload.scp) !== null && _b !== void 0 ? _b : payload.scopes;
|
|
35
|
+
const list = Array.isArray(value) ? value : typeof value === 'string' ? value.split(' ') : [];
|
|
36
|
+
return list.filter((s) => typeof s === 'string' && s !== '');
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The `jwt` strategy, built on jsonwebtoken: verifies the token and loads the user of its payload with the auth
|
|
40
|
+
* provider of `payload.namespace` (`default` if not set). The `scope` / `scp` claims are the scopes of the request.
|
|
41
|
+
*
|
|
42
|
+
* Provided by the {@link AuthModule} when the `jwt` option is set.
|
|
43
|
+
*/
|
|
44
|
+
class JwtStrategy {
|
|
20
45
|
constructor(authService, options) {
|
|
21
|
-
|
|
46
|
+
var _a, _b;
|
|
22
47
|
this.authService = authService;
|
|
23
48
|
this.options = options;
|
|
49
|
+
if (options.secretOrKey === undefined && options.secretOrKeyProvider === undefined) {
|
|
50
|
+
throw new Error('JwtStrategy requires a secretOrKey or a secretOrKeyProvider');
|
|
51
|
+
}
|
|
52
|
+
this.jwtFromRequest = (_a = options.jwtFromRequest) !== null && _a !== void 0 ? _a : extract_1.ExtractJwt.fromAuthHeaderAsBearerToken();
|
|
53
|
+
this.name = (_b = options.name) !== null && _b !== void 0 ? _b : 'jwt';
|
|
24
54
|
}
|
|
25
55
|
getNamespace(payload) {
|
|
26
|
-
|
|
27
|
-
|
|
56
|
+
if (this.options.namespace !== undefined) {
|
|
57
|
+
return this.options.namespace;
|
|
58
|
+
}
|
|
59
|
+
return typeof payload.namespace === 'string' ? payload.namespace : constants_1.DEFAULT_NAMESPACE;
|
|
60
|
+
}
|
|
61
|
+
/** Returns the key of a token. */
|
|
62
|
+
getKey(request, token) {
|
|
63
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
if (this.options.secretOrKeyProvider === undefined) {
|
|
65
|
+
return this.options.secretOrKey;
|
|
66
|
+
}
|
|
67
|
+
const provider = this.options.secretOrKeyProvider;
|
|
68
|
+
return yield new Promise((resolve, reject) => {
|
|
69
|
+
const result = provider(request, token, (err, key) => (err ? reject(err) : resolve(key)));
|
|
70
|
+
if (result instanceof Promise) {
|
|
71
|
+
result.then(resolve, reject);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
});
|
|
28
75
|
}
|
|
76
|
+
/** Verifies a token. Returns its payload, or `undefined` if it is not valid. */
|
|
77
|
+
verify(token_1) {
|
|
78
|
+
return __awaiter(this, arguments, void 0, function* (token, request = { headers: {} }) {
|
|
79
|
+
let key;
|
|
80
|
+
try {
|
|
81
|
+
key = yield this.getKey(request, token);
|
|
82
|
+
}
|
|
83
|
+
catch (_a) {
|
|
84
|
+
return undefined;
|
|
85
|
+
}
|
|
86
|
+
if (key === undefined) {
|
|
87
|
+
return undefined;
|
|
88
|
+
}
|
|
89
|
+
const { algorithms, issuer, audience, ignoreExpiration, jsonWebTokenOptions } = this.options;
|
|
90
|
+
try {
|
|
91
|
+
const verifyOptions = Object.assign(Object.assign({}, jsonWebTokenOptions), { complete: false });
|
|
92
|
+
if (algorithms !== undefined)
|
|
93
|
+
verifyOptions.algorithms = algorithms;
|
|
94
|
+
if (issuer !== undefined)
|
|
95
|
+
verifyOptions.issuer = issuer;
|
|
96
|
+
if (audience !== undefined)
|
|
97
|
+
verifyOptions.audience = audience;
|
|
98
|
+
if (ignoreExpiration !== undefined)
|
|
99
|
+
verifyOptions.ignoreExpiration = ignoreExpiration;
|
|
100
|
+
const payload = jsonwebtoken_1.default.verify(token, key, verifyOptions);
|
|
101
|
+
return typeof payload === 'object' && payload !== null ? payload : undefined;
|
|
102
|
+
}
|
|
103
|
+
catch (_b) {
|
|
104
|
+
return undefined;
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Loads the user of a verified payload.
|
|
110
|
+
* Returns the user (`undefined` fails the authentication) and the auth info.
|
|
111
|
+
*/
|
|
29
112
|
validate(payload) {
|
|
30
113
|
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
const
|
|
32
|
-
|
|
114
|
+
const namespace = this.getNamespace(payload);
|
|
115
|
+
const user = yield this.authService.loadUser(Object.assign(Object.assign({}, payload), { namespace }));
|
|
116
|
+
return [user, { namespace }];
|
|
33
117
|
});
|
|
34
118
|
}
|
|
119
|
+
authenticate(_a) {
|
|
120
|
+
return __awaiter(this, arguments, void 0, function* ({ request }) {
|
|
121
|
+
const token = this.jwtFromRequest(request);
|
|
122
|
+
if (typeof token !== 'string' || token === '') {
|
|
123
|
+
return undefined;
|
|
124
|
+
}
|
|
125
|
+
const payload = yield this.verify(token, request);
|
|
126
|
+
if (payload === undefined) {
|
|
127
|
+
return undefined;
|
|
128
|
+
}
|
|
129
|
+
const [user, info] = yield this.validate(payload);
|
|
130
|
+
if (user === undefined || user === null) {
|
|
131
|
+
return undefined;
|
|
132
|
+
}
|
|
133
|
+
return { user, namespace: info.namespace, info: Object.assign(Object.assign({}, info), { payload }), scopes: getTokenScopes(payload) };
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Signs a token for a user: its payload (see {@link AuthService.serializeUser}), the scopes and the claims.
|
|
138
|
+
*
|
|
139
|
+
* ```ts
|
|
140
|
+
* jwt.signUser(user, { expiresIn: '1h', scope: ['orders:read'] });
|
|
141
|
+
* ```
|
|
142
|
+
*
|
|
143
|
+
* @param options the jsonwebtoken sign options, the `namespace` of the user (default `default`), its `scope`,
|
|
144
|
+
* other `claims`, and the `secretOrPrivateKey` (default: the `secretOrKey` option)
|
|
145
|
+
*/
|
|
146
|
+
signUser(user, options = {}) {
|
|
147
|
+
const { namespace, scope, claims, secretOrPrivateKey } = options, signOptions = __rest(options, ["namespace", "scope", "claims", "secretOrPrivateKey"]);
|
|
148
|
+
const payload = Object.assign(Object.assign({}, this.authService.serializeUser(user, namespace !== null && namespace !== void 0 ? namespace : this.options.namespace)), claims);
|
|
149
|
+
if (scope !== undefined) {
|
|
150
|
+
payload.scope = Array.isArray(scope) ? scope.join(' ') : scope;
|
|
151
|
+
}
|
|
152
|
+
return this.sign(payload, secretOrPrivateKey, signOptions);
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Signs a token (jsonwebtoken).
|
|
156
|
+
*
|
|
157
|
+
* @param payload the payload: the user (see {@link signUser}), the `scope` claim...
|
|
158
|
+
* @param secretOrPrivateKey the key, the `secretOrKey` option of the strategy if not set
|
|
159
|
+
* @param options the jsonwebtoken sign options (`expiresIn`, `algorithm`, `audience`, `issuer`...)
|
|
160
|
+
* @throws Error if there is no key
|
|
161
|
+
*/
|
|
35
162
|
sign(payload, secretOrPrivateKey, options) {
|
|
36
|
-
|
|
163
|
+
const secret = secretOrPrivateKey !== null && secretOrPrivateKey !== void 0 ? secretOrPrivateKey : this.options.secretOrKey;
|
|
164
|
+
if (secret === undefined) {
|
|
165
|
+
throw new Error('JwtStrategy.sign(): a secretOrPrivateKey is required (no secretOrKey option)');
|
|
166
|
+
}
|
|
167
|
+
return jsonwebtoken_1.default.sign(payload, secret, options);
|
|
37
168
|
}
|
|
38
169
|
}
|
|
39
170
|
exports.JwtStrategy = JwtStrategy;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jwt.js","sourceRoot":"","sources":["../../src/strategies/jwt.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"jwt.js","sourceRoot":"","sources":["../../src/strategies/jwt.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAkDA,wCAIC;AAtDD,gEAAkF;AAElF,4CAAiD;AAIjD,uCAA+D;AA2C/D,6GAA6G;AAC7G,SAAgB,cAAc,CAAC,OAAgC;;IAC3D,MAAM,KAAK,GAAG,MAAA,MAAA,OAAO,CAAC,KAAK,mCAAI,OAAO,CAAC,GAAG,mCAAI,OAAO,CAAC,MAAM,CAAC;IAC7D,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC9F,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAe,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;AAC9E,CAAC;AAED;;;;;GAKG;AACH,MAAa,WAAW;IAIpB,YACuB,WAAwB,EACxB,OAA2B;;QAD3B,gBAAW,GAAX,WAAW,CAAa;QACxB,YAAO,GAAP,OAAO,CAAoB;QAE9C,IAAI,OAAO,CAAC,WAAW,KAAK,SAAS,IAAI,OAAO,CAAC,mBAAmB,KAAK,SAAS,EAAE,CAAC;Y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SAAS,cAAT,SAAS,GAAI,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,GACzE,MAAM,CACZ,CAAC;QACF,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACtB,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QACnE,CAAC;QACD,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,kBAAkB,EAAE,WAAW,CAAC,CAAC;IAC/D,CAAC;IAED;;;;;;;OAOG;IACH,IAAI,CAAC,OAAwB,EAAE,kBAA2B,EAAE,OAAqB;QAC7E,MAAM,MAAM,GAAG,kBAAkB,aAAlB,kBAAkB,cAAlB,kBAAkB,GAAI,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC;QAC9D,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CAAC,8EAA8E,CAAC,CAAC;QACpG,CAAC;QACD,OAAO,sBAAG,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9C,CAAC;CACJ;AApID,kCAoIC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AuthStrategy, AuthStrategyContext, AuthStrategyResult } from './interfaces';
|
|
2
|
+
/** Returns the passport instance, or `undefined` if passport is not installed. */
|
|
3
|
+
export declare function loadPassport(): any;
|
|
4
|
+
/**
|
|
5
|
+
* Uses a passport strategy (any of the passport ecosystem: OAuth providers, SAML, LDAP...) as an {@link AuthStrategy}.
|
|
6
|
+
*
|
|
7
|
+
* passport is an optional dependency: install it to use passport strategies. Register them in passport as usual
|
|
8
|
+
* (`passport.use()`, or a `@nestjs/passport` `PassportStrategy` class), then name them in the guards:
|
|
9
|
+
* a strategy name that is not registered in the {@link AuthStrategyRegistry} is looked up in passport.
|
|
10
|
+
*
|
|
11
|
+
* The user given by passport is logged in by the guard (no passport serializer needed for the sessions).
|
|
12
|
+
* A strategy that sends the response (OAuth redirect) ends the request: the handler is not called.
|
|
13
|
+
*/
|
|
14
|
+
export declare class PassportAuthStrategy implements AuthStrategy {
|
|
15
|
+
readonly name: string;
|
|
16
|
+
protected readonly passport: any;
|
|
17
|
+
constructor(name: string, passport?: any);
|
|
18
|
+
/** Returns the adapter of a passport strategy, or `undefined` if passport is missing or has no such strategy. */
|
|
19
|
+
static find(name: string): PassportAuthStrategy | undefined;
|
|
20
|
+
authenticate({ request, response, options }: AuthStrategyContext): Promise<AuthStrategyResult | undefined>;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=passport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"passport.d.ts","sourceRoot":"","sources":["../../src/strategies/passport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAIrF,kFAAkF;AAClF,wBAAgB,YAAY,IAAI,GAAG,CAWlC;AAED;;;;;;;;;GASG;AACH,qBAAa,oBAAqB,YAAW,YAAY;IAEjD,QAAQ,CAAC,IAAI,EAAE,MAAM;IACrB,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,GAAG;gBADvB,IAAI,EAAE,MAAM,EACF,QAAQ,GAAE,GAAoB;IAOrD,iHAAiH;IACjH,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS;IAQrD,YAAY,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,GAAG,SAAS,CAAC;CA6BnH"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.PassportAuthStrategy = void 0;
|
|
13
|
+
exports.loadPassport = loadPassport;
|
|
14
|
+
let passportModule;
|
|
15
|
+
/** Returns the passport instance, or `undefined` if passport is not installed. */
|
|
16
|
+
function loadPassport() {
|
|
17
|
+
var _a;
|
|
18
|
+
if (passportModule === undefined) {
|
|
19
|
+
try {
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
21
|
+
const loaded = require('passport');
|
|
22
|
+
passportModule = (_a = loaded === null || loaded === void 0 ? void 0 : loaded.default) !== null && _a !== void 0 ? _a : loaded;
|
|
23
|
+
}
|
|
24
|
+
catch (_b) {
|
|
25
|
+
passportModule = null;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return passportModule !== null && passportModule !== void 0 ? passportModule : undefined;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Uses a passport strategy (any of the passport ecosystem: OAuth providers, SAML, LDAP...) as an {@link AuthStrategy}.
|
|
32
|
+
*
|
|
33
|
+
* passport is an optional dependency: install it to use passport strategies. Register them in passport as usual
|
|
34
|
+
* (`passport.use()`, or a `@nestjs/passport` `PassportStrategy` class), then name them in the guards:
|
|
35
|
+
* a strategy name that is not registered in the {@link AuthStrategyRegistry} is looked up in passport.
|
|
36
|
+
*
|
|
37
|
+
* The user given by passport is logged in by the guard (no passport serializer needed for the sessions).
|
|
38
|
+
* A strategy that sends the response (OAuth redirect) ends the request: the handler is not called.
|
|
39
|
+
*/
|
|
40
|
+
class PassportAuthStrategy {
|
|
41
|
+
constructor(name, passport = loadPassport()) {
|
|
42
|
+
this.name = name;
|
|
43
|
+
this.passport = passport;
|
|
44
|
+
if (this.passport === undefined) {
|
|
45
|
+
throw new Error(`The passport strategy "${name}" needs passport: npm install passport`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/** Returns the adapter of a passport strategy, or `undefined` if passport is missing or has no such strategy. */
|
|
49
|
+
static find(name) {
|
|
50
|
+
const passport = loadPassport();
|
|
51
|
+
if (passport === undefined || typeof passport._strategy !== 'function' || !passport._strategy(name)) {
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
return new PassportAuthStrategy(name, passport);
|
|
55
|
+
}
|
|
56
|
+
authenticate(_a) {
|
|
57
|
+
return __awaiter(this, arguments, void 0, function* ({ request, response, options }) {
|
|
58
|
+
var _b;
|
|
59
|
+
// passport writes to a node response (redirects): fastify gives a reply, its node response is reply.raw
|
|
60
|
+
const res = (_b = response === null || response === void 0 ? void 0 : response.raw) !== null && _b !== void 0 ? _b : response;
|
|
61
|
+
return yield new Promise((resolve, reject) => {
|
|
62
|
+
var _a;
|
|
63
|
+
let settled = false;
|
|
64
|
+
const settle = (fn) => {
|
|
65
|
+
if (!settled) {
|
|
66
|
+
settled = true;
|
|
67
|
+
fn();
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
// a strategy that redirects ends the response without calling the callback
|
|
71
|
+
(_a = res === null || res === void 0 ? void 0 : res.once) === null || _a === void 0 ? void 0 : _a.call(res, 'finish', () => settle(() => resolve({ user: undefined, handled: true })));
|
|
72
|
+
const callback = (err, user, info) => settle(() => {
|
|
73
|
+
if (err !== undefined && err !== null) {
|
|
74
|
+
return reject(err);
|
|
75
|
+
}
|
|
76
|
+
if (typeof user !== 'object' || user === null) {
|
|
77
|
+
return resolve(undefined);
|
|
78
|
+
}
|
|
79
|
+
const namespace = info === null || info === void 0 ? void 0 : info.namespace;
|
|
80
|
+
resolve({ user, info, namespace: typeof namespace === 'string' ? namespace : undefined });
|
|
81
|
+
});
|
|
82
|
+
const next = (err) => settle(() => (err ? reject(err) : resolve(undefined)));
|
|
83
|
+
// the guard logs the user in: passport must not use its own session
|
|
84
|
+
this.passport.authenticate(this.name, Object.assign(Object.assign({}, options), { session: false }), callback)(request, res, next);
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
exports.PassportAuthStrategy = PassportAuthStrategy;
|
|
90
|
+
//# sourceMappingURL=passport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"passport.js","sourceRoot":"","sources":["../../src/strategies/passport.ts"],"names":[],"mappings":";;;;;;;;;;;;AAKA,oCAWC;AAdD,IAAI,cAAmB,CAAC;AAExB,kFAAkF;AAClF,SAAgB,YAAY;;IACxB,IAAI,cAAc,KAAK,SAAS,EAAE,CAAC;QAC/B,IAAI,CAAC;YACD,iEAAiE;YACjE,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;YACnC,cAAc,GAAG,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,OAAO,mCAAI,MAAM,CAAC;QAC/C,CAAC;QAAC,WAAM,CAAC;YACL,cAAc,GAAG,IAAI,CAAC;QAC1B,CAAC;IACL,CAAC;IACD,OAAO,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,SAAS,CAAC;AACvC,CAAC;AAED;;;;;;;;;GASG;AACH,MAAa,oBAAoB;IAC7B,YACa,IAAY,EACF,WAAgB,YAAY,EAAE;QADxC,SAAI,GAAJ,IAAI,CAAQ;QACF,aAAQ,GAAR,QAAQ,CAAsB;QAEjD,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CAAC,0BAA0B,IAAI,wCAAwC,CAAC,CAAC;QAC5F,CAAC;IACL,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C,GAAG,CAAC,CAAC;oBACvB,CAAC;oBACD,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;wBAC5C,OAAO,OAAO,CAAC,SAAS,CAAC,CAAC;oBAC9B,CAAC;oBACD,MAAM,SAAS,GAAI,IAA4C,aAA5C,IAAI,uBAAJ,IAAI,CAA0C,SAAS,CAAC;oBAC3E,OAAO,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC;gBAC9F,CAAC,CAAC,CAAC;gBACP,MAAM,IAAI,GAAG,CAAC,GAAS,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;gBACnF,oEAAoE;gBACpE,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,kCAAO,OAAO,KAAE,OAAO,EAAE,KAAK,KAAI,QAAQ,CAAC,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;YACxG,CAAC,CAAC,CAAC;QACP,CAAC;KAAA;CACJ;AAhDD,oDAgDC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { OnModuleInit } from '@nestjs/common';
|
|
2
|
+
import type { IAuthModuleOptions } from '../interfaces/options';
|
|
3
|
+
import { AuthService } from '../service';
|
|
4
|
+
import { AuthStrategy } from './interfaces';
|
|
5
|
+
/**
|
|
6
|
+
* The strategies of the application, by name. Provided by the {@link AuthModule}.
|
|
7
|
+
*
|
|
8
|
+
* A name that is not registered is looked up in passport (if it is installed): any passport strategy works with
|
|
9
|
+
* the guard through {@link PassportAuthStrategy}.
|
|
10
|
+
*/
|
|
11
|
+
export declare class AuthStrategyRegistry implements OnModuleInit {
|
|
12
|
+
readonly moduleOptions?: IAuthModuleOptions | undefined;
|
|
13
|
+
readonly authService?: AuthService | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* The registry of the last initialized application, used by the guards created with `new AuthGuard()`
|
|
16
|
+
* (they are not created by the dependency injection).
|
|
17
|
+
*/
|
|
18
|
+
static current: AuthStrategyRegistry | undefined;
|
|
19
|
+
protected readonly strategies: Map<string, AuthStrategy<any>>;
|
|
20
|
+
constructor(moduleOptions?: IAuthModuleOptions | undefined, authService?: AuthService | undefined);
|
|
21
|
+
onModuleInit(): void;
|
|
22
|
+
/** Registers a strategy under its name. A strategy with the same name is replaced. */
|
|
23
|
+
register(strategy: AuthStrategy): this;
|
|
24
|
+
/** Returns the registered strategies by name. */
|
|
25
|
+
getStrategies(): ReadonlyMap<string, AuthStrategy>;
|
|
26
|
+
/**
|
|
27
|
+
* Returns the strategy of a name: a registered one, else the passport strategy of this name.
|
|
28
|
+
*
|
|
29
|
+
* @throws Error if there is none
|
|
30
|
+
*/
|
|
31
|
+
get(name: string): AuthStrategy;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/strategies/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,YAAY,EAAY,MAAM,gBAAgB,CAAC;AAG5E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAG5C;;;;;GAKG;AACH,qBACa,oBAAqB,YAAW,YAAY;IAUP,QAAQ,CAAC,aAAa,CAAC,EAAE,kBAAkB;IACzE,QAAQ,CAAC,WAAW,CAAC,EAAE,WAAW;IAVlD;;;OAGG;IACH,MAAM,CAAC,OAAO,EAAE,oBAAoB,GAAG,SAAS,CAAC;IAEjD,SAAS,CAAC,QAAQ,CAAC,UAAU,iCAAmC;gBAGT,aAAa,CAAC,EAAE,kBAAkB,YAAA,EAChE,WAAW,CAAC,EAAE,WAAW,YAAA;IAGlD,YAAY,IAAI,IAAI;IAIpB,sFAAsF;IACtF,QAAQ,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI;IAKtC,iDAAiD;IACjD,aAAa,IAAI,WAAW,CAAC,MAAM,EAAE,YAAY,CAAC;IAIlD;;;;OAIG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY;CASlC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
var AuthStrategyRegistry_1;
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.AuthStrategyRegistry = void 0;
|
|
17
|
+
const common_1 = require("@nestjs/common");
|
|
18
|
+
const constants_1 = require("../constants");
|
|
19
|
+
const service_1 = require("../service");
|
|
20
|
+
const passport_1 = require("./passport");
|
|
21
|
+
/**
|
|
22
|
+
* The strategies of the application, by name. Provided by the {@link AuthModule}.
|
|
23
|
+
*
|
|
24
|
+
* A name that is not registered is looked up in passport (if it is installed): any passport strategy works with
|
|
25
|
+
* the guard through {@link PassportAuthStrategy}.
|
|
26
|
+
*/
|
|
27
|
+
let AuthStrategyRegistry = AuthStrategyRegistry_1 = class AuthStrategyRegistry {
|
|
28
|
+
constructor(moduleOptions, authService) {
|
|
29
|
+
this.moduleOptions = moduleOptions;
|
|
30
|
+
this.authService = authService;
|
|
31
|
+
this.strategies = new Map();
|
|
32
|
+
}
|
|
33
|
+
onModuleInit() {
|
|
34
|
+
AuthStrategyRegistry_1.current = this;
|
|
35
|
+
}
|
|
36
|
+
/** Registers a strategy under its name. A strategy with the same name is replaced. */
|
|
37
|
+
register(strategy) {
|
|
38
|
+
this.strategies.set(strategy.name, strategy);
|
|
39
|
+
return this;
|
|
40
|
+
}
|
|
41
|
+
/** Returns the registered strategies by name. */
|
|
42
|
+
getStrategies() {
|
|
43
|
+
return this.strategies;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Returns the strategy of a name: a registered one, else the passport strategy of this name.
|
|
47
|
+
*
|
|
48
|
+
* @throws Error if there is none
|
|
49
|
+
*/
|
|
50
|
+
get(name) {
|
|
51
|
+
var _a;
|
|
52
|
+
const strategy = (_a = this.strategies.get(name)) !== null && _a !== void 0 ? _a : passport_1.PassportAuthStrategy.find(name);
|
|
53
|
+
if (strategy === undefined) {
|
|
54
|
+
throw new Error(`Unknown authentication strategy "${name}": register it with AuthModule.registerStrategies() (or in passport)`);
|
|
55
|
+
}
|
|
56
|
+
return strategy;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
exports.AuthStrategyRegistry = AuthStrategyRegistry;
|
|
60
|
+
exports.AuthStrategyRegistry = AuthStrategyRegistry = AuthStrategyRegistry_1 = __decorate([
|
|
61
|
+
(0, common_1.Injectable)(),
|
|
62
|
+
__param(0, (0, common_1.Optional)()),
|
|
63
|
+
__param(0, (0, common_1.Inject)(constants_1.MODULE_OPTIONS_TOKEN)),
|
|
64
|
+
__param(1, (0, common_1.Optional)()),
|
|
65
|
+
__metadata("design:paramtypes", [Object, service_1.AuthService])
|
|
66
|
+
], AuthStrategyRegistry);
|
|
67
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/strategies/registry.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAA4E;AAE5E,4CAAoD;AAEpD,wCAAyC;AAGzC,yCAAkD;AAElD;;;;;GAKG;AAEI,IAAM,oBAAoB,4BAA1B,MAAM,oBAAoB;IAS7B,YAC8C,aAA2C,EACzE,WAAkC;QADK,kBAAa,GAAb,aAAa,CAAqB;QAChE,gBAAW,GAAX,WAAW,CAAc;QAJ/B,eAAU,GAAG,IAAI,GAAG,EAAwB,CAAC;IAK7D,CAAC;IAEJ,YAAY;QACR,sBAAoB,CAAC,OAAO,GAAG,IAAI,CAAC;IACxC,CAAC;IAED,sFAAsF;IACtF,QAAQ,CAAC,QAAsB;QAC3B,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAC7C,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,iDAAiD;IACjD,aAAa;QACT,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAED;;;;OAIG;IACH,GAAG,CAAC,IAAY;;QACZ,MAAM,QAAQ,GAAG,MAAA,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,mCAAI,+BAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC9E,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CACX,oCAAoC,IAAI,sEAAsE,CACjH,CAAC;QACN,CAAC;QACD,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ,CAAA;AA3CY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,mBAAU,GAAE;IAWJ,WAAA,IAAA,iBAAQ,GAAE,CAAA;IAAE,WAAA,IAAA,eAAM,EAAC,gCAAoB,CAAC,CAAA;IACxC,WAAA,IAAA,iBAAQ,GAAE,CAAA;6CAAwB,qBAAW;GAXzC,oBAAoB,CA2ChC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { IAuthModuleOptions } from '../interfaces/options';
|
|
2
|
+
import { AuthService } from '../service';
|
|
3
|
+
import { AuthStrategy, AuthStrategyContext, AuthStrategyResult } from './interfaces';
|
|
4
|
+
/**
|
|
5
|
+
* The `session` strategy: loads the user stored in the session (`fromSession: true` in a guard).
|
|
6
|
+
*
|
|
7
|
+
* The session holds the payload of the user (`session.passport.user`, the format of passport), loaded back with the
|
|
8
|
+
* auth provider of its namespace. If the user or its provider does not exist anymore, it is removed from the session.
|
|
9
|
+
*/
|
|
10
|
+
export declare class SessionStrategy<User = any> implements AuthStrategy<User> {
|
|
11
|
+
protected readonly authService: AuthService;
|
|
12
|
+
protected readonly moduleOptions?: IAuthModuleOptions | undefined;
|
|
13
|
+
readonly name = "session";
|
|
14
|
+
constructor(authService: AuthService, moduleOptions?: IAuthModuleOptions | undefined);
|
|
15
|
+
protected get key(): string;
|
|
16
|
+
authenticate({ request }: AuthStrategyContext): Promise<AuthStrategyResult<User> | undefined>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/strategies/session.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAErF;;;;;GAKG;AACH,qBACa,eAAe,CAAC,IAAI,GAAG,GAAG,CAAE,YAAW,YAAY,CAAC,IAAI,CAAC;IAI9D,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,WAAW;IACD,SAAS,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,kBAAkB;IAJnG,QAAQ,CAAC,IAAI,aAAa;gBAGH,WAAW,EAAE,WAAW,EACkB,aAAa,CAAC,EAAE,kBAAkB,YAAA;IAGnG,SAAS,KAAK,GAAG,IAAI,MAAM,CAE1B;IAEK,YAAY,CAAC,EAAE,OAAO,EAAE,EAAE,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC;CAyBtG"}
|