@absolutejs/auth 0.54.8 → 0.55.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/README.md +19 -5
- package/dist/agents/config.d.ts +16 -0
- package/dist/agents/idJag.d.ts +49 -0
- package/dist/agents/inMemoryStores.d.ts +2 -1
- package/dist/agents/index.d.ts +5 -2
- package/dist/agents/index.js +1391 -66
- package/dist/agents/index.js.map +12 -8
- package/dist/agents/postgresStores.d.ts +280 -1
- package/dist/agents/registration.d.ts +162 -0
- package/dist/agents/registrationClient.d.ts +50 -0
- package/dist/agents/routes.d.ts +112 -1
- package/dist/agents/types.d.ts +59 -0
- package/dist/apikeys/routes.d.ts +2 -2
- package/dist/cli/migrate.js +57 -8
- package/dist/cli/migrate.js.map +4 -4
- package/dist/credentials/login.d.ts +4 -4
- package/dist/credentials/routes.d.ts +4 -4
- package/dist/index.d.ts +185 -2
- package/dist/index.js +1388 -102
- package/dist/index.js.map +15 -12
- package/dist/manifest.js +12 -6
- package/dist/manifest.js.map +4 -4
- package/dist/manifest.json +2 -2
- package/dist/mfa/routes.d.ts +2 -2
- package/dist/mfa/sms.d.ts +2 -2
- package/dist/oidc/clientAuth.d.ts +6 -2
- package/dist/oidc/config.d.ts +19 -5
- package/dist/oidc/keys.d.ts +7 -3
- package/dist/oidc/logout.d.ts +2 -2
- package/dist/oidc/routes.d.ts +13 -11
- package/dist/organizations/routes.d.ts +1 -1
- package/dist/portal/routes.d.ts +3 -3
- package/dist/roles/routes.d.ts +1 -1
- package/dist/routes/refresh.d.ts +1 -1
- package/dist/routes/revoke.d.ts +1 -1
- package/dist/routes/sessions.d.ts +3 -3
- package/dist/sso/discoveryRoute.d.ts +1 -1
- package/dist/sso/oidcRoutes.d.ts +2 -2
- package/dist/sso/samlRoutes.d.ts +4 -4
- package/docs/AGENT-AUTH.md +54 -0
- package/docs/MIGRATE-FROM-LUCIA.md +235 -0
- package/docs/OAUTH-PROVIDER-QUIRKS.md +150 -0
- package/docs/UI-COMPONENTS.md +226 -0
- package/package.json +7 -3
package/dist/agents/types.d.ts
CHANGED
|
@@ -68,3 +68,62 @@ export type AgentPrincipal = {
|
|
|
68
68
|
trust: 'delegated' | 'registered';
|
|
69
69
|
userId?: string;
|
|
70
70
|
};
|
|
71
|
+
export type AgentIdentityRegistrationKind = 'anonymous' | 'identity_assertion' | 'service_auth';
|
|
72
|
+
export type AgentIdentityRegistrationStatus = 'claimed' | 'pending' | 'revoked';
|
|
73
|
+
export type AgentClaimAttempt = {
|
|
74
|
+
attempts: number;
|
|
75
|
+
email: string;
|
|
76
|
+
expiresAt: number;
|
|
77
|
+
tokenHash: string;
|
|
78
|
+
userCodeHash: string;
|
|
79
|
+
};
|
|
80
|
+
/** Durable state for the open auth.md registration profile. Secrets are
|
|
81
|
+
* represented only by hashes; plaintext claim and attempt tokens are returned
|
|
82
|
+
* once to the agent and never persisted. `version` is used for compare-and-swap
|
|
83
|
+
* updates so claim completion is safe across multiple application instances. */
|
|
84
|
+
export type AgentIdentityRegistration = {
|
|
85
|
+
agentId: string;
|
|
86
|
+
claimAttempt?: AgentClaimAttempt;
|
|
87
|
+
claimExpiresAt: number;
|
|
88
|
+
claimTokenHash: string;
|
|
89
|
+
createdAt: number;
|
|
90
|
+
expiresAt: number;
|
|
91
|
+
kind: AgentIdentityRegistrationKind;
|
|
92
|
+
loginHint?: string;
|
|
93
|
+
lastPolledAt?: number;
|
|
94
|
+
registrationId: string;
|
|
95
|
+
status: AgentIdentityRegistrationStatus;
|
|
96
|
+
updatedAt: number;
|
|
97
|
+
upstream?: {
|
|
98
|
+
clientId: string;
|
|
99
|
+
issuer: string;
|
|
100
|
+
subject: string;
|
|
101
|
+
};
|
|
102
|
+
userId?: string;
|
|
103
|
+
version: number;
|
|
104
|
+
};
|
|
105
|
+
export type AgentIdentityRegistrationStore = {
|
|
106
|
+
create: (registration: AgentIdentityRegistration) => Promise<boolean>;
|
|
107
|
+
findByClaimTokenHash: (claimTokenHash: string) => Promise<AgentIdentityRegistration | undefined>;
|
|
108
|
+
findByAgentId: (agentId: string) => Promise<AgentIdentityRegistration | undefined>;
|
|
109
|
+
findByRegistrationId: (registrationId: string) => Promise<AgentIdentityRegistration | undefined>;
|
|
110
|
+
findByUpstreamIdentity: (query: {
|
|
111
|
+
clientId: string;
|
|
112
|
+
issuer: string;
|
|
113
|
+
subject: string;
|
|
114
|
+
}) => Promise<AgentIdentityRegistration | undefined>;
|
|
115
|
+
findByAttemptTokenHash: (attemptTokenHash: string) => Promise<AgentIdentityRegistration | undefined>;
|
|
116
|
+
/** Replaces a record only when its current version equals expectedVersion. */
|
|
117
|
+
replace: (registration: AgentIdentityRegistration, expectedVersion: number) => Promise<boolean>;
|
|
118
|
+
};
|
|
119
|
+
export type VerifiedAgentIdentityAssertion = {
|
|
120
|
+
authenticatedAt: number;
|
|
121
|
+
clientId: string;
|
|
122
|
+
email?: string;
|
|
123
|
+
emailVerified?: boolean;
|
|
124
|
+
issuer: string;
|
|
125
|
+
name?: string;
|
|
126
|
+
phoneNumber?: string;
|
|
127
|
+
phoneNumberVerified?: boolean;
|
|
128
|
+
subject: string;
|
|
129
|
+
};
|
package/dist/apikeys/routes.d.ts
CHANGED
|
@@ -46,10 +46,10 @@ export declare const apiKeysRoutes: ({ accessTokenStore, accessTokenTtlMs, apiCl
|
|
|
46
46
|
[x: string]: {
|
|
47
47
|
post: {
|
|
48
48
|
body: {
|
|
49
|
-
|
|
49
|
+
grant_type?: string | undefined;
|
|
50
50
|
scope?: string | undefined;
|
|
51
|
+
client_id?: string | undefined;
|
|
51
52
|
client_secret?: string | undefined;
|
|
52
|
-
grant_type?: string | undefined;
|
|
53
53
|
};
|
|
54
54
|
params: {};
|
|
55
55
|
query: unknown;
|
package/dist/cli/migrate.js
CHANGED
|
@@ -341,7 +341,14 @@ var apiKeysTable = pgTable2("auth_api_keys", {
|
|
|
341
341
|
|
|
342
342
|
// src/agents/postgresStores.ts
|
|
343
343
|
import { and as and2, desc as desc3, eq as eq3, gt, isNull, or } from "drizzle-orm";
|
|
344
|
-
import {
|
|
344
|
+
import {
|
|
345
|
+
bigint as bigint3,
|
|
346
|
+
integer,
|
|
347
|
+
jsonb,
|
|
348
|
+
pgTable as pgTable3,
|
|
349
|
+
uniqueIndex,
|
|
350
|
+
varchar as varchar3
|
|
351
|
+
} from "drizzle-orm/pg-core";
|
|
345
352
|
var ID_LENGTH3 = 255;
|
|
346
353
|
var NAME_LENGTH = 255;
|
|
347
354
|
var STATUS_LENGTH = 16;
|
|
@@ -359,6 +366,38 @@ var agentDelegationsTable = pgTable3("auth_agent_delegations", {
|
|
|
359
366
|
updated_at_ms: bigint3("updated_at_ms", { mode: "number" }).notNull(),
|
|
360
367
|
user_id: varchar3("user_id", { length: ID_LENGTH3 }).notNull()
|
|
361
368
|
});
|
|
369
|
+
var agentIdentityRegistrationsTable = pgTable3("auth_agent_identity_registrations", {
|
|
370
|
+
agent_id: varchar3("agent_id", { length: ID_LENGTH3 }).notNull().unique(),
|
|
371
|
+
claim_attempt: jsonb("claim_attempt").$type(),
|
|
372
|
+
claim_attempt_token_hash: varchar3("claim_attempt_token_hash", {
|
|
373
|
+
length: ID_LENGTH3
|
|
374
|
+
}).unique(),
|
|
375
|
+
claim_expires_at_ms: bigint3("claim_expires_at_ms", {
|
|
376
|
+
mode: "number"
|
|
377
|
+
}).notNull(),
|
|
378
|
+
claim_token_hash: varchar3("claim_token_hash", {
|
|
379
|
+
length: ID_LENGTH3
|
|
380
|
+
}).notNull().unique(),
|
|
381
|
+
created_at_ms: bigint3("created_at_ms", { mode: "number" }).notNull(),
|
|
382
|
+
expires_at_ms: bigint3("expires_at_ms", { mode: "number" }).notNull(),
|
|
383
|
+
kind: varchar3("kind", { length: 32 }).$type().notNull(),
|
|
384
|
+
last_polled_at_ms: bigint3("last_polled_at_ms", { mode: "number" }),
|
|
385
|
+
login_hint: varchar3("login_hint", { length: ID_LENGTH3 }),
|
|
386
|
+
registration_id: varchar3("registration_id", {
|
|
387
|
+
length: ID_LENGTH3
|
|
388
|
+
}).primaryKey(),
|
|
389
|
+
status: varchar3("status", { length: STATUS_LENGTH }).$type().notNull(),
|
|
390
|
+
updated_at_ms: bigint3("updated_at_ms", { mode: "number" }).notNull(),
|
|
391
|
+
upstream_client_id: varchar3("upstream_client_id", {
|
|
392
|
+
length: ID_LENGTH3
|
|
393
|
+
}),
|
|
394
|
+
upstream_issuer: varchar3("upstream_issuer", { length: ID_LENGTH3 }),
|
|
395
|
+
upstream_subject: varchar3("upstream_subject", { length: ID_LENGTH3 }),
|
|
396
|
+
user_id: varchar3("user_id", { length: ID_LENGTH3 }),
|
|
397
|
+
version: integer("version").notNull()
|
|
398
|
+
}, (table) => [
|
|
399
|
+
uniqueIndex("auth_agent_identity_upstream_unique").on(table.upstream_issuer, table.upstream_subject, table.upstream_client_id)
|
|
400
|
+
]);
|
|
362
401
|
var agentRegistrationsTable = pgTable3("auth_agent_registrations", {
|
|
363
402
|
agent_id: varchar3("agent_id", { length: ID_LENGTH3 }).primaryKey(),
|
|
364
403
|
allowed_scopes: jsonb("allowed_scopes").$type().notNull().default([]),
|
|
@@ -2524,10 +2563,10 @@ var linkedProviderGrantsTable = pgTable7("linked_provider_grants", {
|
|
|
2524
2563
|
|
|
2525
2564
|
// src/lockout/postgresLockoutStore.ts
|
|
2526
2565
|
import { eq as eq8 } from "drizzle-orm";
|
|
2527
|
-
import { bigint as bigint6, integer, pgTable as pgTable8, varchar as varchar8 } from "drizzle-orm/pg-core";
|
|
2566
|
+
import { bigint as bigint6, integer as integer2, pgTable as pgTable8, varchar as varchar8 } from "drizzle-orm/pg-core";
|
|
2528
2567
|
var KEY_LENGTH = 320;
|
|
2529
2568
|
var lockoutsTable = pgTable8("auth_lockouts", {
|
|
2530
|
-
failed_attempts:
|
|
2569
|
+
failed_attempts: integer2("failed_attempts").notNull().default(0),
|
|
2531
2570
|
key: varchar8("key", { length: KEY_LENGTH }).primaryKey(),
|
|
2532
2571
|
locked_until_ms: bigint6("locked_until_ms", { mode: "number" }),
|
|
2533
2572
|
window_started_at_ms: bigint6("window_started_at_ms", {
|
|
@@ -3081,10 +3120,20 @@ var mfaTotpLockoutMigration = {
|
|
|
3081
3120
|
};
|
|
3082
3121
|
var blockMigrations = {
|
|
3083
3122
|
adaptive: initMigration("adaptive", [knownDevicesTable, loginHistoryTable]),
|
|
3084
|
-
agents:
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3123
|
+
agents: {
|
|
3124
|
+
block: "agents",
|
|
3125
|
+
migrations: [
|
|
3126
|
+
...initMigration("agents", [
|
|
3127
|
+
agentRegistrationsTable,
|
|
3128
|
+
agentDelegationsTable,
|
|
3129
|
+
agentIdentityRegistrationsTable
|
|
3130
|
+
]).migrations,
|
|
3131
|
+
{
|
|
3132
|
+
id: "0002_identity_registration",
|
|
3133
|
+
sql: tablesToInitSql([agentIdentityRegistrationsTable])
|
|
3134
|
+
}
|
|
3135
|
+
]
|
|
3136
|
+
},
|
|
3088
3137
|
apikeys: initMigration("apikeys", [
|
|
3089
3138
|
accessTokensTable,
|
|
3090
3139
|
apiClientsTable,
|
|
@@ -3313,5 +3362,5 @@ var main = async () => {
|
|
|
3313
3362
|
};
|
|
3314
3363
|
await main();
|
|
3315
3364
|
|
|
3316
|
-
//# debugId=
|
|
3365
|
+
//# debugId=2CDEAF9E7315372064756E2164756E21
|
|
3317
3366
|
//# sourceMappingURL=migrate.js.map
|