@adonis-agora/authkit-server 0.49.0 → 0.51.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/host/views/login.edge +25 -2
- package/build/index.d.ts +3 -2
- package/build/index.js +3 -1
- package/build/src/accounts/account_store.d.ts +59 -1
- package/build/src/accounts/account_store.js +5 -0
- package/build/src/accounts/lucid_store/core.d.ts +2 -2
- package/build/src/accounts/lucid_store/core.js +105 -4
- package/build/src/audit/audit_sink.d.ts +1 -1
- package/build/src/define_config.d.ts +29 -0
- package/build/src/define_config.js +5 -0
- package/build/src/host/controllers/interaction_controller.d.ts +11 -0
- package/build/src/host/controllers/interaction_controller.js +149 -6
- package/build/src/host/default_mailer.d.ts +2 -0
- package/build/src/host/default_mailer.js +35 -11
- package/build/src/host/email_templates.d.ts +19 -4
- package/build/src/host/email_templates.js +18 -6
- package/build/src/host/i18n.d.ts +20 -0
- package/build/src/host/i18n.js +24 -0
- package/build/src/host/login_channel.d.ts +30 -0
- package/build/src/host/login_channel.js +26 -0
- package/build/src/host/otp_login.d.ts +155 -0
- package/build/src/host/otp_login.js +206 -0
- package/build/src/host/rate_limit.d.ts +6 -0
- package/build/src/host/rate_limit.js +3 -0
- package/build/src/host/register_auth_host.js +8 -0
- package/package.json +1 -1
|
@@ -30,6 +30,12 @@ export interface AuthThrottles {
|
|
|
30
30
|
* orçamentos não poderem se consumir.
|
|
31
31
|
*/
|
|
32
32
|
sudo: ThrottleMiddleware;
|
|
33
|
+
/**
|
|
34
|
+
* Throttle da verificação de código OTP de login, keyed por IP em bucket
|
|
35
|
+
* PRÓPRIO (`authkit_otp_login`) e mais apertado que o `login`. Primeira barreira
|
|
36
|
+
* anti-brute-force do código adivinhável, ANTES do lockout por interaction.
|
|
37
|
+
*/
|
|
38
|
+
otpLogin: ThrottleMiddleware;
|
|
33
39
|
}
|
|
34
40
|
/**
|
|
35
41
|
* Service do `@adonisjs/limiter` resolvido de forma preguiçosa. Tipado como `any`
|
|
@@ -96,5 +96,8 @@ export function createAuthThrottles(config) {
|
|
|
96
96
|
// mesmo vindo do mesmo IP. Sem `usingKey` próprio de propósito: inventar uma
|
|
97
97
|
// key aqui seria mudar o EIXO da contagem, e o eixo certo continua sendo o IP.
|
|
98
98
|
sudo: buildThrottle('authkit_sudo', config.sudo, config.store),
|
|
99
|
+
// Verificação de código OTP: keyed por IP (default), bucket próprio e mais
|
|
100
|
+
// apertado que o login. O namespace do nome mantém a contagem separada.
|
|
101
|
+
otpLogin: buildThrottle('authkit_otp_login', config.otpLogin, config.store),
|
|
99
102
|
};
|
|
100
103
|
}
|
|
@@ -256,6 +256,11 @@ export function registerAuthHost(router, opts = {}) {
|
|
|
256
256
|
if (throttles)
|
|
257
257
|
route.use([throttles.sudo]);
|
|
258
258
|
};
|
|
259
|
+
// Bucket PRÓPRIO da verificação de código OTP: mais apertado que o login, por IP.
|
|
260
|
+
const withOtpLogin = (route) => {
|
|
261
|
+
if (throttles)
|
|
262
|
+
route.use([throttles.otpLogin]);
|
|
263
|
+
};
|
|
259
264
|
// ─── Assets estáticos do host-kit (públicos, sem autenticação) ─────────────
|
|
260
265
|
// Bundle do @simplewebauthn/browser servido pelo próprio app, no lugar do
|
|
261
266
|
// import de CDN público que as views de login/MFA/confirm faziam.
|
|
@@ -286,6 +291,9 @@ export function registerAuthHost(router, opts = {}) {
|
|
|
286
291
|
// Magic link (passwordless): POST emite (throttled), GET consome o token do link.
|
|
287
292
|
withLogin(router.post('/auth/interaction/:uid/magic', [C.interaction, 'magicLinkRequest']));
|
|
288
293
|
router.get('/auth/interaction/:uid/magic', [C.interaction, 'magicLinkConsume']);
|
|
294
|
+
// Login por OTP (código digitável): verifica o código no bucket dedicado
|
|
295
|
+
// `authkit_otp_login` (por IP, mais apertado que o login).
|
|
296
|
+
withOtpLogin(router.post('/auth/interaction/:uid/otp-verify', [C.interaction, 'otpVerify']));
|
|
289
297
|
router.post('/auth/interaction/:uid/consent', [C.interaction, 'consent']);
|
|
290
298
|
router.get('/auth/interaction/:uid/switch', [C.interaction, 'switchIdentifier']);
|
|
291
299
|
// OTP unlock: link enviado por e-mail quando o fator TOTP/recovery é travado.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adonis-agora/authkit-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.51.0",
|
|
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",
|