@absolutejs/auth 0.75.1 → 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.
- package/README.md +21 -2
- package/dist/agents/config.d.ts +5 -1
- package/dist/agents/index.js +2 -1
- package/dist/agents/index.js.map +3 -3
- package/dist/agents/routes.d.ts +2 -0
- package/dist/cli/migrate.js +8 -2
- package/dist/cli/migrate.js.map +4 -4
- package/dist/client/dpop.d.ts +34 -0
- package/dist/client/dpop.test.d.ts +1 -0
- package/dist/client/index.d.ts +1 -0
- package/dist/client/index.js +101 -3
- package/dist/client/index.js.map +4 -3
- package/dist/index.d.ts +2 -0
- package/dist/index.js +16 -2
- package/dist/index.js.map +7 -7
- package/dist/oidc/config.d.ts +2 -1
- package/dist/oidc/index.js +4 -1
- package/dist/oidc/index.js.map +3 -3
- package/dist/oidc/postgresStores.d.ts +15 -0
- package/dist/oidc/routes.d.ts +1 -0
- package/dist/oidc/types.d.ts +1 -0
- package/dist/server.js +16 -2
- package/dist/server.js.map +7 -7
- package/package.json +1 -1
|
@@ -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";
|
package/dist/oidc/routes.d.ts
CHANGED
|
@@ -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: {};
|
package/dist/oidc/types.d.ts
CHANGED
|
@@ -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
|
@@ -4256,6 +4256,7 @@ var DEFAULT_AGENT_RESOURCE_METADATA_ROUTE = "/.well-known/oauth-protected-resour
|
|
|
4256
4256
|
var agentProtectedResourceMetadata = (config) => ({
|
|
4257
4257
|
authorization_servers: [config.authorizationServer],
|
|
4258
4258
|
bearer_methods_supported: ["header"],
|
|
4259
|
+
...config.dpopBoundAccessTokensRequired === true ? { dpop_bound_access_tokens_required: true } : {},
|
|
4259
4260
|
...config.logoUri === undefined ? {} : { resource_logo_uri: config.logoUri },
|
|
4260
4261
|
...config.resourceName === undefined ? {} : { resource_name: config.resourceName },
|
|
4261
4262
|
resource: config.resource,
|
|
@@ -8330,6 +8331,7 @@ var generateUserCode = () => {
|
|
|
8330
8331
|
return `${code.slice(0, USER_CODE_HALF_LENGTH)}-${code.slice(USER_CODE_HALF_LENGTH)}`;
|
|
8331
8332
|
};
|
|
8332
8333
|
var issueDeviceAuthorization = async ({
|
|
8334
|
+
audience,
|
|
8333
8335
|
clientId,
|
|
8334
8336
|
config,
|
|
8335
8337
|
now = Date.now(),
|
|
@@ -8343,6 +8345,7 @@ var issueDeviceAuthorization = async ({
|
|
|
8343
8345
|
const ttl = config.deviceCodeTtlMs ?? DEFAULT_DEVICE_CODE_TTL_MS;
|
|
8344
8346
|
const interval = config.devicePollIntervalSeconds ?? DEFAULT_DEVICE_POLL_INTERVAL_SECONDS;
|
|
8345
8347
|
await config.deviceAuthorizationStore.saveDeviceAuthorization({
|
|
8348
|
+
audience,
|
|
8346
8349
|
clientId,
|
|
8347
8350
|
createdAt: now,
|
|
8348
8351
|
deviceCodeHash: await hashToken(deviceCode),
|
|
@@ -8424,6 +8427,7 @@ var exchangeDeviceCode = async ({
|
|
|
8424
8427
|
}
|
|
8425
8428
|
await config.deviceAuthorizationStore.deleteByDeviceCodeHash(deviceCodeHash);
|
|
8426
8429
|
const tokenSet = await issueTokenSet({
|
|
8430
|
+
audience: record.audience,
|
|
8427
8431
|
clientId,
|
|
8428
8432
|
config,
|
|
8429
8433
|
dpopJkt,
|
|
@@ -10665,6 +10669,7 @@ var oidcProviderRoutes = (config) => {
|
|
|
10665
10669
|
body: t17.Object({
|
|
10666
10670
|
client_id: t17.Optional(t17.String()),
|
|
10667
10671
|
client_secret: t17.Optional(t17.String()),
|
|
10672
|
+
resource: t17.Optional(t17.String()),
|
|
10668
10673
|
scope: t17.Optional(t17.String())
|
|
10669
10674
|
}),
|
|
10670
10675
|
headers: t17.Object({
|
|
@@ -10686,6 +10691,7 @@ var oidcProviderRoutes = (config) => {
|
|
|
10686
10691
|
}
|
|
10687
10692
|
const requested = body.scope === undefined || body.scope.length === 0 ? client.scopes : body.scope.split(" ").filter((entry) => client.scopes.includes(entry));
|
|
10688
10693
|
const response = await issueDeviceAuthorization({
|
|
10694
|
+
audience: body.resource,
|
|
10689
10695
|
clientId: client.clientId,
|
|
10690
10696
|
config,
|
|
10691
10697
|
now: Date.now(),
|
|
@@ -38756,6 +38762,7 @@ var oauthCodesTable = pgTable("auth_oauth_codes", {
|
|
|
38756
38762
|
user_id: varchar("user_id", { length: ID_LENGTH9 }).notNull()
|
|
38757
38763
|
});
|
|
38758
38764
|
var oauthDeviceAuthorizationsTable = pgTable("auth_oauth_device_authorizations", {
|
|
38765
|
+
audience: varchar("audience", { length: 2048 }),
|
|
38759
38766
|
client_id: varchar("client_id", { length: ID_LENGTH9 }).notNull(),
|
|
38760
38767
|
created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
|
|
38761
38768
|
device_code_hash: varchar("device_code_hash", {
|
|
@@ -38871,6 +38878,7 @@ var toCodeValues = (code) => ({
|
|
|
38871
38878
|
user_id: code.userId
|
|
38872
38879
|
});
|
|
38873
38880
|
var toDeviceAuth = (row) => ({
|
|
38881
|
+
audience: row.audience ?? undefined,
|
|
38874
38882
|
clientId: row.client_id,
|
|
38875
38883
|
createdAt: row.created_at_ms,
|
|
38876
38884
|
deviceCodeHash: row.device_code_hash,
|
|
@@ -39008,6 +39016,7 @@ var createPostgresDeviceAuthorizationStore = (db) => ({
|
|
|
39008
39016
|
},
|
|
39009
39017
|
saveDeviceAuthorization: async (deviceAuthorization) => {
|
|
39010
39018
|
await db.insert(oauthDeviceAuthorizationsTable).values({
|
|
39019
|
+
audience: deviceAuthorization.audience ?? null,
|
|
39011
39020
|
client_id: deviceAuthorization.clientId,
|
|
39012
39021
|
created_at_ms: deviceAuthorization.createdAt,
|
|
39013
39022
|
device_code_hash: deviceAuthorization.deviceCodeHash,
|
|
@@ -40563,6 +40572,10 @@ var oidcSocketTicketsMigration = {
|
|
|
40563
40572
|
id: "0004_socket_tickets",
|
|
40564
40573
|
sql: tablesToInitSql([oauthSocketTicketsTable])
|
|
40565
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
|
+
};
|
|
40566
40579
|
var sessionOAuthSubjectMigration = {
|
|
40567
40580
|
id: "0002_oauth_subject",
|
|
40568
40581
|
sql: [
|
|
@@ -40638,7 +40651,8 @@ var blockMigrations = {
|
|
|
40638
40651
|
]).migrations,
|
|
40639
40652
|
oidcResourceAudienceMigration,
|
|
40640
40653
|
oidcRefreshTokenFamiliesMigration,
|
|
40641
|
-
oidcSocketTicketsMigration
|
|
40654
|
+
oidcSocketTicketsMigration,
|
|
40655
|
+
oidcDeviceAudienceMigration
|
|
40642
40656
|
]
|
|
40643
40657
|
},
|
|
40644
40658
|
organizations: initMigration("organizations", [
|
|
@@ -41658,5 +41672,5 @@ export {
|
|
|
41658
41672
|
VerificationProviderError
|
|
41659
41673
|
};
|
|
41660
41674
|
|
|
41661
|
-
//# debugId=
|
|
41675
|
+
//# debugId=A14F7F9FF66E9B8A64756E2164756E21
|
|
41662
41676
|
//# sourceMappingURL=server.js.map
|