@adonis-agora/authkit-server 0.58.2 → 0.58.3
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/index.d.ts +1 -1
- package/build/index.js +1 -1
- package/build/src/host/account_api/account_api_controller.js +1 -1
- package/build/src/host/account_session_key.d.ts +21 -0
- package/build/src/host/account_session_key.js +21 -0
- package/build/src/host/admin_console/console_impersonation_controller.js +1 -1
- package/build/src/host/admin_console/console_orgs_controller.js +1 -1
- package/build/src/host/admin_console/console_roles_controller.js +1 -1
- package/build/src/host/admin_console/console_sessions_controller.js +1 -1
- package/build/src/host/admin_console/console_users_controller.js +1 -1
- package/build/src/host/console_session.js +1 -1
- package/build/src/host/controllers/account_apps_controller.js +1 -1
- package/build/src/host/controllers/account_mfa_controller.js +1 -1
- package/build/src/host/controllers/account_orgs_controller.js +1 -1
- package/build/src/host/controllers/account_security_controller.js +1 -1
- package/build/src/host/controllers/account_session_controller.js +1 -1
- package/build/src/host/controllers/account_tokens_controller.js +1 -1
- package/build/src/host/impersonation_session.js +1 -1
- package/build/src/host/middleware/account_auth.d.ts +2 -1
- package/build/src/host/middleware/account_auth.js +2 -1
- package/build/src/host/oidc_rp_guard.js +1 -1
- package/build/src/host/register_auth_host.js +1 -1
- package/build/src/host/sudo/runtime.js +1 -1
- package/build/src/host/sudo_mode.js +1 -1
- package/package.json +1 -1
package/build/index.d.ts
CHANGED
|
@@ -128,7 +128,7 @@ export type { SettingKey, RegistrationSetting, RequireVerifiedEmailSetting, Main
|
|
|
128
128
|
export { resolveRegistration } from './src/define_config.js';
|
|
129
129
|
export type { RegistrationConfigInput, ResolvedRegistrationConfig, } from './src/define_config.js';
|
|
130
130
|
export { getAccountId, realAccountId, hasAccountSession, consoleLoginUrl, } from './src/host/console_session.js';
|
|
131
|
-
export { ACCOUNT_SESSION_KEY } from './src/host/
|
|
131
|
+
export { ACCOUNT_SESSION_KEY } from './src/host/account_session_key.js';
|
|
132
132
|
export { rememberAccessToken, rememberRefreshToken, refreshAccessToken, startImpersonation, impersonationState, stopImpersonation, } from './src/host/impersonation_session.js';
|
|
133
133
|
export type { StartImpersonationParams, ImpersonationState, } from './src/host/impersonation_session.js';
|
|
134
134
|
export { SUDO_SESSION_KEY, SUDO_ACCOUNT_SESSION_KEY, SUDO_MODE_DEFAULTS, requireSudo, isSudoActive, markSudo, resolveEffectiveSudoMode, } from './src/host/sudo_mode.js';
|
package/build/index.js
CHANGED
|
@@ -87,7 +87,7 @@ export { resolveEffectiveBotProtection } from './src/host/bot_protection.js';
|
|
|
87
87
|
export { SETTING_KEYS, resolveEffectiveRegistration, resolveEffectiveRequireVerifiedEmail, resolveEffectiveMaintenanceMode, resolveEffectiveAuthMethods, configLockedAuthMethods, } from './src/host/runtime_toggles.js';
|
|
88
88
|
export { resolveRegistration } from './src/define_config.js';
|
|
89
89
|
export { getAccountId, realAccountId, hasAccountSession, consoleLoginUrl, } from './src/host/console_session.js';
|
|
90
|
-
export { ACCOUNT_SESSION_KEY } from './src/host/
|
|
90
|
+
export { ACCOUNT_SESSION_KEY } from './src/host/account_session_key.js';
|
|
91
91
|
// Session impersonation — RP-side glue that routes through the IdP's RFC 8693
|
|
92
92
|
// token-exchange (the IdP validates the admin role + audits). See
|
|
93
93
|
// src/host/impersonation_session.ts.
|
|
@@ -31,13 +31,13 @@ import '../augmentations.js';
|
|
|
31
31
|
import { supportsAccountSecurity, supportsOrganizations, supportsPasskeys, supportsProfile, } from '../../accounts/account_store.js';
|
|
32
32
|
import { PasswordPolicyError } from '../../password/password_manager.js';
|
|
33
33
|
import { accountPath } from '../account_paths.js';
|
|
34
|
+
import { ACCOUNT_SESSION_KEY } from '../account_session_key.js';
|
|
34
35
|
import { ACTIVE_ORG_COOKIE } from '../active_org_cookie.js';
|
|
35
36
|
import { AdminSessionsService } from '../admin_sessions_service.js';
|
|
36
37
|
import { syncAdonisAuthLogout } from '../adonis_auth_sync.js';
|
|
37
38
|
import { AvatarUploadError, isAvatarUploadSupported, storeAvatar } from '../avatar_storage.js';
|
|
38
39
|
import { sendEmailChangeConfirmationEmail, sendEmailChangeNoticeEmail } from '../default_mailer.js';
|
|
39
40
|
import { translate } from '../i18n.js';
|
|
40
|
-
import { ACCOUNT_SESSION_KEY } from '../middleware/account_auth.js';
|
|
41
41
|
import { authkitOrigin } from '../origin.js';
|
|
42
42
|
import { resolveRuntimeSettings } from '../runtime_settings.js';
|
|
43
43
|
import { resolveEffectiveEmailChange, resolveEffectivePasswordHistory, } from '../runtime_toggles.js';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session key holding the signed-in account id for the account console.
|
|
3
|
+
*
|
|
4
|
+
* A module of its own, deliberately, and it must stay free of imports.
|
|
5
|
+
*
|
|
6
|
+
* The constant is re-exported from the package barrel, and it used to live in
|
|
7
|
+
* `middleware/account_auth.ts` — which side-effect-imports `../augmentations.js`
|
|
8
|
+
* to type `ctx.session` for its own body. That made every consumer of the barrel
|
|
9
|
+
* load `augmentations.d.ts`, and with it this package's
|
|
10
|
+
* `declare module '@adonisjs/core/http' { adminApiKeyId?: string }`.
|
|
11
|
+
*
|
|
12
|
+
* `adminApiKeyId` is a name only this library claims, so the blast radius was
|
|
13
|
+
* small — but that is nomenclature luck, not design. The sibling client package
|
|
14
|
+
* shipped the identical shape over `auth`, a name every app declares, and
|
|
15
|
+
* consumers went from 24 type errors to 351 with nothing pointing at the cause.
|
|
16
|
+
* A constant that hosts import should not be able to carry a `HttpContext`
|
|
17
|
+
* augmentation in with it.
|
|
18
|
+
*
|
|
19
|
+
* Keep this file import-free: anything it imports, the barrel inherits.
|
|
20
|
+
*/
|
|
21
|
+
export declare const ACCOUNT_SESSION_KEY = "account_user_id";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session key holding the signed-in account id for the account console.
|
|
3
|
+
*
|
|
4
|
+
* A module of its own, deliberately, and it must stay free of imports.
|
|
5
|
+
*
|
|
6
|
+
* The constant is re-exported from the package barrel, and it used to live in
|
|
7
|
+
* `middleware/account_auth.ts` — which side-effect-imports `../augmentations.js`
|
|
8
|
+
* to type `ctx.session` for its own body. That made every consumer of the barrel
|
|
9
|
+
* load `augmentations.d.ts`, and with it this package's
|
|
10
|
+
* `declare module '@adonisjs/core/http' { adminApiKeyId?: string }`.
|
|
11
|
+
*
|
|
12
|
+
* `adminApiKeyId` is a name only this library claims, so the blast radius was
|
|
13
|
+
* small — but that is nomenclature luck, not design. The sibling client package
|
|
14
|
+
* shipped the identical shape over `auth`, a name every app declares, and
|
|
15
|
+
* consumers went from 24 type errors to 351 with nothing pointing at the cause.
|
|
16
|
+
* A constant that hosts import should not be able to carry a `HttpContext`
|
|
17
|
+
* augmentation in with it.
|
|
18
|
+
*
|
|
19
|
+
* Keep this file import-free: anything it imports, the barrel inherits.
|
|
20
|
+
*/
|
|
21
|
+
export const ACCOUNT_SESSION_KEY = 'account_user_id';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import '../augmentations.js';
|
|
2
|
+
import { ACCOUNT_SESSION_KEY } from '../account_session_key.js';
|
|
2
3
|
import { apiError } from '../admin_api/dto.js';
|
|
3
4
|
import { AdminClientsService } from '../admin_clients_service.js';
|
|
4
5
|
import { buildImpersonationPanel } from '../impersonation.js';
|
|
5
|
-
import { ACCOUNT_SESSION_KEY } from '../middleware/account_auth.js';
|
|
6
6
|
import { resolveRuntimeSettingsOrNoop } from '../runtime_settings.js';
|
|
7
7
|
import { resolveEffectiveAdminImpersonation } from '../runtime_toggles.js';
|
|
8
8
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import '../augmentations.js';
|
|
2
|
+
import { ACCOUNT_SESSION_KEY } from '../account_session_key.js';
|
|
2
3
|
import { AdminOrgsService } from '../admin_api/admin_orgs_service.js';
|
|
3
4
|
import { apiError, orgDetailDto, orgDto } from '../admin_api/dto.js';
|
|
4
5
|
import { orgAddMemberValidator, orgCreateValidator, orgInvitationValidator, orgMemberRoleValidator, orgUpdateValidator, } from '../admin_validators.js';
|
|
5
|
-
import { ACCOUNT_SESSION_KEY } from '../middleware/account_auth.js';
|
|
6
6
|
import { authkitOrigin } from '../origin.js';
|
|
7
7
|
import { resolveRuntimeSettings } from '../runtime_settings.js';
|
|
8
8
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import '../augmentations.js';
|
|
2
|
+
import { ACCOUNT_SESSION_KEY } from '../account_session_key.js';
|
|
2
3
|
import { apiError } from '../admin_api/dto.js';
|
|
3
4
|
import { roleCreateValidator, roleUpdateValidator } from '../admin_validators.js';
|
|
4
|
-
import { ACCOUNT_SESSION_KEY } from '../middleware/account_auth.js';
|
|
5
5
|
import { resolveRuntimeSettings } from '../runtime_settings.js';
|
|
6
6
|
import { SETTING_KEYS, resolveEffectiveRolesCatalog, } from '../runtime_toggles.js';
|
|
7
7
|
/** Regex de validação: nome de role — letras maiúsculas, dígitos e underscore. */
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import '../augmentations.js';
|
|
2
|
+
import { ACCOUNT_SESSION_KEY } from '../account_session_key.js';
|
|
2
3
|
import { apiError, grantDto, sessionDto } from '../admin_api/dto.js';
|
|
3
4
|
import { AdminSessionsService } from '../admin_sessions_service.js';
|
|
4
5
|
import { sessionAccountValidator } from '../admin_validators.js';
|
|
5
|
-
import { ACCOUNT_SESSION_KEY } from '../middleware/account_auth.js';
|
|
6
6
|
import { enrichSessionsWithContext } from '../session_context.js';
|
|
7
7
|
/**
|
|
8
8
|
* Endpoints JSON de sessões/grants do console admin React.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import '../augmentations.js';
|
|
2
2
|
import { supportsAccountDeletion, supportsAccountStatus } from '../../accounts/account_store.js';
|
|
3
|
+
import { ACCOUNT_SESSION_KEY } from '../account_session_key.js';
|
|
3
4
|
import { AdminUsersService } from '../admin_api/admin_users_service.js';
|
|
4
5
|
import { apiError, grantDto, sessionDto, userDto } from '../admin_api/dto.js';
|
|
5
6
|
import { AdminSessionsService } from '../admin_sessions_service.js';
|
|
6
7
|
import { adminUserCreateValidator, adminUserRolesValidator } from '../admin_validators.js';
|
|
7
|
-
import { ACCOUNT_SESSION_KEY } from '../middleware/account_auth.js';
|
|
8
8
|
import { resolveRuntimeSettings } from '../runtime_settings.js';
|
|
9
9
|
import { resolveEffectiveRolesCatalog } from '../runtime_toggles.js';
|
|
10
10
|
import { enrichSessionsWithContext } from '../session_context.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getAccountLoginUrl } from './account_login_url.js';
|
|
2
|
+
import { ACCOUNT_SESSION_KEY } from './account_session_key.js';
|
|
2
3
|
import { impersonationState } from './impersonation_session.js';
|
|
3
|
-
import { ACCOUNT_SESSION_KEY } from './middleware/account_auth.js';
|
|
4
4
|
/**
|
|
5
5
|
* Helpers públicos para integrar a sessão do console do AuthKit com
|
|
6
6
|
* qualquer coisa fora do pacote (ex.: proteger o dashboard do
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import '../augmentations.js';
|
|
2
2
|
import { accountPath } from '../account_paths.js';
|
|
3
|
+
import { ACCOUNT_SESSION_KEY } from '../account_session_key.js';
|
|
3
4
|
import { AdminSessionsService } from '../admin_sessions_service.js';
|
|
4
|
-
import { ACCOUNT_SESSION_KEY } from '../middleware/account_auth.js';
|
|
5
5
|
/**
|
|
6
6
|
* Self-service de consentimento ("apps com acesso") no console de conta. Lista os
|
|
7
7
|
* Grants da própria conta agrupados por client (resolvendo o nome do client da
|
|
@@ -2,8 +2,8 @@ import '../augmentations.js';
|
|
|
2
2
|
import QRCode from 'qrcode';
|
|
3
3
|
import { supportsPasskeys } from '../../accounts/account_store.js';
|
|
4
4
|
import { accountPath } from '../account_paths.js';
|
|
5
|
+
import { ACCOUNT_SESSION_KEY } from '../account_session_key.js';
|
|
5
6
|
import { translate } from '../i18n.js';
|
|
6
|
-
import { ACCOUNT_SESSION_KEY } from '../middleware/account_auth.js';
|
|
7
7
|
import { resolveRuntimeSettings } from '../runtime_settings.js';
|
|
8
8
|
import { dispatchSecurityNotice } from '../security_notice_service.js';
|
|
9
9
|
import { requireSudo } from '../sudo_mode.js';
|
|
@@ -2,9 +2,9 @@ import '../augmentations.js';
|
|
|
2
2
|
import { supportsOrganizations } from '../../accounts/account_store.js';
|
|
3
3
|
import { getAccountLoginUrl } from '../account_login_url.js';
|
|
4
4
|
import { accountPath } from '../account_paths.js';
|
|
5
|
+
import { ACCOUNT_SESSION_KEY } from '../account_session_key.js';
|
|
5
6
|
import { ACTIVE_ORG_COOKIE, ACTIVE_ORG_COOKIE_TTL, encodeActiveOrgCookie, } from '../active_org_cookie.js';
|
|
6
7
|
import { sendOrgInvitationEmail } from '../default_mailer.js';
|
|
7
|
-
import { ACCOUNT_SESSION_KEY } from '../middleware/account_auth.js';
|
|
8
8
|
import { authkitOrigin } from '../origin.js';
|
|
9
9
|
import { resolveRuntimeSettings } from '../runtime_settings.js';
|
|
10
10
|
import { isRoleInCatalog } from '../runtime_toggles.js';
|
|
@@ -5,12 +5,12 @@ import { AccountDeletionService } from '../account_deletion_service.js';
|
|
|
5
5
|
import { AccountExportService } from '../account_export_service.js';
|
|
6
6
|
import { getAccountLoginUrl } from '../account_login_url.js';
|
|
7
7
|
import { accountPath } from '../account_paths.js';
|
|
8
|
+
import { ACCOUNT_SESSION_KEY } from '../account_session_key.js';
|
|
8
9
|
import { AdminSessionsService } from '../admin_sessions_service.js';
|
|
9
10
|
import { syncAdonisAuthLogout } from '../adonis_auth_sync.js';
|
|
10
11
|
import { AvatarUploadError, isAvatarUploadSupported, storeAvatar } from '../avatar_storage.js';
|
|
11
12
|
import { sendEmailChangeConfirmationEmail, sendEmailChangeNoticeEmail, sendEmailChangedCompletedEmail, } from '../default_mailer.js';
|
|
12
13
|
import { translate } from '../i18n.js';
|
|
13
|
-
import { ACCOUNT_SESSION_KEY } from '../middleware/account_auth.js';
|
|
14
14
|
import { authkitOrigin } from '../origin.js';
|
|
15
15
|
import { resolveRuntimeSettings } from '../runtime_settings.js';
|
|
16
16
|
import { resolveEffectiveEmailChange, resolveEffectivePasswordHistory, } from '../runtime_toggles.js';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import '../augmentations.js';
|
|
2
2
|
import { accountHome } from '../account_home.js';
|
|
3
3
|
import { getAccountLoginUrl } from '../account_login_url.js';
|
|
4
|
+
import { ACCOUNT_SESSION_KEY } from '../account_session_key.js';
|
|
4
5
|
import { syncAdonisAuthLogin, syncAdonisAuthLogout } from '../adonis_auth_sync.js';
|
|
5
6
|
import { translate } from '../i18n.js';
|
|
6
7
|
import { attemptPasswordLogin } from '../login_attempt.js';
|
|
7
8
|
import { notifyLoginSuccess } from '../login_notify.js';
|
|
8
|
-
import { ACCOUNT_SESSION_KEY } from '../middleware/account_auth.js';
|
|
9
9
|
import { resolveRuntimeSettings } from '../runtime_settings.js';
|
|
10
10
|
import { markSudo } from '../sudo_mode.js';
|
|
11
11
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '../augmentations.js';
|
|
2
2
|
import { accountPath } from '../account_paths.js';
|
|
3
|
-
import { ACCOUNT_SESSION_KEY } from '../
|
|
3
|
+
import { ACCOUNT_SESSION_KEY } from '../account_session_key.js';
|
|
4
4
|
import { resolveRuntimeSettings } from '../runtime_settings.js';
|
|
5
5
|
import { requireSudo } from '../sudo_mode.js';
|
|
6
6
|
export default class AccountTokensController {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ACCOUNT_SESSION_KEY } from './
|
|
1
|
+
import { ACCOUNT_SESSION_KEY } from './account_session_key.js';
|
|
2
2
|
/**
|
|
3
3
|
* Ergonômico de SESSÃO de browser no RP para "personificar" (impersonate) um
|
|
4
4
|
* usuário e navegar como ele — roteado pelo token-exchange RFC 8693 que o IdP já
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import '../augmentations.js';
|
|
2
2
|
import type { HttpContext } from '@adonisjs/core/http';
|
|
3
3
|
import type { NextFn } from '@adonisjs/core/types/http';
|
|
4
|
-
|
|
4
|
+
import { ACCOUNT_SESSION_KEY } from '../account_session_key.js';
|
|
5
|
+
export { ACCOUNT_SESSION_KEY };
|
|
5
6
|
export default class AccountAuthMiddleware {
|
|
6
7
|
handle(ctx: HttpContext, next: NextFn): Promise<any>;
|
|
7
8
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import '../augmentations.js';
|
|
2
2
|
import { getAccountLoginUrl } from '../account_login_url.js';
|
|
3
|
-
|
|
3
|
+
import { ACCOUNT_SESSION_KEY } from '../account_session_key.js';
|
|
4
|
+
export { ACCOUNT_SESSION_KEY };
|
|
4
5
|
export default class AccountAuthMiddleware {
|
|
5
6
|
async handle(ctx, next) {
|
|
6
7
|
const userId = ctx.session.get(ACCOUNT_SESSION_KEY);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RuntimeException } from '@adonisjs/core/exceptions';
|
|
2
|
-
import { ACCOUNT_SESSION_KEY } from './
|
|
2
|
+
import { ACCOUNT_SESSION_KEY } from './account_session_key.js';
|
|
3
3
|
/** Memo do construtor entre instâncias — o `import()` só paga o custo uma vez. */
|
|
4
4
|
let cachedUnauthorizedAccess;
|
|
5
5
|
/**
|
|
@@ -3,10 +3,10 @@ import { accountHome } from './account_home.js';
|
|
|
3
3
|
import { getAccountLoginUrl, setAccountLoginUrl } from './account_login_url.js';
|
|
4
4
|
import { accountPath, accountPathsMap, accountPrefix, joinAccountPath, setAccountPaths, } from './account_paths.js';
|
|
5
5
|
import { resolveAccountRoles } from './account_roles.js';
|
|
6
|
+
import { ACCOUNT_SESSION_KEY } from './account_session_key.js';
|
|
6
7
|
import { adminApiGuard } from './admin_api/admin_api_guard.js';
|
|
7
8
|
import { normalizeAdminApiPrefix, normalizeAdminPrefix, setAdminApiPrefix, setAdminPrefix, } from './admin_prefix.js';
|
|
8
9
|
import { getAuthHostConfig, markAuthHostAutoMounted, wasAuthHostAutoMounted, } from './auth_host_config.js';
|
|
9
|
-
import { ACCOUNT_SESSION_KEY } from './middleware/account_auth.js';
|
|
10
10
|
import { createAuthThrottles } from './rate_limit.js';
|
|
11
11
|
import { resolveRuntimeSettings } from './runtime_settings.js';
|
|
12
12
|
import { resolveEffectiveSessionPolicy } from './runtime_toggles.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { accountHome } from '../account_home.js';
|
|
2
2
|
import { accountPath } from '../account_paths.js';
|
|
3
|
+
import { ACCOUNT_SESSION_KEY } from '../account_session_key.js';
|
|
3
4
|
import { validateReturnTo } from '../controllers/account_session_controller.js';
|
|
4
5
|
import { translate } from '../i18n.js';
|
|
5
|
-
import { ACCOUNT_SESSION_KEY } from '../middleware/account_auth.js';
|
|
6
6
|
import { markSudo } from '../sudo_mode.js';
|
|
7
7
|
/** Último método usado com sucesso — só ordena a tela, não restringe nada. */
|
|
8
8
|
export const LAST_METHOD_SESSION_KEY = 'authkit_sudo_last_method';
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* `SUDO_ACCOUNT_SESSION_KEY`.
|
|
15
15
|
*/
|
|
16
16
|
import { accountPath } from './account_paths.js';
|
|
17
|
-
import { ACCOUNT_SESSION_KEY } from './
|
|
17
|
+
import { ACCOUNT_SESSION_KEY } from './account_session_key.js';
|
|
18
18
|
import { SETTING_KEYS } from './runtime_toggles.js';
|
|
19
19
|
export const SUDO_MODE_DEFAULTS = {
|
|
20
20
|
enabled: true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adonis-agora/authkit-server",
|
|
3
|
-
"version": "0.58.
|
|
3
|
+
"version": "0.58.3",
|
|
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",
|