@lifeaitools/clauth 1.5.36 → 1.5.37
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/cli/commands/serve.js +7 -6
- package/package.json +1 -1
package/cli/commands/serve.js
CHANGED
|
@@ -2914,7 +2914,7 @@ function createServer(initPassword, whitelist, port, tunnelHostnameInit = null,
|
|
|
2914
2914
|
const base = oauthBase();
|
|
2915
2915
|
const suffix = reqPath.replace("/.well-known/oauth-protected-resource", "").replace(/^\//, "");
|
|
2916
2916
|
const resourcePath = suffix && ["/gws", "/clauth", "/mcp", "/sse"].includes("/" + suffix) ? "/" + suffix : "/sse";
|
|
2917
|
-
res.writeHead(200, { "Content-Type": "application/json", ...CORS });
|
|
2917
|
+
res.writeHead(200, { "Content-Type": "application/json", "Cache-Control": "no-store", ...CORS });
|
|
2918
2918
|
return res.end(JSON.stringify({
|
|
2919
2919
|
resource: `${base}${resourcePath}`,
|
|
2920
2920
|
authorization_servers: [base],
|
|
@@ -2925,7 +2925,7 @@ function createServer(initPassword, whitelist, port, tunnelHostnameInit = null,
|
|
|
2925
2925
|
|
|
2926
2926
|
if (reqPath === "/.well-known/oauth-authorization-server") {
|
|
2927
2927
|
const base = oauthBase();
|
|
2928
|
-
res.writeHead(200, { "Content-Type": "application/json", ...CORS });
|
|
2928
|
+
res.writeHead(200, { "Content-Type": "application/json", "Cache-Control": "no-store", ...CORS });
|
|
2929
2929
|
return res.end(JSON.stringify({
|
|
2930
2930
|
issuer: base,
|
|
2931
2931
|
authorization_endpoint: `${base}/authorize`,
|
|
@@ -2959,7 +2959,7 @@ function createServer(initPassword, whitelist, port, tunnelHostnameInit = null,
|
|
|
2959
2959
|
oauthClients.set(clientId, client);
|
|
2960
2960
|
const logMsg = `[${new Date().toISOString()}] OAuth: registered public client ${clientId} (${client.client_name})\n`;
|
|
2961
2961
|
try { fs.appendFileSync(LOG_FILE, logMsg); } catch {}
|
|
2962
|
-
res.writeHead(201, { "Content-Type": "application/json", ...CORS });
|
|
2962
|
+
res.writeHead(201, { "Content-Type": "application/json", "Cache-Control": "no-store", ...CORS });
|
|
2963
2963
|
return res.end(JSON.stringify(client));
|
|
2964
2964
|
}
|
|
2965
2965
|
|
|
@@ -3011,7 +3011,7 @@ function createServer(initPassword, whitelist, port, tunnelHostnameInit = null,
|
|
|
3011
3011
|
|
|
3012
3012
|
const logMsg = `[${new Date().toISOString()}] OAuth: authorize → code for ${clientId}, redirect to ${redirect.origin}\n`;
|
|
3013
3013
|
try { fs.appendFileSync(LOG_FILE, logMsg); } catch {}
|
|
3014
|
-
res.writeHead(302, { Location: redirect.toString(), ...CORS });
|
|
3014
|
+
res.writeHead(302, { Location: redirect.toString(), "Cache-Control": "no-store", ...CORS });
|
|
3015
3015
|
return res.end();
|
|
3016
3016
|
}
|
|
3017
3017
|
|
|
@@ -3082,7 +3082,7 @@ function createServer(initPassword, whitelist, port, tunnelHostnameInit = null,
|
|
|
3082
3082
|
|
|
3083
3083
|
const logMsg = `[${new Date().toISOString()}] OAuth: token issued for ${stored.client_id} (token=${accessToken.slice(0,8)}…)\n`;
|
|
3084
3084
|
try { fs.appendFileSync(LOG_FILE, logMsg); } catch {}
|
|
3085
|
-
res.writeHead(200, { "Content-Type": "application/json", ...CORS });
|
|
3085
|
+
res.writeHead(200, { "Content-Type": "application/json", "Cache-Control": "no-store", ...CORS });
|
|
3086
3086
|
return res.end(JSON.stringify({ access_token: accessToken, token_type: "Bearer", scope: "mcp:tools", expires_in: 86400 }));
|
|
3087
3087
|
}
|
|
3088
3088
|
|
|
@@ -3112,7 +3112,8 @@ function createServer(initPassword, whitelist, port, tunnelHostnameInit = null,
|
|
|
3112
3112
|
const resourceMeta = `${base}/.well-known/oauth-protected-resource/${resourcePath}`;
|
|
3113
3113
|
res.writeHead(401, {
|
|
3114
3114
|
"Content-Type": "application/json",
|
|
3115
|
-
"WWW-Authenticate": `Bearer resource_metadata="${resourceMeta}"`,
|
|
3115
|
+
"WWW-Authenticate": `Bearer realm="MCP", resource_metadata="${resourceMeta}"`,
|
|
3116
|
+
"Cache-Control": "no-store",
|
|
3116
3117
|
...CORS,
|
|
3117
3118
|
});
|
|
3118
3119
|
return res.end(JSON.stringify({
|