@authyon/server 0.2.0-beta.24 → 0.2.0-beta.26
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/README.md +10 -0
- package/dist/{authorization-B-kQhcBm.d.cts → authorization-BBwAqaR4.d.ts} +4 -2
- package/dist/{authorization-CxBweecR.d.ts → authorization-CDHWMYT7.d.cts} +4 -2
- package/dist/{authyonServerClient-zNSLRCwj.d.cts → authyonServerClient-6ezHxvwa.d.cts} +33 -0
- package/dist/{authyonServerClient-zNSLRCwj.d.ts → authyonServerClient-6ezHxvwa.d.ts} +33 -0
- package/dist/bff.d.cts +1 -1
- package/dist/bff.d.ts +1 -1
- package/dist/{chunk-WF26WYSX.js → chunk-V6JQIOSP.js} +19 -0
- package/dist/index.cjs +52 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +34 -2
- package/dist/next.d.cts +2 -2
- package/dist/next.d.ts +2 -2
- package/dist/next.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -294,6 +294,10 @@ const page = await authyon.environment.tenants.credentials.listPage(tenantId, {
|
|
|
294
294
|
skip: 0,
|
|
295
295
|
take: 25,
|
|
296
296
|
});
|
|
297
|
+
// Só as credenciais que concedem TODAS estas permissões (curingas contam).
|
|
298
|
+
const readers = await authyon.environment.tenants.credentials.listPage(tenantId, {
|
|
299
|
+
permissions: ["authyon:users:read", "authyon:tenants:read"],
|
|
300
|
+
});
|
|
297
301
|
const detail = await authyon.environment.tenants.credentials.get(tenantId, credentialId);
|
|
298
302
|
```
|
|
299
303
|
|
|
@@ -303,6 +307,12 @@ limite por página), `total`, `pages`, `hasNext` e `hasPrev`. Até a API de
|
|
|
303
307
|
(limite), nessa ordem trocada. `take` aceita 1–100 (padrão da API: 25),
|
|
304
308
|
`skip` é um deslocamento a partir de zero e `search` aceita até 200 caracteres.
|
|
305
309
|
A API pesquisa clientId, descrição e permissões antes de paginar.
|
|
310
|
+
`permissions` é outro filtro: em vez de procurar texto, mantém só as credenciais
|
|
311
|
+
que **concedem** todas as permissões da lista, respeitando curingas — uma
|
|
312
|
+
credencial com `authyon:*:*` passa em qualquer filtro. Aceita até 20 entradas
|
|
313
|
+
no formato `namespace:resource:action` (até 5 segmentos), normalizadas e sem
|
|
314
|
+
repetição; combina com `search`. Exige uma API de 2026-11-08 ou mais nova; uma
|
|
315
|
+
anterior ignora o filtro.
|
|
306
316
|
|
|
307
317
|
O método existente `credentials.list(tenantId)` continua retornando um array:
|
|
308
318
|
aceita a resposta antiga e percorre todas as páginas da API atual. Prefira
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { J as JwksTokenVerifier, A as AuthyonServerClient } from './authyonServerClient-
|
|
1
|
+
import { J as JwksTokenVerifier, A as AuthyonServerClient } from './authyonServerClient-6ezHxvwa.js';
|
|
2
2
|
|
|
3
3
|
type AbilitySubject = string | Record<string, unknown>;
|
|
4
4
|
type AbilityConditions = Record<string, unknown>;
|
|
@@ -58,7 +58,9 @@ declare function createAuthyonAbility(source?: AuthyonPermissionSource, options?
|
|
|
58
58
|
* Whether a source holds an Authyon permission, by Authyon's own rules: the
|
|
59
59
|
* values are compared segment by segment, `*` stands for any one segment, and
|
|
60
60
|
* two values of different lengths never match — except an all-wildcard grant,
|
|
61
|
-
* which is everything
|
|
61
|
+
* which is everything, and a grant ending in `**`, which stands for one or
|
|
62
|
+
* more segments (`manager:**` covers `manager:account:read` and
|
|
63
|
+
* `manager:account:credentials:write`). OAuth scopes count as permissions.
|
|
62
64
|
*
|
|
63
65
|
* Not the same question as {@link AuthyonAbility.can}. An ability is CASL, so
|
|
64
66
|
* the action `manage` there means "every action on this subject", which is a
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { J as JwksTokenVerifier, A as AuthyonServerClient } from './authyonServerClient-
|
|
1
|
+
import { J as JwksTokenVerifier, A as AuthyonServerClient } from './authyonServerClient-6ezHxvwa.cjs';
|
|
2
2
|
|
|
3
3
|
type AbilitySubject = string | Record<string, unknown>;
|
|
4
4
|
type AbilityConditions = Record<string, unknown>;
|
|
@@ -58,7 +58,9 @@ declare function createAuthyonAbility(source?: AuthyonPermissionSource, options?
|
|
|
58
58
|
* Whether a source holds an Authyon permission, by Authyon's own rules: the
|
|
59
59
|
* values are compared segment by segment, `*` stands for any one segment, and
|
|
60
60
|
* two values of different lengths never match — except an all-wildcard grant,
|
|
61
|
-
* which is everything
|
|
61
|
+
* which is everything, and a grant ending in `**`, which stands for one or
|
|
62
|
+
* more segments (`manager:**` covers `manager:account:read` and
|
|
63
|
+
* `manager:account:credentials:write`). OAuth scopes count as permissions.
|
|
62
64
|
*
|
|
63
65
|
* Not the same question as {@link AuthyonAbility.can}. An ability is CASL, so
|
|
64
66
|
* the action `manage` there means "every action on this subject", which is a
|
|
@@ -277,6 +277,20 @@ interface TenantListOptions extends PaginationOptions {
|
|
|
277
277
|
* on describing what you asked for.
|
|
278
278
|
*/
|
|
279
279
|
parentId?: string | null;
|
|
280
|
+
/**
|
|
281
|
+
* Inclusive floor on how deep a tenant sits, roots being 0. `1` is every
|
|
282
|
+
* sub-tenant in the environment, at any depth and under any parent — which
|
|
283
|
+
* `parentId` cannot ask for, since it names one parent. `subTenants()` is
|
|
284
|
+
* this option set for you. Capped at 4, the API's hard ceiling.
|
|
285
|
+
*/
|
|
286
|
+
minDepth?: number;
|
|
287
|
+
/**
|
|
288
|
+
* Inclusive ceiling. Equal bounds pin one generation (`minDepth: 1,
|
|
289
|
+
* maxDepth: 1` is the first generation across the whole environment). A
|
|
290
|
+
* floor deeper than the ceiling, or a bound outside 0..4, is a 400 rather
|
|
291
|
+
* than an empty page.
|
|
292
|
+
*/
|
|
293
|
+
maxDepth?: number;
|
|
280
294
|
/** Keeps one side of the status. Omitted lists both. */
|
|
281
295
|
status?: "active" | "disabled";
|
|
282
296
|
/**
|
|
@@ -616,6 +630,13 @@ interface AuthyonServerClientOptions {
|
|
|
616
630
|
type AccessTokenSource = string | (() => string | Promise<string>);
|
|
617
631
|
interface CredentialListOptions extends PaginationOptions {
|
|
618
632
|
search?: string;
|
|
633
|
+
/**
|
|
634
|
+
* Keep only credentials that grant EVERY one of these permissions. Matching is
|
|
635
|
+
* wildcard-aware on the server: a credential holding `authyon:*:*` passes any
|
|
636
|
+
* filter. Up to 20 entries; requires an API of 2026-11-08 or newer, and an
|
|
637
|
+
* older one ignores it.
|
|
638
|
+
*/
|
|
639
|
+
permissions?: readonly string[];
|
|
619
640
|
}
|
|
620
641
|
/** scopes is an alias for permissions. Always supply an explicit, nonempty set. */
|
|
621
642
|
type CredentialPermissionsInput = {
|
|
@@ -1205,6 +1226,18 @@ declare class AuthyonServerClient {
|
|
|
1205
1226
|
* start from.
|
|
1206
1227
|
*/
|
|
1207
1228
|
roots: (params?: Omit<TenantListOptions, "parentId">) => Promise<Paged<Organization>>;
|
|
1229
|
+
/**
|
|
1230
|
+
* Every sub-tenant in the environment, at any depth and under any
|
|
1231
|
+
* parent — `list()` with `minDepth: 1`. This is the one page
|
|
1232
|
+
* `children()` cannot produce, since it names a single parent, and the
|
|
1233
|
+
* one a flat "all sub-companies" screen wants: the envelope describes
|
|
1234
|
+
* the sub-tenants alone, so the pager stops where they do, and nobody
|
|
1235
|
+
* has to read the whole environment and drop the roots.
|
|
1236
|
+
*
|
|
1237
|
+
* Against an Authyon API older than 2026-10-31 the floor is ignored and
|
|
1238
|
+
* the roots come back too.
|
|
1239
|
+
*/
|
|
1240
|
+
subTenants: (params?: Omit<TenantListOptions, "parentId" | "minDepth">) => Promise<Paged<Organization>>;
|
|
1208
1241
|
/**
|
|
1209
1242
|
* POST /env/tenants — create a tenant in the environment.
|
|
1210
1243
|
*
|
|
@@ -277,6 +277,20 @@ interface TenantListOptions extends PaginationOptions {
|
|
|
277
277
|
* on describing what you asked for.
|
|
278
278
|
*/
|
|
279
279
|
parentId?: string | null;
|
|
280
|
+
/**
|
|
281
|
+
* Inclusive floor on how deep a tenant sits, roots being 0. `1` is every
|
|
282
|
+
* sub-tenant in the environment, at any depth and under any parent — which
|
|
283
|
+
* `parentId` cannot ask for, since it names one parent. `subTenants()` is
|
|
284
|
+
* this option set for you. Capped at 4, the API's hard ceiling.
|
|
285
|
+
*/
|
|
286
|
+
minDepth?: number;
|
|
287
|
+
/**
|
|
288
|
+
* Inclusive ceiling. Equal bounds pin one generation (`minDepth: 1,
|
|
289
|
+
* maxDepth: 1` is the first generation across the whole environment). A
|
|
290
|
+
* floor deeper than the ceiling, or a bound outside 0..4, is a 400 rather
|
|
291
|
+
* than an empty page.
|
|
292
|
+
*/
|
|
293
|
+
maxDepth?: number;
|
|
280
294
|
/** Keeps one side of the status. Omitted lists both. */
|
|
281
295
|
status?: "active" | "disabled";
|
|
282
296
|
/**
|
|
@@ -616,6 +630,13 @@ interface AuthyonServerClientOptions {
|
|
|
616
630
|
type AccessTokenSource = string | (() => string | Promise<string>);
|
|
617
631
|
interface CredentialListOptions extends PaginationOptions {
|
|
618
632
|
search?: string;
|
|
633
|
+
/**
|
|
634
|
+
* Keep only credentials that grant EVERY one of these permissions. Matching is
|
|
635
|
+
* wildcard-aware on the server: a credential holding `authyon:*:*` passes any
|
|
636
|
+
* filter. Up to 20 entries; requires an API of 2026-11-08 or newer, and an
|
|
637
|
+
* older one ignores it.
|
|
638
|
+
*/
|
|
639
|
+
permissions?: readonly string[];
|
|
619
640
|
}
|
|
620
641
|
/** scopes is an alias for permissions. Always supply an explicit, nonempty set. */
|
|
621
642
|
type CredentialPermissionsInput = {
|
|
@@ -1205,6 +1226,18 @@ declare class AuthyonServerClient {
|
|
|
1205
1226
|
* start from.
|
|
1206
1227
|
*/
|
|
1207
1228
|
roots: (params?: Omit<TenantListOptions, "parentId">) => Promise<Paged<Organization>>;
|
|
1229
|
+
/**
|
|
1230
|
+
* Every sub-tenant in the environment, at any depth and under any
|
|
1231
|
+
* parent — `list()` with `minDepth: 1`. This is the one page
|
|
1232
|
+
* `children()` cannot produce, since it names a single parent, and the
|
|
1233
|
+
* one a flat "all sub-companies" screen wants: the envelope describes
|
|
1234
|
+
* the sub-tenants alone, so the pager stops where they do, and nobody
|
|
1235
|
+
* has to read the whole environment and drop the roots.
|
|
1236
|
+
*
|
|
1237
|
+
* Against an Authyon API older than 2026-10-31 the floor is ignored and
|
|
1238
|
+
* the roots come back too.
|
|
1239
|
+
*/
|
|
1240
|
+
subTenants: (params?: Omit<TenantListOptions, "parentId" | "minDepth">) => Promise<Paged<Organization>>;
|
|
1208
1241
|
/**
|
|
1209
1242
|
* POST /env/tenants — create a tenant in the environment.
|
|
1210
1243
|
*
|
package/dist/bff.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { H as HttpAdapter, a as HttpLoggerOptions, A as AuthyonServerClient } from './authyonServerClient-
|
|
1
|
+
import { H as HttpAdapter, a as HttpLoggerOptions, A as AuthyonServerClient } from './authyonServerClient-6ezHxvwa.cjs';
|
|
2
2
|
import 'jose';
|
|
3
3
|
|
|
4
4
|
interface BffLoginInput {
|
package/dist/bff.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { H as HttpAdapter, a as HttpLoggerOptions, A as AuthyonServerClient } from './authyonServerClient-
|
|
1
|
+
import { H as HttpAdapter, a as HttpLoggerOptions, A as AuthyonServerClient } from './authyonServerClient-6ezHxvwa.js';
|
|
2
2
|
import 'jose';
|
|
3
3
|
|
|
4
4
|
interface BffLoginInput {
|
|
@@ -238,11 +238,30 @@ function grants(granted, required) {
|
|
|
238
238
|
if (isFullWildcard(granted)) return true;
|
|
239
239
|
const grantedSegments = granted.split(":");
|
|
240
240
|
const requiredSegments = required.split(":");
|
|
241
|
+
if (isRecursive(grantedSegments) || isRecursive(requiredSegments)) {
|
|
242
|
+
return grantsRecursive(grantedSegments, requiredSegments);
|
|
243
|
+
}
|
|
241
244
|
if (grantedSegments.length !== requiredSegments.length) return false;
|
|
242
245
|
return grantedSegments.every(
|
|
243
246
|
(segment, index) => segment === "*" || segment === requiredSegments[index]
|
|
244
247
|
);
|
|
245
248
|
}
|
|
249
|
+
var RECURSIVE_WILDCARD = "**";
|
|
250
|
+
function isRecursive(segments) {
|
|
251
|
+
return segments[segments.length - 1] === RECURSIVE_WILDCARD;
|
|
252
|
+
}
|
|
253
|
+
function grantsRecursive(granted, required) {
|
|
254
|
+
if (!isRecursive(granted)) return false;
|
|
255
|
+
if (granted.slice(0, -1).includes(RECURSIVE_WILDCARD)) return false;
|
|
256
|
+
if (required.slice(0, -1).includes(RECURSIVE_WILDCARD)) return false;
|
|
257
|
+
const prefix = granted.length - 1;
|
|
258
|
+
const requiredPinned = isRecursive(required) ? required.length - 1 : required.length;
|
|
259
|
+
if (isRecursive(required) ? requiredPinned < prefix : requiredPinned <= prefix) return false;
|
|
260
|
+
for (let index = 0; index < prefix; index++) {
|
|
261
|
+
if (granted[index] !== "*" && granted[index] !== required[index]) return false;
|
|
262
|
+
}
|
|
263
|
+
return true;
|
|
264
|
+
}
|
|
246
265
|
function isWellFormedPermission(permission) {
|
|
247
266
|
if (!permission) return false;
|
|
248
267
|
const segments = permission.split(":");
|
package/dist/index.cjs
CHANGED
|
@@ -92,6 +92,25 @@ function lifetimeBody(input) {
|
|
|
92
92
|
}
|
|
93
93
|
return { lifetimeDays: input.lifetimeDays };
|
|
94
94
|
}
|
|
95
|
+
var MAX_PERMISSION_FILTERS = 20;
|
|
96
|
+
var PERMISSION_FILTER = /^(?:\*|[a-z][a-z0-9_-]*)(?::(?:\*|[a-z][a-z0-9_-]*)){2,4}$/u;
|
|
97
|
+
function permissionFilter(values) {
|
|
98
|
+
if (values === void 0) return void 0;
|
|
99
|
+
if (!Array.isArray(values)) throw new TypeError("Authyon: permissions must be an array.");
|
|
100
|
+
const normalized = values.map((value) => {
|
|
101
|
+
if (typeof value !== "string") throw new TypeError("Authyon: invalid permission.");
|
|
102
|
+
return value.trim().toLowerCase();
|
|
103
|
+
});
|
|
104
|
+
const unique = [...new Set(normalized.filter((value) => value.length > 0))];
|
|
105
|
+
if (unique.length > MAX_PERMISSION_FILTERS)
|
|
106
|
+
throw new RangeError(
|
|
107
|
+
`Authyon: at most ${MAX_PERMISSION_FILTERS} permissions can be filtered at once.`
|
|
108
|
+
);
|
|
109
|
+
for (const value of unique)
|
|
110
|
+
if (!PERMISSION_FILTER.test(value))
|
|
111
|
+
throw new TypeError("Authyon: permissions must have namespace:resource:action format.");
|
|
112
|
+
return unique.length > 0 ? unique : void 0;
|
|
113
|
+
}
|
|
95
114
|
function credentialQuery(options = {}) {
|
|
96
115
|
const { skip, take, search } = options;
|
|
97
116
|
if (skip !== void 0 && (!Number.isInteger(skip) || skip < 0 || skip > 2147483647))
|
|
@@ -100,7 +119,8 @@ function credentialQuery(options = {}) {
|
|
|
100
119
|
throw new RangeError("Authyon: take must be between 1 and 100.");
|
|
101
120
|
if (search !== void 0 && (typeof search !== "string" || search.trim().length > 200))
|
|
102
121
|
throw new RangeError("Authyon: search must contain at most 200 characters.");
|
|
103
|
-
|
|
122
|
+
const permission = permissionFilter(options.permissions);
|
|
123
|
+
return { search: search?.trim() || void 0, skip, take, permission };
|
|
104
124
|
}
|
|
105
125
|
function credentialSummary(value) {
|
|
106
126
|
return {
|
|
@@ -1088,6 +1108,18 @@ var AuthyonServerClient = class {
|
|
|
1088
1108
|
* start from.
|
|
1089
1109
|
*/
|
|
1090
1110
|
roots: (params = {}) => this.environment.tenants.list({ ...params, parentId: null }),
|
|
1111
|
+
/**
|
|
1112
|
+
* Every sub-tenant in the environment, at any depth and under any
|
|
1113
|
+
* parent — `list()` with `minDepth: 1`. This is the one page
|
|
1114
|
+
* `children()` cannot produce, since it names a single parent, and the
|
|
1115
|
+
* one a flat "all sub-companies" screen wants: the envelope describes
|
|
1116
|
+
* the sub-tenants alone, so the pager stops where they do, and nobody
|
|
1117
|
+
* has to read the whole environment and drop the roots.
|
|
1118
|
+
*
|
|
1119
|
+
* Against an Authyon API older than 2026-10-31 the floor is ignored and
|
|
1120
|
+
* the roots come back too.
|
|
1121
|
+
*/
|
|
1122
|
+
subTenants: (params = {}) => this.environment.tenants.list({ ...params, minDepth: 1 }),
|
|
1091
1123
|
/**
|
|
1092
1124
|
* POST /env/tenants — create a tenant in the environment.
|
|
1093
1125
|
*
|
|
@@ -1819,11 +1851,30 @@ function grants(granted, required) {
|
|
|
1819
1851
|
if (isFullWildcard(granted)) return true;
|
|
1820
1852
|
const grantedSegments = granted.split(":");
|
|
1821
1853
|
const requiredSegments = required.split(":");
|
|
1854
|
+
if (isRecursive(grantedSegments) || isRecursive(requiredSegments)) {
|
|
1855
|
+
return grantsRecursive(grantedSegments, requiredSegments);
|
|
1856
|
+
}
|
|
1822
1857
|
if (grantedSegments.length !== requiredSegments.length) return false;
|
|
1823
1858
|
return grantedSegments.every(
|
|
1824
1859
|
(segment2, index) => segment2 === "*" || segment2 === requiredSegments[index]
|
|
1825
1860
|
);
|
|
1826
1861
|
}
|
|
1862
|
+
var RECURSIVE_WILDCARD = "**";
|
|
1863
|
+
function isRecursive(segments) {
|
|
1864
|
+
return segments[segments.length - 1] === RECURSIVE_WILDCARD;
|
|
1865
|
+
}
|
|
1866
|
+
function grantsRecursive(granted, required) {
|
|
1867
|
+
if (!isRecursive(granted)) return false;
|
|
1868
|
+
if (granted.slice(0, -1).includes(RECURSIVE_WILDCARD)) return false;
|
|
1869
|
+
if (required.slice(0, -1).includes(RECURSIVE_WILDCARD)) return false;
|
|
1870
|
+
const prefix = granted.length - 1;
|
|
1871
|
+
const requiredPinned = isRecursive(required) ? required.length - 1 : required.length;
|
|
1872
|
+
if (isRecursive(required) ? requiredPinned < prefix : requiredPinned <= prefix) return false;
|
|
1873
|
+
for (let index = 0; index < prefix; index++) {
|
|
1874
|
+
if (granted[index] !== "*" && granted[index] !== required[index]) return false;
|
|
1875
|
+
}
|
|
1876
|
+
return true;
|
|
1877
|
+
}
|
|
1827
1878
|
function isWellFormedPermission(permission) {
|
|
1828
1879
|
if (!permission) return false;
|
|
1829
1880
|
const segments = permission.split(":");
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { H as HttpAdapter, a as HttpLoggerOptions, A as AuthyonServerClient } from './authyonServerClient-
|
|
2
|
-
export { b as AcceptTenantInviteInput, c as AccessTokenSource, d as Approval, e as ApprovalAssurance, f as ApprovalPayload, g as ApprovalStatus, h as ApprovalWebAuthnOptions, i as AuditEvent, j as AuthyonJwksDiscoveryOptions, k as AuthyonJwtClaims, l as AuthyonServerClientOptions, m as AuthyonTenantClaim, C as CLIENT_IP_HEADER, n as ClientCredentials, o as ClientRequestContext, p as ConfirmApprovalInput, q as ConsumedApproval, r as CreateApprovalInput, s as CreateCredentialInput, t as CreateOrganizationInput, u as CreatePermissionInput, v as CreateTenantCredentialInput, w as CreateUserInput, x as CredentialCreator, y as CredentialDetail, z as CredentialListOptions, B as CredentialPermissionsInput, E as EnvironmentUser, F as FetchHttpAdapter, D as HttpAdapterRequest, G as HttpLogEvent, I as HttpLogger, K as IntrospectResult, L as InviteTenantMemberInput, M as IssuePasswordResetInput, N as JsonWebKeySet, J as JwksTokenVerifier, O as JwksTokenVerifierOptions, P as LoggingHttpAdapter, Q as LoginActivity, R as OpenIdConfiguration, S as Organization, T as OtpCheckResult, U as Paged, V as PaginationOptions, W as PasswordResetCompleted, X as PasswordResetIssued, Y as PasswordResetPreview, Z as Permission, _ as PermissionsByRole, $ as ReservedPermissions, a0 as Role, a1 as RoleGrant, a2 as RoleInput, a3 as RoleList, a4 as RolePermissions, a5 as SafeJwtAlgorithm, a6 as SecurityMethods, a7 as SubjectApprovals, a8 as SubjectSecurity, a9 as TENANT_FILTER_MAX_DEPTH, aa as TENANT_FILTER_MAX_VALUES, ab as TENANT_FILTER_MAX_VALUE_LENGTH, ac as TenantAncestor, ad as TenantClientValidationResult, ae as TenantCredentialIssued, af as TenantCredentialSummary, ag as TenantFilterExpression, ah as TenantFilterValue, ai as TenantInvite, aj as TenantInviteAccepted, ak as TenantInviteInput, al as TenantInviteIssued, am as TenantInvitePreview, an as TenantInviteStatus, ao as TenantListOptions, ap as TenantMember, aq as TenantMemberPage, ar as TenantMembership, as as TenantOrderField, at as TenantScopedClient, au as TokenResult, av as TokenVerificationError, aw as TokenVerificationErrorCode, ax as UpdateOrganizationInput, ay as User, az as UserScopedClient, aA as ValidateResult, aB as VerifiedAccessToken, aC as createClient, aD as normalizeClientIp, aE as tenantFilter } from './authyonServerClient-
|
|
3
|
-
export { b as AbilityConditions, c as AbilityEvent, d as AbilityListener, e as AbilityRequirement, f as AbilityRule, A as AbilitySubject, g as AuthorizationContext, a as AuthorizationError, h as AuthorizationOptions, i as AuthyonAbility, j as AuthyonAbilityBuilder, k as AuthyonAbilityOptions, l as AuthyonPermissionSource, E as ExpressAuthorizationMiddlewareOptions, m as ExpressNext, n as ExpressRequestLike, o as ExpressResponseLike, P as PermissionGroup, R as RequestAuthorizationOptions, p as authorizeRequest, q as authorizeToken, r as createAuthorizationErrorResponse, s as createAuthyonAbility, t as createAuthyonRules, u as createExpressAuthorizationMiddleware, v as hasPermission, w as hasPermissionGroup } from './authorization-
|
|
1
|
+
import { H as HttpAdapter, a as HttpLoggerOptions, A as AuthyonServerClient } from './authyonServerClient-6ezHxvwa.cjs';
|
|
2
|
+
export { b as AcceptTenantInviteInput, c as AccessTokenSource, d as Approval, e as ApprovalAssurance, f as ApprovalPayload, g as ApprovalStatus, h as ApprovalWebAuthnOptions, i as AuditEvent, j as AuthyonJwksDiscoveryOptions, k as AuthyonJwtClaims, l as AuthyonServerClientOptions, m as AuthyonTenantClaim, C as CLIENT_IP_HEADER, n as ClientCredentials, o as ClientRequestContext, p as ConfirmApprovalInput, q as ConsumedApproval, r as CreateApprovalInput, s as CreateCredentialInput, t as CreateOrganizationInput, u as CreatePermissionInput, v as CreateTenantCredentialInput, w as CreateUserInput, x as CredentialCreator, y as CredentialDetail, z as CredentialListOptions, B as CredentialPermissionsInput, E as EnvironmentUser, F as FetchHttpAdapter, D as HttpAdapterRequest, G as HttpLogEvent, I as HttpLogger, K as IntrospectResult, L as InviteTenantMemberInput, M as IssuePasswordResetInput, N as JsonWebKeySet, J as JwksTokenVerifier, O as JwksTokenVerifierOptions, P as LoggingHttpAdapter, Q as LoginActivity, R as OpenIdConfiguration, S as Organization, T as OtpCheckResult, U as Paged, V as PaginationOptions, W as PasswordResetCompleted, X as PasswordResetIssued, Y as PasswordResetPreview, Z as Permission, _ as PermissionsByRole, $ as ReservedPermissions, a0 as Role, a1 as RoleGrant, a2 as RoleInput, a3 as RoleList, a4 as RolePermissions, a5 as SafeJwtAlgorithm, a6 as SecurityMethods, a7 as SubjectApprovals, a8 as SubjectSecurity, a9 as TENANT_FILTER_MAX_DEPTH, aa as TENANT_FILTER_MAX_VALUES, ab as TENANT_FILTER_MAX_VALUE_LENGTH, ac as TenantAncestor, ad as TenantClientValidationResult, ae as TenantCredentialIssued, af as TenantCredentialSummary, ag as TenantFilterExpression, ah as TenantFilterValue, ai as TenantInvite, aj as TenantInviteAccepted, ak as TenantInviteInput, al as TenantInviteIssued, am as TenantInvitePreview, an as TenantInviteStatus, ao as TenantListOptions, ap as TenantMember, aq as TenantMemberPage, ar as TenantMembership, as as TenantOrderField, at as TenantScopedClient, au as TokenResult, av as TokenVerificationError, aw as TokenVerificationErrorCode, ax as UpdateOrganizationInput, ay as User, az as UserScopedClient, aA as ValidateResult, aB as VerifiedAccessToken, aC as createClient, aD as normalizeClientIp, aE as tenantFilter } from './authyonServerClient-6ezHxvwa.cjs';
|
|
3
|
+
export { b as AbilityConditions, c as AbilityEvent, d as AbilityListener, e as AbilityRequirement, f as AbilityRule, A as AbilitySubject, g as AuthorizationContext, a as AuthorizationError, h as AuthorizationOptions, i as AuthyonAbility, j as AuthyonAbilityBuilder, k as AuthyonAbilityOptions, l as AuthyonPermissionSource, E as ExpressAuthorizationMiddlewareOptions, m as ExpressNext, n as ExpressRequestLike, o as ExpressResponseLike, P as PermissionGroup, R as RequestAuthorizationOptions, p as authorizeRequest, q as authorizeToken, r as createAuthorizationErrorResponse, s as createAuthyonAbility, t as createAuthyonRules, u as createExpressAuthorizationMiddleware, v as hasPermission, w as hasPermissionGroup } from './authorization-CDHWMYT7.cjs';
|
|
4
4
|
import 'jose';
|
|
5
5
|
|
|
6
6
|
declare const ErrorCodes: {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { H as HttpAdapter, a as HttpLoggerOptions, A as AuthyonServerClient } from './authyonServerClient-
|
|
2
|
-
export { b as AcceptTenantInviteInput, c as AccessTokenSource, d as Approval, e as ApprovalAssurance, f as ApprovalPayload, g as ApprovalStatus, h as ApprovalWebAuthnOptions, i as AuditEvent, j as AuthyonJwksDiscoveryOptions, k as AuthyonJwtClaims, l as AuthyonServerClientOptions, m as AuthyonTenantClaim, C as CLIENT_IP_HEADER, n as ClientCredentials, o as ClientRequestContext, p as ConfirmApprovalInput, q as ConsumedApproval, r as CreateApprovalInput, s as CreateCredentialInput, t as CreateOrganizationInput, u as CreatePermissionInput, v as CreateTenantCredentialInput, w as CreateUserInput, x as CredentialCreator, y as CredentialDetail, z as CredentialListOptions, B as CredentialPermissionsInput, E as EnvironmentUser, F as FetchHttpAdapter, D as HttpAdapterRequest, G as HttpLogEvent, I as HttpLogger, K as IntrospectResult, L as InviteTenantMemberInput, M as IssuePasswordResetInput, N as JsonWebKeySet, J as JwksTokenVerifier, O as JwksTokenVerifierOptions, P as LoggingHttpAdapter, Q as LoginActivity, R as OpenIdConfiguration, S as Organization, T as OtpCheckResult, U as Paged, V as PaginationOptions, W as PasswordResetCompleted, X as PasswordResetIssued, Y as PasswordResetPreview, Z as Permission, _ as PermissionsByRole, $ as ReservedPermissions, a0 as Role, a1 as RoleGrant, a2 as RoleInput, a3 as RoleList, a4 as RolePermissions, a5 as SafeJwtAlgorithm, a6 as SecurityMethods, a7 as SubjectApprovals, a8 as SubjectSecurity, a9 as TENANT_FILTER_MAX_DEPTH, aa as TENANT_FILTER_MAX_VALUES, ab as TENANT_FILTER_MAX_VALUE_LENGTH, ac as TenantAncestor, ad as TenantClientValidationResult, ae as TenantCredentialIssued, af as TenantCredentialSummary, ag as TenantFilterExpression, ah as TenantFilterValue, ai as TenantInvite, aj as TenantInviteAccepted, ak as TenantInviteInput, al as TenantInviteIssued, am as TenantInvitePreview, an as TenantInviteStatus, ao as TenantListOptions, ap as TenantMember, aq as TenantMemberPage, ar as TenantMembership, as as TenantOrderField, at as TenantScopedClient, au as TokenResult, av as TokenVerificationError, aw as TokenVerificationErrorCode, ax as UpdateOrganizationInput, ay as User, az as UserScopedClient, aA as ValidateResult, aB as VerifiedAccessToken, aC as createClient, aD as normalizeClientIp, aE as tenantFilter } from './authyonServerClient-
|
|
3
|
-
export { b as AbilityConditions, c as AbilityEvent, d as AbilityListener, e as AbilityRequirement, f as AbilityRule, A as AbilitySubject, g as AuthorizationContext, a as AuthorizationError, h as AuthorizationOptions, i as AuthyonAbility, j as AuthyonAbilityBuilder, k as AuthyonAbilityOptions, l as AuthyonPermissionSource, E as ExpressAuthorizationMiddlewareOptions, m as ExpressNext, n as ExpressRequestLike, o as ExpressResponseLike, P as PermissionGroup, R as RequestAuthorizationOptions, p as authorizeRequest, q as authorizeToken, r as createAuthorizationErrorResponse, s as createAuthyonAbility, t as createAuthyonRules, u as createExpressAuthorizationMiddleware, v as hasPermission, w as hasPermissionGroup } from './authorization-
|
|
1
|
+
import { H as HttpAdapter, a as HttpLoggerOptions, A as AuthyonServerClient } from './authyonServerClient-6ezHxvwa.js';
|
|
2
|
+
export { b as AcceptTenantInviteInput, c as AccessTokenSource, d as Approval, e as ApprovalAssurance, f as ApprovalPayload, g as ApprovalStatus, h as ApprovalWebAuthnOptions, i as AuditEvent, j as AuthyonJwksDiscoveryOptions, k as AuthyonJwtClaims, l as AuthyonServerClientOptions, m as AuthyonTenantClaim, C as CLIENT_IP_HEADER, n as ClientCredentials, o as ClientRequestContext, p as ConfirmApprovalInput, q as ConsumedApproval, r as CreateApprovalInput, s as CreateCredentialInput, t as CreateOrganizationInput, u as CreatePermissionInput, v as CreateTenantCredentialInput, w as CreateUserInput, x as CredentialCreator, y as CredentialDetail, z as CredentialListOptions, B as CredentialPermissionsInput, E as EnvironmentUser, F as FetchHttpAdapter, D as HttpAdapterRequest, G as HttpLogEvent, I as HttpLogger, K as IntrospectResult, L as InviteTenantMemberInput, M as IssuePasswordResetInput, N as JsonWebKeySet, J as JwksTokenVerifier, O as JwksTokenVerifierOptions, P as LoggingHttpAdapter, Q as LoginActivity, R as OpenIdConfiguration, S as Organization, T as OtpCheckResult, U as Paged, V as PaginationOptions, W as PasswordResetCompleted, X as PasswordResetIssued, Y as PasswordResetPreview, Z as Permission, _ as PermissionsByRole, $ as ReservedPermissions, a0 as Role, a1 as RoleGrant, a2 as RoleInput, a3 as RoleList, a4 as RolePermissions, a5 as SafeJwtAlgorithm, a6 as SecurityMethods, a7 as SubjectApprovals, a8 as SubjectSecurity, a9 as TENANT_FILTER_MAX_DEPTH, aa as TENANT_FILTER_MAX_VALUES, ab as TENANT_FILTER_MAX_VALUE_LENGTH, ac as TenantAncestor, ad as TenantClientValidationResult, ae as TenantCredentialIssued, af as TenantCredentialSummary, ag as TenantFilterExpression, ah as TenantFilterValue, ai as TenantInvite, aj as TenantInviteAccepted, ak as TenantInviteInput, al as TenantInviteIssued, am as TenantInvitePreview, an as TenantInviteStatus, ao as TenantListOptions, ap as TenantMember, aq as TenantMemberPage, ar as TenantMembership, as as TenantOrderField, at as TenantScopedClient, au as TokenResult, av as TokenVerificationError, aw as TokenVerificationErrorCode, ax as UpdateOrganizationInput, ay as User, az as UserScopedClient, aA as ValidateResult, aB as VerifiedAccessToken, aC as createClient, aD as normalizeClientIp, aE as tenantFilter } from './authyonServerClient-6ezHxvwa.js';
|
|
3
|
+
export { b as AbilityConditions, c as AbilityEvent, d as AbilityListener, e as AbilityRequirement, f as AbilityRule, A as AbilitySubject, g as AuthorizationContext, a as AuthorizationError, h as AuthorizationOptions, i as AuthyonAbility, j as AuthyonAbilityBuilder, k as AuthyonAbilityOptions, l as AuthyonPermissionSource, E as ExpressAuthorizationMiddlewareOptions, m as ExpressNext, n as ExpressRequestLike, o as ExpressResponseLike, P as PermissionGroup, R as RequestAuthorizationOptions, p as authorizeRequest, q as authorizeToken, r as createAuthorizationErrorResponse, s as createAuthyonAbility, t as createAuthyonRules, u as createExpressAuthorizationMiddleware, v as hasPermission, w as hasPermissionGroup } from './authorization-BBwAqaR4.js';
|
|
4
4
|
import 'jose';
|
|
5
5
|
|
|
6
6
|
declare const ErrorCodes: {
|
package/dist/index.js
CHANGED
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
hasPermission,
|
|
26
26
|
hasPermissionGroup,
|
|
27
27
|
normalizeClientIp
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-V6JQIOSP.js";
|
|
29
29
|
import {
|
|
30
30
|
__privateAdd,
|
|
31
31
|
__privateGet,
|
|
@@ -64,6 +64,25 @@ function lifetimeBody(input) {
|
|
|
64
64
|
}
|
|
65
65
|
return { lifetimeDays: input.lifetimeDays };
|
|
66
66
|
}
|
|
67
|
+
var MAX_PERMISSION_FILTERS = 20;
|
|
68
|
+
var PERMISSION_FILTER = /^(?:\*|[a-z][a-z0-9_-]*)(?::(?:\*|[a-z][a-z0-9_-]*)){2,4}$/u;
|
|
69
|
+
function permissionFilter(values) {
|
|
70
|
+
if (values === void 0) return void 0;
|
|
71
|
+
if (!Array.isArray(values)) throw new TypeError("Authyon: permissions must be an array.");
|
|
72
|
+
const normalized = values.map((value) => {
|
|
73
|
+
if (typeof value !== "string") throw new TypeError("Authyon: invalid permission.");
|
|
74
|
+
return value.trim().toLowerCase();
|
|
75
|
+
});
|
|
76
|
+
const unique = [...new Set(normalized.filter((value) => value.length > 0))];
|
|
77
|
+
if (unique.length > MAX_PERMISSION_FILTERS)
|
|
78
|
+
throw new RangeError(
|
|
79
|
+
`Authyon: at most ${MAX_PERMISSION_FILTERS} permissions can be filtered at once.`
|
|
80
|
+
);
|
|
81
|
+
for (const value of unique)
|
|
82
|
+
if (!PERMISSION_FILTER.test(value))
|
|
83
|
+
throw new TypeError("Authyon: permissions must have namespace:resource:action format.");
|
|
84
|
+
return unique.length > 0 ? unique : void 0;
|
|
85
|
+
}
|
|
67
86
|
function credentialQuery(options = {}) {
|
|
68
87
|
const { skip, take, search } = options;
|
|
69
88
|
if (skip !== void 0 && (!Number.isInteger(skip) || skip < 0 || skip > 2147483647))
|
|
@@ -72,7 +91,8 @@ function credentialQuery(options = {}) {
|
|
|
72
91
|
throw new RangeError("Authyon: take must be between 1 and 100.");
|
|
73
92
|
if (search !== void 0 && (typeof search !== "string" || search.trim().length > 200))
|
|
74
93
|
throw new RangeError("Authyon: search must contain at most 200 characters.");
|
|
75
|
-
|
|
94
|
+
const permission = permissionFilter(options.permissions);
|
|
95
|
+
return { search: search?.trim() || void 0, skip, take, permission };
|
|
76
96
|
}
|
|
77
97
|
function credentialSummary(value) {
|
|
78
98
|
return {
|
|
@@ -550,6 +570,18 @@ var AuthyonServerClient = class {
|
|
|
550
570
|
* start from.
|
|
551
571
|
*/
|
|
552
572
|
roots: (params = {}) => this.environment.tenants.list({ ...params, parentId: null }),
|
|
573
|
+
/**
|
|
574
|
+
* Every sub-tenant in the environment, at any depth and under any
|
|
575
|
+
* parent — `list()` with `minDepth: 1`. This is the one page
|
|
576
|
+
* `children()` cannot produce, since it names a single parent, and the
|
|
577
|
+
* one a flat "all sub-companies" screen wants: the envelope describes
|
|
578
|
+
* the sub-tenants alone, so the pager stops where they do, and nobody
|
|
579
|
+
* has to read the whole environment and drop the roots.
|
|
580
|
+
*
|
|
581
|
+
* Against an Authyon API older than 2026-10-31 the floor is ignored and
|
|
582
|
+
* the roots come back too.
|
|
583
|
+
*/
|
|
584
|
+
subTenants: (params = {}) => this.environment.tenants.list({ ...params, minDepth: 1 }),
|
|
553
585
|
/**
|
|
554
586
|
* POST /env/tenants — create a tenant in the environment.
|
|
555
587
|
*
|
package/dist/next.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { R as RequestAuthorizationOptions, A as AbilitySubject, a as AuthorizationError } from './authorization-
|
|
3
|
-
import { A as AuthyonServerClient } from './authyonServerClient-
|
|
2
|
+
import { R as RequestAuthorizationOptions, A as AbilitySubject, a as AuthorizationError } from './authorization-CDHWMYT7.cjs';
|
|
3
|
+
import { A as AuthyonServerClient } from './authyonServerClient-6ezHxvwa.cjs';
|
|
4
4
|
import 'jose';
|
|
5
5
|
|
|
6
6
|
interface ServerPermissionGuardFallbackContext {
|
package/dist/next.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { R as RequestAuthorizationOptions, A as AbilitySubject, a as AuthorizationError } from './authorization-
|
|
3
|
-
import { A as AuthyonServerClient } from './authyonServerClient-
|
|
2
|
+
import { R as RequestAuthorizationOptions, A as AbilitySubject, a as AuthorizationError } from './authorization-BBwAqaR4.js';
|
|
3
|
+
import { A as AuthyonServerClient } from './authyonServerClient-6ezHxvwa.js';
|
|
4
4
|
import 'jose';
|
|
5
5
|
|
|
6
6
|
interface ServerPermissionGuardFallbackContext {
|
package/dist/next.js
CHANGED
package/package.json
CHANGED