authhero 9.35.0 → 9.36.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 +72 -72
- package/dist/authhero.d.ts +141 -139
- package/dist/authhero.mjs +16605 -16119
- package/dist/{mfa-fD5vp7ql.mjs → mfa-B044FRjD.mjs} +22 -22
- package/dist/{mfa-XAWdFO9R.js → mfa-DPwn1ajo.js} +1 -1
- package/dist/mfa-attempts-BiU_pMOV.js +275 -0
- package/dist/{mfa-attempts-CpIqAsQd.mjs → mfa-attempts-DGOLb2oh.mjs} +6294 -6041
- package/dist/{passkey-enrollment-BB99mHdQ.js → passkey-enrollment-BDboqoaP.js} +1 -1
- package/dist/tsconfig.types.tsbuildinfo +1 -1
- package/dist/types/authentication-flows/passwordless.d.ts +5 -2
- package/dist/types/errors/management-api-error.d.ts +3 -0
- package/dist/types/helpers/database-connection-scope.d.ts +67 -0
- package/dist/types/helpers/dcr/metadata-mapping.d.ts +1 -1
- package/dist/types/helpers/reserved-claims.d.ts +2 -2
- package/dist/types/helpers/sso-access-tickets.d.ts +18 -0
- package/dist/types/helpers/users.d.ts +12 -2
- package/dist/types/index.d.ts +141 -139
- package/dist/types/routes/auth-api/index.d.ts +20 -18
- package/dist/types/routes/auth-api/passwordless.d.ts +10 -8
- package/dist/types/routes/auth-api/token.d.ts +10 -10
- package/dist/types/routes/management-api/action-executions.d.ts +2 -2
- package/dist/types/routes/management-api/actions.d.ts +1 -1
- package/dist/types/routes/management-api/authentication-methods.d.ts +1 -1
- package/dist/types/routes/management-api/branding.d.ts +13 -13
- package/dist/types/routes/management-api/client-grants.d.ts +9 -9
- package/dist/types/routes/management-api/custom-domains.d.ts +6 -6
- package/dist/types/routes/management-api/email-templates.d.ts +18 -18
- package/dist/types/routes/management-api/failed-events.d.ts +2 -2
- package/dist/types/routes/management-api/guardian.d.ts +5 -5
- package/dist/types/routes/management-api/helpers.d.ts +1 -1
- package/dist/types/routes/management-api/hook-code.d.ts +2 -2
- package/dist/types/routes/management-api/index.d.ts +116 -116
- package/dist/types/routes/management-api/keys.d.ts +12 -12
- package/dist/types/routes/management-api/log-streams.d.ts +6 -6
- package/dist/types/routes/management-api/logs.d.ts +4 -4
- package/dist/types/routes/management-api/migration-sources.d.ts +6 -6
- package/dist/types/routes/management-api/organizations.d.ts +5 -5
- package/dist/types/routes/management-api/prompts.d.ts +6 -6
- package/dist/types/routes/management-api/roles.d.ts +1 -1
- package/dist/types/routes/management-api/self-service-profiles.d.ts +345 -0
- package/dist/types/routes/management-api/tenant-operations.d.ts +10 -10
- package/dist/types/routes/management-api/tenants.d.ts +10 -10
- package/dist/types/routes/management-api/themes.d.ts +9 -9
- package/dist/types/routes/management-api/users.d.ts +17 -17
- package/dist/types/routes/universal-login/common.d.ts +8 -6
- package/dist/types/routes/universal-login/u2-index.d.ts +5 -5
- package/dist/types/routes/universal-login/u2-routes.d.ts +5 -5
- package/dist/types/state-machines/login-session.d.ts +1 -1
- package/dist/types/utils/username-password-provider.d.ts +14 -3
- package/package.json +6 -6
- package/dist/mfa-attempts-C7toCIRn.js +0 -275
|
@@ -39,6 +39,7 @@ export declare const passwordlessGrantParamsSchema: z.ZodObject<{
|
|
|
39
39
|
values: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
40
40
|
}, z.core.$strip>]>>>>;
|
|
41
41
|
}, z.core.$strip>>;
|
|
42
|
+
connection: z.ZodOptional<z.ZodString>;
|
|
42
43
|
vendor_id: z.ZodOptional<z.ZodString>;
|
|
43
44
|
}, z.core.$strip>>;
|
|
44
45
|
enforceIpCheck: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
@@ -149,6 +150,7 @@ export declare function passwordlessGrantUser(ctx: Context<{
|
|
|
149
150
|
values?: unknown[] | undefined;
|
|
150
151
|
} | null> | undefined;
|
|
151
152
|
} | undefined;
|
|
153
|
+
connection?: string | undefined;
|
|
152
154
|
vendor_id?: string | undefined;
|
|
153
155
|
};
|
|
154
156
|
expires_at: string;
|
|
@@ -173,8 +175,8 @@ export declare function passwordlessGrantUser(ctx: Context<{
|
|
|
173
175
|
authenticated_at?: string | undefined;
|
|
174
176
|
tenant_id?: string | undefined;
|
|
175
177
|
};
|
|
176
|
-
connectionType: "username" | "
|
|
177
|
-
authConnection: "username" | "
|
|
178
|
+
connectionType: "username" | "email" | "sms";
|
|
179
|
+
authConnection: "username" | "email" | "sms";
|
|
178
180
|
session_id: string | undefined;
|
|
179
181
|
authParams: {
|
|
180
182
|
audience?: string | undefined;
|
|
@@ -206,6 +208,7 @@ export declare function passwordlessGrantUser(ctx: Context<{
|
|
|
206
208
|
values?: unknown[] | undefined;
|
|
207
209
|
} | null> | undefined;
|
|
208
210
|
} | undefined;
|
|
211
|
+
connection?: string | undefined;
|
|
209
212
|
vendor_id?: string | undefined;
|
|
210
213
|
};
|
|
211
214
|
}>;
|
|
@@ -70,6 +70,7 @@ export declare const notFound: {
|
|
|
70
70
|
tenantOperation: () => JSONHTTPException;
|
|
71
71
|
rollout: () => JSONHTTPException;
|
|
72
72
|
tokenExchangeProfile: () => JSONHTTPException;
|
|
73
|
+
selfServiceProfile: () => JSONHTTPException;
|
|
73
74
|
};
|
|
74
75
|
/**
|
|
75
76
|
* 409s. `userExists`, `resourceServer` and `organizationName` are Auth0's
|
|
@@ -80,6 +81,8 @@ export declare const conflict: {
|
|
|
80
81
|
userExists: () => JSONHTTPException;
|
|
81
82
|
resourceServer: (identifier: string) => JSONHTTPException;
|
|
82
83
|
organizationName: () => JSONHTTPException;
|
|
84
|
+
selfServiceProfileLimit: () => JSONHTTPException;
|
|
85
|
+
connectionName: () => JSONHTTPException;
|
|
83
86
|
/** Any other AuthHero conflict: own message, shared code. */
|
|
84
87
|
other: (message: string) => JSONHTTPException;
|
|
85
88
|
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Connection, ConnectionsAdapter, User } from "@authhero/adapter-interfaces";
|
|
2
|
+
/**
|
|
3
|
+
* Scopes a database-user lookup to one database connection (#1702).
|
|
4
|
+
*
|
|
5
|
+
* Every database connection stores its users under the same `auth0` (or
|
|
6
|
+
* legacy `auth2`) provider, so `email:x provider:auth0` cannot tell two
|
|
7
|
+
* database connections apart. A scope narrows the provider-matched rows to
|
|
8
|
+
* the ones that belong to `name`.
|
|
9
|
+
*
|
|
10
|
+
* A row belongs to `name` when its `connection` is `name`, or when its
|
|
11
|
+
* `connection` names no database connection in the tenant at all. The second
|
|
12
|
+
* case covers legacy rows written with a literal instead of the connection's
|
|
13
|
+
* real name (`Username-Password-Authentication` on a tenant whose connection
|
|
14
|
+
* is called something else, `auth0`, `auth2`, or nothing). Those rows can't be
|
|
15
|
+
* attributed to one connection, so they stay visible to every scope, exactly
|
|
16
|
+
* as they are without one. Rows that do name another database connection of
|
|
17
|
+
* the tenant are hidden.
|
|
18
|
+
*/
|
|
19
|
+
export interface DatabaseConnectionScope {
|
|
20
|
+
/** The database connection the lookup targets. */
|
|
21
|
+
name: string;
|
|
22
|
+
/** Names of every database connection in the tenant, `name` included. */
|
|
23
|
+
databaseConnectionNames: ReadonlySet<string>;
|
|
24
|
+
}
|
|
25
|
+
/** True when `user` belongs to the scoped connection. No scope matches all. */
|
|
26
|
+
export declare function isUserInConnectionScope(user: Pick<User, "connection">, scope: DatabaseConnectionScope | undefined): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Order rows so an exact connection match comes before an unattributed legacy
|
|
29
|
+
* row. Only relevant once one identifier can exist in several connections.
|
|
30
|
+
*/
|
|
31
|
+
export declare function compareByConnectionScope(scope: DatabaseConnectionScope): (a: Pick<User, "connection">, b: Pick<User, "connection">) => number;
|
|
32
|
+
/**
|
|
33
|
+
* Build the scope for a lookup in database connection `name`.
|
|
34
|
+
*
|
|
35
|
+
* Returns `undefined` (an unscoped lookup, the behaviour before #1702) when:
|
|
36
|
+
* - no name is given,
|
|
37
|
+
* - the tenant has at most one database connection: there is nothing to tell
|
|
38
|
+
* apart, so single-connection tenants never change behaviour,
|
|
39
|
+
* - `name` is not one of the tenant's database connections, for example the
|
|
40
|
+
* generic `Username-Password-Authentication` realm on a tenant whose
|
|
41
|
+
* connection has another name.
|
|
42
|
+
*
|
|
43
|
+
* Lists connections without params so the read is served from the request's
|
|
44
|
+
* client bundle where one exists.
|
|
45
|
+
*/
|
|
46
|
+
export declare function resolveDatabaseConnectionScope(connections: Pick<ConnectionsAdapter, "list">, tenant_id: string, name: string | undefined): Promise<DatabaseConnectionScope | undefined>;
|
|
47
|
+
/**
|
|
48
|
+
* The database connection a login or signup for `client` targets. Lookups
|
|
49
|
+
* scope to it and new database users are written with it, so the two always
|
|
50
|
+
* agree.
|
|
51
|
+
*
|
|
52
|
+
* - An explicit realm other than the generic `Username-Password-Authentication`
|
|
53
|
+
* is used as is.
|
|
54
|
+
* - The generic realm (the default) resolves to a client connection carrying
|
|
55
|
+
* that exact name, else to the client's only database connection.
|
|
56
|
+
* - With several database connections on the client and none named like the
|
|
57
|
+
* generic realm, the generic name is returned. A user written with it is
|
|
58
|
+
* visible to every scope unless a tenant connection has that name, and
|
|
59
|
+
* {@link resolveDatabaseConnectionScope} leaves a lookup by it unscoped
|
|
60
|
+
* under the same condition.
|
|
61
|
+
*
|
|
62
|
+
* Choosing between several database connections on one client is #1703; this
|
|
63
|
+
* deliberately does not guess.
|
|
64
|
+
*/
|
|
65
|
+
export declare function resolveClientDatabaseConnectionName(client: {
|
|
66
|
+
connections: Pick<Connection, "name" | "strategy">[];
|
|
67
|
+
}, realm?: string): string;
|
|
@@ -24,10 +24,10 @@ export declare const dcrRequestSchema: z.ZodObject<{
|
|
|
24
24
|
response_types: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
25
25
|
token_endpoint_auth_method: z.ZodOptional<z.ZodEnum<{
|
|
26
26
|
none: "none";
|
|
27
|
+
private_key_jwt: "private_key_jwt";
|
|
27
28
|
client_secret_post: "client_secret_post";
|
|
28
29
|
client_secret_basic: "client_secret_basic";
|
|
29
30
|
client_secret_jwt: "client_secret_jwt";
|
|
30
|
-
private_key_jwt: "private_key_jwt";
|
|
31
31
|
}>>;
|
|
32
32
|
jwks_uri: z.ZodOptional<z.ZodString>;
|
|
33
33
|
jwks: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
@@ -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" | "org_name" | "
|
|
17
|
+
export declare const SERVICE_TOKEN_RESERVED_CLAIMS: ("tenant_id" | "client_id" | "org_name" | "jti" | "sub" | "scope" | "gty" | "org_id" | "sid" | "permissions" | "iat" | "exp" | "iss" | "aud" | "auth_time" | "acr" | "amr" | "nbf" | "act" | "requested_userinfo_claims")[];
|
|
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" | "org_name" | "
|
|
19
|
+
export declare const CLIENT_SERVICE_TOKEN_RESERVED_CLAIMS: ("tenant_id" | "client_id" | "org_name" | "jti" | "sub" | "scope" | "azp" | "gty" | "org_id" | "sid" | "permissions" | "iat" | "exp" | "iss" | "aud" | "auth_time" | "acr" | "amr" | "nbf" | "act" | "requested_userinfo_claims")[];
|
|
20
20
|
export type AccessTokenReservedClaim = (typeof ACCESS_TOKEN_RESERVED_CLAIMS)[number];
|
|
21
21
|
export type IdTokenReservedClaim = (typeof ID_TOKEN_RESERVED_CLAIMS)[number];
|
|
22
22
|
/**
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Self-Service SSO access tickets (#1763). The ticket id is the bearer value
|
|
3
|
+
* in the ticket URL: random, returned once, and stored only as its hash.
|
|
4
|
+
*/
|
|
5
|
+
/** Default and maximum ticket lifetime. Auth0's default is 5 days. */
|
|
6
|
+
export declare const SSO_TICKET_DEFAULT_TTL_SEC = 432000;
|
|
7
|
+
export declare const SSO_TICKET_MAX_TTL_SEC: number;
|
|
8
|
+
/** A new ticket id: 32 random bytes, base64url (43 characters). */
|
|
9
|
+
export declare function generateSsoTicketId(): string;
|
|
10
|
+
/** The stored form of a ticket id: hex SHA-256. */
|
|
11
|
+
export declare function hashSsoTicketId(ticketId: string): Promise<string>;
|
|
12
|
+
/** The setup assistant's path on the tenant's own domain. */
|
|
13
|
+
export declare const SSO_TICKET_PATH = "u2/self-service";
|
|
14
|
+
/**
|
|
15
|
+
* The request path with an SSO ticket id replaced, for logs: a log reader
|
|
16
|
+
* must never get a usable ticket (a failed revoke leaves it valid).
|
|
17
|
+
*/
|
|
18
|
+
export declare function redactSsoTicketPath(path: string): string;
|
|
@@ -2,6 +2,7 @@ import { ConnectionSelfService, User, UserDataAdapter } from "@authhero/adapter-
|
|
|
2
2
|
import { EnrichedClient } from "./client";
|
|
3
3
|
import { Context } from "hono";
|
|
4
4
|
import { Bindings, Variables } from "../types";
|
|
5
|
+
import { DatabaseConnectionScope } from "./database-connection-scope";
|
|
5
6
|
export declare function getUsersByEmail(userAdapter: UserDataAdapter, tenantId: string, email: string): Promise<User[]>;
|
|
6
7
|
/**
|
|
7
8
|
* Every user sharing `email`, across all pages.
|
|
@@ -20,8 +21,15 @@ interface GetUserByProviderParams {
|
|
|
20
21
|
tenant_id: string;
|
|
21
22
|
username: string;
|
|
22
23
|
provider: string;
|
|
24
|
+
/**
|
|
25
|
+
* Limit the match to one database connection. Every database connection
|
|
26
|
+
* shares the `auth0` provider, so without a scope a lookup can return a
|
|
27
|
+
* user from another database connection. Build it with
|
|
28
|
+
* `resolveDatabaseConnectionScope`; `undefined` keeps the unscoped lookup.
|
|
29
|
+
*/
|
|
30
|
+
connection?: DatabaseConnectionScope;
|
|
23
31
|
}
|
|
24
|
-
export declare function getUserByProvider({ userAdapter, tenant_id, username, provider, }: GetUserByProviderParams): Promise<User | null>;
|
|
32
|
+
export declare function getUserByProvider({ userAdapter, tenant_id, username, provider, connection, }: GetUserByProviderParams): Promise<User | null>;
|
|
25
33
|
/**
|
|
26
34
|
* Order users by age (oldest first). When account-linking has to choose
|
|
27
35
|
* which of two matching users should remain primary, the older account
|
|
@@ -268,8 +276,10 @@ interface GetPrimaryUserByProviderParams {
|
|
|
268
276
|
tenant_id: string;
|
|
269
277
|
username: string;
|
|
270
278
|
provider: string;
|
|
279
|
+
/** See {@link GetUserByProviderParams.connection}. */
|
|
280
|
+
connection?: DatabaseConnectionScope;
|
|
271
281
|
}
|
|
272
|
-
export declare function getPrimaryUserByProvider({ userAdapter, tenant_id, username, provider, }: GetPrimaryUserByProviderParams): Promise<User | null>;
|
|
282
|
+
export declare function getPrimaryUserByProvider({ userAdapter, tenant_id, username, provider, connection, }: GetPrimaryUserByProviderParams): Promise<User | null>;
|
|
273
283
|
interface GetOrCreateUserByProviderParams {
|
|
274
284
|
client: EnrichedClient;
|
|
275
285
|
username: string;
|