authhero 5.18.0 → 5.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/u/widget/index.esm.js +1 -1
- package/dist/authhero.cjs +2729 -128
- package/dist/authhero.d.ts +602 -230
- package/dist/authhero.mjs +10757 -9901
- package/dist/stats.html +1 -1
- package/dist/tsconfig.types.tsbuildinfo +1 -1
- package/dist/types/authentication-flows/common.d.ts +8 -0
- package/dist/types/authentication-flows/passwordless.d.ts +1 -1
- package/dist/types/authentication-flows/token-exchange.d.ts +19 -0
- package/dist/types/emails/defaults/BlockedAccount.d.ts +1 -0
- package/dist/types/emails/defaults/ChangePassword.d.ts +6 -0
- package/dist/types/emails/defaults/EnrollmentEmail.d.ts +1 -0
- package/dist/types/emails/defaults/MfaOobCode.d.ts +1 -0
- package/dist/types/emails/defaults/PasswordReset.d.ts +5 -0
- package/dist/types/emails/defaults/StolenCredentials.d.ts +1 -0
- package/dist/types/emails/index.d.ts +21 -1
- package/dist/types/helpers/consent.d.ts +31 -0
- package/dist/types/helpers/control-plane-sync-events.d.ts +67 -0
- package/dist/types/helpers/default-destinations.d.ts +11 -0
- package/dist/types/helpers/outbox-destinations/control-plane-sync.d.ts +35 -0
- package/dist/types/helpers/outbox-destinations/logs.d.ts +2 -0
- package/dist/types/helpers/scopes-permissions.d.ts +1 -1
- package/dist/types/index.d.ts +471 -227
- package/dist/types/routes/auth-api/index.d.ts +117 -7
- package/dist/types/routes/auth-api/passwordless.d.ts +6 -6
- package/dist/types/routes/auth-api/token.d.ts +110 -0
- package/dist/types/routes/auth-api/well-known.d.ts +1 -1
- package/dist/types/routes/management-api/action-executions.d.ts +2 -2
- package/dist/types/routes/management-api/actions.d.ts +4 -4
- package/dist/types/routes/management-api/authentication-methods.d.ts +1 -1
- package/dist/types/routes/management-api/branding.d.ts +9 -9
- package/dist/types/routes/management-api/clients.d.ts +2 -2
- package/dist/types/routes/management-api/connections.d.ts +6 -6
- package/dist/types/routes/management-api/custom-domains.d.ts +8 -8
- package/dist/types/routes/management-api/email-templates.d.ts +88 -31
- package/dist/types/routes/management-api/failed-events.d.ts +1 -1
- package/dist/types/routes/management-api/forms.d.ts +126 -126
- package/dist/types/routes/management-api/grants.d.ts +80 -0
- package/dist/types/routes/management-api/guardian.d.ts +5 -5
- package/dist/types/routes/management-api/index.d.ts +343 -212
- package/dist/types/routes/management-api/logs.d.ts +3 -3
- package/dist/types/routes/management-api/migration-sources.d.ts +6 -6
- package/dist/types/routes/management-api/organizations.d.ts +2 -2
- package/dist/types/routes/management-api/prompts.d.ts +4 -4
- package/dist/types/routes/management-api/proxy-routes.d.ts +1 -0
- package/dist/types/routes/management-api/themes.d.ts +6 -6
- package/dist/types/routes/management-api/users.d.ts +2 -2
- package/dist/types/routes/proxy-control-plane/index.d.ts +34 -1
- package/dist/types/routes/universal-login/common.d.ts +8 -8
- package/dist/types/routes/universal-login/flow-api.d.ts +8 -8
- package/dist/types/routes/universal-login/identifier.d.ts +2 -2
- package/dist/types/routes/universal-login/index.d.ts +2 -2
- package/dist/types/routes/universal-login/screens/consent.d.ts +9 -0
- package/dist/types/routes/universal-login/u2-index.d.ts +6 -6
- package/dist/types/routes/universal-login/u2-routes.d.ts +6 -6
- package/dist/types/state-machines/login-session.d.ts +12 -1
- package/dist/types/types/AuthHeroConfig.d.ts +26 -0
- package/dist/types/types/GrantFlowResult.d.ts +8 -0
- package/dist/types/types/IdToken.d.ts +1 -1
- package/dist/types/utils/jwks.d.ts +2 -2
- package/dist/types/utils/jwt.d.ts +4 -0
- package/package.json +5 -5
|
@@ -39,6 +39,14 @@ export interface CreateAuthTokensParams {
|
|
|
39
39
|
permissions?: string[];
|
|
40
40
|
grantType?: GrantType;
|
|
41
41
|
impersonatingUser?: User;
|
|
42
|
+
/**
|
|
43
|
+
* RFC 8693 §4.1 — when the token was minted via a delegated flow (e.g.
|
|
44
|
+
* token-exchange) where the *acting party* is a client rather than a user,
|
|
45
|
+
* pass its client_id here so the `act` claim records the actor.
|
|
46
|
+
*/
|
|
47
|
+
actClient?: {
|
|
48
|
+
client_id: string;
|
|
49
|
+
};
|
|
42
50
|
auth_time?: number;
|
|
43
51
|
/** Custom claims to add to the access token payload (cannot override reserved claims) */
|
|
44
52
|
customClaims?: Record<string, unknown>;
|
|
@@ -404,7 +404,7 @@ export declare function passwordlessGrantUser(ctx: Context<{
|
|
|
404
404
|
} | undefined;
|
|
405
405
|
} | undefined;
|
|
406
406
|
passkey_options?: {
|
|
407
|
-
challenge_ui?: "
|
|
407
|
+
challenge_ui?: "both" | "autofill" | "button" | undefined;
|
|
408
408
|
local_enrollment_enabled?: boolean | undefined;
|
|
409
409
|
progressive_enrollment_enabled?: boolean | undefined;
|
|
410
410
|
} | undefined;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Context } from "hono";
|
|
2
|
+
import { z } from "@hono/zod-openapi";
|
|
3
|
+
import { Bindings, Variables, GrantFlowUserResult } from "../types";
|
|
4
|
+
export declare const TOKEN_EXCHANGE_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:token-exchange";
|
|
5
|
+
export declare const tokenExchangeParamsSchema: z.ZodObject<{
|
|
6
|
+
grant_type: z.ZodLiteral<"urn:ietf:params:oauth:grant-type:token-exchange">;
|
|
7
|
+
client_id: z.ZodString;
|
|
8
|
+
client_secret: z.ZodOptional<z.ZodString>;
|
|
9
|
+
subject_token: z.ZodString;
|
|
10
|
+
subject_token_type: z.ZodLiteral<"urn:ietf:params:oauth:token-type:access_token">;
|
|
11
|
+
organization: z.ZodString;
|
|
12
|
+
audience: z.ZodOptional<z.ZodString>;
|
|
13
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
export type TokenExchangeParams = z.infer<typeof tokenExchangeParamsSchema>;
|
|
16
|
+
export declare function tokenExchangeGrant(ctx: Context<{
|
|
17
|
+
Bindings: Bindings;
|
|
18
|
+
Variables: Variables;
|
|
19
|
+
}>, params: TokenExchangeParams): Promise<GrantFlowUserResult>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function BlockedAccount(): import("react").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Legacy Auth0 template name. Same shape as `reset_email` — kept for
|
|
3
|
+
* Auth0-import compatibility. authhero never sends this; the active path is
|
|
4
|
+
* `reset_email` / `reset_email_by_code`.
|
|
5
|
+
*/
|
|
6
|
+
export declare function ChangePassword(): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function EnrollmentEmail(): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function MfaOobCode(): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function StolenCredentials(): import("react").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Context } from "hono";
|
|
2
2
|
import { Bindings, Variables } from "../types";
|
|
3
|
-
import { AuthParams, User } from "@authhero/adapter-interfaces";
|
|
3
|
+
import { AuthParams, EmailTemplateName, User } from "@authhero/adapter-interfaces";
|
|
4
4
|
export type SendEmailParams = {
|
|
5
5
|
to: string;
|
|
6
6
|
subject: string;
|
|
@@ -68,3 +68,23 @@ export declare function sendInvitation(ctx: Context<{
|
|
|
68
68
|
Bindings: Bindings;
|
|
69
69
|
Variables: Variables;
|
|
70
70
|
}>, { to, invitationUrl, inviterName, organizationName, ttlSec, language, }: SendInvitationParams): Promise<void>;
|
|
71
|
+
export interface SendTestEmailParams {
|
|
72
|
+
to: string;
|
|
73
|
+
templateName: EmailTemplateName;
|
|
74
|
+
/** Optional override for the body — defaults to stored override or bundled default. */
|
|
75
|
+
body?: string;
|
|
76
|
+
/** Optional override for the subject — defaults to stored override or bundled default. */
|
|
77
|
+
subject?: string;
|
|
78
|
+
/** Optional override for the from address. */
|
|
79
|
+
from?: string;
|
|
80
|
+
language?: string;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Send a test email using the provided body/subject (or the stored / bundled
|
|
84
|
+
* default), with realistic-looking sample data. Used by the admin UI's
|
|
85
|
+
* "Send test" button so customizations can be validated before saving.
|
|
86
|
+
*/
|
|
87
|
+
export declare function sendTestEmail(ctx: Context<{
|
|
88
|
+
Bindings: Bindings;
|
|
89
|
+
Variables: Variables;
|
|
90
|
+
}>, params: SendTestEmailParams): Promise<void>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Context } from "hono";
|
|
2
|
+
import { Bindings, Variables } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* OIDC basic scopes — these are exempt from the third-party consent gate
|
|
5
|
+
* because they only authorize the standard ID-token / userinfo claims that
|
|
6
|
+
* are implicit in any OIDC sign-in.
|
|
7
|
+
*/
|
|
8
|
+
export declare const BASIC_OIDC_SCOPES: Set<string>;
|
|
9
|
+
/**
|
|
10
|
+
* Return the scopes in `requested` that are not in `consented` and are not
|
|
11
|
+
* basic OIDC scopes. An empty result means the existing consent record (if
|
|
12
|
+
* any) covers everything the client asked for.
|
|
13
|
+
*/
|
|
14
|
+
export declare function computeMissingConsentScopes(requested: string[], consented: string[]): string[];
|
|
15
|
+
/**
|
|
16
|
+
* Load the user's stored consent for (tenant, user, client) and compute the
|
|
17
|
+
* scopes that still need explicit consent. Returns an empty array if the
|
|
18
|
+
* consent gate should pass.
|
|
19
|
+
*
|
|
20
|
+
* Fail-closed when the adapter isn't configured: the function treats every
|
|
21
|
+
* non-basic requested scope as missing so the caller blocks the auth flow.
|
|
22
|
+
*/
|
|
23
|
+
export declare function getMissingConsentScopes(ctx: Context<{
|
|
24
|
+
Bindings: Bindings;
|
|
25
|
+
Variables: Variables;
|
|
26
|
+
}>, params: {
|
|
27
|
+
tenantId: string;
|
|
28
|
+
userId: string;
|
|
29
|
+
clientId: string;
|
|
30
|
+
requestedScopes: string[];
|
|
31
|
+
}): Promise<string[]>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Context } from "hono";
|
|
2
|
+
import { CustomDomain, ProxyRoute } from "@authhero/adapter-interfaces";
|
|
3
|
+
import { Bindings, Variables } from "../types";
|
|
4
|
+
export declare const CONTROL_PLANE_SYNC_EVENT_PREFIX = "controlplane.sync.";
|
|
5
|
+
export type SyncEntity = "custom_domain" | "proxy_route";
|
|
6
|
+
export type SyncOp = "created" | "updated" | "deleted";
|
|
7
|
+
/**
|
|
8
|
+
* Wire shape posted from the tenant shard to the control plane. The destination
|
|
9
|
+
* serializes one event per HTTP request; the receiver accepts a batch
|
|
10
|
+
* (`{ events: [...] }`) for forward compatibility with a future
|
|
11
|
+
* batched-delivery destination.
|
|
12
|
+
*/
|
|
13
|
+
export type SyncEvent = {
|
|
14
|
+
event_id: string;
|
|
15
|
+
tenant_id: string;
|
|
16
|
+
entity: "custom_domain";
|
|
17
|
+
op: "created" | "updated";
|
|
18
|
+
aggregate_id: string;
|
|
19
|
+
payload: CustomDomain;
|
|
20
|
+
occurred_at: string;
|
|
21
|
+
} | {
|
|
22
|
+
event_id: string;
|
|
23
|
+
tenant_id: string;
|
|
24
|
+
entity: "custom_domain";
|
|
25
|
+
op: "deleted";
|
|
26
|
+
aggregate_id: string;
|
|
27
|
+
payload: CustomDomain;
|
|
28
|
+
occurred_at: string;
|
|
29
|
+
} | {
|
|
30
|
+
event_id: string;
|
|
31
|
+
tenant_id: string;
|
|
32
|
+
entity: "proxy_route";
|
|
33
|
+
op: "created" | "updated";
|
|
34
|
+
aggregate_id: string;
|
|
35
|
+
payload: ProxyRoute;
|
|
36
|
+
occurred_at: string;
|
|
37
|
+
} | {
|
|
38
|
+
event_id: string;
|
|
39
|
+
tenant_id: string;
|
|
40
|
+
entity: "proxy_route";
|
|
41
|
+
op: "deleted";
|
|
42
|
+
aggregate_id: string;
|
|
43
|
+
payload: ProxyRoute;
|
|
44
|
+
occurred_at: string;
|
|
45
|
+
};
|
|
46
|
+
interface EnqueueArgs {
|
|
47
|
+
tenantId: string;
|
|
48
|
+
entity: SyncEntity;
|
|
49
|
+
op: SyncOp;
|
|
50
|
+
aggregateId: string;
|
|
51
|
+
payload: CustomDomain | ProxyRoute;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Enqueue a `controlplane.sync.*` event to the outbox so the
|
|
55
|
+
* `ControlPlaneSyncDestination` can replicate the mutation to the global
|
|
56
|
+
* control-plane data store.
|
|
57
|
+
*
|
|
58
|
+
* Mirrors the pattern used by `enqueuePostHookEvent`: pushes the
|
|
59
|
+
* `outbox.create` promise onto `ctx.var.outboxEventPromises` so the outbox
|
|
60
|
+
* middleware awaits it in its finally block. No-op when the outbox is not
|
|
61
|
+
* configured — single-DB deployments don't need sync.
|
|
62
|
+
*/
|
|
63
|
+
export declare function enqueueControlPlaneSyncEvent(ctx: Context<{
|
|
64
|
+
Bindings: Bindings;
|
|
65
|
+
Variables: Variables;
|
|
66
|
+
}>, args: EnqueueArgs): void;
|
|
67
|
+
export {};
|
|
@@ -18,6 +18,17 @@ export interface CreateDefaultDestinationsConfig {
|
|
|
18
18
|
getServiceToken?: GetServiceToken;
|
|
19
19
|
/** Webhook HTTP request timeout in ms (default: 10_000). */
|
|
20
20
|
webhookTimeoutMs?: number;
|
|
21
|
+
/**
|
|
22
|
+
* When set, drains `controlplane.sync.*` events to the control-plane
|
|
23
|
+
* authhero instance at the given base URL. Mirrors the per-request
|
|
24
|
+
* `ControlPlaneSyncDestination` wired in the management API, so cron-drain
|
|
25
|
+
* deliveries don't lose events that missed per-request processing.
|
|
26
|
+
* Requires `getServiceToken`.
|
|
27
|
+
*/
|
|
28
|
+
controlPlaneSync?: {
|
|
29
|
+
baseUrl: string;
|
|
30
|
+
timeoutMs?: number;
|
|
31
|
+
};
|
|
21
32
|
/**
|
|
22
33
|
* Custom webhook invoker — same shape as the `webhookInvoker` option on
|
|
23
34
|
* `init()`. When provided, `hook.*` events are dispatched by calling this
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { AuditEvent } from "@authhero/adapter-interfaces";
|
|
2
|
+
import { EventDestination } from "../outbox-relay";
|
|
3
|
+
import { SyncEvent } from "../control-plane-sync-events";
|
|
4
|
+
import type { GetServiceToken } from "./webhooks";
|
|
5
|
+
export interface ControlPlaneSyncDestinationOptions {
|
|
6
|
+
/** Base URL of the control-plane authhero instance, e.g. `https://controlplane.example.com`. */
|
|
7
|
+
baseUrl: string;
|
|
8
|
+
/** Mints a bearer token to authenticate the sync POST. */
|
|
9
|
+
getServiceToken: GetServiceToken;
|
|
10
|
+
/** Per-request timeout (default: 10s). */
|
|
11
|
+
timeoutMs?: number;
|
|
12
|
+
/** Override for tests. */
|
|
13
|
+
fetchImpl?: typeof fetch;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Delivers `controlplane.sync.*` outbox events to the global control-plane
|
|
17
|
+
* `POST /api/v2/proxy/control-plane/sync` endpoint. Each POST carries one event
|
|
18
|
+
* with `Idempotency-Key: {event.id}` so the receiver can dedupe retries.
|
|
19
|
+
*
|
|
20
|
+
* The receiver MUST be idempotent: the outbox retries on network failure even
|
|
21
|
+
* after a successful write, so a `created` may arrive twice and a stale
|
|
22
|
+
* `updated` may arrive after a newer `deleted`. The default receiver in
|
|
23
|
+
* `proxy-control-plane/index.ts` handles both cases.
|
|
24
|
+
*/
|
|
25
|
+
export declare class ControlPlaneSyncDestination implements EventDestination {
|
|
26
|
+
name: string;
|
|
27
|
+
private baseUrl;
|
|
28
|
+
private getServiceToken;
|
|
29
|
+
private timeoutMs;
|
|
30
|
+
private fetchImpl;
|
|
31
|
+
constructor(options: ControlPlaneSyncDestinationOptions);
|
|
32
|
+
accepts(event: AuditEvent): boolean;
|
|
33
|
+
transform(event: AuditEvent): SyncEvent;
|
|
34
|
+
deliver(events: SyncEvent[]): Promise<void>;
|
|
35
|
+
}
|
|
@@ -7,6 +7,8 @@ export declare class LogsDestination implements EventDestination {
|
|
|
7
7
|
/**
|
|
8
8
|
* Only accept log-shaped events. `hook.*` events are dispatch tasks for
|
|
9
9
|
* webhook / code-hook destinations and are not audit log entries.
|
|
10
|
+
* `controlplane.sync.*` events are replication tasks for the
|
|
11
|
+
* ControlPlaneSyncDestination and likewise shouldn't appear in audit logs.
|
|
10
12
|
*/
|
|
11
13
|
accepts(event: AuditEvent): boolean;
|
|
12
14
|
transform(event: AuditEvent): {
|
|
@@ -13,7 +13,7 @@ interface ClientCredentialsScopesAndPermissionsParams extends BaseScopesAndPermi
|
|
|
13
13
|
userId?: never;
|
|
14
14
|
}
|
|
15
15
|
interface UserBasedScopesAndPermissionsParams extends BaseScopesAndPermissionsParams {
|
|
16
|
-
grantType?: GrantType.AuthorizationCode | GrantType.RefreshToken | GrantType.Password | GrantType.Passwordless | GrantType.OTP | undefined;
|
|
16
|
+
grantType?: GrantType.AuthorizationCode | GrantType.RefreshToken | GrantType.Password | GrantType.Passwordless | GrantType.OTP | GrantType.TokenExchange | undefined;
|
|
17
17
|
userId: string;
|
|
18
18
|
}
|
|
19
19
|
export type CalculateScopesAndPermissionsParams = ClientCredentialsScopesAndPermissionsParams | UserBasedScopesAndPermissionsParams;
|