authhero 9.41.0 → 9.42.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 (74) hide show
  1. package/dist/assets/u/widget/index.esm.js +1 -1
  2. package/dist/authhero.cjs +114 -111
  3. package/dist/authhero.d.ts +534 -272
  4. package/dist/authhero.mjs +16181 -12453
  5. package/dist/{mfa-Dx8-AJ6U.js → mfa-C8qBEQeH.js} +2 -2
  6. package/dist/{mfa-CdC-9ysu.mjs → mfa-CVF4Wbdz.mjs} +115 -115
  7. package/dist/mfa-attempts-CzGjIGzD.js +395 -0
  8. package/dist/{mfa-attempts-mBkfX0wf.mjs → mfa-attempts-sV0Xs59R.mjs} +5151 -4696
  9. package/dist/{passkey-enrollment-KQcVF_QM.js → passkey-enrollment-CAb2zWEF.js} +1 -1
  10. package/dist/tsconfig.types.tsbuildinfo +1 -1
  11. package/dist/types/authentication-flows/passwordless.d.ts +2 -2
  12. package/dist/types/helpers/client.d.ts +26 -0
  13. package/dist/types/helpers/login-migration.d.ts +56 -0
  14. package/dist/types/helpers/login-version.d.ts +18 -0
  15. package/dist/types/helpers/management-audience.d.ts +11 -0
  16. package/dist/types/helpers/reserved-claims.d.ts +2 -2
  17. package/dist/types/helpers/saml-connection-options.d.ts +24 -0
  18. package/dist/types/helpers/saml-request-signature.d.ts +36 -0
  19. package/dist/types/hooks/lifecycle-codehooks.d.ts +1 -1
  20. package/dist/types/index.d.ts +490 -271
  21. package/dist/types/routes/auth-api/authorize.d.ts +13 -13
  22. package/dist/types/routes/auth-api/callback.d.ts +42 -6
  23. package/dist/types/routes/auth-api/device.d.ts +21 -21
  24. package/dist/types/routes/auth-api/index.d.ts +113 -77
  25. package/dist/types/routes/auth-api/logout.d.ts +2 -2
  26. package/dist/types/routes/auth-api/oidc-logout.d.ts +3 -3
  27. package/dist/types/routes/auth-api/passwordless.d.ts +14 -14
  28. package/dist/types/routes/auth-api/revoke.d.ts +6 -6
  29. package/dist/types/routes/auth-api/token.d.ts +12 -12
  30. package/dist/types/routes/management-api/action-executions.d.ts +1 -1
  31. package/dist/types/routes/management-api/action-triggers.d.ts +2 -2
  32. package/dist/types/routes/management-api/authentication-methods.d.ts +1 -1
  33. package/dist/types/routes/management-api/branding-uploads.d.ts +4 -4
  34. package/dist/types/routes/management-api/branding.d.ts +19 -19
  35. package/dist/types/routes/management-api/client-registration-tokens.d.ts +3 -3
  36. package/dist/types/routes/management-api/clients.d.ts +38 -8
  37. package/dist/types/routes/management-api/connections.d.ts +90 -0
  38. package/dist/types/routes/management-api/custom-domains.d.ts +6 -6
  39. package/dist/types/routes/management-api/email-templates.d.ts +18 -18
  40. package/dist/types/routes/management-api/failed-events.d.ts +4 -4
  41. package/dist/types/routes/management-api/forms.d.ts +8 -8
  42. package/dist/types/routes/management-api/guardian.d.ts +5 -5
  43. package/dist/types/routes/management-api/hooks.d.ts +21 -21
  44. package/dist/types/routes/management-api/index.d.ts +287 -167
  45. package/dist/types/routes/management-api/keys.d.ts +12 -12
  46. package/dist/types/routes/management-api/log-streams.d.ts +12 -12
  47. package/dist/types/routes/management-api/logs.d.ts +4 -4
  48. package/dist/types/routes/management-api/organizations.d.ts +6 -6
  49. package/dist/types/routes/management-api/prompts.d.ts +6 -6
  50. package/dist/types/routes/management-api/self-service-profiles.d.ts +8 -8
  51. package/dist/types/routes/management-api/tenant-export-import.d.ts +5 -5
  52. package/dist/types/routes/management-api/tenant-operations.d.ts +5 -5
  53. package/dist/types/routes/management-api/tenants.d.ts +27 -23
  54. package/dist/types/routes/management-api/themes.d.ts +9 -9
  55. package/dist/types/routes/management-api/users.d.ts +26 -26
  56. package/dist/types/routes/saml/index.d.ts +72 -9
  57. package/dist/types/routes/saml/samlp.d.ts +72 -9
  58. package/dist/types/routes/universal-login/common.d.ts +12 -10
  59. package/dist/types/routes/universal-login/continue.d.ts +4 -4
  60. package/dist/types/routes/universal-login/flow-api.d.ts +4 -4
  61. package/dist/types/routes/universal-login/identifier.d.ts +2 -2
  62. package/dist/types/routes/universal-login/impersonate.d.ts +4 -4
  63. package/dist/types/routes/universal-login/index.d.ts +8 -8
  64. package/dist/types/routes/universal-login/u2-index.d.ts +9 -9
  65. package/dist/types/routes/universal-login/u2-routes.d.ts +7 -7
  66. package/dist/types/state-machines/login-session.d.ts +1 -1
  67. package/dist/types/strategies/index.d.ts +2 -0
  68. package/dist/types/strategies/samlp.d.ts +58 -0
  69. package/dist/types/types/AuthHeroConfig.d.ts +15 -1
  70. package/dist/types/types/Bindings.d.ts +2 -1
  71. package/dist/types/utils/ssrf-fetch.d.ts +2 -0
  72. package/dist/types/variables.d.ts +7 -6
  73. package/package.json +9 -6
  74. package/dist/mfa-attempts-CtWWceg2.js +0 -393
