@forklaunch/core 1.3.4 → 1.3.6
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/lib/{apiDefinition.types-D3fcC39w.d.ts → apiDefinition.types-CAOGkjXe.d.ts} +23 -7
- package/lib/{apiDefinition.types-pmtOHamW.d.mts → apiDefinition.types-CN-qa49j.d.mts} +23 -7
- package/lib/http/index.d.mts +2 -2
- package/lib/http/index.d.ts +2 -2
- package/lib/http/index.js +10 -4
- package/lib/http/index.js.map +1 -1
- package/lib/http/index.mjs +10 -4
- package/lib/http/index.mjs.map +1 -1
- package/lib/ws/index.d.mts +1 -1
- package/lib/ws/index.d.ts +1 -1
- package/package.json +4 -4
package/lib/http/index.mjs
CHANGED
|
@@ -680,7 +680,7 @@ function parseHmacTokenPart(part, expectedKey) {
|
|
|
680
680
|
if (key !== expectedKey || rest.length === 0) return void 0;
|
|
681
681
|
return rest.join("=");
|
|
682
682
|
}
|
|
683
|
-
async function checkAuthorizationToken(req, authorizationMethod, authorizationToken, globalOptions) {
|
|
683
|
+
async function checkAuthorizationToken(req, authorizationMethod, authorizationToken, globalOptions, access) {
|
|
684
684
|
if (authorizationMethod == null) {
|
|
685
685
|
return void 0;
|
|
686
686
|
}
|
|
@@ -817,7 +817,8 @@ async function checkAuthorizationToken(req, authorizationMethod, authorizationTo
|
|
|
817
817
|
}
|
|
818
818
|
}
|
|
819
819
|
}
|
|
820
|
-
if (
|
|
820
|
+
if (access === "authenticated" || access === "internal") {
|
|
821
|
+
} else if (hasPermissionChecks(collapsedAuthorizationMethod)) {
|
|
821
822
|
if (!collapsedAuthorizationMethod.surfacePermissions) {
|
|
822
823
|
return [500, "No permission surfacing function provided."];
|
|
823
824
|
}
|
|
@@ -857,7 +858,7 @@ async function checkAuthorizationToken(req, authorizationMethod, authorizationTo
|
|
|
857
858
|
return invalidAuthorizationTokenRoles;
|
|
858
859
|
}
|
|
859
860
|
}
|
|
860
|
-
} else {
|
|
861
|
+
} else if (access === "protected") {
|
|
861
862
|
return invalidAuthorizationMethod;
|
|
862
863
|
}
|
|
863
864
|
if (hasSubscriptionChecks(collapsedAuthorizationMethod)) {
|
|
@@ -890,9 +891,14 @@ async function checkAuthorizationToken(req, authorizationMethod, authorizationTo
|
|
|
890
891
|
}
|
|
891
892
|
}
|
|
892
893
|
async function parseRequestAuth(req, res, next) {
|
|
894
|
+
const access = req.contractDetails.access;
|
|
895
|
+
if (access === "public") {
|
|
896
|
+
next?.();
|
|
897
|
+
return;
|
|
898
|
+
}
|
|
893
899
|
const auth = req.contractDetails.auth;
|
|
894
900
|
const token = req.headers[auth?.headerName ?? "Authorization"] || req.headers[auth?.headerName ?? "authorization"];
|
|
895
|
-
const [error, message] = await checkAuthorizationToken(req, auth, token, req._globalOptions?.()?.auth) ?? [];
|
|
901
|
+
const [error, message] = await checkAuthorizationToken(req, auth, token, req._globalOptions?.()?.auth, access) ?? [];
|
|
896
902
|
if (error != null) {
|
|
897
903
|
req.openTelemetryCollector?.error(
|
|
898
904
|
message || "Authorization Failed",
|