@nestjs-kitchen/authz 2.0.2 → 2.0.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.
- package/dist/authz.provider.d.ts +1 -3
- package/dist/authz.provider.js +29 -48
- package/dist/constants.d.ts +6 -8
- package/dist/constants.js +13 -46
- package/dist/errors.d.ts +3 -5
- package/dist/errors.js +35 -60
- package/dist/index.d.ts +5 -21
- package/dist/index.js +16 -45
- package/dist/jwt/extract-jwt.d.ts +4 -7
- package/dist/jwt/extract-jwt.js +138 -158
- package/dist/jwt/index.d.ts +2 -16
- package/dist/jwt/index.js +7 -30
- package/dist/jwt/jwt-authz-als.middleware.d.ts +6 -16
- package/dist/jwt/jwt-authz-als.middleware.js +44 -81
- package/dist/jwt/jwt-authz.guard.d.ts +8 -21
- package/dist/jwt/jwt-authz.guard.js +130 -175
- package/dist/jwt/jwt-authz.interface.d.ts +16 -25
- package/dist/jwt/jwt-authz.interface.js +69 -92
- package/dist/jwt/jwt-authz.module.d.ts +19 -31
- package/dist/jwt/jwt-authz.module.js +250 -299
- package/dist/jwt/jwt-authz.service.d.ts +6 -17
- package/dist/jwt/jwt-authz.service.js +116 -162
- package/dist/jwt/jwt-authz.strategy.d.ts +5 -17
- package/dist/jwt/jwt-authz.strategy.js +132 -192
- package/dist/session/index.d.ts +1 -12
- package/dist/session/index.js +5 -27
- package/dist/session/session-authz-als.middleware.d.ts +5 -12
- package/dist/session/session-authz-als.middleware.js +98 -130
- package/dist/session/session-authz.guard.d.ts +6 -15
- package/dist/session/session-authz.guard.js +98 -135
- package/dist/session/session-authz.interface.d.ts +5 -12
- package/dist/session/session-authz.interface.js +19 -42
- package/dist/session/session-authz.module.d.ts +18 -26
- package/dist/session/session-authz.module.js +241 -290
- package/dist/session/session-authz.service.d.ts +5 -13
- package/dist/session/session-authz.service.js +69 -105
- package/dist/session/session-authz.strategy.d.ts +4 -12
- package/dist/session/session-authz.strategy.js +68 -105
- package/dist/user.decorator.d.ts +3 -6
- package/dist/user.decorator.js +26 -35
- package/dist/utils/cookie-parsers.d.ts +3 -6
- package/dist/utils/cookie-parsers.js +66 -74
- package/dist/utils/create-authz-decorator-factory.d.ts +3 -9
- package/dist/utils/create-authz-decorator-factory.js +32 -54
- package/dist/utils/create-set-cookie-fn.d.ts +3 -9
- package/dist/utils/create-set-cookie-fn.js +23 -45
- package/dist/utils/generics.d.ts +4 -6
- package/dist/utils/generics.js +37 -63
- package/dist/utils/get-allow-anonymous.d.ts +2 -9
- package/dist/utils/get-allow-anonymous.js +7 -29
- package/dist/utils/get-als-store.d.ts +2 -5
- package/dist/utils/get-als-store.js +11 -34
- package/dist/utils/get-context-authz-meta-params-list.d.ts +2 -9
- package/dist/utils/get-context-authz-meta-params-list.js +16 -35
- package/dist/utils/get-passport-property.d.ts +1 -3
- package/dist/utils/get-passport-property.js +8 -30
- package/dist/utils/index.d.ts +11 -16
- package/dist/utils/index.js +26 -40
- package/dist/utils/merge-dynamic-module-configs.d.ts +2 -5
- package/dist/utils/merge-dynamic-module-configs.js +14 -49
- package/dist/utils/msgpackrs.d.ts +2 -4
- package/dist/utils/msgpackrs.js +11 -35
- package/dist/utils/types.d.ts +23 -26
- package/dist/utils/types.js +2 -15
- package/package.json +7 -7
|
@@ -1,194 +1,134 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
|
-
var __export = (target, all) => {
|
|
10
|
-
for (var name in all)
|
|
11
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
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;
|
|
12
7
|
};
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
for (let key of __getOwnPropNames(from))
|
|
16
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
-
}
|
|
19
|
-
return to;
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
20
10
|
};
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
];
|
|
146
|
-
}
|
|
147
|
-
const extractor = import_extract_jwt.ExtractJwt.fromExtractors(authOptions.refresh.jwtFromRequest);
|
|
148
|
-
req[import_constants.PASSPORT_PROPERTY] = authOptions.passportProperty;
|
|
149
|
-
const token = extractor(req);
|
|
150
|
-
if (!token) {
|
|
151
|
-
return [
|
|
152
|
-
null,
|
|
153
|
-
new import_errors.AuthzAnonymousError("AnonymousError: Cannnot find token.")
|
|
154
|
-
];
|
|
155
|
-
}
|
|
156
|
-
let user = void 0;
|
|
157
|
-
try {
|
|
158
|
-
const payload = import_jsonwebtoken.default.verify(token, authOptions.refresh.secretOrPublicKey, authOptions.refresh.verify);
|
|
159
|
-
const decodePayload = (0, import_utils.decodeMsgpackrString)(payload.data);
|
|
160
|
-
user = await this.authzProvider.authenticate(decodePayload);
|
|
161
|
-
} catch (error) {
|
|
162
|
-
return [
|
|
163
|
-
null,
|
|
164
|
-
error instanceof Error ? new import_errors.AuthzVerificationError(`${error.name}: ${error.message}`, error) : new import_errors.AuthzVerificationError(`${error}`)
|
|
165
|
-
];
|
|
166
|
-
}
|
|
167
|
-
store.user = user;
|
|
168
|
-
store.jwtVerifiedBy = import_constants.JwtValidationType.REFRESH;
|
|
169
|
-
if (!user) {
|
|
170
|
-
return [
|
|
171
|
-
null,
|
|
172
|
-
new import_errors.AuthzAnonymousError("AnonymousError: Cannnot find user.")
|
|
173
|
-
];
|
|
174
|
-
}
|
|
175
|
-
return user;
|
|
176
|
-
}
|
|
177
|
-
}, __name(_a, "RefreshStrategy"), _a);
|
|
178
|
-
RefreshStrategy = _ts_decorate([
|
|
179
|
-
(0, import_common.Injectable)(),
|
|
180
|
-
_ts_param(0, (0, import_common.Inject)(AUTHZ_PROVIDER)),
|
|
181
|
-
_ts_param(1, (0, import_common.Inject)(ALS_PROVIDER)),
|
|
182
|
-
_ts_metadata("design:type", Function),
|
|
183
|
-
_ts_metadata("design:paramtypes", [
|
|
184
|
-
typeof import_authz.AuthzProviderClass === "undefined" ? Object : import_authz.AuthzProviderClass,
|
|
185
|
-
typeof import_node_async_hooks.AsyncLocalStorage === "undefined" ? Object : import_node_async_hooks.AsyncLocalStorage
|
|
186
|
-
])
|
|
187
|
-
], RefreshStrategy);
|
|
188
|
-
return (0, import_common.mixin)(RefreshStrategy);
|
|
189
|
-
}, "createRefreshStrategy");
|
|
190
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
191
|
-
0 && (module.exports = {
|
|
192
|
-
createJwtStrategy,
|
|
193
|
-
createRefreshStrategy
|
|
194
|
-
});
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
15
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
16
|
+
};
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.createRefreshStrategy = exports.createJwtStrategy = void 0;
|
|
19
|
+
const node_async_hooks_1 = require("node:async_hooks");
|
|
20
|
+
const common_1 = require("@nestjs/common");
|
|
21
|
+
const passport_1 = require("@nestjs/passport");
|
|
22
|
+
const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
|
|
23
|
+
const passport_custom_1 = require("passport-custom");
|
|
24
|
+
const authz_provider_1 = require("../authz.provider");
|
|
25
|
+
const constants_1 = require("../constants");
|
|
26
|
+
const errors_1 = require("../errors");
|
|
27
|
+
const utils_1 = require("../utils");
|
|
28
|
+
const extract_jwt_1 = require("./extract-jwt");
|
|
29
|
+
const createJwtStrategy = ([JWT_STRATEGY, AUTHZ_PROVIDER, ALS_PROVIDER]) => {
|
|
30
|
+
let JwtStrategy = class JwtStrategy extends (0, passport_1.PassportStrategy)(passport_custom_1.Strategy, JWT_STRATEGY) {
|
|
31
|
+
constructor(authzProvider, als) {
|
|
32
|
+
super();
|
|
33
|
+
this.authzProvider = authzProvider;
|
|
34
|
+
this.als = als;
|
|
35
|
+
if (typeof this.authzProvider.authenticate !== 'function') {
|
|
36
|
+
throw new errors_1.AuthzError(`InternalError: Method 'authenticate' from abstract class 'AuthzProvider' must be implemented.`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
async validate(req) {
|
|
40
|
+
const store = (0, utils_1.getAlsStore)(this.als);
|
|
41
|
+
const authOptions = store.authOptions;
|
|
42
|
+
if (!authOptions.jwt.verify) {
|
|
43
|
+
return [null, new errors_1.AuthzError(`InternalError: Refresh verify options must be implemented.`)];
|
|
44
|
+
}
|
|
45
|
+
const extractor = extract_jwt_1.ExtractJwt.fromExtractors(authOptions.jwt.jwtFromRequest);
|
|
46
|
+
req[constants_1.PASSPORT_PROPERTY] = authOptions.passportProperty;
|
|
47
|
+
const token = extractor(req);
|
|
48
|
+
if (!token) {
|
|
49
|
+
return [null, new errors_1.AuthzAnonymousError('AnonymousError: Cannnot find token.')];
|
|
50
|
+
}
|
|
51
|
+
let user = undefined;
|
|
52
|
+
try {
|
|
53
|
+
const payload = jsonwebtoken_1.default.verify(token, authOptions.jwt.secretOrPublicKey, authOptions.jwt.verify);
|
|
54
|
+
user = await this.authzProvider.authenticate(payload);
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
return [
|
|
58
|
+
null,
|
|
59
|
+
error instanceof Error
|
|
60
|
+
? new errors_1.AuthzVerificationError(`${error.name}: ${error.message}`, error)
|
|
61
|
+
: new errors_1.AuthzVerificationError(`${error}`)
|
|
62
|
+
];
|
|
63
|
+
}
|
|
64
|
+
store.user = user;
|
|
65
|
+
store.jwtVerifiedBy = constants_1.JwtValidationType.JWT;
|
|
66
|
+
if (!user) {
|
|
67
|
+
return [null, new errors_1.AuthzAnonymousError('AnonymousError: Cannnot find user.')];
|
|
68
|
+
}
|
|
69
|
+
return user;
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
JwtStrategy = __decorate([
|
|
73
|
+
__param(0, (0, common_1.Inject)(AUTHZ_PROVIDER)),
|
|
74
|
+
__param(1, (0, common_1.Inject)(ALS_PROVIDER)),
|
|
75
|
+
__metadata("design:paramtypes", [authz_provider_1.AuthzProviderClass,
|
|
76
|
+
node_async_hooks_1.AsyncLocalStorage])
|
|
77
|
+
], JwtStrategy);
|
|
78
|
+
return (0, common_1.mixin)(JwtStrategy);
|
|
79
|
+
};
|
|
80
|
+
exports.createJwtStrategy = createJwtStrategy;
|
|
81
|
+
const createRefreshStrategy = ([JWT_REFRESH_STRATEGY, AUTHZ_PROVIDER, ALS_PROVIDER]) => {
|
|
82
|
+
let RefreshStrategy = class RefreshStrategy extends (0, passport_1.PassportStrategy)(passport_custom_1.Strategy, JWT_REFRESH_STRATEGY) {
|
|
83
|
+
constructor(authzProvider, als) {
|
|
84
|
+
super();
|
|
85
|
+
this.authzProvider = authzProvider;
|
|
86
|
+
this.als = als;
|
|
87
|
+
if (typeof this.authzProvider.authenticate !== 'function') {
|
|
88
|
+
throw new errors_1.AuthzError(`InternalError: Method 'authenticate' from abstract class 'AuthzProvider' must be implemented.`);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
async validate(req) {
|
|
92
|
+
const store = (0, utils_1.getAlsStore)(this.als);
|
|
93
|
+
const authOptions = store.authOptions;
|
|
94
|
+
if (!authOptions.refresh.verify) {
|
|
95
|
+
return [null, new errors_1.AuthzError(`InternalError: Refresh verify options must be implemented.`)];
|
|
96
|
+
}
|
|
97
|
+
const extractor = extract_jwt_1.ExtractJwt.fromExtractors(authOptions.refresh.jwtFromRequest);
|
|
98
|
+
req[constants_1.PASSPORT_PROPERTY] = authOptions.passportProperty;
|
|
99
|
+
const token = extractor(req);
|
|
100
|
+
if (!token) {
|
|
101
|
+
return [null, new errors_1.AuthzAnonymousError('AnonymousError: Cannnot find token.')];
|
|
102
|
+
}
|
|
103
|
+
let user = undefined;
|
|
104
|
+
try {
|
|
105
|
+
const payload = jsonwebtoken_1.default.verify(token, authOptions.refresh.secretOrPublicKey, authOptions.refresh.verify);
|
|
106
|
+
const decodePayload = (0, utils_1.decodeMsgpackrString)(payload.data);
|
|
107
|
+
user = await this.authzProvider.authenticate(decodePayload);
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
return [
|
|
111
|
+
null,
|
|
112
|
+
error instanceof Error
|
|
113
|
+
? new errors_1.AuthzVerificationError(`${error.name}: ${error.message}`, error)
|
|
114
|
+
: new errors_1.AuthzVerificationError(`${error}`)
|
|
115
|
+
];
|
|
116
|
+
}
|
|
117
|
+
store.user = user;
|
|
118
|
+
store.jwtVerifiedBy = constants_1.JwtValidationType.REFRESH;
|
|
119
|
+
if (!user) {
|
|
120
|
+
return [null, new errors_1.AuthzAnonymousError('AnonymousError: Cannnot find user.')];
|
|
121
|
+
}
|
|
122
|
+
return user;
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
RefreshStrategy = __decorate([
|
|
126
|
+
(0, common_1.Injectable)(),
|
|
127
|
+
__param(0, (0, common_1.Inject)(AUTHZ_PROVIDER)),
|
|
128
|
+
__param(1, (0, common_1.Inject)(ALS_PROVIDER)),
|
|
129
|
+
__metadata("design:paramtypes", [authz_provider_1.AuthzProviderClass,
|
|
130
|
+
node_async_hooks_1.AsyncLocalStorage])
|
|
131
|
+
], RefreshStrategy);
|
|
132
|
+
return (0, common_1.mixin)(RefreshStrategy);
|
|
133
|
+
};
|
|
134
|
+
exports.createRefreshStrategy = createRefreshStrategy;
|
package/dist/session/index.d.ts
CHANGED
|
@@ -1,12 +1 @@
|
|
|
1
|
-
export { cereateSessionAuthzModule } from './session-authz.module
|
|
2
|
-
import '@nestjs/core';
|
|
3
|
-
import './session-authz.interface.js';
|
|
4
|
-
import 'express-session';
|
|
5
|
-
import '../utils/types.js';
|
|
6
|
-
import '@nestjs/common';
|
|
7
|
-
import '@nestjs/common/interfaces';
|
|
8
|
-
import 'express';
|
|
9
|
-
import '../authz.provider.js';
|
|
10
|
-
import 'node:async_hooks';
|
|
11
|
-
import '../errors.js';
|
|
12
|
-
import './session-authz-als.middleware.js';
|
|
1
|
+
export { cereateSessionAuthzModule } from './session-authz.module';
|
package/dist/session/index.js
CHANGED
|
@@ -1,27 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var session_exports = {};
|
|
19
|
-
__export(session_exports, {
|
|
20
|
-
cereateSessionAuthzModule: () => import_session_authz.cereateSessionAuthzModule
|
|
21
|
-
});
|
|
22
|
-
module.exports = __toCommonJS(session_exports);
|
|
23
|
-
var import_session_authz = require("./session-authz.module");
|
|
24
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
25
|
-
0 && (module.exports = {
|
|
26
|
-
cereateSessionAuthzModule
|
|
27
|
-
});
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cereateSessionAuthzModule = void 0;
|
|
4
|
+
var session_authz_module_1 = require("./session-authz.module");
|
|
5
|
+
Object.defineProperty(exports, "cereateSessionAuthzModule", { enumerable: true, get: function () { return session_authz_module_1.cereateSessionAuthzModule; } });
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import * as _nestjs_common from '@nestjs/common';
|
|
2
1
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
3
|
-
import { Request, Response
|
|
4
|
-
import { CookieOptionsWithSecret } from '../utils
|
|
5
|
-
import { SessionAuthzOptions } from './session-authz.interface
|
|
6
|
-
|
|
7
|
-
import '../authz.provider.js';
|
|
8
|
-
import 'express-session';
|
|
9
|
-
|
|
10
|
-
interface SessionAlsType<P, U> {
|
|
2
|
+
import type { NextFunction, Request, Response } from 'express';
|
|
3
|
+
import { type CookieOptionsWithSecret } from '../utils';
|
|
4
|
+
import type { SessionAuthzOptions } from './session-authz.interface';
|
|
5
|
+
export interface SessionAlsType<P, U> {
|
|
11
6
|
user?: U;
|
|
12
7
|
allowAnonymous?: boolean;
|
|
13
8
|
guardResult?: boolean;
|
|
@@ -16,10 +11,8 @@ interface SessionAlsType<P, U> {
|
|
|
16
11
|
logOut: () => Promise<void>;
|
|
17
12
|
setCookie: (name: string, value: string, options?: CookieOptionsWithSecret) => void;
|
|
18
13
|
}
|
|
19
|
-
declare const createSessionAuthzAlsMiddleware: ([ALS_PROVIDER, SESSION_AUTHZ_OPTIONS]: [any, any]) =>
|
|
14
|
+
export declare const createSessionAuthzAlsMiddleware: ([ALS_PROVIDER, SESSION_AUTHZ_OPTIONS]: [any, any]) => import("@nestjs/common").Type<Omit<{
|
|
20
15
|
readonly als: AsyncLocalStorage<SessionAlsType<unknown, unknown>>;
|
|
21
16
|
readonly sessionAuthzOptions: SessionAuthzOptions;
|
|
22
17
|
use(req: Request, res: Response, next: NextFunction): void;
|
|
23
18
|
}, "als" | "sessionAuthzOptions">>;
|
|
24
|
-
|
|
25
|
-
export { type SessionAlsType, createSessionAuthzAlsMiddleware };
|