authhero 9.44.1 → 9.44.3

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.
@@ -0,0 +1,3 @@
1
+ import type { ExportLine } from "./types";
2
+ /** Remove stored credential values without inserting placeholder credentials. */
3
+ export declare function redactCredentials(row: ExportLine): ExportLine | undefined;
@@ -12,6 +12,11 @@ export interface ExportLine {
12
12
  data: unknown;
13
13
  }
14
14
  export interface ExportOptions {
15
+ /**
16
+ * Preserve stored credentials other than password hashes. Defaults to true
17
+ * for internal backups. HTTP callers must explicitly opt in and be authorized.
18
+ */
19
+ includeCredentials?: boolean;
15
20
  /**
16
21
  * When false, the `passwords` entity is skipped entirely on export so the
17
22
  * stream never carries password hashes. Defaults to false at the call sites
@@ -15,6 +15,6 @@
15
15
  */
16
16
  export { addDataHooks } from "./addDataHooks";
17
17
  export { validateSignupEmail, preUserSignupHook } from "./validate-signup";
18
- export { postUserLoginHook } from "./post-user-login";
18
+ export { postUserLoginHook, postLoginActionsForSilentAuth, } from "./post-user-login";
19
19
  export { validateSignupEmail as validateRegistrationUsername } from "./validate-signup";
20
20
  export { preUserSignupHook as preUserRegistrationHook } from "./validate-signup";
@@ -15,6 +15,22 @@ import { MfaRequiredByAction } from "../state-machines/login-session";
15
15
  * only be remembered when every enabling call allowed it.
16
16
  */
17
17
  export declare function mergeMfaRequest(current: MfaRequiredByAction | undefined, provider: unknown, options: unknown): MfaRequiredByAction | undefined;
18
+ interface PostUserLoginParams {
19
+ client?: EnrichedClient;
20
+ authParams?: any;
21
+ authStrategy?: {
22
+ strategy: string;
23
+ strategy_type: string;
24
+ };
25
+ /** The connection name actually used to authenticate. */
26
+ authConnection?: string;
27
+ /**
28
+ * True when the login completed by reusing an existing SSO session
29
+ * rather than fresh credentials. Page hooks (e.g. impersonate) only
30
+ * interrupt fresh logins.
31
+ */
32
+ sessionReused?: boolean;
33
+ }
18
34
  /**
19
35
  * Checks for post-user-login hooks (form, page, template, code, or webhook)
20
36
  * and handles them in that order. Also:
@@ -32,19 +48,38 @@ export declare function mergeMfaRequest(current: MfaRequiredByAction | undefined
32
48
  export declare function postUserLoginHook(ctx: Context<{
33
49
  Bindings: Bindings;
34
50
  Variables: Variables;
35
- }>, data: DataAdapters, tenant_id: string, user: User, loginSession?: LoginSession, params?: {
36
- client?: EnrichedClient;
37
- authParams?: any;
38
- authStrategy?: {
39
- strategy: string;
40
- strategy_type: string;
41
- };
42
- /** The connection name actually used to authenticate. */
43
- authConnection?: string;
44
- /**
45
- * True when the login completed by reusing an existing SSO session
46
- * rather than fresh credentials. Page hooks (e.g. impersonate) only
47
- * interrupt fresh logins.
48
- */
49
- sessionReused?: boolean;
50
- }): Promise<User | Response>;
51
+ }>, data: DataAdapters, tenant_id: string, user: User, loginSession?: LoginSession, params?: PostUserLoginParams): Promise<User | Response>;
52
+ export type SilentPostLoginResult = {
53
+ status: "ok";
54
+ user: User;
55
+ } | {
56
+ status: "interaction_required" | "access_denied";
57
+ description: string;
58
+ };
59
+ /**
60
+ * Runs the post-login actions for silent authentication (`prompt=none`): the
61
+ * `ctx.env.hooks.onExecutePostLogin` hook and the tenant's code hooks, with
62
+ * the same event and API an interactive login gives them
63
+ * (`event.transaction.prompt` is `"none"`).
64
+ *
65
+ * Nothing can be shown to the user here, so what an action asks for is
66
+ * reported back instead of acted on:
67
+ * - `api.access.deny(...)`, a failing `fail_closed` action, or a client
68
+ * error (4xx `HTTPException`) thrown by `onExecutePostLogin` is
69
+ * `access_denied`;
70
+ * - `api.multifactor.enable(...)` is `interaction_required` unless the browser
71
+ * session already completed MFA for this user, or the browser is remembered
72
+ * and the action allows that;
73
+ * - a redirect requested by `onExecutePostLogin` is `interaction_required`.
74
+ *
75
+ * A silent authentication is not a new login: `login_count` and `last_login`
76
+ * stay as they are, no login is logged, and the template, form, page and
77
+ * webhook hooks of the trigger do not run.
78
+ */
79
+ export declare function postLoginActionsForSilentAuth(ctx: Context<{
80
+ Bindings: Bindings;
81
+ Variables: Variables;
82
+ }>, data: DataAdapters, tenant_id: string, user: User, loginSession: LoginSession, params: PostUserLoginParams & {
83
+ client: EnrichedClient;
84
+ }): Promise<SilentPostLoginResult>;
85
+ export {};