@bostonuniversity/shibboleth-sp 1.0.3 → 1.0.5
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/cjs/index.js +9 -17
- package/dist/cjs/index.js.map +2 -2
- package/dist/esm/HandlerSp.js +12 -18
- package/dist/esm/HandlerSp.js.map +1 -1
- package/dist/esm/Http.js +1 -1
- package/dist/esm/Http.js.map +1 -1
- package/dist/esm/index.js +9 -17
- package/dist/esm/index.js.map +2 -2
- package/dist/types/HandlerSp.d.ts +1 -2
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -69788,7 +69788,7 @@ var getHost = (request) => {
|
|
|
69788
69788
|
const headers = Headers(request);
|
|
69789
69789
|
return headers.get("host");
|
|
69790
69790
|
} catch (e) {
|
|
69791
|
-
console.log(`ERROR: Unable to determine host from request: ${
|
|
69791
|
+
console.log(`ERROR: Unable to determine host from request with headers: ${Object.keys(request.headers).join(", ")}`);
|
|
69792
69792
|
}
|
|
69793
69793
|
return null;
|
|
69794
69794
|
};
|
|
@@ -69799,7 +69799,6 @@ var AUTH_PATHS = /* @__PURE__ */ ((AUTH_PATHS2) => {
|
|
|
69799
69799
|
AUTH_PATHS2["LOGOUT"] = "/logout";
|
|
69800
69800
|
AUTH_PATHS2["ASSERT"] = "/assert";
|
|
69801
69801
|
AUTH_PATHS2["METADATA"] = "/metadata";
|
|
69802
|
-
AUTH_PATHS2["FAVICON"] = "/favicon.ico";
|
|
69803
69802
|
return AUTH_PATHS2;
|
|
69804
69803
|
})(AUTH_PATHS || {});
|
|
69805
69804
|
var APP_AUTHORIZATION_HEADER_NAME = "app_authorization";
|
|
@@ -69845,8 +69844,8 @@ var handler = async (originRequest, config) => {
|
|
|
69845
69844
|
let response;
|
|
69846
69845
|
const qsparms = querystring ? new URLSearchParams(querystring) : null;
|
|
69847
69846
|
console.log(`uri: ${uri}`);
|
|
69848
|
-
console.log(`querystring: ${
|
|
69849
|
-
const { LOGIN, LOGOUT, ASSERT, METADATA
|
|
69847
|
+
console.log(`querystring parameters: ${qsparms ? [...qsparms.keys()].join(", ") : ""}`);
|
|
69848
|
+
const { LOGIN, LOGOUT, ASSERT, METADATA } = AUTH_PATHS;
|
|
69850
69849
|
const getAppLoginUrl = () => {
|
|
69851
69850
|
const relay_state = encodeURIComponent(relayDomain + uri + (querystring ? `?${querystring}` : ""));
|
|
69852
69851
|
return `${relayDomain}${"/login" /* LOGIN */}?relay_state=${relay_state}`;
|
|
@@ -69892,13 +69891,12 @@ var handler = async (originRequest, config) => {
|
|
|
69892
69891
|
break;
|
|
69893
69892
|
case ASSERT:
|
|
69894
69893
|
const result2 = await samlTools.sendAssert(originRequest);
|
|
69895
|
-
const message = `Authentication successful. result: ${JSON.stringify(result2, null, 2)}`;
|
|
69896
69894
|
var { samlAssertResponse, relayState } = result2;
|
|
69897
69895
|
relayState = decodeURIComponent(relayState || relayDomain);
|
|
69898
69896
|
if (!samlAssertResponse) break;
|
|
69899
|
-
debugPrint(
|
|
69900
|
-
console.log(`relayState: ${relayState}`);
|
|
69897
|
+
debugPrint("Authentication successful.");
|
|
69901
69898
|
const redirectUrl = new URL(relayState);
|
|
69899
|
+
console.log(`relayState: ${redirectUrl.origin}${redirectUrl.pathname}`);
|
|
69902
69900
|
redirectUrl.searchParams.append("after_auth", "true");
|
|
69903
69901
|
response = {
|
|
69904
69902
|
status: "302",
|
|
@@ -69911,7 +69909,7 @@ var handler = async (originRequest, config) => {
|
|
|
69911
69909
|
sub: samlAssertResponse.user.name_id,
|
|
69912
69910
|
user: samlAssertResponse.user.attributes
|
|
69913
69911
|
};
|
|
69914
|
-
console.log(`Setting JWT: ${
|
|
69912
|
+
console.log(`Setting JWT with attributes: ${Object.keys(cookieValue.user || {}).join(", ")}`);
|
|
69915
69913
|
jwtTools.setCookieInResponse(response, cookieValue);
|
|
69916
69914
|
break;
|
|
69917
69915
|
case METADATA:
|
|
@@ -69924,12 +69922,6 @@ var handler = async (originRequest, config) => {
|
|
|
69924
69922
|
}
|
|
69925
69923
|
};
|
|
69926
69924
|
break;
|
|
69927
|
-
case FAVICON:
|
|
69928
|
-
response = {
|
|
69929
|
-
status: "200",
|
|
69930
|
-
statusDescription: "OK"
|
|
69931
|
-
};
|
|
69932
|
-
break;
|
|
69933
69925
|
default:
|
|
69934
69926
|
const afterAuth = decodeURIComponent(qsparms ? qsparms.get("after_auth") || "" : "");
|
|
69935
69927
|
const validToken = jwtTools.hasValidToken(originRequest);
|
|
@@ -69950,7 +69942,7 @@ var handler = async (originRequest, config) => {
|
|
|
69950
69942
|
const { key, value } = customHeaders[i];
|
|
69951
69943
|
addHeader(response, key, encodeURIComponent(value));
|
|
69952
69944
|
}
|
|
69953
|
-
console.log(`Valid JWT found - passing through to origin: ${
|
|
69945
|
+
console.log(`Valid JWT found - passing through to origin with headers: ${Object.keys(response.headers).join(", ")}`);
|
|
69954
69946
|
} else if (afterAuth.toLocaleLowerCase() === "true") {
|
|
69955
69947
|
response = {
|
|
69956
69948
|
status: "500",
|
|
@@ -69960,7 +69952,7 @@ var handler = async (originRequest, config) => {
|
|
|
69960
69952
|
"content-type": [{ key: "Content-Type", value: "text/plain" }]
|
|
69961
69953
|
}
|
|
69962
69954
|
};
|
|
69963
|
-
console.log(`No valid JWT found after authentication
|
|
69955
|
+
console.log(`No valid JWT found after authentication - responding ${response.status}`);
|
|
69964
69956
|
} else if (appAuthorization) {
|
|
69965
69957
|
response = originRequest;
|
|
69966
69958
|
addHeader(response, "authenticated", "false");
|
|
@@ -69980,7 +69972,7 @@ var handler = async (originRequest, config) => {
|
|
|
69980
69972
|
location: [{ key: "Location", value: getAppLoginUrl() }]
|
|
69981
69973
|
}
|
|
69982
69974
|
};
|
|
69983
|
-
console.log(`No valid JWT found - redirecting
|
|
69975
|
+
console.log(`No valid JWT found - redirecting to ${LOGIN}`);
|
|
69984
69976
|
}
|
|
69985
69977
|
break;
|
|
69986
69978
|
}
|