@@ -0,0 +1,58 @@
1
+ /**
2
+ * SAML 2.0 enterprise connections (`samlp`): AuthHero as the service
3
+ * provider, federating to an upstream SAML identity provider (Okta, Entra ID,
4
+ * ADFS, Google Workspace, …). Auth0-compatible endpoints:
5
+ *
6
+ * - ACS: `POST {authUrl}login/callback?connection={name}`
7
+ * - SP metadata: `GET {authUrl}samlp/metadata?connection={name}`
8
+ * - SP entity ID: `urn:auth0:{tenant_id}:{name}` (or `options.entityId`)
9
+ *
10
+ * The AuthnRequest's RelayState is the `oauth2_state` code and its ID is
11
+ * stored as the code's `code_verifier`, so the response's InResponseTo is
12
+ * checked against the request this login actually sent.
13
+ */
14
+ import { Context } from "hono";
15
+ import { Connection } from "@authhero/adapter-interfaces";
16
+ import { SamlAssertion } from "@authhero/saml/core";
17
+ import { Bindings, Variables } from "../types";
18
+ import { UserInfo, UserInfoWithRaw } from "./index";
19
+ type Ctx = Context<{
20
+ Bindings: Bindings;
21
+ Variables: Variables;
22
+ }>;
23
+ export declare const displayName = "SAML";
24
+ export declare const logoDataUri = "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2245%22%20height%3D%2245%22%20viewBox%3D%220%200%2045%2045%22%3E%3Ccircle%20cx%3D%2215%22%20cy%3D%2222.5%22%20r%3D%227%22%20fill%3D%22none%22%20stroke%3D%22%23666%22%20stroke-width%3D%223%22%2F%3E%3Cpath%20d%3D%22M22%2022.5h17M33%2022.5v6M38%2022.5v4%22%20fill%3D%22none%22%20stroke%3D%22%23666%22%20stroke-width%3D%223%22%20stroke-linecap%3D%22round%22%2F%3E%3C%2Fsvg%3E";
25
+ /** The SP entity ID: the Audience the IdP must put in its assertions. */
26
+ export declare function getSamlSpEntityId(tenantId: string, connection: Connection): string;
27
+ /**
28
+ * The assertion consumer service URL registered at the IdP. An explicit
29
+ * `options.callback_url` is used verbatim; otherwise it is Auth0's
30
+ * `/login/callback?connection={name}` on the request's host.
31
+ */
32
+ export declare function getSamlAcsUrl(ctx: Ctx, connection: Connection): string;
33
+ /** All trusted IdP signing certificates of the connection. */
34
+ export declare function getSamlIdpCertificates(connection: Connection): string[];
35
+ export declare function getRedirect(ctx: Ctx, connection: Connection): Promise<{
36
+ redirectUrl: string;
37
+ code: string;
38
+ codeVerifier: string;
39
+ formPost: {
40
+ SAMLRequest: string;
41
+ RelayState: string;
42
+ };
43
+ } | {
44
+ redirectUrl: string;
45
+ code: string;
46
+ codeVerifier: string;
47
+ formPost?: undefined;
48
+ }>;
49
+ /** Maps a validated assertion to the normalized user info and raw profile. */
50
+ export declare function mapSamlAssertion(connection: Connection, assertion: SamlAssertion): UserInfoWithRaw;
51
+ /**
52
+ * `code` is the posted SAMLResponse and `codeVerifier` the ID of the
53
+ * AuthnRequest stored with the state.
54
+ */
55
+ export declare function validateAuthorizationCodeAndGetUserWithRaw(ctx: Ctx, connection: Connection, code: string, codeVerifier?: string): Promise<UserInfoWithRaw>;
56
+ export declare function validateAuthorizationCodeAndGetUser(ctx: Ctx, connection: Connection, code: string, codeVerifier?: string): Promise<UserInfo>;
57
+ export declare const singleUseState = true;
58
+ export {};
@@ -1,7 +1,7 @@
1
1
  import { Action, ActionCodeGenerator, ActionInsert, ActionUpdate, CodeExecutor, Connection, ConnectionInsert, CreateTenantParams, DataAdapters, Hook, HookCode, HookCodeInsert, HookInsert, ResourceServer, ResourceServerInsert, Role, RoleInsert, Rollout, Tenant, TenantOperation, TenantOperationKind } from "@authhero/adapter-interfaces";
