@absolutejs/auth 0.29.0-beta.4 → 0.29.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.js CHANGED
@@ -4230,6 +4230,7 @@ var exchangeToken = async ({
4230
4230
  };
4231
4231
  };
4232
4232
  var issueTokenSet = async ({
4233
+ acr,
4233
4234
  claims,
4234
4235
  clientId,
4235
4236
  config,
@@ -4250,7 +4251,7 @@ var issueTokenSet = async ({
4250
4251
  const accessPayload = buildAccessClaims({
4251
4252
  clientId,
4252
4253
  dpopJkt,
4253
- extraClaims: accessExtra,
4254
+ extraClaims: { ...accessExtra, ...acr === undefined ? {} : { acr } },
4254
4255
  issuer: config.issuer,
4255
4256
  now,
4256
4257
  scopes,
@@ -4267,8 +4268,11 @@ var issueTokenSet = async ({
4267
4268
  };
4268
4269
  if (nonce !== undefined)
4269
4270
  idPayload.nonce = nonce;
4271
+ if (acr !== undefined)
4272
+ idPayload.acr = acr;
4270
4273
  const refreshToken = generateSecureToken(TOKEN_BYTES2);
4271
4274
  await config.refreshTokenStore.saveToken({
4275
+ acr,
4272
4276
  claims,
4273
4277
  clientId,
4274
4278
  createdAt: now,
@@ -4554,6 +4558,45 @@ var verifyClientAssertion = async ({
4554
4558
  // src/oidc/dpop.ts
4555
4559
  var DEFAULT_MAX_AGE_MS = 60000;
4556
4560
  var SECONDS_TO_MS = 1000;
4561
+ var NONCE_WINDOW_SECONDS = 120;
4562
+ var NONCE_WINDOW_MS = NONCE_WINDOW_SECONDS * MILLISECONDS_IN_A_SECOND;
4563
+ var NONCE_PREVIOUS_WINDOWS_ACCEPTED = 1;
4564
+ var hmacSha2562 = async (secret, message) => {
4565
+ const encoder = new TextEncoder;
4566
+ const key = await crypto.subtle.importKey("raw", encoder.encode(secret), { hash: "SHA-256", name: "HMAC" }, false, ["sign"]);
4567
+ const signature = await crypto.subtle.sign("HMAC", key, encoder.encode(message));
4568
+ return Buffer.from(new Uint8Array(signature)).toString("base64url");
4569
+ };
4570
+ var extractDpopNonceClaim = (proof) => {
4571
+ const [, payloadSegment] = proof.split(".");
4572
+ if (payloadSegment === undefined)
4573
+ return;
4574
+ try {
4575
+ const payload = JSON.parse(Buffer.from(payloadSegment, "base64url").toString("utf8"));
4576
+ if (typeof payload !== "object" || payload === null)
4577
+ return;
4578
+ const value = payload.nonce;
4579
+ return typeof value === "string" ? value : undefined;
4580
+ } catch {
4581
+ return;
4582
+ }
4583
+ };
4584
+ var mintDpopNonce = async ({
4585
+ now = Date.now(),
4586
+ secret
4587
+ }) => {
4588
+ const window = Math.floor(now / NONCE_WINDOW_MS);
4589
+ return hmacSha2562(secret, String(window));
4590
+ };
4591
+ var verifyDpopNonce = async ({
4592
+ now = Date.now(),
4593
+ nonce,
4594
+ secret
4595
+ }) => {
4596
+ const currentWindow = Math.floor(now / NONCE_WINDOW_MS);
4597
+ const candidates = await Promise.all(Array.from({ length: NONCE_PREVIOUS_WINDOWS_ACCEPTED + 1 }, (_, offset) => hmacSha2562(secret, String(currentWindow - offset))));
4598
+ return candidates.some((expected) => expected === nonce);
4599
+ };
4557
4600
  var decodeHeader = (segment) => JSON.parse(Buffer.from(segment, "base64url").toString("utf8"));
4558
4601
  var normalizeHtu = (value) => {
4559
4602
  try {
@@ -4727,6 +4770,70 @@ var fanOutBackchannelLogout = async ({
4727
4770
  return reachable.map(({ client }) => client.clientId);
4728
4771
  };
4729
4772
 
4773
+ // src/oidc/par.ts
4774
+ var REQUEST_URI_BYTES = 32;
4775
+ var DEFAULT_PAR_TTL_SECONDS = 90;
4776
+ var DEFAULT_PAR_TTL_MS = DEFAULT_PAR_TTL_SECONDS * MILLISECONDS_IN_A_SECOND;
4777
+ var REQUEST_URI_PREFIX = "urn:ietf:params:oauth:request_uri:";
4778
+ var buildRequestUri = (token) => `${REQUEST_URI_PREFIX}${token}`;
4779
+ var extractToken = (requestUri) => {
4780
+ if (!requestUri.startsWith(REQUEST_URI_PREFIX))
4781
+ return;
4782
+ return requestUri.slice(REQUEST_URI_PREFIX.length);
4783
+ };
4784
+ var consumePushedRequest = async ({
4785
+ clientId,
4786
+ requestUri,
4787
+ store
4788
+ }) => {
4789
+ const token = extractToken(requestUri);
4790
+ if (token === undefined)
4791
+ return;
4792
+ const record = await store.consumeRequest(await hashToken(requestUri));
4793
+ if (record === undefined)
4794
+ return;
4795
+ if (record.clientId !== clientId)
4796
+ return;
4797
+ return record.params;
4798
+ };
4799
+ var pushAuthorizationRequest = async ({
4800
+ client,
4801
+ now = Date.now(),
4802
+ params,
4803
+ store,
4804
+ ttlMs = DEFAULT_PAR_TTL_MS
4805
+ }) => {
4806
+ if (typeof params.redirect_uri !== "string" || !client.redirectUris.includes(params.redirect_uri)) {
4807
+ return {
4808
+ body: { error: "invalid_redirect_uri" },
4809
+ ok: false,
4810
+ status: 400
4811
+ };
4812
+ }
4813
+ if (typeof params.client_id === "string" && params.client_id !== client.clientId) {
4814
+ return { body: { error: "invalid_request" }, ok: false, status: 400 };
4815
+ }
4816
+ const token = generateSecureToken(REQUEST_URI_BYTES);
4817
+ const requestUri = buildRequestUri(token);
4818
+ const expiresAt = now + ttlMs;
4819
+ const stored = { ...params };
4820
+ stored.client_id = client.clientId;
4821
+ await store.saveRequest({
4822
+ clientId: client.clientId,
4823
+ createdAt: now,
4824
+ expiresAt,
4825
+ params: stored,
4826
+ requestUriHash: await hashToken(requestUri)
4827
+ });
4828
+ return {
4829
+ body: {
4830
+ expires_in: Math.floor(ttlMs / MILLISECONDS_IN_A_SECOND),
4831
+ request_uri: requestUri
4832
+ },
4833
+ ok: true
4834
+ };
4835
+ };
4836
+
4730
4837
  // src/oidc/registration.ts
4731
4838
  var REG_TOKEN_BYTES = 32;
4732
4839
  var CLIENT_ID_BYTES = 16;
@@ -4988,6 +5095,7 @@ var oidcProviderRoutes = (config) => {
4988
5095
  const deviceAuthorizationRoute = `${oidcRoute}/device_authorization`;
4989
5096
  const deviceApproveRoute = `${oidcRoute}/device/decision`;
4990
5097
  const endSessionRoute = `${oidcRoute}/end_session`;
5098
+ const parRoute = `${oidcRoute}/par`;
4991
5099
  const registrationRoute = `${oidcRoute}/register`;
4992
5100
  const registrationBaseUrl = `${issuer}${registrationRoute}`;
4993
5101
  const tokenUrl = `${issuer}${oidcRoute}/token`;
@@ -5024,6 +5132,29 @@ var oidcProviderRoutes = (config) => {
5024
5132
  return;
5025
5133
  return authenticateClient(clientId, clientSecret);
5026
5134
  };
5135
+ const dpopNonceChallenge = async (proof) => {
5136
+ if (proof === undefined || config.dpopNonce === undefined) {
5137
+ return;
5138
+ }
5139
+ const presented = extractDpopNonceClaim(proof);
5140
+ if (presented !== undefined && await verifyDpopNonce({
5141
+ nonce: presented,
5142
+ secret: config.dpopNonce.secret
5143
+ })) {
5144
+ return;
5145
+ }
5146
+ const fresh = await mintDpopNonce({
5147
+ secret: config.dpopNonce.secret
5148
+ });
5149
+ return new Response(JSON.stringify({ error: "use_dpop_nonce" }), {
5150
+ headers: {
5151
+ "content-type": "application/json",
5152
+ "dpop-nonce": fresh,
5153
+ "www-authenticate": 'DPoP error="use_dpop_nonce"'
5154
+ },
5155
+ status: HTTP_UNAUTHORIZED2
5156
+ });
5157
+ };
5027
5158
  const grantAuthorizationCode = async (client, body, dpop) => {
5028
5159
  const {
5029
5160
  code,
@@ -5046,6 +5177,7 @@ var oidcProviderRoutes = (config) => {
5046
5177
  return oauthError2(HTTP_BAD_REQUEST2, "invalid_dpop_proof");
5047
5178
  }
5048
5179
  return tokenResponse(await issueTokenSet({
5180
+ acr: record.acr,
5049
5181
  claims: record.claims,
5050
5182
  clientId: client.clientId,
5051
5183
  config,
@@ -5075,6 +5207,7 @@ var oidcProviderRoutes = (config) => {
5075
5207
  }
5076
5208
  }
5077
5209
  return tokenResponse(await issueTokenSet({
5210
+ acr: record.acr,
5078
5211
  claims: record.claims,
5079
5212
  clientId: client.clientId,
5080
5213
  config,
@@ -5183,6 +5316,13 @@ var oidcProviderRoutes = (config) => {
5183
5316
  if (config.clientRegistrationTokenStore !== undefined) {
5184
5317
  discovery.registration_endpoint = registrationBaseUrl;
5185
5318
  }
5319
+ if (config.pushedAuthorizationRequestStore !== undefined) {
5320
+ discovery.pushed_authorization_request_endpoint = `${issuer}${parRoute}`;
5321
+ discovery.require_pushed_authorization_requests_supported = true;
5322
+ }
5323
+ if (config.acrValuesSupported !== undefined && config.acrValuesSupported.length > 0) {
5324
+ discovery.acr_values_supported = config.acrValuesSupported;
5325
+ }
5186
5326
  const handleEndSession = async ({
5187
5327
  cookie,
5188
5328
  inMemorySession,
@@ -5225,6 +5365,20 @@ var oidcProviderRoutes = (config) => {
5225
5365
  return redirectTo(url.toString());
5226
5366
  };
5227
5367
  return new Elysia15().use(sessionStore()).get(authorizeRoute, async ({ cookie: { user_session_id }, query, request, store }) => {
5368
+ let effectiveQuery = query;
5369
+ if (query.request_uri !== undefined && config.pushedAuthorizationRequestStore !== undefined && query.client_id !== undefined) {
5370
+ const pushed = await consumePushedRequest({
5371
+ clientId: query.client_id,
5372
+ requestUri: query.request_uri,
5373
+ store: config.pushedAuthorizationRequestStore
5374
+ });
5375
+ if (pushed === undefined) {
5376
+ return jsonResponse({ error: "invalid_request_uri" }, HTTP_BAD_REQUEST2);
5377
+ }
5378
+ effectiveQuery = pushed;
5379
+ } else if (query.request_uri !== undefined && query.request_uri.startsWith(REQUEST_URI_PREFIX)) {
5380
+ return jsonResponse({ error: "invalid_request_uri" }, HTTP_BAD_REQUEST2);
5381
+ }
5228
5382
  const {
5229
5383
  client_id: clientId,
5230
5384
  code_challenge: codeChallenge,
@@ -5234,7 +5388,7 @@ var oidcProviderRoutes = (config) => {
5234
5388
  response_type: responseType,
5235
5389
  scope,
5236
5390
  state
5237
- } = query;
5391
+ } = effectiveQuery;
5238
5392
  const client = clientId === undefined ? undefined : await clientStore.findClient(clientId);
5239
5393
  if (client === undefined || redirectUri === undefined || !client.redirectUris.includes(redirectUri)) {
5240
5394
  return jsonResponse({ error: "invalid_client" }, HTTP_BAD_REQUEST2);
@@ -5245,6 +5399,9 @@ var oidcProviderRoutes = (config) => {
5245
5399
  params2.set("state", state);
5246
5400
  return redirectTo(`${redirectUri}?${params2.toString()}`);
5247
5401
  };
5402
+ if (client.requirePushedAuthorizationRequests === true && query.request_uri === undefined) {
5403
+ return errorRedirect("invalid_request");
5404
+ }
5248
5405
  if (responseType !== "code") {
5249
5406
  return errorRedirect("unsupported_response_type");
5250
5407
  }
@@ -5270,8 +5427,17 @@ var oidcProviderRoutes = (config) => {
5270
5427
  });
5271
5428
  if (granted === undefined)
5272
5429
  return errorRedirect("access_denied");
5430
+ const userAcr = config.getAcr?.({
5431
+ scopes: granted,
5432
+ user: userSession.user
5433
+ });
5434
+ const requestedAcr = effectiveQuery.acr_values === undefined || effectiveQuery.acr_values.length === 0 ? undefined : effectiveQuery.acr_values.split(" ").filter((entry) => entry.length > 0);
5435
+ if (requestedAcr !== undefined && (userAcr === undefined || !requestedAcr.includes(userAcr))) {
5436
+ return errorRedirect("insufficient_user_authentication");
5437
+ }
5273
5438
  const code = generateSecureToken(TOKEN_BYTES3);
5274
5439
  await authorizationCodeStore.saveCode({
5440
+ acr: userAcr,
5275
5441
  claims: getClaims?.(userSession.user),
5276
5442
  clientId: client.clientId,
5277
5443
  codeChallenge,
@@ -5292,11 +5458,14 @@ var oidcProviderRoutes = (config) => {
5292
5458
  user_session_id: t12.Optional(userSessionIdTypebox)
5293
5459
  }),
5294
5460
  query: t12.Object({
5461
+ acr_values: t12.Optional(t12.String()),
5462
+ claims: t12.Optional(t12.String()),
5295
5463
  client_id: t12.Optional(t12.String()),
5296
5464
  code_challenge: t12.Optional(t12.String()),
5297
5465
  code_challenge_method: t12.Optional(t12.String()),
5298
5466
  nonce: t12.Optional(t12.String()),
5299
5467
  redirect_uri: t12.Optional(t12.String()),
5468
+ request_uri: t12.Optional(t12.String()),
5300
5469
  response_type: t12.Optional(t12.String()),
5301
5470
  scope: t12.Optional(t12.String()),
5302
5471
  state: t12.Optional(t12.String())
@@ -5314,6 +5483,9 @@ var oidcProviderRoutes = (config) => {
5314
5483
  if (client === undefined) {
5315
5484
  return oauthError2(HTTP_UNAUTHORIZED2, "invalid_client");
5316
5485
  }
5486
+ const nonceChallenge = await dpopNonceChallenge(headers.dpop);
5487
+ if (nonceChallenge !== undefined)
5488
+ return nonceChallenge;
5317
5489
  if (body.grant_type === "authorization_code") {
5318
5490
  return grantAuthorizationCode(client, body, headers.dpop);
5319
5491
  }
@@ -5345,6 +5517,52 @@ var oidcProviderRoutes = (config) => {
5345
5517
  subject_token: t12.Optional(t12.String()),
5346
5518
  subject_token_type: t12.Optional(t12.String())
5347
5519
  })
5520
+ }).post(parRoute, async ({ body, headers }) => {
5521
+ if (config.pushedAuthorizationRequestStore === undefined) {
5522
+ return oauthError2(HTTP_NOT_IMPLEMENTED, "unsupported_response_type");
5523
+ }
5524
+ const basic = readBasicAuth2(headers.authorization);
5525
+ const client = await authenticateTokenClient({
5526
+ basicClientId: basic.clientId,
5527
+ basicClientSecret: basic.clientSecret,
5528
+ bodyClientAssertion: body.client_assertion,
5529
+ bodyClientAssertionType: body.client_assertion_type,
5530
+ bodyClientId: body.client_id,
5531
+ bodyClientSecret: body.client_secret
5532
+ });
5533
+ if (client === undefined) {
5534
+ return oauthError2(HTTP_UNAUTHORIZED2, "invalid_client");
5535
+ }
5536
+ const isAuthField = (key) => key === "client_assertion" || key === "client_assertion_type" || key === "client_secret";
5537
+ const params = Object.fromEntries(Object.entries(body).filter((entry) => typeof entry[1] === "string" && !isAuthField(entry[0])));
5538
+ const result = await pushAuthorizationRequest({
5539
+ client,
5540
+ params,
5541
+ store: config.pushedAuthorizationRequestStore,
5542
+ ttlMs: config.pushedAuthorizationRequestTtlMs
5543
+ });
5544
+ return jsonResponse(result.body, result.ok ? HTTP_OK2 : result.status);
5545
+ }, {
5546
+ body: t12.Object({
5547
+ acr_values: t12.Optional(t12.String()),
5548
+ audience: t12.Optional(t12.String()),
5549
+ claims: t12.Optional(t12.String()),
5550
+ client_assertion: t12.Optional(t12.String()),
5551
+ client_assertion_type: t12.Optional(t12.String()),
5552
+ client_id: t12.Optional(t12.String()),
5553
+ client_secret: t12.Optional(t12.String()),
5554
+ code_challenge: t12.Optional(t12.String()),
5555
+ code_challenge_method: t12.Optional(t12.String()),
5556
+ nonce: t12.Optional(t12.String()),
5557
+ redirect_uri: t12.Optional(t12.String()),
5558
+ resource: t12.Optional(t12.String()),
5559
+ response_type: t12.Optional(t12.String()),
5560
+ scope: t12.Optional(t12.String()),
5561
+ state: t12.Optional(t12.String())
5562
+ }),
5563
+ headers: t12.Object({
5564
+ authorization: t12.Optional(t12.String())
5565
+ })
5348
5566
  }).post(introspectRoute, async ({ body, headers }) => {
5349
5567
  const basic = readBasicAuth2(headers.authorization);
5350
5568
  const clientId = body.client_id ?? basic.clientId;
@@ -20756,6 +20974,25 @@ var createInMemoryClientAssertionJtiStore = () => {
20756
20974
  }
20757
20975
  };
20758
20976
  };
20977
+ var createInMemoryClientRegistrationTokenStore = () => {
20978
+ const byHash = new Map;
20979
+ return {
20980
+ deleteByClientId: async (clientId) => {
20981
+ for (const [hash, token] of byHash) {
20982
+ if (token.clientId === clientId)
20983
+ byHash.delete(hash);
20984
+ }
20985
+ },
20986
+ findByTokenHash: async (tokenHash) => byHash.get(tokenHash),
20987
+ saveToken: async (token) => {
20988
+ for (const [hash, existing] of byHash) {
20989
+ if (existing.clientId === token.clientId)
20990
+ byHash.delete(hash);
20991
+ }
20992
+ byHash.set(token.tokenHash, { ...token });
20993
+ }
20994
+ };
20995
+ };
20759
20996
  var createInMemoryDeviceAuthorizationStore = () => {
20760
20997
  const byDeviceCode = new Map;
20761
20998
  return {
@@ -20783,6 +21020,17 @@ var createInMemoryDeviceAuthorizationStore = () => {
20783
21020
  }
20784
21021
  };
20785
21022
  };
21023
+ var createInMemoryInitialAccessTokenStore = (initialHashes = []) => {
21024
+ const remaining = new Set(initialHashes);
21025
+ return {
21026
+ consumeToken: async (tokenHash) => {
21027
+ if (!remaining.has(tokenHash))
21028
+ return false;
21029
+ remaining.delete(tokenHash);
21030
+ return true;
21031
+ }
21032
+ };
21033
+ };
20786
21034
  var createInMemoryLogoutDeliveryStore = () => {
20787
21035
  const failures = new Map;
20788
21036
  return {
@@ -20795,36 +21043,6 @@ var createInMemoryLogoutDeliveryStore = () => {
20795
21043
  }
20796
21044
  };
20797
21045
  };
20798
- var createInMemoryClientRegistrationTokenStore = () => {
20799
- const byHash = new Map;
20800
- return {
20801
- deleteByClientId: async (clientId) => {
20802
- for (const [hash, token] of byHash) {
20803
- if (token.clientId === clientId)
20804
- byHash.delete(hash);
20805
- }
20806
- },
20807
- findByTokenHash: async (tokenHash) => byHash.get(tokenHash),
20808
- saveToken: async (token) => {
20809
- for (const [hash, existing] of byHash) {
20810
- if (existing.clientId === token.clientId)
20811
- byHash.delete(hash);
20812
- }
20813
- byHash.set(token.tokenHash, { ...token });
20814
- }
20815
- };
20816
- };
20817
- var createInMemoryInitialAccessTokenStore = (initialHashes = []) => {
20818
- const remaining = new Set(initialHashes);
20819
- return {
20820
- consumeToken: async (tokenHash) => {
20821
- if (!remaining.has(tokenHash))
20822
- return false;
20823
- remaining.delete(tokenHash);
20824
- return true;
20825
- }
20826
- };
20827
- };
20828
21046
  var createInMemoryOAuthClientStore = (clients) => {
20829
21047
  const registry = new Map(clients.map((client) => [client.clientId, client]));
20830
21048
  return {
@@ -20865,6 +21083,23 @@ var createInMemoryOidcRefreshTokenStore = () => {
20865
21083
  }
20866
21084
  };
20867
21085
  };
21086
+ var createInMemoryPushedAuthorizationRequestStore = () => {
21087
+ const requests = new Map;
21088
+ return {
21089
+ consumeRequest: async (requestUriHash) => {
21090
+ const record = requests.get(requestUriHash);
21091
+ if (record === undefined)
21092
+ return;
21093
+ requests.delete(requestUriHash);
21094
+ if (record.expiresAt < Date.now())
21095
+ return;
21096
+ return record;
21097
+ },
21098
+ saveRequest: async (request) => {
21099
+ requests.set(request.requestUriHash, { ...request });
21100
+ }
21101
+ };
21102
+ };
20868
21103
  // src/oidc/postgresStores.ts
20869
21104
  var URL_LENGTH = 2048;
20870
21105
  var DEFAULT_LIST_LIMIT2 = 100;
@@ -20896,6 +21131,7 @@ var oauthClientsTable = pgTable("auth_oauth_clients", {
20896
21131
  scopes: text("scopes").array().notNull()
20897
21132
  });
20898
21133
  var oauthCodesTable = pgTable("auth_oauth_codes", {
21134
+ acr: varchar("acr", { length: ID_LENGTH7 }),
20899
21135
  claims_json: jsonb("claims_json").$type(),
20900
21136
  client_id: varchar("client_id", { length: ID_LENGTH7 }).notNull(),
20901
21137
  code_challenge: varchar("code_challenge", { length: ID_LENGTH7 }).notNull(),
@@ -20935,7 +21171,17 @@ var oauthLogoutDeliveriesTable = pgTable("auth_oauth_logout_deliveries", {
20935
21171
  logout_token: text("logout_token").notNull(),
20936
21172
  user_id: varchar("user_id", { length: ID_LENGTH7 }).notNull()
20937
21173
  });
21174
+ var oauthPushedAuthorizationRequestsTable = pgTable("auth_oauth_pushed_authorization_requests", {
21175
+ client_id: varchar("client_id", { length: ID_LENGTH7 }).notNull(),
21176
+ created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
21177
+ expires_at_ms: bigint("expires_at_ms", { mode: "number" }).notNull(),
21178
+ params_json: jsonb("params_json").$type().notNull(),
21179
+ request_uri_hash: varchar("request_uri_hash", {
21180
+ length: ID_LENGTH7
21181
+ }).primaryKey()
21182
+ });
20938
21183
  var oauthRefreshTokensTable = pgTable("auth_oauth_refresh_tokens", {
21184
+ acr: varchar("acr", { length: ID_LENGTH7 }),
20939
21185
  claims_json: jsonb("claims_json").$type(),
20940
21186
  client_id: varchar("client_id", { length: ID_LENGTH7 }).notNull(),
20941
21187
  created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
@@ -20968,6 +21214,7 @@ var toLogoutDelivery = (row) => ({
20968
21214
  userId: row.user_id
20969
21215
  });
20970
21216
  var toCode = (row) => ({
21217
+ acr: row.acr ?? undefined,
20971
21218
  claims: row.claims_json ?? undefined,
20972
21219
  clientId: row.client_id,
20973
21220
  codeChallenge: row.code_challenge,
@@ -20981,6 +21228,7 @@ var toCode = (row) => ({
20981
21228
  userId: row.user_id
20982
21229
  });
20983
21230
  var toCodeValues = (code) => ({
21231
+ acr: code.acr ?? null,
20984
21232
  claims_json: code.claims ?? null,
20985
21233
  client_id: code.clientId,
20986
21234
  code_challenge: code.codeChallenge,
@@ -21005,6 +21253,7 @@ var toDeviceAuth = (row) => ({
21005
21253
  userSub: row.user_sub ?? undefined
21006
21254
  });
21007
21255
  var toRefresh = (row) => ({
21256
+ acr: row.acr ?? undefined,
21008
21257
  claims: row.claims_json ?? undefined,
21009
21258
  clientId: row.client_id,
21010
21259
  createdAt: row.created_at_ms,
@@ -21015,6 +21264,7 @@ var toRefresh = (row) => ({
21015
21264
  userId: row.user_id
21016
21265
  });
21017
21266
  var toRefreshValues = (token) => ({
21267
+ acr: token.acr ?? null,
21018
21268
  claims_json: token.claims ?? null,
21019
21269
  client_id: token.clientId,
21020
21270
  created_at_ms: token.createdAt,
@@ -21032,6 +21282,7 @@ var createNeonInitialAccessTokenStore = (databaseUrl) => createPostgresInitialAc
21032
21282
  var createNeonLogoutDeliveryStore = (databaseUrl) => createPostgresLogoutDeliveryStore(createNeonDatabase(databaseUrl));
21033
21283
  var createNeonOAuthClientStore = (databaseUrl) => createPostgresOAuthClientStore(createNeonDatabase(databaseUrl));
21034
21284
  var createNeonOidcRefreshTokenStore = (databaseUrl) => createPostgresOidcRefreshTokenStore(createNeonDatabase(databaseUrl));
21285
+ var createNeonPushedAuthorizationRequestStore = (databaseUrl) => createPostgresPushedAuthorizationRequestStore(createNeonDatabase(databaseUrl));
21035
21286
  var createPostgresAuthorizationCodeStore = (db) => ({
21036
21287
  consumeCode: async (codeHash) => {
21037
21288
  const [row] = await db.delete(oauthCodesTable).where(eq(oauthCodesTable.code_hash, codeHash)).returning();
@@ -21185,6 +21436,33 @@ var createPostgresOidcRefreshTokenStore = (db) => ({
21185
21436
  await db.insert(oauthRefreshTokensTable).values(toRefreshValues(token));
21186
21437
  }
21187
21438
  });
21439
+ var createPostgresPushedAuthorizationRequestStore = (db) => ({
21440
+ consumeRequest: async (requestUriHash) => {
21441
+ const [row] = await db.delete(oauthPushedAuthorizationRequestsTable).where(eq(oauthPushedAuthorizationRequestsTable.request_uri_hash, requestUriHash)).returning();
21442
+ if (!row)
21443
+ return;
21444
+ await db.delete(oauthPushedAuthorizationRequestsTable).where(lt(oauthPushedAuthorizationRequestsTable.expires_at_ms, Date.now()));
21445
+ if (row.expires_at_ms < Date.now())
21446
+ return;
21447
+ const request = {
21448
+ clientId: row.client_id,
21449
+ createdAt: row.created_at_ms,
21450
+ expiresAt: row.expires_at_ms,
21451
+ params: row.params_json,
21452
+ requestUriHash: row.request_uri_hash
21453
+ };
21454
+ return request;
21455
+ },
21456
+ saveRequest: async (request) => {
21457
+ await db.insert(oauthPushedAuthorizationRequestsTable).values({
21458
+ client_id: request.clientId,
21459
+ created_at_ms: request.createdAt,
21460
+ expires_at_ms: request.expiresAt,
21461
+ params_json: request.params,
21462
+ request_uri_hash: request.requestUriHash
21463
+ });
21464
+ }
21465
+ });
21188
21466
  // src/adaptive/config.ts
21189
21467
  var DEFAULT_HISTORY_LIMIT = 50;
21190
21468
  var DEFAULT_MAX_TRAVEL_KMH = 900;
@@ -22608,6 +22886,7 @@ export {
22608
22886
  verifyIdTokenHint,
22609
22887
  verifyHcaptcha,
22610
22888
  verifyDpopProof,
22889
+ verifyDpopNonce,
22611
22890
  verifyClientAssertion,
22612
22891
  verifyAuditChain,
22613
22892
  verifyApiKey,
@@ -22658,6 +22937,7 @@ export {
22658
22937
  refreshableProviderOptions,
22659
22938
  recordLoginAttempt,
22660
22939
  readSessionRing,
22940
+ pushAuthorizationRequest,
22661
22941
  providers,
22662
22942
  providerOptions,
22663
22943
  protectRoutePlugin,
@@ -22675,6 +22955,7 @@ export {
22675
22955
  oidcProviderRoutes,
22676
22956
  oidcProviderOptions,
22677
22957
  oauthRefreshTokensTable,
22958
+ oauthPushedAuthorizationRequestsTable,
22678
22959
  oauthLogoutDeliveriesTable,
22679
22960
  oauthInitialAccessTokensTable,
22680
22961
  oauthDeviceAuthorizationsTable,
@@ -22683,6 +22964,7 @@ export {
22683
22964
  oauthClientRegistrationTokensTable,
22684
22965
  oauthClientAssertionJtisTable,
22685
22966
  mintLogoutToken,
22967
+ mintDpopNonce,
22686
22968
  mfaTotpRoutes,
22687
22969
  mfaRoutes,
22688
22970
  mfaEnrollmentsTable,
@@ -22734,6 +23016,7 @@ export {
22734
23016
  fingerprintDevice,
22735
23017
  fanOutBackchannelLogout,
22736
23018
  extractPropFromIdentity,
23019
+ extractDpopNonceClaim,
22737
23020
  exportAuditCsv,
22738
23021
  exchangeToken,
22739
23022
  exchangeDeviceCode,
@@ -22780,6 +23063,7 @@ export {
22780
23063
  createPostgresSetupSessionStore,
22781
23064
  createPostgresScimTokenStore,
22782
23065
  createPostgresRoleStore,
23066
+ createPostgresPushedAuthorizationRequestStore,
22783
23067
  createPostgresPasswordlessTokenStore,
22784
23068
  createPostgresOrganizationStore,
22785
23069
  createPostgresOidcRefreshTokenStore,
@@ -22809,6 +23093,7 @@ export {
22809
23093
  createNeonSetupSessionStore,
22810
23094
  createNeonScimTokenStore,
22811
23095
  createNeonRoleStore,
23096
+ createNeonPushedAuthorizationRequestStore,
22812
23097
  createNeonPasswordlessTokenStore,
22813
23098
  createNeonOrganizationStore,
22814
23099
  createNeonOidcRefreshTokenStore,
@@ -22844,6 +23129,7 @@ export {
22844
23129
  createInMemorySetupSessionStore,
22845
23130
  createInMemoryScimTokenStore,
22846
23131
  createInMemoryRoleStore,
23132
+ createInMemoryPushedAuthorizationRequestStore,
22847
23133
  createInMemoryPasswordlessTokenStore,
22848
23134
  createInMemoryOrganizationStore,
22849
23135
  createInMemoryOidcRefreshTokenStore,
@@ -22875,6 +23161,7 @@ export {
22875
23161
  createAnonymousSession,
22876
23162
  createActionPipeline,
22877
23163
  createAbuseGuard,
23164
+ consumePushedRequest,
22878
23165
  consumeBackupCode,
22879
23166
  constantTimeEqual,
22880
23167
  complianceRoutes,
@@ -22897,6 +23184,7 @@ export {
22897
23184
  accessTokensTable,
22898
23185
  acceptInvitation,
22899
23186
  WEBAUTHN_CHALLENGE_COOKIE,
23187
+ REQUEST_URI_PREFIX,
22900
23188
  DEFAULT_WEBHOOK_TIMEOUT_MS,
22901
23189
  DEFAULT_WEBHOOK_RETRY,
22902
23190
  DEFAULT_WEBAUTHN_SESSION_TTL_MS,
@@ -22913,6 +23201,7 @@ export {
22913
23201
  DEFAULT_PORTAL_ROUTE,
22914
23202
  DEFAULT_PASSWORDLESS_SESSION_TTL_MS,
22915
23203
  DEFAULT_PASSWORDLESS_ROUTE,
23204
+ DEFAULT_PAR_TTL_MS,
22916
23205
  DEFAULT_OWNER_ROLES,
22917
23206
  DEFAULT_OTP_TTL_MS,
22918
23207
  DEFAULT_OTP_LENGTH,
@@ -22928,5 +23217,5 @@ export {
22928
23217
  AuthIdentityConflictError
22929
23218
  };
22930
23219
 
22931
- //# debugId=670CF7C3F8CEA35064756E2164756E21
23220
+ //# debugId=7EEC3FFFBF5D362764756E2164756E21
22932
23221
  //# sourceMappingURL=index.js.map