@open-mercato/enterprise 0.6.7-develop.6862.1.c11a64ce0a → 0.6.7
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/.turbo/turbo-build.log +1 -1
- package/TERMS.md +6 -19
- package/dist/modules/security/api/i18n.js +0 -1
- package/dist/modules/security/api/i18n.js.map +2 -2
- package/dist/modules/security/api/mfa/_shared.js +0 -25
- package/dist/modules/security/api/mfa/_shared.js.map +2 -2
- package/dist/modules/security/api/mfa/methods/[id]/route.js +1 -1
- package/dist/modules/security/api/mfa/methods/[id]/route.js.map +2 -2
- package/dist/modules/security/api/mfa/provider/[providername]/route.js +3 -15
- package/dist/modules/security/api/mfa/provider/[providername]/route.js.map +2 -2
- package/dist/modules/security/api/mfa/recovery-codes/regenerate/route.js +1 -1
- package/dist/modules/security/api/mfa/recovery-codes/regenerate/route.js.map +2 -2
- package/dist/modules/security/backend/profile/security/page.js +2 -3
- package/dist/modules/security/backend/profile/security/page.js.map +2 -2
- package/dist/modules/security/backend/security/enforcement/page.js +1 -2
- package/dist/modules/security/backend/security/enforcement/page.js.map +2 -2
- package/dist/modules/security/backend/security/sudo/page.js +1 -2
- package/dist/modules/security/backend/security/sudo/page.js.map +2 -2
- package/dist/modules/security/backend/security/users/page.js +1 -2
- package/dist/modules/security/backend/security/users/page.js.map +2 -2
- package/dist/modules/security/lib/enforcement-redirect.js +14 -36
- package/dist/modules/security/lib/enforcement-redirect.js.map +2 -2
- package/dist/modules/security/setup.js +1 -1
- package/dist/modules/security/setup.js.map +2 -2
- package/dist/modules/sso/services/accountLinkingService.js +2 -2
- package/dist/modules/sso/services/accountLinkingService.js.map +2 -2
- package/package.json +9 -10
- package/src/modules/security/api/i18n.ts +0 -1
- package/src/modules/security/api/mfa/_shared.ts +0 -48
- package/src/modules/security/api/mfa/methods/[id]/route.ts +1 -1
- package/src/modules/security/api/mfa/provider/[providername]/route.ts +1 -13
- package/src/modules/security/api/mfa/recovery-codes/regenerate/route.ts +1 -1
- package/src/modules/security/backend/profile/security/page.tsx +2 -3
- package/src/modules/security/backend/security/enforcement/page.tsx +1 -2
- package/src/modules/security/backend/security/sudo/page.tsx +1 -2
- package/src/modules/security/backend/security/users/page.tsx +1 -2
- package/src/modules/security/lib/enforcement-redirect.ts +15 -50
- package/src/modules/security/setup.ts +1 -1
- package/src/modules/sso/services/accountLinkingService.ts +2 -2
- package/dist/modules/record_locks/i18n/ko.json +0 -78
- package/dist/modules/security/extension-points.js +0 -17
- package/dist/modules/security/extension-points.js.map +0 -7
- package/dist/modules/security/i18n/ko.json +0 -487
- package/dist/modules/sso/i18n/ko.json +0 -148
- package/dist/modules/system_status_overlays/i18n/ko.json +0 -8
- package/src/modules/record_locks/i18n/ko.json +0 -78
- package/src/modules/security/extension-points.ts +0 -14
- package/src/modules/security/i18n/ko.json +0 -487
- package/src/modules/sso/i18n/ko.json +0 -148
- package/src/modules/system_status_overlays/i18n/ko.json +0 -8
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
[build:enterprise] found
|
|
1
|
+
[build:enterprise] found 326 entry points
|
|
2
2
|
[build:enterprise] built successfully
|
package/TERMS.md
CHANGED
|
@@ -70,15 +70,13 @@ LICENSOR: OPEN MERCATO SP. Z O.O. · VERSION 2.2 · EFFECTIVE: JULY 2026
|
|
|
70
70
|
|
|
71
71
|
5.1. Term; paid access. The Contract begins on the Effective Date stated in the Order Form and remains in force for the billing period stated in the Order Form (the "Billing Period"). The Billing Period constitutes the contractual commitment period for the Contract. Unless either party gives timely notice of non-renewal under Section 5.2, including following Licensee's objection to updated Terms under Section 9.6, or the Contract is terminated earlier in accordance with Section 5.4, the Contract automatically renews for successive Billing Periods of the same length. Licensee's rights to access and use the Software and to receive the services under the Contract apply only during the then-current Billing Period and are subject to payment of the applicable fees in accordance with Section 4.
|
|
72
72
|
|
|
73
|
-
5.2. Non-renewal for convenience. Either party may elect not to renew the Contract for convenience by giving written notice to the other party. Non-renewal is effective only at the end of
|
|
73
|
+
5.2. Non-renewal for convenience. Either party may elect not to renew the Contract for convenience by giving written notice to the other party. Non-renewal is effective only at the end of the then-current Billing Period. If the Billing Period is annual, notice of non-renewal must be given at least thirty (30) days before the end of the then-current Billing Period. If the Billing Period is monthly, notice of non-renewal must be given at least seven (7) days before the end of the then-current Billing Period. For clarity, neither party may terminate the Contract for convenience before the end of the then-current Billing Period.
|
|
74
74
|
|
|
75
75
|
5.3. Suspension and termination for non-payment. If any undisputed fee is not paid when due, Licensor may suspend Licensee's access to the Software, services, and enterprise-only resources until all overdue amounts are paid. Non-payment of undisputed fees constitutes a material breach capable of termination under Section 5.4, and any notice given under this Section 5.3 may also constitute notice of material breach under Section 5.4 if it identifies the non-payment as a material breach. Termination on grounds of non-payment does not relieve Licensee from its obligation to pay all fees due for the then-current Billing Period.
|
|
76
76
|
|
|
77
77
|
5.4. Termination for cause. Either party may terminate the Contract with immediate effect if the other party materially breaches the Contract and fails to cure that breach within ten (10) days after receiving written notice specifying the breach. Either party may also terminate the Contract with immediate effect, to the extent permitted by applicable law, if the other party becomes insolvent, is unable to pay its debts as they fall due, makes an assignment for the benefit of creditors, enters into liquidation, bankruptcy, administration, receivership, restructuring, or similar proceedings, has a receiver, administrator, trustee, or similar officer appointed over all or a material part of its assets, or ceases or threatens to cease carrying on business.
|
|
78
78
|
|
|
79
|
-
5.5. Effect of termination.
|
|
80
|
-
|
|
81
|
-
5.6. Continued use of the deployed Software after the Contract ends (no vendor lock-in). Notwithstanding Section 5.5(a), Licensor grants Licensee a perpetual, non-exclusive, non-transferable, non-sublicensable license to continue to install, run, and use the Retained Version for Licensee's internal business purposes and within the licensed project scope stated in Section 2.2, where the Contract ends by expiry, by non-renewal under Section 5.2, or by termination for non-payment under Sections 5.3 and 5.4, provided that all fees accrued up to the effective end date have been paid. "Retained Version" means the version of the Software last made available to Licensee by Licensor under the Contract before that date. The Retained Version is provided "as is" and carries no updates, security patches, new features, upgrade packages, enterprise-only resources, or services under Section 3, and Licensor has no obligation to provide any of them. Sections 2.4 (Restrictions), 2.6 (Ownership), 6 (Disclaimer; limitation of liability), and 8.1 (Confidentiality) continue to apply to the Retained Version. This Section 5.6 does not apply where Licensor terminates the Contract under Section 5.4 for an uncured material breach by Licensee other than non-payment, and it does not restore access to the resources described in Section 5.5(b).
|
|
79
|
+
5.5. Effect of termination. Upon termination, (a) Licensee's rights to access and use the Software as provided under the Contract end as of the effective termination date, (b) Licensor may disable or terminate Licensee's access to enterprise-only channels, materials, repositories, binaries, upgrade packages, updates, and similar resources provided under the Contract, and (c) Licensor's obligation to provide the services in Section 3 ends as of the effective termination date. For clarity, termination of the Contract does not terminate any open-source license terms that may apply to Open-Source Components obtained independently of Licensor's enterprise distribution.
|
|
82
80
|
|
|
83
81
|
### Disclaimer; limitation of liability
|
|
84
82
|
|
|
@@ -156,7 +154,6 @@ Licensing model
|
|
|
156
154
|
Per project, not per seat. The license is charged per Open Mercato project / per monorepo - never per developer or per end user.
|
|
157
155
|
|
|
158
156
|
* Unlimited Seats - no limits on the number of users or servers within a given system, so your licensing never blocks customer or team growth.
|
|
159
|
-
* No vendor lock-in - if the subscription ends, you keep running the version of the enterprise modules you already have, for as long as you want. What stops are updates, security patches, new features and support. The full rule is in the Terms, cl. 5.6.
|
|
160
157
|
* Revenue-based tiering - the applicable tier is determined by the Licensee's annual revenue.
|
|
161
158
|
* Usage verification ("Phone Home") - for on-premise deployments, the system reports aggregate user/usage counts to Open Mercato. This enables transparent billing verification without Open Mercato needing standing access to your code repository.
|
|
162
159
|
|
|
@@ -164,15 +161,6 @@ Project definition: single business domain / department / business purpose or go
|
|
|
164
161
|
|
|
165
162
|
### 03 - TIERS
|
|
166
163
|
|
|
167
|
-
Starter Pack - where every engagement begins
|
|
168
|
-
|
|
169
|
-
Every engagement starts with the purchase of a Starter Pack license and a sandbox. The license purchase opens the option of any further collaboration - discovery workshops, Proof of Concept and implementation work with Open Mercato and its Implementation Partners. The Starter Pack includes:
|
|
170
|
-
|
|
171
|
-
* Sandbox - an Open Mercato project sandbox for your team and coding agents.
|
|
172
|
-
* 1-hour onboarding session - an introduction to the sandbox, AI-engineering and Open Mercato, run by our Customer Success Manager.
|
|
173
|
-
|
|
174
|
-
The Starter Pack fee is set out in the Order Form / at checkout and applies until the Proof of Concept starts. From POC launch, the subscription is billed according to the tiers below.
|
|
175
|
-
|
|
176
164
|
Subscription tiers
|
|
177
165
|
|
|
178
166
|
Three tiers scale the level of service with company size. All tiers include the Enterprise Software Package and unlimited seats. Prices are net; annual billing is available at a 10% discount.
|
|
@@ -193,7 +181,7 @@ Services by tier
|
|
|
193
181
|
|
|
194
182
|
| SERVICE / CAPABILITY | BASIC | MEDIUM | ENTERPRISE |
|
|
195
183
|
|---|---|---|---|
|
|
196
|
-
| Enterprise software modules (MFA, SSO & Directory Sync, Record Locking, Agents Orchestrator). If
|
|
184
|
+
| Enterprise software modules (MFA, SSO & Directory Sync, Record Locking, Agents Orchestrator). If your license expires, you can continue using these modules in their last deployed version, but they will no longer receive updates, security patches, new features, or ongoing support. | Included | Included | Included |
|
|
197
185
|
| Unlimited users & servers (per instance / project / monorepo) | Included | Included | Included |
|
|
198
186
|
| Time-limited offer: Open Mercato project sandboxes with dev/staging and production environment, CI/CD and AI SDLC pipeline (backup & 7-day restore) — early access (beta) | 1 active project | 3 active projects | 10 active projects |
|
|
199
187
|
| Priority support (AI-assisted helpdesk via Discord / ticketing / automatic issue triage by selected Github accounts) | up to 5 Accounts, 1 issue in the pipeline | up to 10 Accounts, includes Discord, 3 issues in the pipeline | Unlimited Accounts, includes Discord, 10 issues in the pipeline |
|
|
@@ -249,10 +237,9 @@ How the engagement works
|
|
|
249
237
|
|
|
250
238
|
Open Mercato with their Implementation Partners works directly with end customers and runs these processes end-to-end. The path is designed to de-risk adoption and transfer AI-engineering capability to customer's team:
|
|
251
239
|
|
|
252
|
-
1.
|
|
253
|
-
2. Paid
|
|
254
|
-
3.
|
|
255
|
-
4. Enterprise Subscription - license the platform so your team can extend the system independently, on a safe, certified foundation.
|
|
240
|
+
1. Paid discovery workshop - align on the use case, architecture and the way of working.
|
|
241
|
+
2. Paid Proof of Concept - a working, scoped POC that proves value and teaches the customer's team the Open Mercato Way.
|
|
242
|
+
3. Enterprise Subscription - license the platform so your team can extend the system independently, on a safe, certified foundation.
|
|
256
243
|
|
|
257
244
|
Implementation Partners. Certified software consultancies handle efficient delivery. The cheaper Basic tier makes the license easy for partners to attach to their projects. Partners do not build or modify the commercial core.
|
|
258
245
|
|
|
@@ -3,7 +3,6 @@ import { resolveTranslations } from "@open-mercato/shared/lib/i18n/server";
|
|
|
3
3
|
const exactMessageMap = /* @__PURE__ */ new Map([
|
|
4
4
|
["Not implemented", { key: "security.api.errors.notImplemented", fallback: "Not implemented." }],
|
|
5
5
|
["Unauthorized", { key: "api.errors.unauthorized", fallback: "Unauthorized" }],
|
|
6
|
-
["Forbidden", { key: "api.errors.forbidden", fallback: "Forbidden" }],
|
|
7
6
|
["Invalid payload", { key: "api.errors.invalidPayload", fallback: "Invalid payload." }],
|
|
8
7
|
["Invalid query parameters", { key: "security.api.errors.invalidQueryParameters", fallback: "Invalid query parameters." }],
|
|
9
8
|
["Invalid route parameters", { key: "security.api.errors.invalidRouteParameters", fallback: "Invalid route parameters." }],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/modules/security/api/i18n.ts"],
|
|
4
|
-
"sourcesContent": ["import { NextResponse } from 'next/server'\nimport { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'\n\ntype TranslateParams = Record<string, string | number>\n\ntype MessageDescriptor = {\n key: string\n fallback: string\n params?: TranslateParams\n}\n\nconst exactMessageMap = new Map<string, MessageDescriptor>([\n ['Not implemented', { key: 'security.api.errors.notImplemented', fallback: 'Not implemented.' }],\n ['Unauthorized', { key: 'api.errors.unauthorized', fallback: 'Unauthorized' }],\n ['Forbidden', { key: 'api.errors.forbidden', fallback: 'Forbidden' }],\n ['Invalid payload', { key: 'api.errors.invalidPayload', fallback: 'Invalid payload.' }],\n ['Invalid query parameters', { key: 'security.api.errors.invalidQueryParameters', fallback: 'Invalid query parameters.' }],\n ['Invalid route parameters', { key: 'security.api.errors.invalidRouteParameters', fallback: 'Invalid route parameters.' }],\n ['Invalid policy id.', { key: 'security.api.errors.invalidPolicyId', fallback: 'Invalid policy id.' }],\n ['Invalid user id.', { key: 'security.api.errors.invalidUserId', fallback: 'Invalid user id.' }],\n ['Invalid provider type.', { key: 'security.api.errors.invalidProviderType', fallback: 'Invalid provider type.' }],\n ['Invalid method id.', { key: 'security.api.errors.invalidMethodId', fallback: 'Invalid method id.' }],\n ['Sudo config not found', { key: 'security.api.errors.sudoConfigurationNotFound', fallback: 'Sudo configuration not found.' }],\n ['Sudo configuration not found', { key: 'security.api.errors.sudoConfigurationNotFound', fallback: 'Sudo configuration not found.' }],\n ['Tenant context is required.', { key: 'security.api.errors.tenantContextRequired', fallback: 'Tenant context is required.' }],\n ['Cross-tenant access denied.', { key: 'security.api.errors.crossTenantAccessDenied', fallback: 'Cross-tenant access denied.' }],\n ['Tenant not found', { key: 'security.api.errors.tenantNotFound', fallback: 'Tenant not found.' }],\n ['MFA pending token is required.', { key: 'security.api.errors.mfaPendingTokenRequired', fallback: 'MFA pending token is required.' }],\n ['challengeId and methodType are required.', { key: 'security.api.errors.challengeIdAndMethodTypeRequired', fallback: 'challengeId and methodType are required.' }],\n ['setupId is required.', { key: 'security.api.errors.setupIdRequired', fallback: 'setupId is required.' }],\n ['code is required.', { key: 'security.api.errors.codeRequired', fallback: 'code is required.' }],\n ['Invalid MFA verification code.', { key: 'security.api.errors.invalidMfaVerificationCode', fallback: 'Invalid MFA verification code.' }],\n ['Invalid recovery code.', { key: 'security.api.errors.invalidRecoveryCode', fallback: 'Invalid recovery code.' }],\n ['Failed to process MFA request.', { key: 'security.api.errors.mfaRequestFailed', fallback: 'Failed to process MFA request.' }],\n ['Failed to process enforcement request.', { key: 'security.api.errors.enforcementRequestFailed', fallback: 'Failed to process enforcement request.' }],\n ['Failed to process user security request.', { key: 'security.api.errors.userSecurityRequestFailed', fallback: 'Failed to process user security request.' }],\n ['Failed to process sudo request.', { key: 'security.api.errors.sudoRequestFailed', fallback: 'Failed to process sudo request.' }],\n ['User not found', { key: 'auth.users.form.errors.notFound', fallback: 'User not found' }],\n ['Admin ID is required', { key: 'security.api.errors.adminIdRequired', fallback: 'Admin ID is required.' }],\n ['User ID is required', { key: 'security.api.errors.userIdRequired', fallback: 'User ID is required.' }],\n ['Reset reason is required', { key: 'security.api.errors.resetReasonRequired', fallback: 'Reset reason is required.' }],\n ['Tenant ID is required', { key: 'security.api.errors.tenantIdRequired', fallback: 'Tenant ID is required.' }],\n ['MFA setup session not found', { key: 'security.api.errors.mfaSetupSessionNotFound', fallback: 'MFA setup session not found.' }],\n ['MFA setup session does not match the requested provider', { key: 'security.api.errors.mfaSetupSessionProviderMismatch', fallback: 'MFA setup session does not match the requested provider.' }],\n ['MFA method not found', { key: 'security.api.errors.mfaMethodNotFound', fallback: 'MFA method not found.' }],\n ['No MFA methods configured', { key: 'security.api.errors.noMfaMethodsConfigured', fallback: 'No MFA methods configured.' }],\n ['No registered MFA providers are available for the configured methods', { key: 'security.api.errors.noRegisteredMfaProviders', fallback: 'No registered MFA providers are available for the configured methods.' }],\n ['MFA challenge not found', { key: 'security.api.errors.mfaChallengeNotFound', fallback: 'MFA challenge not found.' }],\n ['MFA challenge already verified', { key: 'security.api.errors.mfaChallengeAlreadyVerified', fallback: 'MFA challenge was already verified.' }],\n ['MFA challenge expired', { key: 'security.api.errors.mfaChallengeExpired', fallback: 'MFA challenge expired.' }],\n ['Enforcement policy not found', { key: 'security.api.errors.enforcementPolicyNotFound', fallback: 'Enforcement policy not found.' }],\n ['Insufficient scope for enforcement policy', { key: 'security.api.errors.enforcementInsufficientScope', fallback: 'Insufficient scope for enforcement policy.' }],\n ['Enforcement policy already exists for this scope', { key: 'security.api.errors.enforcementPolicyAlreadyExistsForScope', fallback: 'An enforcement policy already exists for this scope.' }],\n ['scopeId is required for tenant and organisation scopes', { key: 'security.api.errors.enforcementScopeIdRequired', fallback: 'scopeId is required for tenant and organisation scopes.' }],\n [\"organisation scopeId must use '<tenantId>:<organizationId>' format\", { key: 'security.api.errors.enforcementOrganizationScopeFormat', fallback: \"Organisation scopeId must use '<tenantId>:<organizationId>' format.\" }],\n ['tenantId is required for tenant scope', { key: 'security.api.errors.enforcementTenantIdRequired', fallback: 'tenantId is required for tenant scope.' }],\n ['tenantId and organizationId are required for organisation scope', { key: 'security.api.errors.enforcementOrganizationScopeIdsRequired', fallback: 'tenantId and organizationId are required for organisation scope.' }],\n ['This sudo session does not require MFA', { key: 'security.api.errors.sudoSessionDoesNotRequireMfa', fallback: 'This sudo session does not require MFA.' }],\n ['Sudo protection is not configured for this target', { key: 'security.api.errors.sudoProtectionNotConfigured', fallback: 'Sudo protection is not configured for this target.' }],\n ['Unable to verify sudo challenge', { key: 'security.api.errors.sudoVerifyFailed', fallback: 'Unable to verify the sudo challenge.' }],\n ['A sudo configuration for this target and scope already exists', { key: 'security.api.errors.sudoConfigurationAlreadyExists', fallback: 'A sudo configuration for this target and scope already exists.' }],\n ['Organization-scoped sudo config requires a tenant', { key: 'security.api.errors.sudoOrganizationScopeRequiresTenant', fallback: 'An organization-scoped sudo configuration requires a tenant.' }],\n ['This sudo target requires MFA, but no MFA methods are configured', { key: 'security.api.errors.sudoMfaRequiredButUnavailable', fallback: 'This sudo target requires MFA, but no MFA methods are configured.' }],\n ['Sudo challenge session not found', { key: 'security.api.errors.sudoSessionNotFound', fallback: 'Sudo challenge session not found.' }],\n ['Sudo challenge session expired', { key: 'security.api.errors.sudoSessionExpired', fallback: 'Sudo challenge session expired.' }],\n ['Password is required', { key: 'security.api.errors.passwordRequired', fallback: 'Password is required.' }],\n ['TOTP setup session not found', { key: 'security.api.errors.totpSetupSessionNotFound', fallback: 'TOTP setup session not found.' }],\n ['TOTP setup session expired', { key: 'security.api.errors.totpSetupSessionExpired', fallback: 'TOTP setup session expired.' }],\n ['Invalid TOTP code', { key: 'security.api.errors.invalidTotpCode', fallback: 'Invalid TOTP code.' }],\n ['Invalid empty TOTP secret', { key: 'security.api.errors.invalidTotpSecret', fallback: 'Invalid TOTP secret.' }],\n ['Unable to configure Email OTP without a destination email', { key: 'security.api.errors.emailOtpDestinationRequired', fallback: 'Unable to configure email OTP without a destination email address.' }],\n ['Email OTP setup session not found', { key: 'security.api.errors.emailOtpSetupSessionNotFound', fallback: 'Email OTP setup session not found.' }],\n ['Email OTP setup session expired', { key: 'security.api.errors.emailOtpSetupSessionExpired', fallback: 'Email OTP setup session expired.' }],\n ['MFA method does not belong to user', { key: 'security.api.errors.mfaMethodOwnership', fallback: 'The MFA method does not belong to this user.' }],\n ['Email OTP method is missing a destination email address', { key: 'security.api.errors.emailOtpDestinationMissing', fallback: 'The email OTP method is missing a destination email address.' }],\n ['Passkey setup session not found', { key: 'security.api.errors.passkeySetupSessionNotFound', fallback: 'Passkey setup session not found.' }],\n ['Passkey setup session expired', { key: 'security.api.errors.passkeySetupSessionExpired', fallback: 'Passkey setup session expired.' }],\n ['Passkey registration verification failed', { key: 'security.api.errors.passkeyRegistrationVerificationFailed', fallback: 'Passkey registration verification failed.' }],\n ['Passkey registration did not return credential data', { key: 'security.api.errors.passkeyRegistrationCredentialMissing', fallback: 'Passkey registration did not return credential data.' }],\n ['Invalid passkey setup challenge', { key: 'security.api.errors.invalidPasskeySetupChallenge', fallback: 'Invalid passkey setup challenge.' }],\n ['Passkey credential is not configured', { key: 'security.api.errors.passkeyCredentialNotConfigured', fallback: 'The passkey credential is not configured.' }],\n])\n\nconst patternMessageMap: Array<{\n pattern: RegExp\n resolve: (match: RegExpMatchArray) => MessageDescriptor\n}> = [\n {\n pattern: /^Sudo authentication required for: (.+)$/,\n resolve: (match) => ({\n key: 'security.api.errors.sudoRequiredForTarget',\n fallback: 'Sudo authentication is required for: {target}',\n params: { target: match[1] ?? '' },\n }),\n },\n {\n pattern: /^MFA provider '(.+)' is not registered$/,\n resolve: (match) => ({\n key: 'security.api.errors.mfaProviderNotRegistered',\n fallback: 'MFA provider \"{provider}\" is not registered.',\n params: { provider: match[1] ?? '' },\n }),\n },\n {\n pattern: /^MFA provider '(.+)' is already configured$/,\n resolve: (match) => ({\n key: 'security.api.errors.mfaProviderAlreadyConfigured',\n fallback: 'MFA provider \"{provider}\" is already configured.',\n params: { provider: match[1] ?? '' },\n }),\n },\n {\n pattern: /^MFA method '(.+)' not found$/,\n resolve: (match) => ({\n key: 'security.api.errors.mfaMethodByTypeNotFound',\n fallback: 'MFA method \"{method}\" was not found.',\n params: { method: match[1] ?? '' },\n }),\n },\n]\n\nfunction resolveMessageDescriptor(message: string): MessageDescriptor | null {\n const exact = exactMessageMap.get(message)\n if (exact) return exact\n\n for (const entry of patternMessageMap) {\n const match = message.match(entry.pattern)\n if (match) return entry.resolve(match)\n }\n\n return null\n}\n\nexport async function translateSecurityApiMessage(message: string): Promise<string> {\n const descriptor = resolveMessageDescriptor(message)\n if (!descriptor) return message\n\n const { translate } = await resolveTranslations()\n return translate(descriptor.key, descriptor.fallback, descriptor.params)\n}\n\nexport async function localizeSecurityApiBody<T extends Record<string, unknown>>(body: T): Promise<T> {\n const nextBody: Record<string, unknown> = { ...body }\n\n if (typeof nextBody.error === 'string') {\n nextBody.error = await translateSecurityApiMessage(nextBody.error)\n }\n\n if (typeof nextBody.message === 'string') {\n nextBody.message = await translateSecurityApiMessage(nextBody.message)\n }\n\n return nextBody as T\n}\n\nexport async function securityApiError(\n status: number,\n message: string,\n extra?: Record<string, unknown>,\n): Promise<NextResponse> {\n const body = await localizeSecurityApiBody({\n error: message,\n ...(extra ?? {}),\n })\n return NextResponse.json(body, { status })\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,oBAAoB;AAC7B,SAAS,2BAA2B;AAUpC,MAAM,kBAAkB,oBAAI,IAA+B;AAAA,EACzD,CAAC,mBAAmB,EAAE,KAAK,sCAAsC,UAAU,mBAAmB,CAAC;AAAA,EAC/F,CAAC,gBAAgB,EAAE,KAAK,2BAA2B,UAAU,eAAe,CAAC;AAAA,EAC7E,CAAC,
|
|
4
|
+
"sourcesContent": ["import { NextResponse } from 'next/server'\nimport { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'\n\ntype TranslateParams = Record<string, string | number>\n\ntype MessageDescriptor = {\n key: string\n fallback: string\n params?: TranslateParams\n}\n\nconst exactMessageMap = new Map<string, MessageDescriptor>([\n ['Not implemented', { key: 'security.api.errors.notImplemented', fallback: 'Not implemented.' }],\n ['Unauthorized', { key: 'api.errors.unauthorized', fallback: 'Unauthorized' }],\n ['Invalid payload', { key: 'api.errors.invalidPayload', fallback: 'Invalid payload.' }],\n ['Invalid query parameters', { key: 'security.api.errors.invalidQueryParameters', fallback: 'Invalid query parameters.' }],\n ['Invalid route parameters', { key: 'security.api.errors.invalidRouteParameters', fallback: 'Invalid route parameters.' }],\n ['Invalid policy id.', { key: 'security.api.errors.invalidPolicyId', fallback: 'Invalid policy id.' }],\n ['Invalid user id.', { key: 'security.api.errors.invalidUserId', fallback: 'Invalid user id.' }],\n ['Invalid provider type.', { key: 'security.api.errors.invalidProviderType', fallback: 'Invalid provider type.' }],\n ['Invalid method id.', { key: 'security.api.errors.invalidMethodId', fallback: 'Invalid method id.' }],\n ['Sudo config not found', { key: 'security.api.errors.sudoConfigurationNotFound', fallback: 'Sudo configuration not found.' }],\n ['Sudo configuration not found', { key: 'security.api.errors.sudoConfigurationNotFound', fallback: 'Sudo configuration not found.' }],\n ['Tenant context is required.', { key: 'security.api.errors.tenantContextRequired', fallback: 'Tenant context is required.' }],\n ['Cross-tenant access denied.', { key: 'security.api.errors.crossTenantAccessDenied', fallback: 'Cross-tenant access denied.' }],\n ['Tenant not found', { key: 'security.api.errors.tenantNotFound', fallback: 'Tenant not found.' }],\n ['MFA pending token is required.', { key: 'security.api.errors.mfaPendingTokenRequired', fallback: 'MFA pending token is required.' }],\n ['challengeId and methodType are required.', { key: 'security.api.errors.challengeIdAndMethodTypeRequired', fallback: 'challengeId and methodType are required.' }],\n ['setupId is required.', { key: 'security.api.errors.setupIdRequired', fallback: 'setupId is required.' }],\n ['code is required.', { key: 'security.api.errors.codeRequired', fallback: 'code is required.' }],\n ['Invalid MFA verification code.', { key: 'security.api.errors.invalidMfaVerificationCode', fallback: 'Invalid MFA verification code.' }],\n ['Invalid recovery code.', { key: 'security.api.errors.invalidRecoveryCode', fallback: 'Invalid recovery code.' }],\n ['Failed to process MFA request.', { key: 'security.api.errors.mfaRequestFailed', fallback: 'Failed to process MFA request.' }],\n ['Failed to process enforcement request.', { key: 'security.api.errors.enforcementRequestFailed', fallback: 'Failed to process enforcement request.' }],\n ['Failed to process user security request.', { key: 'security.api.errors.userSecurityRequestFailed', fallback: 'Failed to process user security request.' }],\n ['Failed to process sudo request.', { key: 'security.api.errors.sudoRequestFailed', fallback: 'Failed to process sudo request.' }],\n ['User not found', { key: 'auth.users.form.errors.notFound', fallback: 'User not found' }],\n ['Admin ID is required', { key: 'security.api.errors.adminIdRequired', fallback: 'Admin ID is required.' }],\n ['User ID is required', { key: 'security.api.errors.userIdRequired', fallback: 'User ID is required.' }],\n ['Reset reason is required', { key: 'security.api.errors.resetReasonRequired', fallback: 'Reset reason is required.' }],\n ['Tenant ID is required', { key: 'security.api.errors.tenantIdRequired', fallback: 'Tenant ID is required.' }],\n ['MFA setup session not found', { key: 'security.api.errors.mfaSetupSessionNotFound', fallback: 'MFA setup session not found.' }],\n ['MFA setup session does not match the requested provider', { key: 'security.api.errors.mfaSetupSessionProviderMismatch', fallback: 'MFA setup session does not match the requested provider.' }],\n ['MFA method not found', { key: 'security.api.errors.mfaMethodNotFound', fallback: 'MFA method not found.' }],\n ['No MFA methods configured', { key: 'security.api.errors.noMfaMethodsConfigured', fallback: 'No MFA methods configured.' }],\n ['No registered MFA providers are available for the configured methods', { key: 'security.api.errors.noRegisteredMfaProviders', fallback: 'No registered MFA providers are available for the configured methods.' }],\n ['MFA challenge not found', { key: 'security.api.errors.mfaChallengeNotFound', fallback: 'MFA challenge not found.' }],\n ['MFA challenge already verified', { key: 'security.api.errors.mfaChallengeAlreadyVerified', fallback: 'MFA challenge was already verified.' }],\n ['MFA challenge expired', { key: 'security.api.errors.mfaChallengeExpired', fallback: 'MFA challenge expired.' }],\n ['Enforcement policy not found', { key: 'security.api.errors.enforcementPolicyNotFound', fallback: 'Enforcement policy not found.' }],\n ['Insufficient scope for enforcement policy', { key: 'security.api.errors.enforcementInsufficientScope', fallback: 'Insufficient scope for enforcement policy.' }],\n ['Enforcement policy already exists for this scope', { key: 'security.api.errors.enforcementPolicyAlreadyExistsForScope', fallback: 'An enforcement policy already exists for this scope.' }],\n ['scopeId is required for tenant and organisation scopes', { key: 'security.api.errors.enforcementScopeIdRequired', fallback: 'scopeId is required for tenant and organisation scopes.' }],\n [\"organisation scopeId must use '<tenantId>:<organizationId>' format\", { key: 'security.api.errors.enforcementOrganizationScopeFormat', fallback: \"Organisation scopeId must use '<tenantId>:<organizationId>' format.\" }],\n ['tenantId is required for tenant scope', { key: 'security.api.errors.enforcementTenantIdRequired', fallback: 'tenantId is required for tenant scope.' }],\n ['tenantId and organizationId are required for organisation scope', { key: 'security.api.errors.enforcementOrganizationScopeIdsRequired', fallback: 'tenantId and organizationId are required for organisation scope.' }],\n ['This sudo session does not require MFA', { key: 'security.api.errors.sudoSessionDoesNotRequireMfa', fallback: 'This sudo session does not require MFA.' }],\n ['Sudo protection is not configured for this target', { key: 'security.api.errors.sudoProtectionNotConfigured', fallback: 'Sudo protection is not configured for this target.' }],\n ['Unable to verify sudo challenge', { key: 'security.api.errors.sudoVerifyFailed', fallback: 'Unable to verify the sudo challenge.' }],\n ['A sudo configuration for this target and scope already exists', { key: 'security.api.errors.sudoConfigurationAlreadyExists', fallback: 'A sudo configuration for this target and scope already exists.' }],\n ['Organization-scoped sudo config requires a tenant', { key: 'security.api.errors.sudoOrganizationScopeRequiresTenant', fallback: 'An organization-scoped sudo configuration requires a tenant.' }],\n ['This sudo target requires MFA, but no MFA methods are configured', { key: 'security.api.errors.sudoMfaRequiredButUnavailable', fallback: 'This sudo target requires MFA, but no MFA methods are configured.' }],\n ['Sudo challenge session not found', { key: 'security.api.errors.sudoSessionNotFound', fallback: 'Sudo challenge session not found.' }],\n ['Sudo challenge session expired', { key: 'security.api.errors.sudoSessionExpired', fallback: 'Sudo challenge session expired.' }],\n ['Password is required', { key: 'security.api.errors.passwordRequired', fallback: 'Password is required.' }],\n ['TOTP setup session not found', { key: 'security.api.errors.totpSetupSessionNotFound', fallback: 'TOTP setup session not found.' }],\n ['TOTP setup session expired', { key: 'security.api.errors.totpSetupSessionExpired', fallback: 'TOTP setup session expired.' }],\n ['Invalid TOTP code', { key: 'security.api.errors.invalidTotpCode', fallback: 'Invalid TOTP code.' }],\n ['Invalid empty TOTP secret', { key: 'security.api.errors.invalidTotpSecret', fallback: 'Invalid TOTP secret.' }],\n ['Unable to configure Email OTP without a destination email', { key: 'security.api.errors.emailOtpDestinationRequired', fallback: 'Unable to configure email OTP without a destination email address.' }],\n ['Email OTP setup session not found', { key: 'security.api.errors.emailOtpSetupSessionNotFound', fallback: 'Email OTP setup session not found.' }],\n ['Email OTP setup session expired', { key: 'security.api.errors.emailOtpSetupSessionExpired', fallback: 'Email OTP setup session expired.' }],\n ['MFA method does not belong to user', { key: 'security.api.errors.mfaMethodOwnership', fallback: 'The MFA method does not belong to this user.' }],\n ['Email OTP method is missing a destination email address', { key: 'security.api.errors.emailOtpDestinationMissing', fallback: 'The email OTP method is missing a destination email address.' }],\n ['Passkey setup session not found', { key: 'security.api.errors.passkeySetupSessionNotFound', fallback: 'Passkey setup session not found.' }],\n ['Passkey setup session expired', { key: 'security.api.errors.passkeySetupSessionExpired', fallback: 'Passkey setup session expired.' }],\n ['Passkey registration verification failed', { key: 'security.api.errors.passkeyRegistrationVerificationFailed', fallback: 'Passkey registration verification failed.' }],\n ['Passkey registration did not return credential data', { key: 'security.api.errors.passkeyRegistrationCredentialMissing', fallback: 'Passkey registration did not return credential data.' }],\n ['Invalid passkey setup challenge', { key: 'security.api.errors.invalidPasskeySetupChallenge', fallback: 'Invalid passkey setup challenge.' }],\n ['Passkey credential is not configured', { key: 'security.api.errors.passkeyCredentialNotConfigured', fallback: 'The passkey credential is not configured.' }],\n])\n\nconst patternMessageMap: Array<{\n pattern: RegExp\n resolve: (match: RegExpMatchArray) => MessageDescriptor\n}> = [\n {\n pattern: /^Sudo authentication required for: (.+)$/,\n resolve: (match) => ({\n key: 'security.api.errors.sudoRequiredForTarget',\n fallback: 'Sudo authentication is required for: {target}',\n params: { target: match[1] ?? '' },\n }),\n },\n {\n pattern: /^MFA provider '(.+)' is not registered$/,\n resolve: (match) => ({\n key: 'security.api.errors.mfaProviderNotRegistered',\n fallback: 'MFA provider \"{provider}\" is not registered.',\n params: { provider: match[1] ?? '' },\n }),\n },\n {\n pattern: /^MFA provider '(.+)' is already configured$/,\n resolve: (match) => ({\n key: 'security.api.errors.mfaProviderAlreadyConfigured',\n fallback: 'MFA provider \"{provider}\" is already configured.',\n params: { provider: match[1] ?? '' },\n }),\n },\n {\n pattern: /^MFA method '(.+)' not found$/,\n resolve: (match) => ({\n key: 'security.api.errors.mfaMethodByTypeNotFound',\n fallback: 'MFA method \"{method}\" was not found.',\n params: { method: match[1] ?? '' },\n }),\n },\n]\n\nfunction resolveMessageDescriptor(message: string): MessageDescriptor | null {\n const exact = exactMessageMap.get(message)\n if (exact) return exact\n\n for (const entry of patternMessageMap) {\n const match = message.match(entry.pattern)\n if (match) return entry.resolve(match)\n }\n\n return null\n}\n\nexport async function translateSecurityApiMessage(message: string): Promise<string> {\n const descriptor = resolveMessageDescriptor(message)\n if (!descriptor) return message\n\n const { translate } = await resolveTranslations()\n return translate(descriptor.key, descriptor.fallback, descriptor.params)\n}\n\nexport async function localizeSecurityApiBody<T extends Record<string, unknown>>(body: T): Promise<T> {\n const nextBody: Record<string, unknown> = { ...body }\n\n if (typeof nextBody.error === 'string') {\n nextBody.error = await translateSecurityApiMessage(nextBody.error)\n }\n\n if (typeof nextBody.message === 'string') {\n nextBody.message = await translateSecurityApiMessage(nextBody.message)\n }\n\n return nextBody as T\n}\n\nexport async function securityApiError(\n status: number,\n message: string,\n extra?: Record<string, unknown>,\n): Promise<NextResponse> {\n const body = await localizeSecurityApiBody({\n error: message,\n ...(extra ?? {}),\n })\n return NextResponse.json(body, { status })\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,oBAAoB;AAC7B,SAAS,2BAA2B;AAUpC,MAAM,kBAAkB,oBAAI,IAA+B;AAAA,EACzD,CAAC,mBAAmB,EAAE,KAAK,sCAAsC,UAAU,mBAAmB,CAAC;AAAA,EAC/F,CAAC,gBAAgB,EAAE,KAAK,2BAA2B,UAAU,eAAe,CAAC;AAAA,EAC7E,CAAC,mBAAmB,EAAE,KAAK,6BAA6B,UAAU,mBAAmB,CAAC;AAAA,EACtF,CAAC,4BAA4B,EAAE,KAAK,8CAA8C,UAAU,4BAA4B,CAAC;AAAA,EACzH,CAAC,4BAA4B,EAAE,KAAK,8CAA8C,UAAU,4BAA4B,CAAC;AAAA,EACzH,CAAC,sBAAsB,EAAE,KAAK,uCAAuC,UAAU,qBAAqB,CAAC;AAAA,EACrG,CAAC,oBAAoB,EAAE,KAAK,qCAAqC,UAAU,mBAAmB,CAAC;AAAA,EAC/F,CAAC,0BAA0B,EAAE,KAAK,2CAA2C,UAAU,yBAAyB,CAAC;AAAA,EACjH,CAAC,sBAAsB,EAAE,KAAK,uCAAuC,UAAU,qBAAqB,CAAC;AAAA,EACrG,CAAC,yBAAyB,EAAE,KAAK,iDAAiD,UAAU,gCAAgC,CAAC;AAAA,EAC7H,CAAC,gCAAgC,EAAE,KAAK,iDAAiD,UAAU,gCAAgC,CAAC;AAAA,EACpI,CAAC,+BAA+B,EAAE,KAAK,6CAA6C,UAAU,8BAA8B,CAAC;AAAA,EAC7H,CAAC,+BAA+B,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B,wBAA2D,MAAqB;AACpG,QAAM,WAAoC,EAAE,GAAG,KAAK;AAEpD,MAAI,OAAO,SAAS,UAAU,UAAU;AACtC,aAAS,QAAQ,MAAM,4BAA4B,SAAS,KAAK;AAAA,EACnE;AAEA,MAAI,OAAO,SAAS,YAAY,UAAU;AACxC,aAAS,UAAU,MAAM,4BAA4B,SAAS,OAAO;AAAA,EACvE;AAEA,SAAO;AACT;AAEA,eAAsB,iBACpB,QACA,SACA,OACuB;AACvB,QAAM,OAAO,MAAM,wBAAwB;AAAA,IACzC,OAAO;AAAA,IACP,GAAI,SAAS,CAAC;AAAA,EAChB,CAAC;AACD,SAAO,aAAa,KAAK,MAAM,EAAE,OAAO,CAAC;AAC3C;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -7,7 +7,6 @@ import { signJwt } from "@open-mercato/shared/lib/auth/jwt";
|
|
|
7
7
|
import { localizeSecurityApiBody, securityApiError } from "../i18n.js";
|
|
8
8
|
import { createLogger } from "@open-mercato/shared/lib/logger";
|
|
9
9
|
const logger = createLogger("security").child({ component: "mfa" });
|
|
10
|
-
const MFA_MANAGE_FEATURE = "security.mfa.manage";
|
|
11
10
|
const jsonRecordSchema = z.record(z.string(), z.unknown());
|
|
12
11
|
async function resolveMfaRequestContext(req) {
|
|
13
12
|
const auth = await getAuthFromRequest(req);
|
|
@@ -30,29 +29,6 @@ async function resolveMfaRequestContext(req) {
|
|
|
30
29
|
mfaVerificationService: container.resolve("mfaVerificationService")
|
|
31
30
|
};
|
|
32
31
|
}
|
|
33
|
-
async function authorizeMfaEnrollmentMutation(context) {
|
|
34
|
-
const tenantId = typeof context.auth.tenantId === "string" && context.auth.tenantId.trim().length > 0 ? context.auth.tenantId.trim() : null;
|
|
35
|
-
const organizationId = typeof context.auth.orgId === "string" && context.auth.orgId.trim().length > 0 ? context.auth.orgId.trim() : null;
|
|
36
|
-
const rbacService = context.container.resolve("rbacService");
|
|
37
|
-
const canManageMfa = await rbacService.userHasAllFeatures(
|
|
38
|
-
context.auth.sub,
|
|
39
|
-
[MFA_MANAGE_FEATURE],
|
|
40
|
-
{ tenantId, organizationId }
|
|
41
|
-
);
|
|
42
|
-
if (canManageMfa) return null;
|
|
43
|
-
if (!tenantId) return securityApiError(403, "Forbidden");
|
|
44
|
-
try {
|
|
45
|
-
const enforcementService = context.container.resolve("mfaEnforcementService");
|
|
46
|
-
const compliance = await enforcementService.checkUserCompliance(context.auth.sub);
|
|
47
|
-
if (compliance.enforced && !compliance.compliant) return null;
|
|
48
|
-
} catch (error) {
|
|
49
|
-
logger.error("Unable to verify compelled MFA enrollment authorization; allowing enrollment recovery path", {
|
|
50
|
-
err: error
|
|
51
|
-
});
|
|
52
|
-
return null;
|
|
53
|
-
}
|
|
54
|
-
return securityApiError(403, "Forbidden");
|
|
55
|
-
}
|
|
56
32
|
async function readJsonRecord(req) {
|
|
57
33
|
try {
|
|
58
34
|
const parsed = jsonRecordSchema.safeParse(await req.json());
|
|
@@ -122,7 +98,6 @@ function setAuthCookie(response, token) {
|
|
|
122
98
|
});
|
|
123
99
|
}
|
|
124
100
|
export {
|
|
125
|
-
authorizeMfaEnrollmentMutation,
|
|
126
101
|
issueVerifiedMfaToken,
|
|
127
102
|
mapMfaError,
|
|
128
103
|
readJsonRecord,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/modules/security/api/mfa/_shared.ts"],
|
|
4
|
-
"sourcesContent": ["import { NextResponse } from 'next/server'\nimport { z } from 'zod'\nimport type { CommandRuntimeContext } from '@open-mercato/shared/lib/commands'\nimport { CrudHttpError } from '@open-mercato/shared/lib/crud/errors'\nimport { createRequestContainer } from '@open-mercato/shared/lib/di/container'\nimport { getAuthFromRequest } from '@open-mercato/shared/lib/auth/server'\nimport { signJwt } from '@open-mercato/shared/lib/auth/jwt'\nimport type { MfaService, MfaServiceError } from '../../services/MfaService'\nimport type { MfaVerificationService, MfaVerificationServiceError } from '../../services/MfaVerificationService'\nimport { localizeSecurityApiBody, securityApiError } from '../i18n'\nimport { createLogger } from '@open-mercato/shared/lib/logger'\n\nconst logger = createLogger('security').child({ component: 'mfa' })\
|
|
5
|
-
"mappings": "AAAA,SAAS,oBAAoB;AAC7B,SAAS,SAAS;AAElB,SAAS,qBAAqB;AAC9B,SAAS,8BAA8B;AACvC,SAAS,0BAA0B;AACnC,SAAS,eAAe;AAGxB,SAAS,yBAAyB,wBAAwB;AAC1D,SAAS,oBAAoB;AAE7B,MAAM,SAAS,aAAa,UAAU,EAAE,MAAM,EAAE,WAAW,MAAM,CAAC;
|
|
4
|
+
"sourcesContent": ["import { NextResponse } from 'next/server'\nimport { z } from 'zod'\nimport type { CommandRuntimeContext } from '@open-mercato/shared/lib/commands'\nimport { CrudHttpError } from '@open-mercato/shared/lib/crud/errors'\nimport { createRequestContainer } from '@open-mercato/shared/lib/di/container'\nimport { getAuthFromRequest } from '@open-mercato/shared/lib/auth/server'\nimport { signJwt } from '@open-mercato/shared/lib/auth/jwt'\nimport type { MfaService, MfaServiceError } from '../../services/MfaService'\nimport type { MfaVerificationService, MfaVerificationServiceError } from '../../services/MfaVerificationService'\nimport { localizeSecurityApiBody, securityApiError } from '../i18n'\nimport { createLogger } from '@open-mercato/shared/lib/logger'\n\nconst logger = createLogger('security').child({ component: 'mfa' })\n\nconst jsonRecordSchema = z.record(z.string(), z.unknown())\n\nexport type MfaRequestContext = {\n auth: NonNullable<Awaited<ReturnType<typeof getAuthFromRequest>>>\n container: Awaited<ReturnType<typeof createRequestContainer>>\n commandContext: CommandRuntimeContext\n mfaService: MfaService\n mfaVerificationService: MfaVerificationService\n}\n\nexport async function resolveMfaRequestContext(req: Request): Promise<MfaRequestContext | NextResponse> {\n const auth = await getAuthFromRequest(req)\n if (!auth?.sub) {\n return securityApiError(401, 'Unauthorized')\n }\n\n const container = await createRequestContainer()\n return {\n auth,\n container,\n commandContext: {\n container,\n auth,\n organizationScope: null,\n selectedOrganizationId: auth.orgId ?? null,\n organizationIds: auth.orgId ? [auth.orgId] : null,\n request: req,\n },\n mfaService: container.resolve<MfaService>('mfaService'),\n mfaVerificationService: container.resolve<MfaVerificationService>('mfaVerificationService'),\n }\n}\n\nexport async function readJsonRecord(req: Request): Promise<Record<string, unknown>> {\n try {\n const parsed = jsonRecordSchema.safeParse(await req.json())\n return parsed.success ? parsed.data : {}\n } catch {\n return {}\n }\n}\n\nexport function readUuidParam(value: string | string[] | undefined): string | null {\n if (typeof value !== 'string') return null\n const parsed = z.string().uuid().safeParse(value)\n return parsed.success ? parsed.data : null\n}\n\nexport function readString(value: unknown): string | null {\n if (typeof value !== 'string') return null\n const trimmed = value.trim()\n return trimmed.length > 0 ? trimmed : null\n}\n\nexport async function mapMfaError(error: unknown): Promise<NextResponse> {\n if (error instanceof CrudHttpError) {\n return NextResponse.json(await localizeSecurityApiBody(error.body), { status: error.status })\n }\n if (isMfaServiceError(error) || isMfaVerificationServiceError(error)) {\n return securityApiError(error.statusCode, error.message)\n }\n logger.error('MFA route failure', { err: error })\n return securityApiError(500, 'Failed to process MFA request.')\n}\n\nfunction isMfaServiceError(error: unknown): error is MfaServiceError {\n return error instanceof Error\n && error.name === 'MfaServiceError'\n && typeof (error as Partial<MfaServiceError>).statusCode === 'number'\n}\n\nfunction isMfaVerificationServiceError(error: unknown): error is MfaVerificationServiceError {\n return error instanceof Error\n && error.name === 'MfaVerificationServiceError'\n && typeof (error as Partial<MfaVerificationServiceError>).statusCode === 'number'\n}\n\nexport function issueVerifiedMfaToken(auth: MfaRequestContext['auth'], methods: string[]): string {\n const nextPayload: Record<string, unknown> = {\n sub: auth.sub,\n sid: typeof auth.sid === 'string' ? auth.sid : undefined,\n tenantId: auth.tenantId ?? null,\n orgId: auth.orgId ?? null,\n email: typeof auth.email === 'string' ? auth.email : null,\n roles: Array.isArray(auth.roles) ? auth.roles : [],\n mfa_pending: false,\n mfa_verified: true,\n mfa_methods: methods,\n }\n if (typeof auth.actorTenantId === 'string') {\n nextPayload.actorTenantId = auth.actorTenantId\n }\n if (typeof auth.actorOrgId === 'string') {\n nextPayload.actorOrgId = auth.actorOrgId\n }\n if (auth.isSuperAdmin === true) {\n nextPayload.isSuperAdmin = true\n }\n return signJwt({\n ...nextPayload,\n })\n}\n\nexport function setAuthCookie(response: NextResponse, token: string): void {\n response.cookies.set('auth_token', token, {\n httpOnly: true,\n path: '/',\n sameSite: 'lax',\n secure: process.env.NODE_ENV === 'production',\n maxAge: 60 * 60 * 8,\n })\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,oBAAoB;AAC7B,SAAS,SAAS;AAElB,SAAS,qBAAqB;AAC9B,SAAS,8BAA8B;AACvC,SAAS,0BAA0B;AACnC,SAAS,eAAe;AAGxB,SAAS,yBAAyB,wBAAwB;AAC1D,SAAS,oBAAoB;AAE7B,MAAM,SAAS,aAAa,UAAU,EAAE,MAAM,EAAE,WAAW,MAAM,CAAC;AAElE,MAAM,mBAAmB,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC;AAUzD,eAAsB,yBAAyB,KAAyD;AACtG,QAAM,OAAO,MAAM,mBAAmB,GAAG;AACzC,MAAI,CAAC,MAAM,KAAK;AACd,WAAO,iBAAiB,KAAK,cAAc;AAAA,EAC7C;AAEA,QAAM,YAAY,MAAM,uBAAuB;AAC/C,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,gBAAgB;AAAA,MACd;AAAA,MACA;AAAA,MACA,mBAAmB;AAAA,MACnB,wBAAwB,KAAK,SAAS;AAAA,MACtC,iBAAiB,KAAK,QAAQ,CAAC,KAAK,KAAK,IAAI;AAAA,MAC7C,SAAS;AAAA,IACX;AAAA,IACA,YAAY,UAAU,QAAoB,YAAY;AAAA,IACtD,wBAAwB,UAAU,QAAgC,wBAAwB;AAAA,EAC5F;AACF;AAEA,eAAsB,eAAe,KAAgD;AACnF,MAAI;AACF,UAAM,SAAS,iBAAiB,UAAU,MAAM,IAAI,KAAK,CAAC;A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AK,KAAK,IAAI,KAAK,QAAQ,CAAC;AAAA,IACjD,aAAa;AAAA,IACb,cAAc;AAAA,IACd,aAAa;AAAA,EACf;AACA,MAAI,OAAO,KAAK,kBAAkB,UAAU;AAC1C,gBAAY,gBAAgB,KAAK;AAAA,EACnC;AACA,MAAI,OAAO,KAAK,eAAe,UAAU;AACvC,gBAAY,aAAa,KAAK;AAAA,EAChC;AACA,MAAI,KAAK,iBAAiB,MAAM;AAC9B,gBAAY,eAAe;AAAA,EAC7B;AACA,SAAO,QAAQ;AAAA,IACb,GAAG;AAAA,EACL,CAAC;AACH;AAEO,SAAS,cAAc,UAAwB,OAAqB;AACzE,WAAS,QAAQ,IAAI,cAAc,OAAO;AAAA,IACxC,UAAU;AAAA,IACV,MAAM;AAAA,IACN,UAAU;AAAA,IACV,QAAQ,QAAQ,IAAI,aAAa;AAAA,IACjC,QAAQ,KAAK,KAAK;AAAA,EACpB,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -10,7 +10,7 @@ const paramsSchema = z.object({
|
|
|
10
10
|
id: z.string().uuid()
|
|
11
11
|
});
|
|
12
12
|
const metadata = {
|
|
13
|
-
DELETE: { requireAuth: true
|
|
13
|
+
DELETE: { requireAuth: true }
|
|
14
14
|
};
|
|
15
15
|
async function DELETE(req, context) {
|
|
16
16
|
const requestContext = await resolveMfaRequestContext(req);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../src/modules/security/api/mfa/methods/%5Bid%5D/route.ts"],
|
|
4
|
-
"sourcesContent": ["import { NextResponse } from 'next/server'\nimport { z } from 'zod'\nimport type { CommandBus } from '@open-mercato/shared/lib/commands'\nimport { buildSecurityOpenApi, securityErrorSchema } from '../../../openapi'\nimport { securityApiError } from '../../../i18n'\nimport { mapMfaError, readUuidParam, resolveMfaRequestContext } from '../../_shared'\n\nconst okResponseSchema = z.object({\n ok: z.literal(true),\n})\n\nconst paramsSchema = z.object({\n id: z.string().uuid(),\n})\n\nexport const metadata = {\n DELETE: { requireAuth: true
|
|
5
|
-
"mappings": "AAAA,SAAS,oBAAoB;AAC7B,SAAS,SAAS;AAElB,SAAS,sBAAsB,2BAA2B;AAC1D,SAAS,wBAAwB;AACjC,SAAS,aAAa,eAAe,gCAAgC;AAErE,MAAM,mBAAmB,EAAE,OAAO;AAAA,EAChC,IAAI,EAAE,QAAQ,IAAI;AACpB,CAAC;AAED,MAAM,eAAe,EAAE,OAAO;AAAA,EAC5B,IAAI,EAAE,OAAO,EAAE,KAAK;AACtB,CAAC;AAEM,MAAM,WAAW;AAAA,EACtB,QAAQ,EAAE,aAAa,
|
|
4
|
+
"sourcesContent": ["import { NextResponse } from 'next/server'\nimport { z } from 'zod'\nimport type { CommandBus } from '@open-mercato/shared/lib/commands'\nimport { buildSecurityOpenApi, securityErrorSchema } from '../../../openapi'\nimport { securityApiError } from '../../../i18n'\nimport { mapMfaError, readUuidParam, resolveMfaRequestContext } from '../../_shared'\n\nconst okResponseSchema = z.object({\n ok: z.literal(true),\n})\n\nconst paramsSchema = z.object({\n id: z.string().uuid(),\n})\n\nexport const metadata = {\n DELETE: { requireAuth: true },\n}\n\nexport async function DELETE(req: Request, context: { params: Promise<{ id: string }> }) {\n const requestContext = await resolveMfaRequestContext(req)\n if (requestContext instanceof NextResponse) return requestContext\n\n const params = await context.params\n const methodId = readUuidParam(params.id)\n if (!methodId) {\n return securityApiError(400, 'Invalid method id.')\n }\n\n try {\n const commandBus = requestContext.container.resolve<CommandBus>('commandBus')\n const { result } = await commandBus.execute('security.mfa.method.remove', {\n input: { id: methodId },\n ctx: requestContext.commandContext,\n })\n return NextResponse.json(result)\n } catch (error) {\n return await mapMfaError(error)\n }\n}\n\nexport const openApi = buildSecurityOpenApi({\n summary: 'MFA method mutation routes',\n methods: {\n DELETE: {\n summary: 'Remove MFA method',\n pathParams: paramsSchema,\n responses: [{ status: 200, description: 'MFA method removed', schema: okResponseSchema }],\n errors: [\n { status: 400, description: 'Invalid method id', schema: securityErrorSchema },\n { status: 401, description: 'Unauthorized', schema: securityErrorSchema },\n { status: 404, description: 'Method not found', schema: securityErrorSchema },\n ],\n },\n },\n})\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,oBAAoB;AAC7B,SAAS,SAAS;AAElB,SAAS,sBAAsB,2BAA2B;AAC1D,SAAS,wBAAwB;AACjC,SAAS,aAAa,eAAe,gCAAgC;AAErE,MAAM,mBAAmB,EAAE,OAAO;AAAA,EAChC,IAAI,EAAE,QAAQ,IAAI;AACpB,CAAC;AAED,MAAM,eAAe,EAAE,OAAO;AAAA,EAC5B,IAAI,EAAE,OAAO,EAAE,KAAK;AACtB,CAAC;AAEM,MAAM,WAAW;AAAA,EACtB,QAAQ,EAAE,aAAa,KAAK;AAC9B;AAEA,eAAsB,OAAO,KAAc,SAA8C;AACvF,QAAM,iBAAiB,MAAM,yBAAyB,GAAG;AACzD,MAAI,0BAA0B,aAAc,QAAO;AAEnD,QAAM,SAAS,MAAM,QAAQ;AAC7B,QAAM,WAAW,cAAc,OAAO,EAAE;AACxC,MAAI,CAAC,UAAU;AACb,WAAO,iBAAiB,KAAK,oBAAoB;AAAA,EACnD;AAEA,MAAI;AACF,UAAM,aAAa,eAAe,UAAU,QAAoB,YAAY;AAC5E,UAAM,EAAE,OAAO,IAAI,MAAM,WAAW,QAAQ,8BAA8B;AAAA,MACxE,OAAO,EAAE,IAAI,SAAS;AAAA,MACtB,KAAK,eAAe;AAAA,IACtB,CAAC;AACD,WAAO,aAAa,KAAK,MAAM;AAAA,EACjC,SAAS,OAAO;AACd,WAAO,MAAM,YAAY,KAAK;AAAA,EAChC;AACF;AAEO,MAAM,UAAU,qBAAqB;AAAA,EAC1C,SAAS;AAAA,EACT,SAAS;AAAA,IACP,QAAQ;AAAA,MACN,SAAS;AAAA,MACT,YAAY;AAAA,MACZ,WAAW,CAAC,EAAE,QAAQ,KAAK,aAAa,sBAAsB,QAAQ,iBAAiB,CAAC;AAAA,MACxF,QAAQ;AAAA,QACN,EAAE,QAAQ,KAAK,aAAa,qBAAqB,QAAQ,oBAAoB;AAAA,QAC7E,EAAE,QAAQ,KAAK,aAAa,gBAAgB,QAAQ,oBAAoB;AAAA,QACxE,EAAE,QAAQ,KAAK,aAAa,oBAAoB,QAAQ,oBAAoB;AAAA,MAC9E;AAAA,IACF;AAAA,EACF;AACF,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,13 +2,7 @@ import { NextResponse } from "next/server";
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { buildSecurityOpenApi, securityErrorSchema } from "../../../openapi.js";
|
|
4
4
|
import { securityApiError } from "../../../i18n.js";
|
|
5
|
-
import {
|
|
6
|
-
authorizeMfaEnrollmentMutation,
|
|
7
|
-
mapMfaError,
|
|
8
|
-
readJsonRecord,
|
|
9
|
-
readString,
|
|
10
|
-
resolveMfaRequestContext
|
|
11
|
-
} from "../../_shared.js";
|
|
5
|
+
import { mapMfaError, readJsonRecord, readString, resolveMfaRequestContext } from "../../_shared.js";
|
|
12
6
|
const paramsSchema = z.object({
|
|
13
7
|
providername: z.string().min(1)
|
|
14
8
|
});
|
|
@@ -32,8 +26,6 @@ const metadata = {
|
|
|
32
26
|
async function POST(req, context) {
|
|
33
27
|
const requestContext = await resolveMfaRequestContext(req);
|
|
34
28
|
if (requestContext instanceof NextResponse) return requestContext;
|
|
35
|
-
const authorizationError = await authorizeMfaEnrollmentMutation(requestContext);
|
|
36
|
-
if (authorizationError) return authorizationError;
|
|
37
29
|
const body = await readJsonRecord(req);
|
|
38
30
|
const params = await context.params;
|
|
39
31
|
const providerType = readString(params.providername);
|
|
@@ -59,8 +51,6 @@ async function POST(req, context) {
|
|
|
59
51
|
async function PUT(req, context) {
|
|
60
52
|
const requestContext = await resolveMfaRequestContext(req);
|
|
61
53
|
if (requestContext instanceof NextResponse) return requestContext;
|
|
62
|
-
const authorizationError = await authorizeMfaEnrollmentMutation(requestContext);
|
|
63
|
-
if (authorizationError) return authorizationError;
|
|
64
54
|
const body = await readJsonRecord(req);
|
|
65
55
|
const params = await context.params;
|
|
66
56
|
const providerType = readString(params.providername);
|
|
@@ -98,8 +88,7 @@ const openApi = buildSecurityOpenApi({
|
|
|
98
88
|
responses: [{ status: 200, description: "Provider setup created", schema: setupResponseSchema }],
|
|
99
89
|
errors: [
|
|
100
90
|
{ status: 400, description: "Invalid provider type or payload", schema: securityErrorSchema },
|
|
101
|
-
{ status: 401, description: "Unauthorized", schema: securityErrorSchema }
|
|
102
|
-
{ status: 403, description: "MFA enrollment is not permitted", schema: securityErrorSchema }
|
|
91
|
+
{ status: 401, description: "Unauthorized", schema: securityErrorSchema }
|
|
103
92
|
]
|
|
104
93
|
},
|
|
105
94
|
PUT: {
|
|
@@ -112,8 +101,7 @@ const openApi = buildSecurityOpenApi({
|
|
|
112
101
|
responses: [{ status: 200, description: "Provider setup confirmed", schema: confirmResponseSchema }],
|
|
113
102
|
errors: [
|
|
114
103
|
{ status: 400, description: "Invalid provider type or payload", schema: securityErrorSchema },
|
|
115
|
-
{ status: 401, description: "Unauthorized", schema: securityErrorSchema }
|
|
116
|
-
{ status: 403, description: "MFA enrollment is not permitted", schema: securityErrorSchema }
|
|
104
|
+
{ status: 401, description: "Unauthorized", schema: securityErrorSchema }
|
|
117
105
|
]
|
|
118
106
|
}
|
|
119
107
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../src/modules/security/api/mfa/provider/%5Bprovidername%5D/route.ts"],
|
|
4
|
-
"sourcesContent": ["import { NextResponse } from 'next/server'\nimport { z } from 'zod'\nimport { buildSecurityOpenApi, securityErrorSchema } from '../../../openapi'\nimport { securityApiError } from '../../../i18n'\nimport {
|
|
5
|
-
"mappings": "AAAA,SAAS,oBAAoB;AAC7B,SAAS,SAAS;AAClB,SAAS,sBAAsB,2BAA2B;AAC1D,SAAS,wBAAwB;AACjC
|
|
4
|
+
"sourcesContent": ["import { NextResponse } from 'next/server'\nimport { z } from 'zod'\nimport { buildSecurityOpenApi, securityErrorSchema } from '../../../openapi'\nimport { securityApiError } from '../../../i18n'\nimport { mapMfaError, readJsonRecord, readString, resolveMfaRequestContext } from '../../_shared'\n\nconst paramsSchema = z.object({\n providername: z.string().min(1),\n})\n\nconst setupResponseSchema = z.object({\n providerType: z.string(),\n setupId: z.string(),\n clientData: z.record(z.string(), z.unknown()),\n})\n\nconst confirmRequestSchema = z.object({\n setupId: z.string().min(1),\n payload: z.record(z.string(), z.unknown()).optional(),\n})\n\nconst confirmResponseSchema = z.object({\n ok: z.literal(true),\n recoveryCodes: z.array(z.string()).optional(),\n})\n\nexport const metadata = {\n POST: { requireAuth: true },\n PUT: { requireAuth: true },\n}\n\nexport async function POST(req: Request, context: { params: Promise<{ providername: string }> }) {\n const requestContext = await resolveMfaRequestContext(req)\n if (requestContext instanceof NextResponse) return requestContext\n\n const body = await readJsonRecord(req)\n const params = await context.params\n const providerType = readString(params.providername)\n if (!providerType) {\n return securityApiError(400, 'Invalid provider type.')\n }\n\n try {\n const setup = await requestContext.mfaService.setupMethod(\n requestContext.auth.sub,\n providerType,\n body,\n { request: req },\n )\n\n return NextResponse.json({\n providerType,\n setupId: setup.setupId,\n clientData: setup.clientData,\n })\n } catch (error) {\n return await mapMfaError(error)\n }\n}\n\nexport async function PUT(req: Request, context: { params: Promise<{ providername: string }> }) {\n const requestContext = await resolveMfaRequestContext(req)\n if (requestContext instanceof NextResponse) return requestContext\n\n const body = await readJsonRecord(req)\n const params = await context.params\n const providerType = readString(params.providername)\n if (!providerType) {\n return securityApiError(400, 'Invalid provider type.')\n }\n\n const setupId = readString(body.setupId)\n if (!setupId) {\n return securityApiError(400, 'setupId is required.')\n }\n\n const payload = body.payload && typeof body.payload === 'object'\n ? body.payload\n : Object.fromEntries(Object.entries(body).filter(([key]) => key !== 'setupId'))\n\n try {\n await requestContext.mfaService.confirmMethod(\n requestContext.auth.sub,\n setupId,\n payload,\n providerType,\n { request: req },\n )\n return NextResponse.json({ ok: true })\n } catch (error) {\n return await mapMfaError(error)\n }\n}\n\nexport const openApi = buildSecurityOpenApi({\n summary: 'MFA provider routes',\n methods: {\n POST: {\n summary: 'Begin MFA provider setup',\n pathParams: paramsSchema,\n requestBody: {\n contentType: 'application/json',\n schema: z.record(z.string(), z.unknown()).optional(),\n },\n responses: [{ status: 200, description: 'Provider setup created', schema: setupResponseSchema }],\n errors: [\n { status: 400, description: 'Invalid provider type or payload', schema: securityErrorSchema },\n { status: 401, description: 'Unauthorized', schema: securityErrorSchema },\n ],\n },\n PUT: {\n summary: 'Confirm MFA provider setup',\n pathParams: paramsSchema,\n requestBody: {\n contentType: 'application/json',\n schema: confirmRequestSchema,\n },\n responses: [{ status: 200, description: 'Provider setup confirmed', schema: confirmResponseSchema }],\n errors: [\n { status: 400, description: 'Invalid provider type or payload', schema: securityErrorSchema },\n { status: 401, description: 'Unauthorized', schema: securityErrorSchema },\n ],\n },\n },\n})\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,oBAAoB;AAC7B,SAAS,SAAS;AAClB,SAAS,sBAAsB,2BAA2B;AAC1D,SAAS,wBAAwB;AACjC,SAAS,aAAa,gBAAgB,YAAY,gCAAgC;AAElF,MAAM,eAAe,EAAE,OAAO;AAAA,EAC5B,cAAc,EAAE,OAAO,EAAE,IAAI,CAAC;AAChC,CAAC;AAED,MAAM,sBAAsB,EAAE,OAAO;AAAA,EACnC,cAAc,EAAE,OAAO;AAAA,EACvB,SAAS,EAAE,OAAO;AAAA,EAClB,YAAY,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC;AAC9C,CAAC;AAED,MAAM,uBAAuB,EAAE,OAAO;AAAA,EACpC,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACzB,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC,EAAE,SAAS;AAC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C1E;AAAA,IACF;AAAA,EACF;AACF,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -7,7 +7,7 @@ const responseSchema = z.object({
|
|
|
7
7
|
recoveryCodes: z.array(z.string())
|
|
8
8
|
});
|
|
9
9
|
const metadata = {
|
|
10
|
-
POST: { requireAuth: true
|
|
10
|
+
POST: { requireAuth: true }
|
|
11
11
|
};
|
|
12
12
|
async function POST(req) {
|
|
13
13
|
const context = await resolveMfaRequestContext(req);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../src/modules/security/api/mfa/recovery-codes/regenerate/route.ts"],
|
|
4
|
-
"sourcesContent": ["import { NextResponse } from 'next/server'\nimport { z } from 'zod'\nimport type { CommandBus } from '@open-mercato/shared/lib/commands'\nimport { buildSecurityOpenApi, securityErrorSchema } from '../../../openapi'\nimport { mapMfaError, resolveMfaRequestContext } from '../../_shared'\n\nconst responseSchema = z.object({\n ok: z.literal(true),\n recoveryCodes: z.array(z.string()),\n})\n\nexport const metadata = {\n POST: { requireAuth: true
|
|
5
|
-
"mappings": "AAAA,SAAS,oBAAoB;AAC7B,SAAS,SAAS;AAElB,SAAS,sBAAsB,2BAA2B;AAC1D,SAAS,aAAa,gCAAgC;AAEtD,MAAM,iBAAiB,EAAE,OAAO;AAAA,EAC9B,IAAI,EAAE,QAAQ,IAAI;AAAA,EAClB,eAAe,EAAE,MAAM,EAAE,OAAO,CAAC;AACnC,CAAC;AAEM,MAAM,WAAW;AAAA,EACtB,MAAM,EAAE,aAAa,
|
|
4
|
+
"sourcesContent": ["import { NextResponse } from 'next/server'\nimport { z } from 'zod'\nimport type { CommandBus } from '@open-mercato/shared/lib/commands'\nimport { buildSecurityOpenApi, securityErrorSchema } from '../../../openapi'\nimport { mapMfaError, resolveMfaRequestContext } from '../../_shared'\n\nconst responseSchema = z.object({\n ok: z.literal(true),\n recoveryCodes: z.array(z.string()),\n})\n\nexport const metadata = {\n POST: { requireAuth: true },\n}\n\nexport async function POST(req: Request) {\n const context = await resolveMfaRequestContext(req)\n if (context instanceof NextResponse) return context\n\n try {\n const commandBus = context.container.resolve<CommandBus>('commandBus')\n const { result } = await commandBus.execute('security.mfa.recovery_codes.regenerate', {\n input: {},\n ctx: context.commandContext,\n })\n return NextResponse.json(result)\n } catch (error) {\n return mapMfaError(error)\n }\n}\n\nexport const openApi = buildSecurityOpenApi({\n summary: 'Recovery code routes',\n methods: {\n POST: {\n summary: 'Regenerate recovery codes',\n responses: [{ status: 200, description: 'Recovery codes regenerated', schema: responseSchema }],\n errors: [{ status: 401, description: 'Unauthorized', schema: securityErrorSchema }],\n },\n },\n})\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,oBAAoB;AAC7B,SAAS,SAAS;AAElB,SAAS,sBAAsB,2BAA2B;AAC1D,SAAS,aAAa,gCAAgC;AAEtD,MAAM,iBAAiB,EAAE,OAAO;AAAA,EAC9B,IAAI,EAAE,QAAQ,IAAI;AAAA,EAClB,eAAe,EAAE,MAAM,EAAE,OAAO,CAAC;AACnC,CAAC;AAEM,MAAM,WAAW;AAAA,EACtB,MAAM,EAAE,aAAa,KAAK;AAC5B;AAEA,eAAsB,KAAK,KAAc;AACvC,QAAM,UAAU,MAAM,yBAAyB,GAAG;AAClD,MAAI,mBAAmB,aAAc,QAAO;AAE5C,MAAI;AACF,UAAM,aAAa,QAAQ,UAAU,QAAoB,YAAY;AACrE,UAAM,EAAE,OAAO,IAAI,MAAM,WAAW,QAAQ,0CAA0C;AAAA,MACpF,OAAO,CAAC;AAAA,MACR,KAAK,QAAQ;AAAA,IACf,CAAC;AACD,WAAO,aAAa,KAAK,MAAM;AAAA,EACjC,SAAS,OAAO;AACd,WAAO,YAAY,KAAK;AAAA,EAC1B;AACF;AAEO,MAAM,UAAU,qBAAqB;AAAA,EAC1C,SAAS;AAAA,EACT,SAAS;AAAA,IACP,MAAM;AAAA,MACJ,SAAS;AAAA,MACT,WAAW,CAAC,EAAE,QAAQ,KAAK,aAAa,8BAA8B,QAAQ,eAAe,CAAC;AAAA,MAC9F,QAAQ,CAAC,EAAE,QAAQ,KAAK,aAAa,gBAAgB,QAAQ,oBAAoB,CAAC;AAAA,IACpF;AAAA,EACF;AACF,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { Page, PageBody } from "@open-mercato/ui/backend/Page";
|
|
4
4
|
import { InjectionSpot } from "@open-mercato/ui/backend/injection/InjectionSpot";
|
|
5
|
-
import { extensionPoints } from "@open-mercato/enterprise/modules/security/extension-points";
|
|
6
5
|
import MfaSettingsRedirect from "../../../components/MfaSettingsRedirect.js";
|
|
7
6
|
import PasswordChangeForm from "../../../components/PasswordChangeForm.js";
|
|
8
7
|
function SecurityProfilePage() {
|
|
@@ -14,7 +13,7 @@ function SecurityProfilePage() {
|
|
|
14
13
|
/* @__PURE__ */ jsx(
|
|
15
14
|
InjectionSpot,
|
|
16
15
|
{
|
|
17
|
-
spotId:
|
|
16
|
+
spotId: "security.profile.sidebar",
|
|
18
17
|
context: { section: "sidebar" }
|
|
19
18
|
}
|
|
20
19
|
)
|
|
@@ -23,7 +22,7 @@ function SecurityProfilePage() {
|
|
|
23
22
|
/* @__PURE__ */ jsx("div", { className: "mt-6", children: /* @__PURE__ */ jsx(
|
|
24
23
|
InjectionSpot,
|
|
25
24
|
{
|
|
26
|
-
spotId:
|
|
25
|
+
spotId: "security.profile.sections",
|
|
27
26
|
context: { section: "profile-sections" }
|
|
28
27
|
}
|
|
29
28
|
) })
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/modules/security/backend/profile/security/page.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\n\nimport { Page, PageBody } from '@open-mercato/ui/backend/Page'\nimport { InjectionSpot } from '@open-mercato/ui/backend/injection/InjectionSpot'\nimport
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport { Page, PageBody } from '@open-mercato/ui/backend/Page'\nimport { InjectionSpot } from '@open-mercato/ui/backend/injection/InjectionSpot'\nimport MfaSettingsRedirect from '../../../components/MfaSettingsRedirect'\nimport PasswordChangeForm from '../../../components/PasswordChangeForm'\n\nexport default function SecurityProfilePage() {\n return (\n <Page>\n <PageBody>\n <div className=\"grid gap-4 lg:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]\">\n <PasswordChangeForm />\n\n <div className=\"space-y-4\">\n <MfaSettingsRedirect />\n <InjectionSpot\n spotId=\"security.profile.sidebar\"\n context={{ section: 'sidebar' }}\n />\n </div>\n </div>\n\n <div className=\"mt-6\">\n <InjectionSpot\n spotId=\"security.profile.sections\"\n context={{ section: 'profile-sections' }}\n />\n </div>\n </PageBody>\n </Page>\n )\n}\n"],
|
|
5
|
+
"mappings": ";AAYU,cAEA,YAFA;AAVV,SAAS,MAAM,gBAAgB;AAC/B,SAAS,qBAAqB;AAC9B,OAAO,yBAAyB;AAChC,OAAO,wBAAwB;AAEhB,SAAR,sBAAuC;AAC5C,SACE,oBAAC,QACC,+BAAC,YACC;AAAA,yBAAC,SAAI,WAAU,yDACb;AAAA,0BAAC,sBAAmB;AAAA,MAEpB,qBAAC,SAAI,WAAU,aACb;AAAA,4BAAC,uBAAoB;AAAA,QACrB;AAAA,UAAC;AAAA;AAAA,YACC,QAAO;AAAA,YACP,SAAS,EAAE,SAAS,UAAU;AAAA;AAAA,QAChC;AAAA,SACF;AAAA,OACF;AAAA,IAEA,oBAAC,SAAI,WAAU,QACb;AAAA,MAAC;AAAA;AAAA,QACC,QAAO;AAAA,QACP,SAAS,EAAE,SAAS,mBAAmB;AAAA;AAAA,IACzC,GACF;AAAA,KACF,GACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
|
-
import { extensionPoints } from "@open-mercato/enterprise/modules/security/extension-points";
|
|
5
4
|
import Link from "next/link";
|
|
6
5
|
import { useRouter } from "next/navigation.js";
|
|
7
6
|
import { Pencil, Trash2 } from "lucide-react";
|
|
@@ -235,7 +234,7 @@ function SecurityEnforcementPage() {
|
|
|
235
234
|
onRefresh: () => void loadPolicies(),
|
|
236
235
|
isRefreshing: loading
|
|
237
236
|
},
|
|
238
|
-
perspective: { tableId:
|
|
237
|
+
perspective: { tableId: "security.enforcement.list" },
|
|
239
238
|
isLoading: loading,
|
|
240
239
|
error: error ? /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center gap-3", children: [
|
|
241
240
|
/* @__PURE__ */ jsx("span", { children: error }),
|