@adonis-agora/authkit-server 0.61.0 → 0.61.2
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.
|
@@ -838,7 +838,7 @@ export interface AuthServerConfigInput {
|
|
|
838
838
|
* do resolver também vira 401. O id deve ser o mesmo `sub`/`AuthAccount.id`
|
|
839
839
|
* usado pelo account store (no entre-textos, `auth.user.id === app.user.id`).
|
|
840
840
|
*/
|
|
841
|
-
resolveAccountId: (ctx: import('@adonisjs/core/http').HttpContext) => string | null
|
|
841
|
+
resolveAccountId: (ctx: import('@adonisjs/core/http').HttpContext) => string | null | Promise<string | null>;
|
|
842
842
|
};
|
|
843
843
|
/** Segredo para autenticar requests de introspecção de PAT. */
|
|
844
844
|
patIntrospectionSecret?: string;
|
|
@@ -1096,7 +1096,7 @@ export interface ResolvedServerConfig {
|
|
|
1096
1096
|
/** API headless resolvida (Clerk-style). Presente só quando o host a declarou. */
|
|
1097
1097
|
headless?: {
|
|
1098
1098
|
baseUrl: string;
|
|
1099
|
-
resolveAccountId: (ctx: import('@adonisjs/core/http').HttpContext) => string | null
|
|
1099
|
+
resolveAccountId: (ctx: import('@adonisjs/core/http').HttpContext) => string | null | Promise<string | null>;
|
|
1100
1100
|
};
|
|
1101
1101
|
rateLimit: ResolvedRateLimitConfig;
|
|
1102
1102
|
/** Bloqueio progressivo de conta resolvido (sempre presente; default ligado). */
|
|
@@ -41,7 +41,7 @@ export interface AuthHostRuntimeConfig {
|
|
|
41
41
|
*/
|
|
42
42
|
headless?: {
|
|
43
43
|
baseUrl: string;
|
|
44
|
-
resolveAccountId: (ctx: HttpContext) => string | null
|
|
44
|
+
resolveAccountId: (ctx: HttpContext) => string | null | Promise<string | null>;
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
/** Stash dos bits de routing (chamado no boot do provider). */
|
|
@@ -260,5 +260,30 @@ export async function ensureAuthkitSchema(db, options = {}) {
|
|
|
260
260
|
report.altered[def.name].push(column);
|
|
261
261
|
}
|
|
262
262
|
}
|
|
263
|
+
// Coluna `login_methods` em `auth.users` — a tabela é HOST-owned (não está em
|
|
264
|
+
// TABLES porque o nome/shape são decisão do app), mas a LI B consome a coluna
|
|
265
|
+
// (LoginMethodsPreferenceCapability). Alguns deploys de host só migram o schema
|
|
266
|
+
// do domínio, não o schema `auth` — então a migration manual da coluna pode
|
|
267
|
+
// nunca rodar, e isso derrubava TODO login/callback OIDC com "column users.login_methods
|
|
268
|
+
// does not exist" no instante em que o model passou a declará-la.
|
|
269
|
+
// Aqui garantimos: SE `auth.users` existe E a coluna falta, adicionamos. Nunca
|
|
270
|
+
// criamos a tabela (host-owned). Aditivo + idempotente — roda em todo boot.
|
|
271
|
+
try {
|
|
272
|
+
if (await tableExists(conn, 'users')) {
|
|
273
|
+
if (!(await columnExists(conn, 'users', 'login_methods'))) {
|
|
274
|
+
await conn.schema.alterTable('users', (t) => {
|
|
275
|
+
t.jsonb('login_methods').nullable();
|
|
276
|
+
});
|
|
277
|
+
report.altered.users = ['login_methods'];
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
catch (error) {
|
|
282
|
+
// Tabela host-owned pode não existir num banco que nunca criou users — não
|
|
283
|
+
// é erro: fail-soft (a migração do host cuida). Nunca criar a tabela aqui.
|
|
284
|
+
if (!(await tableExists(conn, 'users'))) {
|
|
285
|
+
throw error; // alguém criou entre o probe e o ALTER — repropaga se sumiu
|
|
286
|
+
}
|
|
287
|
+
}
|
|
263
288
|
return report;
|
|
264
289
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adonis-agora/authkit-server",
|
|
3
|
-
"version": "0.61.
|
|
3
|
+
"version": "0.61.2",
|
|
4
4
|
"description": "AdonisJS OIDC/OAuth2 provider (Identity Provider) toolkit: ejectable auth server with sessions, rate-limiting, MFA/TOTP, audit log, federated logout and OpenTelemetry metrics.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "dudousxd",
|