@sassoftware/sas-score-mcp-serverjs 1.1.2 → 1.1.4
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.js +2 -2
- package/package.json +1 -1
- package/src/oauthHandlers/authorize.js +7 -2
- package/src/processHeaders.js +3 -2
package/cli.js
CHANGED
|
@@ -266,12 +266,12 @@ let authFlow = process.env.AUTHFLOW;
|
|
|
266
266
|
let mcpHost = process.env.MCPHOST;
|
|
267
267
|
|
|
268
268
|
if (authFlow === 'oauth' || authFlow === 'oauthclient') {
|
|
269
|
-
authFlow = 'bearer';
|
|
270
269
|
authExternal = (authFlow === 'oauthclient') ? true : false;
|
|
270
|
+
authFlow = 'bearer';
|
|
271
271
|
} else if (authFlow === 'bearer') {
|
|
272
272
|
authExternal = true; // in bearer token flow we assume the token is generated externally and passed in via env variable or token file, so we set authExternal to true to indicate that
|
|
273
273
|
}
|
|
274
|
-
|
|
274
|
+
let autoLogon = process.env.AUTOLOGON != null ? process.env.AUTOLOGON.toUpperCase() : "FALSE";
|
|
275
275
|
const appEnvBase = {
|
|
276
276
|
version: version,
|
|
277
277
|
mcpType: mcpType,
|
package/package.json
CHANGED
|
@@ -8,12 +8,17 @@ import baseUrl from "./baseUrl.js";
|
|
|
8
8
|
function authorize(req, res, appContext, pkceStore, codeStore) {
|
|
9
9
|
const { response_type, redirect_uri, state, scope } = req.query;
|
|
10
10
|
console.error("===============================================================");
|
|
11
|
+
console.error("[NOTE] query parameters:", { response_type, redirect_uri, state, scope });
|
|
12
|
+
let callbackUri = appContext.mcpHost + '/callback';
|
|
13
|
+
console.error("[Note] Constructed callbackUri:", callbackUri);
|
|
14
|
+
console.error("[Note] appContext.AUTHEXTERNAL:", appContext.AUTHEXTERNAL);
|
|
11
15
|
if (appContext.AUTHEXTERNAL === true) {
|
|
12
16
|
console.error('*************************************************************');
|
|
13
17
|
console.error("[Error] Received request for /authorize endpoint with external authorization expected");
|
|
14
18
|
console.error('*************************************************************');
|
|
19
|
+
callbackUri = redirect_uri;
|
|
15
20
|
}
|
|
16
|
-
|
|
21
|
+
|
|
17
22
|
if (response_type !== "code") {
|
|
18
23
|
return res.status(400).json({ error: "unsupported_response_type" });
|
|
19
24
|
}
|
|
@@ -27,7 +32,7 @@ function authorize(req, res, appContext, pkceStore, codeStore) {
|
|
|
27
32
|
|
|
28
33
|
pkceStore.set(ourState, { codeVerifier, clientRedirectUri: redirect_uri, clientState: state, codeChallenge });
|
|
29
34
|
|
|
30
|
-
|
|
35
|
+
|
|
31
36
|
console.error("[Note] callbackUri:", callbackUri);
|
|
32
37
|
let urlConfig = {
|
|
33
38
|
response_type: "code",
|
package/src/processHeaders.js
CHANGED
|
@@ -31,7 +31,7 @@ function processHeaders(req, res, next, cache, appContext) {
|
|
|
31
31
|
//for now, ignore Authorization if authflow is not bearer
|
|
32
32
|
let token = (hdr != null) ? hdr.slice(7) : null;
|
|
33
33
|
debugger;
|
|
34
|
-
console.error('[Note} AUTHFLOW=',
|
|
34
|
+
console.error('[Note} AUTHFLOW=',appContext.AUTHFLOW);
|
|
35
35
|
console.error("[Note] External authorization :", appContext.AUTHEXTERNAL);
|
|
36
36
|
if (appContext.AUTHFLOW === 'bearer') {
|
|
37
37
|
debugger;
|
|
@@ -42,6 +42,7 @@ function processHeaders(req, res, next, cache, appContext) {
|
|
|
42
42
|
if (token != null) {
|
|
43
43
|
console.error("[Note] Using user supplied token for authorization");
|
|
44
44
|
headerCache.bearerToken = token;
|
|
45
|
+
console.error("[Note] incoming token:", token);
|
|
45
46
|
} else {
|
|
46
47
|
console.error("[Note] No Authorization token provided in header for external authorization.");
|
|
47
48
|
console.error("[Note] Returning 404 since we are configured for external token and no token provided in header.");
|
|
@@ -83,7 +84,7 @@ function processHeaders(req, res, next, cache, appContext) {
|
|
|
83
84
|
// start auth flow process since no token provided in header and we are not configured for external token
|
|
84
85
|
}
|
|
85
86
|
}
|
|
86
|
-
|
|
87
|
+
console.error("Header cache after processing:", headerCache);
|
|
87
88
|
cache.set("headerCache", headerCache);
|
|
88
89
|
next();
|
|
89
90
|
}
|