@catamorphic/work-server 0.1.0-alpha.32 → 0.1.0-alpha.36
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/README.md +10 -0
- package/dist/auth/fastify-auth.d.ts.map +1 -1
- package/dist/index.js +2 -15
- package/dist/index.js.map +3 -3
- package/package.json +18 -18
- package/src/auth/fastify-auth.ts +0 -27
package/README.md
CHANGED
|
@@ -79,6 +79,16 @@ resolves when that machine's lease is lost (`/healthz` then answers 503;
|
|
|
79
79
|
`/readyz` answers 503 whenever renewals fail); the host should then shut down so
|
|
80
80
|
its supervisor starts a fresh process.
|
|
81
81
|
|
|
82
|
+
## OAuth token endpoint
|
|
83
|
+
|
|
84
|
+
Token requests use `/api/auth/oauth2/token`, as advertised by OAuth discovery.
|
|
85
|
+
The former `/api/auth/mcp/token` URL is not supported. Reconnect saved clients
|
|
86
|
+
that still use it, and use the client authentication method registered with the
|
|
87
|
+
provider. Work does not translate form-body secrets to Basic authentication.
|
|
88
|
+
|
|
89
|
+
The one-time forward migration still converts older auth databases into the
|
|
90
|
+
current schema. See [ADR 0296](../../docs/decisions/0296-one-oauth-token-endpoint.md).
|
|
91
|
+
|
|
82
92
|
## Hooks
|
|
83
93
|
|
|
84
94
|
| Hook | Adds |
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fastify-auth.d.ts","sourceRoot":"","sources":["../../src/auth/fastify-auth.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAgC,MAAM,SAAS,CAAC;AAE7E,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACd,MAAM,kCAAkC,CAAC;AAO1C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD,2EAA2E;AAC3E,MAAM,WAAW,SAAS;IACxB,aAAa,CAAC,IAAI,EAAE;QAClB,YAAY,EAAE,MAAM,CAAC;QACrB,QAAQ,CAAC,EAAE,MAAM,CAAC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AAO,CAAC,aAAa,CAAC,CAAC;IAC3B,UAAU,CAAC,IAAI,EAAE;QACf,SAAS,EAAE,oBAAoB,GAAG,eAAe,CAAC;QAClD,oBAAoB,CAAC,EAAE,MAAM,CAAC;QAC9B,QAAQ,EAAE,aAAa,CAAC;KACzB,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;CAC5B;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACjD;AAED,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,eAAe,EACpB,OAAO,EAAE;IACP,IAAI,EAAE,QAAQ,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,iBAAiB,CAAC;IAC3B,mEAAmE;IACnE,YAAY,CAAC,EAAE,iBAAiB,CAAC;IACjC,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;;OAGG;IACH,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,gEAAgE;IAChE,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9B,GACA,IAAI,CAoQN"}
|
package/dist/index.js
CHANGED
|
@@ -3032,18 +3032,8 @@ function registerWorkAuthRoutes(app, options) {
|
|
|
3032
3032
|
if (decision && !decision.allow)
|
|
3033
3033
|
return sendTokenError(reply, decision);
|
|
3034
3034
|
}
|
|
3035
|
-
const legacySecret = request.url.split("?")[0] === "/api/auth/mcp/token" && !request.headers.authorization ? form.get("client_secret") : null;
|
|
3036
|
-
const legacyClient = form.get("client_id");
|
|
3037
|
-
const legacyAuthorization = legacySecret && legacyClient ? `Basic ${Buffer.from(`${encodeURIComponent(legacyClient)}:${encodeURIComponent(legacySecret)}`).toString("base64")}` : undefined;
|
|
3038
|
-
if (legacyAuthorization)
|
|
3039
|
-
form.delete("client_secret");
|
|
3040
3035
|
const response = await callBetterAuth(routed, request, {
|
|
3041
|
-
pathname: "/api/auth/oauth2/token"
|
|
3042
|
-
...legacyAuthorization ? {
|
|
3043
|
-
authorization: legacyAuthorization,
|
|
3044
|
-
body: form.toString(),
|
|
3045
|
-
contentType: "application/x-www-form-urlencoded"
|
|
3046
|
-
} : {}
|
|
3036
|
+
pathname: "/api/auth/oauth2/token"
|
|
3047
3037
|
});
|
|
3048
3038
|
if (!response.ok || !gate)
|
|
3049
3039
|
return sendResponse(response, reply);
|
|
@@ -3061,7 +3051,6 @@ function registerWorkAuthRoutes(app, options) {
|
|
|
3061
3051
|
return sendResponse(response, reply);
|
|
3062
3052
|
};
|
|
3063
3053
|
app.post("/api/auth/oauth2/token", token);
|
|
3064
|
-
app.post("/api/auth/mcp/token", token);
|
|
3065
3054
|
app.get("/.well-known/oauth-authorization-server", (request, reply) => forward(request, reply, "/api/auth/.well-known/oauth-authorization-server"));
|
|
3066
3055
|
app.get("/.well-known/oauth-authorization-server/api/auth", (request, reply) => forward(request, reply));
|
|
3067
3056
|
app.get("/.well-known/oauth-protected-resource", (request, reply) => forward(request, reply));
|
|
@@ -3196,8 +3185,6 @@ async function callBetterAuth(options, request, overrides) {
|
|
|
3196
3185
|
if (overrides.contentType) {
|
|
3197
3186
|
headers.set("content-type", overrides.contentType);
|
|
3198
3187
|
}
|
|
3199
|
-
if (overrides.authorization)
|
|
3200
|
-
headers.set("authorization", overrides.authorization);
|
|
3201
3188
|
if (overrides.body !== undefined) {
|
|
3202
3189
|
headers.delete("content-length");
|
|
3203
3190
|
headers.delete("content-encoding");
|
|
@@ -10828,5 +10815,5 @@ export {
|
|
|
10828
10815
|
workServerConfigFromEnv
|
|
10829
10816
|
};
|
|
10830
10817
|
|
|
10831
|
-
//# debugId=
|
|
10818
|
+
//# debugId=DC1A8906FB3873F164756E2164756E21
|
|
10832
10819
|
//# sourceMappingURL=index.js.map
|