authhero 9.16.0 → 9.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/authhero.cjs +141 -141
  2. package/dist/authhero.d.ts +159 -146
  3. package/dist/authhero.mjs +11527 -11490
  4. package/dist/tsconfig.types.tsbuildinfo +1 -1
  5. package/dist/types/authentication-flows/passwordless.d.ts +3 -3
  6. package/dist/types/helpers/reserved-claims.d.ts +2 -2
  7. package/dist/types/helpers/scopes-permissions.d.ts +51 -12
  8. package/dist/types/index.d.ts +159 -146
  9. package/dist/types/middlewares/authentication.d.ts +1 -0
  10. package/dist/types/routes/auth-api/index.d.ts +21 -21
  11. package/dist/types/routes/auth-api/passwordless.d.ts +18 -18
  12. package/dist/types/routes/auth-api/register/index.d.ts +2 -2
  13. package/dist/types/routes/auth-api/well-known.d.ts +1 -1
  14. package/dist/types/routes/management-api/action-executions.d.ts +1 -1
  15. package/dist/types/routes/management-api/actions.d.ts +1 -1
  16. package/dist/types/routes/management-api/authentication-methods.d.ts +1 -1
  17. package/dist/types/routes/management-api/branding.d.ts +1 -1
  18. package/dist/types/routes/management-api/client-grants.d.ts +9 -9
  19. package/dist/types/routes/management-api/clients.d.ts +8 -8
  20. package/dist/types/routes/management-api/custom-domains.d.ts +6 -6
  21. package/dist/types/routes/management-api/email-templates.d.ts +18 -18
  22. package/dist/types/routes/management-api/failed-events.d.ts +1 -1
  23. package/dist/types/routes/management-api/guardian.d.ts +5 -5
  24. package/dist/types/routes/management-api/index.d.ts +139 -126
  25. package/dist/types/routes/management-api/keys.d.ts +8 -8
  26. package/dist/types/routes/management-api/logs.d.ts +4 -4
  27. package/dist/types/routes/management-api/migration-sources.d.ts +6 -6
  28. package/dist/types/routes/management-api/organizations.d.ts +3 -3
  29. package/dist/types/routes/management-api/prompts.d.ts +4 -4
  30. package/dist/types/routes/management-api/roles.d.ts +14 -1
  31. package/dist/types/routes/management-api/tenant-operations.d.ts +5 -5
  32. package/dist/types/routes/management-api/tenants.d.ts +4 -4
  33. package/dist/types/routes/management-api/token-exchange-profiles.d.ts +6 -6
  34. package/dist/types/routes/management-api/users.d.ts +42 -42
  35. package/dist/types/routes/universal-login/common.d.ts +2 -2
  36. package/dist/types/routes/universal-login/flow-api.d.ts +4 -4
  37. package/dist/types/routes/universal-login/screens/connect-authz.d.ts +16 -0
  38. package/dist/types/routes/universal-login/u2-index.d.ts +5 -5
  39. package/dist/types/routes/universal-login/u2-routes.d.ts +5 -5
  40. package/dist/types/utils/jwks.d.ts +2 -2
  41. package/package.json +2 -2
