@absolutejs/auth 0.75.2 → 0.75.3

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.
@@ -654,6 +654,21 @@ export declare const oauthDeviceAuthorizationsTable: import("drizzle-orm/pg-core
654
654
  name: "auth_oauth_device_authorizations";
655
655
  schema: undefined;
656
656
  columns: {
657
+ audience: import("drizzle-orm/pg-core").PgBuildColumn<"auth_oauth_device_authorizations", import("drizzle-orm/pg-core").PgVarcharBuilder<[string, ...string[]]>, {
658
+ name: string;
659
+ tableName: "auth_oauth_device_authorizations";
660
+ dataType: "string";
661
+ data: string;
662
+ driverParam: string;
663
+ notNull: false;
664
+ hasDefault: false;
665
+ isPrimaryKey: false;
666
+ isAutoincrement: false;
667
+ hasRuntimeDefault: false;
668
+ enumValues: undefined;
669
+ identity: undefined;
670
+ generated: undefined;
671
+ }>;
657
672
  client_id: import("drizzle-orm/pg-core").PgBuildColumn<"auth_oauth_device_authorizations", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgVarcharBuilder<[string, ...string[]]>>, {
658
673
  name: string;
659
674
  tableName: "auth_oauth_device_authorizations";
@@ -234,6 +234,7 @@ export declare const oidcProviderRoutes: <UserType>(config: OidcProviderConfig<U
234
234
  body: {
235
235
  client_id?: string | undefined;
236
236
  scope?: string | undefined;
237
+ resource?: string | undefined;
237
238
  client_secret?: string | undefined;
238
239
  };
239
240
  params: {};
@@ -118,6 +118,7 @@ export type SocketTicketStore = {
118
118
  };
119
119
  export type DeviceAuthorizationStatus = 'approved' | 'denied' | 'pending';
120
120
  export type DeviceAuthorization = {
121
+ audience?: string;
121
122
  clientId: string;
122
123
  createdAt: number;
123
124
  deviceCodeHash: string;
package/dist/server.js CHANGED
@@ -8331,6 +8331,7 @@ var generateUserCode = () => {
8331
8331
  return `${code.slice(0, USER_CODE_HALF_LENGTH)}-${code.slice(USER_CODE_HALF_LENGTH)}`;
8332
8332
  };
8333
8333
  var issueDeviceAuthorization = async ({
8334
+ audience,
8334
8335
  clientId,
8335
8336
  config,
8336
8337
  now = Date.now(),
@@ -8344,6 +8345,7 @@ var issueDeviceAuthorization = async ({
8344
8345
  const ttl = config.deviceCodeTtlMs ?? DEFAULT_DEVICE_CODE_TTL_MS;
8345
8346
  const interval = config.devicePollIntervalSeconds ?? DEFAULT_DEVICE_POLL_INTERVAL_SECONDS;
8346
8347
  await config.deviceAuthorizationStore.saveDeviceAuthorization({
8348
+ audience,
8347
8349
  clientId,
8348
8350
  createdAt: now,
8349
8351
  deviceCodeHash: await hashToken(deviceCode),
@@ -8425,6 +8427,7 @@ var exchangeDeviceCode = async ({
8425
8427
  }
8426
8428
  await config.deviceAuthorizationStore.deleteByDeviceCodeHash(deviceCodeHash);
8427
8429
  const tokenSet = await issueTokenSet({
8430
+ audience: record.audience,
8428
8431
  clientId,
8429
8432
  config,
8430
8433
  dpopJkt,
@@ -10666,6 +10669,7 @@ var oidcProviderRoutes = (config) => {
10666
10669
  body: t17.Object({
10667
10670
  client_id: t17.Optional(t17.String()),
10668
10671
  client_secret: t17.Optional(t17.String()),
10672
+ resource: t17.Optional(t17.String()),
10669
10673
  scope: t17.Optional(t17.String())
10670
10674
  }),
10671
10675
  headers: t17.Object({
@@ -10687,6 +10691,7 @@ var oidcProviderRoutes = (config) => {
10687
10691
  }
10688
10692
  const requested = body.scope === undefined || body.scope.length === 0 ? client.scopes : body.scope.split(" ").filter((entry) => client.scopes.includes(entry));
10689
10693
  const response = await issueDeviceAuthorization({
10694
+ audience: body.resource,
10690
10695
  clientId: client.clientId,
10691
10696
  config,
10692
10697
  now: Date.now(),
@@ -38757,6 +38762,7 @@ var oauthCodesTable = pgTable("auth_oauth_codes", {
38757
38762
  user_id: varchar("user_id", { length: ID_LENGTH9 }).notNull()
38758
38763
  });
38759
38764
  var oauthDeviceAuthorizationsTable = pgTable("auth_oauth_device_authorizations", {
38765
+ audience: varchar("audience", { length: 2048 }),
38760
38766
  client_id: varchar("client_id", { length: ID_LENGTH9 }).notNull(),
38761
38767
  created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
38762
38768
  device_code_hash: varchar("device_code_hash", {
@@ -38872,6 +38878,7 @@ var toCodeValues = (code) => ({
38872
38878
  user_id: code.userId
38873
38879
  });
38874
38880
  var toDeviceAuth = (row) => ({
38881
+ audience: row.audience ?? undefined,
38875
38882
  clientId: row.client_id,
38876
38883
  createdAt: row.created_at_ms,
38877
38884
  deviceCodeHash: row.device_code_hash,
@@ -39009,6 +39016,7 @@ var createPostgresDeviceAuthorizationStore = (db) => ({
39009
39016
  },
39010
39017
  saveDeviceAuthorization: async (deviceAuthorization) => {
39011
39018
  await db.insert(oauthDeviceAuthorizationsTable).values({
39019
+ audience: deviceAuthorization.audience ?? null,
39012
39020
  client_id: deviceAuthorization.clientId,
39013
39021
  created_at_ms: deviceAuthorization.createdAt,
39014
39022
  device_code_hash: deviceAuthorization.deviceCodeHash,
@@ -40564,6 +40572,10 @@ var oidcSocketTicketsMigration = {
40564
40572
  id: "0004_socket_tickets",
40565
40573
  sql: tablesToInitSql([oauthSocketTicketsTable])
40566
40574
  };
40575
+ var oidcDeviceAudienceMigration = {
40576
+ id: "0005_device_resource_audience",
40577
+ sql: 'ALTER TABLE "auth_oauth_device_authorizations" ADD COLUMN IF NOT EXISTS "audience" varchar(2048);'
40578
+ };
40567
40579
  var sessionOAuthSubjectMigration = {
40568
40580
  id: "0002_oauth_subject",
40569
40581
  sql: [
@@ -40639,7 +40651,8 @@ var blockMigrations = {
40639
40651
  ]).migrations,
40640
40652
  oidcResourceAudienceMigration,
40641
40653
  oidcRefreshTokenFamiliesMigration,
40642
- oidcSocketTicketsMigration
40654
+ oidcSocketTicketsMigration,
40655
+ oidcDeviceAudienceMigration
40643
40656
  ]
40644
40657
  },
40645
40658
  organizations: initMigration("organizations", [
@@ -41659,5 +41672,5 @@ export {
41659
41672
  VerificationProviderError
41660
41673
  };
41661
41674
 
41662
- //# debugId=4C7D47096A194ABC64756E2164756E21
41675
+ //# debugId=A14F7F9FF66E9B8A64756E2164756E21
41663
41676
  //# sourceMappingURL=server.js.map