authhero 9.1.0 → 9.1.1

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.
@@ -261,6 +261,12 @@ export declare function completeLogin(ctx: Context<{
261
261
  * stale-overwrite re-fetch.
262
262
  */
263
263
  loginSessionIsCurrent?: boolean;
264
+ /**
265
+ * True when the login completed by reusing an existing SSO session
266
+ * rather than fresh credentials. Page hooks (e.g. impersonate) are
267
+ * skipped for reused sessions.
268
+ */
269
+ sessionReused?: boolean;
264
270
  }): Promise<TokenResponse | {
265
271
  code: string;
266
272
  state?: string;
@@ -14,6 +14,12 @@ export interface CreateServiceTokenCoreParams {
14
14
  tenantId: string;
15
15
  scope: string;
16
16
  issuer: string;
17
+ /**
18
+ * Explicit audience override. When unset the tenant's `audience` is
19
+ * required — callers that want a fallback chain (e.g. `default_audience`)
20
+ * resolve it themselves and pass the result here.
21
+ */
22
+ audience?: string;
17
23
  expiresInSeconds?: number;
18
24
  customClaims?: Record<string, unknown>;
19
25
  /**
@@ -31,14 +37,19 @@ export interface CreateServiceTokenCoreParams {
31
37
  * binding, and signing key.
32
38
  */
33
39
  export declare function createServiceTokenCore(params: CreateServiceTokenCoreParams): Promise<ServiceTokenResponse>;
40
+ /**
41
+ * Mint an internal `auth-service` token for calling our own (or a trusted
42
+ * downstream) API. Deliberately does NOT go through `createAuthTokens`: that
43
+ * path runs the tenant's credentials-exchange hooks, which must never fire for
44
+ * internal mints. A hook that calls `api.access.deny()` (e.g. a tenant gating
45
+ * logins on an external membership lookup) would otherwise reject the mint —
46
+ * and since post-user-update hooks commonly mint service tokens, a hook that
47
+ * updates a user could recurse straight back into itself.
48
+ */
34
49
  export declare function createServiceToken(ctx: Context<{
35
50
  Bindings: Bindings;
36
51
  Variables: Variables;
37
- }>, tenant_id: string, scope: string, expiresInSeconds?: number, customClaims?: Record<string, unknown>): Promise<{
38
- access_token: string;
39
- token_type: string;
40
- expires_in: number;
41
- }>;
52
+ }>, tenant_id: string, scope: string, expiresInSeconds?: number, customClaims?: Record<string, unknown>): Promise<ServiceTokenResponse>;
42
53
  /**
43
54
  * Bound ctx-free token factory for outbox destinations. Mirrors the shape
44
55
  * expected by `WebhookDestination` and `createDefaultDestinations` but uses
@@ -28,4 +28,10 @@ export declare function postUserLoginHook(ctx: Context<{
28
28
  };
29
29
  /** The connection name actually used to authenticate. */
30
30
  authConnection?: string;
31
+ /**
32
+ * True when the login completed by reusing an existing SSO session
33
+ * rather than fresh credentials. Page hooks (e.g. impersonate) only
34
+ * interrupt fresh logins.
35
+ */
36
+ sessionReused?: boolean;
31
37
  }): Promise<User | Response>;