@contember/engine-tenant-api 2.2.0-alpha.1 → 2.2.0-alpha.10
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/CLAUDE.md +60 -7
- package/dist/development/index.cjs +69 -0
- package/dist/development/index.cjs.map +1 -1
- package/dist/development/index.js +71 -2
- package/dist/development/index.js.map +1 -1
- package/dist/development/src/TenantContainer.cjs +39 -10
- package/dist/development/src/TenantContainer.cjs.map +1 -1
- package/dist/development/src/TenantContainer.js +39 -10
- package/dist/development/src/TenantContainer.js.map +1 -1
- package/dist/development/src/bridges/system/IdentityFetcher.cjs +9 -7
- package/dist/development/src/bridges/system/IdentityFetcher.cjs.map +1 -1
- package/dist/development/src/bridges/system/IdentityFetcher.js +9 -7
- package/dist/development/src/bridges/system/IdentityFetcher.js.map +1 -1
- package/dist/development/src/migrations/2026-06-18-120000-idp-claim-mapping.cjs +10 -0
- package/dist/development/src/migrations/2026-06-18-120000-idp-claim-mapping.cjs.map +1 -0
- package/dist/development/src/migrations/2026-06-18-120000-idp-claim-mapping.js +11 -0
- package/dist/development/src/migrations/2026-06-18-120000-idp-claim-mapping.js.map +1 -0
- package/dist/development/src/migrations/2026-08-03-120000-person-enable-auth-log.cjs +9 -0
- package/dist/development/src/migrations/2026-08-03-120000-person-enable-auth-log.cjs.map +1 -0
- package/dist/development/src/migrations/2026-08-03-120000-person-enable-auth-log.js +10 -0
- package/dist/development/src/migrations/2026-08-03-120000-person-enable-auth-log.js.map +1 -0
- package/dist/development/src/migrations/2026-08-04-120000-config-panel.cjs +11 -0
- package/dist/development/src/migrations/2026-08-04-120000-config-panel.cjs.map +1 -0
- package/dist/development/src/migrations/2026-08-04-120000-config-panel.js +12 -0
- package/dist/development/src/migrations/2026-08-04-120000-config-panel.js.map +1 -0
- package/dist/development/src/migrations/2026-09-04-120000-idp-disable-local-authentication.cjs +18 -0
- package/dist/development/src/migrations/2026-09-04-120000-idp-disable-local-authentication.cjs.map +1 -0
- package/dist/development/src/migrations/2026-09-04-120000-idp-disable-local-authentication.js +19 -0
- package/dist/development/src/migrations/2026-09-04-120000-idp-disable-local-authentication.js.map +1 -0
- package/dist/development/src/migrations/2026-09-11-120000-custom-role.cjs +18 -0
- package/dist/development/src/migrations/2026-09-11-120000-custom-role.cjs.map +1 -0
- package/dist/development/src/migrations/2026-09-11-120000-custom-role.js +19 -0
- package/dist/development/src/migrations/2026-09-11-120000-custom-role.js.map +1 -0
- package/dist/development/src/migrations/runner.cjs +17 -5
- package/dist/development/src/migrations/runner.cjs.map +1 -1
- package/dist/development/src/migrations/runner.js +17 -5
- package/dist/development/src/migrations/runner.js.map +1 -1
- package/dist/development/src/migrations/snapshot.cjs +22 -2
- package/dist/development/src/migrations/snapshot.cjs.map +1 -1
- package/dist/development/src/migrations/snapshot.js +22 -2
- package/dist/development/src/migrations/snapshot.js.map +1 -1
- package/dist/development/src/model/authorization/CustomRoleAuthorizator.cjs +65 -0
- package/dist/development/src/model/authorization/CustomRoleAuthorizator.cjs.map +1 -0
- package/dist/development/src/model/authorization/CustomRoleAuthorizator.js +65 -0
- package/dist/development/src/model/authorization/CustomRoleAuthorizator.js.map +1 -0
- package/dist/development/src/model/authorization/CustomRolePermissions.cjs +404 -0
- package/dist/development/src/model/authorization/CustomRolePermissions.cjs.map +1 -0
- package/dist/development/src/model/authorization/CustomRolePermissions.js +387 -0
- package/dist/development/src/model/authorization/CustomRolePermissions.js.map +1 -0
- package/dist/development/src/model/authorization/PermissionActions.cjs +19 -16
- package/dist/development/src/model/authorization/PermissionActions.cjs.map +1 -1
- package/dist/development/src/model/authorization/PermissionActions.js +19 -16
- package/dist/development/src/model/authorization/PermissionActions.js.map +1 -1
- package/dist/development/src/model/authorization/PermissionContextFactory.cjs +20 -2
- package/dist/development/src/model/authorization/PermissionContextFactory.cjs.map +1 -1
- package/dist/development/src/model/authorization/PermissionContextFactory.js +20 -2
- package/dist/development/src/model/authorization/PermissionContextFactory.js.map +1 -1
- package/dist/development/src/model/authorization/PermissionsFactory.cjs +32 -24
- package/dist/development/src/model/authorization/PermissionsFactory.cjs.map +1 -1
- package/dist/development/src/model/authorization/PermissionsFactory.js +33 -25
- package/dist/development/src/model/authorization/PermissionsFactory.js.map +1 -1
- package/dist/development/src/model/authorization/Roles.cjs +8 -0
- package/dist/development/src/model/authorization/Roles.cjs.map +1 -1
- package/dist/development/src/model/authorization/Roles.js +8 -0
- package/dist/development/src/model/authorization/Roles.js.map +1 -1
- package/dist/development/src/model/authorization/TargetIdentityPermission.cjs +35 -0
- package/dist/development/src/model/authorization/TargetIdentityPermission.cjs.map +1 -0
- package/dist/development/src/model/authorization/TargetIdentityPermission.js +35 -0
- package/dist/development/src/model/authorization/TargetIdentityPermission.js.map +1 -0
- package/dist/development/src/model/commands/apiKey/ApiKeyHelper.cjs +19 -0
- package/dist/development/src/model/commands/apiKey/ApiKeyHelper.cjs.map +1 -1
- package/dist/development/src/model/commands/apiKey/ApiKeyHelper.js +19 -0
- package/dist/development/src/model/commands/apiKey/ApiKeyHelper.js.map +1 -1
- package/dist/development/src/model/commands/apiKey/CreateApiKeyCommand.cjs +4 -2
- package/dist/development/src/model/commands/apiKey/CreateApiKeyCommand.cjs.map +1 -1
- package/dist/development/src/model/commands/apiKey/CreateApiKeyCommand.js +5 -3
- package/dist/development/src/model/commands/apiKey/CreateApiKeyCommand.js.map +1 -1
- package/dist/development/src/model/commands/apiKey/ProlongApiKeyCommand.cjs +9 -10
- package/dist/development/src/model/commands/apiKey/ProlongApiKeyCommand.cjs.map +1 -1
- package/dist/development/src/model/commands/apiKey/ProlongApiKeyCommand.js +10 -11
- package/dist/development/src/model/commands/apiKey/ProlongApiKeyCommand.js.map +1 -1
- package/dist/development/src/model/commands/authLog/CreateAuthLogEntryCommand.cjs.map +1 -1
- package/dist/development/src/model/commands/authLog/CreateAuthLogEntryCommand.js.map +1 -1
- package/dist/development/src/model/commands/configuration/UpdateConfigurationCommand.cjs +5 -3
- package/dist/development/src/model/commands/configuration/UpdateConfigurationCommand.cjs.map +1 -1
- package/dist/development/src/model/commands/configuration/UpdateConfigurationCommand.js +5 -3
- package/dist/development/src/model/commands/configuration/UpdateConfigurationCommand.js.map +1 -1
- package/dist/development/src/model/commands/customRole/CreateCustomRoleCommand.cjs +23 -0
- package/dist/development/src/model/commands/customRole/CreateCustomRoleCommand.cjs.map +1 -0
- package/dist/development/src/model/commands/customRole/CreateCustomRoleCommand.js +23 -0
- package/dist/development/src/model/commands/customRole/CreateCustomRoleCommand.js.map +1 -0
- package/dist/development/src/model/commands/customRole/DeleteCustomRoleCommand.cjs +14 -0
- package/dist/development/src/model/commands/customRole/DeleteCustomRoleCommand.cjs.map +1 -0
- package/dist/development/src/model/commands/customRole/DeleteCustomRoleCommand.js +14 -0
- package/dist/development/src/model/commands/customRole/DeleteCustomRoleCommand.js.map +1 -0
- package/dist/development/src/model/commands/customRole/RemoveCustomRoleAssignmentsCommand.cjs +16 -0
- package/dist/development/src/model/commands/customRole/RemoveCustomRoleAssignmentsCommand.cjs.map +1 -0
- package/dist/development/src/model/commands/customRole/RemoveCustomRoleAssignmentsCommand.js +16 -0
- package/dist/development/src/model/commands/customRole/RemoveCustomRoleAssignmentsCommand.js.map +1 -0
- package/dist/development/src/model/commands/customRole/UpdateCustomRoleCommand.cjs +19 -0
- package/dist/development/src/model/commands/customRole/UpdateCustomRoleCommand.cjs.map +1 -0
- package/dist/development/src/model/commands/customRole/UpdateCustomRoleCommand.js +19 -0
- package/dist/development/src/model/commands/customRole/UpdateCustomRoleCommand.js.map +1 -0
- package/dist/development/src/model/commands/identity/PatchIdentityGlobalRoles.cjs +1 -1
- package/dist/development/src/model/commands/identity/PatchIdentityGlobalRoles.cjs.map +1 -1
- package/dist/development/src/model/commands/identity/PatchIdentityGlobalRoles.js +1 -1
- package/dist/development/src/model/commands/identity/PatchIdentityGlobalRoles.js.map +1 -1
- package/dist/development/src/model/commands/idp/ClaimIdpRevalidationCommand.cjs +3 -7
- package/dist/development/src/model/commands/idp/ClaimIdpRevalidationCommand.cjs.map +1 -1
- package/dist/development/src/model/commands/idp/ClaimIdpRevalidationCommand.js +3 -7
- package/dist/development/src/model/commands/idp/ClaimIdpRevalidationCommand.js.map +1 -1
- package/dist/development/src/model/commands/idp/CreateIdpCommand.cjs +8 -2
- package/dist/development/src/model/commands/idp/CreateIdpCommand.cjs.map +1 -1
- package/dist/development/src/model/commands/idp/CreateIdpCommand.js +8 -2
- package/dist/development/src/model/commands/idp/CreateIdpCommand.js.map +1 -1
- package/dist/development/src/model/commands/idp/CreateIdpSessionCommand.cjs +4 -1
- package/dist/development/src/model/commands/idp/CreateIdpSessionCommand.cjs.map +1 -1
- package/dist/development/src/model/commands/idp/CreateIdpSessionCommand.js +5 -2
- package/dist/development/src/model/commands/idp/CreateIdpSessionCommand.js.map +1 -1
- package/dist/development/src/model/commands/idp/UpdateIdpCommand.cjs +6 -2
- package/dist/development/src/model/commands/idp/UpdateIdpCommand.cjs.map +1 -1
- package/dist/development/src/model/commands/idp/UpdateIdpCommand.js +6 -2
- package/dist/development/src/model/commands/idp/UpdateIdpCommand.js.map +1 -1
- package/dist/development/src/model/commands/idp/UpdateIdpSessionCommand.cjs +2 -1
- package/dist/development/src/model/commands/idp/UpdateIdpSessionCommand.cjs.map +1 -1
- package/dist/development/src/model/commands/idp/UpdateIdpSessionCommand.js +3 -2
- package/dist/development/src/model/commands/idp/UpdateIdpSessionCommand.js.map +1 -1
- package/dist/development/src/model/commands/membership/{RemoveProjectMembershipsCommand.cjs → RemoveProjectMembershipCommand.cjs} +1 -1
- package/dist/development/src/model/commands/membership/RemoveProjectMembershipCommand.cjs.map +1 -0
- package/dist/development/src/model/commands/membership/{RemoveProjectMembershipsCommand.js → RemoveProjectMembershipCommand.js} +1 -1
- package/dist/development/src/model/commands/membership/RemoveProjectMembershipCommand.js.map +1 -0
- package/dist/development/src/model/commands/membership/UpdateProjectMemberCommand.cjs +2 -2
- package/dist/development/src/model/commands/membership/UpdateProjectMemberCommand.cjs.map +1 -1
- package/dist/development/src/model/commands/membership/UpdateProjectMemberCommand.js +1 -1
- package/dist/development/src/model/commands/membership/UpdateProjectMemberCommand.js.map +1 -1
- package/dist/development/src/model/commands/person/CreatePersonCommand.cjs +1 -0
- package/dist/development/src/model/commands/person/CreatePersonCommand.cjs.map +1 -1
- package/dist/development/src/model/commands/person/CreatePersonCommand.js +1 -0
- package/dist/development/src/model/commands/person/CreatePersonCommand.js.map +1 -1
- package/dist/development/src/model/commands/person/EnablePersonCommand.cjs +17 -0
- package/dist/development/src/model/commands/person/EnablePersonCommand.cjs.map +1 -0
- package/dist/development/src/model/commands/person/EnablePersonCommand.js +17 -0
- package/dist/development/src/model/commands/person/EnablePersonCommand.js.map +1 -0
- package/dist/development/src/model/commands/person/SetMfaGraceUntilCommand.cjs +3 -3
- package/dist/development/src/model/commands/person/SetMfaGraceUntilCommand.cjs.map +1 -1
- package/dist/development/src/model/commands/person/SetMfaGraceUntilCommand.js +4 -4
- package/dist/development/src/model/commands/person/SetMfaGraceUntilCommand.js.map +1 -1
- package/dist/development/src/model/commands/personToken/ResetPasswordCommand.cjs +2 -3
- package/dist/development/src/model/commands/personToken/ResetPasswordCommand.cjs.map +1 -1
- package/dist/development/src/model/commands/personToken/ResetPasswordCommand.js +2 -3
- package/dist/development/src/model/commands/personToken/ResetPasswordCommand.js.map +1 -1
- package/dist/development/src/model/commands/personToken/SaveEmailOtpTokenCommand.cjs +3 -3
- package/dist/development/src/model/commands/personToken/SaveEmailOtpTokenCommand.cjs.map +1 -1
- package/dist/development/src/model/commands/personToken/SaveEmailOtpTokenCommand.js +4 -4
- package/dist/development/src/model/commands/personToken/SaveEmailOtpTokenCommand.js.map +1 -1
- package/dist/development/src/model/commands/personToken/SavePersonTokenCommand.cjs +12 -6
- package/dist/development/src/model/commands/personToken/SavePersonTokenCommand.cjs.map +1 -1
- package/dist/development/src/model/commands/personToken/SavePersonTokenCommand.js +13 -7
- package/dist/development/src/model/commands/personToken/SavePersonTokenCommand.js.map +1 -1
- package/dist/development/src/model/commands/rateLimit/RecordRateLimitEventCommand.cjs +1 -2
- package/dist/development/src/model/commands/rateLimit/RecordRateLimitEventCommand.cjs.map +1 -1
- package/dist/development/src/model/commands/rateLimit/RecordRateLimitEventCommand.js +1 -2
- package/dist/development/src/model/commands/rateLimit/RecordRateLimitEventCommand.js.map +1 -1
- package/dist/development/src/model/mailing/UserMailer.cjs +2 -1
- package/dist/development/src/model/mailing/UserMailer.cjs.map +1 -1
- package/dist/development/src/model/mailing/UserMailer.js +2 -1
- package/dist/development/src/model/mailing/UserMailer.js.map +1 -1
- package/dist/development/src/model/queries/apiKey/ApiKeyQuery.cjs +8 -1
- package/dist/development/src/model/queries/apiKey/ApiKeyQuery.cjs.map +1 -1
- package/dist/development/src/model/queries/apiKey/ApiKeyQuery.js +9 -2
- package/dist/development/src/model/queries/apiKey/ApiKeyQuery.js.map +1 -1
- package/dist/development/src/model/queries/apiKey/ApiKeySessionsQuery.cjs +2 -3
- package/dist/development/src/model/queries/apiKey/ApiKeySessionsQuery.cjs.map +1 -1
- package/dist/development/src/model/queries/apiKey/ApiKeySessionsQuery.js +2 -3
- package/dist/development/src/model/queries/apiKey/ApiKeySessionsQuery.js.map +1 -1
- package/dist/development/src/model/queries/authLog/NextLoginAttemptQuery.cjs +12 -10
- package/dist/development/src/model/queries/authLog/NextLoginAttemptQuery.cjs.map +1 -1
- package/dist/development/src/model/queries/authLog/NextLoginAttemptQuery.js +12 -10
- package/dist/development/src/model/queries/authLog/NextLoginAttemptQuery.js.map +1 -1
- package/dist/development/src/model/queries/authLog/NextMailAttemptQuery.cjs +10 -8
- package/dist/development/src/model/queries/authLog/NextMailAttemptQuery.cjs.map +1 -1
- package/dist/development/src/model/queries/authLog/NextMailAttemptQuery.js +10 -8
- package/dist/development/src/model/queries/authLog/NextMailAttemptQuery.js.map +1 -1
- package/dist/development/src/model/queries/configuration/ConfigurationQuery.cjs +4 -0
- package/dist/development/src/model/queries/configuration/ConfigurationQuery.cjs.map +1 -1
- package/dist/development/src/model/queries/configuration/ConfigurationQuery.js +4 -0
- package/dist/development/src/model/queries/configuration/ConfigurationQuery.js.map +1 -1
- package/dist/development/src/model/queries/customRole/CustomRolesQuery.cjs +23 -0
- package/dist/development/src/model/queries/customRole/CustomRolesQuery.cjs.map +1 -0
- package/dist/development/src/model/queries/customRole/CustomRolesQuery.js +23 -0
- package/dist/development/src/model/queries/customRole/CustomRolesQuery.js.map +1 -0
- package/dist/development/src/model/queries/identity/IdentitiesHoldingRoleCountQuery.cjs +15 -0
- package/dist/development/src/model/queries/identity/IdentitiesHoldingRoleCountQuery.cjs.map +1 -0
- package/dist/development/src/model/queries/identity/IdentitiesHoldingRoleCountQuery.js +15 -0
- package/dist/development/src/model/queries/identity/IdentitiesHoldingRoleCountQuery.js.map +1 -0
- package/dist/development/src/model/queries/identity/IdentityQuery.cjs +7 -2
- package/dist/development/src/model/queries/identity/IdentityQuery.cjs.map +1 -1
- package/dist/development/src/model/queries/identity/IdentityQuery.js +7 -2
- package/dist/development/src/model/queries/identity/IdentityQuery.js.map +1 -1
- package/dist/development/src/model/queries/idp/LocalAuthDisablingIdpsQuery.cjs +21 -0
- package/dist/development/src/model/queries/idp/LocalAuthDisablingIdpsQuery.cjs.map +1 -0
- package/dist/development/src/model/queries/idp/LocalAuthDisablingIdpsQuery.js +21 -0
- package/dist/development/src/model/queries/idp/LocalAuthDisablingIdpsQuery.js.map +1 -0
- package/dist/development/src/model/queries/idp/PersonIdentityProvidersQuery.cjs +1 -1
- package/dist/development/src/model/queries/idp/PersonIdentityProvidersQuery.cjs.map +1 -1
- package/dist/development/src/model/queries/idp/PersonIdentityProvidersQuery.js +1 -1
- package/dist/development/src/model/queries/idp/PersonIdentityProvidersQuery.js.map +1 -1
- package/dist/development/src/model/queries/idp/helpers.cjs +3 -3
- package/dist/development/src/model/queries/idp/helpers.cjs.map +1 -1
- package/dist/development/src/model/queries/idp/helpers.js +3 -3
- package/dist/development/src/model/queries/idp/helpers.js.map +1 -1
- package/dist/development/src/model/queries/membership/IdentityHasProjectMembershipsQuery.cjs +15 -0
- package/dist/development/src/model/queries/membership/IdentityHasProjectMembershipsQuery.cjs.map +1 -0
- package/dist/development/src/model/queries/membership/IdentityHasProjectMembershipsQuery.js +15 -0
- package/dist/development/src/model/queries/membership/IdentityHasProjectMembershipsQuery.js.map +1 -0
- package/dist/development/src/model/queries/membership/ProjectMembersQuery.cjs +1 -1
- package/dist/development/src/model/queries/membership/ProjectMembersQuery.cjs.map +1 -1
- package/dist/development/src/model/queries/membership/ProjectMembersQuery.js +1 -1
- package/dist/development/src/model/queries/membership/ProjectMembersQuery.js.map +1 -1
- package/dist/development/src/model/queries/person/PersonQueryBuilderFactory.cjs +2 -2
- package/dist/development/src/model/queries/person/PersonQueryBuilderFactory.cjs.map +1 -1
- package/dist/development/src/model/queries/person/PersonQueryBuilderFactory.js +2 -2
- package/dist/development/src/model/queries/person/PersonQueryBuilderFactory.js.map +1 -1
- package/dist/development/src/model/queries/personToken/PersonTokenQuery.cjs +1 -1
- package/dist/development/src/model/queries/personToken/PersonTokenQuery.cjs.map +1 -1
- package/dist/development/src/model/queries/personToken/PersonTokenQuery.js +1 -1
- package/dist/development/src/model/queries/personToken/PersonTokenQuery.js.map +1 -1
- package/dist/development/src/model/queries/project/ProjectsByIdentityQuery.cjs +4 -1
- package/dist/development/src/model/queries/project/ProjectsByIdentityQuery.cjs.map +1 -1
- package/dist/development/src/model/queries/project/ProjectsByIdentityQuery.js +4 -1
- package/dist/development/src/model/queries/project/ProjectsByIdentityQuery.js.map +1 -1
- package/dist/development/src/model/queries/rateLimit/RateLimitCountQuery.cjs +3 -3
- package/dist/development/src/model/queries/rateLimit/RateLimitCountQuery.cjs.map +1 -1
- package/dist/development/src/model/queries/rateLimit/RateLimitCountQuery.js +3 -3
- package/dist/development/src/model/queries/rateLimit/RateLimitCountQuery.js.map +1 -1
- package/dist/development/src/model/service/AuthLogService.cjs +8 -2
- package/dist/development/src/model/service/AuthLogService.cjs.map +1 -1
- package/dist/development/src/model/service/AuthLogService.js +8 -2
- package/dist/development/src/model/service/AuthLogService.js.map +1 -1
- package/dist/development/src/model/service/AuthPolicyManager.cjs +2 -1
- package/dist/development/src/model/service/AuthPolicyManager.cjs.map +1 -1
- package/dist/development/src/model/service/AuthPolicyManager.js +2 -1
- package/dist/development/src/model/service/AuthPolicyManager.js.map +1 -1
- package/dist/development/src/model/service/AuthPolicyResolver.cjs +2 -1
- package/dist/development/src/model/service/AuthPolicyResolver.cjs.map +1 -1
- package/dist/development/src/model/service/AuthPolicyResolver.js +2 -1
- package/dist/development/src/model/service/AuthPolicyResolver.js.map +1 -1
- package/dist/development/src/model/service/CustomRoleManager.cjs +170 -0
- package/dist/development/src/model/service/CustomRoleManager.cjs.map +1 -0
- package/dist/development/src/model/service/CustomRoleManager.js +170 -0
- package/dist/development/src/model/service/CustomRoleManager.js.map +1 -0
- package/dist/development/src/model/service/EmailChangeManager.cjs +5 -4
- package/dist/development/src/model/service/EmailChangeManager.cjs.map +1 -1
- package/dist/development/src/model/service/EmailChangeManager.js +5 -4
- package/dist/development/src/model/service/EmailChangeManager.js.map +1 -1
- package/dist/development/src/model/service/EmailOtpManager.cjs +0 -1
- package/dist/development/src/model/service/EmailOtpManager.cjs.map +1 -1
- package/dist/development/src/model/service/EmailOtpManager.js +0 -1
- package/dist/development/src/model/service/EmailOtpManager.js.map +1 -1
- package/dist/development/src/model/service/EmailValidator.cjs +2 -1
- package/dist/development/src/model/service/EmailValidator.cjs.map +1 -1
- package/dist/development/src/model/service/EmailValidator.js +2 -1
- package/dist/development/src/model/service/EmailValidator.js.map +1 -1
- package/dist/development/src/model/service/EmailVerificationManager.cjs +5 -4
- package/dist/development/src/model/service/EmailVerificationManager.cjs.map +1 -1
- package/dist/development/src/model/service/EmailVerificationManager.js +5 -4
- package/dist/development/src/model/service/EmailVerificationManager.js.map +1 -1
- package/dist/development/src/model/service/GlobalRoleValidator.cjs +35 -0
- package/dist/development/src/model/service/GlobalRoleValidator.cjs.map +1 -0
- package/dist/development/src/model/service/GlobalRoleValidator.js +35 -0
- package/dist/development/src/model/service/GlobalRoleValidator.js.map +1 -0
- package/dist/development/src/model/service/IDPSignInManager.cjs +52 -16
- package/dist/development/src/model/service/IDPSignInManager.cjs.map +1 -1
- package/dist/development/src/model/service/IDPSignInManager.js +52 -16
- package/dist/development/src/model/service/IDPSignInManager.js.map +1 -1
- package/dist/development/src/model/service/InviteManager.cjs +2 -1
- package/dist/development/src/model/service/InviteManager.cjs.map +1 -1
- package/dist/development/src/model/service/InviteManager.js +2 -1
- package/dist/development/src/model/service/InviteManager.js.map +1 -1
- package/dist/development/src/model/service/PanelAccessResolver.cjs +32 -0
- package/dist/development/src/model/service/PanelAccessResolver.cjs.map +1 -0
- package/dist/development/src/model/service/PanelAccessResolver.js +32 -0
- package/dist/development/src/model/service/PanelAccessResolver.js.map +1 -0
- package/dist/development/src/model/service/PasswordChangeManager.cjs +2 -1
- package/dist/development/src/model/service/PasswordChangeManager.cjs.map +1 -1
- package/dist/development/src/model/service/PasswordChangeManager.js +2 -1
- package/dist/development/src/model/service/PasswordChangeManager.js.map +1 -1
- package/dist/development/src/model/service/PasswordResetManager.cjs +9 -3
- package/dist/development/src/model/service/PasswordResetManager.cjs.map +1 -1
- package/dist/development/src/model/service/PasswordResetManager.js +9 -3
- package/dist/development/src/model/service/PasswordResetManager.js.map +1 -1
- package/dist/development/src/model/service/PasswordlessSignInManager.cjs +24 -6
- package/dist/development/src/model/service/PasswordlessSignInManager.cjs.map +1 -1
- package/dist/development/src/model/service/PasswordlessSignInManager.js +24 -6
- package/dist/development/src/model/service/PasswordlessSignInManager.js.map +1 -1
- package/dist/development/src/model/service/PersonAccessManager.cjs +10 -2
- package/dist/development/src/model/service/PersonAccessManager.cjs.map +1 -1
- package/dist/development/src/model/service/PersonAccessManager.js +10 -2
- package/dist/development/src/model/service/PersonAccessManager.js.map +1 -1
- package/dist/development/src/model/service/PersonManager.cjs +2 -1
- package/dist/development/src/model/service/PersonManager.cjs.map +1 -1
- package/dist/development/src/model/service/PersonManager.js +2 -1
- package/dist/development/src/model/service/PersonManager.js.map +1 -1
- package/dist/development/src/model/service/ProjectMemberManager.cjs +2 -1
- package/dist/development/src/model/service/ProjectMemberManager.cjs.map +1 -1
- package/dist/development/src/model/service/ProjectMemberManager.js +2 -1
- package/dist/development/src/model/service/ProjectMemberManager.js.map +1 -1
- package/dist/development/src/model/service/RateLimiter.cjs +1 -2
- package/dist/development/src/model/service/RateLimiter.cjs.map +1 -1
- package/dist/development/src/model/service/RateLimiter.js +1 -2
- package/dist/development/src/model/service/RateLimiter.js.map +1 -1
- package/dist/development/src/model/service/RolesManager.cjs +17 -18
- package/dist/development/src/model/service/RolesManager.cjs.map +1 -1
- package/dist/development/src/model/service/RolesManager.js +18 -19
- package/dist/development/src/model/service/RolesManager.js.map +1 -1
- package/dist/development/src/model/service/SecretsManager.cjs +2 -1
- package/dist/development/src/model/service/SecretsManager.cjs.map +1 -1
- package/dist/development/src/model/service/SecretsManager.js +2 -1
- package/dist/development/src/model/service/SecretsManager.js.map +1 -1
- package/dist/development/src/model/service/SignInManager.cjs +9 -5
- package/dist/development/src/model/service/SignInManager.cjs.map +1 -1
- package/dist/development/src/model/service/SignInManager.js +9 -5
- package/dist/development/src/model/service/SignInManager.js.map +1 -1
- package/dist/development/src/model/service/SignOutManager.cjs +2 -1
- package/dist/development/src/model/service/SignOutManager.cjs.map +1 -1
- package/dist/development/src/model/service/SignOutManager.js +2 -1
- package/dist/development/src/model/service/SignOutManager.js.map +1 -1
- package/dist/development/src/model/service/SignUpManager.cjs +15 -7
- package/dist/development/src/model/service/SignUpManager.cjs.map +1 -1
- package/dist/development/src/model/service/SignUpManager.js +15 -7
- package/dist/development/src/model/service/SignUpManager.js.map +1 -1
- package/dist/development/src/model/service/apiKey/ApiKeyManager.cjs +56 -40
- package/dist/development/src/model/service/apiKey/ApiKeyManager.cjs.map +1 -1
- package/dist/development/src/model/service/apiKey/ApiKeyManager.js +57 -41
- package/dist/development/src/model/service/apiKey/ApiKeyManager.js.map +1 -1
- package/dist/development/src/model/service/apiKey/ApiKeyService.cjs.map +1 -1
- package/dist/development/src/model/service/apiKey/ApiKeyService.js.map +1 -1
- package/dist/development/src/model/service/apiKey/UnpersistedApiKeyManager.cjs +10 -1
- package/dist/development/src/model/service/apiKey/UnpersistedApiKeyManager.cjs.map +1 -1
- package/dist/development/src/model/service/apiKey/UnpersistedApiKeyManager.js +11 -2
- package/dist/development/src/model/service/apiKey/UnpersistedApiKeyManager.js.map +1 -1
- package/dist/development/src/model/service/idp/ClaimMapping.cjs +187 -0
- package/dist/development/src/model/service/idp/ClaimMapping.cjs.map +1 -0
- package/dist/development/src/model/service/idp/ClaimMapping.js +170 -0
- package/dist/development/src/model/service/idp/ClaimMapping.js.map +1 -0
- package/dist/development/src/model/service/idp/ClaimMappingEvaluator.cjs +155 -0
- package/dist/development/src/model/service/idp/ClaimMappingEvaluator.cjs.map +1 -0
- package/dist/development/src/model/service/idp/ClaimMappingEvaluator.js +155 -0
- package/dist/development/src/model/service/idp/ClaimMappingEvaluator.js.map +1 -0
- package/dist/development/src/model/service/idp/ClaimMappingValidation.cjs +83 -0
- package/dist/development/src/model/service/idp/ClaimMappingValidation.cjs.map +1 -0
- package/dist/development/src/model/service/idp/ClaimMappingValidation.js +83 -0
- package/dist/development/src/model/service/idp/ClaimMappingValidation.js.map +1 -0
- package/dist/development/src/model/service/idp/IDPClaimSyncService.cjs +261 -0
- package/dist/development/src/model/service/idp/IDPClaimSyncService.cjs.map +1 -0
- package/dist/development/src/model/service/idp/IDPClaimSyncService.js +261 -0
- package/dist/development/src/model/service/idp/IDPClaimSyncService.js.map +1 -0
- package/dist/development/src/model/service/idp/IDPManager.cjs +98 -21
- package/dist/development/src/model/service/idp/IDPManager.cjs.map +1 -1
- package/dist/development/src/model/service/idp/IDPManager.js +98 -21
- package/dist/development/src/model/service/idp/IDPManager.js.map +1 -1
- package/dist/development/src/model/service/idp/IdpSessionRevalidator.cjs +93 -28
- package/dist/development/src/model/service/idp/IdpSessionRevalidator.cjs.map +1 -1
- package/dist/development/src/model/service/idp/IdpSessionRevalidator.js +93 -28
- package/dist/development/src/model/service/idp/IdpSessionRevalidator.js.map +1 -1
- package/dist/development/src/model/service/idp/PersonIdentityProviderManager.cjs +8 -1
- package/dist/development/src/model/service/idp/PersonIdentityProviderManager.cjs.map +1 -1
- package/dist/development/src/model/service/idp/PersonIdentityProviderManager.js +8 -1
- package/dist/development/src/model/service/idp/PersonIdentityProviderManager.js.map +1 -1
- package/dist/development/src/model/service/idp/providers/OIDCHelpers.cjs +69 -33
- package/dist/development/src/model/service/idp/providers/OIDCHelpers.cjs.map +1 -1
- package/dist/development/src/model/service/idp/providers/OIDCHelpers.js +69 -33
- package/dist/development/src/model/service/idp/providers/OIDCHelpers.js.map +1 -1
- package/dist/development/src/model/service/idp/providers/OIDCProvider.cjs +4 -1
- package/dist/development/src/model/service/idp/providers/OIDCProvider.cjs.map +1 -1
- package/dist/development/src/model/service/idp/providers/OIDCProvider.js +4 -1
- package/dist/development/src/model/service/idp/providers/OIDCProvider.js.map +1 -1
- package/dist/development/src/model/utils/DatabaseContext.cjs +10 -3
- package/dist/development/src/model/utils/DatabaseContext.cjs.map +1 -1
- package/dist/development/src/model/utils/DatabaseContext.js +11 -4
- package/dist/development/src/model/utils/DatabaseContext.js.map +1 -1
- package/dist/development/src/model/utils/token.cjs +2 -2
- package/dist/development/src/model/utils/token.cjs.map +1 -1
- package/dist/development/src/model/utils/token.js +2 -2
- package/dist/development/src/model/utils/token.js.map +1 -1
- package/dist/development/src/resolvers/ResolverFactory.cjs +12 -3
- package/dist/development/src/resolvers/ResolverFactory.cjs.map +1 -1
- package/dist/development/src/resolvers/ResolverFactory.js +12 -3
- package/dist/development/src/resolvers/ResolverFactory.js.map +1 -1
- package/dist/development/src/resolvers/TenantResolverContextFactory.cjs +4 -4
- package/dist/development/src/resolvers/TenantResolverContextFactory.cjs.map +1 -1
- package/dist/development/src/resolvers/TenantResolverContextFactory.js +4 -4
- package/dist/development/src/resolvers/TenantResolverContextFactory.js.map +1 -1
- package/dist/development/src/resolvers/mutation/apiKey/CreateApiKeyMutationResolver.cjs +19 -9
- package/dist/development/src/resolvers/mutation/apiKey/CreateApiKeyMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/apiKey/CreateApiKeyMutationResolver.js +20 -10
- package/dist/development/src/resolvers/mutation/apiKey/CreateApiKeyMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/apiKey/DisableApiKeyMutationResolver.cjs +7 -5
- package/dist/development/src/resolvers/mutation/apiKey/DisableApiKeyMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/apiKey/DisableApiKeyMutationResolver.js +7 -5
- package/dist/development/src/resolvers/mutation/apiKey/DisableApiKeyMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/configuration/AuthPolicyMutationResolver.cjs +7 -5
- package/dist/development/src/resolvers/mutation/configuration/AuthPolicyMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/configuration/AuthPolicyMutationResolver.js +7 -5
- package/dist/development/src/resolvers/mutation/configuration/AuthPolicyMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/configuration/ConfigurationMutationResolver.cjs +7 -5
- package/dist/development/src/resolvers/mutation/configuration/ConfigurationMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/configuration/ConfigurationMutationResolver.js +7 -5
- package/dist/development/src/resolvers/mutation/configuration/ConfigurationMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/customRole/CustomRoleMutationResolver.cjs +124 -0
- package/dist/development/src/resolvers/mutation/customRole/CustomRoleMutationResolver.cjs.map +1 -0
- package/dist/development/src/resolvers/mutation/customRole/CustomRoleMutationResolver.js +124 -0
- package/dist/development/src/resolvers/mutation/customRole/CustomRoleMutationResolver.js.map +1 -0
- package/dist/development/src/resolvers/mutation/identity/GlobalRolesMutationResolver.cjs +35 -11
- package/dist/development/src/resolvers/mutation/identity/GlobalRolesMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/identity/GlobalRolesMutationResolver.js +35 -11
- package/dist/development/src/resolvers/mutation/identity/GlobalRolesMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/idp/AddIDPMutationResolver.cjs +10 -7
- package/dist/development/src/resolvers/mutation/idp/AddIDPMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/idp/AddIDPMutationResolver.js +10 -7
- package/dist/development/src/resolvers/mutation/idp/AddIDPMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/idp/DisableIDPMutationResolver.cjs +7 -5
- package/dist/development/src/resolvers/mutation/idp/DisableIDPMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/idp/DisableIDPMutationResolver.js +7 -5
- package/dist/development/src/resolvers/mutation/idp/DisableIDPMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/idp/DisconnectMyIdentityProviderMutationResolver.cjs +8 -6
- package/dist/development/src/resolvers/mutation/idp/DisconnectMyIdentityProviderMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/idp/DisconnectMyIdentityProviderMutationResolver.js +8 -6
- package/dist/development/src/resolvers/mutation/idp/DisconnectMyIdentityProviderMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/idp/EnableIDPMutationResolver.cjs +7 -5
- package/dist/development/src/resolvers/mutation/idp/EnableIDPMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/idp/EnableIDPMutationResolver.js +7 -5
- package/dist/development/src/resolvers/mutation/idp/EnableIDPMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/idp/UpdateIDPMutationResolver.cjs +10 -7
- package/dist/development/src/resolvers/mutation/idp/UpdateIDPMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/idp/UpdateIDPMutationResolver.js +10 -7
- package/dist/development/src/resolvers/mutation/idp/UpdateIDPMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/idp/audit.cjs +1 -0
- package/dist/development/src/resolvers/mutation/idp/audit.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/idp/audit.js +1 -0
- package/dist/development/src/resolvers/mutation/idp/audit.js.map +1 -1
- package/dist/development/src/resolvers/mutation/mailTemplates/MailTemplateMutationResolver.cjs +38 -18
- package/dist/development/src/resolvers/mutation/mailTemplates/MailTemplateMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/mailTemplates/MailTemplateMutationResolver.js +38 -18
- package/dist/development/src/resolvers/mutation/mailTemplates/MailTemplateMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/person/ChangePasswordMutationResolver.cjs +10 -8
- package/dist/development/src/resolvers/mutation/person/ChangePasswordMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/person/ChangePasswordMutationResolver.js +10 -8
- package/dist/development/src/resolvers/mutation/person/ChangePasswordMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/person/ChangeProfileMutationResolver.cjs +17 -11
- package/dist/development/src/resolvers/mutation/person/ChangeProfileMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/person/ChangeProfileMutationResolver.js +17 -11
- package/dist/development/src/resolvers/mutation/person/ChangeProfileMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/person/DisablePersonMutationResolver.cjs +10 -8
- package/dist/development/src/resolvers/mutation/person/DisablePersonMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/person/DisablePersonMutationResolver.js +10 -8
- package/dist/development/src/resolvers/mutation/person/DisablePersonMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/person/EmailOtpMutationResolver.cjs +10 -8
- package/dist/development/src/resolvers/mutation/person/EmailOtpMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/person/EmailOtpMutationResolver.js +10 -8
- package/dist/development/src/resolvers/mutation/person/EmailOtpMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/person/EmailVerificationMutationResolver.cjs +10 -8
- package/dist/development/src/resolvers/mutation/person/EmailVerificationMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/person/EmailVerificationMutationResolver.js +10 -8
- package/dist/development/src/resolvers/mutation/person/EmailVerificationMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/person/EnablePersonMutationResolver.cjs +61 -0
- package/dist/development/src/resolvers/mutation/person/EnablePersonMutationResolver.cjs.map +1 -0
- package/dist/development/src/resolvers/mutation/person/EnablePersonMutationResolver.js +61 -0
- package/dist/development/src/resolvers/mutation/person/EnablePersonMutationResolver.js.map +1 -0
- package/dist/development/src/resolvers/mutation/person/ForceSignOutMutationResolver.cjs +8 -6
- package/dist/development/src/resolvers/mutation/person/ForceSignOutMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/person/ForceSignOutMutationResolver.js +8 -6
- package/dist/development/src/resolvers/mutation/person/ForceSignOutMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/person/IDPMutationResolver.cjs +32 -5
- package/dist/development/src/resolvers/mutation/person/IDPMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/person/IDPMutationResolver.js +32 -5
- package/dist/development/src/resolvers/mutation/person/IDPMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/person/InviteMutationResolver.cjs +7 -5
- package/dist/development/src/resolvers/mutation/person/InviteMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/person/InviteMutationResolver.js +7 -5
- package/dist/development/src/resolvers/mutation/person/InviteMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/person/OtpMutationResolver.cjs +9 -7
- package/dist/development/src/resolvers/mutation/person/OtpMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/person/OtpMutationResolver.js +9 -7
- package/dist/development/src/resolvers/mutation/person/OtpMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/person/PasswordlessMutationResolver.cjs +12 -6
- package/dist/development/src/resolvers/mutation/person/PasswordlessMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/person/PasswordlessMutationResolver.js +12 -6
- package/dist/development/src/resolvers/mutation/person/PasswordlessMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/person/RegenerateBackupCodesMutationResolver.cjs +9 -7
- package/dist/development/src/resolvers/mutation/person/RegenerateBackupCodesMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/person/RegenerateBackupCodesMutationResolver.js +9 -7
- package/dist/development/src/resolvers/mutation/person/RegenerateBackupCodesMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/person/ResetPasswordMutationResolver.cjs +10 -8
- package/dist/development/src/resolvers/mutation/person/ResetPasswordMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/person/ResetPasswordMutationResolver.js +10 -8
- package/dist/development/src/resolvers/mutation/person/ResetPasswordMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/person/ResetPersonMfaMutationResolver.cjs +8 -6
- package/dist/development/src/resolvers/mutation/person/ResetPersonMfaMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/person/ResetPersonMfaMutationResolver.js +8 -6
- package/dist/development/src/resolvers/mutation/person/ResetPersonMfaMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/person/RevokeSessionMutationResolver.cjs +8 -6
- package/dist/development/src/resolvers/mutation/person/RevokeSessionMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/person/RevokeSessionMutationResolver.js +8 -6
- package/dist/development/src/resolvers/mutation/person/RevokeSessionMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/person/SignInMutationResolver.cjs +22 -14
- package/dist/development/src/resolvers/mutation/person/SignInMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/person/SignInMutationResolver.js +22 -14
- package/dist/development/src/resolvers/mutation/person/SignInMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/person/SignOutMutationResolver.cjs +7 -5
- package/dist/development/src/resolvers/mutation/person/SignOutMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/person/SignOutMutationResolver.js +7 -5
- package/dist/development/src/resolvers/mutation/person/SignOutMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/person/SignUpMutationResolver.cjs +10 -8
- package/dist/development/src/resolvers/mutation/person/SignUpMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/person/SignUpMutationResolver.js +10 -8
- package/dist/development/src/resolvers/mutation/person/SignUpMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/person/TogglePasswordlessMutationResolver.cjs +9 -7
- package/dist/development/src/resolvers/mutation/person/TogglePasswordlessMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/person/TogglePasswordlessMutationResolver.js +9 -7
- package/dist/development/src/resolvers/mutation/person/TogglePasswordlessMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/project/CreateProjectMutationResolver.cjs +7 -5
- package/dist/development/src/resolvers/mutation/project/CreateProjectMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/project/CreateProjectMutationResolver.js +7 -5
- package/dist/development/src/resolvers/mutation/project/CreateProjectMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/project/SetProjectSecretMutationResolver.cjs +7 -5
- package/dist/development/src/resolvers/mutation/project/SetProjectSecretMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/project/SetProjectSecretMutationResolver.js +7 -5
- package/dist/development/src/resolvers/mutation/project/SetProjectSecretMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/project/UpdateProjectMutationResolver.cjs +7 -5
- package/dist/development/src/resolvers/mutation/project/UpdateProjectMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/project/UpdateProjectMutationResolver.js +7 -5
- package/dist/development/src/resolvers/mutation/project/UpdateProjectMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/projectMember/AddProjectMemberMutationResolver.cjs +7 -5
- package/dist/development/src/resolvers/mutation/projectMember/AddProjectMemberMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/projectMember/AddProjectMemberMutationResolver.js +7 -5
- package/dist/development/src/resolvers/mutation/projectMember/AddProjectMemberMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/projectMember/RemoveProjectMemberMutationResolver.cjs +8 -6
- package/dist/development/src/resolvers/mutation/projectMember/RemoveProjectMemberMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/projectMember/RemoveProjectMemberMutationResolver.js +8 -6
- package/dist/development/src/resolvers/mutation/projectMember/RemoveProjectMemberMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/projectMember/UpdateProjectMemberMutationResolver.cjs +8 -6
- package/dist/development/src/resolvers/mutation/projectMember/UpdateProjectMemberMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/projectMember/UpdateProjectMemberMutationResolver.js +8 -6
- package/dist/development/src/resolvers/mutation/projectMember/UpdateProjectMemberMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/projectMember/audit.cjs +2 -1
- package/dist/development/src/resolvers/mutation/projectMember/audit.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/projectMember/audit.js +2 -1
- package/dist/development/src/resolvers/mutation/projectMember/audit.js.map +1 -1
- package/dist/development/src/resolvers/query/ApiKeyQueryResolver.cjs +8 -6
- package/dist/development/src/resolvers/query/ApiKeyQueryResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/query/ApiKeyQueryResolver.js +8 -6
- package/dist/development/src/resolvers/query/ApiKeyQueryResolver.js.map +1 -1
- package/dist/development/src/resolvers/query/AuthLogQueryResolver.cjs +7 -5
- package/dist/development/src/resolvers/query/AuthLogQueryResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/query/AuthLogQueryResolver.js +7 -5
- package/dist/development/src/resolvers/query/AuthLogQueryResolver.js.map +1 -1
- package/dist/development/src/resolvers/query/AuthPolicyQueryResolver.cjs +8 -6
- package/dist/development/src/resolvers/query/AuthPolicyQueryResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/query/AuthPolicyQueryResolver.js +8 -6
- package/dist/development/src/resolvers/query/AuthPolicyQueryResolver.js.map +1 -1
- package/dist/development/src/resolvers/query/ConfigurationQueryResolver.cjs +8 -6
- package/dist/development/src/resolvers/query/ConfigurationQueryResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/query/ConfigurationQueryResolver.js +8 -6
- package/dist/development/src/resolvers/query/ConfigurationQueryResolver.js.map +1 -1
- package/dist/development/src/resolvers/query/CustomRoleQueryResolver.cjs +55 -0
- package/dist/development/src/resolvers/query/CustomRoleQueryResolver.cjs.map +1 -0
- package/dist/development/src/resolvers/query/CustomRoleQueryResolver.js +55 -0
- package/dist/development/src/resolvers/query/CustomRoleQueryResolver.js.map +1 -0
- package/dist/development/src/resolvers/query/IDPQueryResolver.cjs +7 -5
- package/dist/development/src/resolvers/query/IDPQueryResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/query/IDPQueryResolver.js +7 -5
- package/dist/development/src/resolvers/query/IDPQueryResolver.js.map +1 -1
- package/dist/development/src/resolvers/query/MailTemplateQueryResolver.cjs +21 -14
- package/dist/development/src/resolvers/query/MailTemplateQueryResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/query/MailTemplateQueryResolver.js +21 -14
- package/dist/development/src/resolvers/query/MailTemplateQueryResolver.js.map +1 -1
- package/dist/development/src/resolvers/query/PersonQueryResolver.cjs +7 -5
- package/dist/development/src/resolvers/query/PersonQueryResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/query/PersonQueryResolver.js +7 -5
- package/dist/development/src/resolvers/query/PersonQueryResolver.js.map +1 -1
- package/dist/development/src/resolvers/query/ProjectMembersQueryResolver.cjs +7 -5
- package/dist/development/src/resolvers/query/ProjectMembersQueryResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/query/ProjectMembersQueryResolver.js +7 -5
- package/dist/development/src/resolvers/query/ProjectMembersQueryResolver.js.map +1 -1
- package/dist/development/src/resolvers/query/ProjectQueryResolver.cjs +10 -7
- package/dist/development/src/resolvers/query/ProjectQueryResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/query/ProjectQueryResolver.js +10 -7
- package/dist/development/src/resolvers/query/ProjectQueryResolver.js.map +1 -1
- package/dist/development/src/resolvers/responseHelpers/ApiKeyResponseFactory.cjs +7 -5
- package/dist/development/src/resolvers/responseHelpers/ApiKeyResponseFactory.cjs.map +1 -1
- package/dist/development/src/resolvers/responseHelpers/ApiKeyResponseFactory.js +7 -5
- package/dist/development/src/resolvers/responseHelpers/ApiKeyResponseFactory.js.map +1 -1
- package/dist/development/src/resolvers/responseHelpers/PersonResponseFactory.cjs +5 -0
- package/dist/development/src/resolvers/responseHelpers/PersonResponseFactory.cjs.map +1 -1
- package/dist/development/src/resolvers/responseHelpers/PersonResponseFactory.js +5 -0
- package/dist/development/src/resolvers/responseHelpers/PersonResponseFactory.js.map +1 -1
- package/dist/development/src/resolvers/responseHelpers/ProjectResponseFactory.cjs +23 -0
- package/dist/development/src/resolvers/responseHelpers/ProjectResponseFactory.cjs.map +1 -0
- package/dist/development/src/resolvers/responseHelpers/ProjectResponseFactory.js +23 -0
- package/dist/development/src/resolvers/responseHelpers/ProjectResponseFactory.js.map +1 -0
- package/dist/development/src/resolvers/responseHelpers/SignInResponseFactory.cjs +8 -6
- package/dist/development/src/resolvers/responseHelpers/SignInResponseFactory.cjs.map +1 -1
- package/dist/development/src/resolvers/responseHelpers/SignInResponseFactory.js +8 -6
- package/dist/development/src/resolvers/responseHelpers/SignInResponseFactory.js.map +1 -1
- package/dist/development/src/resolvers/types/IdentityTypeResolver.cjs +50 -18
- package/dist/development/src/resolvers/types/IdentityTypeResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/types/IdentityTypeResolver.js +50 -18
- package/dist/development/src/resolvers/types/IdentityTypeResolver.js.map +1 -1
- package/dist/development/src/resolvers/types/PersonTypeResolver.cjs +38 -8
- package/dist/development/src/resolvers/types/PersonTypeResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/types/PersonTypeResolver.js +38 -8
- package/dist/development/src/resolvers/types/PersonTypeResolver.js.map +1 -1
- package/dist/development/src/resolvers/types/ProjectTypeResolver.cjs +31 -6
- package/dist/development/src/resolvers/types/ProjectTypeResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/types/ProjectTypeResolver.js +31 -6
- package/dist/development/src/resolvers/types/ProjectTypeResolver.js.map +1 -1
- package/dist/development/src/schema/tenant.graphql.cjs +275 -15
- package/dist/development/src/schema/tenant.graphql.cjs.map +1 -1
- package/dist/development/src/schema/tenant.graphql.js +275 -15
- package/dist/development/src/schema/tenant.graphql.js.map +1 -1
- package/dist/production/index.cjs +69 -0
- package/dist/production/index.cjs.map +1 -1
- package/dist/production/index.js +71 -2
- package/dist/production/index.js.map +1 -1
- package/dist/production/src/TenantContainer.cjs +39 -10
- package/dist/production/src/TenantContainer.cjs.map +1 -1
- package/dist/production/src/TenantContainer.js +39 -10
- package/dist/production/src/TenantContainer.js.map +1 -1
- package/dist/production/src/bridges/system/IdentityFetcher.cjs +9 -7
- package/dist/production/src/bridges/system/IdentityFetcher.cjs.map +1 -1
- package/dist/production/src/bridges/system/IdentityFetcher.js +9 -7
- package/dist/production/src/bridges/system/IdentityFetcher.js.map +1 -1
- package/dist/production/src/migrations/2026-06-18-120000-idp-claim-mapping.cjs +10 -0
- package/dist/production/src/migrations/2026-06-18-120000-idp-claim-mapping.cjs.map +1 -0
- package/dist/production/src/migrations/2026-06-18-120000-idp-claim-mapping.js +11 -0
- package/dist/production/src/migrations/2026-06-18-120000-idp-claim-mapping.js.map +1 -0
- package/dist/production/src/migrations/2026-08-03-120000-person-enable-auth-log.cjs +9 -0
- package/dist/production/src/migrations/2026-08-03-120000-person-enable-auth-log.cjs.map +1 -0
- package/dist/production/src/migrations/2026-08-03-120000-person-enable-auth-log.js +10 -0
- package/dist/production/src/migrations/2026-08-03-120000-person-enable-auth-log.js.map +1 -0
- package/dist/production/src/migrations/2026-08-04-120000-config-panel.cjs +11 -0
- package/dist/production/src/migrations/2026-08-04-120000-config-panel.cjs.map +1 -0
- package/dist/production/src/migrations/2026-08-04-120000-config-panel.js +12 -0
- package/dist/production/src/migrations/2026-08-04-120000-config-panel.js.map +1 -0
- package/dist/production/src/migrations/2026-09-04-120000-idp-disable-local-authentication.cjs +18 -0
- package/dist/production/src/migrations/2026-09-04-120000-idp-disable-local-authentication.cjs.map +1 -0
- package/dist/production/src/migrations/2026-09-04-120000-idp-disable-local-authentication.js +19 -0
- package/dist/production/src/migrations/2026-09-04-120000-idp-disable-local-authentication.js.map +1 -0
- package/dist/production/src/migrations/2026-09-11-120000-custom-role.cjs +18 -0
- package/dist/production/src/migrations/2026-09-11-120000-custom-role.cjs.map +1 -0
- package/dist/production/src/migrations/2026-09-11-120000-custom-role.js +19 -0
- package/dist/production/src/migrations/2026-09-11-120000-custom-role.js.map +1 -0
- package/dist/production/src/migrations/runner.cjs +17 -5
- package/dist/production/src/migrations/runner.cjs.map +1 -1
- package/dist/production/src/migrations/runner.js +17 -5
- package/dist/production/src/migrations/runner.js.map +1 -1
- package/dist/production/src/migrations/snapshot.cjs +22 -2
- package/dist/production/src/migrations/snapshot.cjs.map +1 -1
- package/dist/production/src/migrations/snapshot.js +22 -2
- package/dist/production/src/migrations/snapshot.js.map +1 -1
- package/dist/production/src/model/authorization/CustomRoleAuthorizator.cjs +65 -0
- package/dist/production/src/model/authorization/CustomRoleAuthorizator.cjs.map +1 -0
- package/dist/production/src/model/authorization/CustomRoleAuthorizator.js +65 -0
- package/dist/production/src/model/authorization/CustomRoleAuthorizator.js.map +1 -0
- package/dist/production/src/model/authorization/CustomRolePermissions.cjs +404 -0
- package/dist/production/src/model/authorization/CustomRolePermissions.cjs.map +1 -0
- package/dist/production/src/model/authorization/CustomRolePermissions.js +387 -0
- package/dist/production/src/model/authorization/CustomRolePermissions.js.map +1 -0
- package/dist/production/src/model/authorization/PermissionActions.cjs +19 -16
- package/dist/production/src/model/authorization/PermissionActions.cjs.map +1 -1
- package/dist/production/src/model/authorization/PermissionActions.js +19 -16
- package/dist/production/src/model/authorization/PermissionActions.js.map +1 -1
- package/dist/production/src/model/authorization/PermissionContextFactory.cjs +20 -2
- package/dist/production/src/model/authorization/PermissionContextFactory.cjs.map +1 -1
- package/dist/production/src/model/authorization/PermissionContextFactory.js +20 -2
- package/dist/production/src/model/authorization/PermissionContextFactory.js.map +1 -1
- package/dist/production/src/model/authorization/PermissionsFactory.cjs +32 -24
- package/dist/production/src/model/authorization/PermissionsFactory.cjs.map +1 -1
- package/dist/production/src/model/authorization/PermissionsFactory.js +33 -25
- package/dist/production/src/model/authorization/PermissionsFactory.js.map +1 -1
- package/dist/production/src/model/authorization/Roles.cjs +8 -0
- package/dist/production/src/model/authorization/Roles.cjs.map +1 -1
- package/dist/production/src/model/authorization/Roles.js +8 -0
- package/dist/production/src/model/authorization/Roles.js.map +1 -1
- package/dist/production/src/model/authorization/TargetIdentityPermission.cjs +35 -0
- package/dist/production/src/model/authorization/TargetIdentityPermission.cjs.map +1 -0
- package/dist/production/src/model/authorization/TargetIdentityPermission.js +35 -0
- package/dist/production/src/model/authorization/TargetIdentityPermission.js.map +1 -0
- package/dist/production/src/model/commands/apiKey/ApiKeyHelper.cjs +19 -0
- package/dist/production/src/model/commands/apiKey/ApiKeyHelper.cjs.map +1 -1
- package/dist/production/src/model/commands/apiKey/ApiKeyHelper.js +19 -0
- package/dist/production/src/model/commands/apiKey/ApiKeyHelper.js.map +1 -1
- package/dist/production/src/model/commands/apiKey/CreateApiKeyCommand.cjs +4 -2
- package/dist/production/src/model/commands/apiKey/CreateApiKeyCommand.cjs.map +1 -1
- package/dist/production/src/model/commands/apiKey/CreateApiKeyCommand.js +5 -3
- package/dist/production/src/model/commands/apiKey/CreateApiKeyCommand.js.map +1 -1
- package/dist/production/src/model/commands/apiKey/ProlongApiKeyCommand.cjs +9 -10
- package/dist/production/src/model/commands/apiKey/ProlongApiKeyCommand.cjs.map +1 -1
- package/dist/production/src/model/commands/apiKey/ProlongApiKeyCommand.js +10 -11
- package/dist/production/src/model/commands/apiKey/ProlongApiKeyCommand.js.map +1 -1
- package/dist/production/src/model/commands/authLog/CreateAuthLogEntryCommand.cjs.map +1 -1
- package/dist/production/src/model/commands/authLog/CreateAuthLogEntryCommand.js.map +1 -1
- package/dist/production/src/model/commands/configuration/UpdateConfigurationCommand.cjs +5 -3
- package/dist/production/src/model/commands/configuration/UpdateConfigurationCommand.cjs.map +1 -1
- package/dist/production/src/model/commands/configuration/UpdateConfigurationCommand.js +5 -3
- package/dist/production/src/model/commands/configuration/UpdateConfigurationCommand.js.map +1 -1
- package/dist/production/src/model/commands/customRole/CreateCustomRoleCommand.cjs +23 -0
- package/dist/production/src/model/commands/customRole/CreateCustomRoleCommand.cjs.map +1 -0
- package/dist/production/src/model/commands/customRole/CreateCustomRoleCommand.js +23 -0
- package/dist/production/src/model/commands/customRole/CreateCustomRoleCommand.js.map +1 -0
- package/dist/production/src/model/commands/customRole/DeleteCustomRoleCommand.cjs +14 -0
- package/dist/production/src/model/commands/customRole/DeleteCustomRoleCommand.cjs.map +1 -0
- package/dist/production/src/model/commands/customRole/DeleteCustomRoleCommand.js +14 -0
- package/dist/production/src/model/commands/customRole/DeleteCustomRoleCommand.js.map +1 -0
- package/dist/production/src/model/commands/customRole/RemoveCustomRoleAssignmentsCommand.cjs +16 -0
- package/dist/production/src/model/commands/customRole/RemoveCustomRoleAssignmentsCommand.cjs.map +1 -0
- package/dist/production/src/model/commands/customRole/RemoveCustomRoleAssignmentsCommand.js +16 -0
- package/dist/production/src/model/commands/customRole/RemoveCustomRoleAssignmentsCommand.js.map +1 -0
- package/dist/production/src/model/commands/customRole/UpdateCustomRoleCommand.cjs +19 -0
- package/dist/production/src/model/commands/customRole/UpdateCustomRoleCommand.cjs.map +1 -0
- package/dist/production/src/model/commands/customRole/UpdateCustomRoleCommand.js +19 -0
- package/dist/production/src/model/commands/customRole/UpdateCustomRoleCommand.js.map +1 -0
- package/dist/production/src/model/commands/identity/PatchIdentityGlobalRoles.cjs +1 -1
- package/dist/production/src/model/commands/identity/PatchIdentityGlobalRoles.cjs.map +1 -1
- package/dist/production/src/model/commands/identity/PatchIdentityGlobalRoles.js +1 -1
- package/dist/production/src/model/commands/identity/PatchIdentityGlobalRoles.js.map +1 -1
- package/dist/production/src/model/commands/idp/ClaimIdpRevalidationCommand.cjs +3 -7
- package/dist/production/src/model/commands/idp/ClaimIdpRevalidationCommand.cjs.map +1 -1
- package/dist/production/src/model/commands/idp/ClaimIdpRevalidationCommand.js +3 -7
- package/dist/production/src/model/commands/idp/ClaimIdpRevalidationCommand.js.map +1 -1
- package/dist/production/src/model/commands/idp/CreateIdpCommand.cjs +8 -2
- package/dist/production/src/model/commands/idp/CreateIdpCommand.cjs.map +1 -1
- package/dist/production/src/model/commands/idp/CreateIdpCommand.js +8 -2
- package/dist/production/src/model/commands/idp/CreateIdpCommand.js.map +1 -1
- package/dist/production/src/model/commands/idp/CreateIdpSessionCommand.cjs +4 -1
- package/dist/production/src/model/commands/idp/CreateIdpSessionCommand.cjs.map +1 -1
- package/dist/production/src/model/commands/idp/CreateIdpSessionCommand.js +5 -2
- package/dist/production/src/model/commands/idp/CreateIdpSessionCommand.js.map +1 -1
- package/dist/production/src/model/commands/idp/UpdateIdpCommand.cjs +6 -2
- package/dist/production/src/model/commands/idp/UpdateIdpCommand.cjs.map +1 -1
- package/dist/production/src/model/commands/idp/UpdateIdpCommand.js +6 -2
- package/dist/production/src/model/commands/idp/UpdateIdpCommand.js.map +1 -1
- package/dist/production/src/model/commands/idp/UpdateIdpSessionCommand.cjs +2 -1
- package/dist/production/src/model/commands/idp/UpdateIdpSessionCommand.cjs.map +1 -1
- package/dist/production/src/model/commands/idp/UpdateIdpSessionCommand.js +3 -2
- package/dist/production/src/model/commands/idp/UpdateIdpSessionCommand.js.map +1 -1
- package/dist/production/src/model/commands/membership/{RemoveProjectMembershipsCommand.cjs → RemoveProjectMembershipCommand.cjs} +1 -1
- package/dist/production/src/model/commands/membership/RemoveProjectMembershipCommand.cjs.map +1 -0
- package/dist/production/src/model/commands/membership/{RemoveProjectMembershipsCommand.js → RemoveProjectMembershipCommand.js} +1 -1
- package/dist/production/src/model/commands/membership/RemoveProjectMembershipCommand.js.map +1 -0
- package/dist/production/src/model/commands/membership/UpdateProjectMemberCommand.cjs +2 -2
- package/dist/production/src/model/commands/membership/UpdateProjectMemberCommand.cjs.map +1 -1
- package/dist/production/src/model/commands/membership/UpdateProjectMemberCommand.js +1 -1
- package/dist/production/src/model/commands/membership/UpdateProjectMemberCommand.js.map +1 -1
- package/dist/production/src/model/commands/person/CreatePersonCommand.cjs +1 -0
- package/dist/production/src/model/commands/person/CreatePersonCommand.cjs.map +1 -1
- package/dist/production/src/model/commands/person/CreatePersonCommand.js +1 -0
- package/dist/production/src/model/commands/person/CreatePersonCommand.js.map +1 -1
- package/dist/production/src/model/commands/person/EnablePersonCommand.cjs +17 -0
- package/dist/production/src/model/commands/person/EnablePersonCommand.cjs.map +1 -0
- package/dist/production/src/model/commands/person/EnablePersonCommand.js +17 -0
- package/dist/production/src/model/commands/person/EnablePersonCommand.js.map +1 -0
- package/dist/production/src/model/commands/person/SetMfaGraceUntilCommand.cjs +3 -3
- package/dist/production/src/model/commands/person/SetMfaGraceUntilCommand.cjs.map +1 -1
- package/dist/production/src/model/commands/person/SetMfaGraceUntilCommand.js +4 -4
- package/dist/production/src/model/commands/person/SetMfaGraceUntilCommand.js.map +1 -1
- package/dist/production/src/model/commands/personToken/ResetPasswordCommand.cjs +2 -3
- package/dist/production/src/model/commands/personToken/ResetPasswordCommand.cjs.map +1 -1
- package/dist/production/src/model/commands/personToken/ResetPasswordCommand.js +2 -3
- package/dist/production/src/model/commands/personToken/ResetPasswordCommand.js.map +1 -1
- package/dist/production/src/model/commands/personToken/SaveEmailOtpTokenCommand.cjs +3 -3
- package/dist/production/src/model/commands/personToken/SaveEmailOtpTokenCommand.cjs.map +1 -1
- package/dist/production/src/model/commands/personToken/SaveEmailOtpTokenCommand.js +4 -4
- package/dist/production/src/model/commands/personToken/SaveEmailOtpTokenCommand.js.map +1 -1
- package/dist/production/src/model/commands/personToken/SavePersonTokenCommand.cjs +12 -6
- package/dist/production/src/model/commands/personToken/SavePersonTokenCommand.cjs.map +1 -1
- package/dist/production/src/model/commands/personToken/SavePersonTokenCommand.js +13 -7
- package/dist/production/src/model/commands/personToken/SavePersonTokenCommand.js.map +1 -1
- package/dist/production/src/model/commands/rateLimit/RecordRateLimitEventCommand.cjs +1 -2
- package/dist/production/src/model/commands/rateLimit/RecordRateLimitEventCommand.cjs.map +1 -1
- package/dist/production/src/model/commands/rateLimit/RecordRateLimitEventCommand.js +1 -2
- package/dist/production/src/model/commands/rateLimit/RecordRateLimitEventCommand.js.map +1 -1
- package/dist/production/src/model/mailing/UserMailer.cjs +2 -1
- package/dist/production/src/model/mailing/UserMailer.cjs.map +1 -1
- package/dist/production/src/model/mailing/UserMailer.js +2 -1
- package/dist/production/src/model/mailing/UserMailer.js.map +1 -1
- package/dist/production/src/model/queries/apiKey/ApiKeyQuery.cjs +8 -1
- package/dist/production/src/model/queries/apiKey/ApiKeyQuery.cjs.map +1 -1
- package/dist/production/src/model/queries/apiKey/ApiKeyQuery.js +9 -2
- package/dist/production/src/model/queries/apiKey/ApiKeyQuery.js.map +1 -1
- package/dist/production/src/model/queries/apiKey/ApiKeySessionsQuery.cjs +2 -3
- package/dist/production/src/model/queries/apiKey/ApiKeySessionsQuery.cjs.map +1 -1
- package/dist/production/src/model/queries/apiKey/ApiKeySessionsQuery.js +2 -3
- package/dist/production/src/model/queries/apiKey/ApiKeySessionsQuery.js.map +1 -1
- package/dist/production/src/model/queries/authLog/NextLoginAttemptQuery.cjs +12 -10
- package/dist/production/src/model/queries/authLog/NextLoginAttemptQuery.cjs.map +1 -1
- package/dist/production/src/model/queries/authLog/NextLoginAttemptQuery.js +12 -10
- package/dist/production/src/model/queries/authLog/NextLoginAttemptQuery.js.map +1 -1
- package/dist/production/src/model/queries/authLog/NextMailAttemptQuery.cjs +10 -8
- package/dist/production/src/model/queries/authLog/NextMailAttemptQuery.cjs.map +1 -1
- package/dist/production/src/model/queries/authLog/NextMailAttemptQuery.js +10 -8
- package/dist/production/src/model/queries/authLog/NextMailAttemptQuery.js.map +1 -1
- package/dist/production/src/model/queries/configuration/ConfigurationQuery.cjs +4 -0
- package/dist/production/src/model/queries/configuration/ConfigurationQuery.cjs.map +1 -1
- package/dist/production/src/model/queries/configuration/ConfigurationQuery.js +4 -0
- package/dist/production/src/model/queries/configuration/ConfigurationQuery.js.map +1 -1
- package/dist/production/src/model/queries/customRole/CustomRolesQuery.cjs +23 -0
- package/dist/production/src/model/queries/customRole/CustomRolesQuery.cjs.map +1 -0
- package/dist/production/src/model/queries/customRole/CustomRolesQuery.js +23 -0
- package/dist/production/src/model/queries/customRole/CustomRolesQuery.js.map +1 -0
- package/dist/production/src/model/queries/identity/IdentitiesHoldingRoleCountQuery.cjs +15 -0
- package/dist/production/src/model/queries/identity/IdentitiesHoldingRoleCountQuery.cjs.map +1 -0
- package/dist/production/src/model/queries/identity/IdentitiesHoldingRoleCountQuery.js +15 -0
- package/dist/production/src/model/queries/identity/IdentitiesHoldingRoleCountQuery.js.map +1 -0
- package/dist/production/src/model/queries/identity/IdentityQuery.cjs +7 -2
- package/dist/production/src/model/queries/identity/IdentityQuery.cjs.map +1 -1
- package/dist/production/src/model/queries/identity/IdentityQuery.js +7 -2
- package/dist/production/src/model/queries/identity/IdentityQuery.js.map +1 -1
- package/dist/production/src/model/queries/idp/LocalAuthDisablingIdpsQuery.cjs +21 -0
- package/dist/production/src/model/queries/idp/LocalAuthDisablingIdpsQuery.cjs.map +1 -0
- package/dist/production/src/model/queries/idp/LocalAuthDisablingIdpsQuery.js +21 -0
- package/dist/production/src/model/queries/idp/LocalAuthDisablingIdpsQuery.js.map +1 -0
- package/dist/production/src/model/queries/idp/PersonIdentityProvidersQuery.cjs +1 -1
- package/dist/production/src/model/queries/idp/PersonIdentityProvidersQuery.cjs.map +1 -1
- package/dist/production/src/model/queries/idp/PersonIdentityProvidersQuery.js +1 -1
- package/dist/production/src/model/queries/idp/PersonIdentityProvidersQuery.js.map +1 -1
- package/dist/production/src/model/queries/idp/helpers.cjs +3 -3
- package/dist/production/src/model/queries/idp/helpers.cjs.map +1 -1
- package/dist/production/src/model/queries/idp/helpers.js +3 -3
- package/dist/production/src/model/queries/idp/helpers.js.map +1 -1
- package/dist/production/src/model/queries/membership/IdentityHasProjectMembershipsQuery.cjs +15 -0
- package/dist/production/src/model/queries/membership/IdentityHasProjectMembershipsQuery.cjs.map +1 -0
- package/dist/production/src/model/queries/membership/IdentityHasProjectMembershipsQuery.js +15 -0
- package/dist/production/src/model/queries/membership/IdentityHasProjectMembershipsQuery.js.map +1 -0
- package/dist/production/src/model/queries/membership/ProjectMembersQuery.cjs +1 -1
- package/dist/production/src/model/queries/membership/ProjectMembersQuery.cjs.map +1 -1
- package/dist/production/src/model/queries/membership/ProjectMembersQuery.js +1 -1
- package/dist/production/src/model/queries/membership/ProjectMembersQuery.js.map +1 -1
- package/dist/production/src/model/queries/person/PersonQueryBuilderFactory.cjs +2 -2
- package/dist/production/src/model/queries/person/PersonQueryBuilderFactory.cjs.map +1 -1
- package/dist/production/src/model/queries/person/PersonQueryBuilderFactory.js +2 -2
- package/dist/production/src/model/queries/person/PersonQueryBuilderFactory.js.map +1 -1
- package/dist/production/src/model/queries/personToken/PersonTokenQuery.cjs +1 -1
- package/dist/production/src/model/queries/personToken/PersonTokenQuery.cjs.map +1 -1
- package/dist/production/src/model/queries/personToken/PersonTokenQuery.js +1 -1
- package/dist/production/src/model/queries/personToken/PersonTokenQuery.js.map +1 -1
- package/dist/production/src/model/queries/project/ProjectsByIdentityQuery.cjs +4 -1
- package/dist/production/src/model/queries/project/ProjectsByIdentityQuery.cjs.map +1 -1
- package/dist/production/src/model/queries/project/ProjectsByIdentityQuery.js +4 -1
- package/dist/production/src/model/queries/project/ProjectsByIdentityQuery.js.map +1 -1
- package/dist/production/src/model/queries/rateLimit/RateLimitCountQuery.cjs +3 -3
- package/dist/production/src/model/queries/rateLimit/RateLimitCountQuery.cjs.map +1 -1
- package/dist/production/src/model/queries/rateLimit/RateLimitCountQuery.js +3 -3
- package/dist/production/src/model/queries/rateLimit/RateLimitCountQuery.js.map +1 -1
- package/dist/production/src/model/service/AuthLogService.cjs +8 -2
- package/dist/production/src/model/service/AuthLogService.cjs.map +1 -1
- package/dist/production/src/model/service/AuthLogService.js +8 -2
- package/dist/production/src/model/service/AuthLogService.js.map +1 -1
- package/dist/production/src/model/service/AuthPolicyManager.cjs +2 -1
- package/dist/production/src/model/service/AuthPolicyManager.cjs.map +1 -1
- package/dist/production/src/model/service/AuthPolicyManager.js +2 -1
- package/dist/production/src/model/service/AuthPolicyManager.js.map +1 -1
- package/dist/production/src/model/service/AuthPolicyResolver.cjs +2 -1
- package/dist/production/src/model/service/AuthPolicyResolver.cjs.map +1 -1
- package/dist/production/src/model/service/AuthPolicyResolver.js +2 -1
- package/dist/production/src/model/service/AuthPolicyResolver.js.map +1 -1
- package/dist/production/src/model/service/CustomRoleManager.cjs +170 -0
- package/dist/production/src/model/service/CustomRoleManager.cjs.map +1 -0
- package/dist/production/src/model/service/CustomRoleManager.js +170 -0
- package/dist/production/src/model/service/CustomRoleManager.js.map +1 -0
- package/dist/production/src/model/service/EmailChangeManager.cjs +5 -4
- package/dist/production/src/model/service/EmailChangeManager.cjs.map +1 -1
- package/dist/production/src/model/service/EmailChangeManager.js +5 -4
- package/dist/production/src/model/service/EmailChangeManager.js.map +1 -1
- package/dist/production/src/model/service/EmailOtpManager.cjs +0 -1
- package/dist/production/src/model/service/EmailOtpManager.cjs.map +1 -1
- package/dist/production/src/model/service/EmailOtpManager.js +0 -1
- package/dist/production/src/model/service/EmailOtpManager.js.map +1 -1
- package/dist/production/src/model/service/EmailValidator.cjs +2 -1
- package/dist/production/src/model/service/EmailValidator.cjs.map +1 -1
- package/dist/production/src/model/service/EmailValidator.js +2 -1
- package/dist/production/src/model/service/EmailValidator.js.map +1 -1
- package/dist/production/src/model/service/EmailVerificationManager.cjs +5 -4
- package/dist/production/src/model/service/EmailVerificationManager.cjs.map +1 -1
- package/dist/production/src/model/service/EmailVerificationManager.js +5 -4
- package/dist/production/src/model/service/EmailVerificationManager.js.map +1 -1
- package/dist/production/src/model/service/GlobalRoleValidator.cjs +35 -0
- package/dist/production/src/model/service/GlobalRoleValidator.cjs.map +1 -0
- package/dist/production/src/model/service/GlobalRoleValidator.js +35 -0
- package/dist/production/src/model/service/GlobalRoleValidator.js.map +1 -0
- package/dist/production/src/model/service/IDPSignInManager.cjs +52 -16
- package/dist/production/src/model/service/IDPSignInManager.cjs.map +1 -1
- package/dist/production/src/model/service/IDPSignInManager.js +52 -16
- package/dist/production/src/model/service/IDPSignInManager.js.map +1 -1
- package/dist/production/src/model/service/InviteManager.cjs +2 -1
- package/dist/production/src/model/service/InviteManager.cjs.map +1 -1
- package/dist/production/src/model/service/InviteManager.js +2 -1
- package/dist/production/src/model/service/InviteManager.js.map +1 -1
- package/dist/production/src/model/service/PanelAccessResolver.cjs +32 -0
- package/dist/production/src/model/service/PanelAccessResolver.cjs.map +1 -0
- package/dist/production/src/model/service/PanelAccessResolver.js +32 -0
- package/dist/production/src/model/service/PanelAccessResolver.js.map +1 -0
- package/dist/production/src/model/service/PasswordChangeManager.cjs +2 -1
- package/dist/production/src/model/service/PasswordChangeManager.cjs.map +1 -1
- package/dist/production/src/model/service/PasswordChangeManager.js +2 -1
- package/dist/production/src/model/service/PasswordChangeManager.js.map +1 -1
- package/dist/production/src/model/service/PasswordResetManager.cjs +9 -3
- package/dist/production/src/model/service/PasswordResetManager.cjs.map +1 -1
- package/dist/production/src/model/service/PasswordResetManager.js +9 -3
- package/dist/production/src/model/service/PasswordResetManager.js.map +1 -1
- package/dist/production/src/model/service/PasswordlessSignInManager.cjs +24 -6
- package/dist/production/src/model/service/PasswordlessSignInManager.cjs.map +1 -1
- package/dist/production/src/model/service/PasswordlessSignInManager.js +24 -6
- package/dist/production/src/model/service/PasswordlessSignInManager.js.map +1 -1
- package/dist/production/src/model/service/PersonAccessManager.cjs +10 -2
- package/dist/production/src/model/service/PersonAccessManager.cjs.map +1 -1
- package/dist/production/src/model/service/PersonAccessManager.js +10 -2
- package/dist/production/src/model/service/PersonAccessManager.js.map +1 -1
- package/dist/production/src/model/service/PersonManager.cjs +2 -1
- package/dist/production/src/model/service/PersonManager.cjs.map +1 -1
- package/dist/production/src/model/service/PersonManager.js +2 -1
- package/dist/production/src/model/service/PersonManager.js.map +1 -1
- package/dist/production/src/model/service/ProjectMemberManager.cjs +2 -1
- package/dist/production/src/model/service/ProjectMemberManager.cjs.map +1 -1
- package/dist/production/src/model/service/ProjectMemberManager.js +2 -1
- package/dist/production/src/model/service/ProjectMemberManager.js.map +1 -1
- package/dist/production/src/model/service/RateLimiter.cjs +1 -2
- package/dist/production/src/model/service/RateLimiter.cjs.map +1 -1
- package/dist/production/src/model/service/RateLimiter.js +1 -2
- package/dist/production/src/model/service/RateLimiter.js.map +1 -1
- package/dist/production/src/model/service/RolesManager.cjs +17 -18
- package/dist/production/src/model/service/RolesManager.cjs.map +1 -1
- package/dist/production/src/model/service/RolesManager.js +18 -19
- package/dist/production/src/model/service/RolesManager.js.map +1 -1
- package/dist/production/src/model/service/SecretsManager.cjs +2 -1
- package/dist/production/src/model/service/SecretsManager.cjs.map +1 -1
- package/dist/production/src/model/service/SecretsManager.js +2 -1
- package/dist/production/src/model/service/SecretsManager.js.map +1 -1
- package/dist/production/src/model/service/SignInManager.cjs +9 -5
- package/dist/production/src/model/service/SignInManager.cjs.map +1 -1
- package/dist/production/src/model/service/SignInManager.js +9 -5
- package/dist/production/src/model/service/SignInManager.js.map +1 -1
- package/dist/production/src/model/service/SignOutManager.cjs +2 -1
- package/dist/production/src/model/service/SignOutManager.cjs.map +1 -1
- package/dist/production/src/model/service/SignOutManager.js +2 -1
- package/dist/production/src/model/service/SignOutManager.js.map +1 -1
- package/dist/production/src/model/service/SignUpManager.cjs +15 -7
- package/dist/production/src/model/service/SignUpManager.cjs.map +1 -1
- package/dist/production/src/model/service/SignUpManager.js +15 -7
- package/dist/production/src/model/service/SignUpManager.js.map +1 -1
- package/dist/production/src/model/service/apiKey/ApiKeyManager.cjs +56 -40
- package/dist/production/src/model/service/apiKey/ApiKeyManager.cjs.map +1 -1
- package/dist/production/src/model/service/apiKey/ApiKeyManager.js +57 -41
- package/dist/production/src/model/service/apiKey/ApiKeyManager.js.map +1 -1
- package/dist/production/src/model/service/apiKey/ApiKeyService.cjs.map +1 -1
- package/dist/production/src/model/service/apiKey/ApiKeyService.js.map +1 -1
- package/dist/production/src/model/service/apiKey/UnpersistedApiKeyManager.cjs +10 -1
- package/dist/production/src/model/service/apiKey/UnpersistedApiKeyManager.cjs.map +1 -1
- package/dist/production/src/model/service/apiKey/UnpersistedApiKeyManager.js +11 -2
- package/dist/production/src/model/service/apiKey/UnpersistedApiKeyManager.js.map +1 -1
- package/dist/production/src/model/service/idp/ClaimMapping.cjs +187 -0
- package/dist/production/src/model/service/idp/ClaimMapping.cjs.map +1 -0
- package/dist/production/src/model/service/idp/ClaimMapping.js +170 -0
- package/dist/production/src/model/service/idp/ClaimMapping.js.map +1 -0
- package/dist/production/src/model/service/idp/ClaimMappingEvaluator.cjs +155 -0
- package/dist/production/src/model/service/idp/ClaimMappingEvaluator.cjs.map +1 -0
- package/dist/production/src/model/service/idp/ClaimMappingEvaluator.js +155 -0
- package/dist/production/src/model/service/idp/ClaimMappingEvaluator.js.map +1 -0
- package/dist/production/src/model/service/idp/ClaimMappingValidation.cjs +83 -0
- package/dist/production/src/model/service/idp/ClaimMappingValidation.cjs.map +1 -0
- package/dist/production/src/model/service/idp/ClaimMappingValidation.js +83 -0
- package/dist/production/src/model/service/idp/ClaimMappingValidation.js.map +1 -0
- package/dist/production/src/model/service/idp/IDPClaimSyncService.cjs +261 -0
- package/dist/production/src/model/service/idp/IDPClaimSyncService.cjs.map +1 -0
- package/dist/production/src/model/service/idp/IDPClaimSyncService.js +261 -0
- package/dist/production/src/model/service/idp/IDPClaimSyncService.js.map +1 -0
- package/dist/production/src/model/service/idp/IDPManager.cjs +98 -21
- package/dist/production/src/model/service/idp/IDPManager.cjs.map +1 -1
- package/dist/production/src/model/service/idp/IDPManager.js +98 -21
- package/dist/production/src/model/service/idp/IDPManager.js.map +1 -1
- package/dist/production/src/model/service/idp/IdpSessionRevalidator.cjs +93 -28
- package/dist/production/src/model/service/idp/IdpSessionRevalidator.cjs.map +1 -1
- package/dist/production/src/model/service/idp/IdpSessionRevalidator.js +93 -28
- package/dist/production/src/model/service/idp/IdpSessionRevalidator.js.map +1 -1
- package/dist/production/src/model/service/idp/PersonIdentityProviderManager.cjs +8 -1
- package/dist/production/src/model/service/idp/PersonIdentityProviderManager.cjs.map +1 -1
- package/dist/production/src/model/service/idp/PersonIdentityProviderManager.js +8 -1
- package/dist/production/src/model/service/idp/PersonIdentityProviderManager.js.map +1 -1
- package/dist/production/src/model/service/idp/providers/OIDCHelpers.cjs +69 -33
- package/dist/production/src/model/service/idp/providers/OIDCHelpers.cjs.map +1 -1
- package/dist/production/src/model/service/idp/providers/OIDCHelpers.js +69 -33
- package/dist/production/src/model/service/idp/providers/OIDCHelpers.js.map +1 -1
- package/dist/production/src/model/service/idp/providers/OIDCProvider.cjs +4 -1
- package/dist/production/src/model/service/idp/providers/OIDCProvider.cjs.map +1 -1
- package/dist/production/src/model/service/idp/providers/OIDCProvider.js +4 -1
- package/dist/production/src/model/service/idp/providers/OIDCProvider.js.map +1 -1
- package/dist/production/src/model/utils/DatabaseContext.cjs +10 -3
- package/dist/production/src/model/utils/DatabaseContext.cjs.map +1 -1
- package/dist/production/src/model/utils/DatabaseContext.js +11 -4
- package/dist/production/src/model/utils/DatabaseContext.js.map +1 -1
- package/dist/production/src/model/utils/token.cjs +2 -2
- package/dist/production/src/model/utils/token.cjs.map +1 -1
- package/dist/production/src/model/utils/token.js +2 -2
- package/dist/production/src/model/utils/token.js.map +1 -1
- package/dist/production/src/resolvers/ResolverFactory.cjs +12 -3
- package/dist/production/src/resolvers/ResolverFactory.cjs.map +1 -1
- package/dist/production/src/resolvers/ResolverFactory.js +12 -3
- package/dist/production/src/resolvers/ResolverFactory.js.map +1 -1
- package/dist/production/src/resolvers/TenantResolverContextFactory.cjs +4 -4
- package/dist/production/src/resolvers/TenantResolverContextFactory.cjs.map +1 -1
- package/dist/production/src/resolvers/TenantResolverContextFactory.js +4 -4
- package/dist/production/src/resolvers/TenantResolverContextFactory.js.map +1 -1
- package/dist/production/src/resolvers/mutation/apiKey/CreateApiKeyMutationResolver.cjs +19 -9
- package/dist/production/src/resolvers/mutation/apiKey/CreateApiKeyMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/apiKey/CreateApiKeyMutationResolver.js +20 -10
- package/dist/production/src/resolvers/mutation/apiKey/CreateApiKeyMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/apiKey/DisableApiKeyMutationResolver.cjs +7 -5
- package/dist/production/src/resolvers/mutation/apiKey/DisableApiKeyMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/apiKey/DisableApiKeyMutationResolver.js +7 -5
- package/dist/production/src/resolvers/mutation/apiKey/DisableApiKeyMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/configuration/AuthPolicyMutationResolver.cjs +7 -5
- package/dist/production/src/resolvers/mutation/configuration/AuthPolicyMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/configuration/AuthPolicyMutationResolver.js +7 -5
- package/dist/production/src/resolvers/mutation/configuration/AuthPolicyMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/configuration/ConfigurationMutationResolver.cjs +7 -5
- package/dist/production/src/resolvers/mutation/configuration/ConfigurationMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/configuration/ConfigurationMutationResolver.js +7 -5
- package/dist/production/src/resolvers/mutation/configuration/ConfigurationMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/customRole/CustomRoleMutationResolver.cjs +124 -0
- package/dist/production/src/resolvers/mutation/customRole/CustomRoleMutationResolver.cjs.map +1 -0
- package/dist/production/src/resolvers/mutation/customRole/CustomRoleMutationResolver.js +124 -0
- package/dist/production/src/resolvers/mutation/customRole/CustomRoleMutationResolver.js.map +1 -0
- package/dist/production/src/resolvers/mutation/identity/GlobalRolesMutationResolver.cjs +35 -11
- package/dist/production/src/resolvers/mutation/identity/GlobalRolesMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/identity/GlobalRolesMutationResolver.js +35 -11
- package/dist/production/src/resolvers/mutation/identity/GlobalRolesMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/idp/AddIDPMutationResolver.cjs +10 -7
- package/dist/production/src/resolvers/mutation/idp/AddIDPMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/idp/AddIDPMutationResolver.js +10 -7
- package/dist/production/src/resolvers/mutation/idp/AddIDPMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/idp/DisableIDPMutationResolver.cjs +7 -5
- package/dist/production/src/resolvers/mutation/idp/DisableIDPMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/idp/DisableIDPMutationResolver.js +7 -5
- package/dist/production/src/resolvers/mutation/idp/DisableIDPMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/idp/DisconnectMyIdentityProviderMutationResolver.cjs +8 -6
- package/dist/production/src/resolvers/mutation/idp/DisconnectMyIdentityProviderMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/idp/DisconnectMyIdentityProviderMutationResolver.js +8 -6
- package/dist/production/src/resolvers/mutation/idp/DisconnectMyIdentityProviderMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/idp/EnableIDPMutationResolver.cjs +7 -5
- package/dist/production/src/resolvers/mutation/idp/EnableIDPMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/idp/EnableIDPMutationResolver.js +7 -5
- package/dist/production/src/resolvers/mutation/idp/EnableIDPMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/idp/UpdateIDPMutationResolver.cjs +10 -7
- package/dist/production/src/resolvers/mutation/idp/UpdateIDPMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/idp/UpdateIDPMutationResolver.js +10 -7
- package/dist/production/src/resolvers/mutation/idp/UpdateIDPMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/idp/audit.cjs +1 -0
- package/dist/production/src/resolvers/mutation/idp/audit.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/idp/audit.js +1 -0
- package/dist/production/src/resolvers/mutation/idp/audit.js.map +1 -1
- package/dist/production/src/resolvers/mutation/mailTemplates/MailTemplateMutationResolver.cjs +38 -18
- package/dist/production/src/resolvers/mutation/mailTemplates/MailTemplateMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/mailTemplates/MailTemplateMutationResolver.js +38 -18
- package/dist/production/src/resolvers/mutation/mailTemplates/MailTemplateMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/person/ChangePasswordMutationResolver.cjs +10 -8
- package/dist/production/src/resolvers/mutation/person/ChangePasswordMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/person/ChangePasswordMutationResolver.js +10 -8
- package/dist/production/src/resolvers/mutation/person/ChangePasswordMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/person/ChangeProfileMutationResolver.cjs +17 -11
- package/dist/production/src/resolvers/mutation/person/ChangeProfileMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/person/ChangeProfileMutationResolver.js +17 -11
- package/dist/production/src/resolvers/mutation/person/ChangeProfileMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/person/DisablePersonMutationResolver.cjs +10 -8
- package/dist/production/src/resolvers/mutation/person/DisablePersonMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/person/DisablePersonMutationResolver.js +10 -8
- package/dist/production/src/resolvers/mutation/person/DisablePersonMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/person/EmailOtpMutationResolver.cjs +10 -8
- package/dist/production/src/resolvers/mutation/person/EmailOtpMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/person/EmailOtpMutationResolver.js +10 -8
- package/dist/production/src/resolvers/mutation/person/EmailOtpMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/person/EmailVerificationMutationResolver.cjs +10 -8
- package/dist/production/src/resolvers/mutation/person/EmailVerificationMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/person/EmailVerificationMutationResolver.js +10 -8
- package/dist/production/src/resolvers/mutation/person/EmailVerificationMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/person/EnablePersonMutationResolver.cjs +61 -0
- package/dist/production/src/resolvers/mutation/person/EnablePersonMutationResolver.cjs.map +1 -0
- package/dist/production/src/resolvers/mutation/person/EnablePersonMutationResolver.js +61 -0
- package/dist/production/src/resolvers/mutation/person/EnablePersonMutationResolver.js.map +1 -0
- package/dist/production/src/resolvers/mutation/person/ForceSignOutMutationResolver.cjs +8 -6
- package/dist/production/src/resolvers/mutation/person/ForceSignOutMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/person/ForceSignOutMutationResolver.js +8 -6
- package/dist/production/src/resolvers/mutation/person/ForceSignOutMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/person/IDPMutationResolver.cjs +32 -5
- package/dist/production/src/resolvers/mutation/person/IDPMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/person/IDPMutationResolver.js +32 -5
- package/dist/production/src/resolvers/mutation/person/IDPMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/person/InviteMutationResolver.cjs +7 -5
- package/dist/production/src/resolvers/mutation/person/InviteMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/person/InviteMutationResolver.js +7 -5
- package/dist/production/src/resolvers/mutation/person/InviteMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/person/OtpMutationResolver.cjs +9 -7
- package/dist/production/src/resolvers/mutation/person/OtpMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/person/OtpMutationResolver.js +9 -7
- package/dist/production/src/resolvers/mutation/person/OtpMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/person/PasswordlessMutationResolver.cjs +12 -6
- package/dist/production/src/resolvers/mutation/person/PasswordlessMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/person/PasswordlessMutationResolver.js +12 -6
- package/dist/production/src/resolvers/mutation/person/PasswordlessMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/person/RegenerateBackupCodesMutationResolver.cjs +9 -7
- package/dist/production/src/resolvers/mutation/person/RegenerateBackupCodesMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/person/RegenerateBackupCodesMutationResolver.js +9 -7
- package/dist/production/src/resolvers/mutation/person/RegenerateBackupCodesMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/person/ResetPasswordMutationResolver.cjs +10 -8
- package/dist/production/src/resolvers/mutation/person/ResetPasswordMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/person/ResetPasswordMutationResolver.js +10 -8
- package/dist/production/src/resolvers/mutation/person/ResetPasswordMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/person/ResetPersonMfaMutationResolver.cjs +8 -6
- package/dist/production/src/resolvers/mutation/person/ResetPersonMfaMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/person/ResetPersonMfaMutationResolver.js +8 -6
- package/dist/production/src/resolvers/mutation/person/ResetPersonMfaMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/person/RevokeSessionMutationResolver.cjs +8 -6
- package/dist/production/src/resolvers/mutation/person/RevokeSessionMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/person/RevokeSessionMutationResolver.js +8 -6
- package/dist/production/src/resolvers/mutation/person/RevokeSessionMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/person/SignInMutationResolver.cjs +22 -14
- package/dist/production/src/resolvers/mutation/person/SignInMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/person/SignInMutationResolver.js +22 -14
- package/dist/production/src/resolvers/mutation/person/SignInMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/person/SignOutMutationResolver.cjs +7 -5
- package/dist/production/src/resolvers/mutation/person/SignOutMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/person/SignOutMutationResolver.js +7 -5
- package/dist/production/src/resolvers/mutation/person/SignOutMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/person/SignUpMutationResolver.cjs +10 -8
- package/dist/production/src/resolvers/mutation/person/SignUpMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/person/SignUpMutationResolver.js +10 -8
- package/dist/production/src/resolvers/mutation/person/SignUpMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/person/TogglePasswordlessMutationResolver.cjs +9 -7
- package/dist/production/src/resolvers/mutation/person/TogglePasswordlessMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/person/TogglePasswordlessMutationResolver.js +9 -7
- package/dist/production/src/resolvers/mutation/person/TogglePasswordlessMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/project/CreateProjectMutationResolver.cjs +7 -5
- package/dist/production/src/resolvers/mutation/project/CreateProjectMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/project/CreateProjectMutationResolver.js +7 -5
- package/dist/production/src/resolvers/mutation/project/CreateProjectMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/project/SetProjectSecretMutationResolver.cjs +7 -5
- package/dist/production/src/resolvers/mutation/project/SetProjectSecretMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/project/SetProjectSecretMutationResolver.js +7 -5
- package/dist/production/src/resolvers/mutation/project/SetProjectSecretMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/project/UpdateProjectMutationResolver.cjs +7 -5
- package/dist/production/src/resolvers/mutation/project/UpdateProjectMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/project/UpdateProjectMutationResolver.js +7 -5
- package/dist/production/src/resolvers/mutation/project/UpdateProjectMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/projectMember/AddProjectMemberMutationResolver.cjs +7 -5
- package/dist/production/src/resolvers/mutation/projectMember/AddProjectMemberMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/projectMember/AddProjectMemberMutationResolver.js +7 -5
- package/dist/production/src/resolvers/mutation/projectMember/AddProjectMemberMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/projectMember/RemoveProjectMemberMutationResolver.cjs +8 -6
- package/dist/production/src/resolvers/mutation/projectMember/RemoveProjectMemberMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/projectMember/RemoveProjectMemberMutationResolver.js +8 -6
- package/dist/production/src/resolvers/mutation/projectMember/RemoveProjectMemberMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/projectMember/UpdateProjectMemberMutationResolver.cjs +8 -6
- package/dist/production/src/resolvers/mutation/projectMember/UpdateProjectMemberMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/projectMember/UpdateProjectMemberMutationResolver.js +8 -6
- package/dist/production/src/resolvers/mutation/projectMember/UpdateProjectMemberMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/projectMember/audit.cjs +2 -1
- package/dist/production/src/resolvers/mutation/projectMember/audit.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/projectMember/audit.js +2 -1
- package/dist/production/src/resolvers/mutation/projectMember/audit.js.map +1 -1
- package/dist/production/src/resolvers/query/ApiKeyQueryResolver.cjs +8 -6
- package/dist/production/src/resolvers/query/ApiKeyQueryResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/query/ApiKeyQueryResolver.js +8 -6
- package/dist/production/src/resolvers/query/ApiKeyQueryResolver.js.map +1 -1
- package/dist/production/src/resolvers/query/AuthLogQueryResolver.cjs +7 -5
- package/dist/production/src/resolvers/query/AuthLogQueryResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/query/AuthLogQueryResolver.js +7 -5
- package/dist/production/src/resolvers/query/AuthLogQueryResolver.js.map +1 -1
- package/dist/production/src/resolvers/query/AuthPolicyQueryResolver.cjs +8 -6
- package/dist/production/src/resolvers/query/AuthPolicyQueryResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/query/AuthPolicyQueryResolver.js +8 -6
- package/dist/production/src/resolvers/query/AuthPolicyQueryResolver.js.map +1 -1
- package/dist/production/src/resolvers/query/ConfigurationQueryResolver.cjs +8 -6
- package/dist/production/src/resolvers/query/ConfigurationQueryResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/query/ConfigurationQueryResolver.js +8 -6
- package/dist/production/src/resolvers/query/ConfigurationQueryResolver.js.map +1 -1
- package/dist/production/src/resolvers/query/CustomRoleQueryResolver.cjs +55 -0
- package/dist/production/src/resolvers/query/CustomRoleQueryResolver.cjs.map +1 -0
- package/dist/production/src/resolvers/query/CustomRoleQueryResolver.js +55 -0
- package/dist/production/src/resolvers/query/CustomRoleQueryResolver.js.map +1 -0
- package/dist/production/src/resolvers/query/IDPQueryResolver.cjs +7 -5
- package/dist/production/src/resolvers/query/IDPQueryResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/query/IDPQueryResolver.js +7 -5
- package/dist/production/src/resolvers/query/IDPQueryResolver.js.map +1 -1
- package/dist/production/src/resolvers/query/MailTemplateQueryResolver.cjs +21 -14
- package/dist/production/src/resolvers/query/MailTemplateQueryResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/query/MailTemplateQueryResolver.js +21 -14
- package/dist/production/src/resolvers/query/MailTemplateQueryResolver.js.map +1 -1
- package/dist/production/src/resolvers/query/PersonQueryResolver.cjs +7 -5
- package/dist/production/src/resolvers/query/PersonQueryResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/query/PersonQueryResolver.js +7 -5
- package/dist/production/src/resolvers/query/PersonQueryResolver.js.map +1 -1
- package/dist/production/src/resolvers/query/ProjectMembersQueryResolver.cjs +7 -5
- package/dist/production/src/resolvers/query/ProjectMembersQueryResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/query/ProjectMembersQueryResolver.js +7 -5
- package/dist/production/src/resolvers/query/ProjectMembersQueryResolver.js.map +1 -1
- package/dist/production/src/resolvers/query/ProjectQueryResolver.cjs +10 -7
- package/dist/production/src/resolvers/query/ProjectQueryResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/query/ProjectQueryResolver.js +10 -7
- package/dist/production/src/resolvers/query/ProjectQueryResolver.js.map +1 -1
- package/dist/production/src/resolvers/responseHelpers/ApiKeyResponseFactory.cjs +7 -5
- package/dist/production/src/resolvers/responseHelpers/ApiKeyResponseFactory.cjs.map +1 -1
- package/dist/production/src/resolvers/responseHelpers/ApiKeyResponseFactory.js +7 -5
- package/dist/production/src/resolvers/responseHelpers/ApiKeyResponseFactory.js.map +1 -1
- package/dist/production/src/resolvers/responseHelpers/PersonResponseFactory.cjs +5 -0
- package/dist/production/src/resolvers/responseHelpers/PersonResponseFactory.cjs.map +1 -1
- package/dist/production/src/resolvers/responseHelpers/PersonResponseFactory.js +5 -0
- package/dist/production/src/resolvers/responseHelpers/PersonResponseFactory.js.map +1 -1
- package/dist/production/src/resolvers/responseHelpers/ProjectResponseFactory.cjs +23 -0
- package/dist/production/src/resolvers/responseHelpers/ProjectResponseFactory.cjs.map +1 -0
- package/dist/production/src/resolvers/responseHelpers/ProjectResponseFactory.js +23 -0
- package/dist/production/src/resolvers/responseHelpers/ProjectResponseFactory.js.map +1 -0
- package/dist/production/src/resolvers/responseHelpers/SignInResponseFactory.cjs +8 -6
- package/dist/production/src/resolvers/responseHelpers/SignInResponseFactory.cjs.map +1 -1
- package/dist/production/src/resolvers/responseHelpers/SignInResponseFactory.js +8 -6
- package/dist/production/src/resolvers/responseHelpers/SignInResponseFactory.js.map +1 -1
- package/dist/production/src/resolvers/types/IdentityTypeResolver.cjs +50 -18
- package/dist/production/src/resolvers/types/IdentityTypeResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/types/IdentityTypeResolver.js +50 -18
- package/dist/production/src/resolvers/types/IdentityTypeResolver.js.map +1 -1
- package/dist/production/src/resolvers/types/PersonTypeResolver.cjs +38 -8
- package/dist/production/src/resolvers/types/PersonTypeResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/types/PersonTypeResolver.js +38 -8
- package/dist/production/src/resolvers/types/PersonTypeResolver.js.map +1 -1
- package/dist/production/src/resolvers/types/ProjectTypeResolver.cjs +31 -6
- package/dist/production/src/resolvers/types/ProjectTypeResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/types/ProjectTypeResolver.js +31 -6
- package/dist/production/src/resolvers/types/ProjectTypeResolver.js.map +1 -1
- package/dist/production/src/schema/tenant.graphql.cjs +275 -15
- package/dist/production/src/schema/tenant.graphql.cjs.map +1 -1
- package/dist/production/src/schema/tenant.graphql.js +275 -15
- package/dist/production/src/schema/tenant.graphql.js.map +1 -1
- package/dist/tests/cases/integration/database/dbClock.test.d.ts +2 -0
- package/dist/tests/cases/integration/database/dbClock.test.d.ts.map +1 -0
- package/dist/tests/cases/integration/mocked/configurationPanel.test.d.ts +2 -0
- package/dist/tests/cases/integration/mocked/configurationPanel.test.d.ts.map +1 -0
- package/dist/tests/cases/integration/mocked/customRoleCrud.test.d.ts +2 -0
- package/dist/tests/cases/integration/mocked/customRoleCrud.test.d.ts.map +1 -0
- package/dist/tests/cases/integration/mocked/disablePersonMutation.test.d.ts +2 -0
- package/dist/tests/cases/integration/mocked/disablePersonMutation.test.d.ts.map +1 -0
- package/dist/tests/cases/integration/mocked/enablePersonMutation.test.d.ts +2 -0
- package/dist/tests/cases/integration/mocked/enablePersonMutation.test.d.ts.map +1 -0
- package/dist/tests/cases/integration/mocked/gql/addProjectMember.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/gql/changeMyPassword.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/gql/changeMyProfile.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/gql/changePassword.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/gql/changeProfile.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/gql/confirmOtp.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/gql/createApiKey.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/gql/createResetPasswordRequest.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/gql/createSessionToken.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/gql/emailOtp.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/gql/emailVerification.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/gql/invite.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/gql/myIdentityProviders.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/gql/passwordless.d.ts +4 -1
- package/dist/tests/cases/integration/mocked/gql/passwordless.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/gql/prepareOtp.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/gql/resetPassword.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/gql/signIn.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/gql/signInIdp.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/gql/signUp.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/gql/unmanagedInvite.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/gql/updateProjectMember.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/idpClaimMappingConfig.test.d.ts +2 -0
- package/dist/tests/cases/integration/mocked/idpClaimMappingConfig.test.d.ts.map +1 -0
- package/dist/tests/cases/integration/mocked/localAuthenticationDisabled.test.d.ts +2 -0
- package/dist/tests/cases/integration/mocked/localAuthenticationDisabled.test.d.ts.map +1 -0
- package/dist/tests/cases/integration/mocked/mailTemplateScope.test.d.ts +2 -0
- package/dist/tests/cases/integration/mocked/mailTemplateScope.test.d.ts.map +1 -0
- package/dist/tests/cases/integration/mocked/permissionsQuery.test.d.ts +2 -0
- package/dist/tests/cases/integration/mocked/permissionsQuery.test.d.ts.map +1 -0
- package/dist/tests/cases/integration/mocked/signInIdpClaimMapping.test.d.ts +2 -0
- package/dist/tests/cases/integration/mocked/signInIdpClaimMapping.test.d.ts.map +1 -0
- package/dist/tests/cases/integration/mocked/signInIdpClaimMappingFixes.test.d.ts +2 -0
- package/dist/tests/cases/integration/mocked/signInIdpClaimMappingFixes.test.d.ts.map +1 -0
- package/dist/tests/cases/integration/mocked/signInIdpClaimMappingSafety.test.d.ts +2 -0
- package/dist/tests/cases/integration/mocked/signInIdpClaimMappingSafety.test.d.ts.map +1 -0
- package/dist/tests/cases/integration/mocked/sql/authLogSql.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/sql/authPolicySql.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/sql/consumeBackupCodeSql.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/sql/createApiKeySql.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/sql/createIdentitySql.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/sql/createMembershipSql.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/sql/createMembershipVariableSql.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/sql/createPersonSql.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/sql/createPersonTokenSql.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/sql/createSessionKeySql.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/sql/disableApiKeySql.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/sql/disableOneOffKeySql.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/sql/emailOtpSql.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/sql/generateBackupCodesSql.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/sql/getApiKeySql.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/sql/getConfigSql.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/sql/getCustomRolesSql.d.ts +18 -0
- package/dist/tests/cases/integration/mocked/sql/getCustomRolesSql.d.ts.map +1 -0
- package/dist/tests/cases/integration/mocked/sql/getIdentityByIdSql.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/sql/getIdentityProjectMembershipPresenceSql.d.ts +3 -0
- package/dist/tests/cases/integration/mocked/sql/getIdentityProjectMembershipPresenceSql.d.ts.map +1 -0
- package/dist/tests/cases/integration/mocked/sql/getIdentityProjectsSql.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/sql/getIdpBySlugSql.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/sql/getIdpSessionByApiKeySql.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/sql/getMailTemplateSql.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/sql/getNextLoginAttemptSql.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/sql/getNextMailAttemptSql.d.ts +1 -1
- package/dist/tests/cases/integration/mocked/sql/getNextMailAttemptSql.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/sql/getPersonByEmailSql.d.ts +1 -0
- package/dist/tests/cases/integration/mocked/sql/getPersonByEmailSql.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/sql/getPersonByIdSql.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/sql/getPersonByIdentity.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/sql/getPersonByIdpSql.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/sql/getPersonsByIdentitySql.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/sql/getProjectBySlugSql.d.ts +1 -1
- package/dist/tests/cases/integration/mocked/sql/getProjectBySlugSql.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/sql/getProjectMembershipSql.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/sql/listApiKeysSql.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/sql/listPersonsSql.d.ts +2 -0
- package/dist/tests/cases/integration/mocked/sql/listPersonsSql.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/sql/listProjectSecretsSql.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/sql/listSessionsSql.d.ts +1 -1
- package/dist/tests/cases/integration/mocked/sql/listSessionsSql.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/sql/localAuthDisablingIdpsSql.d.ts +10 -0
- package/dist/tests/cases/integration/mocked/sql/localAuthDisablingIdpsSql.d.ts.map +1 -0
- package/dist/tests/cases/integration/mocked/sql/loginHistorySql.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/sql/patchVariablesSql.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/sql/personIdentityProvidersSql.d.ts +1 -0
- package/dist/tests/cases/integration/mocked/sql/personIdentityProvidersSql.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/sql/removeMembershipSql.d.ts +8 -0
- package/dist/tests/cases/integration/mocked/sql/removeMembershipSql.d.ts.map +1 -0
- package/dist/tests/cases/integration/mocked/sql/selectMembershipsSql.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/sql/setEmailOtpEnabledSql.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/sql/sqlTransaction.d.ts +6 -0
- package/dist/tests/cases/integration/mocked/sql/sqlTransaction.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/sql/updatePesonNameSql.d.ts.map +1 -1
- package/dist/tests/cases/integration/mocked/sql/updatePesonPasswordSql.d.ts.map +1 -1
- package/dist/tests/cases/unit/apiKey/verifyAndProlongReplica.test.d.ts +2 -0
- package/dist/tests/cases/unit/apiKey/verifyAndProlongReplica.test.d.ts.map +1 -0
- package/dist/tests/cases/unit/customRoleAuthorizator.test.d.ts +2 -0
- package/dist/tests/cases/unit/customRoleAuthorizator.test.d.ts.map +1 -0
- package/dist/tests/cases/unit/customRolePermissions.test.d.ts +2 -0
- package/dist/tests/cases/unit/customRolePermissions.test.d.ts.map +1 -0
- package/dist/tests/cases/unit/databaseContextRetry.test.d.ts +2 -0
- package/dist/tests/cases/unit/databaseContextRetry.test.d.ts.map +1 -0
- package/dist/tests/cases/unit/idp/claimIdpRevalidation.test.d.ts +2 -0
- package/dist/tests/cases/unit/idp/claimIdpRevalidation.test.d.ts.map +1 -0
- package/dist/tests/cases/unit/idp/claimMappingEvaluator.test.d.ts +2 -0
- package/dist/tests/cases/unit/idp/claimMappingEvaluator.test.d.ts.map +1 -0
- package/dist/tests/cases/unit/idp/claimMappingValidation.test.d.ts +2 -0
- package/dist/tests/cases/unit/idp/claimMappingValidation.test.d.ts.map +1 -0
- package/dist/tests/cases/unit/idp/idpManagerConfigMerge.test.d.ts +2 -0
- package/dist/tests/cases/unit/idp/idpManagerConfigMerge.test.d.ts.map +1 -0
- package/dist/tests/cases/unit/idp/idpManagerUnknownConfigKeys.test.d.ts +2 -0
- package/dist/tests/cases/unit/idp/idpManagerUnknownConfigKeys.test.d.ts.map +1 -0
- package/dist/tests/cases/unit/idp/oidcClaims.test.d.ts +2 -0
- package/dist/tests/cases/unit/idp/oidcClaims.test.d.ts.map +1 -0
- package/dist/tests/cases/unit/panelAccessResolver.test.d.ts +2 -0
- package/dist/tests/cases/unit/panelAccessResolver.test.d.ts.map +1 -0
- package/dist/tests/cases/unit/savePersonTokenCommand.test.d.ts +2 -0
- package/dist/tests/cases/unit/savePersonTokenCommand.test.d.ts.map +1 -0
- package/dist/tests/cases/unit/updateConfigurationCommand.test.d.ts +2 -0
- package/dist/tests/cases/unit/updateConfigurationCommand.test.d.ts.map +1 -0
- package/dist/tests/src/IdPMock.d.ts.map +1 -1
- package/dist/tests/src/dbUtils.d.ts.map +1 -1
- package/dist/tests/src/tags.d.ts.map +1 -1
- package/dist/tests/src/testGraphql.d.ts.map +1 -1
- package/dist/tests/src/testTenant.d.ts +16 -4
- package/dist/tests/src/testTenant.d.ts.map +1 -1
- package/dist/tests/src/testUuid.d.ts.map +1 -1
- package/dist/tests/tsconfig.tsbuildinfo +1 -1
- package/dist/types/TenantContainer.d.ts +36 -13
- package/dist/types/TenantContainer.d.ts.map +1 -1
- package/dist/types/bridges/system/IdentityFetcher.d.ts +2 -2
- package/dist/types/bridges/system/IdentityFetcher.d.ts.map +1 -1
- package/dist/types/exceptions.d.ts.map +1 -1
- package/dist/types/migrations/2026-06-18-120000-idp-claim-mapping.d.ts +3 -0
- package/dist/types/migrations/2026-06-18-120000-idp-claim-mapping.d.ts.map +1 -0
- package/dist/types/migrations/2026-08-03-120000-person-enable-auth-log.d.ts +3 -0
- package/dist/types/migrations/2026-08-03-120000-person-enable-auth-log.d.ts.map +1 -0
- package/dist/types/migrations/2026-08-04-120000-config-panel.d.ts +3 -0
- package/dist/types/migrations/2026-08-04-120000-config-panel.d.ts.map +1 -0
- package/dist/types/migrations/2026-09-04-120000-idp-disable-local-authentication.d.ts +3 -0
- package/dist/types/migrations/2026-09-04-120000-idp-disable-local-authentication.d.ts.map +1 -0
- package/dist/types/migrations/2026-09-11-120000-custom-role.d.ts +3 -0
- package/dist/types/migrations/2026-09-11-120000-custom-role.d.ts.map +1 -0
- package/dist/types/migrations/runner.d.ts.map +1 -1
- package/dist/types/migrations/snapshot-factory.d.ts.map +1 -1
- package/dist/types/migrations/snapshot.d.ts.map +1 -1
- package/dist/types/migrations/tenantCredentials.d.ts.map +1 -1
- package/dist/types/model/authorization/AclSchemaAccessNodeFactory.d.ts.map +1 -1
- package/dist/types/model/authorization/CustomRoleAuthorizator.d.ts +29 -0
- package/dist/types/model/authorization/CustomRoleAuthorizator.d.ts.map +1 -0
- package/dist/types/model/authorization/CustomRolePermissions.d.ts +45 -0
- package/dist/types/model/authorization/CustomRolePermissions.d.ts.map +1 -0
- package/dist/types/model/authorization/DirectPermissionsAccessNode.d.ts.map +1 -1
- package/dist/types/model/authorization/Identity.d.ts.map +1 -1
- package/dist/types/model/authorization/IdentityFactory.d.ts.map +1 -1
- package/dist/types/model/authorization/IdentityScope.d.ts.map +1 -1
- package/dist/types/model/authorization/MembershipMatcher.d.ts.map +1 -1
- package/dist/types/model/authorization/PermissionActions.d.ts +104 -37
- package/dist/types/model/authorization/PermissionActions.d.ts.map +1 -1
- package/dist/types/model/authorization/PermissionContext.d.ts.map +1 -1
- package/dist/types/model/authorization/PermissionContextFactory.d.ts +13 -2
- package/dist/types/model/authorization/PermissionContextFactory.d.ts.map +1 -1
- package/dist/types/model/authorization/PermissionsFactory.d.ts.map +1 -1
- package/dist/types/model/authorization/ProjectScope.d.ts.map +1 -1
- package/dist/types/model/authorization/ProjectScopeFactory.d.ts.map +1 -1
- package/dist/types/model/authorization/Roles.d.ts +8 -0
- package/dist/types/model/authorization/Roles.d.ts.map +1 -1
- package/dist/types/model/authorization/TargetIdentityPermission.d.ts +15 -0
- package/dist/types/model/authorization/TargetIdentityPermission.d.ts.map +1 -0
- package/dist/types/model/authorization/index.d.ts +3 -0
- package/dist/types/model/authorization/index.d.ts.map +1 -1
- package/dist/types/model/commands/CommandBus.d.ts.map +1 -1
- package/dist/types/model/commands/apiKey/ApiKeyHelper.d.ts +15 -0
- package/dist/types/model/commands/apiKey/ApiKeyHelper.d.ts.map +1 -1
- package/dist/types/model/commands/apiKey/CreateApiKeyCommand.d.ts +5 -1
- package/dist/types/model/commands/apiKey/CreateApiKeyCommand.d.ts.map +1 -1
- package/dist/types/model/commands/apiKey/DisableApiKeyCommand.d.ts.map +1 -1
- package/dist/types/model/commands/apiKey/DisableIdentityApiKeysCommand.d.ts.map +1 -1
- package/dist/types/model/commands/apiKey/DisableOneOffApiKeyCommand.d.ts.map +1 -1
- package/dist/types/model/commands/apiKey/ProlongApiKeyCommand.d.ts +6 -4
- package/dist/types/model/commands/apiKey/ProlongApiKeyCommand.d.ts.map +1 -1
- package/dist/types/model/commands/authLog/CreateAuthLogEntryCommand.d.ts +1 -0
- package/dist/types/model/commands/authLog/CreateAuthLogEntryCommand.d.ts.map +1 -1
- package/dist/types/model/commands/authPolicy/CreateAuthPolicyCommand.d.ts.map +1 -1
- package/dist/types/model/commands/authPolicy/DeleteAuthPolicyCommand.d.ts.map +1 -1
- package/dist/types/model/commands/authPolicy/UpdateAuthPolicyCommand.d.ts.map +1 -1
- package/dist/types/model/commands/backupCode/ConsumeBackupCodeCommand.d.ts.map +1 -1
- package/dist/types/model/commands/backupCode/CreateBackupCodeCommand.d.ts.map +1 -1
- package/dist/types/model/commands/backupCode/DeleteBackupCodesCommand.d.ts.map +1 -1
- package/dist/types/model/commands/configuration/UpdateConfigurationCommand.d.ts.map +1 -1
- package/dist/types/model/commands/customRole/CreateCustomRoleCommand.d.ts +12 -0
- package/dist/types/model/commands/customRole/CreateCustomRoleCommand.d.ts.map +1 -0
- package/dist/types/model/commands/customRole/DeleteCustomRoleCommand.d.ts +13 -0
- package/dist/types/model/commands/customRole/DeleteCustomRoleCommand.d.ts.map +1 -0
- package/dist/types/model/commands/customRole/RemoveCustomRoleAssignmentsCommand.d.ts +8 -0
- package/dist/types/model/commands/customRole/RemoveCustomRoleAssignmentsCommand.d.ts.map +1 -0
- package/dist/types/model/commands/customRole/UpdateCustomRoleCommand.d.ts +16 -0
- package/dist/types/model/commands/customRole/UpdateCustomRoleCommand.d.ts.map +1 -0
- package/dist/types/model/commands/customRole/index.d.ts +5 -0
- package/dist/types/model/commands/customRole/index.d.ts.map +1 -0
- package/dist/types/model/commands/identity/CreateIdentityCommand.d.ts.map +1 -1
- package/dist/types/model/commands/identity/PatchIdentityGlobalRoles.d.ts.map +1 -1
- package/dist/types/model/commands/idp/ClaimIdpRevalidationCommand.d.ts.map +1 -1
- package/dist/types/model/commands/idp/CreateIdpCommand.d.ts.map +1 -1
- package/dist/types/model/commands/idp/CreateIdpSessionCommand.d.ts.map +1 -1
- package/dist/types/model/commands/idp/DisableIdpCommand.d.ts.map +1 -1
- package/dist/types/model/commands/idp/DisconnectPersonIdentityProviderCommand.d.ts.map +1 -1
- package/dist/types/model/commands/idp/EnableIdpCommand.d.ts.map +1 -1
- package/dist/types/model/commands/idp/UpdateIdpCommand.d.ts.map +1 -1
- package/dist/types/model/commands/idp/UpdateIdpSessionCommand.d.ts.map +1 -1
- package/dist/types/model/commands/index.d.ts +1 -0
- package/dist/types/model/commands/index.d.ts.map +1 -1
- package/dist/types/model/commands/mailTemplate/AddMailTemplateCommand.d.ts.map +1 -1
- package/dist/types/model/commands/mailTemplate/RemoveMailTemplateCommand.d.ts.map +1 -1
- package/dist/types/model/commands/membership/AddProjectMemberCommand.d.ts.map +1 -1
- package/dist/types/model/commands/membership/CreateOrUpdateProjectMembershipCommand.d.ts.map +1 -1
- package/dist/types/model/commands/membership/RemoveProjectMemberCommand.d.ts.map +1 -1
- package/dist/types/model/commands/membership/{RemoveProjectMembershipsCommand.d.ts → RemoveProjectMembershipCommand.d.ts} +1 -1
- package/dist/types/model/commands/membership/RemoveProjectMembershipCommand.d.ts.map +1 -0
- package/dist/types/model/commands/membership/UpdateProjectMemberCommand.d.ts.map +1 -1
- package/dist/types/model/commands/membership/index.d.ts +2 -1
- package/dist/types/model/commands/membership/index.d.ts.map +1 -1
- package/dist/types/model/commands/membership/variables/PatchProjectMembershipVariableValuesCommand.d.ts.map +1 -1
- package/dist/types/model/commands/membership/variables/PatchProjectMembershipVariablesCommand.d.ts.map +1 -1
- package/dist/types/model/commands/membership/variables/SetProjectMembershipVariableValuesCommand.d.ts.map +1 -1
- package/dist/types/model/commands/membership/variables/index.d.ts +1 -0
- package/dist/types/model/commands/membership/variables/index.d.ts.map +1 -1
- package/dist/types/model/commands/otp/ConfirmOtpCommand.d.ts.map +1 -1
- package/dist/types/model/commands/otp/DisableOtpCommand.d.ts.map +1 -1
- package/dist/types/model/commands/otp/PrepareOtpCommand.d.ts.map +1 -1
- package/dist/types/model/commands/otp/ReEncryptOtpSecretCommand.d.ts.map +1 -1
- package/dist/types/model/commands/otp/SetEmailOtpEnabledCommand.d.ts.map +1 -1
- package/dist/types/model/commands/person/ChangePasswordCommand.d.ts.map +1 -1
- package/dist/types/model/commands/person/ChangeProfileCommand.d.ts.map +1 -1
- package/dist/types/model/commands/person/CreatePersonCommand.d.ts.map +1 -1
- package/dist/types/model/commands/person/CreatePersonIdentityProviderIdentifierCommand.d.ts.map +1 -1
- package/dist/types/model/commands/person/DisablePersonCommand.d.ts.map +1 -1
- package/dist/types/model/commands/person/EnablePersonCommand.d.ts +7 -0
- package/dist/types/model/commands/person/EnablePersonCommand.d.ts.map +1 -0
- package/dist/types/model/commands/person/MarkEmailVerifiedCommand.d.ts.map +1 -1
- package/dist/types/model/commands/person/ResetPersonMfaCommand.d.ts.map +1 -1
- package/dist/types/model/commands/person/SetMfaGraceUntilCommand.d.ts +8 -3
- package/dist/types/model/commands/person/SetMfaGraceUntilCommand.d.ts.map +1 -1
- package/dist/types/model/commands/person/TogglePersonPasswordlessCommand.d.ts.map +1 -1
- package/dist/types/model/commands/personToken/ActivateOtpCommand.d.ts.map +1 -1
- package/dist/types/model/commands/personToken/ClaimOtpAttemptCommand.d.ts.map +1 -1
- package/dist/types/model/commands/personToken/CreatePersonTokenCommand.d.ts.map +1 -1
- package/dist/types/model/commands/personToken/IncreaseOtpAttemptCommand.d.ts.map +1 -1
- package/dist/types/model/commands/personToken/InvalidateEmailOtpTokensCommand.d.ts.map +1 -1
- package/dist/types/model/commands/personToken/InvalidateTokenCommand.d.ts.map +1 -1
- package/dist/types/model/commands/personToken/ResetPasswordCommand.d.ts +1 -1
- package/dist/types/model/commands/personToken/ResetPasswordCommand.d.ts.map +1 -1
- package/dist/types/model/commands/personToken/SaveEmailOtpTokenCommand.d.ts.map +1 -1
- package/dist/types/model/commands/personToken/SavePersonTokenCommand.d.ts.map +1 -1
- package/dist/types/model/commands/project/CreateProjectCommand.d.ts.map +1 -1
- package/dist/types/model/commands/project/SetProjectSecretCommand.d.ts.map +1 -1
- package/dist/types/model/commands/project/UpdateProjectCommand.d.ts.map +1 -1
- package/dist/types/model/commands/rateLimit/RecordRateLimitEventCommand.d.ts.map +1 -1
- package/dist/types/model/dtos/Password.d.ts.map +1 -1
- package/dist/types/model/mailing/UserMailer.d.ts.map +1 -1
- package/dist/types/model/mailing/templates/BackupCodesExhausted.mustache.d.ts.map +1 -1
- package/dist/types/model/mailing/templates/EmailChangeNotify.mustache.d.ts.map +1 -1
- package/dist/types/model/mailing/templates/EmailChangeVerify.mustache.d.ts.map +1 -1
- package/dist/types/model/mailing/templates/EmailOtp.mustache.d.ts.map +1 -1
- package/dist/types/model/mailing/templates/EmailVerification.mustache.d.ts.map +1 -1
- package/dist/types/model/mailing/templates/ExistingUserInvited.mustache.d.ts.map +1 -1
- package/dist/types/model/mailing/templates/ForcedSignOut.mustache.d.ts.map +1 -1
- package/dist/types/model/mailing/templates/Layout.mustache.d.ts.map +1 -1
- package/dist/types/model/mailing/templates/NewUserInvited.mustache.d.ts.map +1 -1
- package/dist/types/model/mailing/templates/PasswordReset.mustache.d.ts.map +1 -1
- package/dist/types/model/mailing/templates/PasswordlessSignIn.mustache.d.ts.map +1 -1
- package/dist/types/model/mailing/templates/UnusualLogin.mustache.d.ts.map +1 -1
- package/dist/types/model/mailing/type.d.ts.map +1 -1
- package/dist/types/model/queries/apiKey/ApiKeyListQuery.d.ts.map +1 -1
- package/dist/types/model/queries/apiKey/ApiKeyQuery.d.ts +4 -0
- package/dist/types/model/queries/apiKey/ApiKeyQuery.d.ts.map +1 -1
- package/dist/types/model/queries/apiKey/ApiKeySessionsQuery.d.ts +1 -4
- package/dist/types/model/queries/apiKey/ApiKeySessionsQuery.d.ts.map +1 -1
- package/dist/types/model/queries/authLog/AuthLogQuery.d.ts.map +1 -1
- package/dist/types/model/queries/authLog/NextLoginAttemptQuery.d.ts +2 -2
- package/dist/types/model/queries/authLog/NextLoginAttemptQuery.d.ts.map +1 -1
- package/dist/types/model/queries/authLog/NextMailAttemptQuery.d.ts +2 -2
- package/dist/types/model/queries/authLog/NextMailAttemptQuery.d.ts.map +1 -1
- package/dist/types/model/queries/authPolicy/AuthPoliciesQuery.d.ts.map +1 -1
- package/dist/types/model/queries/configuration/ConfigurationQuery.d.ts.map +1 -1
- package/dist/types/model/queries/customRole/CustomRolesQuery.d.ts +12 -0
- package/dist/types/model/queries/customRole/CustomRolesQuery.d.ts.map +1 -0
- package/dist/types/model/queries/customRole/index.d.ts +2 -0
- package/dist/types/model/queries/customRole/index.d.ts.map +1 -0
- package/dist/types/model/queries/identity/IdentitiesHoldingRoleCountQuery.d.ts +8 -0
- package/dist/types/model/queries/identity/IdentitiesHoldingRoleCountQuery.d.ts.map +1 -0
- package/dist/types/model/queries/identity/IdentityQuery.d.ts +3 -2
- package/dist/types/model/queries/identity/IdentityQuery.d.ts.map +1 -1
- package/dist/types/model/queries/identity/index.d.ts +1 -0
- package/dist/types/model/queries/identity/index.d.ts.map +1 -1
- package/dist/types/model/queries/idp/IdentityProviderBySlugQuery.d.ts.map +1 -1
- package/dist/types/model/queries/idp/IdentityProvidersQuery.d.ts.map +1 -1
- package/dist/types/model/queries/idp/IdpSessionByApiKeyQuery.d.ts.map +1 -1
- package/dist/types/model/queries/idp/IdpSessionsBySidQuery.d.ts.map +1 -1
- package/dist/types/model/queries/idp/IdpSessionsBySubQuery.d.ts.map +1 -1
- package/dist/types/model/queries/idp/LocalAuthDisablingIdpsQuery.d.ts +18 -0
- package/dist/types/model/queries/idp/LocalAuthDisablingIdpsQuery.d.ts.map +1 -0
- package/dist/types/model/queries/idp/PersonIdentityProvidersQuery.d.ts +1 -0
- package/dist/types/model/queries/idp/PersonIdentityProvidersQuery.d.ts.map +1 -1
- package/dist/types/model/queries/idp/helpers.d.ts +1 -1
- package/dist/types/model/queries/idp/helpers.d.ts.map +1 -1
- package/dist/types/model/queries/idp/index.d.ts +1 -0
- package/dist/types/model/queries/idp/index.d.ts.map +1 -1
- package/dist/types/model/queries/idp/types.d.ts +1 -0
- package/dist/types/model/queries/idp/types.d.ts.map +1 -1
- package/dist/types/model/queries/index.d.ts +1 -0
- package/dist/types/model/queries/index.d.ts.map +1 -1
- package/dist/types/model/queries/mailTemplate/MailTemplateListQuery.d.ts.map +1 -1
- package/dist/types/model/queries/mailTemplate/MailTemplateQuery.d.ts.map +1 -1
- package/dist/types/model/queries/membership/AllProjectRolesByIdentityQuery.d.ts.map +1 -1
- package/dist/types/model/queries/membership/IdentityHasProjectMembershipsQuery.d.ts +7 -0
- package/dist/types/model/queries/membership/IdentityHasProjectMembershipsQuery.d.ts.map +1 -0
- package/dist/types/model/queries/membership/ProjectMembersQuery.d.ts.map +1 -1
- package/dist/types/model/queries/membership/ProjectMembershipByIdentityQuery.d.ts.map +1 -1
- package/dist/types/model/queries/membership/ProjectRolesByIdentityQuery.d.ts.map +1 -1
- package/dist/types/model/queries/membership/ProjectSlugSpecification.d.ts.map +1 -1
- package/dist/types/model/queries/membership/index.d.ts +1 -0
- package/dist/types/model/queries/membership/index.d.ts.map +1 -1
- package/dist/types/model/queries/person/PersonByIdPQuery.d.ts.map +1 -1
- package/dist/types/model/queries/person/PersonByIdentityBatchQuery.d.ts.map +1 -1
- package/dist/types/model/queries/person/PersonQuery.d.ts.map +1 -1
- package/dist/types/model/queries/person/PersonQueryBuilderFactory.d.ts.map +1 -1
- package/dist/types/model/queries/person/PersonsQuery.d.ts.map +1 -1
- package/dist/types/model/queries/person/types.d.ts +3 -0
- package/dist/types/model/queries/person/types.d.ts.map +1 -1
- package/dist/types/model/queries/personToken/PersonTokenQuery.d.ts.map +1 -1
- package/dist/types/model/queries/project/ProjectBySlugQuery.d.ts.map +1 -1
- package/dist/types/model/queries/project/ProjectSecretKeysQuery.d.ts.map +1 -1
- package/dist/types/model/queries/project/ProjectSecretsQuery.d.ts.map +1 -1
- package/dist/types/model/queries/project/ProjectUpdateTimestampQuery.d.ts.map +1 -1
- package/dist/types/model/queries/project/ProjectsByIdentityQuery.d.ts.map +1 -1
- package/dist/types/model/queries/project/ProjectsQuery.d.ts.map +1 -1
- package/dist/types/model/queries/rateLimit/RateLimitCountQuery.d.ts +2 -2
- package/dist/types/model/queries/rateLimit/RateLimitCountQuery.d.ts.map +1 -1
- package/dist/types/model/service/AuthLogService.d.ts.map +1 -1
- package/dist/types/model/service/AuthPolicyManager.d.ts.map +1 -1
- package/dist/types/model/service/AuthPolicyResolver.d.ts.map +1 -1
- package/dist/types/model/service/BackupCodeManager.d.ts.map +1 -1
- package/dist/types/model/service/ConfigurationManager.d.ts.map +1 -1
- package/dist/types/model/service/CustomRoleManager.d.ts +46 -0
- package/dist/types/model/service/CustomRoleManager.d.ts.map +1 -0
- package/dist/types/model/service/EmailChangeManager.d.ts.map +1 -1
- package/dist/types/model/service/EmailOtpManager.d.ts.map +1 -1
- package/dist/types/model/service/EmailValidator.d.ts.map +1 -1
- package/dist/types/model/service/EmailVerificationManager.d.ts.map +1 -1
- package/dist/types/model/service/GlobalRoleValidator.d.ts +5 -0
- package/dist/types/model/service/GlobalRoleValidator.d.ts.map +1 -0
- package/dist/types/model/service/HibpChecker.d.ts.map +1 -1
- package/dist/types/model/service/IDPSignInManager.d.ts +13 -1
- package/dist/types/model/service/IDPSignInManager.d.ts.map +1 -1
- package/dist/types/model/service/InviteManager.d.ts.map +1 -1
- package/dist/types/model/service/LoginRiskAnalyzer.d.ts +1 -1
- package/dist/types/model/service/LoginRiskAnalyzer.d.ts.map +1 -1
- package/dist/types/model/service/MailTemplateManager.d.ts.map +1 -1
- package/dist/types/model/service/MembershipValidator.d.ts.map +1 -1
- package/dist/types/model/service/OtpAuthenticator.d.ts.map +1 -1
- package/dist/types/model/service/OtpManager.d.ts.map +1 -1
- package/dist/types/model/service/PanelAccessResolver.d.ts +19 -0
- package/dist/types/model/service/PanelAccessResolver.d.ts.map +1 -0
- package/dist/types/model/service/PasswordChangeManager.d.ts.map +1 -1
- package/dist/types/model/service/PasswordResetManager.d.ts.map +1 -1
- package/dist/types/model/service/PasswordStrengthValidator.d.ts.map +1 -1
- package/dist/types/model/service/PasswordlessSignInManager.d.ts.map +1 -1
- package/dist/types/model/service/PersonAccessManager.d.ts +5 -2
- package/dist/types/model/service/PersonAccessManager.d.ts.map +1 -1
- package/dist/types/model/service/PersonManager.d.ts.map +1 -1
- package/dist/types/model/service/ProjectManager.d.ts.map +1 -1
- package/dist/types/model/service/ProjectMemberManager.d.ts.map +1 -1
- package/dist/types/model/service/RateLimiter.d.ts +1 -1
- package/dist/types/model/service/RateLimiter.d.ts.map +1 -1
- package/dist/types/model/service/RolesManager.d.ts +6 -1
- package/dist/types/model/service/RolesManager.d.ts.map +1 -1
- package/dist/types/model/service/SecretsManager.d.ts.map +1 -1
- package/dist/types/model/service/SignInManager.d.ts.map +1 -1
- package/dist/types/model/service/SignOutManager.d.ts.map +1 -1
- package/dist/types/model/service/SignUpManager.d.ts +3 -1
- package/dist/types/model/service/SignUpManager.d.ts.map +1 -1
- package/dist/types/model/service/apiKey/ApiKeyManager.d.ts +4 -1
- package/dist/types/model/service/apiKey/ApiKeyManager.d.ts.map +1 -1
- package/dist/types/model/service/apiKey/ApiKeyService.d.ts +2 -2
- package/dist/types/model/service/apiKey/ApiKeyService.d.ts.map +1 -1
- package/dist/types/model/service/apiKey/UnpersistedApiKeyManager.d.ts +18 -0
- package/dist/types/model/service/apiKey/UnpersistedApiKeyManager.d.ts.map +1 -1
- package/dist/types/model/service/captcha/CaptchaValidator.d.ts.map +1 -1
- package/dist/types/model/service/captcha/HCaptchaProvider.d.ts.map +1 -1
- package/dist/types/model/service/captcha/RecaptchaV3Provider.d.ts.map +1 -1
- package/dist/types/model/service/captcha/TurnstileProvider.d.ts.map +1 -1
- package/dist/types/model/service/helpers/getPreferredProject.d.ts.map +1 -1
- package/dist/types/model/service/helpers/isPasswordlessEnabled.d.ts.map +1 -1
- package/dist/types/model/service/idp/BackchannelLogoutManager.d.ts.map +1 -1
- package/dist/types/model/service/idp/ClaimMapping.d.ts +330 -0
- package/dist/types/model/service/idp/ClaimMapping.d.ts.map +1 -0
- package/dist/types/model/service/idp/ClaimMappingEvaluator.d.ts +30 -0
- package/dist/types/model/service/idp/ClaimMappingEvaluator.d.ts.map +1 -0
- package/dist/types/model/service/idp/ClaimMappingValidation.d.ts +55 -0
- package/dist/types/model/service/idp/ClaimMappingValidation.d.ts.map +1 -0
- package/dist/types/model/service/idp/IDPClaimSyncService.d.ts +113 -0
- package/dist/types/model/service/idp/IDPClaimSyncService.d.ts.map +1 -0
- package/dist/types/model/service/idp/IDPHandlerRegistry.d.ts.map +1 -1
- package/dist/types/model/service/idp/IDPManager.d.ts +31 -1
- package/dist/types/model/service/idp/IDPManager.d.ts.map +1 -1
- package/dist/types/model/service/idp/IdentityProviderHandler.d.ts +7 -0
- package/dist/types/model/service/idp/IdentityProviderHandler.d.ts.map +1 -1
- package/dist/types/model/service/idp/IdpSessionRevalidator.d.ts +15 -1
- package/dist/types/model/service/idp/IdpSessionRevalidator.d.ts.map +1 -1
- package/dist/types/model/service/idp/PersonIdentityProviderManager.d.ts.map +1 -1
- package/dist/types/model/service/idp/index.d.ts +4 -0
- package/dist/types/model/service/idp/index.d.ts.map +1 -1
- package/dist/types/model/service/idp/providers/AppleProvider.d.ts +2 -2
- package/dist/types/model/service/idp/providers/AppleProvider.d.ts.map +1 -1
- package/dist/types/model/service/idp/providers/FacebookProvider.d.ts +2 -2
- package/dist/types/model/service/idp/providers/FacebookProvider.d.ts.map +1 -1
- package/dist/types/model/service/idp/providers/OIDCHelpers.d.ts +13 -1
- package/dist/types/model/service/idp/providers/OIDCHelpers.d.ts.map +1 -1
- package/dist/types/model/service/idp/providers/OIDCProvider.d.ts +1 -1
- package/dist/types/model/service/idp/providers/OIDCProvider.d.ts.map +1 -1
- package/dist/types/model/service/idp/providers/OIDCTypes.d.ts +5 -5
- package/dist/types/model/service/idp/providers/helpers.d.ts.map +1 -1
- package/dist/types/model/service/index.d.ts +3 -0
- package/dist/types/model/service/index.d.ts.map +1 -1
- package/dist/types/model/service/membershipUtils.d.ts.map +1 -1
- package/dist/types/model/type/AuthLog.d.ts +1 -1
- package/dist/types/model/type/AuthLog.d.ts.map +1 -1
- package/dist/types/model/type/Config.d.ts +2 -0
- package/dist/types/model/type/Config.d.ts.map +1 -1
- package/dist/types/model/type/CustomRole.d.ts +9 -0
- package/dist/types/model/type/CustomRole.d.ts.map +1 -0
- package/dist/types/model/type/IdentityProvider.d.ts +2 -0
- package/dist/types/model/type/IdentityProvider.d.ts.map +1 -1
- package/dist/types/model/type/PersonToken.d.ts +2 -0
- package/dist/types/model/type/PersonToken.d.ts.map +1 -1
- package/dist/types/model/type/RateLimit.d.ts +6 -6
- package/dist/types/model/type/RateLimit.d.ts.map +1 -1
- package/dist/types/model/type/index.d.ts +1 -0
- package/dist/types/model/type/index.d.ts.map +1 -1
- package/dist/types/model/utils/DatabaseContext.d.ts +15 -1
- package/dist/types/model/utils/DatabaseContext.d.ts.map +1 -1
- package/dist/types/model/utils/Response.d.ts.map +1 -1
- package/dist/types/model/utils/email.d.ts.map +1 -1
- package/dist/types/model/utils/hex.d.ts.map +1 -1
- package/dist/types/model/utils/interval.d.ts.map +1 -1
- package/dist/types/model/utils/time.d.ts.map +1 -1
- package/dist/types/model/utils/token.d.ts +1 -2
- package/dist/types/model/utils/token.d.ts.map +1 -1
- package/dist/types/resolvers/ResolverFactory.d.ts +6 -0
- package/dist/types/resolvers/ResolverFactory.d.ts.map +1 -1
- package/dist/types/resolvers/TenantResolverContext.d.ts +1 -1
- package/dist/types/resolvers/TenantResolverContext.d.ts.map +1 -1
- package/dist/types/resolvers/TenantResolverContextFactory.d.ts +1 -1
- package/dist/types/resolvers/TenantResolverContextFactory.d.ts.map +1 -1
- package/dist/types/resolvers/errorUtils.d.ts.map +1 -1
- package/dist/types/resolvers/membershipUtils.d.ts.map +1 -1
- package/dist/types/resolvers/mutation/apiKey/CreateApiKeyMutationResolver.d.ts.map +1 -1
- package/dist/types/resolvers/mutation/apiKey/DisableApiKeyMutationResolver.d.ts.map +1 -1
- package/dist/types/resolvers/mutation/configuration/AuthPolicyMutationResolver.d.ts.map +1 -1
- package/dist/types/resolvers/mutation/configuration/ConfigurationMutationResolver.d.ts.map +1 -1
- package/dist/types/resolvers/mutation/customRole/CustomRoleMutationResolver.d.ts +16 -0
- package/dist/types/resolvers/mutation/customRole/CustomRoleMutationResolver.d.ts.map +1 -0
- package/dist/types/resolvers/mutation/identity/GlobalRolesMutationResolver.d.ts.map +1 -1
- package/dist/types/resolvers/mutation/idp/AddIDPMutationResolver.d.ts.map +1 -1
- package/dist/types/resolvers/mutation/idp/DisableIDPMutationResolver.d.ts.map +1 -1
- package/dist/types/resolvers/mutation/idp/DisconnectMyIdentityProviderMutationResolver.d.ts.map +1 -1
- package/dist/types/resolvers/mutation/idp/EnableIDPMutationResolver.d.ts.map +1 -1
- package/dist/types/resolvers/mutation/idp/UpdateIDPMutationResolver.d.ts.map +1 -1
- package/dist/types/resolvers/mutation/idp/audit.d.ts.map +1 -1
- package/dist/types/resolvers/mutation/mailTemplates/MailTemplateMutationResolver.d.ts +2 -0
- package/dist/types/resolvers/mutation/mailTemplates/MailTemplateMutationResolver.d.ts.map +1 -1
- package/dist/types/resolvers/mutation/person/ChangePasswordMutationResolver.d.ts.map +1 -1
- package/dist/types/resolvers/mutation/person/ChangeProfileMutationResolver.d.ts.map +1 -1
- package/dist/types/resolvers/mutation/person/DisablePersonMutationResolver.d.ts +1 -1
- package/dist/types/resolvers/mutation/person/DisablePersonMutationResolver.d.ts.map +1 -1
- package/dist/types/resolvers/mutation/person/EmailOtpMutationResolver.d.ts.map +1 -1
- package/dist/types/resolvers/mutation/person/EmailVerificationMutationResolver.d.ts.map +1 -1
- package/dist/types/resolvers/mutation/person/EnablePersonMutationResolver.d.ts +11 -0
- package/dist/types/resolvers/mutation/person/EnablePersonMutationResolver.d.ts.map +1 -0
- package/dist/types/resolvers/mutation/person/ForceSignOutMutationResolver.d.ts.map +1 -1
- package/dist/types/resolvers/mutation/person/IDPMutationResolver.d.ts.map +1 -1
- package/dist/types/resolvers/mutation/person/InviteMutationResolver.d.ts.map +1 -1
- package/dist/types/resolvers/mutation/person/OtpMutationResolver.d.ts.map +1 -1
- package/dist/types/resolvers/mutation/person/PasswordlessMutationResolver.d.ts.map +1 -1
- package/dist/types/resolvers/mutation/person/RegenerateBackupCodesMutationResolver.d.ts.map +1 -1
- package/dist/types/resolvers/mutation/person/ResetPasswordMutationResolver.d.ts.map +1 -1
- package/dist/types/resolvers/mutation/person/ResetPersonMfaMutationResolver.d.ts.map +1 -1
- package/dist/types/resolvers/mutation/person/RevokeSessionMutationResolver.d.ts.map +1 -1
- package/dist/types/resolvers/mutation/person/SignInMutationResolver.d.ts.map +1 -1
- package/dist/types/resolvers/mutation/person/SignOutMutationResolver.d.ts.map +1 -1
- package/dist/types/resolvers/mutation/person/SignUpMutationResolver.d.ts.map +1 -1
- package/dist/types/resolvers/mutation/person/TogglePasswordlessMutationResolver.d.ts.map +1 -1
- package/dist/types/resolvers/mutation/project/CreateProjectMutationResolver.d.ts.map +1 -1
- package/dist/types/resolvers/mutation/project/SetProjectSecretMutationResolver.d.ts.map +1 -1
- package/dist/types/resolvers/mutation/project/UpdateProjectMutationResolver.d.ts.map +1 -1
- package/dist/types/resolvers/mutation/projectMember/AddProjectMemberMutationResolver.d.ts.map +1 -1
- package/dist/types/resolvers/mutation/projectMember/RemoveProjectMemberMutationResolver.d.ts.map +1 -1
- package/dist/types/resolvers/mutation/projectMember/UpdateProjectMemberMutationResolver.d.ts.map +1 -1
- package/dist/types/resolvers/mutation/projectMember/audit.d.ts +1 -1
- package/dist/types/resolvers/mutation/projectMember/audit.d.ts.map +1 -1
- package/dist/types/resolvers/query/ApiKeyQueryResolver.d.ts.map +1 -1
- package/dist/types/resolvers/query/AuthLogQueryResolver.d.ts.map +1 -1
- package/dist/types/resolvers/query/AuthPolicyQueryResolver.d.ts.map +1 -1
- package/dist/types/resolvers/query/ConfigurationQueryResolver.d.ts.map +1 -1
- package/dist/types/resolvers/query/CustomRoleQueryResolver.d.ts +11 -0
- package/dist/types/resolvers/query/CustomRoleQueryResolver.d.ts.map +1 -0
- package/dist/types/resolvers/query/IDPQueryResolver.d.ts.map +1 -1
- package/dist/types/resolvers/query/MailTemplateQueryResolver.d.ts +1 -0
- package/dist/types/resolvers/query/MailTemplateQueryResolver.d.ts.map +1 -1
- package/dist/types/resolvers/query/MeQueryResolver.d.ts.map +1 -1
- package/dist/types/resolvers/query/PersonQueryResolver.d.ts.map +1 -1
- package/dist/types/resolvers/query/ProjectMembersQueryResolver.d.ts.map +1 -1
- package/dist/types/resolvers/query/ProjectQueryResolver.d.ts.map +1 -1
- package/dist/types/resolvers/responseHelpers/ApiKeyResponseFactory.d.ts.map +1 -1
- package/dist/types/resolvers/responseHelpers/PersonResponseFactory.d.ts.map +1 -1
- package/dist/types/resolvers/responseHelpers/ProjectResponseFactory.d.ts +10 -0
- package/dist/types/resolvers/responseHelpers/ProjectResponseFactory.d.ts.map +1 -0
- package/dist/types/resolvers/responseHelpers/SignInResponseFactory.d.ts.map +1 -1
- package/dist/types/resolvers/types/IdentityTypeResolver.d.ts.map +1 -1
- package/dist/types/resolvers/types/PersonTypeResolver.d.ts +15 -1
- package/dist/types/resolvers/types/PersonTypeResolver.d.ts.map +1 -1
- package/dist/types/resolvers/types/ProjectTypeResolver.d.ts +15 -6
- package/dist/types/resolvers/types/ProjectTypeResolver.d.ts.map +1 -1
- package/dist/types/schema/index.d.ts +381 -21
- package/dist/types/schema/index.d.ts.map +1 -1
- package/dist/types/schema/tenant.graphql.d.ts.map +1 -1
- package/dist/types/schema/types.d.ts +2 -2
- package/dist/types/schema/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dist/types/utils/Mailer.d.ts.map +1 -1
- package/dist/types/utils/TemplateRenderer.d.ts.map +1 -1
- package/dist/types/utils/array.d.ts.map +1 -1
- package/dist/types/utils/batchQuery.d.ts.map +1 -1
- package/package.json +12 -12
- package/readme.md +56 -0
- package/src/TenantContainer.ts +46 -8
- package/src/migrations/2026-06-18-120000-idp-claim-mapping.ts +15 -0
- package/src/migrations/2026-08-03-120000-person-enable-auth-log.ts +12 -0
- package/src/migrations/2026-08-04-120000-config-panel.ts +13 -0
- package/src/migrations/2026-09-04-120000-idp-disable-local-authentication.ts +18 -0
- package/src/migrations/2026-09-11-120000-custom-role.ts +19 -0
- package/src/migrations/runner.ts +10 -0
- package/src/migrations/snapshot.ts +22 -2
- package/src/model/authorization/CustomRoleAuthorizator.ts +72 -0
- package/src/model/authorization/CustomRolePermissions.ts +558 -0
- package/src/model/authorization/PermissionActions.ts +74 -17
- package/src/model/authorization/PermissionContextFactory.ts +39 -3
- package/src/model/authorization/PermissionsFactory.ts +65 -31
- package/src/model/authorization/Roles.ts +13 -0
- package/src/model/authorization/TargetIdentityPermission.ts +37 -0
- package/src/model/authorization/index.ts +3 -0
- package/src/model/commands/apiKey/ApiKeyHelper.ts +23 -0
- package/src/model/commands/apiKey/CreateApiKeyCommand.ts +12 -5
- package/src/model/commands/apiKey/ProlongApiKeyCommand.ts +22 -14
- package/src/model/commands/authLog/CreateAuthLogEntryCommand.ts +1 -0
- package/src/model/commands/configuration/UpdateConfigurationCommand.ts +5 -4
- package/src/model/commands/customRole/CreateCustomRoleCommand.ts +30 -0
- package/src/model/commands/customRole/DeleteCustomRoleCommand.ts +20 -0
- package/src/model/commands/customRole/RemoveCustomRoleAssignmentsCommand.ts +20 -0
- package/src/model/commands/customRole/UpdateCustomRoleCommand.ts +30 -0
- package/src/model/commands/customRole/index.ts +4 -0
- package/src/model/commands/identity/PatchIdentityGlobalRoles.ts +1 -1
- package/src/model/commands/idp/ClaimIdpRevalidationCommand.ts +8 -7
- package/src/model/commands/idp/CreateIdpCommand.ts +7 -1
- package/src/model/commands/idp/CreateIdpSessionCommand.ts +5 -2
- package/src/model/commands/idp/UpdateIdpCommand.ts +5 -1
- package/src/model/commands/idp/UpdateIdpSessionCommand.ts +3 -2
- package/src/model/commands/index.ts +1 -0
- package/src/model/commands/membership/UpdateProjectMemberCommand.ts +1 -1
- package/src/model/commands/membership/index.ts +2 -1
- package/src/model/commands/membership/variables/index.ts +1 -0
- package/src/model/commands/person/CreatePersonCommand.ts +1 -0
- package/src/model/commands/person/EnablePersonCommand.ts +18 -0
- package/src/model/commands/person/SetMfaGraceUntilCommand.ts +9 -4
- package/src/model/commands/personToken/ResetPasswordCommand.ts +2 -3
- package/src/model/commands/personToken/SaveEmailOtpTokenCommand.ts +5 -4
- package/src/model/commands/personToken/SavePersonTokenCommand.ts +13 -7
- package/src/model/commands/rateLimit/RecordRateLimitEventCommand.ts +3 -1
- package/src/model/queries/apiKey/ApiKeyQuery.ts +17 -1
- package/src/model/queries/apiKey/ApiKeySessionsQuery.ts +2 -2
- package/src/model/queries/authLog/NextLoginAttemptQuery.ts +14 -12
- package/src/model/queries/authLog/NextMailAttemptQuery.ts +12 -10
- package/src/model/queries/configuration/ConfigurationQuery.ts +4 -0
- package/src/model/queries/customRole/CustomRolesQuery.ts +30 -0
- package/src/model/queries/customRole/index.ts +1 -0
- package/src/model/queries/identity/IdentitiesHoldingRoleCountQuery.ts +17 -0
- package/src/model/queries/identity/IdentityQuery.ts +10 -4
- package/src/model/queries/identity/index.ts +1 -0
- package/src/model/queries/idp/LocalAuthDisablingIdpsQuery.ts +41 -0
- package/src/model/queries/idp/PersonIdentityProvidersQuery.ts +2 -0
- package/src/model/queries/idp/helpers.ts +3 -2
- package/src/model/queries/idp/index.ts +1 -0
- package/src/model/queries/idp/types.ts +1 -0
- package/src/model/queries/index.ts +1 -0
- package/src/model/queries/membership/IdentityHasProjectMembershipsQuery.ts +17 -0
- package/src/model/queries/membership/ProjectMembersQuery.ts +1 -0
- package/src/model/queries/membership/index.ts +1 -0
- package/src/model/queries/person/PersonQueryBuilderFactory.ts +4 -0
- package/src/model/queries/person/types.ts +3 -0
- package/src/model/queries/personToken/PersonTokenQuery.ts +4 -0
- package/src/model/queries/rateLimit/RateLimitCountQuery.ts +5 -2
- package/src/model/service/AuthLogService.ts +18 -2
- package/src/model/service/CustomRoleManager.ts +221 -0
- package/src/model/service/EmailChangeManager.ts +3 -3
- package/src/model/service/EmailOtpManager.ts +0 -1
- package/src/model/service/EmailVerificationManager.ts +3 -3
- package/src/model/service/GlobalRoleValidator.ts +30 -0
- package/src/model/service/IDPSignInManager.ts +74 -14
- package/src/model/service/PanelAccessResolver.ts +32 -0
- package/src/model/service/PasswordResetManager.ts +11 -3
- package/src/model/service/PasswordlessSignInManager.ts +26 -6
- package/src/model/service/PersonAccessManager.ts +19 -3
- package/src/model/service/RateLimiter.ts +2 -3
- package/src/model/service/RolesManager.ts +28 -14
- package/src/model/service/SignInManager.ts +16 -8
- package/src/model/service/SignUpManager.ts +12 -4
- package/src/model/service/apiKey/ApiKeyManager.ts +75 -53
- package/src/model/service/apiKey/ApiKeyService.ts +2 -2
- package/src/model/service/apiKey/UnpersistedApiKeyManager.ts +24 -0
- package/src/model/service/idp/ClaimMapping.ts +283 -0
- package/src/model/service/idp/ClaimMappingEvaluator.ts +226 -0
- package/src/model/service/idp/ClaimMappingValidation.ts +158 -0
- package/src/model/service/idp/IDPClaimSyncService.ts +401 -0
- package/src/model/service/idp/IDPManager.ts +126 -21
- package/src/model/service/idp/IdentityProviderHandler.ts +7 -0
- package/src/model/service/idp/IdpSessionRevalidator.ts +130 -25
- package/src/model/service/idp/PersonIdentityProviderManager.ts +8 -0
- package/src/model/service/idp/index.ts +4 -0
- package/src/model/service/idp/providers/OIDCHelpers.ts +161 -53
- package/src/model/service/idp/providers/OIDCProvider.ts +4 -1
- package/src/model/service/index.ts +3 -0
- package/src/model/type/AuthLog.ts +4 -0
- package/src/model/type/Config.ts +3 -0
- package/src/model/type/CustomRole.ts +8 -0
- package/src/model/type/IdentityProvider.ts +2 -0
- package/src/model/type/PersonToken.ts +2 -0
- package/src/model/type/index.ts +1 -0
- package/src/model/utils/DatabaseContext.ts +30 -6
- package/src/model/utils/token.ts +2 -3
- package/src/resolvers/ResolverFactory.ts +17 -0
- package/src/resolvers/TenantResolverContext.ts +1 -1
- package/src/resolvers/TenantResolverContextFactory.ts +5 -5
- package/src/resolvers/mutation/apiKey/CreateApiKeyMutationResolver.ts +13 -5
- package/src/resolvers/mutation/customRole/CustomRoleMutationResolver.ts +125 -0
- package/src/resolvers/mutation/identity/GlobalRolesMutationResolver.ts +30 -7
- package/src/resolvers/mutation/idp/AddIDPMutationResolver.ts +1 -0
- package/src/resolvers/mutation/idp/UpdateIDPMutationResolver.ts +1 -0
- package/src/resolvers/mutation/idp/audit.ts +1 -0
- package/src/resolvers/mutation/mailTemplates/MailTemplateMutationResolver.ts +48 -14
- package/src/resolvers/mutation/person/ChangePasswordMutationResolver.ts +2 -2
- package/src/resolvers/mutation/person/ChangeProfileMutationResolver.ts +9 -3
- package/src/resolvers/mutation/person/DisablePersonMutationResolver.ts +5 -5
- package/src/resolvers/mutation/person/EmailVerificationMutationResolver.ts +1 -1
- package/src/resolvers/mutation/person/EnablePersonMutationResolver.ts +50 -0
- package/src/resolvers/mutation/person/ForceSignOutMutationResolver.ts +2 -2
- package/src/resolvers/mutation/person/IDPMutationResolver.ts +31 -0
- package/src/resolvers/mutation/person/PasswordlessMutationResolver.ts +7 -0
- package/src/resolvers/mutation/person/ResetPasswordMutationResolver.ts +1 -1
- package/src/resolvers/mutation/person/ResetPersonMfaMutationResolver.ts +2 -2
- package/src/resolvers/mutation/person/SignInMutationResolver.ts +22 -9
- package/src/resolvers/mutation/person/SignUpMutationResolver.ts +1 -1
- package/src/resolvers/query/CustomRoleQueryResolver.ts +41 -0
- package/src/resolvers/query/MailTemplateQueryResolver.ts +13 -8
- package/src/resolvers/query/PersonQueryResolver.ts +3 -1
- package/src/resolvers/query/ProjectQueryResolver.ts +3 -2
- package/src/resolvers/responseHelpers/PersonResponseFactory.ts +5 -0
- package/src/resolvers/responseHelpers/ProjectResponseFactory.ts +24 -0
- package/src/resolvers/responseHelpers/SignInResponseFactory.ts +1 -1
- package/src/resolvers/types/IdentityTypeResolver.ts +50 -14
- package/src/resolvers/types/PersonTypeResolver.ts +45 -4
- package/src/resolvers/types/ProjectTypeResolver.ts +33 -1
- package/src/schema/index.ts +483 -15
- package/src/schema/tenant.graphql.ts +275 -15
- package/tests/cases/integration/database/dbClock.test.ts +171 -0
- package/tests/cases/integration/mocked/antiAbuseSignUp.test.ts +2 -2
- package/tests/cases/integration/mocked/changeMyProfileEmailVerificationMutation.test.ts +10 -11
- package/tests/cases/integration/mocked/changePasswordMutation.test.ts +43 -0
- package/tests/cases/integration/mocked/changeProfileMutation.test.ts +2 -0
- package/tests/cases/integration/mocked/configurationPanel.test.ts +105 -0
- package/tests/cases/integration/mocked/confirmEmailChangeMutation.test.ts +4 -2
- package/tests/cases/integration/mocked/createSessionKeyMutation.test.ts +33 -0
- package/tests/cases/integration/mocked/customRoleCrud.test.ts +442 -0
- package/tests/cases/integration/mocked/disablePersonMutation.test.ts +92 -0
- package/tests/cases/integration/mocked/enablePersonMutation.test.ts +137 -0
- package/tests/cases/integration/mocked/forceSignOutPersonMutation.test.ts +3 -1
- package/tests/cases/integration/mocked/globalIdentityRolesMutation.test.ts +169 -3
- package/tests/cases/integration/mocked/gql/passwordless.ts +10 -0
- package/tests/cases/integration/mocked/idpClaimMappingConfig.test.ts +332 -0
- package/tests/cases/integration/mocked/listProjectMembersQuery.test.ts +8 -3
- package/tests/cases/integration/mocked/localAuthenticationDisabled.test.ts +182 -0
- package/tests/cases/integration/mocked/mailTemplateScope.test.ts +95 -0
- package/tests/cases/integration/mocked/permissionsQuery.test.ts +153 -0
- package/tests/cases/integration/mocked/personByIdQuery.test.ts +59 -1
- package/tests/cases/integration/mocked/personIdentityProviders.test.ts +67 -0
- package/tests/cases/integration/mocked/personsQuery.test.ts +38 -5
- package/tests/cases/integration/mocked/requestEmailVerificationMutation.test.ts +15 -6
- package/tests/cases/integration/mocked/resetPersonMfaMutation.test.ts +5 -3
- package/tests/cases/integration/mocked/signInAnomalyDetection.test.ts +13 -2
- package/tests/cases/integration/mocked/signInIdpClaimMapping.test.ts +1258 -0
- package/tests/cases/integration/mocked/signInIdpClaimMappingFixes.test.ts +344 -0
- package/tests/cases/integration/mocked/signInIdpClaimMappingSafety.test.ts +531 -0
- package/tests/cases/integration/mocked/signInIdpMutation.test.ts +105 -1
- package/tests/cases/integration/mocked/signInMfaEnforcement.test.ts +20 -5
- package/tests/cases/integration/mocked/signInMutation.test.ts +14 -0
- package/tests/cases/integration/mocked/signInPasswordlessMutation.test.ts +38 -1
- package/tests/cases/integration/mocked/signUpMutation.test.ts +62 -3
- package/tests/cases/integration/mocked/sql/createPersonTokenSql.ts +4 -3
- package/tests/cases/integration/mocked/sql/createSessionKeySql.ts +2 -2
- package/tests/cases/integration/mocked/sql/emailOtpSql.ts +10 -8
- package/tests/cases/integration/mocked/sql/getApiKeySql.ts +2 -2
- package/tests/cases/integration/mocked/sql/getConfigSql.ts +3 -0
- package/tests/cases/integration/mocked/sql/getCustomRolesSql.ts +25 -0
- package/tests/cases/integration/mocked/sql/getIdentityProjectMembershipPresenceSql.ts +11 -0
- package/tests/cases/integration/mocked/sql/getIdpBySlugSql.ts +1 -1
- package/tests/cases/integration/mocked/sql/getNextLoginAttemptSql.ts +15 -11
- package/tests/cases/integration/mocked/sql/getNextMailAttemptSql.ts +12 -13
- package/tests/cases/integration/mocked/sql/getPersonByEmailSql.ts +5 -2
- package/tests/cases/integration/mocked/sql/getPersonByIdSql.ts +1 -1
- package/tests/cases/integration/mocked/sql/getPersonByIdentity.ts +1 -1
- package/tests/cases/integration/mocked/sql/getPersonByIdpSql.ts +1 -1
- package/tests/cases/integration/mocked/sql/getPersonsByIdentitySql.ts +1 -1
- package/tests/cases/integration/mocked/sql/getProjectBySlugSql.ts +1 -1
- package/tests/cases/integration/mocked/sql/listPersonsSql.ts +5 -2
- package/tests/cases/integration/mocked/sql/listSessionsSql.ts +3 -3
- package/tests/cases/integration/mocked/sql/localAuthDisablingIdpsSql.ts +21 -0
- package/tests/cases/integration/mocked/sql/personIdentityProvidersSql.ts +4 -2
- package/tests/cases/integration/mocked/sql/removeMembershipSql.ts +14 -0
- package/tests/cases/integration/mocked/sql/sqlTransaction.ts +28 -0
- package/tests/cases/integration/mocked/trustForwardedClientInfo.test.ts +60 -3
- package/tests/cases/integration/mocked/verifyEmailMutation.test.ts +9 -5
- package/tests/cases/unit/apiKey/createSessionApiKeyPolicy.test.ts +9 -6
- package/tests/cases/unit/apiKey/prolongApiKeyCommand.test.ts +29 -19
- package/tests/cases/unit/apiKey/unpersistedApiKeyManager.test.ts +4 -5
- package/tests/cases/unit/apiKey/verifyAndProlongIdle.test.ts +16 -6
- package/tests/cases/unit/apiKey/verifyAndProlongReplica.test.ts +173 -0
- package/tests/cases/unit/authLogBaselineWrite.test.ts +26 -3
- package/tests/cases/unit/backupCodeManager.test.ts +1 -0
- package/tests/cases/unit/customRoleAuthorizator.test.ts +149 -0
- package/tests/cases/unit/customRolePermissions.test.ts +583 -0
- package/tests/cases/unit/databaseContextRetry.test.ts +81 -0
- package/tests/cases/unit/emailOtpManager.test.ts +10 -8
- package/tests/cases/unit/idp/claimIdpRevalidation.test.ts +50 -0
- package/tests/cases/unit/idp/claimMappingEvaluator.test.ts +554 -0
- package/tests/cases/unit/idp/claimMappingValidation.test.ts +134 -0
- package/tests/cases/unit/idp/idpManagerConfigMerge.test.ts +97 -0
- package/tests/cases/unit/idp/idpManagerUnknownConfigKeys.test.ts +108 -0
- package/tests/cases/unit/idp/idpSessionRevalidator.test.ts +261 -26
- package/tests/cases/unit/idp/oidcClaims.test.ts +29 -0
- package/tests/cases/unit/idp/oidcResponse.test.ts +54 -0
- package/tests/cases/unit/idp/oidcRevalidate.test.ts +94 -2
- package/tests/cases/unit/otpManager.test.ts +1 -0
- package/tests/cases/unit/panelAccessResolver.test.ts +57 -0
- package/tests/cases/unit/rateLimiter.test.ts +7 -7
- package/tests/cases/unit/savePersonTokenCommand.test.ts +40 -0
- package/tests/cases/unit/updateConfigurationCommand.test.ts +63 -0
- package/tests/src/IdPMock.ts +6 -0
- package/tests/src/testTenant.ts +60 -12
- package/dist/development/src/model/commands/membership/RemoveProjectMembershipsCommand.cjs.map +0 -1
- package/dist/development/src/model/commands/membership/RemoveProjectMembershipsCommand.js.map +0 -1
- package/dist/production/src/model/commands/membership/RemoveProjectMembershipsCommand.cjs.map +0 -1
- package/dist/production/src/model/commands/membership/RemoveProjectMembershipsCommand.js.map +0 -1
- package/dist/types/model/commands/membership/RemoveProjectMembershipsCommand.d.ts.map +0 -1
- /package/src/model/commands/membership/{RemoveProjectMembershipsCommand.ts → RemoveProjectMembershipCommand.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiKeyManager.cjs","sources":["../../../../../../../packages/engine-tenant-api/src/model/service/apiKey/ApiKeyManager.ts"],"sourcesContent":["import {\n\tApiKeyRequestInfo,\n\tCreateApiKeyCommand,\n\tDisableApiKeyCommand,\n\tDisableIdentityApiKeysCommand,\n\tDisableOneOffApiKeyCommand,\n\tPROLONG_THROTTLE_MS,\n\tProlongApiKeyCommand,\n} from '../../commands/index.js'\nimport { ApiKey } from '../../type/index.js'\n\nimport { Response, ResponseError, ResponseOk } from '../../utils/Response.js'\nimport { DatabaseContext, TokenHash } from '../../utils/index.js'\nimport { ApiKeyService, CreateApiKeyResponse } from './ApiKeyService.js'\nimport assert from 'node:assert'\nimport { Acl } from '@contember/schema'\nimport { ApiKeyByIdQuery, ApiKeyByTokenQuery, ApiKeyRow, ConfigurationQuery, IdentityQuery } from '../../queries/index.js'\nimport PostgresInterval from 'postgres-interval'\nimport { Config } from '../../type/Config.js'\nimport { intervalToPostgres, intervalToSeconds } from '../../utils/interval.js'\nimport { AuthPolicyResolver } from '../AuthPolicyResolver.js'\nimport { AuthLogService } from '../AuthLogService.js'\nimport { IdpSessionRevalidator } from '../idp/IdpSessionRevalidator.js'\nimport { UnpersistedApiKeyManager } from './UnpersistedApiKeyManager.js'\n\nexport class ApiKeyManager {\n\tconstructor(\n\t\tprivate readonly apiKeyService: ApiKeyService,\n\t\tprivate readonly authPolicyResolver: AuthPolicyResolver,\n\t\tprivate readonly authLogService: AuthLogService,\n\t\tprivate readonly unpersistedApiKeyManager: UnpersistedApiKeyManager = new UnpersistedApiKeyManager(),\n\t\tprivate readonly idpSessionRevalidator?: IdpSessionRevalidator,\n\t) {}\n\n\tasync verifyAndProlong(\n\t\tdbContext: DatabaseContext,\n\t\treadDbContext: DatabaseContext,\n\t\ttoken: string,\n\t\trequestInfo?: ApiKeyRequestInfo,\n\t\tforwardedInfo?: ApiKeyRequestInfo,\n\t): Promise<VerifyResponse> {\n\t\tconst unpersistedResult = this.unpersistedApiKeyManager.verify(token)\n\t\tif (unpersistedResult !== null) {\n\t\t\t// Configured (unpersisted) root token: no DB row to prolong/track.\n\t\t\treturn new ResponseOk(unpersistedResult)\n\t\t}\n\n\t\tconst apiKeyRow = await readDbContext.queryHandler.fetch(new ApiKeyByTokenQuery(token))\n\t\tif (apiKeyRow === null) {\n\t\t\treturn new ResponseError(VerifyErrorCode.NOT_FOUND, 'API key was not found')\n\t\t}\n\n\t\tif (apiKeyRow.disabled_at !== null) {\n\t\t\treturn new ResponseError(\n\t\t\t\tVerifyErrorCode.DISABLED,\n\t\t\t\t`API key was disabled at ${apiKeyRow.disabled_at.toISOString()}`,\n\t\t\t)\n\t\t}\n\n\t\t// Single injectable clock for all session-policy time math (matches issuance,\n\t\t// which uses providers.now()), so the A19 idle/max logic is deterministically testable.\n\t\tconst now = dbContext.providers.now()\n\t\tif (apiKeyRow.expires_at !== null && apiKeyRow.expires_at <= now) {\n\t\t\treturn new ResponseError(VerifyErrorCode.DISABLED, `API key expired at ${apiKeyRow.expires_at.toISOString()}`)\n\t\t}\n\n\t\t// A19: absolute hard cap (defensive — the prolong clamp should already keep\n\t\t// expires_at <= max_expires_at, but enforce it here regardless).\n\t\tif (apiKeyRow.max_expires_at !== null && apiKeyRow.max_expires_at <= now) {\n\t\t\tawait dbContext.commandBus.execute(new DisableApiKeyCommand(apiKeyRow.id))\n\t\t\treturn new ResponseError(\n\t\t\t\tVerifyErrorCode.DISABLED,\n\t\t\t\t`API key reached its maximum lifetime at ${apiKeyRow.max_expires_at.toISOString()}`,\n\t\t\t)\n\t\t}\n\n\t\t// A19: idle timeout. Reject + disable when the session has been idle longer\n\t\t// than the policy's idle_timeout. A null idle_timeout (today's default) or a\n\t\t// never-used key (last_used_at null) are never idle-expired.\n\t\tif (apiKeyRow.idle_timeout !== null && apiKeyRow.last_used_at !== null) {\n\t\t\tconst idleMs = intervalToSeconds(apiKeyRow.idle_timeout) * 1000\n\t\t\t// last_used_at is written at most once per PROLONG_THROTTLE_MS (tracking is\n\t\t\t// throttled), so it can legitimately lag a continuously-active session by up\n\t\t\t// to that window. Add the throttle as slack so a small idle_timeout can't\n\t\t\t// idle-expire a session that is actually in use.\n\t\t\tif (now.getTime() - apiKeyRow.last_used_at.getTime() > idleMs + PROLONG_THROTTLE_MS) {\n\t\t\t\tawait dbContext.commandBus.execute(new DisableApiKeyCommand(apiKeyRow.id))\n\t\t\t\ttry {\n\t\t\t\t\tawait this.authLogService.logSessionEvent(dbContext, {\n\t\t\t\t\t\ttype: 'session_expired_idle',\n\t\t\t\t\t\tidentityId: apiKeyRow.identity_id,\n\t\t\t\t\t\tpersonId: apiKeyRow.person_id,\n\t\t\t\t\t\tipAddress: requestInfo?.ip,\n\t\t\t\t\t\tuserAgent: requestInfo?.userAgent,\n\t\t\t\t\t\tsuccess: false,\n\t\t\t\t\t\teventData: {\n\t\t\t\t\t\t\tlastUsedAt: apiKeyRow.last_used_at?.toISOString() ?? null,\n\t\t\t\t\t\t\tidleTimeout: String(apiKeyRow.idle_timeout),\n\t\t\t\t\t\t},\n\t\t\t\t\t})\n\t\t\t\t} catch {\n\t\t\t\t\t/* best-effort: auth path must stay resilient */\n\t\t\t\t}\n\t\t\t\treturn new ResponseError(\n\t\t\t\t\tVerifyErrorCode.DISABLED,\n\t\t\t\t\t`API key was idle since ${apiKeyRow.last_used_at.toISOString()} and exceeded the idle timeout`,\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\n\t\tconst effectiveInfo: ApiKeyRequestInfo | undefined = apiKeyRow.trust_forwarded_info && forwardedInfo\n\t\t\t? {\n\t\t\t\tip: forwardedInfo.ip ?? requestInfo?.ip,\n\t\t\t\tuserAgent: forwardedInfo.userAgent ?? requestInfo?.userAgent,\n\t\t\t}\n\t\t\t: requestInfo\n\n\t\t// Re-validate IdP-backed sessions against their identity provider (A24). In the\n\t\t// default `background` mode this returns immediately and revalidates after the\n\t\t// response (revocation lands on the next request); in `blocking` mode it can revoke\n\t\t// the current request. No-op for password sessions and IdPs without revalidation.\n\t\t// `effectiveInfo` is passed so the audit entries record the originating request's IP/UA.\n\t\tif (this.idpSessionRevalidator) {\n\t\t\tconst outcome = await this.idpSessionRevalidator.revalidate(dbContext, readDbContext, apiKeyRow, effectiveInfo)\n\t\t\tif (outcome === 'revoked') {\n\t\t\t\treturn new ResponseError(VerifyErrorCode.DISABLED, 'IdP session was revoked')\n\t\t\t}\n\t\t}\n\n\t\tsetImmediate(async () => {\n\t\t\tawait dbContext.commandBus.execute(\n\t\t\t\tnew ProlongApiKeyCommand(\n\t\t\t\t\tapiKeyRow.id,\n\t\t\t\t\tapiKeyRow.type,\n\t\t\t\t\tapiKeyRow.expiration,\n\t\t\t\t\tapiKeyRow.expires_at,\n\t\t\t\t\teffectiveInfo,\n\t\t\t\t\t{\n\t\t\t\t\t\tlastIp: apiKeyRow.last_ip,\n\t\t\t\t\t\tlastUserAgent: apiKeyRow.last_user_agent,\n\t\t\t\t\t\tlastUsedAt: apiKeyRow.last_used_at,\n\t\t\t\t\t},\n\t\t\t\t\tapiKeyRow.max_expires_at,\n\t\t\t\t),\n\t\t\t)\n\t\t})\n\n\t\treturn new ResponseOk(\n\t\t\tnew VerifyResult(\n\t\t\t\tapiKeyRow.identity_id,\n\t\t\t\tapiKeyRow.id,\n\t\t\t\tapiKeyRow.roles,\n\t\t\t\tapiKeyRow.person_id,\n\t\t\t\tapiKeyRow.trust_forwarded_info,\n\t\t\t),\n\t\t)\n\t}\n\n\tasync createSessionApiKey(\n\t\tdbContext: DatabaseContext,\n\t\tidentityId: string,\n\t\texpiration?: number,\n\t\trequestInfo?: ApiKeyRequestInfo,\n\t\ttrustForwardedInfo?: boolean,\n\t): Promise<string> {\n\t\tconst { token } = await this.createSessionApiKeyWithId(dbContext, identityId, expiration, requestInfo, trustForwardedInfo)\n\t\treturn token\n\t}\n\n\t/**\n\t * Like {@link createSessionApiKey} but also returns the api_key id — needed when the\n\t * caller has to bind another row to the session (e.g. an `idp_session` for IdP\n\t * re-validation).\n\t */\n\tasync createSessionApiKeyWithId(\n\t\tdbContext: DatabaseContext,\n\t\tidentityId: string,\n\t\texpiration?: number,\n\t\trequestInfo?: ApiKeyRequestInfo,\n\t\ttrustForwardedInfo?: boolean,\n\t): Promise<{ id: string; token: string }> {\n\t\tconst config = await dbContext.queryHandler.fetch(new ConfigurationQuery(dbContext.providers))\n\n\t\t// A19: snapshot the effective session policy onto the api_key at sign-in.\n\t\t// With no matching policy, every field is null/baseline and the result is\n\t\t// byte-for-byte today's behavior.\n\t\tconst [identityRow] = await dbContext.queryHandler.fetch(new IdentityQuery([identityId]))\n\t\tconst globalRoles = identityRow?.roles ?? []\n\t\tconst policy = await this.authPolicyResolver.resolveForIdentity(dbContext, identityId, globalRoles)\n\n\t\tconst defaultExpirationMinutes = intervalToSeconds(config.login.defaultTokenExpiration) / 60\n\t\t// remember_me_allowed === false: ignore a client-supplied longer lifetime and\n\t\t// force the default. (true/null leave the requested expiration untouched.)\n\t\tconst requestedMinutes = policy.rememberMeAllowed === false\n\t\t\t? defaultExpirationMinutes\n\t\t\t: (expiration ?? defaultExpirationMinutes)\n\n\t\t// Cap by maxTokenExpiration (existing behavior) AND by the policy's\n\t\t// tokenExpiration (A19) — strictest wins.\n\t\tlet expirationCapped = config.login.maxTokenExpiration\n\t\t\t? Math.min(requestedMinutes, intervalToSeconds(config.login.maxTokenExpiration) / 60)\n\t\t\t: requestedMinutes\n\t\tif (policy.tokenExpiration) {\n\t\t\texpirationCapped = Math.min(expirationCapped, intervalToSeconds(policy.tokenExpiration) / 60)\n\t\t}\n\n\t\t// Absolute hard cap: issued_at + policy.tokenExpiration. NULL = uncapped\n\t\t// sliding window (today's behavior).\n\t\tconst issuedAt = dbContext.providers.now()\n\t\tconst maxExpiresAt = policy.tokenExpiration\n\t\t\t? new Date(issuedAt.getTime() + intervalToSeconds(policy.tokenExpiration) * 1000)\n\t\t\t: null\n\n\t\tconst command = new CreateApiKeyCommand({\n\t\t\ttype: ApiKey.Type.SESSION,\n\t\t\tidentityId,\n\t\t\texpiration: expirationCapped,\n\t\t\trequestInfo,\n\t\t\ttrustForwardedInfo,\n\t\t\tidleTimeout: policy.idleTimeout ? intervalToPostgres(policy.idleTimeout) : null,\n\t\t\tmaxExpiresAt,\n\t\t})\n\t\tconst { id, token } = await dbContext.commandBus.execute(command)\n\t\tassert(token !== undefined)\n\n\t\t// A19: audit only when a policy is actually in effect. With zero auth_policy\n\t\t// rows the resolved policy is inert and no extra insert happens.\n\t\tconst policyApplied = policy.mfaRequired === true\n\t\t\t|| policy.tokenExpiration !== null\n\t\t\t|| policy.idleTimeout !== null\n\t\t\t|| policy.rememberMeAllowed !== null\n\t\tif (policyApplied) {\n\t\t\ttry {\n\t\t\t\tawait this.authLogService.logSessionEvent(dbContext, {\n\t\t\t\t\ttype: 'session_policy_applied',\n\t\t\t\t\tidentityId,\n\t\t\t\t\tipAddress: requestInfo?.ip,\n\t\t\t\t\tuserAgent: requestInfo?.userAgent,\n\t\t\t\t\tsuccess: true,\n\t\t\t\t\teventData: {\n\t\t\t\t\t\ttokenExpiration: policy.tokenExpiration ? intervalToPostgres(policy.tokenExpiration) : null,\n\t\t\t\t\t\tidleTimeout: policy.idleTimeout ? intervalToPostgres(policy.idleTimeout) : null,\n\t\t\t\t\t\trememberMeAllowed: policy.rememberMeAllowed,\n\t\t\t\t\t\tmfaRequired: policy.mfaRequired,\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t} catch {\n\t\t\t\t/* best-effort: sign-in must not break on an audit failure */\n\t\t\t}\n\t\t}\n\n\t\treturn { id, token }\n\t}\n\n\tasync findApiKey(dbContext: DatabaseContext, apiKeyId: string): Promise<ApiKeyRow | null> {\n\t\treturn await dbContext.queryHandler.fetch(\n\t\t\tnew ApiKeyByIdQuery(apiKeyId),\n\t\t)\n\t}\n\n\tasync disableOneOffApiKey(dbContext: DatabaseContext, apiKeyId: string): Promise<void> {\n\t\tawait dbContext.commandBus.execute(new DisableOneOffApiKeyCommand(apiKeyId))\n\t}\n\n\tasync disableApiKey(dbContext: DatabaseContext, apiKeyId: string): Promise<boolean> {\n\t\treturn await dbContext.commandBus.execute(new DisableApiKeyCommand(apiKeyId))\n\t}\n\n\tasync disableIdentityApiKeys(dbContext: DatabaseContext, identityId: string): Promise<void> {\n\t\tawait dbContext.commandBus.execute(new DisableIdentityApiKeysCommand(identityId))\n\t}\n\n\tasync createGlobalPermanentApiKey(\n\t\tdbContext: DatabaseContext,\n\t\tdescription: string,\n\t\troles: readonly string[],\n\t\ttokenHash?: TokenHash,\n\t\ttrustForwardedInfo?: boolean,\n\t): Promise<CreateApiKeyResponse> {\n\t\treturn await dbContext.transaction(async db => {\n\t\t\treturn await this.apiKeyService.createPermanentApiKey(db, description, roles, tokenHash, trustForwardedInfo)\n\t\t})\n\t}\n\n\tasync createProjectPermanentApiKey(\n\t\tdbContext: DatabaseContext,\n\t\tprojectId: string,\n\t\tmemberships: readonly Acl.Membership[],\n\t\tdescription: string,\n\t\ttokenHash?: TokenHash,\n\t\ttrustForwardedInfo?: boolean,\n\t): Promise<CreateApiKeyResponse> {\n\t\treturn await dbContext.transaction(async db => {\n\t\t\treturn await this.apiKeyService.createProjectPermanentApiKey(db, projectId, memberships, description, tokenHash, trustForwardedInfo)\n\t\t})\n\t}\n}\n\nexport type VerifyResponse = Response<VerifyResult, VerifyErrorCode>\n\nexport class VerifyResult {\n\treadonly valid = true\n\n\tconstructor(\n\t\tpublic readonly identityId: string,\n\t\tpublic readonly apiKeyId: string,\n\t\tpublic readonly roles: string[],\n\t\tpublic readonly personId: string | null,\n\t\tpublic readonly trustForwardedInfo: boolean = false,\n\t) {}\n}\n\nexport enum VerifyErrorCode {\n\tNOT_FOUND = 'not_found',\n\tDISABLED = 'disabled',\n\tEXPIRED = 'expired',\n\tNO_AUTH_HEADER = 'no_auth_header',\n\tINVALID_AUTH_HEADER = 'invalid_auth_header',\n}\n"],"names":["UnpersistedApiKeyManager","ResponseOk","ApiKeyByTokenQuery","ResponseError","DisableApiKeyCommand","intervalToSeconds","PROLONG_THROTTLE_MS","ProlongApiKeyCommand","ConfigurationQuery","IdentityQuery","CreateApiKeyCommand","ApiKey","intervalToPostgres","ApiKeyByIdQuery","DisableOneOffApiKeyCommand","DisableIdentityApiKeysCommand","VerifyErrorCode"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAyBO,MAAM,cAAc;AAAA,EAC1B,YACkB,eACA,oBACA,gBACA,2BAAqD,IAAIA,yBAAAA,yBAAA,GACzD,uBAChB;AALgB,SAAA,gBAAA;AACA,SAAA,qBAAA;AACA,SAAA,iBAAA;AACA,SAAA,2BAAA;AACA,SAAA,wBAAA;AAAA,EACf;AAAA,EAEH,MAAM,iBACL,WACA,eACA,OACA,aACA,eAC0B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AAA,EAEA,MAAM,6BACL,WACA,WACA,aACA,aACA,WACA,oBACgC;AAChC,WAAO,MAAM,UAAU,YAAY,OAAM,OAAM;AAC9C,aAAO,MAAM,KAAK,cAAc,6BAA6B,IAAI,WAAW,aAAa,aAAa,WAAW,kBAAkB;AAAA,IACpI,CAAC;AAAA,EACF;AACD;AAIO,MAAM,aAAa;AAAA,EAGzB,YACiB,YACA,UACA,OACA,UACA,qBAA8B,OAC7C;AALe,SAAA,aAAA;AACA,SAAA,WAAA;AACA,SAAA,QAAA;AACA,SAAA,WAAA;AACA,SAAA,qBAAA;AAPjB,kBAAA,MAAS,SAAQ,IAAA;AAAA,EAQd;AACJ;AAEO,IAAK,oCAAAC,qBAAL;AACNA,mBAAA,WAAA,IAAY;AACZA,mBAAA,UAAA,IAAW;AACXA,mBAAA,SAAA,IAAU;AACVA,mBAAA,gBAAA,IAAiB;AACjBA,mBAAA,qBAAA,IAAsB;AALX,SAAAA;AAAA,GAAA,mBAAA,CAAA,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"ApiKeyManager.cjs","sources":["../../../../../../../packages/engine-tenant-api/src/model/service/apiKey/ApiKeyManager.ts"],"sourcesContent":["import {\n\tApiKeyRequestInfo,\n\tCreateApiKeyCommand,\n\tDisableApiKeyCommand,\n\tDisableIdentityApiKeysCommand,\n\tDisableOneOffApiKeyCommand,\n\tProlongApiKeyCommand,\n} from '../../commands/index.js'\nimport { ApiKey } from '../../type/index.js'\n\nimport { Response, ResponseError, ResponseOk } from '../../utils/Response.js'\nimport { DatabaseContext, TokenHash } from '../../utils/index.js'\nimport { ApiKeyService, CreateApiKeyResponse } from './ApiKeyService.js'\nimport assert from 'node:assert'\nimport { Acl } from '@contember/schema'\nimport { ApiKeyByIdQuery, ApiKeyByTokenQuery, ApiKeyRow, ConfigurationQuery, IdentityQuery } from '../../queries/index.js'\nimport PostgresInterval from 'postgres-interval'\nimport { Config } from '../../type/Config.js'\nimport { intervalToPostgres, intervalToSeconds } from '../../utils/interval.js'\nimport { AuthPolicyResolver } from '../AuthPolicyResolver.js'\nimport { AuthLogService } from '../AuthLogService.js'\nimport { IdpSessionRevalidator } from '../idp/IdpSessionRevalidator.js'\nimport { UnpersistedApiKeyManager } from './UnpersistedApiKeyManager.js'\nimport { GlobalRoleValidator } from '../GlobalRoleValidator.js'\nimport { Connection } from '@contember/database'\n\nexport class ApiKeyManager {\n\tconstructor(\n\t\tprivate readonly apiKeyService: ApiKeyService,\n\t\tprivate readonly authPolicyResolver: AuthPolicyResolver,\n\t\tprivate readonly authLogService: AuthLogService,\n\t\tprivate readonly unpersistedApiKeyManager: UnpersistedApiKeyManager = new UnpersistedApiKeyManager(),\n\t\tprivate readonly idpSessionRevalidator?: IdpSessionRevalidator,\n\t\tprivate readonly globalRoleValidator: GlobalRoleValidator = new GlobalRoleValidator(),\n\t) {}\n\n\tasync verifyAndProlong(\n\t\tdbContext: DatabaseContext,\n\t\treadDbContext: DatabaseContext,\n\t\ttoken: string,\n\t\trequestInfo?: ApiKeyRequestInfo,\n\t\tforwardedInfo?: ApiKeyRequestInfo,\n\t): Promise<VerifyResponse> {\n\t\tconst unpersistedResult = this.unpersistedApiKeyManager.verify(token)\n\t\tif (unpersistedResult !== null) {\n\t\t\t// Configured (unpersisted) root token: no DB row to prolong/track.\n\t\t\treturn new ResponseOk(unpersistedResult)\n\t\t}\n\n\t\tconst fetchedApiKey = await this.fetchApiKeyByToken(dbContext, readDbContext, token)\n\t\tif (fetchedApiKey === null) {\n\t\t\treturn new ResponseError(VerifyErrorCode.NOT_FOUND, 'API key was not found')\n\t\t}\n\t\tconst apiKeyRow = fetchedApiKey.row\n\n\t\tif (apiKeyRow.disabled_at !== null) {\n\t\t\treturn new ResponseError(\n\t\t\t\tVerifyErrorCode.DISABLED,\n\t\t\t\t`API key was disabled at ${apiKeyRow.disabled_at.toISOString()}`,\n\t\t\t)\n\t\t}\n\n\t\t// A19 time gates are computed on the DATABASE clock by ApiKeyByTokenQuery\n\t\t// (is_expired / is_max_expired / is_idle_expired against NOW()), so app/DB clock\n\t\t// skew — or skew between engine instances — can't weaken them. The idle slack\n\t\t// (PROLONG_THROTTLE_MS) is folded into the SQL too. See engine-tenant-api/CLAUDE.md.\n\t\tif (apiKeyRow.is_expired) {\n\t\t\treturn new ResponseError(VerifyErrorCode.DISABLED, `API key expired at ${apiKeyRow.expires_at?.toISOString()}`)\n\t\t}\n\n\t\t// Absolute hard cap (defensive — the prolong clamp should already keep\n\t\t// expires_at <= max_expires_at, but enforce it here regardless).\n\t\tif (apiKeyRow.is_max_expired) {\n\t\t\tawait dbContext.commandBus.execute(new DisableApiKeyCommand(apiKeyRow.id))\n\t\t\treturn new ResponseError(\n\t\t\t\tVerifyErrorCode.DISABLED,\n\t\t\t\t`API key reached its maximum lifetime at ${apiKeyRow.max_expires_at?.toISOString()}`,\n\t\t\t)\n\t\t}\n\n\t\t// Idle timeout. Reject + disable when the session has been idle longer than the\n\t\t// policy's idle_timeout. A null idle_timeout (today's default) or a never-used\n\t\t// key (last_used_at null) are never idle-expired — the SQL encodes both.\n\t\tif (apiKeyRow.is_idle_expired) {\n\t\t\tawait dbContext.commandBus.execute(new DisableApiKeyCommand(apiKeyRow.id))\n\t\t\ttry {\n\t\t\t\tawait this.authLogService.logSessionEvent(dbContext, {\n\t\t\t\t\ttype: 'session_expired_idle',\n\t\t\t\t\tidentityId: apiKeyRow.identity_id,\n\t\t\t\t\tpersonId: apiKeyRow.person_id,\n\t\t\t\t\tipAddress: requestInfo?.ip,\n\t\t\t\t\tuserAgent: requestInfo?.userAgent,\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\teventData: {\n\t\t\t\t\t\tlastUsedAt: apiKeyRow.last_used_at?.toISOString() ?? null,\n\t\t\t\t\t\tidleTimeout: String(apiKeyRow.idle_timeout),\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t} catch {\n\t\t\t\t/* best-effort: auth path must stay resilient */\n\t\t\t}\n\t\t\treturn new ResponseError(\n\t\t\t\tVerifyErrorCode.DISABLED,\n\t\t\t\t`API key was idle since ${apiKeyRow.last_used_at?.toISOString()} and exceeded the idle timeout`,\n\t\t\t)\n\t\t}\n\n\t\tconst effectiveInfo: ApiKeyRequestInfo | undefined = apiKeyRow.trust_forwarded_info && forwardedInfo\n\t\t\t? {\n\t\t\t\tip: forwardedInfo.ip ?? requestInfo?.ip,\n\t\t\t\tuserAgent: forwardedInfo.userAgent ?? requestInfo?.userAgent,\n\t\t\t}\n\t\t\t: requestInfo\n\n\t\t// Re-validate IdP-backed sessions against their identity provider (A24). In the\n\t\t// default `background` mode this returns immediately and revalidates after the\n\t\t// response (revocation lands on the next request); in `blocking` mode it can revoke\n\t\t// the current request. No-op for password sessions and IdPs without revalidation.\n\t\t// `effectiveInfo` is passed so the audit entries record the originating request's IP/UA.\n\t\t// The idp_session row is written together with the api_key, so it is read from where the key was found.\n\t\tif (this.idpSessionRevalidator) {\n\t\t\tconst outcome = await this.idpSessionRevalidator.revalidate(dbContext, fetchedApiKey.sourceDbContext, apiKeyRow, effectiveInfo)\n\t\t\tif (outcome === 'revoked') {\n\t\t\t\treturn new ResponseError(VerifyErrorCode.DISABLED, 'IdP session was revoked')\n\t\t\t}\n\t\t}\n\n\t\t// Detached (runs after the response), so a rejection here would be an unhandledRejection and can take the\n\t\t// worker down. Tracking is best-effort — the next request writes it again.\n\t\tsetImmediate(() => {\n\t\t\tdbContext.commandBus.execute(\n\t\t\t\tnew ProlongApiKeyCommand(\n\t\t\t\t\tapiKeyRow.id,\n\t\t\t\t\tapiKeyRow.type,\n\t\t\t\t\tapiKeyRow.expiration,\n\t\t\t\t\tapiKeyRow.expires_at,\n\t\t\t\t\teffectiveInfo,\n\t\t\t\t\t{\n\t\t\t\t\t\tlastIp: apiKeyRow.last_ip,\n\t\t\t\t\t\tlastUserAgent: apiKeyRow.last_user_agent,\n\t\t\t\t\t\tlastUsedAt: apiKeyRow.last_used_at,\n\t\t\t\t\t},\n\t\t\t\t\tapiKeyRow.max_expires_at,\n\t\t\t\t),\n\t\t\t).catch(() => {})\n\t\t})\n\n\t\treturn new ResponseOk(\n\t\t\tnew VerifyResult(\n\t\t\t\tapiKeyRow.identity_id,\n\t\t\t\tapiKeyRow.id,\n\t\t\t\tapiKeyRow.roles,\n\t\t\t\tapiKeyRow.person_id,\n\t\t\t\tapiKeyRow.trust_forwarded_info,\n\t\t\t),\n\t\t)\n\t}\n\n\tprivate async fetchApiKeyByToken(dbContext: DatabaseContext, readDbContext: DatabaseContext, token: string): Promise<FetchedApiKey | null> {\n\t\tconst query = new ApiKeyByTokenQuery(token)\n\t\tconst replicaRow = await readDbContext.queryHandler.fetch(query)\n\t\tif (replicaRow !== null) {\n\t\t\treturn { row: replicaRow, sourceDbContext: readDbContext }\n\t\t}\n\t\tif (readDbContext.client.connection === dbContext.client.connection) {\n\t\t\treturn null\n\t\t}\n\t\t// A token issued moments ago (sign-in, createSessionToken) may not have reached the read replica yet.\n\t\tconst primaryRow = await dbContext.queryHandler.fetch(query)\n\t\treturn primaryRow !== null ? { row: primaryRow, sourceDbContext: dbContext } : null\n\t}\n\n\tasync createSessionApiKey(\n\t\tdbContext: DatabaseContext,\n\t\tidentityId: string,\n\t\texpiration?: number,\n\t\trequestInfo?: ApiKeyRequestInfo,\n\t\ttrustForwardedInfo?: boolean,\n\t): Promise<string> {\n\t\tconst { token } = await this.createSessionApiKeyWithId(dbContext, identityId, expiration, requestInfo, trustForwardedInfo)\n\t\treturn token\n\t}\n\n\t/**\n\t * Like {@link createSessionApiKey} but also returns the api_key id — needed when the\n\t * caller has to bind another row to the session (e.g. an `idp_session` for IdP\n\t * re-validation).\n\t */\n\tasync createSessionApiKeyWithId(\n\t\tdbContext: DatabaseContext,\n\t\tidentityId: string,\n\t\texpiration?: number,\n\t\trequestInfo?: ApiKeyRequestInfo,\n\t\ttrustForwardedInfo?: boolean,\n\t): Promise<{ id: string; token: string }> {\n\t\tconst config = await dbContext.queryHandler.fetch(new ConfigurationQuery(dbContext.providers))\n\n\t\t// A19: snapshot the effective session policy onto the api_key at sign-in.\n\t\t// With no matching policy, every field is null/baseline and the result is\n\t\t// byte-for-byte today's behavior.\n\t\tconst [identityRow] = await dbContext.queryHandler.fetch(new IdentityQuery([identityId]))\n\t\tconst globalRoles = identityRow?.roles ?? []\n\t\tconst policy = await this.authPolicyResolver.resolveForIdentity(dbContext, identityId, globalRoles)\n\n\t\tconst defaultExpirationMinutes = intervalToSeconds(config.login.defaultTokenExpiration) / 60\n\t\t// remember_me_allowed === false: ignore a client-supplied longer lifetime and\n\t\t// force the default. (true/null leave the requested expiration untouched.)\n\t\tconst requestedMinutes = policy.rememberMeAllowed === false\n\t\t\t? defaultExpirationMinutes\n\t\t\t: (expiration ?? defaultExpirationMinutes)\n\n\t\t// Cap by maxTokenExpiration (existing behavior) AND by the policy's\n\t\t// tokenExpiration (A19) — strictest wins.\n\t\tlet expirationCapped = config.login.maxTokenExpiration\n\t\t\t? Math.min(requestedMinutes, intervalToSeconds(config.login.maxTokenExpiration) / 60)\n\t\t\t: requestedMinutes\n\t\tif (policy.tokenExpiration) {\n\t\t\texpirationCapped = Math.min(expirationCapped, intervalToSeconds(policy.tokenExpiration) / 60)\n\t\t}\n\n\t\t// Absolute hard cap as a lifetime in seconds; CreateApiKeyCommand writes it as\n\t\t// now() + interval on the DB clock. NULL = uncapped sliding window (today's behavior).\n\t\tconst maxExpirationSeconds = policy.tokenExpiration\n\t\t\t? intervalToSeconds(policy.tokenExpiration)\n\t\t\t: null\n\n\t\tconst command = new CreateApiKeyCommand({\n\t\t\ttype: ApiKey.Type.SESSION,\n\t\t\tidentityId,\n\t\t\texpiration: expirationCapped,\n\t\t\trequestInfo,\n\t\t\ttrustForwardedInfo,\n\t\t\tidleTimeout: policy.idleTimeout ? intervalToPostgres(policy.idleTimeout) : null,\n\t\t\tmaxExpirationSeconds,\n\t\t})\n\t\tconst { id, token } = await dbContext.commandBus.execute(command)\n\t\tassert(token !== undefined)\n\n\t\t// A19: audit only when a policy is actually in effect. With zero auth_policy\n\t\t// rows the resolved policy is inert and no extra insert happens.\n\t\tconst policyApplied = policy.mfaRequired === true\n\t\t\t|| policy.tokenExpiration !== null\n\t\t\t|| policy.idleTimeout !== null\n\t\t\t|| policy.rememberMeAllowed !== null\n\t\tif (policyApplied) {\n\t\t\ttry {\n\t\t\t\tawait this.authLogService.logSessionEvent(dbContext, {\n\t\t\t\t\ttype: 'session_policy_applied',\n\t\t\t\t\tidentityId,\n\t\t\t\t\tipAddress: requestInfo?.ip,\n\t\t\t\t\tuserAgent: requestInfo?.userAgent,\n\t\t\t\t\tsuccess: true,\n\t\t\t\t\teventData: {\n\t\t\t\t\t\ttokenExpiration: policy.tokenExpiration ? intervalToPostgres(policy.tokenExpiration) : null,\n\t\t\t\t\t\tidleTimeout: policy.idleTimeout ? intervalToPostgres(policy.idleTimeout) : null,\n\t\t\t\t\t\trememberMeAllowed: policy.rememberMeAllowed,\n\t\t\t\t\t\tmfaRequired: policy.mfaRequired,\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t} catch {\n\t\t\t\t/* best-effort: sign-in must not break on an audit failure */\n\t\t\t}\n\t\t}\n\n\t\treturn { id, token }\n\t}\n\n\tasync findApiKey(dbContext: DatabaseContext, apiKeyId: string): Promise<ApiKeyRow | null> {\n\t\treturn await dbContext.queryHandler.fetch(\n\t\t\tnew ApiKeyByIdQuery(apiKeyId),\n\t\t)\n\t}\n\n\tasync disableOneOffApiKey(dbContext: DatabaseContext, apiKeyId: string): Promise<void> {\n\t\tawait dbContext.commandBus.execute(new DisableOneOffApiKeyCommand(apiKeyId))\n\t}\n\n\tasync disableApiKey(dbContext: DatabaseContext, apiKeyId: string): Promise<boolean> {\n\t\treturn await dbContext.commandBus.execute(new DisableApiKeyCommand(apiKeyId))\n\t}\n\n\tasync disableIdentityApiKeys(dbContext: DatabaseContext, identityId: string): Promise<void> {\n\t\tawait dbContext.commandBus.execute(new DisableIdentityApiKeysCommand(identityId))\n\t}\n\n\tasync createGlobalPermanentApiKey(\n\t\tdbContext: DatabaseContext,\n\t\tdescription: string,\n\t\troles: readonly string[],\n\t\ttokenHash?: TokenHash,\n\t\ttrustForwardedInfo?: boolean,\n\t): Promise<CreateApiKeyResponse> {\n\t\treturn await dbContext.transaction(async db => {\n\t\t\tconst invalidRole = await this.globalRoleValidator.findInvalidRole(db, roles)\n\t\t\tif (invalidRole !== null) {\n\t\t\t\treturn new ResponseError('INVALID_ROLE', `Role ${invalidRole} is not valid or globally assignable`)\n\t\t\t}\n\t\t\treturn await this.apiKeyService.createPermanentApiKey(db, description, roles, tokenHash, trustForwardedInfo)\n\t\t}, { isolation: 'readCommitted' })\n\t}\n\n\tasync createProjectPermanentApiKey(\n\t\tdbContext: DatabaseContext,\n\t\tprojectId: string,\n\t\tmemberships: readonly Acl.Membership[],\n\t\tdescription: string,\n\t\ttokenHash?: TokenHash,\n\t\ttrustForwardedInfo?: boolean,\n\t): Promise<CreateApiKeyResponse> {\n\t\treturn await dbContext.transaction(async db => {\n\t\t\treturn await this.apiKeyService.createProjectPermanentApiKey(db, projectId, memberships, description, tokenHash, trustForwardedInfo)\n\t\t})\n\t}\n}\n\ntype FetchedApiKey = {\n\trow: ApiKeyRow\n\tsourceDbContext: DatabaseContext\n}\n\nexport type VerifyResponse = Response<VerifyResult, VerifyErrorCode>\n\nexport class VerifyResult {\n\treadonly valid = true\n\n\tconstructor(\n\t\tpublic readonly identityId: string,\n\t\tpublic readonly apiKeyId: string,\n\t\tpublic readonly roles: string[],\n\t\tpublic readonly personId: string | null,\n\t\tpublic readonly trustForwardedInfo: boolean = false,\n\t) {}\n}\n\nexport enum VerifyErrorCode {\n\tNOT_FOUND = 'not_found',\n\tDISABLED = 'disabled',\n\tEXPIRED = 'expired',\n\tNO_AUTH_HEADER = 'no_auth_header',\n\tINVALID_AUTH_HEADER = 'invalid_auth_header',\n}\n"],"names":["UnpersistedApiKeyManager","GlobalRoleValidator","ResponseOk","ResponseError","DisableApiKeyCommand","ProlongApiKeyCommand","ApiKeyByTokenQuery","ConfigurationQuery","IdentityQuery","intervalToSeconds","CreateApiKeyCommand","ApiKey","intervalToPostgres","ApiKeyByIdQuery","DisableOneOffApiKeyCommand","DisableIdentityApiKeysCommand","VerifyErrorCode"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BO,MAAM,cAAc;AAAA,EAC1B,YACkB,eACA,oBACA,gBACA,2BAAqD,IAAIA,yBAAAA,yBAAA,GACzD,uBACA,sBAA2C,IAAIC,oBAAAA,oBAAA,GAC/D;AANgB,SAAA,gBAAA;AACA,SAAA,qBAAA;AACA,SAAA,iBAAA;AACA,SAAA,2BAAA;AACA,SAAA,wBAAA;AACA,SAAA,sBAAA;AAAA,EACf;AAAA,EAEH,MAAM,iBACL,WACA,eACA,OACA,aACA,eAC0B;AAC1B,UAAM,oBAAoB,KAAK,yBAAyB,OAAO,KAAK;AACpE,QAAI,sBAAsB,MAAM;AAE/B,aAAO,IAAIC,SAAAA,WAAW,iBAAiB;AAAA,IACxC;AAEA,UAAM,gBAAgB,MAAM,KAAK,mBAAmB,WAAW,eAAe,KAAK;AACnF,QAAI,kBAAkB,MAAM;AAC3B,aAAO,IAAIC,SAAAA,cAAc,aAA2B,uBAAuB;AAAA,IAC5E;AACA,UAAM,YAAY,cAAc;AAEhC,QAAI,UAAU,gBAAgB,MAAM;AACnC,aAAO,IAAIA,SAAAA;AAAAA,QACV;AAAA,QACA,2BAA2B,UAAU,YAAY,YAAA,CAAa;AAAA,MAAA;AAAA,IAEhE;AAMA,QAAI,UAAU,YAAY;AACzB,aAAO,IAAIA,SAAAA,cAAc,YAA0B,sBAAsB,UAAU,YAAY,YAAA,CAAa,EAAE;AAAA,IAC/G;AAIA,QAAI,UAAU,gBAAgB;AAC7B,YAAM,UAAU,WAAW,QAAQ,IAAIC,qBAAAA,qBAAqB,UAAU,EAAE,CAAC;AACzE,aAAO,IAAID,SAAAA;AAAAA,QACV;AAAA,QACA,2CAA2C,UAAU,gBAAgB,YAAA,CAAa;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ACJ;AAEO,IAAK,oCAAAa,qBAAL;AACNA,mBAAA,WAAA,IAAY;AACZA,mBAAA,UAAA,IAAW;AACXA,mBAAA,SAAA,IAAU;AACVA,mBAAA,gBAAA,IAAiB;AACjBA,mBAAA,qBAAA,IAAsB;AALX,SAAAA;AAAA,GAAA,mBAAA,CAAA,CAAA;;;;"}
|
|
@@ -2,7 +2,7 @@ import { CreateApiKeyCommand } from "../../commands/apiKey/CreateApiKeyCommand.j
|
|
|
2
2
|
import { DisableApiKeyCommand } from "../../commands/apiKey/DisableApiKeyCommand.js";
|
|
3
3
|
import { DisableIdentityApiKeysCommand } from "../../commands/apiKey/DisableIdentityApiKeysCommand.js";
|
|
4
4
|
import { DisableOneOffApiKeyCommand } from "../../commands/apiKey/DisableOneOffApiKeyCommand.js";
|
|
5
|
-
import {
|
|
5
|
+
import { ProlongApiKeyCommand } from "../../commands/apiKey/ProlongApiKeyCommand.js";
|
|
6
6
|
import "@contember/database";
|
|
7
7
|
import { ResponseOk, ResponseError } from "../../utils/Response.js";
|
|
8
8
|
import "node:crypto";
|
|
@@ -13,85 +13,85 @@ import { ConfigurationQuery } from "../../queries/configuration/ConfigurationQue
|
|
|
13
13
|
import { IdentityQuery } from "../../queries/identity/IdentityQuery.js";
|
|
14
14
|
import "../../authorization/PermissionActions.js";
|
|
15
15
|
import "@contember/authorization";
|
|
16
|
+
import "../../authorization/CustomRolePermissions.js";
|
|
16
17
|
import "../../authorization/PermissionContext.js";
|
|
17
|
-
import "../../authorization/
|
|
18
|
+
import "../../authorization/TargetIdentityPermission.js";
|
|
18
19
|
import "@contember/schema";
|
|
19
20
|
import { intervalToSeconds, intervalToPostgres } from "../../utils/interval.js";
|
|
20
21
|
import { UnpersistedApiKeyManager } from "./UnpersistedApiKeyManager.js";
|
|
22
|
+
import { GlobalRoleValidator } from "../GlobalRoleValidator.js";
|
|
21
23
|
var __defProp = Object.defineProperty;
|
|
22
24
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
23
25
|
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "", value);
|
|
24
26
|
class ApiKeyManager {
|
|
25
|
-
constructor(apiKeyService, authPolicyResolver, authLogService, unpersistedApiKeyManager = new UnpersistedApiKeyManager(), idpSessionRevalidator) {
|
|
27
|
+
constructor(apiKeyService, authPolicyResolver, authLogService, unpersistedApiKeyManager = new UnpersistedApiKeyManager(), idpSessionRevalidator, globalRoleValidator = new GlobalRoleValidator()) {
|
|
26
28
|
this.apiKeyService = apiKeyService;
|
|
27
29
|
this.authPolicyResolver = authPolicyResolver;
|
|
28
30
|
this.authLogService = authLogService;
|
|
29
31
|
this.unpersistedApiKeyManager = unpersistedApiKeyManager;
|
|
30
32
|
this.idpSessionRevalidator = idpSessionRevalidator;
|
|
33
|
+
this.globalRoleValidator = globalRoleValidator;
|
|
31
34
|
}
|
|
32
35
|
async verifyAndProlong(dbContext, readDbContext, token, requestInfo, forwardedInfo) {
|
|
33
36
|
const unpersistedResult = this.unpersistedApiKeyManager.verify(token);
|
|
34
37
|
if (unpersistedResult !== null) {
|
|
35
38
|
return new ResponseOk(unpersistedResult);
|
|
36
39
|
}
|
|
37
|
-
const
|
|
38
|
-
if (
|
|
40
|
+
const fetchedApiKey = await this.fetchApiKeyByToken(dbContext, readDbContext, token);
|
|
41
|
+
if (fetchedApiKey === null) {
|
|
39
42
|
return new ResponseError("not_found", "API key was not found");
|
|
40
43
|
}
|
|
44
|
+
const apiKeyRow = fetchedApiKey.row;
|
|
41
45
|
if (apiKeyRow.disabled_at !== null) {
|
|
42
46
|
return new ResponseError(
|
|
43
47
|
"disabled",
|
|
44
48
|
`API key was disabled at ${apiKeyRow.disabled_at.toISOString()}`
|
|
45
49
|
);
|
|
46
50
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
return new ResponseError("disabled", `API key expired at ${apiKeyRow.expires_at.toISOString()}`);
|
|
51
|
+
if (apiKeyRow.is_expired) {
|
|
52
|
+
return new ResponseError("disabled", `API key expired at ${apiKeyRow.expires_at?.toISOString()}`);
|
|
50
53
|
}
|
|
51
|
-
if (apiKeyRow.
|
|
54
|
+
if (apiKeyRow.is_max_expired) {
|
|
52
55
|
await dbContext.commandBus.execute(new DisableApiKeyCommand(apiKeyRow.id));
|
|
53
56
|
return new ResponseError(
|
|
54
57
|
"disabled",
|
|
55
|
-
`API key reached its maximum lifetime at ${apiKeyRow.max_expires_at
|
|
58
|
+
`API key reached its maximum lifetime at ${apiKeyRow.max_expires_at?.toISOString()}`
|
|
56
59
|
);
|
|
57
60
|
}
|
|
58
|
-
if (apiKeyRow.
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
await
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
});
|
|
75
|
-
} catch {
|
|
76
|
-
}
|
|
77
|
-
return new ResponseError(
|
|
78
|
-
"disabled",
|
|
79
|
-
`API key was idle since ${apiKeyRow.last_used_at.toISOString()} and exceeded the idle timeout`
|
|
80
|
-
);
|
|
61
|
+
if (apiKeyRow.is_idle_expired) {
|
|
62
|
+
await dbContext.commandBus.execute(new DisableApiKeyCommand(apiKeyRow.id));
|
|
63
|
+
try {
|
|
64
|
+
await this.authLogService.logSessionEvent(dbContext, {
|
|
65
|
+
type: "session_expired_idle",
|
|
66
|
+
identityId: apiKeyRow.identity_id,
|
|
67
|
+
personId: apiKeyRow.person_id,
|
|
68
|
+
ipAddress: requestInfo?.ip,
|
|
69
|
+
userAgent: requestInfo?.userAgent,
|
|
70
|
+
success: false,
|
|
71
|
+
eventData: {
|
|
72
|
+
lastUsedAt: apiKeyRow.last_used_at?.toISOString() ?? null,
|
|
73
|
+
idleTimeout: String(apiKeyRow.idle_timeout)
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
} catch {
|
|
81
77
|
}
|
|
78
|
+
return new ResponseError(
|
|
79
|
+
"disabled",
|
|
80
|
+
`API key was idle since ${apiKeyRow.last_used_at?.toISOString()} and exceeded the idle timeout`
|
|
81
|
+
);
|
|
82
82
|
}
|
|
83
83
|
const effectiveInfo = apiKeyRow.trust_forwarded_info && forwardedInfo ? {
|
|
84
84
|
ip: forwardedInfo.ip ?? requestInfo?.ip,
|
|
85
85
|
userAgent: forwardedInfo.userAgent ?? requestInfo?.userAgent
|
|
86
86
|
} : requestInfo;
|
|
87
87
|
if (this.idpSessionRevalidator) {
|
|
88
|
-
const outcome = await this.idpSessionRevalidator.revalidate(dbContext,
|
|
88
|
+
const outcome = await this.idpSessionRevalidator.revalidate(dbContext, fetchedApiKey.sourceDbContext, apiKeyRow, effectiveInfo);
|
|
89
89
|
if (outcome === "revoked") {
|
|
90
90
|
return new ResponseError("disabled", "IdP session was revoked");
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
-
setImmediate(
|
|
94
|
-
|
|
93
|
+
setImmediate(() => {
|
|
94
|
+
dbContext.commandBus.execute(
|
|
95
95
|
new ProlongApiKeyCommand(
|
|
96
96
|
apiKeyRow.id,
|
|
97
97
|
apiKeyRow.type,
|
|
@@ -105,7 +105,8 @@ class ApiKeyManager {
|
|
|
105
105
|
},
|
|
106
106
|
apiKeyRow.max_expires_at
|
|
107
107
|
)
|
|
108
|
-
)
|
|
108
|
+
).catch(() => {
|
|
109
|
+
});
|
|
109
110
|
});
|
|
110
111
|
return new ResponseOk(
|
|
111
112
|
new VerifyResult(
|
|
@@ -117,6 +118,18 @@ class ApiKeyManager {
|
|
|
117
118
|
)
|
|
118
119
|
);
|
|
119
120
|
}
|
|
121
|
+
async fetchApiKeyByToken(dbContext, readDbContext, token) {
|
|
122
|
+
const query = new ApiKeyByTokenQuery(token);
|
|
123
|
+
const replicaRow = await readDbContext.queryHandler.fetch(query);
|
|
124
|
+
if (replicaRow !== null) {
|
|
125
|
+
return { row: replicaRow, sourceDbContext: readDbContext };
|
|
126
|
+
}
|
|
127
|
+
if (readDbContext.client.connection === dbContext.client.connection) {
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
const primaryRow = await dbContext.queryHandler.fetch(query);
|
|
131
|
+
return primaryRow !== null ? { row: primaryRow, sourceDbContext: dbContext } : null;
|
|
132
|
+
}
|
|
120
133
|
async createSessionApiKey(dbContext, identityId, expiration, requestInfo, trustForwardedInfo) {
|
|
121
134
|
const { token } = await this.createSessionApiKeyWithId(dbContext, identityId, expiration, requestInfo, trustForwardedInfo);
|
|
122
135
|
return token;
|
|
@@ -137,8 +150,7 @@ class ApiKeyManager {
|
|
|
137
150
|
if (policy.tokenExpiration) {
|
|
138
151
|
expirationCapped = Math.min(expirationCapped, intervalToSeconds(policy.tokenExpiration) / 60);
|
|
139
152
|
}
|
|
140
|
-
const
|
|
141
|
-
const maxExpiresAt = policy.tokenExpiration ? new Date(issuedAt.getTime() + intervalToSeconds(policy.tokenExpiration) * 1e3) : null;
|
|
153
|
+
const maxExpirationSeconds = policy.tokenExpiration ? intervalToSeconds(policy.tokenExpiration) : null;
|
|
142
154
|
const command = new CreateApiKeyCommand({
|
|
143
155
|
type: ApiKey.Type.SESSION,
|
|
144
156
|
identityId,
|
|
@@ -146,7 +158,7 @@ class ApiKeyManager {
|
|
|
146
158
|
requestInfo,
|
|
147
159
|
trustForwardedInfo,
|
|
148
160
|
idleTimeout: policy.idleTimeout ? intervalToPostgres(policy.idleTimeout) : null,
|
|
149
|
-
|
|
161
|
+
maxExpirationSeconds
|
|
150
162
|
});
|
|
151
163
|
const { id, token } = await dbContext.commandBus.execute(command);
|
|
152
164
|
assert(token !== void 0);
|
|
@@ -187,8 +199,12 @@ class ApiKeyManager {
|
|
|
187
199
|
}
|
|
188
200
|
async createGlobalPermanentApiKey(dbContext, description, roles, tokenHash, trustForwardedInfo) {
|
|
189
201
|
return await dbContext.transaction(async (db) => {
|
|
202
|
+
const invalidRole = await this.globalRoleValidator.findInvalidRole(db, roles);
|
|
203
|
+
if (invalidRole !== null) {
|
|
204
|
+
return new ResponseError("INVALID_ROLE", `Role ${invalidRole} is not valid or globally assignable`);
|
|
205
|
+
}
|
|
190
206
|
return await this.apiKeyService.createPermanentApiKey(db, description, roles, tokenHash, trustForwardedInfo);
|
|
191
|
-
});
|
|
207
|
+
}, { isolation: "readCommitted" });
|
|
192
208
|
}
|
|
193
209
|
async createProjectPermanentApiKey(dbContext, projectId, memberships, description, tokenHash, trustForwardedInfo) {
|
|
194
210
|
return await dbContext.transaction(async (db) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiKeyManager.js","sources":["../../../../../../../packages/engine-tenant-api/src/model/service/apiKey/ApiKeyManager.ts"],"sourcesContent":["import {\n\tApiKeyRequestInfo,\n\tCreateApiKeyCommand,\n\tDisableApiKeyCommand,\n\tDisableIdentityApiKeysCommand,\n\tDisableOneOffApiKeyCommand,\n\tPROLONG_THROTTLE_MS,\n\tProlongApiKeyCommand,\n} from '../../commands/index.js'\nimport { ApiKey } from '../../type/index.js'\n\nimport { Response, ResponseError, ResponseOk } from '../../utils/Response.js'\nimport { DatabaseContext, TokenHash } from '../../utils/index.js'\nimport { ApiKeyService, CreateApiKeyResponse } from './ApiKeyService.js'\nimport assert from 'node:assert'\nimport { Acl } from '@contember/schema'\nimport { ApiKeyByIdQuery, ApiKeyByTokenQuery, ApiKeyRow, ConfigurationQuery, IdentityQuery } from '../../queries/index.js'\nimport PostgresInterval from 'postgres-interval'\nimport { Config } from '../../type/Config.js'\nimport { intervalToPostgres, intervalToSeconds } from '../../utils/interval.js'\nimport { AuthPolicyResolver } from '../AuthPolicyResolver.js'\nimport { AuthLogService } from '../AuthLogService.js'\nimport { IdpSessionRevalidator } from '../idp/IdpSessionRevalidator.js'\nimport { UnpersistedApiKeyManager } from './UnpersistedApiKeyManager.js'\n\nexport class ApiKeyManager {\n\tconstructor(\n\t\tprivate readonly apiKeyService: ApiKeyService,\n\t\tprivate readonly authPolicyResolver: AuthPolicyResolver,\n\t\tprivate readonly authLogService: AuthLogService,\n\t\tprivate readonly unpersistedApiKeyManager: UnpersistedApiKeyManager = new UnpersistedApiKeyManager(),\n\t\tprivate readonly idpSessionRevalidator?: IdpSessionRevalidator,\n\t) {}\n\n\tasync verifyAndProlong(\n\t\tdbContext: DatabaseContext,\n\t\treadDbContext: DatabaseContext,\n\t\ttoken: string,\n\t\trequestInfo?: ApiKeyRequestInfo,\n\t\tforwardedInfo?: ApiKeyRequestInfo,\n\t): Promise<VerifyResponse> {\n\t\tconst unpersistedResult = this.unpersistedApiKeyManager.verify(token)\n\t\tif (unpersistedResult !== null) {\n\t\t\t// Configured (unpersisted) root token: no DB row to prolong/track.\n\t\t\treturn new ResponseOk(unpersistedResult)\n\t\t}\n\n\t\tconst apiKeyRow = await readDbContext.queryHandler.fetch(new ApiKeyByTokenQuery(token))\n\t\tif (apiKeyRow === null) {\n\t\t\treturn new ResponseError(VerifyErrorCode.NOT_FOUND, 'API key was not found')\n\t\t}\n\n\t\tif (apiKeyRow.disabled_at !== null) {\n\t\t\treturn new ResponseError(\n\t\t\t\tVerifyErrorCode.DISABLED,\n\t\t\t\t`API key was disabled at ${apiKeyRow.disabled_at.toISOString()}`,\n\t\t\t)\n\t\t}\n\n\t\t// Single injectable clock for all session-policy time math (matches issuance,\n\t\t// which uses providers.now()), so the A19 idle/max logic is deterministically testable.\n\t\tconst now = dbContext.providers.now()\n\t\tif (apiKeyRow.expires_at !== null && apiKeyRow.expires_at <= now) {\n\t\t\treturn new ResponseError(VerifyErrorCode.DISABLED, `API key expired at ${apiKeyRow.expires_at.toISOString()}`)\n\t\t}\n\n\t\t// A19: absolute hard cap (defensive — the prolong clamp should already keep\n\t\t// expires_at <= max_expires_at, but enforce it here regardless).\n\t\tif (apiKeyRow.max_expires_at !== null && apiKeyRow.max_expires_at <= now) {\n\t\t\tawait dbContext.commandBus.execute(new DisableApiKeyCommand(apiKeyRow.id))\n\t\t\treturn new ResponseError(\n\t\t\t\tVerifyErrorCode.DISABLED,\n\t\t\t\t`API key reached its maximum lifetime at ${apiKeyRow.max_expires_at.toISOString()}`,\n\t\t\t)\n\t\t}\n\n\t\t// A19: idle timeout. Reject + disable when the session has been idle longer\n\t\t// than the policy's idle_timeout. A null idle_timeout (today's default) or a\n\t\t// never-used key (last_used_at null) are never idle-expired.\n\t\tif (apiKeyRow.idle_timeout !== null && apiKeyRow.last_used_at !== null) {\n\t\t\tconst idleMs = intervalToSeconds(apiKeyRow.idle_timeout) * 1000\n\t\t\t// last_used_at is written at most once per PROLONG_THROTTLE_MS (tracking is\n\t\t\t// throttled), so it can legitimately lag a continuously-active session by up\n\t\t\t// to that window. Add the throttle as slack so a small idle_timeout can't\n\t\t\t// idle-expire a session that is actually in use.\n\t\t\tif (now.getTime() - apiKeyRow.last_used_at.getTime() > idleMs + PROLONG_THROTTLE_MS) {\n\t\t\t\tawait dbContext.commandBus.execute(new DisableApiKeyCommand(apiKeyRow.id))\n\t\t\t\ttry {\n\t\t\t\t\tawait this.authLogService.logSessionEvent(dbContext, {\n\t\t\t\t\t\ttype: 'session_expired_idle',\n\t\t\t\t\t\tidentityId: apiKeyRow.identity_id,\n\t\t\t\t\t\tpersonId: apiKeyRow.person_id,\n\t\t\t\t\t\tipAddress: requestInfo?.ip,\n\t\t\t\t\t\tuserAgent: requestInfo?.userAgent,\n\t\t\t\t\t\tsuccess: false,\n\t\t\t\t\t\teventData: {\n\t\t\t\t\t\t\tlastUsedAt: apiKeyRow.last_used_at?.toISOString() ?? null,\n\t\t\t\t\t\t\tidleTimeout: String(apiKeyRow.idle_timeout),\n\t\t\t\t\t\t},\n\t\t\t\t\t})\n\t\t\t\t} catch {\n\t\t\t\t\t/* best-effort: auth path must stay resilient */\n\t\t\t\t}\n\t\t\t\treturn new ResponseError(\n\t\t\t\t\tVerifyErrorCode.DISABLED,\n\t\t\t\t\t`API key was idle since ${apiKeyRow.last_used_at.toISOString()} and exceeded the idle timeout`,\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\n\t\tconst effectiveInfo: ApiKeyRequestInfo | undefined = apiKeyRow.trust_forwarded_info && forwardedInfo\n\t\t\t? {\n\t\t\t\tip: forwardedInfo.ip ?? requestInfo?.ip,\n\t\t\t\tuserAgent: forwardedInfo.userAgent ?? requestInfo?.userAgent,\n\t\t\t}\n\t\t\t: requestInfo\n\n\t\t// Re-validate IdP-backed sessions against their identity provider (A24). In the\n\t\t// default `background` mode this returns immediately and revalidates after the\n\t\t// response (revocation lands on the next request); in `blocking` mode it can revoke\n\t\t// the current request. No-op for password sessions and IdPs without revalidation.\n\t\t// `effectiveInfo` is passed so the audit entries record the originating request's IP/UA.\n\t\tif (this.idpSessionRevalidator) {\n\t\t\tconst outcome = await this.idpSessionRevalidator.revalidate(dbContext, readDbContext, apiKeyRow, effectiveInfo)\n\t\t\tif (outcome === 'revoked') {\n\t\t\t\treturn new ResponseError(VerifyErrorCode.DISABLED, 'IdP session was revoked')\n\t\t\t}\n\t\t}\n\n\t\tsetImmediate(async () => {\n\t\t\tawait dbContext.commandBus.execute(\n\t\t\t\tnew ProlongApiKeyCommand(\n\t\t\t\t\tapiKeyRow.id,\n\t\t\t\t\tapiKeyRow.type,\n\t\t\t\t\tapiKeyRow.expiration,\n\t\t\t\t\tapiKeyRow.expires_at,\n\t\t\t\t\teffectiveInfo,\n\t\t\t\t\t{\n\t\t\t\t\t\tlastIp: apiKeyRow.last_ip,\n\t\t\t\t\t\tlastUserAgent: apiKeyRow.last_user_agent,\n\t\t\t\t\t\tlastUsedAt: apiKeyRow.last_used_at,\n\t\t\t\t\t},\n\t\t\t\t\tapiKeyRow.max_expires_at,\n\t\t\t\t),\n\t\t\t)\n\t\t})\n\n\t\treturn new ResponseOk(\n\t\t\tnew VerifyResult(\n\t\t\t\tapiKeyRow.identity_id,\n\t\t\t\tapiKeyRow.id,\n\t\t\t\tapiKeyRow.roles,\n\t\t\t\tapiKeyRow.person_id,\n\t\t\t\tapiKeyRow.trust_forwarded_info,\n\t\t\t),\n\t\t)\n\t}\n\n\tasync createSessionApiKey(\n\t\tdbContext: DatabaseContext,\n\t\tidentityId: string,\n\t\texpiration?: number,\n\t\trequestInfo?: ApiKeyRequestInfo,\n\t\ttrustForwardedInfo?: boolean,\n\t): Promise<string> {\n\t\tconst { token } = await this.createSessionApiKeyWithId(dbContext, identityId, expiration, requestInfo, trustForwardedInfo)\n\t\treturn token\n\t}\n\n\t/**\n\t * Like {@link createSessionApiKey} but also returns the api_key id — needed when the\n\t * caller has to bind another row to the session (e.g. an `idp_session` for IdP\n\t * re-validation).\n\t */\n\tasync createSessionApiKeyWithId(\n\t\tdbContext: DatabaseContext,\n\t\tidentityId: string,\n\t\texpiration?: number,\n\t\trequestInfo?: ApiKeyRequestInfo,\n\t\ttrustForwardedInfo?: boolean,\n\t): Promise<{ id: string; token: string }> {\n\t\tconst config = await dbContext.queryHandler.fetch(new ConfigurationQuery(dbContext.providers))\n\n\t\t// A19: snapshot the effective session policy onto the api_key at sign-in.\n\t\t// With no matching policy, every field is null/baseline and the result is\n\t\t// byte-for-byte today's behavior.\n\t\tconst [identityRow] = await dbContext.queryHandler.fetch(new IdentityQuery([identityId]))\n\t\tconst globalRoles = identityRow?.roles ?? []\n\t\tconst policy = await this.authPolicyResolver.resolveForIdentity(dbContext, identityId, globalRoles)\n\n\t\tconst defaultExpirationMinutes = intervalToSeconds(config.login.defaultTokenExpiration) / 60\n\t\t// remember_me_allowed === false: ignore a client-supplied longer lifetime and\n\t\t// force the default. (true/null leave the requested expiration untouched.)\n\t\tconst requestedMinutes = policy.rememberMeAllowed === false\n\t\t\t? defaultExpirationMinutes\n\t\t\t: (expiration ?? defaultExpirationMinutes)\n\n\t\t// Cap by maxTokenExpiration (existing behavior) AND by the policy's\n\t\t// tokenExpiration (A19) — strictest wins.\n\t\tlet expirationCapped = config.login.maxTokenExpiration\n\t\t\t? Math.min(requestedMinutes, intervalToSeconds(config.login.maxTokenExpiration) / 60)\n\t\t\t: requestedMinutes\n\t\tif (policy.tokenExpiration) {\n\t\t\texpirationCapped = Math.min(expirationCapped, intervalToSeconds(policy.tokenExpiration) / 60)\n\t\t}\n\n\t\t// Absolute hard cap: issued_at + policy.tokenExpiration. NULL = uncapped\n\t\t// sliding window (today's behavior).\n\t\tconst issuedAt = dbContext.providers.now()\n\t\tconst maxExpiresAt = policy.tokenExpiration\n\t\t\t? new Date(issuedAt.getTime() + intervalToSeconds(policy.tokenExpiration) * 1000)\n\t\t\t: null\n\n\t\tconst command = new CreateApiKeyCommand({\n\t\t\ttype: ApiKey.Type.SESSION,\n\t\t\tidentityId,\n\t\t\texpiration: expirationCapped,\n\t\t\trequestInfo,\n\t\t\ttrustForwardedInfo,\n\t\t\tidleTimeout: policy.idleTimeout ? intervalToPostgres(policy.idleTimeout) : null,\n\t\t\tmaxExpiresAt,\n\t\t})\n\t\tconst { id, token } = await dbContext.commandBus.execute(command)\n\t\tassert(token !== undefined)\n\n\t\t// A19: audit only when a policy is actually in effect. With zero auth_policy\n\t\t// rows the resolved policy is inert and no extra insert happens.\n\t\tconst policyApplied = policy.mfaRequired === true\n\t\t\t|| policy.tokenExpiration !== null\n\t\t\t|| policy.idleTimeout !== null\n\t\t\t|| policy.rememberMeAllowed !== null\n\t\tif (policyApplied) {\n\t\t\ttry {\n\t\t\t\tawait this.authLogService.logSessionEvent(dbContext, {\n\t\t\t\t\ttype: 'session_policy_applied',\n\t\t\t\t\tidentityId,\n\t\t\t\t\tipAddress: requestInfo?.ip,\n\t\t\t\t\tuserAgent: requestInfo?.userAgent,\n\t\t\t\t\tsuccess: true,\n\t\t\t\t\teventData: {\n\t\t\t\t\t\ttokenExpiration: policy.tokenExpiration ? intervalToPostgres(policy.tokenExpiration) : null,\n\t\t\t\t\t\tidleTimeout: policy.idleTimeout ? intervalToPostgres(policy.idleTimeout) : null,\n\t\t\t\t\t\trememberMeAllowed: policy.rememberMeAllowed,\n\t\t\t\t\t\tmfaRequired: policy.mfaRequired,\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t} catch {\n\t\t\t\t/* best-effort: sign-in must not break on an audit failure */\n\t\t\t}\n\t\t}\n\n\t\treturn { id, token }\n\t}\n\n\tasync findApiKey(dbContext: DatabaseContext, apiKeyId: string): Promise<ApiKeyRow | null> {\n\t\treturn await dbContext.queryHandler.fetch(\n\t\t\tnew ApiKeyByIdQuery(apiKeyId),\n\t\t)\n\t}\n\n\tasync disableOneOffApiKey(dbContext: DatabaseContext, apiKeyId: string): Promise<void> {\n\t\tawait dbContext.commandBus.execute(new DisableOneOffApiKeyCommand(apiKeyId))\n\t}\n\n\tasync disableApiKey(dbContext: DatabaseContext, apiKeyId: string): Promise<boolean> {\n\t\treturn await dbContext.commandBus.execute(new DisableApiKeyCommand(apiKeyId))\n\t}\n\n\tasync disableIdentityApiKeys(dbContext: DatabaseContext, identityId: string): Promise<void> {\n\t\tawait dbContext.commandBus.execute(new DisableIdentityApiKeysCommand(identityId))\n\t}\n\n\tasync createGlobalPermanentApiKey(\n\t\tdbContext: DatabaseContext,\n\t\tdescription: string,\n\t\troles: readonly string[],\n\t\ttokenHash?: TokenHash,\n\t\ttrustForwardedInfo?: boolean,\n\t): Promise<CreateApiKeyResponse> {\n\t\treturn await dbContext.transaction(async db => {\n\t\t\treturn await this.apiKeyService.createPermanentApiKey(db, description, roles, tokenHash, trustForwardedInfo)\n\t\t})\n\t}\n\n\tasync createProjectPermanentApiKey(\n\t\tdbContext: DatabaseContext,\n\t\tprojectId: string,\n\t\tmemberships: readonly Acl.Membership[],\n\t\tdescription: string,\n\t\ttokenHash?: TokenHash,\n\t\ttrustForwardedInfo?: boolean,\n\t): Promise<CreateApiKeyResponse> {\n\t\treturn await dbContext.transaction(async db => {\n\t\t\treturn await this.apiKeyService.createProjectPermanentApiKey(db, projectId, memberships, description, tokenHash, trustForwardedInfo)\n\t\t})\n\t}\n}\n\nexport type VerifyResponse = Response<VerifyResult, VerifyErrorCode>\n\nexport class VerifyResult {\n\treadonly valid = true\n\n\tconstructor(\n\t\tpublic readonly identityId: string,\n\t\tpublic readonly apiKeyId: string,\n\t\tpublic readonly roles: string[],\n\t\tpublic readonly personId: string | null,\n\t\tpublic readonly trustForwardedInfo: boolean = false,\n\t) {}\n}\n\nexport enum VerifyErrorCode {\n\tNOT_FOUND = 'not_found',\n\tDISABLED = 'disabled',\n\tEXPIRED = 'expired',\n\tNO_AUTH_HEADER = 'no_auth_header',\n\tINVALID_AUTH_HEADER = 'invalid_auth_header',\n}\n"],"names":["VerifyErrorCode"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAyBO,MAAM,cAAc;AAAA,EAC1B,YACkB,eACA,oBACA,gBACA,2BAAqD,IAAI,yBAAA,GACzD,uBAChB;AALgB,SAAA,gBAAA;AACA,SAAA,qBAAA;AACA,SAAA,iBAAA;AACA,SAAA,2BAAA;AACA,SAAA,wBAAA;AAAA,EACf;AAAA,EAEH,MAAM,iBACL,WACA,eACA,OACA,aACA,eAC0B;AAC1B,UAAM,oBAAoB,KAAK,yBAAyB,OAAO,KAAK;AACpE,QAAI,sBAAsB,MAAM;AAE/B,aAAO,IAAI,WAAW,iBAAiB;AAAA,IACxC;AAEA,UAAM,YAAY,MAAM,cAAc,aAAa,MAAM,IAAI,mBAAmB,KAAK,CAAC;AACtF,QAAI,cAAc,MAAM;AACvB,aAAO,IAAI,cAAc,aAA2B,uBAAuB;AAAA,IAC5E;AAEA,QAAI,UAAU,gBAAgB,MAAM;AACnC,aAAO,IAAI;AAAA,QACV;AAAA,QACA,2BAA2B,UAAU,YAAY,YAAA,CAAa;AAAA,MAAA;AAAA,IAEhE;AAIA,UAAM,MAAM,UAAU,UAAU,IAAA;AAChC,QAAI,UAAU,eAAe,QAAQ,UAAU,cAAc,KAAK;AACjE,aAAO,IAAI,cAAc,YAA0B,sBAAsB,UAAU,WAAW,YAAA,CAAa,EAAE;AAAA,IAC9G;AAIA,QAAI,UAAU,mBAAmB,QAAQ,UAAU,kBAAkB,KAAK;AACzE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UAAU,WAAW,QAAQ,IAAI,qBAAqB,QAAQ,CAAC;AAAA,EAC7E;AAAA,EAEA,MAAM,uBAAuB,WAA4B,YAAmC;AAC3F,UAAM,UAAU,WAAW,QAAQ,IAAI,8BAA8B,UAAU,CAAC;AAAA,EACjF;AAAA,EAEA,MAAM,4BACL,WACA,aACA,OACA,WACA,oBACgC;AAChC,WAAO,MAAM,UAAU,YAAY,OAAM,OAAM;AAC9C,aAAO,MAAM,KAAK,cAAc,sBAAsB,IAAI,aAAa,OAAO,WAAW,kBAAkB;AAAA,IAC5G,CAAC;AAAA,EACF;AAAA,EAEA,MAAM,6BACL,WACA,WACA,aACA,aACA,WACA,oBACgC;AAChC,WAAO,MAAM,UAAU,YAAY,OAAM,OAAM;AAC9C,aAAO,MAAM,KAAK,cAAc,6BAA6B,IAAI,WAAW,aAAa,aAAa,WAAW,kBAAkB;AAAA,IACpI,CAAC;AAAA,EACF;AACD;AAIO,MAAM,aAAa;AAAA,EAGzB,YACiB,YACA,UACA,OACA,UACA,qBAA8B,OAC7C;AALe,SAAA,aAAA;AACA,SAAA,WAAA;AACA,SAAA,QAAA;AACA,SAAA,WAAA;AACA,SAAA,qBAAA;AAPjB,kBAAA,MAAS,SAAQ,IAAA;AAAA,EAQd;AACJ;AAEO,IAAK,oCAAAA,qBAAL;AACNA,mBAAA,WAAA,IAAY;AACZA,mBAAA,UAAA,IAAW;AACXA,mBAAA,SAAA,IAAU;AACVA,mBAAA,gBAAA,IAAiB;AACjBA,mBAAA,qBAAA,IAAsB;AALX,SAAAA;AAAA,GAAA,mBAAA,CAAA,CAAA;"}
|
|
1
|
+
{"version":3,"file":"ApiKeyManager.js","sources":["../../../../../../../packages/engine-tenant-api/src/model/service/apiKey/ApiKeyManager.ts"],"sourcesContent":["import {\n\tApiKeyRequestInfo,\n\tCreateApiKeyCommand,\n\tDisableApiKeyCommand,\n\tDisableIdentityApiKeysCommand,\n\tDisableOneOffApiKeyCommand,\n\tProlongApiKeyCommand,\n} from '../../commands/index.js'\nimport { ApiKey } from '../../type/index.js'\n\nimport { Response, ResponseError, ResponseOk } from '../../utils/Response.js'\nimport { DatabaseContext, TokenHash } from '../../utils/index.js'\nimport { ApiKeyService, CreateApiKeyResponse } from './ApiKeyService.js'\nimport assert from 'node:assert'\nimport { Acl } from '@contember/schema'\nimport { ApiKeyByIdQuery, ApiKeyByTokenQuery, ApiKeyRow, ConfigurationQuery, IdentityQuery } from '../../queries/index.js'\nimport PostgresInterval from 'postgres-interval'\nimport { Config } from '../../type/Config.js'\nimport { intervalToPostgres, intervalToSeconds } from '../../utils/interval.js'\nimport { AuthPolicyResolver } from '../AuthPolicyResolver.js'\nimport { AuthLogService } from '../AuthLogService.js'\nimport { IdpSessionRevalidator } from '../idp/IdpSessionRevalidator.js'\nimport { UnpersistedApiKeyManager } from './UnpersistedApiKeyManager.js'\nimport { GlobalRoleValidator } from '../GlobalRoleValidator.js'\nimport { Connection } from '@contember/database'\n\nexport class ApiKeyManager {\n\tconstructor(\n\t\tprivate readonly apiKeyService: ApiKeyService,\n\t\tprivate readonly authPolicyResolver: AuthPolicyResolver,\n\t\tprivate readonly authLogService: AuthLogService,\n\t\tprivate readonly unpersistedApiKeyManager: UnpersistedApiKeyManager = new UnpersistedApiKeyManager(),\n\t\tprivate readonly idpSessionRevalidator?: IdpSessionRevalidator,\n\t\tprivate readonly globalRoleValidator: GlobalRoleValidator = new GlobalRoleValidator(),\n\t) {}\n\n\tasync verifyAndProlong(\n\t\tdbContext: DatabaseContext,\n\t\treadDbContext: DatabaseContext,\n\t\ttoken: string,\n\t\trequestInfo?: ApiKeyRequestInfo,\n\t\tforwardedInfo?: ApiKeyRequestInfo,\n\t): Promise<VerifyResponse> {\n\t\tconst unpersistedResult = this.unpersistedApiKeyManager.verify(token)\n\t\tif (unpersistedResult !== null) {\n\t\t\t// Configured (unpersisted) root token: no DB row to prolong/track.\n\t\t\treturn new ResponseOk(unpersistedResult)\n\t\t}\n\n\t\tconst fetchedApiKey = await this.fetchApiKeyByToken(dbContext, readDbContext, token)\n\t\tif (fetchedApiKey === null) {\n\t\t\treturn new ResponseError(VerifyErrorCode.NOT_FOUND, 'API key was not found')\n\t\t}\n\t\tconst apiKeyRow = fetchedApiKey.row\n\n\t\tif (apiKeyRow.disabled_at !== null) {\n\t\t\treturn new ResponseError(\n\t\t\t\tVerifyErrorCode.DISABLED,\n\t\t\t\t`API key was disabled at ${apiKeyRow.disabled_at.toISOString()}`,\n\t\t\t)\n\t\t}\n\n\t\t// A19 time gates are computed on the DATABASE clock by ApiKeyByTokenQuery\n\t\t// (is_expired / is_max_expired / is_idle_expired against NOW()), so app/DB clock\n\t\t// skew — or skew between engine instances — can't weaken them. The idle slack\n\t\t// (PROLONG_THROTTLE_MS) is folded into the SQL too. See engine-tenant-api/CLAUDE.md.\n\t\tif (apiKeyRow.is_expired) {\n\t\t\treturn new ResponseError(VerifyErrorCode.DISABLED, `API key expired at ${apiKeyRow.expires_at?.toISOString()}`)\n\t\t}\n\n\t\t// Absolute hard cap (defensive — the prolong clamp should already keep\n\t\t// expires_at <= max_expires_at, but enforce it here regardless).\n\t\tif (apiKeyRow.is_max_expired) {\n\t\t\tawait dbContext.commandBus.execute(new DisableApiKeyCommand(apiKeyRow.id))\n\t\t\treturn new ResponseError(\n\t\t\t\tVerifyErrorCode.DISABLED,\n\t\t\t\t`API key reached its maximum lifetime at ${apiKeyRow.max_expires_at?.toISOString()}`,\n\t\t\t)\n\t\t}\n\n\t\t// Idle timeout. Reject + disable when the session has been idle longer than the\n\t\t// policy's idle_timeout. A null idle_timeout (today's default) or a never-used\n\t\t// key (last_used_at null) are never idle-expired — the SQL encodes both.\n\t\tif (apiKeyRow.is_idle_expired) {\n\t\t\tawait dbContext.commandBus.execute(new DisableApiKeyCommand(apiKeyRow.id))\n\t\t\ttry {\n\t\t\t\tawait this.authLogService.logSessionEvent(dbContext, {\n\t\t\t\t\ttype: 'session_expired_idle',\n\t\t\t\t\tidentityId: apiKeyRow.identity_id,\n\t\t\t\t\tpersonId: apiKeyRow.person_id,\n\t\t\t\t\tipAddress: requestInfo?.ip,\n\t\t\t\t\tuserAgent: requestInfo?.userAgent,\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\teventData: {\n\t\t\t\t\t\tlastUsedAt: apiKeyRow.last_used_at?.toISOString() ?? null,\n\t\t\t\t\t\tidleTimeout: String(apiKeyRow.idle_timeout),\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t} catch {\n\t\t\t\t/* best-effort: auth path must stay resilient */\n\t\t\t}\n\t\t\treturn new ResponseError(\n\t\t\t\tVerifyErrorCode.DISABLED,\n\t\t\t\t`API key was idle since ${apiKeyRow.last_used_at?.toISOString()} and exceeded the idle timeout`,\n\t\t\t)\n\t\t}\n\n\t\tconst effectiveInfo: ApiKeyRequestInfo | undefined = apiKeyRow.trust_forwarded_info && forwardedInfo\n\t\t\t? {\n\t\t\t\tip: forwardedInfo.ip ?? requestInfo?.ip,\n\t\t\t\tuserAgent: forwardedInfo.userAgent ?? requestInfo?.userAgent,\n\t\t\t}\n\t\t\t: requestInfo\n\n\t\t// Re-validate IdP-backed sessions against their identity provider (A24). In the\n\t\t// default `background` mode this returns immediately and revalidates after the\n\t\t// response (revocation lands on the next request); in `blocking` mode it can revoke\n\t\t// the current request. No-op for password sessions and IdPs without revalidation.\n\t\t// `effectiveInfo` is passed so the audit entries record the originating request's IP/UA.\n\t\t// The idp_session row is written together with the api_key, so it is read from where the key was found.\n\t\tif (this.idpSessionRevalidator) {\n\t\t\tconst outcome = await this.idpSessionRevalidator.revalidate(dbContext, fetchedApiKey.sourceDbContext, apiKeyRow, effectiveInfo)\n\t\t\tif (outcome === 'revoked') {\n\t\t\t\treturn new ResponseError(VerifyErrorCode.DISABLED, 'IdP session was revoked')\n\t\t\t}\n\t\t}\n\n\t\t// Detached (runs after the response), so a rejection here would be an unhandledRejection and can take the\n\t\t// worker down. Tracking is best-effort — the next request writes it again.\n\t\tsetImmediate(() => {\n\t\t\tdbContext.commandBus.execute(\n\t\t\t\tnew ProlongApiKeyCommand(\n\t\t\t\t\tapiKeyRow.id,\n\t\t\t\t\tapiKeyRow.type,\n\t\t\t\t\tapiKeyRow.expiration,\n\t\t\t\t\tapiKeyRow.expires_at,\n\t\t\t\t\teffectiveInfo,\n\t\t\t\t\t{\n\t\t\t\t\t\tlastIp: apiKeyRow.last_ip,\n\t\t\t\t\t\tlastUserAgent: apiKeyRow.last_user_agent,\n\t\t\t\t\t\tlastUsedAt: apiKeyRow.last_used_at,\n\t\t\t\t\t},\n\t\t\t\t\tapiKeyRow.max_expires_at,\n\t\t\t\t),\n\t\t\t).catch(() => {})\n\t\t})\n\n\t\treturn new ResponseOk(\n\t\t\tnew VerifyResult(\n\t\t\t\tapiKeyRow.identity_id,\n\t\t\t\tapiKeyRow.id,\n\t\t\t\tapiKeyRow.roles,\n\t\t\t\tapiKeyRow.person_id,\n\t\t\t\tapiKeyRow.trust_forwarded_info,\n\t\t\t),\n\t\t)\n\t}\n\n\tprivate async fetchApiKeyByToken(dbContext: DatabaseContext, readDbContext: DatabaseContext, token: string): Promise<FetchedApiKey | null> {\n\t\tconst query = new ApiKeyByTokenQuery(token)\n\t\tconst replicaRow = await readDbContext.queryHandler.fetch(query)\n\t\tif (replicaRow !== null) {\n\t\t\treturn { row: replicaRow, sourceDbContext: readDbContext }\n\t\t}\n\t\tif (readDbContext.client.connection === dbContext.client.connection) {\n\t\t\treturn null\n\t\t}\n\t\t// A token issued moments ago (sign-in, createSessionToken) may not have reached the read replica yet.\n\t\tconst primaryRow = await dbContext.queryHandler.fetch(query)\n\t\treturn primaryRow !== null ? { row: primaryRow, sourceDbContext: dbContext } : null\n\t}\n\n\tasync createSessionApiKey(\n\t\tdbContext: DatabaseContext,\n\t\tidentityId: string,\n\t\texpiration?: number,\n\t\trequestInfo?: ApiKeyRequestInfo,\n\t\ttrustForwardedInfo?: boolean,\n\t): Promise<string> {\n\t\tconst { token } = await this.createSessionApiKeyWithId(dbContext, identityId, expiration, requestInfo, trustForwardedInfo)\n\t\treturn token\n\t}\n\n\t/**\n\t * Like {@link createSessionApiKey} but also returns the api_key id — needed when the\n\t * caller has to bind another row to the session (e.g. an `idp_session` for IdP\n\t * re-validation).\n\t */\n\tasync createSessionApiKeyWithId(\n\t\tdbContext: DatabaseContext,\n\t\tidentityId: string,\n\t\texpiration?: number,\n\t\trequestInfo?: ApiKeyRequestInfo,\n\t\ttrustForwardedInfo?: boolean,\n\t): Promise<{ id: string; token: string }> {\n\t\tconst config = await dbContext.queryHandler.fetch(new ConfigurationQuery(dbContext.providers))\n\n\t\t// A19: snapshot the effective session policy onto the api_key at sign-in.\n\t\t// With no matching policy, every field is null/baseline and the result is\n\t\t// byte-for-byte today's behavior.\n\t\tconst [identityRow] = await dbContext.queryHandler.fetch(new IdentityQuery([identityId]))\n\t\tconst globalRoles = identityRow?.roles ?? []\n\t\tconst policy = await this.authPolicyResolver.resolveForIdentity(dbContext, identityId, globalRoles)\n\n\t\tconst defaultExpirationMinutes = intervalToSeconds(config.login.defaultTokenExpiration) / 60\n\t\t// remember_me_allowed === false: ignore a client-supplied longer lifetime and\n\t\t// force the default. (true/null leave the requested expiration untouched.)\n\t\tconst requestedMinutes = policy.rememberMeAllowed === false\n\t\t\t? defaultExpirationMinutes\n\t\t\t: (expiration ?? defaultExpirationMinutes)\n\n\t\t// Cap by maxTokenExpiration (existing behavior) AND by the policy's\n\t\t// tokenExpiration (A19) — strictest wins.\n\t\tlet expirationCapped = config.login.maxTokenExpiration\n\t\t\t? Math.min(requestedMinutes, intervalToSeconds(config.login.maxTokenExpiration) / 60)\n\t\t\t: requestedMinutes\n\t\tif (policy.tokenExpiration) {\n\t\t\texpirationCapped = Math.min(expirationCapped, intervalToSeconds(policy.tokenExpiration) / 60)\n\t\t}\n\n\t\t// Absolute hard cap as a lifetime in seconds; CreateApiKeyCommand writes it as\n\t\t// now() + interval on the DB clock. NULL = uncapped sliding window (today's behavior).\n\t\tconst maxExpirationSeconds = policy.tokenExpiration\n\t\t\t? intervalToSeconds(policy.tokenExpiration)\n\t\t\t: null\n\n\t\tconst command = new CreateApiKeyCommand({\n\t\t\ttype: ApiKey.Type.SESSION,\n\t\t\tidentityId,\n\t\t\texpiration: expirationCapped,\n\t\t\trequestInfo,\n\t\t\ttrustForwardedInfo,\n\t\t\tidleTimeout: policy.idleTimeout ? intervalToPostgres(policy.idleTimeout) : null,\n\t\t\tmaxExpirationSeconds,\n\t\t})\n\t\tconst { id, token } = await dbContext.commandBus.execute(command)\n\t\tassert(token !== undefined)\n\n\t\t// A19: audit only when a policy is actually in effect. With zero auth_policy\n\t\t// rows the resolved policy is inert and no extra insert happens.\n\t\tconst policyApplied = policy.mfaRequired === true\n\t\t\t|| policy.tokenExpiration !== null\n\t\t\t|| policy.idleTimeout !== null\n\t\t\t|| policy.rememberMeAllowed !== null\n\t\tif (policyApplied) {\n\t\t\ttry {\n\t\t\t\tawait this.authLogService.logSessionEvent(dbContext, {\n\t\t\t\t\ttype: 'session_policy_applied',\n\t\t\t\t\tidentityId,\n\t\t\t\t\tipAddress: requestInfo?.ip,\n\t\t\t\t\tuserAgent: requestInfo?.userAgent,\n\t\t\t\t\tsuccess: true,\n\t\t\t\t\teventData: {\n\t\t\t\t\t\ttokenExpiration: policy.tokenExpiration ? intervalToPostgres(policy.tokenExpiration) : null,\n\t\t\t\t\t\tidleTimeout: policy.idleTimeout ? intervalToPostgres(policy.idleTimeout) : null,\n\t\t\t\t\t\trememberMeAllowed: policy.rememberMeAllowed,\n\t\t\t\t\t\tmfaRequired: policy.mfaRequired,\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t} catch {\n\t\t\t\t/* best-effort: sign-in must not break on an audit failure */\n\t\t\t}\n\t\t}\n\n\t\treturn { id, token }\n\t}\n\n\tasync findApiKey(dbContext: DatabaseContext, apiKeyId: string): Promise<ApiKeyRow | null> {\n\t\treturn await dbContext.queryHandler.fetch(\n\t\t\tnew ApiKeyByIdQuery(apiKeyId),\n\t\t)\n\t}\n\n\tasync disableOneOffApiKey(dbContext: DatabaseContext, apiKeyId: string): Promise<void> {\n\t\tawait dbContext.commandBus.execute(new DisableOneOffApiKeyCommand(apiKeyId))\n\t}\n\n\tasync disableApiKey(dbContext: DatabaseContext, apiKeyId: string): Promise<boolean> {\n\t\treturn await dbContext.commandBus.execute(new DisableApiKeyCommand(apiKeyId))\n\t}\n\n\tasync disableIdentityApiKeys(dbContext: DatabaseContext, identityId: string): Promise<void> {\n\t\tawait dbContext.commandBus.execute(new DisableIdentityApiKeysCommand(identityId))\n\t}\n\n\tasync createGlobalPermanentApiKey(\n\t\tdbContext: DatabaseContext,\n\t\tdescription: string,\n\t\troles: readonly string[],\n\t\ttokenHash?: TokenHash,\n\t\ttrustForwardedInfo?: boolean,\n\t): Promise<CreateApiKeyResponse> {\n\t\treturn await dbContext.transaction(async db => {\n\t\t\tconst invalidRole = await this.globalRoleValidator.findInvalidRole(db, roles)\n\t\t\tif (invalidRole !== null) {\n\t\t\t\treturn new ResponseError('INVALID_ROLE', `Role ${invalidRole} is not valid or globally assignable`)\n\t\t\t}\n\t\t\treturn await this.apiKeyService.createPermanentApiKey(db, description, roles, tokenHash, trustForwardedInfo)\n\t\t}, { isolation: 'readCommitted' })\n\t}\n\n\tasync createProjectPermanentApiKey(\n\t\tdbContext: DatabaseContext,\n\t\tprojectId: string,\n\t\tmemberships: readonly Acl.Membership[],\n\t\tdescription: string,\n\t\ttokenHash?: TokenHash,\n\t\ttrustForwardedInfo?: boolean,\n\t): Promise<CreateApiKeyResponse> {\n\t\treturn await dbContext.transaction(async db => {\n\t\t\treturn await this.apiKeyService.createProjectPermanentApiKey(db, projectId, memberships, description, tokenHash, trustForwardedInfo)\n\t\t})\n\t}\n}\n\ntype FetchedApiKey = {\n\trow: ApiKeyRow\n\tsourceDbContext: DatabaseContext\n}\n\nexport type VerifyResponse = Response<VerifyResult, VerifyErrorCode>\n\nexport class VerifyResult {\n\treadonly valid = true\n\n\tconstructor(\n\t\tpublic readonly identityId: string,\n\t\tpublic readonly apiKeyId: string,\n\t\tpublic readonly roles: string[],\n\t\tpublic readonly personId: string | null,\n\t\tpublic readonly trustForwardedInfo: boolean = false,\n\t) {}\n}\n\nexport enum VerifyErrorCode {\n\tNOT_FOUND = 'not_found',\n\tDISABLED = 'disabled',\n\tEXPIRED = 'expired',\n\tNO_AUTH_HEADER = 'no_auth_header',\n\tINVALID_AUTH_HEADER = 'invalid_auth_header',\n}\n"],"names":["VerifyErrorCode"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA0BO,MAAM,cAAc;AAAA,EAC1B,YACkB,eACA,oBACA,gBACA,2BAAqD,IAAI,yBAAA,GACzD,uBACA,sBAA2C,IAAI,oBAAA,GAC/D;AANgB,SAAA,gBAAA;AACA,SAAA,qBAAA;AACA,SAAA,iBAAA;AACA,SAAA,2BAAA;AACA,SAAA,wBAAA;AACA,SAAA,sBAAA;AAAA,EACf;AAAA,EAEH,MAAM,iBACL,WACA,eACA,OACA,aACA,eAC0B;AAC1B,UAAM,oBAAoB,KAAK,yBAAyB,OAAO,KAAK;AACpE,QAAI,sBAAsB,MAAM;AAE/B,aAAO,IAAI,WAAW,iBAAiB;AAAA,IACxC;AAEA,UAAM,gBAAgB,MAAM,KAAK,mBAAmB,WAAW,eAAe,KAAK;AACnF,QAAI,kBAAkB,MAAM;AAC3B,aAAO,IAAI,cAAc,aAA2B,uBAAuB;AAAA,IAC5E;AACA,UAAM,YAAY,cAAc;AAEhC,QAAI,UAAU,gBAAgB,MAAM;AACnC,aAAO,IAAI;AAAA,QACV;AAAA,QACA,2BAA2B,UAAU,YAAY,YAAA,CAAa;AAAA,MAAA;AAAA,IAEhE;AAMA,QAAI,UAAU,YAAY;AACzB,aAAO,IAAI,cAAc,YAA0B,sBAAsB,UAAU,YAAY,YAAA,CAAa,EAAE;AAAA,IAC/G;AAIA,QAAI,UAAU,gBAAgB;AAC7B,YAAM,UAAU,WAAW,QAAQ,IAAI,qBAAqB,UAAU,EAAE,CAAC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A,mBAAA,gBAAA,IAAiB;AACjBA,mBAAA,qBAAA,IAAsB;AALX,SAAAA;AAAA,GAAA,mBAAA,CAAA,CAAA;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiKeyService.cjs","sources":["../../../../../../../packages/engine-tenant-api/src/model/service/apiKey/ApiKeyService.ts"],"sourcesContent":["import { DatabaseContext, TokenHash } from '../../utils/index.js'\nimport { AddProjectMemberCommand, CreateApiKeyCommand, CreateIdentityCommand } from '../../commands/index.js'\nimport { ApiKey } from '../../type/index.js'\nimport { createSetMembershipVariables } from '../membershipUtils.js'\nimport { ImplementationException } from '../../../exceptions.js'\nimport { Response, ResponseOk } from '../../utils/Response.js'\nimport { ApiKeyWithToken } from '../../../schema/index.js'\nimport { Acl } from '@contember/schema'\n\nexport class ApiKeyService {\n\tasync createPermanentApiKey(\n\t\tdb: DatabaseContext,\n\t\tdescription: string,\n\t\troles: readonly string[] = [],\n\t\ttokenHash?: TokenHash,\n\t\ttrustForwardedInfo?: boolean,\n\t) {\n\t\tconst identityId = await db.commandBus.execute(new CreateIdentityCommand(roles, description))\n\t\tconst apiKeyResult = await db.commandBus.execute(\n\t\t\tnew CreateApiKeyCommand({\n\t\t\t\ttype: ApiKey.Type.PERMANENT,\n\t\t\t\tidentityId,\n\t\t\t\ttokenHash,\n\t\t\t\ttrustForwardedInfo,\n\t\t\t}),\n\t\t)\n\n\t\treturn new ResponseOk(new CreateApiKeyResult({ id: identityId, description }, apiKeyResult))\n\t}\n\n\tasync createProjectPermanentApiKey(\n\t\tdb: DatabaseContext,\n\t\tprojectId: string,\n\t\tmemberships: readonly Acl.Membership[],\n\t\tdescription: string,\n\t\ttokenHash?: TokenHash,\n\t\ttrustForwardedInfo?: boolean,\n\t) {\n\t\tconst response = await this.createPermanentApiKey(db, description, [], tokenHash, trustForwardedInfo)\n\n\t\tconst addMemberResult = await db.commandBus.execute(\n\t\t\tnew AddProjectMemberCommand(projectId, response.result.identity.id, createSetMembershipVariables(memberships)),\n\t\t)\n\t\tif (!addMemberResult.ok) {\n\t\t\tthrow new ImplementationException()\n\t\t}\n\t\treturn response\n\t}\n}\n\nexport type CreateApiKeyResponse = Response<CreateApiKeyResult,
|
|
1
|
+
{"version":3,"file":"ApiKeyService.cjs","sources":["../../../../../../../packages/engine-tenant-api/src/model/service/apiKey/ApiKeyService.ts"],"sourcesContent":["import { DatabaseContext, TokenHash } from '../../utils/index.js'\nimport { AddProjectMemberCommand, CreateApiKeyCommand, CreateIdentityCommand } from '../../commands/index.js'\nimport { ApiKey } from '../../type/index.js'\nimport { createSetMembershipVariables } from '../membershipUtils.js'\nimport { ImplementationException } from '../../../exceptions.js'\nimport { Response, ResponseOk } from '../../utils/Response.js'\nimport { ApiKeyWithToken, CreateApiKeyErrorCode } from '../../../schema/index.js'\nimport { Acl } from '@contember/schema'\n\nexport class ApiKeyService {\n\tasync createPermanentApiKey(\n\t\tdb: DatabaseContext,\n\t\tdescription: string,\n\t\troles: readonly string[] = [],\n\t\ttokenHash?: TokenHash,\n\t\ttrustForwardedInfo?: boolean,\n\t) {\n\t\tconst identityId = await db.commandBus.execute(new CreateIdentityCommand(roles, description))\n\t\tconst apiKeyResult = await db.commandBus.execute(\n\t\t\tnew CreateApiKeyCommand({\n\t\t\t\ttype: ApiKey.Type.PERMANENT,\n\t\t\t\tidentityId,\n\t\t\t\ttokenHash,\n\t\t\t\ttrustForwardedInfo,\n\t\t\t}),\n\t\t)\n\n\t\treturn new ResponseOk(new CreateApiKeyResult({ id: identityId, description }, apiKeyResult))\n\t}\n\n\tasync createProjectPermanentApiKey(\n\t\tdb: DatabaseContext,\n\t\tprojectId: string,\n\t\tmemberships: readonly Acl.Membership[],\n\t\tdescription: string,\n\t\ttokenHash?: TokenHash,\n\t\ttrustForwardedInfo?: boolean,\n\t) {\n\t\tconst response = await this.createPermanentApiKey(db, description, [], tokenHash, trustForwardedInfo)\n\n\t\tconst addMemberResult = await db.commandBus.execute(\n\t\t\tnew AddProjectMemberCommand(projectId, response.result.identity.id, createSetMembershipVariables(memberships)),\n\t\t)\n\t\tif (!addMemberResult.ok) {\n\t\t\tthrow new ImplementationException()\n\t\t}\n\t\treturn response\n\t}\n}\n\nexport type CreateApiKeyResponse = Response<CreateApiKeyResult, CreateApiKeyErrorCode>\n\nexport class CreateApiKeyResult {\n\tconstructor(public readonly identity: { id: string; description?: string }, public readonly apiKey: { id: string; token?: string }) {\n\t}\n\n\ttoApiKeyWithToken(): ApiKeyWithToken {\n\t\treturn {\n\t\t\tid: this.apiKey.id,\n\t\t\ttoken: this.apiKey.token,\n\t\t\tidentity: {\n\t\t\t\t...this.identity,\n\t\t\t\tprojects: [],\n\t\t\t\tsessions: [],\n\t\t\t},\n\t\t}\n\t}\n}\n"],"names":["CreateIdentityCommand","CreateApiKeyCommand","ApiKey","ResponseOk","AddProjectMemberCommand","createSetMembershipVariables","ImplementationException"],"mappings":";;;;;;;;;;;AASO,MAAM,cAAc;AAAA,EAC1B,MAAM,sBACL,IACA,aACA,QAA2B,CAAA,GAC3B,WACA,oBACC;AACD,UAAM,aAAa,MAAM,GAAG,WAAW,QAAQ,IAAIA,sBAAAA,sBAAsB,OAAO,WAAW,CAAC;AAC5F,UAAM,eAAe,MAAM,GAAG,WAAW;AAAA,MACxC,IAAIC,wCAAoB;AAAA,QACvB,MAAMC,OAAAA,OAAO,KAAK;AAAA,QAClB;AAAA,QACA;AAAA,QACA;AAAA,MAAA,CACA;AAAA,IAAA;AAGF,WAAO,IAAIC,SAAAA,WAAW,IAAI,mBAAmB,EAAE,IAAI,YAAY,eAAe,YAAY,CAAC;AAAA,EAC5F;AAAA,EAEA,MAAM,6BACL,IACA,WACA,aACA,aACA,WACA,oBACC;AACD,UAAM,WAAW,MAAM,KAAK,sBAAsB,IAAI,aAAa,CAAA,GAAI,WAAW,kBAAkB;AAEpG,UAAM,kBAAkB,MAAM,GAAG,WAAW;AAAA,MAC3C,IAAIC,wBAAAA,wBAAwB,WAAW,SAAS,OAAO,SAAS,IAAIC,gBAAAA,6BAA6B,WAAW,CAAC;AAAA,IAAA;AAE9G,QAAI,CAAC,gBAAgB,IAAI;AACxB,YAAM,IAAIC,WAAAA,wBAAA;AAAA,IACX;AACA,WAAO;AAAA,EACR;AACD;AAIO,MAAM,mBAAmB;AAAA,EAC/B,YAA4B,UAAgE,QAAwC;AAAxG,SAAA,WAAA;AAAgE,SAAA,SAAA;AAAA,EAC5F;AAAA,EAEA,oBAAqC;AACpC,WAAO;AAAA,MACN,IAAI,KAAK,OAAO;AAAA,MAChB,OAAO,KAAK,OAAO;AAAA,MACnB,UAAU;AAAA,QACT,GAAG,KAAK;AAAA,QACR,UAAU,CAAA;AAAA,QACV,UAAU,CAAA;AAAA,MAAC;AAAA,IACZ;AAAA,EAEF;AACD;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiKeyService.js","sources":["../../../../../../../packages/engine-tenant-api/src/model/service/apiKey/ApiKeyService.ts"],"sourcesContent":["import { DatabaseContext, TokenHash } from '../../utils/index.js'\nimport { AddProjectMemberCommand, CreateApiKeyCommand, CreateIdentityCommand } from '../../commands/index.js'\nimport { ApiKey } from '../../type/index.js'\nimport { createSetMembershipVariables } from '../membershipUtils.js'\nimport { ImplementationException } from '../../../exceptions.js'\nimport { Response, ResponseOk } from '../../utils/Response.js'\nimport { ApiKeyWithToken } from '../../../schema/index.js'\nimport { Acl } from '@contember/schema'\n\nexport class ApiKeyService {\n\tasync createPermanentApiKey(\n\t\tdb: DatabaseContext,\n\t\tdescription: string,\n\t\troles: readonly string[] = [],\n\t\ttokenHash?: TokenHash,\n\t\ttrustForwardedInfo?: boolean,\n\t) {\n\t\tconst identityId = await db.commandBus.execute(new CreateIdentityCommand(roles, description))\n\t\tconst apiKeyResult = await db.commandBus.execute(\n\t\t\tnew CreateApiKeyCommand({\n\t\t\t\ttype: ApiKey.Type.PERMANENT,\n\t\t\t\tidentityId,\n\t\t\t\ttokenHash,\n\t\t\t\ttrustForwardedInfo,\n\t\t\t}),\n\t\t)\n\n\t\treturn new ResponseOk(new CreateApiKeyResult({ id: identityId, description }, apiKeyResult))\n\t}\n\n\tasync createProjectPermanentApiKey(\n\t\tdb: DatabaseContext,\n\t\tprojectId: string,\n\t\tmemberships: readonly Acl.Membership[],\n\t\tdescription: string,\n\t\ttokenHash?: TokenHash,\n\t\ttrustForwardedInfo?: boolean,\n\t) {\n\t\tconst response = await this.createPermanentApiKey(db, description, [], tokenHash, trustForwardedInfo)\n\n\t\tconst addMemberResult = await db.commandBus.execute(\n\t\t\tnew AddProjectMemberCommand(projectId, response.result.identity.id, createSetMembershipVariables(memberships)),\n\t\t)\n\t\tif (!addMemberResult.ok) {\n\t\t\tthrow new ImplementationException()\n\t\t}\n\t\treturn response\n\t}\n}\n\nexport type CreateApiKeyResponse = Response<CreateApiKeyResult,
|
|
1
|
+
{"version":3,"file":"ApiKeyService.js","sources":["../../../../../../../packages/engine-tenant-api/src/model/service/apiKey/ApiKeyService.ts"],"sourcesContent":["import { DatabaseContext, TokenHash } from '../../utils/index.js'\nimport { AddProjectMemberCommand, CreateApiKeyCommand, CreateIdentityCommand } from '../../commands/index.js'\nimport { ApiKey } from '../../type/index.js'\nimport { createSetMembershipVariables } from '../membershipUtils.js'\nimport { ImplementationException } from '../../../exceptions.js'\nimport { Response, ResponseOk } from '../../utils/Response.js'\nimport { ApiKeyWithToken, CreateApiKeyErrorCode } from '../../../schema/index.js'\nimport { Acl } from '@contember/schema'\n\nexport class ApiKeyService {\n\tasync createPermanentApiKey(\n\t\tdb: DatabaseContext,\n\t\tdescription: string,\n\t\troles: readonly string[] = [],\n\t\ttokenHash?: TokenHash,\n\t\ttrustForwardedInfo?: boolean,\n\t) {\n\t\tconst identityId = await db.commandBus.execute(new CreateIdentityCommand(roles, description))\n\t\tconst apiKeyResult = await db.commandBus.execute(\n\t\t\tnew CreateApiKeyCommand({\n\t\t\t\ttype: ApiKey.Type.PERMANENT,\n\t\t\t\tidentityId,\n\t\t\t\ttokenHash,\n\t\t\t\ttrustForwardedInfo,\n\t\t\t}),\n\t\t)\n\n\t\treturn new ResponseOk(new CreateApiKeyResult({ id: identityId, description }, apiKeyResult))\n\t}\n\n\tasync createProjectPermanentApiKey(\n\t\tdb: DatabaseContext,\n\t\tprojectId: string,\n\t\tmemberships: readonly Acl.Membership[],\n\t\tdescription: string,\n\t\ttokenHash?: TokenHash,\n\t\ttrustForwardedInfo?: boolean,\n\t) {\n\t\tconst response = await this.createPermanentApiKey(db, description, [], tokenHash, trustForwardedInfo)\n\n\t\tconst addMemberResult = await db.commandBus.execute(\n\t\t\tnew AddProjectMemberCommand(projectId, response.result.identity.id, createSetMembershipVariables(memberships)),\n\t\t)\n\t\tif (!addMemberResult.ok) {\n\t\t\tthrow new ImplementationException()\n\t\t}\n\t\treturn response\n\t}\n}\n\nexport type CreateApiKeyResponse = Response<CreateApiKeyResult, CreateApiKeyErrorCode>\n\nexport class CreateApiKeyResult {\n\tconstructor(public readonly identity: { id: string; description?: string }, public readonly apiKey: { id: string; token?: string }) {\n\t}\n\n\ttoApiKeyWithToken(): ApiKeyWithToken {\n\t\treturn {\n\t\t\tid: this.apiKey.id,\n\t\t\ttoken: this.apiKey.token,\n\t\t\tidentity: {\n\t\t\t\t...this.identity,\n\t\t\t\tprojects: [],\n\t\t\t\tsessions: [],\n\t\t\t},\n\t\t}\n\t}\n}\n"],"names":[],"mappings":";;;;;;;;;AASO,MAAM,cAAc;AAAA,EAC1B,MAAM,sBACL,IACA,aACA,QAA2B,CAAA,GAC3B,WACA,oBACC;AACD,UAAM,aAAa,MAAM,GAAG,WAAW,QAAQ,IAAI,sBAAsB,OAAO,WAAW,CAAC;AAC5F,UAAM,eAAe,MAAM,GAAG,WAAW;AAAA,MACxC,IAAI,oBAAoB;AAAA,QACvB,MAAM,OAAO,KAAK;AAAA,QAClB;AAAA,QACA;AAAA,QACA;AAAA,MAAA,CACA;AAAA,IAAA;AAGF,WAAO,IAAI,WAAW,IAAI,mBAAmB,EAAE,IAAI,YAAY,eAAe,YAAY,CAAC;AAAA,EAC5F;AAAA,EAEA,MAAM,6BACL,IACA,WACA,aACA,aACA,WACA,oBACC;AACD,UAAM,WAAW,MAAM,KAAK,sBAAsB,IAAI,aAAa,CAAA,GAAI,WAAW,kBAAkB;AAEpG,UAAM,kBAAkB,MAAM,GAAG,WAAW;AAAA,MAC3C,IAAI,wBAAwB,WAAW,SAAS,OAAO,SAAS,IAAI,6BAA6B,WAAW,CAAC;AAAA,IAAA;AAE9G,QAAI,CAAC,gBAAgB,IAAI;AACxB,YAAM,IAAI,wBAAA;AAAA,IACX;AACA,WAAO;AAAA,EACR;AACD;AAIO,MAAM,mBAAmB;AAAA,EAC/B,YAA4B,UAAgE,QAAwC;AAAxG,SAAA,WAAA;AAAgE,SAAA,SAAA;AAAA,EAC5F;AAAA,EAEA,oBAAqC;AACpC,WAAO;AAAA,MACN,IAAI,KAAK,OAAO;AAAA,MAChB,OAAO,KAAK,OAAO;AAAA,MACnB,UAAU;AAAA,QACT,GAAG,KAAK;AAAA,QACR,UAAU,CAAA;AAAA,QACV,UAAU,CAAA;AAAA,MAAC;AAAA,IACZ;AAAA,EAEF;AACD;"}
|
|
@@ -6,14 +6,20 @@ const token = require("../../utils/token.cjs");
|
|
|
6
6
|
require("../../authorization/PermissionActions.cjs");
|
|
7
7
|
require("@contember/authorization");
|
|
8
8
|
const Roles = require("../../authorization/Roles.cjs");
|
|
9
|
+
require("../../queries/apiKey/ApiKeyQuery.cjs");
|
|
10
|
+
require("../../authorization/CustomRolePermissions.cjs");
|
|
9
11
|
require("../../authorization/PermissionContext.cjs");
|
|
10
|
-
require("../../authorization/
|
|
12
|
+
require("../../authorization/TargetIdentityPermission.cjs");
|
|
11
13
|
require("@contember/schema");
|
|
12
14
|
const ApiKeyManager = require("./ApiKeyManager.cjs");
|
|
13
15
|
var __defProp = Object.defineProperty;
|
|
14
16
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
15
17
|
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "", value);
|
|
16
18
|
const UNPERSISTED_ROOT_IDENTITY_ID = "f3b2c4d6-0000-4000-8000-000000000001";
|
|
19
|
+
const UNPERSISTED_LOGIN_IDENTITY_ID = "f3b2c4d6-0000-4000-8000-000000000002";
|
|
20
|
+
const unpersistedIdentityIds = /* @__PURE__ */ new Set([UNPERSISTED_ROOT_IDENTITY_ID, UNPERSISTED_LOGIN_IDENTITY_ID]);
|
|
21
|
+
const isUnpersistedIdentityId = (identityId) => identityId !== void 0 && unpersistedIdentityIds.has(identityId);
|
|
22
|
+
const createUnpersistedLoginVerifyResult = () => new ApiKeyManager.VerifyResult(UNPERSISTED_LOGIN_IDENTITY_ID, UNPERSISTED_LOGIN_IDENTITY_ID, [Roles.TenantRole.LOGIN], null, false);
|
|
17
23
|
class UnpersistedApiKeyManager {
|
|
18
24
|
constructor(apiKeys = []) {
|
|
19
25
|
__publicField(this, "apiKeys");
|
|
@@ -77,6 +83,9 @@ class UnpersistedApiKeyManager {
|
|
|
77
83
|
return new UnpersistedApiKeyManager(hashes.map((it) => UnpersistedApiKeyManager.createRootApiKey(it)));
|
|
78
84
|
}
|
|
79
85
|
}
|
|
86
|
+
exports.UNPERSISTED_LOGIN_IDENTITY_ID = UNPERSISTED_LOGIN_IDENTITY_ID;
|
|
80
87
|
exports.UNPERSISTED_ROOT_IDENTITY_ID = UNPERSISTED_ROOT_IDENTITY_ID;
|
|
81
88
|
exports.UnpersistedApiKeyManager = UnpersistedApiKeyManager;
|
|
89
|
+
exports.createUnpersistedLoginVerifyResult = createUnpersistedLoginVerifyResult;
|
|
90
|
+
exports.isUnpersistedIdentityId = isUnpersistedIdentityId;
|
|
82
91
|
//# sourceMappingURL=UnpersistedApiKeyManager.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnpersistedApiKeyManager.cjs","sources":["../../../../../../../packages/engine-tenant-api/src/model/service/apiKey/UnpersistedApiKeyManager.ts"],"sourcesContent":["import { computeTokenHash, isTokenHash, timingSafeCompareHash, TokenHash } from '../../utils/index.js'\nimport { TenantRole } from '../../authorization/index.js'\nimport { VerifyResult } from './ApiKeyManager.js'\n\n/**\n * Well-known identity id used for super-admin identities authenticated via an\n * unpersisted (configured) root token. The id is stable so that audit logs and\n * created entities consistently reference the same virtual identity, even\n * though no row exists in the `identity` table.\n */\nexport const UNPERSISTED_ROOT_IDENTITY_ID = 'f3b2c4d6-0000-4000-8000-000000000001'\n\nexport interface UnpersistedApiKey {\n\treadonly tokenHash: TokenHash\n\treadonly identityId: string\n\treadonly roles: readonly string[]\n}\n\n/**\n * Verifies incoming tokens against a fixed set of root tokens configured out of\n * band (env/config) instead of being stored in the database. This enables token\n * rotation without database writes and avoids persisting the token hash.\n *\n * Token hashes are compared in constant time to avoid leaking information about\n * the configured secret.\n */\nexport class UnpersistedApiKeyManager {\n\tprivate readonly apiKeys: readonly UnpersistedApiKey[]\n\n\tconstructor(apiKeys: readonly UnpersistedApiKey[] = []) {\n\t\tthis.apiKeys = apiKeys\n\t}\n\n\tget isEmpty(): boolean {\n\t\treturn this.apiKeys.length === 0\n\t}\n\n\tverify(token: string): VerifyResult | null {\n\t\tif (this.apiKeys.length === 0) {\n\t\t\treturn null\n\t\t}\n\t\tconst tokenHash = computeTokenHash(token)\n\t\t// Iterate over all configured keys (no early return) so that matching\n\t\t// remains independent of the position of the matching key.\n\t\tlet matched: UnpersistedApiKey | null = null\n\t\tfor (const apiKey of this.apiKeys) {\n\t\t\tif (timingSafeCompareHash(tokenHash, apiKey.tokenHash)) {\n\t\t\t\tmatched = apiKey\n\t\t\t}\n\t\t}\n\t\tif (matched === null) {\n\t\t\treturn null\n\t\t}\n\t\treturn new VerifyResult(\n\t\t\tmatched.identityId,\n\t\t\t// There is no persisted api_key row, so there is no api key id.\n\t\t\tmatched.identityId,\n\t\t\t[...matched.roles],\n\t\t\tnull,\n\t\t\tfalse,\n\t\t)\n\t}\n\n\tstatic createRootApiKey(tokenHash: TokenHash): UnpersistedApiKey {\n\t\treturn {\n\t\t\ttokenHash,\n\t\t\tidentityId: UNPERSISTED_ROOT_IDENTITY_ID,\n\t\t\troles: [TenantRole.SUPER_ADMIN],\n\t\t}\n\t}\n\n\t/**\n\t * Builds a manager for unpersisted super-admin root tokens from configured\n\t * plain tokens and/or pre-computed token hashes.\n\t */\n\tstatic createForRootTokens(input: {\n\t\ttokens?: readonly string[]\n\t\ttokenHashes?: readonly string[]\n\t}): UnpersistedApiKeyManager {\n\t\tconst hashes: TokenHash[] = []\n\t\tfor (const token of input.tokens ?? []) {\n\t\t\tif (token.length === 0) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\thashes.push(computeTokenHash(token))\n\t\t}\n\t\tfor (const hash of input.tokenHashes ?? []) {\n\t\t\tif (hash.length === 0) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tconst normalized = hash.toLowerCase()\n\t\t\tif (!isTokenHash(normalized)) {\n\t\t\t\tthrow new Error(`Invalid unpersisted root token hash: expected a 64-character sha256 hex string.`)\n\t\t\t}\n\t\t\thashes.push(normalized)\n\t\t}\n\t\treturn new UnpersistedApiKeyManager(hashes.map(it => UnpersistedApiKeyManager.createRootApiKey(it)))\n\t}\n}\n"],"names":["
|
|
1
|
+
{"version":3,"file":"UnpersistedApiKeyManager.cjs","sources":["../../../../../../../packages/engine-tenant-api/src/model/service/apiKey/UnpersistedApiKeyManager.ts"],"sourcesContent":["import { computeTokenHash, isTokenHash, timingSafeCompareHash, TokenHash } from '../../utils/index.js'\nimport { TenantRole } from '../../authorization/index.js'\nimport { VerifyResult } from './ApiKeyManager.js'\n\n/**\n * Well-known identity id used for super-admin identities authenticated via an\n * unpersisted (configured) root token. The id is stable so that audit logs and\n * created entities consistently reference the same virtual identity, even\n * though no row exists in the `identity` table.\n */\nexport const UNPERSISTED_ROOT_IDENTITY_ID = 'f3b2c4d6-0000-4000-8000-000000000001'\n\n/**\n * Well-known identity id for the pre-sign-in caller of a first-party UI served by the engine (the\n * management panel's login screen). It holds exactly {@link TenantRole.LOGIN} and exists only in\n * memory, so the surface it opens is fixed by this file rather than by whatever token an operator\n * happened to configure.\n */\nexport const UNPERSISTED_LOGIN_IDENTITY_ID = 'f3b2c4d6-0000-4000-8000-000000000002'\n\nconst unpersistedIdentityIds: ReadonlySet<string> = new Set([UNPERSISTED_ROOT_IDENTITY_ID, UNPERSISTED_LOGIN_IDENTITY_ID])\n\n/**\n * Whether an identity id is one of the virtual identities above, i.e. has no row in `identity`.\n * Anything writing a foreign key to `identity` must ask first — see `AuthLogService`.\n */\nexport const isUnpersistedIdentityId = (identityId: string | undefined): boolean => identityId !== undefined && unpersistedIdentityIds.has(identityId)\n\n/**\n * The pre-sign-in caller of an engine-served UI, as an already-verified result. There is no token to\n * present: the surface is reached by being routed there, so nothing is compared and nothing is read\n * from the database.\n */\nexport const createUnpersistedLoginVerifyResult = (): VerifyResult =>\n\tnew VerifyResult(UNPERSISTED_LOGIN_IDENTITY_ID, UNPERSISTED_LOGIN_IDENTITY_ID, [TenantRole.LOGIN], null, false)\n\nexport interface UnpersistedApiKey {\n\treadonly tokenHash: TokenHash\n\treadonly identityId: string\n\treadonly roles: readonly string[]\n}\n\n/**\n * Verifies incoming tokens against a fixed set of root tokens configured out of\n * band (env/config) instead of being stored in the database. This enables token\n * rotation without database writes and avoids persisting the token hash.\n *\n * Token hashes are compared in constant time to avoid leaking information about\n * the configured secret.\n */\nexport class UnpersistedApiKeyManager {\n\tprivate readonly apiKeys: readonly UnpersistedApiKey[]\n\n\tconstructor(apiKeys: readonly UnpersistedApiKey[] = []) {\n\t\tthis.apiKeys = apiKeys\n\t}\n\n\tget isEmpty(): boolean {\n\t\treturn this.apiKeys.length === 0\n\t}\n\n\tverify(token: string): VerifyResult | null {\n\t\tif (this.apiKeys.length === 0) {\n\t\t\treturn null\n\t\t}\n\t\tconst tokenHash = computeTokenHash(token)\n\t\t// Iterate over all configured keys (no early return) so that matching\n\t\t// remains independent of the position of the matching key.\n\t\tlet matched: UnpersistedApiKey | null = null\n\t\tfor (const apiKey of this.apiKeys) {\n\t\t\tif (timingSafeCompareHash(tokenHash, apiKey.tokenHash)) {\n\t\t\t\tmatched = apiKey\n\t\t\t}\n\t\t}\n\t\tif (matched === null) {\n\t\t\treturn null\n\t\t}\n\t\treturn new VerifyResult(\n\t\t\tmatched.identityId,\n\t\t\t// There is no persisted api_key row, so there is no api key id.\n\t\t\tmatched.identityId,\n\t\t\t[...matched.roles],\n\t\t\tnull,\n\t\t\tfalse,\n\t\t)\n\t}\n\n\tstatic createRootApiKey(tokenHash: TokenHash): UnpersistedApiKey {\n\t\treturn {\n\t\t\ttokenHash,\n\t\t\tidentityId: UNPERSISTED_ROOT_IDENTITY_ID,\n\t\t\troles: [TenantRole.SUPER_ADMIN],\n\t\t}\n\t}\n\n\t/**\n\t * Builds a manager for unpersisted super-admin root tokens from configured\n\t * plain tokens and/or pre-computed token hashes.\n\t */\n\tstatic createForRootTokens(input: {\n\t\ttokens?: readonly string[]\n\t\ttokenHashes?: readonly string[]\n\t}): UnpersistedApiKeyManager {\n\t\tconst hashes: TokenHash[] = []\n\t\tfor (const token of input.tokens ?? []) {\n\t\t\tif (token.length === 0) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\thashes.push(computeTokenHash(token))\n\t\t}\n\t\tfor (const hash of input.tokenHashes ?? []) {\n\t\t\tif (hash.length === 0) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tconst normalized = hash.toLowerCase()\n\t\t\tif (!isTokenHash(normalized)) {\n\t\t\t\tthrow new Error(`Invalid unpersisted root token hash: expected a 64-character sha256 hex string.`)\n\t\t\t}\n\t\t\thashes.push(normalized)\n\t\t}\n\t\treturn new UnpersistedApiKeyManager(hashes.map(it => UnpersistedApiKeyManager.createRootApiKey(it)))\n\t}\n}\n"],"names":["VerifyResult","TenantRole","token","computeTokenHash","timingSafeCompareHash","isTokenHash"],"mappings":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,GAAG;AACvB;AAAA,MACD;AACA,aAAO,KAAKC,uBAAiBD,OAAK,CAAC;AAAA,IACpC;AACA,eAAW,QAAQ,MAAM,eAAe,CAAA,GAAI;AAC3C,UAAI,KAAK,WAAW,GAAG;AACtB;AAAA,MACD;AACA,YAAM,aAAa,KAAK,YAAA;AACxB,UAAI,CAACG,MAAAA,YAAY,UAAU,GAAG;AAC7B,cAAM,IAAI,MAAM,iFAAiF;AAAA,MAClG;AACA,aAAO,KAAK,UAAU;AAAA,IACvB;AACA,WAAO,IAAI,yBAAyB,OAAO,IAAI,QAAM,yBAAyB,iBAAiB,EAAE,CAAC,CAAC;AAAA,EACpG;AACD;;;;;;"}
|
|
@@ -4,14 +4,20 @@ import { computeTokenHash, timingSafeCompareHash, isTokenHash } from "../../util
|
|
|
4
4
|
import "../../authorization/PermissionActions.js";
|
|
5
5
|
import "@contember/authorization";
|
|
6
6
|
import { TenantRole } from "../../authorization/Roles.js";
|
|
7
|
+
import "../../queries/apiKey/ApiKeyQuery.js";
|
|
8
|
+
import "../../authorization/CustomRolePermissions.js";
|
|
7
9
|
import "../../authorization/PermissionContext.js";
|
|
8
|
-
import "../../authorization/
|
|
10
|
+
import "../../authorization/TargetIdentityPermission.js";
|
|
9
11
|
import "@contember/schema";
|
|
10
12
|
import { VerifyResult } from "./ApiKeyManager.js";
|
|
11
13
|
var __defProp = Object.defineProperty;
|
|
12
14
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
15
|
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "", value);
|
|
14
16
|
const UNPERSISTED_ROOT_IDENTITY_ID = "f3b2c4d6-0000-4000-8000-000000000001";
|
|
17
|
+
const UNPERSISTED_LOGIN_IDENTITY_ID = "f3b2c4d6-0000-4000-8000-000000000002";
|
|
18
|
+
const unpersistedIdentityIds = /* @__PURE__ */ new Set([UNPERSISTED_ROOT_IDENTITY_ID, UNPERSISTED_LOGIN_IDENTITY_ID]);
|
|
19
|
+
const isUnpersistedIdentityId = (identityId) => identityId !== void 0 && unpersistedIdentityIds.has(identityId);
|
|
20
|
+
const createUnpersistedLoginVerifyResult = () => new VerifyResult(UNPERSISTED_LOGIN_IDENTITY_ID, UNPERSISTED_LOGIN_IDENTITY_ID, [TenantRole.LOGIN], null, false);
|
|
15
21
|
class UnpersistedApiKeyManager {
|
|
16
22
|
constructor(apiKeys = []) {
|
|
17
23
|
__publicField(this, "apiKeys");
|
|
@@ -76,7 +82,10 @@ class UnpersistedApiKeyManager {
|
|
|
76
82
|
}
|
|
77
83
|
}
|
|
78
84
|
export {
|
|
85
|
+
UNPERSISTED_LOGIN_IDENTITY_ID,
|
|
79
86
|
UNPERSISTED_ROOT_IDENTITY_ID,
|
|
80
|
-
UnpersistedApiKeyManager
|
|
87
|
+
UnpersistedApiKeyManager,
|
|
88
|
+
createUnpersistedLoginVerifyResult,
|
|
89
|
+
isUnpersistedIdentityId
|
|
81
90
|
};
|
|
82
91
|
//# sourceMappingURL=UnpersistedApiKeyManager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnpersistedApiKeyManager.js","sources":["../../../../../../../packages/engine-tenant-api/src/model/service/apiKey/UnpersistedApiKeyManager.ts"],"sourcesContent":["import { computeTokenHash, isTokenHash, timingSafeCompareHash, TokenHash } from '../../utils/index.js'\nimport { TenantRole } from '../../authorization/index.js'\nimport { VerifyResult } from './ApiKeyManager.js'\n\n/**\n * Well-known identity id used for super-admin identities authenticated via an\n * unpersisted (configured) root token. The id is stable so that audit logs and\n * created entities consistently reference the same virtual identity, even\n * though no row exists in the `identity` table.\n */\nexport const UNPERSISTED_ROOT_IDENTITY_ID = 'f3b2c4d6-0000-4000-8000-000000000001'\n\nexport interface UnpersistedApiKey {\n\treadonly tokenHash: TokenHash\n\treadonly identityId: string\n\treadonly roles: readonly string[]\n}\n\n/**\n * Verifies incoming tokens against a fixed set of root tokens configured out of\n * band (env/config) instead of being stored in the database. This enables token\n * rotation without database writes and avoids persisting the token hash.\n *\n * Token hashes are compared in constant time to avoid leaking information about\n * the configured secret.\n */\nexport class UnpersistedApiKeyManager {\n\tprivate readonly apiKeys: readonly UnpersistedApiKey[]\n\n\tconstructor(apiKeys: readonly UnpersistedApiKey[] = []) {\n\t\tthis.apiKeys = apiKeys\n\t}\n\n\tget isEmpty(): boolean {\n\t\treturn this.apiKeys.length === 0\n\t}\n\n\tverify(token: string): VerifyResult | null {\n\t\tif (this.apiKeys.length === 0) {\n\t\t\treturn null\n\t\t}\n\t\tconst tokenHash = computeTokenHash(token)\n\t\t// Iterate over all configured keys (no early return) so that matching\n\t\t// remains independent of the position of the matching key.\n\t\tlet matched: UnpersistedApiKey | null = null\n\t\tfor (const apiKey of this.apiKeys) {\n\t\t\tif (timingSafeCompareHash(tokenHash, apiKey.tokenHash)) {\n\t\t\t\tmatched = apiKey\n\t\t\t}\n\t\t}\n\t\tif (matched === null) {\n\t\t\treturn null\n\t\t}\n\t\treturn new VerifyResult(\n\t\t\tmatched.identityId,\n\t\t\t// There is no persisted api_key row, so there is no api key id.\n\t\t\tmatched.identityId,\n\t\t\t[...matched.roles],\n\t\t\tnull,\n\t\t\tfalse,\n\t\t)\n\t}\n\n\tstatic createRootApiKey(tokenHash: TokenHash): UnpersistedApiKey {\n\t\treturn {\n\t\t\ttokenHash,\n\t\t\tidentityId: UNPERSISTED_ROOT_IDENTITY_ID,\n\t\t\troles: [TenantRole.SUPER_ADMIN],\n\t\t}\n\t}\n\n\t/**\n\t * Builds a manager for unpersisted super-admin root tokens from configured\n\t * plain tokens and/or pre-computed token hashes.\n\t */\n\tstatic createForRootTokens(input: {\n\t\ttokens?: readonly string[]\n\t\ttokenHashes?: readonly string[]\n\t}): UnpersistedApiKeyManager {\n\t\tconst hashes: TokenHash[] = []\n\t\tfor (const token of input.tokens ?? []) {\n\t\t\tif (token.length === 0) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\thashes.push(computeTokenHash(token))\n\t\t}\n\t\tfor (const hash of input.tokenHashes ?? []) {\n\t\t\tif (hash.length === 0) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tconst normalized = hash.toLowerCase()\n\t\t\tif (!isTokenHash(normalized)) {\n\t\t\t\tthrow new Error(`Invalid unpersisted root token hash: expected a 64-character sha256 hex string.`)\n\t\t\t}\n\t\t\thashes.push(normalized)\n\t\t}\n\t\treturn new UnpersistedApiKeyManager(hashes.map(it => UnpersistedApiKeyManager.createRootApiKey(it)))\n\t}\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"UnpersistedApiKeyManager.js","sources":["../../../../../../../packages/engine-tenant-api/src/model/service/apiKey/UnpersistedApiKeyManager.ts"],"sourcesContent":["import { computeTokenHash, isTokenHash, timingSafeCompareHash, TokenHash } from '../../utils/index.js'\nimport { TenantRole } from '../../authorization/index.js'\nimport { VerifyResult } from './ApiKeyManager.js'\n\n/**\n * Well-known identity id used for super-admin identities authenticated via an\n * unpersisted (configured) root token. The id is stable so that audit logs and\n * created entities consistently reference the same virtual identity, even\n * though no row exists in the `identity` table.\n */\nexport const UNPERSISTED_ROOT_IDENTITY_ID = 'f3b2c4d6-0000-4000-8000-000000000001'\n\n/**\n * Well-known identity id for the pre-sign-in caller of a first-party UI served by the engine (the\n * management panel's login screen). It holds exactly {@link TenantRole.LOGIN} and exists only in\n * memory, so the surface it opens is fixed by this file rather than by whatever token an operator\n * happened to configure.\n */\nexport const UNPERSISTED_LOGIN_IDENTITY_ID = 'f3b2c4d6-0000-4000-8000-000000000002'\n\nconst unpersistedIdentityIds: ReadonlySet<string> = new Set([UNPERSISTED_ROOT_IDENTITY_ID, UNPERSISTED_LOGIN_IDENTITY_ID])\n\n/**\n * Whether an identity id is one of the virtual identities above, i.e. has no row in `identity`.\n * Anything writing a foreign key to `identity` must ask first — see `AuthLogService`.\n */\nexport const isUnpersistedIdentityId = (identityId: string | undefined): boolean => identityId !== undefined && unpersistedIdentityIds.has(identityId)\n\n/**\n * The pre-sign-in caller of an engine-served UI, as an already-verified result. There is no token to\n * present: the surface is reached by being routed there, so nothing is compared and nothing is read\n * from the database.\n */\nexport const createUnpersistedLoginVerifyResult = (): VerifyResult =>\n\tnew VerifyResult(UNPERSISTED_LOGIN_IDENTITY_ID, UNPERSISTED_LOGIN_IDENTITY_ID, [TenantRole.LOGIN], null, false)\n\nexport interface UnpersistedApiKey {\n\treadonly tokenHash: TokenHash\n\treadonly identityId: string\n\treadonly roles: readonly string[]\n}\n\n/**\n * Verifies incoming tokens against a fixed set of root tokens configured out of\n * band (env/config) instead of being stored in the database. This enables token\n * rotation without database writes and avoids persisting the token hash.\n *\n * Token hashes are compared in constant time to avoid leaking information about\n * the configured secret.\n */\nexport class UnpersistedApiKeyManager {\n\tprivate readonly apiKeys: readonly UnpersistedApiKey[]\n\n\tconstructor(apiKeys: readonly UnpersistedApiKey[] = []) {\n\t\tthis.apiKeys = apiKeys\n\t}\n\n\tget isEmpty(): boolean {\n\t\treturn this.apiKeys.length === 0\n\t}\n\n\tverify(token: string): VerifyResult | null {\n\t\tif (this.apiKeys.length === 0) {\n\t\t\treturn null\n\t\t}\n\t\tconst tokenHash = computeTokenHash(token)\n\t\t// Iterate over all configured keys (no early return) so that matching\n\t\t// remains independent of the position of the matching key.\n\t\tlet matched: UnpersistedApiKey | null = null\n\t\tfor (const apiKey of this.apiKeys) {\n\t\t\tif (timingSafeCompareHash(tokenHash, apiKey.tokenHash)) {\n\t\t\t\tmatched = apiKey\n\t\t\t}\n\t\t}\n\t\tif (matched === null) {\n\t\t\treturn null\n\t\t}\n\t\treturn new VerifyResult(\n\t\t\tmatched.identityId,\n\t\t\t// There is no persisted api_key row, so there is no api key id.\n\t\t\tmatched.identityId,\n\t\t\t[...matched.roles],\n\t\t\tnull,\n\t\t\tfalse,\n\t\t)\n\t}\n\n\tstatic createRootApiKey(tokenHash: TokenHash): UnpersistedApiKey {\n\t\treturn {\n\t\t\ttokenHash,\n\t\t\tidentityId: UNPERSISTED_ROOT_IDENTITY_ID,\n\t\t\troles: [TenantRole.SUPER_ADMIN],\n\t\t}\n\t}\n\n\t/**\n\t * Builds a manager for unpersisted super-admin root tokens from configured\n\t * plain tokens and/or pre-computed token hashes.\n\t */\n\tstatic createForRootTokens(input: {\n\t\ttokens?: readonly string[]\n\t\ttokenHashes?: readonly string[]\n\t}): UnpersistedApiKeyManager {\n\t\tconst hashes: TokenHash[] = []\n\t\tfor (const token of input.tokens ?? []) {\n\t\t\tif (token.length === 0) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\thashes.push(computeTokenHash(token))\n\t\t}\n\t\tfor (const hash of input.tokenHashes ?? []) {\n\t\t\tif (hash.length === 0) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tconst normalized = hash.toLowerCase()\n\t\t\tif (!isTokenHash(normalized)) {\n\t\t\t\tthrow new Error(`Invalid unpersisted root token hash: expected a 64-character sha256 hex string.`)\n\t\t\t}\n\t\t\thashes.push(normalized)\n\t\t}\n\t\treturn new UnpersistedApiKeyManager(hashes.map(it => UnpersistedApiKeyManager.createRootApiKey(it)))\n\t}\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAUO,MAAM,+BAA+B;AAQrC,MAAM,gCAAgC;AAE7C,MAAM,yBAA8C,oBAAI,IAAI,CAAC,8BAA8B,6BAA6B,CAAC;AAMlH,MAAM,0BAA0B,CAAC,eAA4C,eAAe,UAAa,uBAAuB,IAAI,UAAU;AAO9I,MAAM,qCAAqC,MACjD,IAAI,aAAa,+BAA+B,+BAA+B,CAAC,WAAW,KAAK,GAAG,MAAM,KAAK;AAgBxG,MAAM,yBAAyB;AAAA,EAGrC,YAAY,UAAwC,IAAI;AAFxD,kBAAA,MAAiB,SAAA;AAGhB,SAAK,UAAU;AAAA,EAChB;AAAA,EAEA,IAAI,UAAmB;AACtB,WAAO,KAAK,QAAQ,WAAW;AAAA,EAChC;AAAA,EAEA,OAAO,OAAoC;AAC1C,QAAI,KAAK,Q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