@absolutejs/auth 0.40.0-beta.2 → 0.41.0
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.d.ts +1 -0
- package/dist/index.js +37 -7
- package/dist/index.js.map +3 -3
- package/dist/oidc/routes.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -13533,6 +13533,7 @@ export declare const auth: <UserType>({ providersConfiguration, authorizeRoute,
|
|
|
13533
13533
|
max_age?: string | undefined;
|
|
13534
13534
|
prompt?: string | undefined;
|
|
13535
13535
|
request_uri?: string | undefined;
|
|
13536
|
+
response_mode?: string | undefined;
|
|
13536
13537
|
response_type?: string | undefined;
|
|
13537
13538
|
state?: string | undefined;
|
|
13538
13539
|
};
|
package/dist/index.js
CHANGED
|
@@ -6050,6 +6050,25 @@ var jsonResponse = (value, status) => new Response(JSON.stringify(value), {
|
|
|
6050
6050
|
var oauthError2 = (status, error) => jsonResponse({ error }, status);
|
|
6051
6051
|
var tokenResponse = (tokens) => jsonResponse(tokens, HTTP_OK2);
|
|
6052
6052
|
var redirectTo = (url) => new Response(null, { headers: { location: url }, status: HTTP_FOUND });
|
|
6053
|
+
var escapeHtmlAttr = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """);
|
|
6054
|
+
var formPostResponse = (redirectUri, params) => {
|
|
6055
|
+
const inputs = Object.entries(params).map(([name, value]) => `<input type="hidden" name="${escapeHtmlAttr(name)}" value="${escapeHtmlAttr(value)}" />`).join("");
|
|
6056
|
+
const body = `<!DOCTYPE html><html><head><meta charset="utf-8" />` + `<title>Submitting\u2026</title></head>` + `<body onload="document.forms[0].submit()">` + `<form method="post" action="${escapeHtmlAttr(redirectUri)}">${inputs}` + `<noscript><button type="submit">Continue</button></noscript>` + `</form></body></html>`;
|
|
6057
|
+
return new Response(body, {
|
|
6058
|
+
headers: {
|
|
6059
|
+
"cache-control": "no-store",
|
|
6060
|
+
"content-type": "text/html;charset=UTF-8"
|
|
6061
|
+
},
|
|
6062
|
+
status: HTTP_OK2
|
|
6063
|
+
});
|
|
6064
|
+
};
|
|
6065
|
+
var respondToClient = (redirectUri, responseMode, params) => {
|
|
6066
|
+
if (responseMode === "form_post") {
|
|
6067
|
+
return formPostResponse(redirectUri, params);
|
|
6068
|
+
}
|
|
6069
|
+
const search = new URLSearchParams(params);
|
|
6070
|
+
return redirectTo(`${redirectUri}?${search.toString()}`);
|
|
6071
|
+
};
|
|
6053
6072
|
var readBasicAuth2 = (authorization) => {
|
|
6054
6073
|
if (authorization === undefined || !authorization.startsWith(BASIC_PREFIX2)) {
|
|
6055
6074
|
return {};
|
|
@@ -6364,6 +6383,8 @@ var oidcProviderRoutes = (config) => {
|
|
|
6364
6383
|
request_object_signing_alg_values_supported: ["ES256"],
|
|
6365
6384
|
request_parameter_supported: true,
|
|
6366
6385
|
require_signed_request_object_supported: true,
|
|
6386
|
+
authorization_response_iss_parameter_supported: true,
|
|
6387
|
+
response_modes_supported: ["query", "form_post"],
|
|
6367
6388
|
response_types_supported: ["code"],
|
|
6368
6389
|
revocation_endpoint: `${issuer}${revokeRoute}`,
|
|
6369
6390
|
subject_types_supported: ["public"],
|
|
@@ -6475,6 +6496,7 @@ var oidcProviderRoutes = (config) => {
|
|
|
6475
6496
|
code_challenge_method: codeChallengeMethod,
|
|
6476
6497
|
nonce,
|
|
6477
6498
|
redirect_uri: redirectUri,
|
|
6499
|
+
response_mode: requestedResponseMode,
|
|
6478
6500
|
response_type: responseType,
|
|
6479
6501
|
scope,
|
|
6480
6502
|
state
|
|
@@ -6483,11 +6505,15 @@ var oidcProviderRoutes = (config) => {
|
|
|
6483
6505
|
if (client === undefined || clientId !== client.clientId || redirectUri === undefined || !client.redirectUris.includes(redirectUri)) {
|
|
6484
6506
|
return jsonResponse({ error: "invalid_client" }, HTTP_BAD_REQUEST2);
|
|
6485
6507
|
}
|
|
6508
|
+
const responseMode = requestedResponseMode === "form_post" ? "form_post" : "query";
|
|
6509
|
+
if (requestedResponseMode !== undefined && requestedResponseMode !== "query" && requestedResponseMode !== "form_post") {
|
|
6510
|
+
return jsonResponse({ error: "unsupported_response_mode" }, HTTP_BAD_REQUEST2);
|
|
6511
|
+
}
|
|
6486
6512
|
const errorRedirect = (error) => {
|
|
6487
|
-
const params2 =
|
|
6513
|
+
const params2 = { error, iss: issuer };
|
|
6488
6514
|
if (state !== undefined)
|
|
6489
|
-
params2.
|
|
6490
|
-
return
|
|
6515
|
+
params2.state = state;
|
|
6516
|
+
return respondToClient(redirectUri, responseMode, params2);
|
|
6491
6517
|
};
|
|
6492
6518
|
if (client.requirePushedAuthorizationRequests === true && query.request_uri === undefined) {
|
|
6493
6519
|
return errorRedirect("invalid_request");
|
|
@@ -6556,10 +6582,13 @@ var oidcProviderRoutes = (config) => {
|
|
|
6556
6582
|
scopes: granted,
|
|
6557
6583
|
userId: getUserId(userSession.user)
|
|
6558
6584
|
});
|
|
6559
|
-
const params =
|
|
6585
|
+
const params = {
|
|
6586
|
+
code,
|
|
6587
|
+
iss: issuer
|
|
6588
|
+
};
|
|
6560
6589
|
if (state !== undefined)
|
|
6561
|
-
params.
|
|
6562
|
-
return
|
|
6590
|
+
params.state = state;
|
|
6591
|
+
return respondToClient(redirectUri, responseMode, params);
|
|
6563
6592
|
}, {
|
|
6564
6593
|
cookie: t12.Cookie({
|
|
6565
6594
|
user_session_id: t12.Optional(userSessionIdTypebox)
|
|
@@ -6577,6 +6606,7 @@ var oidcProviderRoutes = (config) => {
|
|
|
6577
6606
|
redirect_uri: t12.Optional(t12.String()),
|
|
6578
6607
|
request: t12.Optional(t12.String()),
|
|
6579
6608
|
request_uri: t12.Optional(t12.String()),
|
|
6609
|
+
response_mode: t12.Optional(t12.String()),
|
|
6580
6610
|
response_type: t12.Optional(t12.String()),
|
|
6581
6611
|
scope: t12.Optional(t12.String()),
|
|
6582
6612
|
state: t12.Optional(t12.String())
|
|
@@ -26150,5 +26180,5 @@ export {
|
|
|
26150
26180
|
AuthIdentityConflictError
|
|
26151
26181
|
};
|
|
26152
26182
|
|
|
26153
|
-
//# debugId=
|
|
26183
|
+
//# debugId=3861326B7894F72964756E2164756E21
|
|
26154
26184
|
//# sourceMappingURL=index.js.map
|