@adonis-agora/authkit-server 0.46.0 → 0.48.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/build/commands/clients_create.js +4 -4
- package/build/commands/configure.js +3 -2
- package/build/commands/doctor.js +8 -5
- package/build/commands/eject.js +1 -1
- package/build/commands/expire_scan.js +7 -5
- package/build/commands/import_users.js +1 -1
- package/build/commands/keys_rotate.js +7 -4
- package/build/host/views/account/apps.edge +5 -5
- package/build/host/views/account/login.edge +1 -1
- package/build/host/views/account/mfa.edge +7 -7
- package/build/host/views/account/orgs.edge +5 -5
- package/build/host/views/account/security.edge +10 -10
- package/build/host/views/account/tokens.edge +5 -5
- package/build/host/views/otp-unlock.edge +2 -2
- package/build/index.d.ts +7 -7
- package/build/index.js +5 -5
- package/build/providers/authkit_server_provider.d.ts +2 -2
- package/build/providers/authkit_server_provider.js +26 -10
- package/build/services/booted_app.d.ts +8 -0
- package/build/services/booted_app.js +27 -0
- package/build/services/main.d.ts +8 -1
- package/build/services/main.js +10 -2
- package/build/src/accounts/lucid_account_store.d.ts +3 -3
- package/build/src/accounts/lucid_account_store.js +6 -8
- package/build/src/accounts/lucid_store/core.js +1 -1
- package/build/src/accounts/lucid_store/mfa.js +1 -1
- package/build/src/accounts/lucid_store/organizations.js +2 -4
- package/build/src/accounts/lucid_store/password_hygiene.js +1 -4
- package/build/src/accounts/lucid_store/shared.d.ts +1 -1
- package/build/src/accounts/lucid_stores.d.ts +3 -3
- package/build/src/accounts/lucid_stores.js +2 -2
- package/build/src/adapters/database_adapter.js +3 -1
- package/build/src/adapters/factory.js +1 -1
- package/build/src/adapters/redis_adapter.js +2 -1
- package/build/src/commands/expire_scan_command.js +19 -5
- package/build/src/commands/settings_commands.js +22 -5
- package/build/src/define_config.d.ts +20 -20
- package/build/src/define_config.js +62 -67
- package/build/src/doctor/checks.js +45 -20
- package/build/src/events/dispatcher.d.ts +1 -1
- package/build/src/events/dispatcher.js +10 -10
- package/build/src/host/account_api/account_api_controller.js +95 -39
- package/build/src/host/account_deletion_ops.d.ts +4 -4
- package/build/src/host/account_deletion_ops.js +5 -5
- package/build/src/host/account_deletion_service.d.ts +2 -2
- package/build/src/host/account_deletion_service.js +2 -2
- package/build/src/host/account_export_service.d.ts +1 -1
- package/build/src/host/account_export_service.js +4 -6
- package/build/src/host/account_home.d.ts +0 -8
- package/build/src/host/account_home.js +6 -4
- package/build/src/host/account_login_url.d.ts +44 -0
- package/build/src/host/account_login_url.js +58 -0
- package/build/src/host/account_paths.d.ts +120 -0
- package/build/src/host/account_paths.js +161 -0
- package/build/src/host/admin_api/admin_orgs_service.d.ts +2 -2
- package/build/src/host/admin_api/admin_orgs_service.js +3 -2
- package/build/src/host/admin_api/admin_users_service.d.ts +12 -12
- package/build/src/host/admin_api/admin_users_service.js +20 -20
- package/build/src/host/admin_api/api_clients_controller.js +2 -2
- package/build/src/host/admin_api/api_misc_controller.js +2 -2
- package/build/src/host/admin_api/api_orgs_controller.js +3 -3
- package/build/src/host/admin_api/api_settings_controller.js +11 -5
- package/build/src/host/admin_api/api_users_controller.d.ts +2 -2
- package/build/src/host/admin_api/api_users_controller.js +37 -38
- package/build/src/host/admin_api/dto.d.ts +4 -4
- package/build/src/host/admin_clients_service.js +5 -4
- package/build/src/host/admin_console/admin_shell_controller.js +4 -2
- package/build/src/host/admin_console/console_audit_controller.js +1 -1
- package/build/src/host/admin_console/console_clients_controller.js +5 -3
- package/build/src/host/admin_console/console_impersonation_controller.js +1 -1
- package/build/src/host/admin_console/console_keys_controller.js +2 -4
- package/build/src/host/admin_console/console_orgs_controller.js +3 -3
- package/build/src/host/admin_console/console_roles_controller.js +30 -12
- package/build/src/host/admin_console/console_sessions_controller.js +3 -3
- package/build/src/host/admin_console/console_settings_controller.js +11 -5
- package/build/src/host/admin_console/console_users_controller.d.ts +2 -2
- package/build/src/host/admin_console/console_users_controller.js +46 -47
- package/build/src/host/admin_prefix.js +2 -2
- package/build/src/host/admin_sessions_service.d.ts +3 -1
- package/build/src/host/admin_sessions_service.js +36 -6
- package/build/src/host/adonis_auth_sync.d.ts +1 -1
- package/build/src/host/adonis_auth_user_provider.d.ts +1 -1
- package/build/src/host/app_key.js +1 -1
- package/build/src/host/avatar_storage.js +1 -3
- package/build/src/host/config_locks.js +1 -3
- package/build/src/host/console_session.d.ts +4 -0
- package/build/src/host/console_session.js +9 -2
- package/build/src/host/controllers/account_apps_controller.js +3 -2
- package/build/src/host/controllers/account_confirm_controller.js +2 -6
- package/build/src/host/controllers/account_mfa_controller.js +63 -12
- package/build/src/host/controllers/account_orgs_controller.js +53 -30
- package/build/src/host/controllers/account_security_controller.d.ts +2 -2
- package/build/src/host/controllers/account_security_controller.js +116 -116
- package/build/src/host/controllers/account_session_controller.js +7 -5
- package/build/src/host/controllers/account_tokens_controller.js +14 -2
- package/build/src/host/controllers/interaction_controller.js +59 -22
- package/build/src/host/controllers/pat_introspection_controller.js +10 -0
- package/build/src/host/controllers/registration_controller.js +28 -13
- package/build/src/host/default_mailer.js +11 -7
- package/build/src/host/durable/account_deletion_workflow.d.ts +2 -2
- package/build/src/host/durable/account_deletion_workflow.js +14 -14
- package/build/src/host/durable/account_export_workflow.d.ts +2 -2
- package/build/src/host/durable/account_export_workflow.js +12 -12
- package/build/src/host/durable/index.d.ts +5 -5
- package/build/src/host/durable/index.js +6 -6
- package/build/src/host/i18n.d.ts +1376 -1376
- package/build/src/host/i18n.js +1380 -1380
- package/build/src/host/impersonation.js +1 -7
- package/build/src/host/key_rotation_actions.d.ts +1 -1
- package/build/src/host/login_attempt.js +35 -6
- package/build/src/host/login_notify.js +1 -1
- package/build/src/host/middleware/account_auth.js +3 -1
- package/build/src/host/otp_lockout.js +1 -3
- package/build/src/host/rate_limit.js +1 -1
- package/build/src/host/register_auth_host.d.ts +96 -2
- package/build/src/host/register_auth_host.js +196 -91
- package/build/src/host/renderers/edge_renderer.js +19 -1
- package/build/src/host/renderers/inertia_renderer.d.ts +63 -0
- package/build/src/host/renderers/inertia_renderer.js +63 -0
- package/build/src/host/runtime_settings.js +1 -1
- package/build/src/host/runtime_toggles.d.ts +3 -3
- package/build/src/host/runtime_toggles.js +69 -24
- package/build/src/host/security_notice_service.d.ts +1 -1
- package/build/src/host/security_notice_service.js +1 -1
- package/build/src/host/session_context.js +1 -1
- package/build/src/host/sudo/index.d.ts +3 -3
- package/build/src/host/sudo/index.js +3 -3
- package/build/src/host/sudo/methods/magic_link.js +6 -5
- package/build/src/host/sudo/methods/passkey.js +7 -4
- package/build/src/host/sudo/methods/password.js +8 -3
- package/build/src/host/sudo/runtime.js +6 -13
- package/build/src/host/sudo_mode.js +3 -2
- package/build/src/host/ui-dist/assets/index-BQoTDiLV.js +137 -0
- package/build/src/host/ui-dist/index.html +1 -1
- package/build/src/keys/jwks_manager.js +1 -1
- package/build/src/keys/keystore.js +1 -1
- package/build/src/keys/keystore_manager.d.ts +2 -2
- package/build/src/keys/keystore_manager.js +2 -2
- package/build/src/keys/keystore_vault.js +8 -4
- package/build/src/mixins/with_audit_log.d.ts +1 -1
- package/build/src/mixins/with_auth_user.d.ts +1 -1
- package/build/src/mixins/with_auth_user.js +1 -1
- package/build/src/mixins/with_credentials.d.ts +1 -1
- package/build/src/mixins/with_mfa.d.ts +1 -1
- package/build/src/mixins/with_personal_access_token.d.ts +1 -1
- package/build/src/mixins/with_provider_identity.d.ts +1 -1
- package/build/src/mixins/with_webauthn_credential.d.ts +1 -1
- package/build/src/observability/diagnostics_bridge.js +2 -2
- package/build/src/observability/metrics_service.js +1 -1
- package/build/src/observability/telescope/data_providers.d.ts +1 -1
- package/build/src/observability/telescope/data_providers.js +29 -43
- package/build/src/observability/telescope/extension.d.ts +1 -1
- package/build/src/observability/telescope/extension.js +58 -58
- package/build/src/observability/telescope/index.d.ts +2 -2
- package/build/src/observability/telescope/index.js +2 -2
- package/build/src/observability/wire_provider_events.d.ts +1 -1
- package/build/src/observability/wire_provider_events.js +11 -11
- package/build/src/password/common_passwords.js +1 -1
- package/build/src/password/password_manager.d.ts +1 -1
- package/build/src/password/password_manager.js +4 -4
- package/build/src/pat/lucid_pat_store.js +2 -6
- package/build/src/pat/pat_tokens.js +1 -1
- package/build/src/provider/interaction_actions.js +1 -1
- package/build/src/provider/key_rotation_scheduler.js +3 -1
- package/build/src/provider/logout_sources.js +2 -8
- package/build/src/provider/oidc_service.d.ts +2 -2
- package/build/src/provider/oidc_service.js +22 -14
- package/build/src/provider/single_flight_lock.js +1 -3
- package/build/src/provider/token_exchange.d.ts +1 -1
- package/build/src/schema/ensure.js +3 -1
- package/build/stubs/ui/react/components/auth_shell.tsx +19 -19
- package/build/stubs/ui/react/pages/account/login.tsx +6 -7
- package/build/stubs/ui/react/pages/account/mfa.tsx +16 -15
- package/build/stubs/ui/react/pages/account/tokens.tsx +27 -17
- package/build/stubs/ui/react/pages/consent.tsx +12 -12
- package/build/stubs/ui/react/pages/forgot.tsx +7 -7
- package/build/stubs/ui/react/pages/login.tsx +22 -24
- package/build/stubs/ui/react/pages/mfa-challenge.tsx +9 -10
- package/build/stubs/ui/react/pages/reset.tsx +10 -10
- package/build/stubs/ui/react/pages/signup.tsx +30 -16
- package/build/stubs/ui/react/pages/verify-email.tsx +6 -6
- package/package.json +1 -1
- package/stubs/main.ts +2 -2
- package/stubs/ui/react/components/auth_shell.tsx +19 -19
- package/stubs/ui/react/pages/account/login.tsx +6 -7
- package/stubs/ui/react/pages/account/mfa.tsx +16 -15
- package/stubs/ui/react/pages/account/tokens.tsx +27 -17
- package/stubs/ui/react/pages/consent.tsx +12 -12
- package/stubs/ui/react/pages/forgot.tsx +7 -7
- package/stubs/ui/react/pages/login.tsx +22 -24
- package/stubs/ui/react/pages/mfa-challenge.tsx +9 -10
- package/stubs/ui/react/pages/reset.tsx +10 -10
- package/stubs/ui/react/pages/signup.tsx +30 -16
- package/stubs/ui/react/pages/verify-email.tsx +6 -6
- package/build/src/host/ui-dist/assets/index-BmI_J87g.js +0 -137
|
@@ -47,10 +47,10 @@ export default class AuthkitClientsCreate extends BaseCommand {
|
|
|
47
47
|
const service = await this.app.container.make('authkit.server');
|
|
48
48
|
const { AdminClientsService } = await import('../src/host/admin_clients_service.js');
|
|
49
49
|
const svc = new AdminClientsService(service);
|
|
50
|
-
const grantTypes = this.grant && this.grant.length > 0
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
const grantTypes = this.grant && this.grant.length > 0 ? this.grant : ['authorization_code', 'refresh_token'];
|
|
51
|
+
const tokenEndpointAuthMethod = this.public
|
|
52
|
+
? 'none'
|
|
53
|
+
: 'client_secret_basic';
|
|
54
54
|
const created = await svc.create({
|
|
55
55
|
clientId: this.clientId,
|
|
56
56
|
redirectUris,
|
|
@@ -9,7 +9,7 @@ function assertPresetPrereqs(preset, appRoot) {
|
|
|
9
9
|
const pkg = existsSync(pkgPath) ? JSON.parse(readFileSync(pkgPath, 'utf8')) : {};
|
|
10
10
|
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
11
11
|
const hasInertia = !!deps['@adonisjs/inertia'];
|
|
12
|
-
const hasReact = !!deps
|
|
12
|
+
const hasReact = !!deps.react;
|
|
13
13
|
const hasVite = existsSync(join(appRoot, 'vite.config.ts')) || existsSync(join(appRoot, 'vite.config.js'));
|
|
14
14
|
if (!hasInertia || !hasReact || !hasVite) {
|
|
15
15
|
throw new Error('authkit --ui=react requer @adonisjs/inertia + react + Vite no app. ' +
|
|
@@ -18,7 +18,8 @@ function assertPresetPrereqs(preset, appRoot) {
|
|
|
18
18
|
}
|
|
19
19
|
export async function configure(command) {
|
|
20
20
|
const flag = command.parsedFlags?.ui;
|
|
21
|
-
const chosen = flag ??
|
|
21
|
+
const chosen = flag ??
|
|
22
|
+
(await command.prompt.choice('UI das telas de login/consent', ['edge', 'react', 'headless']));
|
|
22
23
|
const preset = resolveUiPreset(chosen);
|
|
23
24
|
assertPresetPrereqs(preset, command.app.makePath());
|
|
24
25
|
const codemods = await command.createCodemods();
|
package/build/commands/doctor.js
CHANGED
|
@@ -7,14 +7,14 @@ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExte
|
|
|
7
7
|
return path;
|
|
8
8
|
};
|
|
9
9
|
import { BaseCommand } from '@adonisjs/core/ace';
|
|
10
|
-
import { runAllChecks, hasErrors, signingKeyAgeFinding } from '../src/doctor/checks.js';
|
|
11
10
|
import { DatabaseAdapter } from '../src/adapters/database_adapter.js';
|
|
12
11
|
import { resolveAuthkitConfig } from '../src/commands/resolve_config.js';
|
|
13
|
-
import { KeystoreManager, resolveKeystoreVault } from '../src/keys/keystore_manager.js';
|
|
14
|
-
import { KeystoreCodec } from '../src/keys/keystore_codec.js';
|
|
15
|
-
import { signingKeyAgeDays } from '../src/keys/keystore.js';
|
|
16
12
|
import { defaultEncryptForStore } from '../src/define_config.js';
|
|
13
|
+
import { hasErrors, runAllChecks, signingKeyAgeFinding, } from '../src/doctor/checks.js';
|
|
14
|
+
import { signingKeyAgeDays } from '../src/keys/keystore.js';
|
|
15
|
+
import { KeystoreCodec } from '../src/keys/keystore_codec.js';
|
|
17
16
|
import { loadEncryptionService } from '../src/keys/keystore_crypto.js';
|
|
17
|
+
import { KeystoreManager, resolveKeystoreVault } from '../src/keys/keystore_manager.js';
|
|
18
18
|
/**
|
|
19
19
|
* Tenta importar um peer; `true` se importável.
|
|
20
20
|
*
|
|
@@ -77,7 +77,10 @@ export default class AuthkitDoctor extends BaseCommand {
|
|
|
77
77
|
const jwksInput = (authkitConfig?.jwksConfig ?? authkitConfig?.jwks);
|
|
78
78
|
if (jwksInput?.source === 'managed' && jwksInput?.store) {
|
|
79
79
|
try {
|
|
80
|
-
const vault = resolveKeystoreVault(jwksInput.store, {
|
|
80
|
+
const vault = resolveKeystoreVault(jwksInput.store, {
|
|
81
|
+
makePath: (p) => this.app.makePath(p),
|
|
82
|
+
container: this.app.container,
|
|
83
|
+
});
|
|
81
84
|
const encrypt = jwksInput.encrypt ?? defaultEncryptForStore(jwksInput.store);
|
|
82
85
|
const enc = encrypt ? await loadEncryptionService().catch(() => undefined) : undefined;
|
|
83
86
|
const mgr = new KeystoreManager(vault, new KeystoreCodec({ encrypt, enc }), jwksInput.algorithm ?? 'RS256');
|
package/build/commands/eject.js
CHANGED
|
@@ -91,6 +91,6 @@ __decorate([
|
|
|
91
91
|
], AuthkitEject.prototype, "views", void 0);
|
|
92
92
|
__decorate([
|
|
93
93
|
flags.string({
|
|
94
|
-
description:
|
|
94
|
+
description: 'Copia um controller do host-kit (ex.: interaction) para app/controllers/authkit/',
|
|
95
95
|
})
|
|
96
96
|
], AuthkitEject.prototype, "controller", void 0);
|
|
@@ -62,22 +62,22 @@ export default class AuthkitExpireScan extends BaseCommand {
|
|
|
62
62
|
this.logger.info(`[expire-scan] Deduped (already warned): ${result.deduped}`);
|
|
63
63
|
}
|
|
64
64
|
if (expired.length > 0) {
|
|
65
|
-
this.logger.warning(
|
|
65
|
+
this.logger.warning('[expire-scan] Expired accounts:');
|
|
66
66
|
for (const acc of expired) {
|
|
67
67
|
this.logger.warning(` ${acc.email} (${acc.accountId}) — last activity ${acc.lastActivityDaysAgo ?? '?'} days ago`);
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
if (warnSoon.length > 0) {
|
|
71
|
-
this.logger.info(
|
|
71
|
+
this.logger.info('[expire-scan] Expiring soon:');
|
|
72
72
|
for (const acc of warnSoon) {
|
|
73
73
|
this.logger.info(` ${acc.email} (${acc.accountId}) — expires in ${acc.expiresInDays} days`);
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
if (!summary.auditSupported) {
|
|
77
|
-
this.logger.warning(
|
|
77
|
+
this.logger.warning('[expire-scan] Audit sink does not support list(). Feature unavailable.');
|
|
78
78
|
}
|
|
79
79
|
if (summary.dryRun) {
|
|
80
|
-
this.logger.info(
|
|
80
|
+
this.logger.info('[expire-scan] DRY RUN — no emails sent, no audit events recorded.');
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
}
|
|
@@ -85,7 +85,9 @@ __decorate([
|
|
|
85
85
|
flags.boolean({ description: 'Reporta sem enviar e-mails nem auditar.' })
|
|
86
86
|
], AuthkitExpireScan.prototype, "dryRun", void 0);
|
|
87
87
|
__decorate([
|
|
88
|
-
flags.boolean({
|
|
88
|
+
flags.boolean({
|
|
89
|
+
description: 'Envia e-mail de aviso às contas a expirar em breve (deduplicado via audit).',
|
|
90
|
+
})
|
|
89
91
|
], AuthkitExpireScan.prototype, "warn", void 0);
|
|
90
92
|
__decorate([
|
|
91
93
|
flags.boolean({ description: 'Output em JSON machine-readable (estrutura ExpireScanResult).' })
|
|
@@ -6,7 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { readFile } from 'node:fs/promises';
|
|
8
8
|
import { BaseCommand, flags } from '@adonisjs/core/ace';
|
|
9
|
-
import {
|
|
9
|
+
import { importUsers, parseImportFile } from '../src/commands/import_users.js';
|
|
10
10
|
import { resolveAuthkitConfig } from '../src/commands/resolve_config.js';
|
|
11
11
|
/**
|
|
12
12
|
* Importa usuários de outro sistema para o account store do AuthKit. Os hashes
|
|
@@ -5,12 +5,12 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { BaseCommand, flags } from '@adonisjs/core/ace';
|
|
8
|
+
import { resolveAuthkitConfig } from '../src/commands/resolve_config.js';
|
|
9
|
+
import { defaultEncryptForStore } from '../src/define_config.js';
|
|
8
10
|
import { signingKeyAgeDays } from '../src/keys/keystore.js';
|
|
9
|
-
import { KeystoreManager, resolveKeystoreVault } from '../src/keys/keystore_manager.js';
|
|
10
11
|
import { KeystoreCodec } from '../src/keys/keystore_codec.js';
|
|
11
12
|
import { loadEncryptionService } from '../src/keys/keystore_crypto.js';
|
|
12
|
-
import {
|
|
13
|
-
import { resolveAuthkitConfig } from '../src/commands/resolve_config.js';
|
|
13
|
+
import { KeystoreManager, resolveKeystoreVault } from '../src/keys/keystore_manager.js';
|
|
14
14
|
/**
|
|
15
15
|
* Rotação de chaves de assinatura JWKS (padrão OIDC). Gera uma chave nova, passa a
|
|
16
16
|
* ASSINAR com ela e mantém as antigas publicadas no JWKS por um período de graça
|
|
@@ -61,7 +61,10 @@ export default class AuthkitKeysRotate extends BaseCommand {
|
|
|
61
61
|
const alg = algorithm ?? 'RS256';
|
|
62
62
|
const keep = this.keep ?? 2;
|
|
63
63
|
const retire = this.retire ?? false;
|
|
64
|
-
const vault = resolveKeystoreVault(store, {
|
|
64
|
+
const vault = resolveKeystoreVault(store, {
|
|
65
|
+
makePath: (p) => this.app.makePath(p),
|
|
66
|
+
container: this.app.container,
|
|
67
|
+
});
|
|
65
68
|
const encrypt = jwksInput.encrypt ?? defaultEncryptForStore(store);
|
|
66
69
|
const enc = encrypt ? await loadEncryptionService() : undefined;
|
|
67
70
|
const manager = new KeystoreManager(vault, new KeystoreCodec({ encrypt, enc }), alg);
|
|
@@ -10,16 +10,16 @@
|
|
|
10
10
|
<h1 class="text-xl font-semibold text-gray-900">{{ t('account.apps.title') }}</h1>
|
|
11
11
|
<p class="mt-1 text-sm text-gray-500">{{ t('account.apps.intro') }}</p>
|
|
12
12
|
</div>
|
|
13
|
-
<form method="POST" action="/account/logout">
|
|
13
|
+
<form method="POST" action="{{ accountPaths?.logout ?? '/account/logout' }}">
|
|
14
14
|
<input type="hidden" name="_csrf" value="{{ csrfToken }}">
|
|
15
15
|
<button type="submit" class="text-sm text-gray-500 hover:underline">{{ t('account.apps.logout') }}</button>
|
|
16
16
|
</form>
|
|
17
17
|
</div>
|
|
18
18
|
|
|
19
19
|
<nav class="mb-6 flex gap-4 text-sm font-medium">
|
|
20
|
-
<a href="/account/tokens" class="text-gray-500 hover:underline">{{ t('account.tokens.title') }}</a>
|
|
21
|
-
<a href="/account/security" class="text-gray-500 hover:underline">{{ t('account.security.title') }}</a>
|
|
22
|
-
<a href="/account/apps" class="text-gray-900 underline">{{ t('account.apps.title') }}</a>
|
|
20
|
+
<a href="{{ accountPaths?.tokens ?? '/account/tokens' }}" class="text-gray-500 hover:underline">{{ t('account.tokens.title') }}</a>
|
|
21
|
+
<a href="{{ accountPaths?.security ?? '/account/security' }}" class="text-gray-500 hover:underline">{{ t('account.security.title') }}</a>
|
|
22
|
+
<a href="{{ accountPaths?.apps ?? '/account/apps' }}" class="text-gray-900 underline">{{ t('account.apps.title') }}</a>
|
|
23
23
|
</nav>
|
|
24
24
|
|
|
25
25
|
@if(revoked)
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
<p class="text-sm font-medium text-gray-900">{{ app.name }}</p>
|
|
44
44
|
<p class="text-xs text-gray-500">{{ t('account.apps.tokens', { accessTokens: app.accessTokens, refreshTokens: app.refreshTokens }) }}</p>
|
|
45
45
|
</div>
|
|
46
|
-
<form method="POST" action="/account/apps/{{ app.clientId }}/revoke"
|
|
46
|
+
<form method="POST" action="{{ accountPaths?.apps ?? '/account/apps' }}/{{ app.clientId }}/revoke"
|
|
47
47
|
onsubmit="return confirm('{{ t('account.apps.revoke_confirm') }}')">
|
|
48
48
|
<input type="hidden" name="_csrf" value="{{ csrfToken }}">
|
|
49
49
|
<button type="submit" class="rounded-lg border border-red-300 px-3 py-1.5 text-sm font-semibold text-red-700 hover:bg-red-50">
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
@include('authkit::partials/styles')
|
|
4
4
|
</head>
|
|
5
5
|
<body class="min-h-screen flex items-center justify-center bg-gray-100 p-4">
|
|
6
|
-
<form method="POST" action="/account/login"
|
|
6
|
+
<form method="POST" action="{{ accountPaths?.login ?? '/account/login' }}"
|
|
7
7
|
class="w-full max-w-sm rounded-2xl bg-white p-8 shadow-xl ring-1 ring-black/5">
|
|
8
8
|
<input type="hidden" name="_csrf" value="{{ csrfToken }}">
|
|
9
9
|
@if(returnTo)
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<div class="text-xs font-semibold uppercase tracking-widest text-gray-400">{{ t('common.brand_eyebrow') }}</div>
|
|
10
10
|
<h1 class="text-xl font-semibold text-gray-900">{{ t('account.mfa.title') }}</h1>
|
|
11
11
|
</div>
|
|
12
|
-
<form method="POST" action="/account/logout">
|
|
12
|
+
<form method="POST" action="{{ accountPaths?.logout ?? '/account/logout' }}">
|
|
13
13
|
<input type="hidden" name="_csrf" value="{{ csrfToken }}">
|
|
14
14
|
<button type="submit" class="text-sm text-gray-500 hover:underline">{{ t('account.mfa.logout') }}</button>
|
|
15
15
|
</form>
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
<code class="mx-auto mt-1 block w-fit break-all rounded bg-gray-100 px-3 py-2 text-sm text-gray-800">{{ secret }}</code>
|
|
47
47
|
@end
|
|
48
48
|
|
|
49
|
-
<form method="POST" action="/account/mfa/confirm" class="mt-6">
|
|
49
|
+
<form method="POST" action="{{ accountPaths?.mfa ?? '/account/mfa' }}/confirm" class="mt-6">
|
|
50
50
|
<input type="hidden" name="_csrf" value="{{ csrfToken }}">
|
|
51
51
|
<label for="code" class="mb-1 block text-sm font-medium text-gray-700">{{ t('account.mfa.confirm_code_label') }}</label>
|
|
52
52
|
<input id="code" name="code" inputmode="numeric" pattern="[0-9]*" maxlength="6" autofocus
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
<p class="text-sm text-gray-700">
|
|
62
62
|
{{{ t('account.mfa.enabled_html') }}}
|
|
63
63
|
</p>
|
|
64
|
-
<form method="POST" action="/account/mfa/disable" class="mt-4">
|
|
64
|
+
<form method="POST" action="{{ accountPaths?.mfa ?? '/account/mfa' }}/disable" class="mt-4">
|
|
65
65
|
<input type="hidden" name="_csrf" value="{{ csrfToken }}">
|
|
66
66
|
<button type="submit" class="rounded-lg border border-red-300 px-4 py-2 text-sm font-semibold text-red-600 hover:bg-red-50">
|
|
67
67
|
{{ t('account.mfa.disable') }}
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
<p class="text-sm text-gray-700">
|
|
74
74
|
{{ t('account.mfa.disabled_intro') }}
|
|
75
75
|
</p>
|
|
76
|
-
<form method="POST" action="/account/mfa/enroll" class="mt-4">
|
|
76
|
+
<form method="POST" action="{{ accountPaths?.mfa ?? '/account/mfa' }}/enroll" class="mt-4">
|
|
77
77
|
<input type="hidden" name="_csrf" value="{{ csrfToken }}">
|
|
78
78
|
<button type="submit" class="rounded-lg bg-gray-900 px-4 py-2 text-sm font-semibold text-white">
|
|
79
79
|
{{ t('account.mfa.enable') }}
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
@each(pk in passkeys)
|
|
94
94
|
<li class="flex items-center justify-between rounded-lg border border-gray-200 px-3 py-2">
|
|
95
95
|
<span class="text-sm text-gray-800">{{ pk.label ? pk.label : t('mfa.passkey.unnamed') }}</span>
|
|
96
|
-
<form method="POST" action="/account/mfa/passkeys/{{ pk.id }}/remove">
|
|
96
|
+
<form method="POST" action="{{ accountPaths?.mfa ?? '/account/mfa' }}/passkeys/{{ pk.id }}/remove">
|
|
97
97
|
<input type="hidden" name="_csrf" value="{{ csrfToken }}">
|
|
98
98
|
<button type="submit" class="text-sm text-red-600 hover:underline">{{ t('mfa.passkey.remove') }}</button>
|
|
99
99
|
</form>
|
|
@@ -124,7 +124,7 @@
|
|
|
124
124
|
btn.disabled = true
|
|
125
125
|
try {
|
|
126
126
|
// 1) Opções de registro (challenge guardado na sessão server-side).
|
|
127
|
-
const optsRes = await fetch('/account/mfa/passkeys/options', {
|
|
127
|
+
const optsRes = await fetch('{{ accountPaths?.mfa ?? '/account/mfa' }}/passkeys/options', {
|
|
128
128
|
method: 'POST',
|
|
129
129
|
headers: { 'content-type': 'application/json', 'x-csrf-token': csrf },
|
|
130
130
|
body: JSON.stringify({}),
|
|
@@ -134,7 +134,7 @@
|
|
|
134
134
|
// 2) Cerimônia de registro no authenticator.
|
|
135
135
|
const attResp = await startRegistration({ optionsJSON })
|
|
136
136
|
// 3) Verifica/persiste no servidor.
|
|
137
|
-
const verifyRes = await fetch('/account/mfa/passkeys/verify', {
|
|
137
|
+
const verifyRes = await fetch('{{ accountPaths?.mfa ?? '/account/mfa' }}/passkeys/verify', {
|
|
138
138
|
method: 'POST',
|
|
139
139
|
headers: { 'content-type': 'application/json', 'x-csrf-token': csrf },
|
|
140
140
|
body: JSON.stringify({ response: attResp }),
|
|
@@ -18,15 +18,15 @@
|
|
|
18
18
|
<strong>{{ org.name }}</strong> ({{ org.slug }})
|
|
19
19
|
@if(org.isActive)
|
|
20
20
|
<span>{{ t('account.orgs.active_badge') }}</span>
|
|
21
|
-
<form method="POST" action="/account/orgs/deactivate">
|
|
21
|
+
<form method="POST" action="{{ accountPaths?.orgs ?? '/account/orgs' }}/deactivate">
|
|
22
22
|
<button>{{ t('account.orgs.deactivate') }}</button>
|
|
23
23
|
</form>
|
|
24
24
|
@else
|
|
25
|
-
<form method="POST" action="/account/orgs/{{ org.id }}/activate">
|
|
25
|
+
<form method="POST" action="{{ accountPaths?.orgs ?? '/account/orgs' }}/{{ org.id }}/activate">
|
|
26
26
|
<button>{{ t('account.orgs.activate') }}</button>
|
|
27
27
|
</form>
|
|
28
28
|
@end
|
|
29
|
-
<form method="POST" action="/account/orgs/{{ org.id }}/leave">
|
|
29
|
+
<form method="POST" action="{{ accountPaths?.orgs ?? '/account/orgs' }}/{{ org.id }}/leave">
|
|
30
30
|
<button>{{ t('account.orgs.leave') }}</button>
|
|
31
31
|
</form>
|
|
32
32
|
</div>
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
@each(inv in pendingInvitations)
|
|
39
39
|
<div>
|
|
40
40
|
{{ t('account.orgs.invitation_from', { orgName: inv.orgName, role: inv.role }) }}
|
|
41
|
-
<form method="POST" action="/account/orgs/invitations/{{ inv.id }}/accept">
|
|
41
|
+
<form method="POST" action="{{ accountPaths?.orgs ?? '/account/orgs' }}/invitations/{{ inv.id }}/accept">
|
|
42
42
|
<button>{{ t('account.orgs.invitation_accept') }}</button>
|
|
43
43
|
</form>
|
|
44
44
|
</div>
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
|
|
48
48
|
@if(allowSelfCreate)
|
|
49
49
|
<h2>{{ t('account.orgs.create_section') }}</h2>
|
|
50
|
-
<form method="POST" action="/account/orgs">
|
|
50
|
+
<form method="POST" action="{{ accountPaths?.orgs ?? '/account/orgs' }}">
|
|
51
51
|
<input name="name" placeholder="{{ t('account.orgs.create_name_label') }}">
|
|
52
52
|
<input name="slug" placeholder="{{ t('account.orgs.create_slug_label') }}">
|
|
53
53
|
<button>{{ t('account.orgs.create_submit') }}</button>
|
|
@@ -12,16 +12,16 @@
|
|
|
12
12
|
<p class="mt-1 text-sm text-gray-500">{{ t('account.security.current_email', { email: email }) }}</p>
|
|
13
13
|
@end
|
|
14
14
|
</div>
|
|
15
|
-
<form method="POST" action="/account/logout">
|
|
15
|
+
<form method="POST" action="{{ accountPaths?.logout ?? '/account/logout' }}">
|
|
16
16
|
<input type="hidden" name="_csrf" value="{{ csrfToken }}">
|
|
17
17
|
<button type="submit" class="text-sm text-gray-500 hover:underline">{{ t('account.security.logout') }}</button>
|
|
18
18
|
</form>
|
|
19
19
|
</div>
|
|
20
20
|
|
|
21
21
|
<nav class="mb-6 flex gap-4 text-sm font-medium">
|
|
22
|
-
<a href="/account/tokens" class="text-gray-500 hover:underline">{{ t('account.tokens.title') }}</a>
|
|
23
|
-
<a href="/account/security" class="text-gray-900 underline">{{ t('account.security.title') }}</a>
|
|
24
|
-
<a href="/account/apps" class="text-gray-500 hover:underline">{{ t('account.apps.title') }}</a>
|
|
22
|
+
<a href="{{ accountPaths?.tokens ?? '/account/tokens' }}" class="text-gray-500 hover:underline">{{ t('account.tokens.title') }}</a>
|
|
23
|
+
<a href="{{ accountPaths?.security ?? '/account/security' }}" class="text-gray-900 underline">{{ t('account.security.title') }}</a>
|
|
24
|
+
<a href="{{ accountPaths?.apps ?? '/account/apps' }}" class="text-gray-500 hover:underline">{{ t('account.apps.title') }}</a>
|
|
25
25
|
</nav>
|
|
26
26
|
|
|
27
27
|
@if(profileUpdated)
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
<div class="mb-6 rounded-xl bg-white p-6 shadow-sm ring-1 ring-black/5">
|
|
35
35
|
<h2 class="mb-1 text-sm font-semibold text-gray-900">{{ t('account.profile.section') }}</h2>
|
|
36
36
|
<p class="mb-4 text-xs text-gray-500">{{ t('account.profile.intro') }}</p>
|
|
37
|
-
<form method="POST" action="/account/security/profile" enctype="multipart/form-data" class="space-y-4">
|
|
37
|
+
<form method="POST" action="{{ accountPaths?.security ?? '/account/security' }}/profile" enctype="multipart/form-data" class="space-y-4">
|
|
38
38
|
<input type="hidden" name="_csrf" value="{{ csrfToken }}">
|
|
39
39
|
@if(avatarUrl)
|
|
40
40
|
<div>
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
|
|
90
90
|
<div class="mb-6 rounded-xl bg-white p-6 shadow-sm ring-1 ring-black/5">
|
|
91
91
|
<h2 class="mb-4 text-sm font-semibold text-gray-900">{{ t('account.security.password_section') }}</h2>
|
|
92
|
-
<form method="POST" action="/account/security/password" class="space-y-4">
|
|
92
|
+
<form method="POST" action="{{ accountPaths?.security ?? '/account/security' }}/password" class="space-y-4">
|
|
93
93
|
<input type="hidden" name="_csrf" value="{{ csrfToken }}">
|
|
94
94
|
<div>
|
|
95
95
|
<label class="mb-1 block text-sm font-medium text-gray-700">{{ t('account.security.current_password_label') }}</label>
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
<div class="rounded-xl bg-white p-6 shadow-sm ring-1 ring-black/5">
|
|
111
111
|
<h2 class="mb-1 text-sm font-semibold text-gray-900">{{ t('account.security.email_section') }}</h2>
|
|
112
112
|
<p class="mb-4 text-xs text-gray-500">{{ t('account.security.email_intro') }}</p>
|
|
113
|
-
<form method="POST" action="/account/security/email" class="space-y-4">
|
|
113
|
+
<form method="POST" action="{{ accountPaths?.security ?? '/account/security' }}/email" class="space-y-4">
|
|
114
114
|
<input type="hidden" name="_csrf" value="{{ csrfToken }}">
|
|
115
115
|
<div>
|
|
116
116
|
<label class="mb-1 block text-sm font-medium text-gray-700">{{ t('account.security.new_email_label') }}</label>
|
|
@@ -164,7 +164,7 @@
|
|
|
164
164
|
<div class="mt-6 rounded-xl bg-white p-6 shadow-sm ring-1 ring-black/5">
|
|
165
165
|
<h2 class="mb-1 text-sm font-semibold text-gray-900">{{ t('account.security.trusted_devices_section') }}</h2>
|
|
166
166
|
<p class="mb-4 text-xs text-gray-500">{{ t('account.security.trusted_devices_intro') }}</p>
|
|
167
|
-
<form method="POST" action="/account/security/trusted-devices/revoke">
|
|
167
|
+
<form method="POST" action="{{ accountPaths?.security ?? '/account/security' }}/trusted-devices/revoke">
|
|
168
168
|
<input type="hidden" name="_csrf" value="{{ csrfToken }}">
|
|
169
169
|
<button type="submit" class="rounded-lg border border-gray-300 px-4 py-2 text-sm font-semibold text-gray-700 hover:bg-gray-50">
|
|
170
170
|
{{ t('account.security.trusted_devices_revoke') }}
|
|
@@ -177,7 +177,7 @@
|
|
|
177
177
|
<div class="mt-6 rounded-xl bg-white p-6 shadow-sm ring-1 ring-black/5">
|
|
178
178
|
<h2 class="mb-1 text-sm font-semibold text-gray-900">{{ t('account.export.section') }}</h2>
|
|
179
179
|
<p class="mb-4 text-xs text-gray-500">{{ t('account.export.intro') }}</p>
|
|
180
|
-
<a href="/account/security/export"
|
|
180
|
+
<a href="{{ accountPaths?.security ?? '/account/security' }}/export"
|
|
181
181
|
class="inline-block rounded-lg border border-gray-300 px-4 py-2 text-sm font-semibold text-gray-700 hover:bg-gray-50">
|
|
182
182
|
{{ t('account.export.submit') }}
|
|
183
183
|
</a>
|
|
@@ -193,7 +193,7 @@
|
|
|
193
193
|
<div class="mt-6 rounded-xl bg-white p-6 shadow-sm ring-1 ring-red-200">
|
|
194
194
|
<h2 class="mb-1 text-sm font-semibold text-red-700">{{ t('account.delete.section') }}</h2>
|
|
195
195
|
<p class="mb-4 text-xs text-gray-500">{{ t('account.delete.intro') }}</p>
|
|
196
|
-
<form method="POST" action="/account/security/delete" class="space-y-4">
|
|
196
|
+
<form method="POST" action="{{ accountPaths?.security ?? '/account/security' }}/delete" class="space-y-4">
|
|
197
197
|
<input type="hidden" name="_csrf" value="{{ csrfToken }}">
|
|
198
198
|
<div>
|
|
199
199
|
<label class="mb-1 block text-sm font-medium text-gray-700">{{ t('account.delete.confirm_password_label') }}</label>
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
<h1 class="text-xl font-semibold text-gray-900">{{ t('account.tokens.title') }}</h1>
|
|
11
11
|
</div>
|
|
12
12
|
<div class="flex items-center gap-4">
|
|
13
|
-
<a href="/account/security" class="text-sm text-gray-500 hover:underline">{{ t('account.tokens.security') }}</a>
|
|
14
|
-
<a href="/account/apps" class="text-sm text-gray-500 hover:underline">{{ t('account.apps.title') }}</a>
|
|
15
|
-
<form method="POST" action="/account/logout">
|
|
13
|
+
<a href="{{ accountPaths?.security ?? '/account/security' }}" class="text-sm text-gray-500 hover:underline">{{ t('account.tokens.security') }}</a>
|
|
14
|
+
<a href="{{ accountPaths?.apps ?? '/account/apps' }}" class="text-sm text-gray-500 hover:underline">{{ t('account.apps.title') }}</a>
|
|
15
|
+
<form method="POST" action="{{ accountPaths?.logout ?? '/account/logout' }}">
|
|
16
16
|
<input type="hidden" name="_csrf" value="{{ csrfToken }}">
|
|
17
17
|
<button type="submit" class="text-sm text-gray-500 hover:underline">{{ t('account.tokens.logout') }}</button>
|
|
18
18
|
</form>
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
</div>
|
|
31
31
|
@end
|
|
32
32
|
|
|
33
|
-
<form method="POST" action="/account/tokens"
|
|
33
|
+
<form method="POST" action="{{ accountPaths?.tokens ?? '/account/tokens' }}"
|
|
34
34
|
class="mb-6 flex gap-2 rounded-xl bg-white p-4 shadow-sm ring-1 ring-black/5">
|
|
35
35
|
<input type="hidden" name="_csrf" value="{{ csrfToken }}">
|
|
36
36
|
<input name="name" placeholder="{{ t('account.tokens.name_placeholder') }}"
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
<p class="text-xs text-gray-400">{{ t('account.tokens.audience', { audience: token.audience }) }}</p>
|
|
64
64
|
@end
|
|
65
65
|
</div>
|
|
66
|
-
<form method="POST" action="/account/tokens/{{ token.id }}/revoke">
|
|
66
|
+
<form method="POST" action="{{ accountPaths?.tokens ?? '/account/tokens' }}/{{ token.id }}/revoke">
|
|
67
67
|
<input type="hidden" name="_csrf" value="{{ csrfToken }}">
|
|
68
68
|
<button type="submit" class="text-sm text-red-600 hover:underline">{{ t('account.tokens.revoke') }}</button>
|
|
69
69
|
</form>
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
</div>
|
|
16
16
|
<h1 class="mb-2 text-lg font-semibold text-gray-900">{{ t('otp_unlock.ok_title') }}</h1>
|
|
17
17
|
<p class="mb-6 text-sm text-gray-600">{{ t('otp_unlock.ok_body') }}</p>
|
|
18
|
-
<a href="/account/login" class="inline-block rounded-lg bg-gray-900 px-4 py-2 text-sm font-medium text-white hover:bg-gray-700">{{ t('otp_unlock.login_link') }}</a>
|
|
18
|
+
<a href="{{ loginUrl ?? '/account/login' }}" class="inline-block rounded-lg bg-gray-900 px-4 py-2 text-sm font-medium text-white hover:bg-gray-700">{{ t('otp_unlock.login_link') }}</a>
|
|
19
19
|
@else
|
|
20
20
|
<div class="mb-4 flex justify-center">
|
|
21
21
|
<span class="inline-flex h-12 w-12 items-center justify-center rounded-full bg-red-100 text-red-600">
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
{{ t('otp_unlock.invalid_body') }}
|
|
33
33
|
@end
|
|
34
34
|
</p>
|
|
35
|
-
<a href="/account/login" class="inline-block rounded-lg bg-gray-900 px-4 py-2 text-sm font-medium text-white hover:bg-gray-700">{{ t('otp_unlock.login_link') }}</a>
|
|
35
|
+
<a href="{{ loginUrl ?? '/account/login' }}" class="inline-block rounded-lg bg-gray-900 px-4 py-2 text-sm font-medium text-white hover:bg-gray-700">{{ t('otp_unlock.login_link') }}</a>
|
|
36
36
|
@end
|
|
37
37
|
</div>
|
|
38
38
|
</div>
|
package/build/index.d.ts
CHANGED
|
@@ -11,9 +11,9 @@ export { withMfa } from './src/mixins/with_mfa.js';
|
|
|
11
11
|
export { OidcService } from './src/provider/oidc_service.js';
|
|
12
12
|
export { registerOidcRoutes } from './src/register_routes.js';
|
|
13
13
|
export type { AuthServerConfigInput, ResolvedServerConfig, DynamicRegistrationConfigInput, ResolvedDynamicRegistrationConfig, AdminConfigInput, ResolvedAdminConfig, AdminApiConfigInput, ResolvedAdminApiConfig, } from './src/define_config.js';
|
|
14
|
-
export { resolveAdmin, resolveAdminApi, resolveWebauthn, resolveDynamicRegistration } from './src/define_config.js';
|
|
14
|
+
export { resolveAdmin, resolveAdminApi, resolveWebauthn, resolveDynamicRegistration, } from './src/define_config.js';
|
|
15
15
|
export type { WebauthnConfigInput, ResolvedWebauthnConfig } from './src/define_config.js';
|
|
16
|
-
export { resolvePasswordless, resolveLogin, resolveAuthMethodsConfig } from './src/define_config.js';
|
|
16
|
+
export { resolvePasswordless, resolveLogin, resolveAuthMethodsConfig, } from './src/define_config.js';
|
|
17
17
|
export type { PasswordlessConfigInput, ResolvedPasswordlessConfig, AuthMethodsConfigInput, ResolvedAuthMethodsConfig, LoginConfigInput, ResolvedLoginConfig, } from './src/define_config.js';
|
|
18
18
|
export { resolveTrustedDevices, isTrustedDeviceValid, buildTrustedDevicePayload, TRUSTED_DEVICE_COOKIE, } from './src/host/trusted_device.js';
|
|
19
19
|
export type { TrustedDevicesConfigInput, ResolvedTrustedDevicesConfig, TrustedDevicePayload, } from './src/host/trusted_device.js';
|
|
@@ -29,7 +29,7 @@ export { PasswordManager, PasswordPolicyError, } from './src/password/password_m
|
|
|
29
29
|
export type { PasswordConfigInput, LegacyPasswordVerifier, PasswordVerifyResult, } from './src/password/password_manager.js';
|
|
30
30
|
export { checkPasswordPolicy, policyViolationParams, DEFAULT_PWNED_TIMEOUT_MS, } from './src/password/policy.js';
|
|
31
31
|
export type { ResolvedPasswordPolicy, ResolvedPasswordConfig, PasswordPolicyViolation, } from './src/password/policy.js';
|
|
32
|
-
export { isPasswordPwned, __setFetchForTests as __setPwnedFetchForTests } from './src/password/pwned.js';
|
|
32
|
+
export { isPasswordPwned, __setFetchForTests as __setPwnedFetchForTests, } from './src/password/pwned.js';
|
|
33
33
|
export type { PwnedLogger, FetchLike as PwnedFetchLike } from './src/password/pwned.js';
|
|
34
34
|
export { withProviderIdentity } from './src/mixins/with_provider_identity.js';
|
|
35
35
|
export type { ProviderIdentityRow, ProviderIdentityClass, } from './src/mixins/with_provider_identity.js';
|
|
@@ -56,7 +56,7 @@ export { registerAuthHost } from './src/host/register_auth_host.js';
|
|
|
56
56
|
export type { AuthHostOptions } from './src/host/register_auth_host.js';
|
|
57
57
|
export { getAdminPrefix, setAdminPrefix, normalizeAdminPrefix, getAdminApiPrefix, setAdminApiPrefix, normalizeAdminApiPrefix, } from './src/host/admin_prefix.js';
|
|
58
58
|
export { resolveRateLimit, resolveNotifications } from './src/define_config.js';
|
|
59
|
-
export type { ResolvedNotificationsConfig
|
|
59
|
+
export type { ResolvedNotificationsConfig } from './src/define_config.js';
|
|
60
60
|
export type { RateLimitConfigInput, RateLimitBucket, ResolvedRateLimitConfig, } from './src/define_config.js';
|
|
61
61
|
export { createAuthThrottles } from './src/host/rate_limit.js';
|
|
62
62
|
export type { AuthThrottles, ThrottleMiddleware } from './src/host/rate_limit.js';
|
|
@@ -100,10 +100,10 @@ export type { OrganizationsCapability, OrgSummary, OrgMember, OrgInvitation, Act
|
|
|
100
100
|
export { configure } from './commands/configure.js';
|
|
101
101
|
export { stubsRoot } from './stubs/main.js';
|
|
102
102
|
export { RuntimeSettings, supportsSettings } from './src/host/runtime_settings.js';
|
|
103
|
-
export type { SettingsCapability, SettingRow, RuntimeSettingsOptions } from './src/host/runtime_settings.js';
|
|
103
|
+
export type { SettingsCapability, SettingRow, RuntimeSettingsOptions, } from './src/host/runtime_settings.js';
|
|
104
104
|
export { buildKeysStatus, rotateNow } from './src/host/key_rotation_actions.js';
|
|
105
105
|
export type { KeysStatus as ServerKeysStatus } from './src/host/key_rotation_actions.js';
|
|
106
|
-
export { resolveEffectiveBotProtection
|
|
106
|
+
export { resolveEffectiveBotProtection } from './src/host/bot_protection.js';
|
|
107
107
|
export type { BotProtectionSetting } from './src/host/bot_protection.js';
|
|
108
108
|
export { SETTING_KEYS, resolveEffectiveRegistration, resolveEffectiveRequireVerifiedEmail, resolveEffectiveMaintenanceMode, resolveEffectiveAuthMethods, configLockedAuthMethods, } from './src/host/runtime_toggles.js';
|
|
109
109
|
export type { SettingKey, RegistrationSetting, RequireVerifiedEmailSetting, MaintenanceModeSetting, ResolvedMaintenanceMode, AuthMethodsSetting, ResolvedAuthMethods, AuthMethodsCapabilities, AuthMethodsConfigOverride, } from './src/host/runtime_toggles.js';
|
|
@@ -116,7 +116,7 @@ export type { StartImpersonationParams, ImpersonationState, } from './src/host/i
|
|
|
116
116
|
export { SUDO_SESSION_KEY, SUDO_ACCOUNT_SESSION_KEY, SUDO_MODE_DEFAULTS, requireSudo, isSudoActive, markSudo, resolveEffectiveSudoMode, } from './src/host/sudo_mode.js';
|
|
117
117
|
export type { SudoModeSetting, ResolvedSudoModeSetting, } from './src/host/sudo_mode.js';
|
|
118
118
|
export { sudoMethods } from './src/host/sudo/index.js';
|
|
119
|
-
export { completeSudo, fail as failSudo, LAST_METHOD_SESSION_KEY } from './src/host/sudo/runtime.js';
|
|
119
|
+
export { completeSudo, fail as failSudo, LAST_METHOD_SESSION_KEY, } from './src/host/sudo/runtime.js';
|
|
120
120
|
export { sudoContextFrom } from './src/host/sudo/runtime.js';
|
|
121
121
|
export type { SudoMethod, SudoContext, SudoMethodDescriptor, SudoRouteHelpers, } from './src/host/sudo/types.js';
|
|
122
122
|
export { authkitUserProvider } from './src/host/adonis_auth_user_provider.js';
|
package/build/index.js
CHANGED
|
@@ -8,8 +8,8 @@ export { withCredentials } from './src/mixins/with_credentials.js';
|
|
|
8
8
|
export { withMfa } from './src/mixins/with_mfa.js';
|
|
9
9
|
export { OidcService } from './src/provider/oidc_service.js';
|
|
10
10
|
export { registerOidcRoutes } from './src/register_routes.js';
|
|
11
|
-
export { resolveAdmin, resolveAdminApi, resolveWebauthn, resolveDynamicRegistration } from './src/define_config.js';
|
|
12
|
-
export { resolvePasswordless, resolveLogin, resolveAuthMethodsConfig } from './src/define_config.js';
|
|
11
|
+
export { resolveAdmin, resolveAdminApi, resolveWebauthn, resolveDynamicRegistration, } from './src/define_config.js';
|
|
12
|
+
export { resolvePasswordless, resolveLogin, resolveAuthMethodsConfig, } from './src/define_config.js';
|
|
13
13
|
export { resolveTrustedDevices, isTrustedDeviceValid, buildTrustedDevicePayload, TRUSTED_DEVICE_COOKIE, } from './src/host/trusted_device.js';
|
|
14
14
|
export { resolveBotProtection, botProtectionApplies, extractBotToken, verifyBotProtection, guardBotProtection, DEFAULT_BOT_TOKEN_FIELDS, } from './src/host/bot_protection.js';
|
|
15
15
|
export { lucidAccountStore, appKeyEncrypter } from './src/accounts/lucid_account_store.js';
|
|
@@ -18,7 +18,7 @@ export { supportsMfa, supportsPasskeys, supportsProviderIdentity, supportsAccoun
|
|
|
18
18
|
// Gerência de senha: lazy rehash + legacy verifier, política e checagem de vazamento.
|
|
19
19
|
export { PasswordManager, PasswordPolicyError, } from './src/password/password_manager.js';
|
|
20
20
|
export { checkPasswordPolicy, policyViolationParams, DEFAULT_PWNED_TIMEOUT_MS, } from './src/password/policy.js';
|
|
21
|
-
export { isPasswordPwned, __setFetchForTests as __setPwnedFetchForTests } from './src/password/pwned.js';
|
|
21
|
+
export { isPasswordPwned, __setFetchForTests as __setPwnedFetchForTests, } from './src/password/pwned.js';
|
|
22
22
|
export { withProviderIdentity } from './src/mixins/with_provider_identity.js';
|
|
23
23
|
export { withWebauthnCredential } from './src/mixins/with_webauthn_credential.js';
|
|
24
24
|
export { lucidPatStore } from './src/pat/lucid_pat_store.js';
|
|
@@ -66,7 +66,7 @@ export { stubsRoot } from './stubs/main.js';
|
|
|
66
66
|
export { RuntimeSettings, supportsSettings } from './src/host/runtime_settings.js';
|
|
67
67
|
// Key rotation actions — shared between the Admin REST API controller and the SDK embedded driver.
|
|
68
68
|
export { buildKeysStatus, rotateNow } from './src/host/key_rotation_actions.js';
|
|
69
|
-
export { resolveEffectiveBotProtection
|
|
69
|
+
export { resolveEffectiveBotProtection } from './src/host/bot_protection.js';
|
|
70
70
|
// Runtime toggles (registration, require_verified_email, maintenance_mode).
|
|
71
71
|
export { SETTING_KEYS, resolveEffectiveRegistration, resolveEffectiveRequireVerifiedEmail, resolveEffectiveMaintenanceMode, resolveEffectiveAuthMethods, configLockedAuthMethods, } from './src/host/runtime_toggles.js';
|
|
72
72
|
export { resolveRegistration } from './src/define_config.js';
|
|
@@ -86,7 +86,7 @@ export { SUDO_SESSION_KEY, SUDO_ACCOUNT_SESSION_KEY, SUDO_MODE_DEFAULTS, require
|
|
|
86
86
|
// perderia o audit `sudo.confirmed`, a preferência de método e o redirect para
|
|
87
87
|
// o `return_to`.
|
|
88
88
|
export { sudoMethods } from './src/host/sudo/index.js';
|
|
89
|
-
export { completeSudo, fail as failSudo, LAST_METHOD_SESSION_KEY } from './src/host/sudo/runtime.js';
|
|
89
|
+
export { completeSudo, fail as failSudo, LAST_METHOD_SESSION_KEY, } from './src/host/sudo/runtime.js';
|
|
90
90
|
// Montador do `SudoContext` que `completeSudo`/`failSudo` recebem. Exportado
|
|
91
91
|
// junto porque sem ele o host teria de montar o contexto na mão (resolver o
|
|
92
92
|
// service do container, carregar a conta, validar o `return_to`) — e um
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { ApplicationService } from '@adonisjs/core/types';
|
|
2
1
|
import type { MetricsRecorder } from '@adonis-agora/authkit-core';
|
|
3
|
-
import {
|
|
2
|
+
import type { ApplicationService } from '@adonisjs/core/types';
|
|
4
3
|
import type { AccountStore } from '../src/accounts/account_store.js';
|
|
5
4
|
import type { PatStore } from '../src/pat/pat_store.js';
|
|
5
|
+
import { OidcService } from '../src/provider/oidc_service.js';
|
|
6
6
|
declare module '@adonisjs/core/types' {
|
|
7
7
|
interface ContainerBindings {
|
|
8
8
|
'authkit.server': OidcService;
|
|
@@ -2,17 +2,18 @@ import { existsSync } from 'node:fs';
|
|
|
2
2
|
import { fileURLToPath } from 'node:url';
|
|
3
3
|
import { configProvider } from '@adonisjs/core';
|
|
4
4
|
import { RuntimeException } from '@adonisjs/core/exceptions';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { makeSingleFlightLock } from '../src/provider/single_flight_lock.js';
|
|
5
|
+
import { setBootedApp } from '../services/booted_app.js';
|
|
6
|
+
import { defaultEncryptForStore } from '../src/define_config.js';
|
|
7
|
+
import { resolveAppKey } from '../src/host/app_key.js';
|
|
9
8
|
import { resolveEffectiveKeyRotation } from '../src/host/key_rotation.js';
|
|
10
9
|
import { RuntimeSettings } from '../src/host/runtime_settings.js';
|
|
11
|
-
import { defaultEncryptForStore } from '../src/define_config.js';
|
|
12
|
-
import { resolveKeystoreVault, KeystoreManager } from '../src/keys/keystore_manager.js';
|
|
13
10
|
import { KeystoreCodec } from '../src/keys/keystore_codec.js';
|
|
14
11
|
import { loadEncryptionService } from '../src/keys/keystore_crypto.js';
|
|
15
|
-
import {
|
|
12
|
+
import { KeystoreManager, resolveKeystoreVault } from '../src/keys/keystore_manager.js';
|
|
13
|
+
import { KeyRotationScheduler } from '../src/provider/key_rotation_scheduler.js';
|
|
14
|
+
import { KeystoreReloadPoller } from '../src/provider/keystore_reload.js';
|
|
15
|
+
import { OidcService } from '../src/provider/oidc_service.js';
|
|
16
|
+
import { makeSingleFlightLock } from '../src/provider/single_flight_lock.js';
|
|
16
17
|
export default class AuthkitServerProvider {
|
|
17
18
|
app;
|
|
18
19
|
constructor(app) {
|
|
@@ -85,6 +86,12 @@ export default class AuthkitServerProvider {
|
|
|
85
86
|
}
|
|
86
87
|
}
|
|
87
88
|
register() {
|
|
89
|
+
// Entrega o app BOOTADO ao singleton de `services/main` (e ao
|
|
90
|
+
// `recordSubRevocation` do AdminSessionsService) para que nunca precisem
|
|
91
|
+
// `import`ar uma cópia de `@adonisjs/core`/`services/app` que pode não ser a
|
|
92
|
+
// que o `bin/server` bootou — dual-package hazard do core (ver
|
|
93
|
+
// `services/booted_app.ts`).
|
|
94
|
+
setBootedApp(this.app);
|
|
88
95
|
this.app.container.singleton('authkit.server', async () => {
|
|
89
96
|
const configProviderValue = this.app.config.get('authkit');
|
|
90
97
|
const config = (await configProvider.resolve(this.app, configProviderValue));
|
|
@@ -105,7 +112,10 @@ export default class AuthkitServerProvider {
|
|
|
105
112
|
if (jwksInput?.source === 'managed' && jwksInput?.store) {
|
|
106
113
|
const appRef = this.app;
|
|
107
114
|
const buildManager = async () => {
|
|
108
|
-
const vault = resolveKeystoreVault(jwksInput.store, {
|
|
115
|
+
const vault = resolveKeystoreVault(jwksInput.store, {
|
|
116
|
+
makePath: (p) => appRef.makePath(p),
|
|
117
|
+
container: appRef.container,
|
|
118
|
+
});
|
|
109
119
|
const encrypt = jwksInput.encrypt ?? defaultEncryptForStore(jwksInput.store);
|
|
110
120
|
// best-effort (≠ boot, que lança): se a encryption sumir em runtime, o reload
|
|
111
121
|
// degrada para "sem hot-reload" (o onError do poller engole) em vez de derrubar o processo.
|
|
@@ -123,7 +133,11 @@ export default class AuthkitServerProvider {
|
|
|
123
133
|
};
|
|
124
134
|
keystoreManager = async () => buildManager();
|
|
125
135
|
}
|
|
126
|
-
return new OidcService(config, appKey, metrics, {
|
|
136
|
+
return new OidcService(config, appKey, metrics, {
|
|
137
|
+
jwksLoader,
|
|
138
|
+
keystoreHead,
|
|
139
|
+
keystoreManager,
|
|
140
|
+
});
|
|
127
141
|
});
|
|
128
142
|
this.app.container.singleton('authkit.metrics', async () => {
|
|
129
143
|
const value = this.app.config.get('authkit');
|
|
@@ -231,7 +245,9 @@ export default class AuthkitServerProvider {
|
|
|
231
245
|
// conexão que o resto do authkit (mesmo padrão do expire_scan_command).
|
|
232
246
|
const value = this.app.config.get('authkit');
|
|
233
247
|
const config = value
|
|
234
|
-
? (await configProvider
|
|
248
|
+
? (await configProvider
|
|
249
|
+
.resolve(this.app, value)
|
|
250
|
+
.catch(() => null))
|
|
235
251
|
: null;
|
|
236
252
|
const connection = config?.schema?.connection;
|
|
237
253
|
// RuntimeSettings sem request (mesmo padrão de expire_scan_command / security_notice_service).
|