authhero 9.35.0 → 9.37.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 +144 -141
- package/dist/authhero.d.ts +562 -369
- package/dist/authhero.mjs +13530 -11568
- package/dist/{mfa-fD5vp7ql.mjs → mfa-BpHxTir1.mjs} +25 -25
- package/dist/{mfa-XAWdFO9R.js → mfa-DuNbh_YF.js} +1 -1
- package/dist/mfa-attempts-D5U1FCSY.js +275 -0
- package/dist/{mfa-attempts-CpIqAsQd.mjs → mfa-attempts-DDgCBTDW.mjs} +6022 -5686
- package/dist/{passkey-enrollment-BB99mHdQ.js → passkey-enrollment-D6ZZmelw.js} +1 -1
- package/dist/tsconfig.types.tsbuildinfo +1 -1
- package/dist/types/authentication-flows/email-verification.d.ts +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/generated/locale-types.d.ts +87 -0
- package/dist/types/helpers/anchor-client.d.ts +16 -0
- package/dist/types/helpers/database-connection-scope.d.ts +97 -0
- package/dist/types/helpers/dcr/audience-policy.d.ts +13 -0
- package/dist/types/helpers/dcr/client-registration.d.ts +81 -0
- package/dist/types/helpers/dcr/constraint-enforcement.d.ts +1 -0
- package/dist/types/helpers/dcr/metadata-mapping.d.ts +17 -0
- package/dist/types/helpers/dcr/mint-iat.d.ts +4 -1
- package/dist/types/helpers/dcr/mint-token.d.ts +4 -0
- package/dist/types/helpers/dcr/presets.d.ts +34 -0
- package/dist/types/helpers/dcr/uri-policy.d.ts +34 -0
- package/dist/types/helpers/password-connection.d.ts +3 -1
- package/dist/types/helpers/reserved-claims.d.ts +2 -2
- package/dist/types/helpers/self-service-tickets.d.ts +34 -0
- package/dist/types/helpers/sso-access-tickets.d.ts +18 -0
- package/dist/types/helpers/users.d.ts +29 -4
- package/dist/types/index.d.ts +502 -310
- package/dist/types/routes/auth-api/authenticate.d.ts +1 -1
- package/dist/types/routes/auth-api/dbconnections.d.ts +2 -2
- package/dist/types/routes/auth-api/device.d.ts +8 -8
- package/dist/types/routes/auth-api/index.d.ts +54 -37
- package/dist/types/routes/auth-api/passwordless.d.ts +18 -16
- package/dist/types/routes/auth-api/register/index.d.ts +15 -0
- package/dist/types/routes/auth-api/token.d.ts +10 -10
- package/dist/types/routes/management-api/action-executions.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/client-registration-tokens.d.ts +149 -0
- package/dist/types/routes/management-api/connections.d.ts +1 -1
- 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/forms.d.ts +144 -144
- 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/index.d.ts +411 -266
- package/dist/types/routes/management-api/keys.d.ts +16 -16
- 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/rollouts.d.ts +6 -6
- package/dist/types/routes/management-api/self-service-profiles.d.ts +345 -0
- package/dist/types/routes/management-api/tenant-export-import.d.ts +5 -5
- package/dist/types/routes/management-api/tenant-operations.d.ts +10 -10
- package/dist/types/routes/management-api/tenants.d.ts +17 -17
- 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 +10 -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/connect-authz.d.ts +9 -0
- package/dist/types/routes/universal-login/screens/self-service-app.d.ts +46 -0
- package/dist/types/routes/universal-login/u2-index.d.ts +35 -5
- package/dist/types/routes/universal-login/u2-routes.d.ts +35 -5
- package/dist/types/state-machines/login-session.d.ts +19 -1
- package/dist/types/types/Bindings.d.ts +2 -0
- package/dist/types/utils/username-password-provider.d.ts +14 -3
- package/package.json +6 -6
- package/dist/mfa-attempts-C7toCIRn.js +0 -275
|
@@ -38,7 +38,7 @@ export declare function setPendingLoginEmailVerification(ctx: Context<{
|
|
|
38
38
|
* to "code" like the u2 password reset, so the user stays on the login page
|
|
39
39
|
* instead of depending on an emailed link.
|
|
40
40
|
*/
|
|
41
|
-
export declare function getEmailVerificationMethod(client: EnrichedClient): EmailVerificationMethod;
|
|
41
|
+
export declare function getEmailVerificationMethod(client: EnrichedClient, requested?: string): EmailVerificationMethod;
|
|
42
42
|
/**
|
|
43
43
|
* Mint a one-time code bound to the login session and email it. The code is
|
|
44
44
|
* only issued after the password has been validated, so redeeming it proves
|
|
@@ -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
|
};
|
|
@@ -963,6 +963,90 @@ export interface StatusScreen {
|
|
|
963
963
|
successTitle: () => string;
|
|
964
964
|
title: () => string;
|
|
965
965
|
}
|
|
966
|
+
export interface SelfServiceSelfServiceAppScreen {
|
|
967
|
+
title: () => string;
|
|
968
|
+
description: (vars: {
|
|
969
|
+
tenantName: string;
|
|
970
|
+
}) => string;
|
|
971
|
+
editTitle: (vars: {
|
|
972
|
+
appName: string;
|
|
973
|
+
}) => string;
|
|
974
|
+
editDescription: (vars: {
|
|
975
|
+
appName: string;
|
|
976
|
+
}) => string;
|
|
977
|
+
expiresText: (vars: {
|
|
978
|
+
date: string;
|
|
979
|
+
}) => string;
|
|
980
|
+
appTypeLabel: () => string;
|
|
981
|
+
appTypeNative: () => string;
|
|
982
|
+
appTypeSpa: () => string;
|
|
983
|
+
appTypeRegularWeb: () => string;
|
|
984
|
+
nameLabel: () => string;
|
|
985
|
+
callbacksLabel: () => string;
|
|
986
|
+
callbacksHintNative: () => string;
|
|
987
|
+
callbacksHintWeb: () => string;
|
|
988
|
+
logoutUrlsLabel: () => string;
|
|
989
|
+
webOriginsLabel: () => string;
|
|
990
|
+
webOriginsHint: () => string;
|
|
991
|
+
logoUrlLabel: () => string;
|
|
992
|
+
websiteLabel: () => string;
|
|
993
|
+
privacyLabel: () => string;
|
|
994
|
+
termsLabel: () => string;
|
|
995
|
+
contactLabel: () => string;
|
|
996
|
+
registerButton: () => string;
|
|
997
|
+
saveButton: () => string;
|
|
998
|
+
savedText: () => string;
|
|
999
|
+
clientIdLabel: () => string;
|
|
1000
|
+
requiredError: () => string;
|
|
1001
|
+
invalidValueError: () => string;
|
|
1002
|
+
uriTooMany: () => string;
|
|
1003
|
+
uriTooLong: () => string;
|
|
1004
|
+
uriInvalid: (vars: {
|
|
1005
|
+
value: string;
|
|
1006
|
+
}) => string;
|
|
1007
|
+
uriWildcard: (vars: {
|
|
1008
|
+
value: string;
|
|
1009
|
+
}) => string;
|
|
1010
|
+
uriFragment: (vars: {
|
|
1011
|
+
value: string;
|
|
1012
|
+
}) => string;
|
|
1013
|
+
uriUserinfo: (vars: {
|
|
1014
|
+
value: string;
|
|
1015
|
+
}) => string;
|
|
1016
|
+
uriHttpNotLoopback: (vars: {
|
|
1017
|
+
value: string;
|
|
1018
|
+
}) => string;
|
|
1019
|
+
uriSchemeNotAllowed: (vars: {
|
|
1020
|
+
value: string;
|
|
1021
|
+
}) => string;
|
|
1022
|
+
uriCustomSchemeNeedsDot: (vars: {
|
|
1023
|
+
value: string;
|
|
1024
|
+
}) => string;
|
|
1025
|
+
uriOriginOnly: (vars: {
|
|
1026
|
+
value: string;
|
|
1027
|
+
}) => string;
|
|
1028
|
+
uriNotForNative: () => string;
|
|
1029
|
+
errorText: () => string;
|
|
1030
|
+
}
|
|
1031
|
+
export interface SelfServiceSelfServiceAppDoneScreen {
|
|
1032
|
+
title: () => string;
|
|
1033
|
+
description: (vars: {
|
|
1034
|
+
appName: string;
|
|
1035
|
+
}) => string;
|
|
1036
|
+
clientIdLabel: () => string;
|
|
1037
|
+
domainLabel: () => string;
|
|
1038
|
+
discoveryLabel: () => string;
|
|
1039
|
+
clientSecretLabel: () => string;
|
|
1040
|
+
clientSecretWarning: () => string;
|
|
1041
|
+
pkceNote: () => string;
|
|
1042
|
+
editLaterText: (vars: {
|
|
1043
|
+
tenantName: string;
|
|
1044
|
+
}) => string;
|
|
1045
|
+
}
|
|
1046
|
+
export interface SelfServiceSelfServiceTicketInvalidScreen {
|
|
1047
|
+
title: () => string;
|
|
1048
|
+
description: () => string;
|
|
1049
|
+
}
|
|
966
1050
|
export interface ScreenMap {
|
|
967
1051
|
"common.common": CommonScreen;
|
|
968
1052
|
"common.account": CommonAccountScreen;
|
|
@@ -1010,4 +1094,7 @@ export interface ScreenMap {
|
|
|
1010
1094
|
"signup-password.signup-password": SignupPasswordScreen;
|
|
1011
1095
|
"sms-otp-challenge.sms-otp-challenge": SmsOtpChallengeScreen;
|
|
1012
1096
|
"status.status": StatusScreen;
|
|
1097
|
+
"self-service.self-service-app": SelfServiceSelfServiceAppScreen;
|
|
1098
|
+
"self-service.self-service-app-done": SelfServiceSelfServiceAppDoneScreen;
|
|
1099
|
+
"self-service.self-service-ticket-invalid": SelfServiceSelfServiceTicketInvalidScreen;
|
|
1013
1100
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Context } from "hono";
|
|
2
|
+
import type { Client, Tenant } from "@authhero/adapter-interfaces";
|
|
3
|
+
import type { Bindings, Variables } from "../types";
|
|
4
|
+
/**
|
|
5
|
+
* The client a tenant-level browser flow (the /connect/start consent, the
|
|
6
|
+
* developer app setup page) anchors its login session to. The session is only
|
|
7
|
+
* used to carry state through u2 screens; the anchor client_id is never
|
|
8
|
+
* traversed in an OAuth flow. Prefers the tenant's `default_client_id`
|
|
9
|
+
* (analogous to Auth0's Default App) so branding stays deterministic, and
|
|
10
|
+
* falls back to the first *interactive* client — never an M2M client, which
|
|
11
|
+
* can't render a screen. Returns null when the tenant has neither.
|
|
12
|
+
*/
|
|
13
|
+
export declare function resolveAnchorClient(ctx: Context<{
|
|
14
|
+
Bindings: Bindings;
|
|
15
|
+
Variables: Variables;
|
|
16
|
+
}>, tenant: Tenant): Promise<Client | null>;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { Connection, ConnectionsAdapter, User } from "@authhero/adapter-interfaces";
|
|
2
|
+
import { JSONHTTPException } from "../errors/json-http-exception";
|
|
3
|
+
/**
|
|
4
|
+
* Scopes a database-user lookup to one database connection (#1702).
|
|
5
|
+
*
|
|
6
|
+
* Every database connection stores its users under the same `auth0` (or
|
|
7
|
+
* legacy `auth2`) provider, so `email:x provider:auth0` cannot tell two
|
|
8
|
+
* database connections apart. A scope narrows the provider-matched rows to
|
|
9
|
+
* the ones that belong to `name`.
|
|
10
|
+
*
|
|
11
|
+
* A row belongs to `name` when its `connection` is `name`, or when its
|
|
12
|
+
* `connection` names no database connection in the tenant at all. The second
|
|
13
|
+
* case covers legacy rows written with a literal instead of the connection's
|
|
14
|
+
* real name (`Username-Password-Authentication` on a tenant whose connection
|
|
15
|
+
* is called something else, `auth0`, `auth2`, or nothing). Those rows can't be
|
|
16
|
+
* attributed to one connection, so they stay visible to every scope, exactly
|
|
17
|
+
* as they are without one. Rows that do name another database connection of
|
|
18
|
+
* the tenant are hidden.
|
|
19
|
+
*/
|
|
20
|
+
export interface DatabaseConnectionScope {
|
|
21
|
+
/** The database connection the lookup targets. */
|
|
22
|
+
name: string;
|
|
23
|
+
/** Names of every database connection in the tenant, `name` included. */
|
|
24
|
+
databaseConnectionNames: ReadonlySet<string>;
|
|
25
|
+
}
|
|
26
|
+
/** True when `user` belongs to the scoped connection. No scope matches all. */
|
|
27
|
+
export declare function isUserInConnectionScope(user: {
|
|
28
|
+
connection?: string;
|
|
29
|
+
}, scope: DatabaseConnectionScope | undefined): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Order rows so an exact connection match comes before an unattributed legacy
|
|
32
|
+
* row. Only relevant once one identifier can exist in several connections.
|
|
33
|
+
*/
|
|
34
|
+
export declare function compareByConnectionScope(scope: DatabaseConnectionScope): (a: Pick<User, "connection">, b: Pick<User, "connection">) => number;
|
|
35
|
+
/**
|
|
36
|
+
* Build the scope for a lookup in database connection `name`.
|
|
37
|
+
*
|
|
38
|
+
* Returns `undefined` (an unscoped lookup, the behaviour before #1702) when:
|
|
39
|
+
* - no name is given,
|
|
40
|
+
* - the tenant has at most one database connection: there is nothing to tell
|
|
41
|
+
* apart, so single-connection tenants never change behaviour,
|
|
42
|
+
* - `name` is not one of the tenant's database connections, for example the
|
|
43
|
+
* generic `Username-Password-Authentication` realm on a tenant whose
|
|
44
|
+
* connection has another name.
|
|
45
|
+
*
|
|
46
|
+
* The name set must cover every database connection in the tenant, or a row
|
|
47
|
+
* of a missing connection would pass the scope; see
|
|
48
|
+
* {@link listAllTenantConnections}.
|
|
49
|
+
*/
|
|
50
|
+
export declare function resolveDatabaseConnectionScope(connections: Pick<ConnectionsAdapter, "list">, tenant_id: string, name: string | undefined): Promise<DatabaseConnectionScope | undefined>;
|
|
51
|
+
/**
|
|
52
|
+
* The database connection a login, signup or password reset for `client`
|
|
53
|
+
* uses (#1703). This is the one place that decides it; lookups scope to it and
|
|
54
|
+
* new database users are written with it, so the two always agree.
|
|
55
|
+
*
|
|
56
|
+
* Auth0's rule, in order:
|
|
57
|
+
* 1. A connection the request names (`/authorize` `connection`, carried on the
|
|
58
|
+
* login session as `authParams.connection`; the password-realm `realm`; the
|
|
59
|
+
* `/dbconnections` `connection` field) is used when it is a database
|
|
60
|
+
* connection enabled on the client. A name that isn't enabled on the client
|
|
61
|
+
* is rejected, never replaced by another connection.
|
|
62
|
+
* 2. Otherwise the client's first enabled database connection, in the
|
|
63
|
+
* client's stored order. A client with no explicit connection list (it
|
|
64
|
+
* falls back to every tenant connection, as CIMD clients do) gets its
|
|
65
|
+
* database connections oldest first, see
|
|
66
|
+
* {@link orderFallbackDatabaseConnections}, so this is the tenant's oldest.
|
|
67
|
+
*
|
|
68
|
+
* `Username-Password-Authentication` is the generic realm that callers from
|
|
69
|
+
* before named database connections send for "this client's database
|
|
70
|
+
* connection". It names a connection when one has that exact name, and
|
|
71
|
+
* otherwise means "no explicit choice".
|
|
72
|
+
*
|
|
73
|
+
* Returns `undefined` when the client has no database connection.
|
|
74
|
+
*/
|
|
75
|
+
export declare function resolveClientDatabaseConnection<T extends Pick<Connection, "name" | "strategy">>(client: {
|
|
76
|
+
connections: T[];
|
|
77
|
+
}, requested?: string): T | undefined;
|
|
78
|
+
/**
|
|
79
|
+
* Name of the connection {@link resolveClientDatabaseConnection} picks, or the
|
|
80
|
+
* generic `Username-Password-Authentication` when the client has no database
|
|
81
|
+
* connection (the name such users were always written with).
|
|
82
|
+
*/
|
|
83
|
+
export declare function resolveClientDatabaseConnectionName(client: {
|
|
84
|
+
connections: Pick<Connection, "name" | "strategy">[];
|
|
85
|
+
}, requested?: string): string;
|
|
86
|
+
/** A request named a connection that isn't a database connection of the client. */
|
|
87
|
+
export declare function databaseConnectionNotEnabled(name: string): JSONHTTPException;
|
|
88
|
+
/**
|
|
89
|
+
* Order a client's fallback connection list (every tenant connection, used
|
|
90
|
+
* when the client enables none explicitly) so its database connections come
|
|
91
|
+
* oldest first. Only the database connections move, within the slots they
|
|
92
|
+
* already hold, so the order of login buttons doesn't change.
|
|
93
|
+
*
|
|
94
|
+
* Oldest is by `created_at`; a connection without one (imported or seeded
|
|
95
|
+
* rows) counts as newest, and ties break on id.
|
|
96
|
+
*/
|
|
97
|
+
export declare function orderFallbackDatabaseConnections<T extends Connection>(connections: T[]): T[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Context } from "hono";
|
|
2
|
+
import type { Bindings, Variables } from "../../types";
|
|
3
|
+
/**
|
|
4
|
+
* Dynamic Client Registration never provisions a client grant for the
|
|
5
|
+
* Management API: the built-in `urn:authhero:management` identifier and any
|
|
6
|
+
* extra management audiences the deployment accepts
|
|
7
|
+
* (`init({ additionalManagementAudiences })`). Clients that need Management
|
|
8
|
+
* API access are created through the Management API itself.
|
|
9
|
+
*/
|
|
10
|
+
export declare function isRegistrationDeniedAudience(ctx: Context<{
|
|
11
|
+
Bindings: Bindings;
|
|
12
|
+
Variables: Variables;
|
|
13
|
+
}>, tenantId: string, audience: string): Promise<boolean>;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { Context } from "hono";
|
|
2
|
+
import type { ContentfulStatusCode } from "hono/utils/http-status";
|
|
3
|
+
import { type Client, type ClientRegistrationToken, type Tenant } from "@authhero/adapter-interfaces";
|
|
4
|
+
import type { Bindings, Variables } from "../../types";
|
|
5
|
+
import { JSONHTTPException } from "../../errors/json-http-exception";
|
|
6
|
+
import { type DcrRequest } from "./metadata-mapping";
|
|
7
|
+
import { type AppPreset } from "./presets";
|
|
8
|
+
import { type UriViolation } from "./uri-policy";
|
|
9
|
+
type Ctx = Context<{
|
|
10
|
+
Bindings: Bindings;
|
|
11
|
+
Variables: Variables;
|
|
12
|
+
}>;
|
|
13
|
+
/** Registration access tokens of invite-created apps expire after 7 days. */
|
|
14
|
+
export declare const INVITE_REGISTRATION_ACCESS_TOKEN_TTL_SEC: number;
|
|
15
|
+
/**
|
|
16
|
+
* A rejected registration or update. `field` names the metadata field at
|
|
17
|
+
* fault (in wire form) so the setup page can show the error next to it.
|
|
18
|
+
*/
|
|
19
|
+
export declare class DcrMetadataError extends JSONHTTPException {
|
|
20
|
+
readonly field?: string;
|
|
21
|
+
readonly description: string;
|
|
22
|
+
/** Set when a URL broke the developer URL rules (see uri-policy.ts). */
|
|
23
|
+
readonly uriViolation?: UriViolation;
|
|
24
|
+
constructor(error: string, description: string, field?: string, status?: ContentfulStatusCode, uriViolation?: UriViolation);
|
|
25
|
+
}
|
|
26
|
+
export declare function readIatConstraints(registrationMetadata: Record<string, unknown> | undefined): Record<string, unknown> | undefined;
|
|
27
|
+
export interface RegisterClientOptions {
|
|
28
|
+
/**
|
|
29
|
+
* Return a registration access token, as `POST /oidc/register` does. The
|
|
30
|
+
* setup page does not: the developer gets no standing access and asks the
|
|
31
|
+
* operator for an edit link instead.
|
|
32
|
+
*/
|
|
33
|
+
issueRegistrationAccessToken: boolean;
|
|
34
|
+
}
|
|
35
|
+
export interface RegisteredClient {
|
|
36
|
+
client: Client;
|
|
37
|
+
/** Only for confidential clients; shown once. */
|
|
38
|
+
client_secret?: string;
|
|
39
|
+
registration_access_token?: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* RFC 7591 registration shared by `POST /oidc/register` and the developer
|
|
43
|
+
* setup page. `iat` is the authenticated Initial Access Token, or undefined
|
|
44
|
+
* for open registration. The token is marked used in the same transaction
|
|
45
|
+
* that creates the client.
|
|
46
|
+
*/
|
|
47
|
+
export declare function registerClient(ctx: Ctx, tenant: Tenant, iat: ClientRegistrationToken | undefined, body: DcrRequest, options: RegisterClientOptions): Promise<RegisteredClient>;
|
|
48
|
+
/**
|
|
49
|
+
* Fields an outside developer may change after registration, through an edit
|
|
50
|
+
* link or (for invite-created apps) RFC 7592. Everything else stays as the
|
|
51
|
+
* operator configured it.
|
|
52
|
+
*/
|
|
53
|
+
export declare const EDITABLE_FIELDS: readonly ["client_name", "logo_uri", "redirect_uris", "post_logout_redirect_uris", "web_origins", "client_uri", "policy_uri", "tos_uri", "contacts"];
|
|
54
|
+
export type EditableField = (typeof EDITABLE_FIELDS)[number];
|
|
55
|
+
export interface UpdateRegisteredClientOptions {
|
|
56
|
+
/**
|
|
57
|
+
* Restrict the update to `EDITABLE_FIELDS`: other fields must be omitted
|
|
58
|
+
* (kept as stored) or equal to the stored value. Used for edit links and
|
|
59
|
+
* for every app created from an invite preset.
|
|
60
|
+
*/
|
|
61
|
+
editableFieldsOnly: boolean;
|
|
62
|
+
}
|
|
63
|
+
export interface UpdatedClient {
|
|
64
|
+
client: Client;
|
|
65
|
+
/** Wire names of the editable fields whose value changed. */
|
|
66
|
+
changed: string[];
|
|
67
|
+
}
|
|
68
|
+
/** The app type whose URL rules apply when editing `client`. */
|
|
69
|
+
export declare function editPolicyAppType(client: Client): AppPreset;
|
|
70
|
+
/**
|
|
71
|
+
* RFC 7592 update shared by `PUT /oidc/register/{client_id}` and the
|
|
72
|
+
* developer setup page.
|
|
73
|
+
*/
|
|
74
|
+
export declare function updateRegisteredClient(ctx: Ctx, tenant: Tenant, existing: Client, body: DcrRequest, options: UpdateRegisteredClientOptions): Promise<UpdatedClient>;
|
|
75
|
+
/**
|
|
76
|
+
* Whether RFC 7592 updates to this client are limited to `EDITABLE_FIELDS`:
|
|
77
|
+
* always through an edit link, and for every app created from an invite
|
|
78
|
+
* preset.
|
|
79
|
+
*/
|
|
80
|
+
export declare function updatesRestrictedToEditableFields(client: Client, token: ClientRegistrationToken): boolean;
|
|
81
|
+
export {};
|
|
@@ -36,6 +36,12 @@ export declare const dcrRequestSchema: z.ZodObject<{
|
|
|
36
36
|
client_id: z.ZodOptional<z.ZodString>;
|
|
37
37
|
client_secret: z.ZodOptional<z.ZodString>;
|
|
38
38
|
audience: z.ZodOptional<z.ZodString>;
|
|
39
|
+
application_type: z.ZodOptional<z.ZodEnum<{
|
|
40
|
+
native: "native";
|
|
41
|
+
web: "web";
|
|
42
|
+
}>>;
|
|
43
|
+
post_logout_redirect_uris: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
44
|
+
web_origins: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
39
45
|
}, z.core.$strip>;
|
|
40
46
|
export type DcrRequest = z.infer<typeof dcrRequestSchema>;
|
|
41
47
|
export declare const dcrResponseSchema: z.ZodObject<{
|
|
@@ -59,6 +65,12 @@ export declare const dcrResponseSchema: z.ZodObject<{
|
|
|
59
65
|
jwks_uri: z.ZodOptional<z.ZodString>;
|
|
60
66
|
software_id: z.ZodOptional<z.ZodString>;
|
|
61
67
|
software_version: z.ZodOptional<z.ZodString>;
|
|
68
|
+
application_type: z.ZodOptional<z.ZodEnum<{
|
|
69
|
+
native: "native";
|
|
70
|
+
web: "web";
|
|
71
|
+
}>>;
|
|
72
|
+
post_logout_redirect_uris: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
73
|
+
web_origins: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
62
74
|
}, z.core.$strip>;
|
|
63
75
|
export type DcrResponse = z.infer<typeof dcrResponseSchema>;
|
|
64
76
|
export interface RegistrationMapping {
|
|
@@ -67,6 +79,11 @@ export interface RegistrationMapping {
|
|
|
67
79
|
/** Additional metadata preserved on the client for round-trip. */
|
|
68
80
|
extraMetadata: Record<string, unknown>;
|
|
69
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* OIDC `application_type` to Auth0 `app_type`. A browser app (`web`) without
|
|
84
|
+
* a client secret is a single-page app.
|
|
85
|
+
*/
|
|
86
|
+
export declare function appTypeFromApplicationType(applicationType: "web" | "native", tokenEndpointAuthMethod: string | undefined): "native" | "spa" | "regular_web";
|
|
70
87
|
/**
|
|
71
88
|
* Map an RFC 7591 DCR request to internal Client fields.
|
|
72
89
|
*/
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import type { ClientRegistrationToken, ClientRegistrationTokensAdapter } from "@authhero/adapter-interfaces";
|
|
1
|
+
import type { ClientRegistrationToken, ClientRegistrationTokenSource, ClientRegistrationTokensAdapter } from "@authhero/adapter-interfaces";
|
|
2
2
|
export interface MintIatOptions {
|
|
3
3
|
sub?: string;
|
|
4
4
|
constraints?: Record<string, unknown>;
|
|
5
5
|
expires_in_seconds?: number;
|
|
6
6
|
single_use?: boolean;
|
|
7
|
+
name?: string;
|
|
8
|
+
created_by?: string;
|
|
9
|
+
source?: ClientRegistrationTokenSource;
|
|
7
10
|
}
|
|
8
11
|
export interface MintedIat {
|
|
9
12
|
id: string;
|
|
@@ -3,5 +3,9 @@ export interface GeneratedRegistrationToken {
|
|
|
3
3
|
token: string;
|
|
4
4
|
token_hash: string;
|
|
5
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* Registration tokens (IATs, RATs) are self-service tickets: an invite or
|
|
8
|
+
* edit link carries the token itself as its ticket id.
|
|
9
|
+
*/
|
|
6
10
|
export declare function hashRegistrationToken(token: string): Promise<string>;
|
|
7
11
|
export declare function mintRegistrationToken(): Promise<GeneratedRegistrationToken>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* App-type presets for developer invites (#1776). A preset is expanded into
|
|
3
|
+
* Initial Access Token constraints, so the restrictions hold whether the
|
|
4
|
+
* developer registers through the setup page or calls `POST /oidc/register`
|
|
5
|
+
* with the token directly. No machine-to-machine preset: invites are for
|
|
6
|
+
* interactive apps.
|
|
7
|
+
*/
|
|
8
|
+
export declare const APP_PRESETS: readonly ["native", "spa", "regular_web"];
|
|
9
|
+
export type AppPreset = (typeof APP_PRESETS)[number];
|
|
10
|
+
export declare function isAppPreset(value: unknown): value is AppPreset;
|
|
11
|
+
/**
|
|
12
|
+
* Constraint keys only an operator may set (on the IAT). They are not RFC 7591
|
|
13
|
+
* metadata, the request schema drops them, and registration reads them from
|
|
14
|
+
* the token's constraints only:
|
|
15
|
+
* - `app_type`: the preset (`native`, `spa`, `regular_web`)
|
|
16
|
+
* - `is_first_party`: whether the app skips the consent screen
|
|
17
|
+
* - `connections`: connection ids the app may use; unset means all
|
|
18
|
+
* - `require_pkce`: PKCE with S256 is required at /authorize
|
|
19
|
+
*/
|
|
20
|
+
export interface OperatorConstraints {
|
|
21
|
+
app_type?: AppPreset;
|
|
22
|
+
is_first_party?: boolean;
|
|
23
|
+
connections?: string[];
|
|
24
|
+
require_pkce?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export declare function readOperatorConstraints(constraints: Record<string, unknown> | undefined): OperatorConstraints;
|
|
27
|
+
/**
|
|
28
|
+
* The constraints a preset pins. Every preset is a code-flow app with refresh
|
|
29
|
+
* tokens and PKCE; native and single-page apps are public clients (no
|
|
30
|
+
* secret), regular web apps use `client_secret_post` (Auth0's default).
|
|
31
|
+
*/
|
|
32
|
+
export declare function presetConstraints(preset: AppPreset): Record<string, unknown>;
|
|
33
|
+
/** Which preset (if any) a registered client was created from. */
|
|
34
|
+
export declare function clientPreset(registrationMetadata: Record<string, unknown> | undefined): AppPreset | undefined;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { AppPreset } from "./presets";
|
|
2
|
+
/**
|
|
3
|
+
* URL rules for apps registered or edited by an outside developer (#1776):
|
|
4
|
+
* invite-created apps and apps edited through an edit link.
|
|
5
|
+
*
|
|
6
|
+
* - Every URL: no wildcards, no fragment, no userinfo, at most 1024
|
|
7
|
+
* characters; at most 20 entries per list.
|
|
8
|
+
* - https is always allowed. http only on a loopback host (`localhost`,
|
|
9
|
+
* `127.0.0.1`, `[::1]`), any port, for local development (RFC 8252 §7.3).
|
|
10
|
+
* - Native apps may also use a private-use URI scheme containing a dot, e.g.
|
|
11
|
+
* `com.example.app:/callback` (RFC 8252 §7.1).
|
|
12
|
+
* - Web origins are bare origins (no path, query or fragment) and only for
|
|
13
|
+
* browser apps.
|
|
14
|
+
*
|
|
15
|
+
* Values already stored on the client are accepted as they are, so an edit
|
|
16
|
+
* link on an older, hand-made client can still save without first fixing
|
|
17
|
+
* every existing URL. New values must follow the rules.
|
|
18
|
+
*/
|
|
19
|
+
export declare const MAX_URIS = 20;
|
|
20
|
+
export declare const MAX_URI_LENGTH = 1024;
|
|
21
|
+
export declare const FORBIDDEN_SCHEMES: Set<string>;
|
|
22
|
+
export type UriField = "redirect_uris" | "post_logout_redirect_uris" | "web_origins";
|
|
23
|
+
export interface UriViolation {
|
|
24
|
+
field: UriField;
|
|
25
|
+
value?: string;
|
|
26
|
+
reason: UriViolationReason;
|
|
27
|
+
}
|
|
28
|
+
export type UriViolationReason = "too_many" | "too_long" | "invalid" | "wildcard" | "fragment" | "userinfo" | "http_not_loopback" | "scheme_not_allowed" | "custom_scheme_needs_dot" | "origin_only" | "not_for_native";
|
|
29
|
+
/**
|
|
30
|
+
* Returns the first violation in `values`, or null. `existing` are the values
|
|
31
|
+
* already stored on the client for this field; those are not re-checked.
|
|
32
|
+
*/
|
|
33
|
+
export declare function checkUris(field: UriField, values: string[] | undefined, appType: AppPreset, existing?: string[]): UriViolation | null;
|
|
34
|
+
export declare function describeUriViolation(violation: UriViolation): string;
|
|
@@ -7,10 +7,12 @@ import type { EnrichedClient } from "./client";
|
|
|
7
7
|
* fallback rather than the tenant's actual connection. Centralised here so the
|
|
8
8
|
* HTML route and the screen handler resolve it identically.
|
|
9
9
|
*
|
|
10
|
+
* The connection is the one {@link resolveClientDatabaseConnection} picks.
|
|
11
|
+
*
|
|
10
12
|
* @param fallbackConnection connection name to use when the client has no
|
|
11
13
|
* database connection (typically `user.connection`).
|
|
12
14
|
*/
|
|
13
|
-
export declare function resolvePasswordConnection(client: EnrichedClient, fallbackConnection: string): {
|
|
15
|
+
export declare function resolvePasswordConnection(client: EnrichedClient, fallbackConnection: string, requested?: string): {
|
|
14
16
|
connection: string;
|
|
15
17
|
connectionId?: string;
|
|
16
18
|
};
|
|
@@ -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" | "iat" | "sid" | "permissions" | "iss" | "exp" | "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" | "iat" | "sid" | "permissions" | "iss" | "exp" | "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,34 @@
|
|
|
1
|
+
import type { Context } from "hono";
|
|
2
|
+
import type { Bindings, Variables } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* Shared helpers for self-service tickets: the bearer links that let an
|
|
5
|
+
* outside party set something up without an account. Used by Self-Service
|
|
6
|
+
* SSO tickets (#1763) and developer app invites and edit links (#1776).
|
|
7
|
+
*
|
|
8
|
+
* A ticket id is 32 random bytes, base64url-encoded, returned once inside the
|
|
9
|
+
* ticket URL and stored only as its hex SHA-256 hash.
|
|
10
|
+
*/
|
|
11
|
+
/** A new ticket id: 32 random bytes, base64url (43 characters). */
|
|
12
|
+
export declare function generateTicketId(): string;
|
|
13
|
+
/** The stored form of a ticket id: hex SHA-256. */
|
|
14
|
+
export declare function hashTicketId(ticketId: string): Promise<string>;
|
|
15
|
+
/** Developer app setup page (invite and edit links), on the tenant's domain. */
|
|
16
|
+
export declare const APP_TICKET_PATH = "u2/self-service/app";
|
|
17
|
+
/** Default and maximum lifetime of app invite and edit links. */
|
|
18
|
+
export declare const APP_TICKET_DEFAULT_TTL_SEC: number;
|
|
19
|
+
export declare const APP_TICKET_MAX_TTL_SEC: number;
|
|
20
|
+
/** The query parameter carrying a ticket id in a ticket URL. */
|
|
21
|
+
export declare const TICKET_PARAM = "ticket";
|
|
22
|
+
/**
|
|
23
|
+
* The ticket URL for `path` on the tenant's login domain. On the shared
|
|
24
|
+
* issuer host nothing else identifies the tenant, so `tenant_id` is added.
|
|
25
|
+
*/
|
|
26
|
+
export declare function buildTicketUrl(ctx: Context<{
|
|
27
|
+
Bindings: Bindings;
|
|
28
|
+
Variables: Variables;
|
|
29
|
+
}>, path: string, ticketId: string, tenantId: string): string;
|
|
30
|
+
/**
|
|
31
|
+
* A logged query record with any ticket id replaced: a log reader must never
|
|
32
|
+
* get a usable ticket.
|
|
33
|
+
*/
|
|
34
|
+
export declare function redactTicketQuery<T>(query: Record<string, T>): Record<string, T | string>;
|
|
@@ -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;
|