@absolutejs/auth 0.52.0 → 0.52.1
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/index.js +14 -3
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6435,6 +6435,17 @@ var jsonResponse = (value, status) => new Response(JSON.stringify(value), {
|
|
|
6435
6435
|
});
|
|
6436
6436
|
var oauthError2 = (status, error) => jsonResponse({ error }, status);
|
|
6437
6437
|
var tokenResponse = (tokens) => jsonResponse(tokens, HTTP_OK2);
|
|
6438
|
+
var canonicalizeRequestUrl = (requestUrl, issuer) => {
|
|
6439
|
+
try {
|
|
6440
|
+
const url = new URL(requestUrl);
|
|
6441
|
+
const base = new URL(issuer);
|
|
6442
|
+
url.protocol = base.protocol;
|
|
6443
|
+
url.host = base.host;
|
|
6444
|
+
return url.toString();
|
|
6445
|
+
} catch {
|
|
6446
|
+
return requestUrl;
|
|
6447
|
+
}
|
|
6448
|
+
};
|
|
6438
6449
|
var redirectTo = (url) => new Response(null, { headers: { location: url }, status: HTTP_FOUND });
|
|
6439
6450
|
var escapeHtmlAttr = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """);
|
|
6440
6451
|
var formPostResponse = (redirectUri, params) => {
|
|
@@ -6948,7 +6959,7 @@ var oidcProviderRoutes = (config) => {
|
|
|
6948
6959
|
if (wantsSilent) {
|
|
6949
6960
|
return errorRedirect(userSession === undefined ? "login_required" : "interaction_required");
|
|
6950
6961
|
}
|
|
6951
|
-
return loginUrl === undefined ? jsonResponse({ error: "login_required" }, HTTP_UNAUTHORIZED2) : redirectTo(`${loginUrl}?return_to=${encodeURIComponent(request.url)}`);
|
|
6962
|
+
return loginUrl === undefined ? jsonResponse({ error: "login_required" }, HTTP_UNAUTHORIZED2) : redirectTo(`${loginUrl}?return_to=${encodeURIComponent(canonicalizeRequestUrl(request.url, issuer))}`);
|
|
6952
6963
|
}
|
|
6953
6964
|
const requested = scope === undefined || scope.length === 0 ? client.scopes : scope.split(" ").filter((entry) => client.scopes.includes(entry));
|
|
6954
6965
|
if (config.consentUrl !== undefined && await config.needsConsent?.({
|
|
@@ -6960,7 +6971,7 @@ var oidcProviderRoutes = (config) => {
|
|
|
6960
6971
|
user: userSession.user
|
|
6961
6972
|
}) === true) {
|
|
6962
6973
|
const consentTarget = new URL(config.consentUrl, issuer);
|
|
6963
|
-
consentTarget.searchParams.set("return_to", request.url);
|
|
6974
|
+
consentTarget.searchParams.set("return_to", canonicalizeRequestUrl(request.url, issuer));
|
|
6964
6975
|
consentTarget.searchParams.set("client_id", client.clientId);
|
|
6965
6976
|
consentTarget.searchParams.set("client_name", client.name);
|
|
6966
6977
|
consentTarget.searchParams.set("scope", requested.join(" "));
|
|
@@ -28043,5 +28054,5 @@ export {
|
|
|
28043
28054
|
AuthIdentityConflictError
|
|
28044
28055
|
};
|
|
28045
28056
|
|
|
28046
|
-
//# debugId=
|
|
28057
|
+
//# debugId=9E1C46257073267B64756E2164756E21
|
|
28047
28058
|
//# sourceMappingURL=index.js.map
|