2
2
  import type { RolePermissionHooks, Hooks } from "./Hooks";
3
3
  import type { OutboxMetricsSink } from "./OutboxMetrics";
4
- import type { SamlSigner } from "@authhero/saml/core";
4
+ import type { SamlSignatureVerifier, SamlSigner } from "@authhero/saml/core";
5
5
  import type { SigningCertificateAuthority } from "../helpers/signing-certificate-authority";
6
6
  import type { OpenAPIHono } from "@hono/zod-openapi";
7
7
  import type { Handler, MiddlewareHandler } from "hono";
@@ -310,6 +310,20 @@ export interface AuthHeroConfig {
310
310
  managementDataAdapter?: DataAdapters;
311
311
  allowedOrigins?: string[];
312
312
  samlSigner?: SamlSigner;
313
+ /**
314
+ * Verifies the signatures of SAML responses from upstream identity
315
+ * providers (`samlp` connections). Required for SAML connections to work.
316
+ *
317
+ * @example
318
+ * ```typescript
319
+ * import { LocalSamlVerifier } from "@authhero/saml/local-verifier";
320
+ *
321
+ * init({ dataAdapter, samlVerifier: new LocalSamlVerifier() });
322
+ * ```
323
+ * `LocalSamlVerifier` uses xml-crypto and runs on Node.js and on
324
+ * Cloudflare Workers with the `nodejs_compat` flag.
325
+ */
326
+ samlVerifier?: SamlSignatureVerifier;
313
327
  /**
314
328
  * Auth0-style action hooks for auth flow events.
315
329
  */
@@ -1,6 +1,6 @@
1
1
  import type { SigningCertificateAuthority } from "../helpers/signing-certificate-authority";
2
2
  import { ActionCodeGenerator, CodeExecutor, DataAdapters } from "@authhero/adapter-interfaces";
3
- import type { SamlSigner } from "@authhero/saml/core";
3
+ import type { SamlSignatureVerifier, SamlSigner } from "@authhero/saml/core";
4
4
  import type { ManagementAudienceResolver } from "../middlewares/authentication";
5
5
  import { Hooks } from "./Hooks";
6
6
  import { ActionExecutionLogCapture, EntityHooksConfig, McpConfig, OutboxConfig, SigningKeyModeOption, RolloutControllerBinding, TenantOperationExecutorBinding, UserLinkingModeOption, UsernamePasswordProviderResolver, WebhookInvoker } from "./AuthHeroConfig";
@@ -33,6 +33,7 @@ export type Bindings = {
33
33
  ORGANIZATION_NAME: string;
34
34
  SAML_SIGN_URL?: string;
35
35
  samlSigner?: SamlSigner;
36
+ samlVerifier?: SamlSignatureVerifier;
36
37
  poweredByLogo?: {
37
38
  url: string;
38
39
  darkUrl?: string;
@@ -10,6 +10,8 @@ export interface SsrfFetchOptions {
10
10
  * `localhost`) are allowed. Intended for tests only.
11
11
  */
12
12
  allowPrivateHosts?: boolean;
13
+ /** The Accept header. Defaults to JSON, JWT and plain text. */
14
+ accept?: string;
13
15
  }
14
16
  /**
15
17
  * Build SSRF fetch options from the environment. In production only https and
@@ -2,11 +2,12 @@ import { Bindings } from "./types";
2
2
  export declare function getIssuer(env: Bindings, customDomain?: string): string;
3
3
  export declare function getUniversalLoginUrl(env: Bindings, customDomain?: string, routePrefix?: string): string;
4
4
  /**
5
- * Wildcard callback entries that always allow redirecting back to the auth
6
- * server itself (e.g. the /u/info and /u2/info test screens) without
7
- * per-client registration. The bases usually end in "/", so normalize before
8
- * appending "*" — a naive `${base}/*` yields a "//*" path whose wildcard
9
- * regex never matches a real pathname.
5
+ * Redirect targets on the auth server itself that every client may use
6
+ * without registering them: the /u/info and /u2/info test screens.
7
+ *
8
+ * These are exact URLs on purpose. A wildcard over the auth server's own host
9
+ * would make every endpoint on it a valid `redirect_uri` for every client,
10
+ * including the ones that redirect onward.
10
11
  */
11
- export declare function getSelfCallbackWildcards(env: Bindings, customDomain?: string): string[];
12
+ export declare function getSelfCallbacks(env: Bindings, customDomain?: string): string[];
12
13
  export declare function getAuthUrl(env: Bindings, customDomain?: string): string;
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "type": "git",
12
12
  "url": "https://github.com/sesamyab/authhero"
13
13
  },
14
- "version": "9.41.0",
14
+ "version": "9.42.0",
15
15
  "files": [
16
16
  "dist"
17
17
  ],
@@ -49,6 +49,7 @@
49
49
  "hono": "^4.12.30",
50
50
  "i18nexus-cli": "^3.8.2",
51
51
  "kysely": "^0.29.2",
52
+ "kysely-planetscale": "^1.5.0",
52
53
  "postcss": "8.5.15",
53
54
  "react": "^19.2.6",
54
55
  "react-dom": "^19.2.6",
@@ -63,8 +64,9 @@
63
64
  "vite": "^8.0.14",
64
65
  "vite-plugin-dts": "^4.5.4",
65
66
  "vitest": "^4.1.7",
66
- "@authhero/kysely-adapter": "12.25.0",
67
- "@authhero/widget": "0.43.1"
67
+ "xml-crypto": "^6.1.2",
68
+ "@authhero/kysely-adapter": "12.25.1",
69
+ "@authhero/widget": "0.43.2"
68
70
  },