@@ -475,7 +475,7 @@ export declare function passwordlessGrantUser(ctx: Context<{
475
475
  custom_login_page_preview?: string | undefined;
476
476
  form_template?: string | undefined;
477
477
  addons?: Record<string, any> | undefined;
478
- token_endpoint_auth_method?: "client_secret_post" | "client_secret_basic" | "none" | "client_secret_jwt" | "private_key_jwt" | undefined;
478
+ token_endpoint_auth_method?: "none" | "client_secret_post" | "client_secret_basic" | "client_secret_jwt" | "private_key_jwt" | undefined;
479
479
  client_metadata?: Record<string, string> | undefined;
480
480
  hide_sign_up_disabled_error?: boolean | undefined;
481
481
  mobile?: Record<string, any> | undefined;
@@ -561,8 +561,8 @@ export declare function passwordlessGrantUser(ctx: Context<{
561
561
  } | undefined;
562
562
  authenticated_at?: string | undefined;
563
563
  };
564
- connectionType: "email" | "username" | "sms";
565
- authConnection: "email" | "username" | "sms";
564
+ connectionType: "email" | "sms" | "username";
565
+ authConnection: "email" | "sms" | "username";
566
566
  session_id: string | undefined;
567
567
  authParams: {
568
568
  audience?: string | undefined;
@@ -14,9 +14,9 @@ export declare const USERINFO_RESERVED_CLAIMS: readonly ["iss", "sub", "aud", "e
14
14
  * vendor/tenant for downstream APIs while `sub` stays `auth-service`.
15
15
  * Client-bound mints keep `azp` locked (see below).
16
16
  */
17
- export declare const SERVICE_TOKEN_RESERVED_CLAIMS: ("tenant_id" | "client_id" | "scope" | "sid" | "sub" | "org_name" | "aud" | "auth_time" | "exp" | "iat" | "iss" | "permissions" | "org_id" | "acr" | "amr" | "nbf" | "jti" | "act" | "requested_userinfo_claims" | "gty")[];
17
+ export declare const SERVICE_TOKEN_RESERVED_CLAIMS: ("tenant_id" | "client_id" | "org_name" | "sid" | "permissions" | "scope" | "sub" | "auth_time" | "iss" | "aud" | "exp" | "nbf" | "iat" | "jti" | "acr" | "amr" | "act" | "org_id" | "requested_userinfo_claims" | "gty")[];
18
18
  /** Client-bound mints: `azp` must stay the registered client id. */
19
- export declare const CLIENT_SERVICE_TOKEN_RESERVED_CLAIMS: ("tenant_id" | "client_id" | "scope" | "sid" | "sub" | "org_name" | "aud" | "auth_time" | "exp" | "iat" | "iss" | "permissions" | "org_id" | "acr" | "amr" | "azp" | "nbf" | "jti" | "act" | "requested_userinfo_claims" | "gty")[];
19
+ export declare const CLIENT_SERVICE_TOKEN_RESERVED_CLAIMS: ("tenant_id" | "client_id" | "org_name" | "sid" | "permissions" | "scope" | "sub" | "auth_time" | "iss" | "aud" | "exp" | "nbf" | "iat" | "jti" | "azp" | "acr" | "amr" | "act" | "org_id" | "requested_userinfo_claims" | "gty")[];
20
20
  export type AccessTokenReservedClaim = (typeof ACCESS_TOKEN_RESERVED_CLAIMS)[number];
21
21
  export type IdTokenReservedClaim = (typeof ID_TOKEN_RESERVED_CLAIMS)[number];
22
22
  /**
@@ -24,23 +24,62 @@ export interface ScopesAndPermissionsResult {
24
24
  token_lifetime_for_web: number;
25
25
  }
26
26
  /**
27
- * True when the user holds the global `admin:organizations` escape hatch — the
28
- * single canonical key for "may act on any organization without being a
29
- * member". It is a management-plane permission, so it is always matched against
30
- * the Management API audience, never the requested token's audience.
27
+ * Management API permission that lets a user act on any organization without
28
+ * being a member. Doubles as a tenant-admin permission on the multi-tenancy
29
+ * `/tenants` routes, and only bypasses org membership when the tenant has the
30
+ * `inherit_global_permissions_in_organizations` flag.
31
+ */
32
+ export declare const ADMIN_ORGANIZATIONS_PERMISSION = "admin:organizations";
33
+ /**
34
+ * Management API permission that lets a user get org-scoped tokens for (and
35
+ * list) every organization without being a member. Unlike
36
+ * `admin:organizations` it carries no tenant-admin rights and needs no tenant
37
+ * flag: holding the permission is the opt-in.
38
+ */
39
+ export declare const ACCESS_ALL_ORGANIZATIONS_PERMISSION = "access:all_organizations";
40
+ /**
41
+ * True when the user holds `permissionName` at global scope on the Management
42
+ * API audience, directly or through a role.
43
+ */
44
+ export declare function userHasGlobalManagementPermission(ctx: Context<{
45
+ Bindings: Bindings;
46
+ Variables: Variables;
47
+ }>, tenantId: string, userId: string, permissionName: string): Promise<boolean>;
48
+ /**
49
+ * Single rule for "may this user get an org-scoped token for an organization
50
+ * they are not a member of?". Used by every org-membership gate
51
+ * (calculateScopesAndPermissions, token exchange, refresh token) so they can
52
+ * never disagree.
31
53
  *
32
- * "Global" means an assignment with an empty organization scope (`""`). Both
33
- * directly-assigned user permissions AND role-derived permissions count, so a
34
- * user granted the permission either way is treated consistently (see #1198).
54
+ * True when the user holds, at global scope on the Management API audience:
55
+ * - `access:all_organizations` (no tenant flag needed), or
56
+ * - `admin:organizations` AND the tenant has
57
+ * `inherit_global_permissions_in_organizations` (legacy behaviour).
35
58
  *
36
- * The caller is responsible for gating on the
37
- * `inherit_global_permissions_in_organizations` tenant flag; this helper only
38
- * answers whether the permission is present.
59
+ * Pass `tenant` when the caller already loaded it to skip a second fetch.
60
+ */
61
+ export declare function userCanAccessAllOrganizations(ctx: Context<{
62
+ Bindings: Bindings;
63
+ Variables: Variables;
64
+ }>, tenantId: string, userId: string, tenant?: {
65
+ flags?: {
66
+ inherit_global_permissions_in_organizations?: boolean;
67
+ };
68
+ } | null): Promise<boolean>;
69
+ /**
70
+ * True when the user may get an org-scoped token for `organizationId`: either
71
+ * they may access every organization (see `userCanAccessAllOrganizations`) or
72
+ * they are a member of it. Every org gate (login, silent auth, token grants)
73
+ * goes through here so they apply the same rule.
39
74
  */
40
- export declare function userHasGlobalOrgAdminPermission(ctx: Context<{
75
+ export declare function userCanAccessOrganization(ctx: Context<{
41
76
  Bindings: Bindings;
42
77
  Variables: Variables;
43
- }>, tenantId: string, userId: string): Promise<boolean>;
78
+ }>, tenantId: string, userId: string, organizationId: string, tenant?: {
79
+ flags?: {
80
+ inherit_global_permissions_in_organizations?: boolean;
81
+ };
82
+ } | null): Promise<boolean>;
44
83
  /**
45
84
  * Returns the subset of `scopes` that the resource server matching `audience`
46
85
  * does not define — the scopes that would silently vanish from an issued token.