authhero 9.13.0 → 9.13.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.
- package/dist/authhero.cjs +141 -141
- package/dist/authhero.d.ts +210 -210
- package/dist/authhero.mjs +19191 -19169
- package/dist/tsconfig.types.tsbuildinfo +1 -1
- package/dist/types/index.d.ts +210 -210
- package/dist/types/middlewares/apply-config.d.ts +8 -0
- package/dist/types/middlewares/client-info.d.ts +27 -1
- package/dist/types/routes/auth-api/index.d.ts +8 -8
- package/dist/types/routes/management-api/index.d.ts +195 -195
- package/dist/types/routes/universal-login/index.d.ts +2 -2
- package/dist/types/routes/universal-login/u2-index.d.ts +5 -5
- package/package.json +5 -5
|
@@ -7,6 +7,14 @@ import { AuthHeroConfig, Bindings, Variables } from "../types";
|
|
|
7
7
|
* Applied both in the outer `init()` app and in each sub-app's middleware
|
|
8
8
|
* chain so that serving a sub-app (oauthApp, managementApp, ...) directly —
|
|
9
9
|
* without routing through the outer app — still sees the config.
|
|
10
|
+
*
|
|
11
|
+
* `ctx.env` is replaced with a shallow copy before anything is written to it.
|
|
12
|
+
* On Cloudflare Workers the runtime hands every request in an isolate the SAME
|
|
13
|
+
* `env` object, and the routes store per-request state on it (`ctx.env.data =
|
|
14
|
+
* composeAuthData({ ctx, ... })`). Writing to the shared object let concurrent
|
|
15
|
+
* requests overwrite each other's adapter stack, so one request awaited
|
|
16
|
+
* another request's in-flight promises — which the runtime cancels as a hung
|
|
17
|
+
* Worker once the owning request ends.
|
|
10
18
|
*/
|
|
11
19
|
export declare function applyConfigMiddleware(config: AuthHeroConfig): MiddlewareHandler<{
|
|
12
20
|
Bindings: Bindings;
|
|
@@ -1,5 +1,31 @@
|
|
|
1
|
-
import { MiddlewareHandler } from "hono";
|
|
1
|
+
import { Context, MiddlewareHandler } from "hono";
|
|
2
2
|
import { Variables } from "../types/Variables";
|
|
3
|
+
/**
|
|
4
|
+
* Derive the client IP from the least forgeable header available.
|
|
5
|
+
*
|
|
6
|
+
* `X-Forwarded-For` arrives carrying whatever prefix the caller chose to send:
|
|
7
|
+
* `@authhero/proxy` appends the hop it verified to the end of the inbound
|
|
8
|
+
* chain and leaves the rest intact, so the leading entries are the client's
|
|
9
|
+
* own claim. Reading the first one handed a caller full control of
|
|
10
|
+
* `ctx.var.ip`, which keys the pre-login rate limiter (and its allowlist) and
|
|
11
|
+
* the passwordless IP check. Order of trust instead:
|
|
12
|
+
*
|
|
13
|
+
* 1. `CF-Connecting-IP`, unless it holds one of Cloudflare's own addresses.
|
|
14
|
+
* The edge overwrites it on ingress, so on a direct hit it is
|
|
15
|
+
* authoritative. When a Worker is reached worker-to-worker — our proxy's
|
|
16
|
+
* service binding to this app — the runtime replaces it with the loopback
|
|
17
|
+
* source, which is why a Cloudflare-owned value falls through instead of
|
|
18
|
+
* being laundered as a visitor.
|
|
19
|
+
* 2. `X-Real-IP`, which `@authhero/proxy` overwrites with the hop it verified.
|
|
20
|
+
* Only reachable when (1) is absent or Cloudflare-owned — off the edge, or
|
|
21
|
+
* behind our own proxy — so a caller on the edge cannot reach this branch
|
|
22
|
+
* by sending the header itself.
|
|
23
|
+
* 3. The *last* `X-Forwarded-For` entry: the hop appended by the nearest
|
|
24
|
+
* proxy, rather than the first, which anyone can set.
|
|
25
|
+
*/
|
|
26
|
+
export declare function getClientIp(c: Context<{
|
|
27
|
+
Variables: Variables;
|
|
28
|
+
}>): string | undefined;
|
|
3
29
|
/**
|
|
4
30
|
* Middleware that extracts client information from the request and stores it in context variables
|
|
5
31
|
*/
|
|
@@ -739,16 +739,16 @@ export default function create(config: AuthHeroConfig): OpenAPIHono<{
|
|
|
739
739
|
connection: "email";
|
|
740
740
|
client_id: string;
|
|
741
741
|
email: string;
|
|
742
|
-
send: "
|
|
742
|
+
send: "link" | "code";
|
|
743
743
|
authParams: {
|
|
744
744
|
username?: string | undefined;
|
|
745
745
|
state?: string | undefined;
|
|
746
|
+
redirect_uri?: string | undefined;
|
|
747
|
+
organization?: string | undefined;
|
|
748
|
+
audience?: string | undefined;
|
|
746
749
|
act_as?: string | undefined;
|
|
747
750
|
response_type?: import("@authhero/adapter-interfaces").AuthorizationResponseType | undefined;
|
|
748
751
|
response_mode?: import("@authhero/adapter-interfaces").AuthorizationResponseMode | undefined;
|
|
749
|
-
redirect_uri?: string | undefined;
|
|
750
|
-
audience?: string | undefined;
|
|
751
|
-
organization?: string | undefined;
|
|
752
752
|
nonce?: string | undefined;
|
|
753
753
|
scope?: string | undefined;
|
|
754
754
|
prompt?: string | undefined;
|
|
@@ -775,16 +775,16 @@ export default function create(config: AuthHeroConfig): OpenAPIHono<{
|
|
|
775
775
|
client_id: string;
|
|
776
776
|
connection: "sms";
|
|
777
777
|
phone_number: string;
|
|
778
|
-
send: "
|
|
778
|
+
send: "link" | "code";
|
|
779
779
|
authParams: {
|
|
780
780
|
username?: string | undefined;
|
|
781
781
|
state?: string | undefined;
|
|
782
|
+
redirect_uri?: string | undefined;
|
|
783
|
+
organization?: string | undefined;
|
|
784
|
+
audience?: string | undefined;
|
|
782
785
|
act_as?: string | undefined;
|
|
783
786
|
response_type?: import("@authhero/adapter-interfaces").AuthorizationResponseType | undefined;
|
|
784
787
|
response_mode?: import("@authhero/adapter-interfaces").AuthorizationResponseMode | undefined;
|
|
785
|
-
redirect_uri?: string | undefined;
|
|
786
|
-
audience?: string | undefined;
|
|
787
|
-
organization?: string | undefined;
|
|
788
788
|
nonce?: string | undefined;
|
|
789
789
|
scope?: string | undefined;
|
|
790
790
|
prompt?: string | undefined;
|