@adonis-agora/authkit-server 0.40.0 → 0.41.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.
|
@@ -117,6 +117,19 @@ export interface MailHooks {
|
|
|
117
117
|
/** Metadados extras (ex.: oldEmail/newEmail para email_changed). */
|
|
118
118
|
metadata?: Record<string, string>;
|
|
119
119
|
}) => Promise<void>;
|
|
120
|
+
/**
|
|
121
|
+
* Remetente (`from`) dos e-mails que a PRÓPRIA lib envia (alertas de novo acesso/
|
|
122
|
+
* dispositivo, reset de senha, verificação, magic link default, avisos de segurança).
|
|
123
|
+
* Tem PRIORIDADE sobre o `from` global do `config/mail.ts` do host — permite que o auth
|
|
124
|
+
* use um remetente próprio (ex.: `Segurança <no-reply-auth@dominio>`) sem trocar o
|
|
125
|
+
* remetente dos e-mails gerais do app. Quando ausente, cai no `config.mail.from` do host
|
|
126
|
+
* e, por fim, no default do @adonisjs/mail. Não afeta os hooks customizados (onMagicLink
|
|
127
|
+
* etc.): nesses o host monta o próprio `from`.
|
|
128
|
+
*/
|
|
129
|
+
from?: string | {
|
|
130
|
+
address: string;
|
|
131
|
+
name?: string;
|
|
132
|
+
};
|
|
120
133
|
}
|
|
121
134
|
/** Bucket de rate-limit: pontos (requests) permitidos por janela de duração. */
|
|
122
135
|
export interface RateLimitBucket {
|
|
@@ -42,18 +42,24 @@ export function __setMailLoaderForTests(fn) {
|
|
|
42
42
|
*/
|
|
43
43
|
function defaultFrom(ctx) {
|
|
44
44
|
try {
|
|
45
|
-
// Alcançamos
|
|
46
|
-
//
|
|
47
|
-
//
|
|
48
|
-
//
|
|
45
|
+
// Alcançamos as configs do HOST via o resolver do container. Esse formato é
|
|
46
|
+
// específico do app (a lib não conhece o shape das configs nem `containerResolver.app`
|
|
47
|
+
// é público), então tipamos apenas ESTE acesso como `unknown`/cast estreito — não o
|
|
48
|
+
// `HttpContext` inteiro.
|
|
49
49
|
const resolver = ctx.containerResolver;
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
const get = resolver.app?.config?.get;
|
|
51
|
+
// 1) `from` específico do authkit (defineConfig({ mail: { from } })) — PRIORIDADE:
|
|
52
|
+
// permite que o auth use um remetente próprio, diferente do e-mail geral do app.
|
|
53
|
+
const authkitFrom = get?.('authkit')?.mail?.from;
|
|
54
|
+
if (authkitFrom)
|
|
55
|
+
return authkitFrom;
|
|
56
|
+
// 2) `from` global do host (config/mail.ts).
|
|
57
|
+
const hostFrom = get?.('mail')?.from;
|
|
58
|
+
if (hostFrom)
|
|
59
|
+
return hostFrom;
|
|
54
60
|
}
|
|
55
61
|
catch {
|
|
56
|
-
// sem config
|
|
62
|
+
// sem config resolvível — deixa o @adonisjs/mail decidir.
|
|
57
63
|
}
|
|
58
64
|
return undefined;
|
|
59
65
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adonis-agora/authkit-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.41.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",
|