@absolutejs/auth 0.40.0 → 0.42.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 +46 -9
- package/dist/index.js.map +4 -4
- package/dist/oidc/config.d.ts +1 -0
- 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 {};
|
|
@@ -6151,6 +6170,9 @@ var oidcProviderRoutes = (config) => {
|
|
|
6151
6170
|
if (mtlsResult !== undefined)
|
|
6152
6171
|
return mtlsResult;
|
|
6153
6172
|
const clientSecret = bodyClientSecret ?? basicClientSecret;
|
|
6173
|
+
if (config.strictFapi === true && clientSecret !== undefined) {
|
|
6174
|
+
return;
|
|
6175
|
+
}
|
|
6154
6176
|
const client = await authenticateClient(clientId, clientSecret);
|
|
6155
6177
|
return client === undefined ? undefined : { client, clientCertThumbprint: undefined };
|
|
6156
6178
|
};
|
|
@@ -6364,12 +6386,14 @@ var oidcProviderRoutes = (config) => {
|
|
|
6364
6386
|
request_object_signing_alg_values_supported: ["ES256"],
|
|
6365
6387
|
request_parameter_supported: true,
|
|
6366
6388
|
require_signed_request_object_supported: true,
|
|
6389
|
+
authorization_response_iss_parameter_supported: true,
|
|
6390
|
+
response_modes_supported: ["query", "form_post"],
|
|
6367
6391
|
response_types_supported: ["code"],
|
|
6368
6392
|
revocation_endpoint: `${issuer}${revokeRoute}`,
|
|
6369
6393
|
subject_types_supported: ["public"],
|
|
6370
6394
|
tls_client_certificate_bound_access_tokens: true,
|
|
6371
6395
|
token_endpoint: tokenUrl,
|
|
6372
|
-
token_endpoint_auth_methods_supported: [
|
|
6396
|
+
token_endpoint_auth_methods_supported: config.strictFapi === true ? ["private_key_jwt", "self_signed_tls_client_auth"] : [
|
|
6373
6397
|
"client_secret_basic",
|
|
6374
6398
|
"client_secret_post",
|
|
6375
6399
|
"none",
|
|
@@ -6382,6 +6406,9 @@ var oidcProviderRoutes = (config) => {
|
|
|
6382
6406
|
if (config.deviceAuthorizationStore) {
|
|
6383
6407
|
discovery.device_authorization_endpoint = `${issuer}${deviceAuthorizationRoute}`;
|
|
6384
6408
|
}
|
|
6409
|
+
if (config.strictFapi === true) {
|
|
6410
|
+
discovery.require_pushed_authorization_requests = true;
|
|
6411
|
+
}
|
|
6385
6412
|
if (config.backchannelAuthStore) {
|
|
6386
6413
|
discovery.backchannel_authentication_endpoint = `${issuer}${backchannelAuthorizationRoute}`;
|
|
6387
6414
|
discovery.backchannel_token_delivery_modes_supported = ["poll"];
|
|
@@ -6475,6 +6502,7 @@ var oidcProviderRoutes = (config) => {
|
|
|
6475
6502
|
code_challenge_method: codeChallengeMethod,
|
|
6476
6503
|
nonce,
|
|
6477
6504
|
redirect_uri: redirectUri,
|
|
6505
|
+
response_mode: requestedResponseMode,
|
|
6478
6506
|
response_type: responseType,
|
|
6479
6507
|
scope,
|
|
6480
6508
|
state
|
|
@@ -6483,13 +6511,18 @@ var oidcProviderRoutes = (config) => {
|
|
|
6483
6511
|
if (client === undefined || clientId !== client.clientId || redirectUri === undefined || !client.redirectUris.includes(redirectUri)) {
|
|
6484
6512
|
return jsonResponse({ error: "invalid_client" }, HTTP_BAD_REQUEST2);
|
|
6485
6513
|
}
|
|
6514
|
+
const responseMode = requestedResponseMode === "form_post" ? "form_post" : "query";
|
|
6515
|
+
if (requestedResponseMode !== undefined && requestedResponseMode !== "query" && requestedResponseMode !== "form_post") {
|
|
6516
|
+
return jsonResponse({ error: "unsupported_response_mode" }, HTTP_BAD_REQUEST2);
|
|
6517
|
+
}
|
|
6486
6518
|
const errorRedirect = (error) => {
|
|
6487
|
-
const params2 =
|
|
6519
|
+
const params2 = { error, iss: issuer };
|
|
6488
6520
|
if (state !== undefined)
|
|
6489
|
-
params2.
|
|
6490
|
-
return
|
|
6521
|
+
params2.state = state;
|
|
6522
|
+
return respondToClient(redirectUri, responseMode, params2);
|
|
6491
6523
|
};
|
|
6492
|
-
|
|
6524
|
+
const requirePar = client.requirePushedAuthorizationRequests === true || config.strictFapi === true;
|
|
6525
|
+
if (requirePar && query.request_uri === undefined) {
|
|
6493
6526
|
return errorRedirect("invalid_request");
|
|
6494
6527
|
}
|
|
6495
6528
|
if (client.requireSignedRequestObject === true && query.request === undefined && query.request_uri === undefined) {
|
|
@@ -6556,10 +6589,13 @@ var oidcProviderRoutes = (config) => {
|
|
|
6556
6589
|
scopes: granted,
|
|
6557
6590
|
userId: getUserId(userSession.user)
|
|
6558
6591
|
});
|
|
6559
|
-
const params =
|
|
6592
|
+
const params = {
|
|
6593
|
+
code,
|
|
6594
|
+
iss: issuer
|
|
6595
|
+
};
|
|
6560
6596
|
if (state !== undefined)
|
|
6561
|
-
params.
|
|
6562
|
-
return
|
|
6597
|
+
params.state = state;
|
|
6598
|
+
return respondToClient(redirectUri, responseMode, params);
|
|
6563
6599
|
}, {
|
|
6564
6600
|
cookie: t12.Cookie({
|
|
6565
6601
|
user_session_id: t12.Optional(userSessionIdTypebox)
|
|
@@ -6577,6 +6613,7 @@ var oidcProviderRoutes = (config) => {
|
|
|
6577
6613
|
redirect_uri: t12.Optional(t12.String()),
|
|
6578
6614
|
request: t12.Optional(t12.String()),
|
|
6579
6615
|
request_uri: t12.Optional(t12.String()),
|
|
6616
|
+
response_mode: t12.Optional(t12.String()),
|
|
6580
6617
|
response_type: t12.Optional(t12.String()),
|
|
6581
6618
|
scope: t12.Optional(t12.String()),
|
|
6582
6619
|
state: t12.Optional(t12.String())
|
|
@@ -26150,5 +26187,5 @@ export {
|
|
|
26150
26187
|
AuthIdentityConflictError
|
|
26151
26188
|
};
|
|
26152
26189
|
|
|
26153
|
-
//# debugId=
|
|
26190
|
+
//# debugId=02ED8EE4D0AFE4F564756E2164756E21
|
|
26154
26191
|
//# sourceMappingURL=index.js.map
|