@venizia/ignis 0.0.9-13 → 0.0.9-15
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/base/models/enrichers/tz.enricher.d.ts.map +1 -1
- package/dist/base/models/enrichers/tz.enricher.js +5 -2
- package/dist/base/models/enrichers/tz.enricher.js.map +1 -1
- package/dist/base/repositories/core/readable.d.ts.map +1 -1
- package/dist/base/repositories/core/readable.js +16 -4
- package/dist/base/repositories/core/readable.js.map +1 -1
- package/dist/components/auth/authorize/adapters/base-filtered.d.ts +26 -56
- package/dist/components/auth/authorize/adapters/base-filtered.d.ts.map +1 -1
- package/dist/components/auth/authorize/adapters/base-filtered.js +23 -70
- package/dist/components/auth/authorize/adapters/base-filtered.js.map +1 -1
- package/dist/components/auth/authorize/adapters/index.d.ts +2 -1
- package/dist/components/auth/authorize/adapters/index.d.ts.map +1 -1
- package/dist/components/auth/authorize/adapters/index.js +2 -1
- package/dist/components/auth/authorize/adapters/index.js.map +1 -1
- package/dist/components/auth/authorize/adapters/scoped-casbin.adapter.d.ts +131 -0
- package/dist/components/auth/authorize/adapters/scoped-casbin.adapter.d.ts.map +1 -0
- package/dist/components/auth/authorize/adapters/scoped-casbin.adapter.js +293 -0
- package/dist/components/auth/authorize/adapters/scoped-casbin.adapter.js.map +1 -0
- package/dist/components/auth/authorize/adapters/types.d.ts +31 -0
- package/dist/components/auth/authorize/adapters/types.d.ts.map +1 -0
- package/dist/components/auth/authorize/adapters/types.js +3 -0
- package/dist/components/auth/authorize/adapters/types.js.map +1 -0
- package/dist/components/auth/authorize/common/constants.d.ts +127 -12
- package/dist/components/auth/authorize/common/constants.d.ts.map +1 -1
- package/dist/components/auth/authorize/common/constants.js +139 -16
- package/dist/components/auth/authorize/common/constants.js.map +1 -1
- package/dist/components/auth/authorize/common/index.d.ts +2 -0
- package/dist/components/auth/authorize/common/index.d.ts.map +1 -1
- package/dist/components/auth/authorize/common/index.js +2 -0
- package/dist/components/auth/authorize/common/index.js.map +1 -1
- package/dist/components/auth/authorize/common/object-match.d.ts +21 -0
- package/dist/components/auth/authorize/common/object-match.d.ts.map +1 -0
- package/dist/components/auth/authorize/common/object-match.js +33 -0
- package/dist/components/auth/authorize/common/object-match.js.map +1 -0
- package/dist/components/auth/authorize/common/resolve-request-domain.d.ts +20 -0
- package/dist/components/auth/authorize/common/resolve-request-domain.d.ts.map +1 -0
- package/dist/components/auth/authorize/common/resolve-request-domain.js +59 -0
- package/dist/components/auth/authorize/common/resolve-request-domain.js.map +1 -0
- package/dist/components/auth/authorize/common/types.d.ts +65 -22
- package/dist/components/auth/authorize/common/types.d.ts.map +1 -1
- package/dist/components/auth/authorize/enforcers/casbin.enforcer.d.ts +119 -30
- package/dist/components/auth/authorize/enforcers/casbin.enforcer.d.ts.map +1 -1
- package/dist/components/auth/authorize/enforcers/casbin.enforcer.js +302 -168
- package/dist/components/auth/authorize/enforcers/casbin.enforcer.js.map +1 -1
- package/dist/components/auth/authorize/enforcers/enforcer-registry.d.ts +19 -1
- package/dist/components/auth/authorize/enforcers/enforcer-registry.d.ts.map +1 -1
- package/dist/components/auth/authorize/enforcers/enforcer-registry.js +23 -0
- package/dist/components/auth/authorize/enforcers/enforcer-registry.js.map +1 -1
- package/dist/components/auth/authorize/enforcers/index.d.ts +1 -0
- package/dist/components/auth/authorize/enforcers/index.d.ts.map +1 -1
- package/dist/components/auth/authorize/enforcers/index.js +1 -0
- package/dist/components/auth/authorize/enforcers/index.js.map +1 -1
- package/dist/components/auth/authorize/enforcers/models/index.d.ts +2 -0
- package/dist/components/auth/authorize/enforcers/models/index.d.ts.map +1 -0
- package/dist/components/auth/authorize/{models/abilities → enforcers/models}/index.js +1 -2
- package/dist/components/auth/authorize/enforcers/models/index.js.map +1 -0
- package/dist/components/auth/authorize/enforcers/models/rbac-domain.model.d.ts +32 -0
- package/dist/components/auth/authorize/enforcers/models/rbac-domain.model.d.ts.map +1 -0
- package/dist/components/auth/authorize/enforcers/models/rbac-domain.model.js +54 -0
- package/dist/components/auth/authorize/enforcers/models/rbac-domain.model.js.map +1 -0
- package/dist/components/auth/authorize/models/index.d.ts +0 -1
- package/dist/components/auth/authorize/models/index.d.ts.map +1 -1
- package/dist/components/auth/authorize/models/index.js +0 -1
- package/dist/components/auth/authorize/models/index.js.map +1 -1
- package/dist/components/auth/authorize/providers/authorization.provider.d.ts.map +1 -1
- package/dist/components/auth/authorize/providers/authorization.provider.js +12 -0
- package/dist/components/auth/authorize/providers/authorization.provider.js.map +1 -1
- package/dist/components/mail/helpers/executors/internal-queue-executor.helper.d.ts.map +1 -1
- package/dist/components/mail/helpers/executors/internal-queue-executor.helper.js +1 -1
- package/dist/components/mail/helpers/executors/internal-queue-executor.helper.js.map +1 -1
- package/package.json +3 -3
- package/dist/components/auth/authorize/adapters/drizzle-casbin.d.ts +0 -46
- package/dist/components/auth/authorize/adapters/drizzle-casbin.d.ts.map +0 -1
- package/dist/components/auth/authorize/adapters/drizzle-casbin.js +0 -104
- package/dist/components/auth/authorize/adapters/drizzle-casbin.js.map +0 -1
- package/dist/components/auth/authorize/models/abilities/index.d.ts +0 -3
- package/dist/components/auth/authorize/models/abilities/index.d.ts.map +0 -1
- package/dist/components/auth/authorize/models/abilities/index.js.map +0 -1
- package/dist/components/auth/authorize/models/abilities/string-action.model.d.ts +0 -14
- package/dist/components/auth/authorize/models/abilities/string-action.model.d.ts.map +0 -1
- package/dist/components/auth/authorize/models/abilities/string-action.model.js +0 -23
- package/dist/components/auth/authorize/models/abilities/string-action.model.js.map +0 -1
- package/dist/components/auth/authorize/models/abilities/string-resource.model.d.ts +0 -13
- package/dist/components/auth/authorize/models/abilities/string-resource.model.d.ts.map +0 -1
- package/dist/components/auth/authorize/models/abilities/string-resource.model.js +0 -19
- package/dist/components/auth/authorize/models/abilities/string-resource.model.js.map +0 -1
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.AuthorizationPolicyVariants = exports.CasbinRuleVariants = exports.AuthorizationDomainScopes = exports.CasbinDomainMatchingFunctions = exports.CasbinEnforcerModelDrivers = exports.CasbinEnforcerCachedDrivers = exports.AuthorizationEnforcerTypes = exports.AuthorizationRoles = exports.AuthorizationDecisions = exports.AuthorizationActions = exports.Authorization = void 0;
|
|
4
4
|
const authorization_role_model_1 = require("../models/authorization-role.model");
|
|
5
5
|
class Authorization {
|
|
6
6
|
static { this.RULES = 'authorization.rules'; }
|
|
7
7
|
static { this.SKIP_AUTHORIZATION = 'authorization.skip'; }
|
|
8
8
|
static { this.ENFORCER = 'authorization.enforcer'; }
|
|
9
|
+
static { this.DOMAIN = 'authorization.domain'; }
|
|
9
10
|
}
|
|
10
11
|
exports.Authorization = Authorization;
|
|
11
12
|
class AuthorizationActions {
|
|
@@ -97,9 +98,8 @@ class AuthorizationEnforcerTypes {
|
|
|
97
98
|
}
|
|
98
99
|
exports.AuthorizationEnforcerTypes = AuthorizationEnforcerTypes;
|
|
99
100
|
class CasbinEnforcerCachedDrivers {
|
|
100
|
-
static { this.IN_MEMORY = 'in-memory'; }
|
|
101
101
|
static { this.REDIS = 'redis'; }
|
|
102
|
-
static { this.SCHEME_SET = new Set([this.
|
|
102
|
+
static { this.SCHEME_SET = new Set([this.REDIS]); }
|
|
103
103
|
static isValid(input) {
|
|
104
104
|
return this.SCHEME_SET.has(input);
|
|
105
105
|
}
|
|
@@ -114,19 +114,6 @@ class CasbinEnforcerModelDrivers {
|
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
exports.CasbinEnforcerModelDrivers = CasbinEnforcerModelDrivers;
|
|
117
|
-
class CasbinRuleVariants {
|
|
118
|
-
static { this.POLICY = 'policy'; }
|
|
119
|
-
static { this.GROUP = 'group'; }
|
|
120
|
-
/** Casbin line prefix for policy rules. */
|
|
121
|
-
static { this.P = 'p'; }
|
|
122
|
-
/** Casbin line prefix for grouping rules. */
|
|
123
|
-
static { this.G = 'g'; }
|
|
124
|
-
static { this.SCHEME_SET = new Set([this.POLICY, this.GROUP]); }
|
|
125
|
-
static isValid(input) {
|
|
126
|
-
return this.SCHEME_SET.has(input);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
exports.CasbinRuleVariants = CasbinRuleVariants;
|
|
130
117
|
class CasbinDomainMatchingFunctions {
|
|
131
118
|
/** `*` is the only wildcard; exact compare otherwise. Safest for `Merchant_<uuid>` domains. */
|
|
132
119
|
static { this.KEY_MATCH = 'keyMatch'; }
|
|
@@ -150,4 +137,140 @@ class CasbinDomainMatchingFunctions {
|
|
|
150
137
|
}
|
|
151
138
|
}
|
|
152
139
|
exports.CasbinDomainMatchingFunctions = CasbinDomainMatchingFunctions;
|
|
140
|
+
class AuthorizationDomainScopes {
|
|
141
|
+
/** Grant applies in EVERY domain the subject is a member of (checked via join_domain / g2). */
|
|
142
|
+
static { this.ANY_MEMBER = 'ANY_MEMBER'; }
|
|
143
|
+
/** Grant applies system-wide, bypassing membership — super-admin only. */
|
|
144
|
+
static { this.SYSTEM_WIDE = 'SYSTEM_WIDE'; }
|
|
145
|
+
static { this.SCHEME_SET = new Set([this.ANY_MEMBER, this.SYSTEM_WIDE]); }
|
|
146
|
+
static isValid(input) {
|
|
147
|
+
return this.SCHEME_SET.has(input);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
exports.AuthorizationDomainScopes = AuthorizationDomainScopes;
|
|
151
|
+
/**
|
|
152
|
+
* Engine-level vocabulary: the relation prefixes the Casbin MODEL declares — `p` for permission
|
|
153
|
+
* policies and `g`/`g2`…`g5` for grouping relations. This is the low-level building block that
|
|
154
|
+
* {@link AuthorizationPolicyVariants} maps onto (many app edge-types → one rule, e.g. both
|
|
155
|
+
* `assign_role` and `role_inherits` use `g`). Keep these in sync with the model's `[role_definition]`.
|
|
156
|
+
*/
|
|
157
|
+
class CasbinRuleVariants {
|
|
158
|
+
/** Permission policy line. */
|
|
159
|
+
static { this.P = 'p'; }
|
|
160
|
+
/**
|
|
161
|
+
* Numbered in request-tuple order (`sub → dom → obj → act`) so the matcher reads left-to-right:
|
|
162
|
+
* g (sub), g2/g3 (dom), g4 (obj), g5 (act).
|
|
163
|
+
*/
|
|
164
|
+
/** Grouping #1 — role membership + role inheritance (user→role, role→role). The `sub` axis. */
|
|
165
|
+
static { this.G = 'g'; }
|
|
166
|
+
/** Grouping #2 — user→domain membership (join_domain). The `dom` axis (membership). */
|
|
167
|
+
static { this.G2 = 'g2'; }
|
|
168
|
+
/** Grouping #3 — domain hierarchy. The `dom` axis (nesting). */
|
|
169
|
+
static { this.G3 = 'g3'; }
|
|
170
|
+
/** Grouping #4 — resource hierarchy. The `obj` axis. */
|
|
171
|
+
static { this.G4 = 'g4'; }
|
|
172
|
+
/** Grouping #5 — action hierarchy. The `act` axis. */
|
|
173
|
+
static { this.G5 = 'g5'; }
|
|
174
|
+
}
|
|
175
|
+
exports.CasbinRuleVariants = CasbinRuleVariants;
|
|
176
|
+
/**
|
|
177
|
+
* The kinds of "edge" stored in the single `PolicyDefinition` table. Every row links a `subject`
|
|
178
|
+
* (type + id) to a `target` (type + id); the `variant` column says WHAT kind of link it is.
|
|
179
|
+
*
|
|
180
|
+
* Picture the whole RBAC state as a graph — nodes are User / Role / Permission / Domain, and each
|
|
181
|
+
* PolicyDefinition row is one edge. `ScopedCasbinAdapter` reads these rows and emits one casbin line
|
|
182
|
+
* per edge. Each entry below carries:
|
|
183
|
+
* - `action` — the value stored in the DB `variant` column (what the adapter filters on).
|
|
184
|
+
* - `rule` — the casbin grouping/policy prefix the adapter emits for that edge (`p`, `g`, `g2`…).
|
|
185
|
+
*
|
|
186
|
+
* Per-USER edges (differ per user): GRANT, ASSIGN_ROLE, JOIN_DOMAIN.
|
|
187
|
+
* Shared HIERARCHY edges (same for everyone — describe the org structure, not a user):
|
|
188
|
+
* ROLE_INHERITS, RESOURCE_INHERITS, ACTION_INHERITS, DOMAIN_INHERITS.
|
|
189
|
+
*/
|
|
190
|
+
class AuthorizationPolicyVariants {
|
|
191
|
+
/**
|
|
192
|
+
* Give a Permission to a User or Role (the grant row also carries action / effect / domain).
|
|
193
|
+
* casbin `p`: `p, <Role|User>_<id>, <domain>, <permissionCode>, <action>, <allow|deny>`
|
|
194
|
+
* e.g. `p, Role_5, ANY_MEMBER, Order, read, allow` — "Role 5 may read Order in any joined domain".
|
|
195
|
+
*/
|
|
196
|
+
static { this.GRANT = { action: 'grant', rule: CasbinRuleVariants.P }; }
|
|
197
|
+
/**
|
|
198
|
+
* Give a User a Role (optionally scoped to a domain; no domain → `*` = every domain).
|
|
199
|
+
* casbin `g`: `g, User_<id>, Role_<id>, <domain|*>`
|
|
200
|
+
* e.g. `g, User_42, Role_5, *` — "User 42 holds Role 5 everywhere".
|
|
201
|
+
*/
|
|
202
|
+
static { this.ASSIGN_ROLE = { action: 'assign_role', rule: CasbinRuleVariants.G }; }
|
|
203
|
+
/**
|
|
204
|
+
* A Role inherits another Role (DAG). Shares the `g` relation with ASSIGN_ROLE so a
|
|
205
|
+
* user → role → parent-role chain resolves in one lookup. Emitted with domain `*`.
|
|
206
|
+
* casbin `g`: `g, Role_<child>, Role_<parent>, *`
|
|
207
|
+
* e.g. `g, Role_5, Role_9, *` — "Role 5 inherits everything Role 9 has".
|
|
208
|
+
*/
|
|
209
|
+
static { this.ROLE_INHERITS = { action: 'role_inherits', rule: CasbinRuleVariants.G }; }
|
|
210
|
+
/**
|
|
211
|
+
* A User is a member of a Domain. Powers the `ANY_MEMBER` grant scope — a grant with domain
|
|
212
|
+
* `ANY_MEMBER` applies in every domain the user joined. Matcher uses `g2(r.sub, r.dom)`.
|
|
213
|
+
* casbin `g2`: `g2, User_<id>, <Type>_<domainId>`
|
|
214
|
+
* e.g. `g2, User_42, Merchant_7` — "User 42 is a member of Merchant 7".
|
|
215
|
+
*/
|
|
216
|
+
static { this.JOIN_DOMAIN = { action: 'join_domain', rule: CasbinRuleVariants.G2 }; }
|
|
217
|
+
/**
|
|
218
|
+
* DOMAIN axis (the `dom` of a request). One domain is nested under a parent domain.
|
|
219
|
+
* Matcher: `g3(r.dom, p.dom)` (+ self-link, so an exact domain always matches itself).
|
|
220
|
+
* casbin `g3`: `g3, <Type>_<childId>, <Type>_<parentId>`
|
|
221
|
+
* e.g. `g3, Branch_1, Company_9` — "a grant scoped to Company 9 also applies in Branch 1".
|
|
222
|
+
*/
|
|
223
|
+
static { this.DOMAIN_INHERITS = {
|
|
224
|
+
action: 'domain_inherits',
|
|
225
|
+
rule: CasbinRuleVariants.G3,
|
|
226
|
+
}; }
|
|
227
|
+
/**
|
|
228
|
+
* RESOURCE axis (the `obj` of a request). One resource is nested under a broader one — for
|
|
229
|
+
* NON-standard nesting only; dotted nesting (`Order.findById ⊂ Order`) is handled by `objectMatch`
|
|
230
|
+
* WITHOUT an edge. Matcher: `objectMatch(r.obj, p.obj) || g4(r.obj, p.obj)`.
|
|
231
|
+
* casbin `g4`: `g4, <childCode>, <parentCode>`
|
|
232
|
+
* e.g. `g4, OrderItem, Order` — "a grant on Order also covers OrderItem".
|
|
233
|
+
*/
|
|
234
|
+
static { this.RESOURCE_INHERITS = {
|
|
235
|
+
action: 'resource_inherits',
|
|
236
|
+
rule: CasbinRuleVariants.G4,
|
|
237
|
+
}; }
|
|
238
|
+
/**
|
|
239
|
+
* ACTION axis (the `act` of a request) — SAME shape as RESOURCE_INHERITS but a DIFFERENT axis: a
|
|
240
|
+
* narrow action is covered by a broader one. No dotted shortcut — needs an explicit edge.
|
|
241
|
+
* Matcher: `g5(r.act, p.act)`.
|
|
242
|
+
* casbin `g5`: `g5, <childAction>, <parentAction>`
|
|
243
|
+
* e.g. `g5, read, manage` — "a grant of manage also allows read".
|
|
244
|
+
* (g4 + g5 combine multiplicatively: a `manage Order` grant covers a `read OrderItem` request.)
|
|
245
|
+
*/
|
|
246
|
+
static { this.ACTION_INHERITS = {
|
|
247
|
+
action: 'action_inherits',
|
|
248
|
+
rule: CasbinRuleVariants.G5,
|
|
249
|
+
}; }
|
|
250
|
+
static { this.ACTION_SCHEME_SET = new Set([
|
|
251
|
+
this.GRANT.action.toString(),
|
|
252
|
+
this.ASSIGN_ROLE.action.toString(),
|
|
253
|
+
this.ROLE_INHERITS.action.toString(),
|
|
254
|
+
this.JOIN_DOMAIN.action.toString(),
|
|
255
|
+
this.DOMAIN_INHERITS.action.toString(),
|
|
256
|
+
this.RESOURCE_INHERITS.action.toString(),
|
|
257
|
+
this.ACTION_INHERITS.action.toString(),
|
|
258
|
+
]); }
|
|
259
|
+
static { this.RULE_SCHEME_SET = new Set([
|
|
260
|
+
this.GRANT.rule.toString(),
|
|
261
|
+
this.ASSIGN_ROLE.rule.toString(),
|
|
262
|
+
this.ROLE_INHERITS.rule.toString(),
|
|
263
|
+
this.JOIN_DOMAIN.rule.toString(),
|
|
264
|
+
this.DOMAIN_INHERITS.rule.toString(),
|
|
265
|
+
this.RESOURCE_INHERITS.rule.toString(),
|
|
266
|
+
this.ACTION_INHERITS.rule.toString(),
|
|
267
|
+
]); }
|
|
268
|
+
static isValidAction(input) {
|
|
269
|
+
return this.ACTION_SCHEME_SET.has(input);
|
|
270
|
+
}
|
|
271
|
+
static isValidRule(input) {
|
|
272
|
+
return this.RULE_SCHEME_SET.has(input);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
exports.AuthorizationPolicyVariants = AuthorizationPolicyVariants;
|
|
153
276
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/components/auth/authorize/common/constants.ts"],"names":[],"mappings":";;;AACA,iFAAuE;AAEvE,MAAa,aAAa;aACR,UAAK,GAAG,qBAAqB,CAAC;aAC9B,uBAAkB,GAAG,oBAAoB,CAAC;aAC1C,aAAQ,GAAG,wBAAwB,CAAC;;
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/components/auth/authorize/common/constants.ts"],"names":[],"mappings":";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,EAAE;QAChC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,EAAE;QAClC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,EAAE;QAChC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,EAAE;QACpC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,QAAQ,EAAE;QACtC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,EAAE;KACrC,CAAC,CAAC;IAEH,MAAM,CAAC,aAAa,CAAC,KAAa;QAChC,OAAO,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC;IAED,MAAM,CAAC,WAAW,CAAC,KAAa;QAC9B,OAAO,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC;;AA7FH,kEA8FC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/auth/authorize/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/auth/authorize/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,0BAA0B,CAAC;AACzC,cAAc,SAAS,CAAC"}
|
|
@@ -16,5 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./constants"), exports);
|
|
18
18
|
__exportStar(require("./keys"), exports);
|
|
19
|
+
__exportStar(require("./object-match"), exports);
|
|
20
|
+
__exportStar(require("./resolve-request-domain"), exports);
|
|
19
21
|
__exportStar(require("./types"), exports);
|
|
20
22
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/components/auth/authorize/common/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,yCAAuB;AACvB,0CAAwB"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/components/auth/authorize/common/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,yCAAuB;AACvB,iDAA+B;AAC/B,2DAAyC;AACzC,0CAAwB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resource-hierarchy matcher for casbin `g4`. Decides whether a requested resource node
|
|
3
|
+
* falls under a granted resource node WITHOUT storing the "standard" edges
|
|
4
|
+
* (endpoint ⊂ subject ⊂ *), which are derivable from the dotted `code`.
|
|
5
|
+
*
|
|
6
|
+
* Non-standard edges (e.g. `OrderItem ⊂ Order`) are NOT covered here — those are stored as
|
|
7
|
+
* explicit `resource_inherits` (g4) links and resolved by casbin's role manager.
|
|
8
|
+
*
|
|
9
|
+
* Registered in TWO ways by the enforcer (both required):
|
|
10
|
+
* 1. `enforcer.addFunction('objectMatch', objectMatch)` — lets the matcher call
|
|
11
|
+
* `objectMatch(r.obj, p.obj)` directly for "graph-free" prefix/wildcard matching. casbin's
|
|
12
|
+
* role-manager `hasLink` only traverses stored nodes, so a `g4(...)`-only call can't match
|
|
13
|
+
* `p.obj = '*'` or a subject that isn't a stored g4 vertex — the direct call covers those.
|
|
14
|
+
* 2. `enforcer.addNamedMatchingFunc('g4', objectMatch)` — applies the same semantics when
|
|
15
|
+
* traversing explicit stored `resource_inherits` (g4) edges.
|
|
16
|
+
*
|
|
17
|
+
* @param requested the resource on the request (r.obj), e.g. `Activation.findById`
|
|
18
|
+
* @param granted the resource on the policy (p.obj), e.g. `Activation` or `*`
|
|
19
|
+
*/
|
|
20
|
+
export declare const objectMatch: (requested: string, granted: string) => boolean;
|
|
21
|
+
//# sourceMappingURL=object-match.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object-match.d.ts","sourceRoot":"","sources":["../../../../../src/components/auth/authorize/common/object-match.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,WAAW,GAAI,WAAW,MAAM,EAAE,SAAS,MAAM,KAAG,OAUhE,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.objectMatch = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Resource-hierarchy matcher for casbin `g4`. Decides whether a requested resource node
|
|
6
|
+
* falls under a granted resource node WITHOUT storing the "standard" edges
|
|
7
|
+
* (endpoint ⊂ subject ⊂ *), which are derivable from the dotted `code`.
|
|
8
|
+
*
|
|
9
|
+
* Non-standard edges (e.g. `OrderItem ⊂ Order`) are NOT covered here — those are stored as
|
|
10
|
+
* explicit `resource_inherits` (g4) links and resolved by casbin's role manager.
|
|
11
|
+
*
|
|
12
|
+
* Registered in TWO ways by the enforcer (both required):
|
|
13
|
+
* 1. `enforcer.addFunction('objectMatch', objectMatch)` — lets the matcher call
|
|
14
|
+
* `objectMatch(r.obj, p.obj)` directly for "graph-free" prefix/wildcard matching. casbin's
|
|
15
|
+
* role-manager `hasLink` only traverses stored nodes, so a `g4(...)`-only call can't match
|
|
16
|
+
* `p.obj = '*'` or a subject that isn't a stored g4 vertex — the direct call covers those.
|
|
17
|
+
* 2. `enforcer.addNamedMatchingFunc('g4', objectMatch)` — applies the same semantics when
|
|
18
|
+
* traversing explicit stored `resource_inherits` (g4) edges.
|
|
19
|
+
*
|
|
20
|
+
* @param requested the resource on the request (r.obj), e.g. `Activation.findById`
|
|
21
|
+
* @param granted the resource on the policy (p.obj), e.g. `Activation` or `*`
|
|
22
|
+
*/
|
|
23
|
+
const objectMatch = (requested, granted) => {
|
|
24
|
+
if (granted === '*') {
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
if (requested === granted) {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
return requested.startsWith(`${granted}.`);
|
|
31
|
+
};
|
|
32
|
+
exports.objectMatch = objectMatch;
|
|
33
|
+
//# sourceMappingURL=object-match.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object-match.js","sourceRoot":"","sources":["../../../../../src/components/auth/authorize/common/object-match.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACI,MAAM,WAAW,GAAG,CAAC,SAAiB,EAAE,OAAe,EAAW,EAAE;IACzE,IAAI,OAAO,KAAK,GAAG,EAAE,CAAC;QACpB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,SAAS,KAAK,OAAO,EAAE,CAAC;QAC1B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,SAAS,CAAC,UAAU,CAAC,GAAG,OAAO,GAAG,CAAC,CAAC;AAC7C,CAAC,CAAC;AAVW,QAAA,WAAW,eAUtB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { TContext } from '../../../../base/controllers/common/types';
|
|
2
|
+
import { TNullable } from '@venizia/ignis-helpers';
|
|
3
|
+
import { Env } from 'hono';
|
|
4
|
+
import { IAuthorizationDomainSource, IAuthorizationSpec, IAuthorizeOptions } from './types';
|
|
5
|
+
/** Read a domain value from a declarative source on the Hono context. */
|
|
6
|
+
export declare const readDeclarative: (opts: {
|
|
7
|
+
source: IAuthorizationDomainSource;
|
|
8
|
+
context: TContext<Env, string>;
|
|
9
|
+
}) => TNullable<string>;
|
|
10
|
+
/**
|
|
11
|
+
* Resolve the request domain scope with precedence:
|
|
12
|
+
* spec.domain (method | declarative) → options.domainResolver → SYSTEM_WIDE.
|
|
13
|
+
* Returns a casbin domain string ("<type>_<id>") or the SYSTEM_WIDE sentinel.
|
|
14
|
+
*/
|
|
15
|
+
export declare const resolveRequestDomain: (opts: {
|
|
16
|
+
spec: IAuthorizationSpec;
|
|
17
|
+
context: TContext<Env, string>;
|
|
18
|
+
options: TNullable<IAuthorizeOptions>;
|
|
19
|
+
}) => Promise<string>;
|
|
20
|
+
//# sourceMappingURL=resolve-request-domain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-request-domain.d.ts","sourceRoot":"","sources":["../../../../../src/components/auth/authorize/common/resolve-request-domain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAE3B,OAAO,EAAE,0BAA0B,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5F,yEAAyE;AACzE,eAAO,MAAM,eAAe,GAAI,MAAM;IACpC,MAAM,EAAE,0BAA0B,CAAC;IACnC,OAAO,EAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;CAChC,KAAG,SAAS,CAAC,MAAM,CAoBnB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAAU,MAAM;IAC/C,IAAI,EAAE,kBAAkB,CAAC;IACzB,OAAO,EAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAC/B,OAAO,EAAE,SAAS,CAAC,iBAAiB,CAAC,CAAC;CACvC,KAAG,OAAO,CAAC,MAAM,CA4BjB,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveRequestDomain = exports.readDeclarative = void 0;
|
|
4
|
+
const constants_1 = require("./constants");
|
|
5
|
+
/** Read a domain value from a declarative source on the Hono context. */
|
|
6
|
+
const readDeclarative = (opts) => {
|
|
7
|
+
const { source, context } = opts;
|
|
8
|
+
switch (source.from) {
|
|
9
|
+
case 'param': {
|
|
10
|
+
return context.req.param(source.key) ?? null;
|
|
11
|
+
}
|
|
12
|
+
case 'header': {
|
|
13
|
+
return context.req.header(source.key) ?? null;
|
|
14
|
+
}
|
|
15
|
+
case 'query': {
|
|
16
|
+
return context.req.query(source.key) ?? null;
|
|
17
|
+
}
|
|
18
|
+
case 'context': {
|
|
19
|
+
const value = context.get(source.key);
|
|
20
|
+
return value == null ? null : String(value);
|
|
21
|
+
}
|
|
22
|
+
default: {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
exports.readDeclarative = readDeclarative;
|
|
28
|
+
/**
|
|
29
|
+
* Resolve the request domain scope with precedence:
|
|
30
|
+
* spec.domain (method | declarative) → options.domainResolver → SYSTEM_WIDE.
|
|
31
|
+
* Returns a casbin domain string ("<type>_<id>") or the SYSTEM_WIDE sentinel.
|
|
32
|
+
*/
|
|
33
|
+
const resolveRequestDomain = async (opts) => {
|
|
34
|
+
const { spec, context, options } = opts;
|
|
35
|
+
// (1) spec.domain as a method
|
|
36
|
+
if (typeof spec.domain === 'function') {
|
|
37
|
+
const resolved = await spec.domain({ context });
|
|
38
|
+
return resolved
|
|
39
|
+
? [resolved.type, resolved.id].join('_')
|
|
40
|
+
: constants_1.AuthorizationDomainScopes.SYSTEM_WIDE;
|
|
41
|
+
}
|
|
42
|
+
// (2) spec.domain as declarative
|
|
43
|
+
if (spec.domain) {
|
|
44
|
+
const id = (0, exports.readDeclarative)({ source: spec.domain, context });
|
|
45
|
+
return id ? [spec.domain.type, id].join('_') : constants_1.AuthorizationDomainScopes.SYSTEM_WIDE;
|
|
46
|
+
}
|
|
47
|
+
// (3) global resolver
|
|
48
|
+
const globalResolver = options?.domainResolver ?? null;
|
|
49
|
+
if (globalResolver) {
|
|
50
|
+
const resolved = await globalResolver({ context });
|
|
51
|
+
return resolved
|
|
52
|
+
? [resolved.type, resolved.id].join('_')
|
|
53
|
+
: constants_1.AuthorizationDomainScopes.SYSTEM_WIDE;
|
|
54
|
+
}
|
|
55
|
+
// (4) nothing → SYSTEM_WIDE
|
|
56
|
+
return constants_1.AuthorizationDomainScopes.SYSTEM_WIDE;
|
|
57
|
+
};
|
|
58
|
+
exports.resolveRequestDomain = resolveRequestDomain;
|
|
59
|
+
//# sourceMappingURL=resolve-request-domain.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-request-domain.js","sourceRoot":"","sources":["../../../../../src/components/auth/authorize/common/resolve-request-domain.ts"],"names":[],"mappings":";;;AAGA,2CAAwD;AAGxD,yEAAyE;AAClE,MAAM,eAAe,GAAG,CAAC,IAG/B,EAAqB,EAAE;IACtB,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IACjC,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,OAAO,CAAC,CAAC,CAAC;YACb,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC;QAC/C,CAAC;QACD,KAAK,QAAQ,CAAC,CAAC,CAAC;YACd,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC;QAChD,CAAC;QACD,KAAK,OAAO,CAAC,CAAC,CAAC;YACb,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC;QAC/C,CAAC;QACD,KAAK,SAAS,CAAC,CAAC,CAAC;YACf,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAY,CAAC,CAAC;YAC/C,OAAO,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,M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AE,QAAQ,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;YACxC,CAAC,CAAC,qCAAyB,CAAC,WAAW,CAAC;IAC5C,CAAC;IAED,4BAA4B;IAC5B,OAAO,qCAAyB,CAAC,WAAW,CAAC;AAC/C,CAAC,CAAC;AAhCW,QAAA,oBAAoB,wBAgC/B"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { IdType } from '../../../../base';
|
|
1
2
|
import { TContext } from '../../../../base/controllers/common/types';
|
|
2
|
-
import { type DefaultRedisHelper, type ValueOrPromise } from '@venizia/ignis-helpers';
|
|
3
|
+
import { type DefaultRedisHelper, type TNullable, type ValueOrPromise } from '@venizia/ignis-helpers';
|
|
3
4
|
import { type Adapter } from 'casbin';
|
|
4
5
|
import { Env, type MiddlewareHandler } from 'hono';
|
|
5
6
|
import { IAuthUser } from '../../authenticate';
|
|
@@ -11,24 +12,49 @@ export interface IAuthorizationRole {
|
|
|
11
12
|
}
|
|
12
13
|
/** Key-value conditions for attribute-based access control. Values compared with strict equality. */
|
|
13
14
|
export type TAuthorizationConditions<KeyType extends string | symbol = string | symbol, ValueType = string | number | boolean | null> = Record<KeyType, ValueType>;
|
|
14
|
-
export interface IAuthorizationComparable<TElement = string, TCompareResult = number> {
|
|
15
|
-
value: TElement;
|
|
16
|
-
compare(other: TElement): TCompareResult;
|
|
17
|
-
isEqual(other: TElement): boolean;
|
|
18
|
-
}
|
|
19
15
|
export interface IAuthorizationRequest<TAction = string, TResource = string> {
|
|
20
16
|
action: TAction;
|
|
21
17
|
resource: TResource;
|
|
22
18
|
conditions?: TAuthorizationConditions;
|
|
19
|
+
/**
|
|
20
|
+
* Resolved domain scope for this request, as a casbin domain string `"<DomainType>_<id>"`
|
|
21
|
+
* (e.g. `"Merchant_7"`), or the `"SYSTEM_WIDE"` sentinel to enforce across all domains.
|
|
22
|
+
*/
|
|
23
|
+
domain?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface IAuthorizationUser extends IAuthUser {
|
|
26
|
+
principalType: string;
|
|
27
|
+
}
|
|
28
|
+
/** What CasbinAuthorizationEnforcer.buildRules returns and evaluate consumes. */
|
|
29
|
+
export interface ICasbinRules {
|
|
30
|
+
user: IAuthorizationUser;
|
|
31
|
+
lines: string[];
|
|
23
32
|
}
|
|
24
|
-
/**
|
|
33
|
+
/** Declarative description of where to read the request domain from. */
|
|
34
|
+
export interface IAuthorizationDomainSource {
|
|
35
|
+
from: 'param' | 'header' | 'query' | 'context';
|
|
36
|
+
key: string;
|
|
37
|
+
type: string;
|
|
38
|
+
}
|
|
39
|
+
/** Returns the current request domain; null = no domain (→ SYSTEM_WIDE). */
|
|
40
|
+
export type TAuthorizationDomainResolver<E extends Env = Env> = (opts: {
|
|
41
|
+
context: TContext<E, string>;
|
|
42
|
+
}) => ValueOrPromise<TNullable<{
|
|
43
|
+
type: string;
|
|
44
|
+
id: IdType;
|
|
45
|
+
}>>;
|
|
46
|
+
/**
|
|
47
|
+
* Authorization enforcer: builds rules and evaluates requests.
|
|
48
|
+
*
|
|
49
|
+
* Cache management (`invalidateUserCache`/`rebuildUserCache`) is OPTIONAL — present only on enforcers
|
|
50
|
+
* that cache per-user policies (e.g. the Casbin enforcer with the Redis driver). The registry
|
|
51
|
+
* feature-detects them at runtime before invoking.
|
|
52
|
+
*/
|
|
25
53
|
export interface IAuthorizationEnforcer<E extends Env = Env, TAction = string, TResource = string, TRules = unknown, TBuildRulesReturn = ValueOrPromise<TRules>, TEvaluateReturn = ValueOrPromise<TAuthorizationDecision>> {
|
|
26
54
|
name: string;
|
|
27
55
|
configure(): ValueOrPromise<void>;
|
|
28
56
|
buildRules(opts: {
|
|
29
|
-
user:
|
|
30
|
-
principalType: string;
|
|
31
|
-
} & IAuthUser;
|
|
57
|
+
user: IAuthorizationUser;
|
|
32
58
|
context: TContext<E, string>;
|
|
33
59
|
}): TBuildRulesReturn;
|
|
34
60
|
evaluate(opts: {
|
|
@@ -36,6 +62,19 @@ export interface IAuthorizationEnforcer<E extends Env = Env, TAction = string, T
|
|
|
36
62
|
request: IAuthorizationRequest<TAction, TResource>;
|
|
37
63
|
context: TContext<E, string>;
|
|
38
64
|
}): TEvaluateReturn;
|
|
65
|
+
/** Drop a user's cached policies. Implemented only by caching enforcers. */
|
|
66
|
+
invalidateUserCache?(opts: {
|
|
67
|
+
user: IAuthorizationUser;
|
|
68
|
+
}): Promise<{
|
|
69
|
+
invalidatedKeys: number;
|
|
70
|
+
}>;
|
|
71
|
+
/** Drop + rebuild a user's cached policies. Implemented only by caching enforcers. */
|
|
72
|
+
rebuildUserCache?(opts: {
|
|
73
|
+
user: IAuthorizationUser;
|
|
74
|
+
}): Promise<{
|
|
75
|
+
cacheKey: string;
|
|
76
|
+
lineCount: number;
|
|
77
|
+
}>;
|
|
39
78
|
}
|
|
40
79
|
export type TAuthorizationVoter<E extends Env = Env, TAction = string, TResource = string> = (opts: {
|
|
41
80
|
user: IAuthUser;
|
|
@@ -49,26 +88,20 @@ export interface IAuthorizationSpec<E extends Env = Env, TAction = string, TReso
|
|
|
49
88
|
conditions?: TAuthorizationConditions;
|
|
50
89
|
allowedRoles?: string[];
|
|
51
90
|
voters?: TAuthorizationVoter<E, TAction, TResource>[];
|
|
91
|
+
/** Optional per-route domain: declarative source OR a resolver method. Omitted → global resolver. */
|
|
92
|
+
domain?: IAuthorizationDomainSource | TAuthorizationDomainResolver<E>;
|
|
52
93
|
}
|
|
53
94
|
export type TAuthorizeFn<E extends Env = Env, TAction = string, TResource = string> = (opts: {
|
|
54
95
|
spec: IAuthorizationSpec<E, TAction, TResource>;
|
|
55
96
|
enforcerName?: string;
|
|
56
97
|
}) => MiddlewareHandler;
|
|
57
|
-
export interface ICasbinEnforcerCachedMemory {
|
|
58
|
-
driver: typeof CasbinEnforcerCachedDrivers.IN_MEMORY;
|
|
59
|
-
options: {
|
|
60
|
-
expiresIn: number;
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
98
|
export interface ICasbinEnforcerCachedRedis {
|
|
64
99
|
driver: typeof CasbinEnforcerCachedDrivers.REDIS;
|
|
65
100
|
options: {
|
|
66
101
|
connection: DefaultRedisHelper;
|
|
67
102
|
expiresIn: number;
|
|
68
103
|
keyFn: (opts: {
|
|
69
|
-
user:
|
|
70
|
-
principalType: string;
|
|
71
|
-
} & IAuthUser;
|
|
104
|
+
user: IAuthorizationUser;
|
|
72
105
|
}) => ValueOrPromise<string>;
|
|
73
106
|
};
|
|
74
107
|
}
|
|
@@ -82,9 +115,7 @@ export interface ICasbinEnforcerOptions<E extends Env = Env, TAction = string, T
|
|
|
82
115
|
};
|
|
83
116
|
cached: {
|
|
84
117
|
use: false;
|
|
85
|
-
} | (
|
|
86
|
-
use: true;
|
|
87
|
-
}) | (ICasbinEnforcerCachedRedis & {
|
|
118
|
+
} | (ICasbinEnforcerCachedRedis & {
|
|
88
119
|
use: true;
|
|
89
120
|
});
|
|
90
121
|
adapter?: TAdapter;
|
|
@@ -103,9 +134,21 @@ export interface ICasbinEnforcerOptions<E extends Env = Env, TAction = string, T
|
|
|
103
134
|
action: string;
|
|
104
135
|
domain?: string;
|
|
105
136
|
};
|
|
137
|
+
/**
|
|
138
|
+
* Turn on the domain-scoped RBAC model. Requests become 4-token `(subject, domain, object, action)`
|
|
139
|
+
* instead of 3-token, and the enforcer registers the domain matcher (`keyMatch` on `g`) and the
|
|
140
|
+
* resource matcher (`objectMatch`) needed by that model.
|
|
141
|
+
*/
|
|
142
|
+
isScoped?: boolean;
|
|
143
|
+
/** Number of pooled enforcers (each request enforces on its own). Default 16. */
|
|
144
|
+
poolSize?: number;
|
|
145
|
+
/** Max ms to wait for a free pooled enforcer before failing closed. Default 5000. */
|
|
146
|
+
poolAcquireTimeoutMs?: number;
|
|
106
147
|
}
|
|
107
148
|
export interface IAuthorizeOptions {
|
|
108
149
|
defaultDecision: TAuthorizationDecision;
|
|
109
150
|
alwaysAllowRoles?: string[];
|
|
151
|
+
/** Fallback domain resolver used when a route's spec has no `domain`. */
|
|
152
|
+
domainResolver?: TAuthorizationDomainResolver;
|
|
110
153
|
}
|
|
111
154
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/components/auth/authorize/common/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/components/auth/authorize/common/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,SAAS,EACd,KAAK,cAAc,EACpB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,GAAG,EAAE,KAAK,iBAAiB,EAAE,MAAM,MAAM,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EACL,2BAA2B,EAC3B,0BAA0B,EAC1B,sBAAsB,EACtB,6BAA6B,EAC9B,MAAM,aAAa,CAAC;AACrB,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,qGAAqG;AACrG,MAAM,MAAM,wBAAwB,CAClC,OAAO,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,EACjD,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,IAC1C,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;AAE/B,MAAM,WAAW,qBAAqB,CAAC,OAAO,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