69
71
  "dependencies": {
70
72
  "@peculiar/x509": "^1.14.3",
@@ -82,9 +84,9 @@
82
84
  "qrcode": "^1.5.4",
83
85
  "sanitize-html": "^2.17.4",
84
86
  "xstate": "^5.31.1",
85
- "@authhero/adapter-interfaces": "4.36.0",
86
- "@authhero/proxy": "0.11.23",
87
- "@authhero/saml": "0.6.16"
87
+ "@authhero/adapter-interfaces": "4.37.0",
88
+ "@authhero/proxy": "0.11.24",
89
+ "@authhero/saml": "0.7.0"
88
90
  },
89
91
  "peerDependencies": {
90
92
  "@authhero/widget": ">=0.38.9",
@@ -109,6 +111,7 @@
109
111
  "build": "pnpm build:i18n && pnpm build:emails && pnpm build:tailwind && pnpm build:client && tsc -p tsconfig.types.json && vite build && rollup -c rollup.dts.config.mjs && pnpm build:assets",
110
112
  "build:i18n": "node scripts/generate-locale-types.js",
111
113
  "build:emails": "tsx scripts/build-emails.tsx",
114
+ "login-migration": "tsx scripts/login-migration.ts",
112
115
  "build:tailwind": "node build-tailwind.js",
113
116
  "build:client": "vite build --mode client && node build-client.js",
114
117
  "build:assets": "node build-assets.js",