authhero 9.31.0 → 9.33.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 +73 -73
- package/dist/authhero.d.ts +613 -432
- package/dist/authhero.mjs +10990 -10763
- package/dist/mfa-attempts-DNgUKmta.js +275 -0
- package/dist/{mfa-attempts-Dl3I8pop.mjs → mfa-attempts-dhkGMzI5.mjs} +6263 -5839
- package/dist/{passkey-enrollment-2Toeaevy.js → passkey-enrollment-B_o8pQ1z.js} +1 -1
- package/dist/tsconfig.types.tsbuildinfo +1 -1
- package/dist/types/authentication-flows/common.d.ts +12 -1
- package/dist/types/authentication-flows/passwordless.d.ts +17 -6
- package/dist/types/authentication-flows/refresh-token.d.ts +1 -0
- package/dist/types/helpers/cimd.d.ts +8 -0
- package/dist/types/helpers/client.d.ts +17 -1
- package/dist/types/helpers/dcr/metadata-mapping.d.ts +1 -1
- package/dist/types/helpers/login-session-tenant.d.ts +22 -0
- package/dist/types/helpers/reserved-claims.d.ts +2 -2
- package/dist/types/helpers/session-transfer.d.ts +158 -0
- package/dist/types/hooks/lifecycle-codehooks.d.ts +2 -2
- package/dist/types/index.d.ts +552 -422
- package/dist/types/routes/auth-api/account.d.ts +2 -2
- package/dist/types/routes/auth-api/authorize.d.ts +6 -0
- package/dist/types/routes/auth-api/index.d.ts +42 -25
- package/dist/types/routes/auth-api/oidc-logout.d.ts +3 -3
- package/dist/types/routes/auth-api/passwordless.d.ts +8 -8
- package/dist/types/routes/auth-api/register/index.d.ts +2 -2
- package/dist/types/routes/auth-api/token.d.ts +21 -10
- package/dist/types/routes/management-api/action-triggers.d.ts +27 -27
- package/dist/types/routes/management-api/actions.d.ts +13 -13
- package/dist/types/routes/management-api/authentication-methods.d.ts +1 -1
- package/dist/types/routes/management-api/branding.d.ts +19 -19
- package/dist/types/routes/management-api/clients.d.ts +86 -18
- package/dist/types/routes/management-api/connections.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/emails.d.ts +6 -6
- package/dist/types/routes/management-api/failed-events.d.ts +2 -2
- package/dist/types/routes/management-api/flows.d.ts +8 -8
- 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/hooks.d.ts +56 -56
- package/dist/types/routes/management-api/index.d.ts +512 -399
- package/dist/types/routes/management-api/jobs.d.ts +2 -2
- package/dist/types/routes/management-api/keys.d.ts +4 -4
- 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 +1 -1
- package/dist/types/routes/management-api/prompts.d.ts +8 -8
- package/dist/types/routes/management-api/refresh_tokens.d.ts +5 -0
- package/dist/types/routes/management-api/resource-servers.d.ts +8 -8
- 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/sessions.d.ts +5 -0
- package/dist/types/routes/management-api/tenant-members.d.ts +8 -8
- package/dist/types/routes/management-api/tenant-operations.d.ts +9 -9
- package/dist/types/routes/management-api/tenants.d.ts +6 -6
- package/dist/types/routes/management-api/themes.d.ts +9 -9
- package/dist/types/routes/management-api/users.d.ts +45 -15
- package/dist/types/routes/saml/index.d.ts +6 -6
- package/dist/types/routes/saml/samlp.d.ts +6 -6
- package/dist/types/routes/universal-login/common.d.ts +45 -18
- package/dist/types/routes/universal-login/flow-api.d.ts +12 -12
- package/dist/types/routes/universal-login/impersonate.d.ts +2 -2
- package/dist/types/routes/universal-login/index.d.ts +2 -2
- 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 +3 -1
- package/dist/types/types/GrantFlowResult.d.ts +13 -0
- package/dist/types/types/Hooks.d.ts +24 -0
- package/dist/types/types/Variables.d.ts +12 -1
- package/dist/types/utils/cookies.d.ts +15 -0
- package/dist/types/utils/session-transfer-token.d.ts +56 -0
- package/package.json +6 -6
- package/dist/mfa-attempts-DXiY4U74.js +0 -275
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AuthorizationResponseType, AuthParams, LoginSession, LoginSessionAuthStrategy, RefreshToken, User, TokenResponse } from "@authhero/adapter-interfaces";
|
|
1
|
+
import { AuthorizationResponseType, AuthParams, LoginSession, LoginSessionAuthStrategy, RefreshToken, SessionTransferProvenance, User, TokenResponse } from "@authhero/adapter-interfaces";
|
|
2
2
|
import { EnrichedClient } from "../helpers/client";
|
|
3
3
|
import { Context } from "hono";
|
|
4
4
|
import { Bindings, Variables } from "../types";
|
|
@@ -103,6 +103,17 @@ export interface CreateRefreshTokenParams {
|
|
|
103
103
|
organization?: string;
|
|
104
104
|
auth_connection?: string;
|
|
105
105
|
auth_strategy?: LoginSessionAuthStrategy;
|
|
106
|
+
/**
|
|
107
|
+
* Set when the session came from a session_transfer_token. The token then
|
|
108
|
+
* carries the same provenance, so it ends with the refresh token the
|
|
109
|
+
* session was transferred from.
|
|
110
|
+
*/
|
|
111
|
+
session_transfer?: SessionTransferProvenance;
|
|
112
|
+
/**
|
|
113
|
+
* Upper bound for the token's absolute and idle expiry. Used to tie a
|
|
114
|
+
* refresh token to the lifetime of the session it was issued under.
|
|
115
|
+
*/
|
|
116
|
+
max_expires_at?: string;
|
|
106
117
|
}
|
|
107
118
|
export interface CreatedRefreshToken {
|
|
108
119
|
row: RefreshToken;
|
|
@@ -243,7 +243,7 @@ export declare function passwordlessGrantUser(ctx: Context<{
|
|
|
243
243
|
pushed_authorization_requests_supported?: boolean | undefined;
|
|
244
244
|
authorization_response_iss_parameter_supported?: boolean | undefined;
|
|
245
245
|
deployment_type?: "shared" | "wfp" | undefined;
|
|
246
|
-
provisioning_state?: "
|
|
246
|
+
provisioning_state?: "pending" | "ready" | "failed" | undefined;
|
|
247
247
|
provisioning_error?: string | undefined;
|
|
248
248
|
provisioning_state_changed_at?: string | undefined;
|
|
249
249
|
bundle_configuration?: string | undefined;
|
|
@@ -441,7 +441,7 @@ export declare function passwordlessGrantUser(ctx: Context<{
|
|
|
441
441
|
} | undefined;
|
|
442
442
|
set_user_root_attributes?: "on_each_login" | "on_first_login" | "never_on_login" | undefined;
|
|
443
443
|
};
|
|
444
|
-
scope?: "
|
|
444
|
+
scope?: "shared" | "local" | "platform" | undefined;
|
|
445
445
|
override?: "none" | "secrets" | "fields" | undefined;
|
|
446
446
|
enforce?: boolean | undefined;
|
|
447
447
|
id?: string | undefined;
|
|
@@ -464,7 +464,17 @@ export declare function passwordlessGrantUser(ctx: Context<{
|
|
|
464
464
|
client_aliases?: string[] | undefined;
|
|
465
465
|
allowed_clients?: string[] | undefined;
|
|
466
466
|
allowed_logout_urls?: string[] | undefined;
|
|
467
|
-
session_transfer?:
|
|
467
|
+
session_transfer?: {
|
|
468
|
+
[x: string]: unknown;
|
|
469
|
+
can_create_session_transfer_token?: boolean | undefined;
|
|
470
|
+
enforce_cascade_revocation?: boolean | undefined;
|
|
471
|
+
allowed_authentication_methods?: ("query" | "cookie")[] | undefined;
|
|
472
|
+
enforce_device_binding?: "none" | "ip" | "asn" | undefined;
|
|
473
|
+
allow_refresh_token?: boolean | undefined;
|
|
474
|
+
enforce_online_refresh_tokens?: boolean | undefined;
|
|
475
|
+
allow_onward_transfer?: boolean | undefined;
|
|
476
|
+
trust_forwarded_ip?: boolean | undefined;
|
|
477
|
+
} | undefined;
|
|
468
478
|
oidc_logout?: {
|
|
469
479
|
[x: string]: unknown;
|
|
470
480
|
backchannel_logout_urls?: string[] | undefined;
|
|
@@ -483,7 +493,7 @@ export declare function passwordlessGrantUser(ctx: Context<{
|
|
|
483
493
|
custom_login_page_preview?: string | undefined;
|
|
484
494
|
form_template?: string | undefined;
|
|
485
495
|
addons?: Record<string, any> | undefined;
|
|
486
|
-
token_endpoint_auth_method?: "none" | "
|
|
496
|
+
token_endpoint_auth_method?: "none" | "private_key_jwt" | "client_secret_post" | "client_secret_basic" | "client_secret_jwt" | undefined;
|
|
487
497
|
client_metadata?: Record<string, string> | undefined;
|
|
488
498
|
hide_sign_up_disabled_error?: boolean | undefined;
|
|
489
499
|
mobile?: Record<string, any> | undefined;
|
|
@@ -568,9 +578,10 @@ export declare function passwordlessGrantUser(ctx: Context<{
|
|
|
568
578
|
strategy_type: string;
|
|
569
579
|
} | undefined;
|
|
570
580
|
authenticated_at?: string | undefined;
|
|
581
|
+
tenant_id?: string | undefined;
|
|
571
582
|
};
|
|
572
|
-
connectionType: "
|
|
573
|
-
authConnection: "
|
|
583
|
+
connectionType: "sms" | "email" | "username";
|
|
584
|
+
authConnection: "sms" | "email" | "username";
|
|
574
585
|
session_id: string | undefined;
|
|
575
586
|
authParams: {
|
|
576
587
|
audience?: string | undefined;
|
|
@@ -9,6 +9,7 @@ export declare const refreshTokenParamsSchema: z.ZodObject<{
|
|
|
9
9
|
refresh_token: z.ZodString;
|
|
10
10
|
client_secret: z.ZodOptional<z.ZodString>;
|
|
11
11
|
organization: z.ZodOptional<z.ZodString>;
|
|
12
|
+
audience: z.ZodOptional<z.ZodString>;
|
|
12
13
|
}, z.core.$strip>;
|
|
13
14
|
export declare function refreshTokenGrant(ctx: Context<{
|
|
14
15
|
Bindings: Bindings;
|
|
@@ -6,6 +6,14 @@ import { SsrfFetchOptions } from "../utils/ssrf-fetch";
|
|
|
6
6
|
* (length, path, fetch, document shape) happens in {@link resolveCimdClient}.
|
|
7
7
|
*/
|
|
8
8
|
export declare function isCimdClientId(clientId: string): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Tenant hint for `getEnrichedClient` on a host-scoped route that takes the
|
|
11
|
+
* client_id from the request. A registered client_id is globally unique and
|
|
12
|
+
* resolves its own tenant, so it gets no hint (unchanged behavior). A CIMD
|
|
13
|
+
* client_id (https URL) has a stub row in every tenant that uses it and can't
|
|
14
|
+
* identify the tenant, so it gets the request's tenant, as /authorize does.
|
|
15
|
+
*/
|
|
16
|
+
export declare function cimdTenantHint(clientId: string, requestTenantId: string | undefined): string | undefined;
|
|
9
17
|
export declare const cimdDocumentSchema: z.ZodObject<{
|
|
10
18
|
client_id: z.ZodString;
|
|
11
19
|
client_name: z.ZodString;
|
|
@@ -52,7 +52,23 @@ export declare const enrichedClientSchema: z.ZodObject<{
|
|
|
52
52
|
client_aliases: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
|
|
53
53
|
allowed_clients: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
|
|
54
54
|
allowed_logout_urls: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
|
|
55
|
-
session_transfer: z.ZodOptional<z.
|
|
55
|
+
session_transfer: z.ZodOptional<z.ZodObject<{
|
|
56
|
+
can_create_session_transfer_token: z.ZodOptional<z.ZodBoolean>;
|
|
57
|
+
enforce_cascade_revocation: z.ZodOptional<z.ZodBoolean>;
|
|
58
|
+
allowed_authentication_methods: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
59
|
+
query: "query";
|
|
60
|
+
cookie: "cookie";
|
|
61
|
+
}>>>;
|
|
62
|
+
enforce_device_binding: z.ZodOptional<z.ZodEnum<{
|
|
63
|
+
none: "none";
|
|
64
|
+
ip: "ip";
|
|
65
|
+
asn: "asn";
|
|
66
|
+
}>>;
|
|
67
|
+
allow_refresh_token: z.ZodOptional<z.ZodBoolean>;
|
|
68
|
+
enforce_online_refresh_tokens: z.ZodOptional<z.ZodBoolean>;
|
|
69
|
+
allow_onward_transfer: z.ZodOptional<z.ZodBoolean>;
|
|
70
|
+
trust_forwarded_ip: z.ZodOptional<z.ZodBoolean>;
|
|
71
|
+
}, z.core.$loose>>;
|
|
56
72
|
oidc_logout: z.ZodOptional<z.ZodDefault<z.ZodObject<{
|
|
57
73
|
backchannel_logout_urls: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
58
74
|
backchannel_logout_initiators: z.ZodOptional<z.ZodObject<{
|
|
@@ -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>>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { LoginSession } from "@authhero/adapter-interfaces";
|
|
2
|
+
export type LoginSessionTenant = {
|
|
3
|
+
ok: true;
|
|
4
|
+
tenantId: string | undefined;
|
|
5
|
+
} | {
|
|
6
|
+
ok: false;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* The tenant a state-keyed request (/callback, /authorize/resume, the
|
|
10
|
+
* universal login screens) runs in.
|
|
11
|
+
*
|
|
12
|
+
* A request whose host or header resolved a tenant only ever serves that
|
|
13
|
+
* tenant's login sessions. Some adapters (kysely) load the session by id
|
|
14
|
+
* alone, so a session of another tenant can come back here: callers must
|
|
15
|
+
* treat `ok: false` exactly like a missing session, otherwise one tenant's
|
|
16
|
+
* login screens could be served on another tenant's domain.
|
|
17
|
+
*
|
|
18
|
+
* When the request carries no tenant, the session row is the authoritative
|
|
19
|
+
* record of the flow's tenant. A CIMD client_id (https URL) has a stub row in
|
|
20
|
+
* every tenant that uses it, so it can't identify the tenant (#1731).
|
|
21
|
+
*/
|
|
22
|
+
export declare function resolveLoginSessionTenant(requestTenantId: string | undefined, loginSession: Pick<LoginSession, "tenant_id">): LoginSessionTenant;
|
|
@@ -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: ("client_id" | "
|
|
17
|
+
export declare const SERVICE_TOKEN_RESERVED_CLAIMS: ("client_id" | "sid" | "scope" | "tenant_id" | "org_name" | "jti" | "sub" | "exp" | "iat" | "org_id" | "iss" | "aud" | "auth_time" | "acr" | "amr" | "gty" | "permissions" | "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: ("client_id" | "
|
|
19
|
+
export declare const CLIENT_SERVICE_TOKEN_RESERVED_CLAIMS: ("client_id" | "sid" | "scope" | "tenant_id" | "org_name" | "jti" | "sub" | "exp" | "iat" | "org_id" | "iss" | "aud" | "auth_time" | "acr" | "amr" | "azp" | "gty" | "permissions" | "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,158 @@
|
|
|
1
|
+
import { Context } from "hono";
|
|
2
|
+
import { z } from "@hono/zod-openapi";
|
|
3
|
+
import { DataAdapters, RefreshToken, Session, SessionTransferAuthenticationMethod, SessionTransferProvenance, User } from "@authhero/adapter-interfaces";
|
|
4
|
+
import { Bindings, Variables } from "../types";
|
|
5
|
+
import { EnrichedClient } from "./client";
|
|
6
|
+
/**
|
|
7
|
+
* Minting and redeeming session_transfer_tokens (#1710, Auth0 "Native to Web
|
|
8
|
+
* SSO"), and the checks a session or refresh token created from one is subject
|
|
9
|
+
* to afterwards.
|
|
10
|
+
*
|
|
11
|
+
* A token is stored as two rows: a `codes` row keyed by the token's hash, which
|
|
12
|
+
* gives single use and the 60 second lifetime, and a "carrier" login session
|
|
13
|
+
* that holds what the redeeming /authorize needs to rebuild the login: the
|
|
14
|
+
* user, the connection they authenticated with, the device the token is bound
|
|
15
|
+
* to and the refresh token family it was minted from.
|
|
16
|
+
*/
|
|
17
|
+
type Ctx = Context<{
|
|
18
|
+
Bindings: Bindings;
|
|
19
|
+
Variables: Variables;
|
|
20
|
+
}>;
|
|
21
|
+
/**
|
|
22
|
+
* Descriptions of the `w` log written when a presented token does not log the
|
|
23
|
+
* user in. The first five are Auth0's, word for word, so log queries written
|
|
24
|
+
* against Auth0 keep matching. The rest cover checks Auth0 does not make.
|
|
25
|
+
*/
|
|
26
|
+
export declare const SESSION_TRANSFER_WARNINGS: {
|
|
27
|
+
readonly notFound: "Single Sign-On failed: Session Transfer Token not found or expired. This may indicate token reuse or expiration.";
|
|
28
|
+
readonly deviceBinding: "Single Sign-On failed: Session Transfer Token device binding validation failed due to IP/ASN mismatch.";
|
|
29
|
+
readonly organization: "Single Sign-On failed: Session Transfer Token organization mismatch detected.";
|
|
30
|
+
readonly userMismatch: "Single Sign-On failed: Session Transfer Token user mismatch detected.";
|
|
31
|
+
readonly parentNotFound: "Single Sign-On failed: Parent refresh token not found. Session Transfer Token won't be used for session establishment.";
|
|
32
|
+
readonly methodNotAllowed: "Single Sign-On failed: Session Transfer Token authentication method is not allowed for this client.";
|
|
33
|
+
readonly connectionNotEnabled: "Single Sign-On failed: Session Transfer Token user's connection is not enabled for this client.";
|
|
34
|
+
readonly userUnavailable: "Single Sign-On failed: Session Transfer Token user is blocked or no longer exists.";
|
|
35
|
+
};
|
|
36
|
+
/** What the carrier login session keeps in its context (`state_data`). */
|
|
37
|
+
declare const carrierStateSchema: z.ZodObject<{
|
|
38
|
+
session_transfer: z.ZodObject<{
|
|
39
|
+
family_id: z.ZodString;
|
|
40
|
+
cascade_revocation: z.ZodBoolean;
|
|
41
|
+
asn: z.ZodOptional<z.ZodString>;
|
|
42
|
+
authentication: z.ZodOptional<z.ZodObject<{
|
|
43
|
+
methods: z.ZodArray<z.ZodObject<{
|
|
44
|
+
name: z.ZodString;
|
|
45
|
+
timestamp: z.ZodString;
|
|
46
|
+
type: z.ZodOptional<z.ZodString>;
|
|
47
|
+
}, z.core.$strip>>;
|
|
48
|
+
}, z.core.$strip>>;
|
|
49
|
+
organization: z.ZodOptional<z.ZodObject<{
|
|
50
|
+
id: z.ZodString;
|
|
51
|
+
name: z.ZodString;
|
|
52
|
+
}, z.core.$strip>>;
|
|
53
|
+
}, z.core.$strip>;
|
|
54
|
+
}, z.core.$strip>;
|
|
55
|
+
export type SessionTransferCarrierState = z.infer<typeof carrierStateSchema>["session_transfer"];
|
|
56
|
+
/**
|
|
57
|
+
* The autonomous system number of the caller's network, when the runtime
|
|
58
|
+
* reports one (Cloudflare Workers put it on `request.cf.asn`). Undefined
|
|
59
|
+
* everywhere else: the binding check treats that as "cannot verify".
|
|
60
|
+
*/
|
|
61
|
+
export declare function getRequestAsn(ctx: Ctx): string | undefined;
|
|
62
|
+
export interface MintSessionTransferTokenParams {
|
|
63
|
+
/** The client the refresh token belongs to (the sender). */
|
|
64
|
+
client: EnrichedClient;
|
|
65
|
+
user: User;
|
|
66
|
+
/** The refresh token presented to the exchange, before rotation. */
|
|
67
|
+
refreshToken: RefreshToken;
|
|
68
|
+
sessionId?: string;
|
|
69
|
+
organization?: {
|
|
70
|
+
id: string;
|
|
71
|
+
name: string;
|
|
72
|
+
};
|
|
73
|
+
authConnection?: string;
|
|
74
|
+
authStrategy?: RefreshToken["auth_strategy"];
|
|
75
|
+
/**
|
|
76
|
+
* Whether the client proved its identity on this request (secret or
|
|
77
|
+
* assertion). Only then may it name the end user's IP address.
|
|
78
|
+
*/
|
|
79
|
+
clientAuthenticated: boolean;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Mint a session_transfer_token for the user behind a refresh token. The
|
|
83
|
+
* caller has already validated the refresh token and checked that the client
|
|
84
|
+
* may mint. Returns the wire token; only its hash is stored.
|
|
85
|
+
*/
|
|
86
|
+
export declare function mintSessionTransferToken(ctx: Ctx, params: MintSessionTransferTokenParams): Promise<string>;
|
|
87
|
+
export interface RedeemSessionTransferTokenParams {
|
|
88
|
+
/** The client the /authorize request is for (the receiver). */
|
|
89
|
+
client: EnrichedClient;
|
|
90
|
+
token: string;
|
|
91
|
+
/** How the token reached /authorize. */
|
|
92
|
+
method: SessionTransferAuthenticationMethod;
|
|
93
|
+
/** The browser's current valid session, if it has one. */
|
|
94
|
+
existingSession?: Session;
|
|
95
|
+
/** The `organization` parameter of the /authorize request (id or name). */
|
|
96
|
+
organization?: string;
|
|
97
|
+
}
|
|
98
|
+
export type RedeemSessionTransferTokenResult =
|
|
99
|
+
/** The token did not log the user in; continue as if it was not sent. */
|
|
100
|
+
{
|
|
101
|
+
outcome: "rejected";
|
|
102
|
+
}
|
|
103
|
+
/** A new session for the token's user. */
|
|
104
|
+
| {
|
|
105
|
+
outcome: "session_created";
|
|
106
|
+
session: Session;
|
|
107
|
+
}
|
|
108
|
+
/** The browser already had a session for the token's user; it is kept. */
|
|
109
|
+
| {
|
|
110
|
+
outcome: "session_kept";
|
|
111
|
+
}
|
|
112
|
+
/** The browser had a session for another user; it has been revoked. */
|
|
113
|
+
| {
|
|
114
|
+
outcome: "session_revoked";
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* Redeem a session_transfer_token presented to /authorize. Never throws for an
|
|
118
|
+
* unusable token: every refusal writes a `w` log and reports `rejected`, and
|
|
119
|
+
* the caller carries on with the normal login flow.
|
|
120
|
+
*/
|
|
121
|
+
export declare function redeemSessionTransferToken(ctx: Ctx, params: RedeemSessionTransferTokenParams): Promise<RedeemSessionTransferTokenResult>;
|
|
122
|
+
/**
|
|
123
|
+
* Whether the refresh token a transferred session or refresh token descends
|
|
124
|
+
* from is still usable. Only call this for rows that carry provenance with
|
|
125
|
+
* `cascade_revocation`, so ordinary logins pay nothing for it.
|
|
126
|
+
*/
|
|
127
|
+
export declare function isSessionTransferParentActive(data: DataAdapters, tenantId: string, provenance: SessionTransferProvenance): Promise<boolean>;
|
|
128
|
+
/**
|
|
129
|
+
* Whether a session can still back an "online" refresh token: it exists, has
|
|
130
|
+
* not been revoked and has not passed its absolute or idle expiry.
|
|
131
|
+
*/
|
|
132
|
+
export declare function isSessionLive(session: Session | null | undefined, now?: number): session is Session;
|
|
133
|
+
/**
|
|
134
|
+
* The idle expiry a session should move to after one of its online refresh
|
|
135
|
+
* tokens was exchanged, or undefined when it should be left alone. Exchanging
|
|
136
|
+
* the token is the only sign of life such a session gets from an application
|
|
137
|
+
* that never returns to /authorize, so without the slide the session, and the
|
|
138
|
+
* refresh token bound to it, would end after one idle period however active
|
|
139
|
+
* the user is. Never moves past the session's absolute expiry.
|
|
140
|
+
*/
|
|
141
|
+
export declare function nextOnlineSessionIdleExpiry(client: EnrichedClient, session: Pick<Session, "idle_expires_at" | "expires_at">, now?: number): string | undefined;
|
|
142
|
+
export type TransferredRefreshTokenPolicy = {
|
|
143
|
+
allowed: false;
|
|
144
|
+
} | {
|
|
145
|
+
allowed: true;
|
|
146
|
+
session_transfer?: SessionTransferProvenance;
|
|
147
|
+
/** Absolute expiry the refresh token may not outlive. */
|
|
148
|
+
max_expires_at?: string;
|
|
149
|
+
};
|
|
150
|
+
/**
|
|
151
|
+
* What applies to a refresh token about to be issued under `session`. A
|
|
152
|
+
* session that did not come from a session_transfer_token is unaffected. One
|
|
153
|
+
* that did gets a refresh token only if the client opted in, and that token
|
|
154
|
+
* records where it came from and, unless the client turned it off, ends with
|
|
155
|
+
* the session ("online" refresh token).
|
|
156
|
+
*/
|
|
157
|
+
export declare function resolveTransferredRefreshTokenPolicy(client: EnrichedClient, session: Pick<Session, "session_transfer" | "expires_at"> | null | undefined): TransferredRefreshTokenPolicy;
|
|
158
|
+
export {};
|
|
@@ -10,14 +10,14 @@ export declare function listEnabledCodeHooks(ctx: Context<{
|
|
|
10
10
|
Bindings: Bindings;
|
|
11
11
|
Variables: Variables;
|
|
12
12
|
}>, tenantId: string, triggerId: string): Promise<{
|
|
13
|
-
trigger_id: "
|
|
13
|
+
trigger_id: "pre-user-registration" | "post-user-registration" | "post-user-login" | "post-user-update" | "validate-registration-username" | "pre-user-deletion" | "post-user-deletion" | "credentials-exchange" | "pre-user-update" | "pre-account-action";
|
|
14
14
|
enabled: boolean;
|
|
15
15
|
synchronous: boolean;
|
|
16
16
|
created_at: string;
|
|
17
17
|
updated_at: string;
|
|
18
18
|
hook_id: string;
|
|
19
19
|
code_id: string;
|
|
20
|
-
scope?: "
|
|
20
|
+
scope?: "shared" | "local" | "platform" | undefined;
|
|
21
21
|
override?: "none" | "secrets" | "fields" | undefined;
|
|
22
22
|
enforce?: boolean | undefined;
|
|
23
23
|
priority?: number | undefined;
|