@contember/engine-tenant-api 2.2.0-alpha.3 → 2.2.0-alpha.6
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 +36 -2
- package/dist/development/index.cjs +32 -0
- package/dist/development/index.cjs.map +1 -1
- package/dist/development/index.js +33 -1
- package/dist/development/index.js.map +1 -1
- package/dist/development/src/TenantContainer.cjs +15 -3
- package/dist/development/src/TenantContainer.cjs.map +1 -1
- package/dist/development/src/TenantContainer.js +15 -3
- package/dist/development/src/TenantContainer.js.map +1 -1
- package/dist/development/src/bridges/system/IdentityFetcher.cjs +2 -1
- package/dist/development/src/bridges/system/IdentityFetcher.cjs.map +1 -1
- package/dist/development/src/bridges/system/IdentityFetcher.js +2 -1
- 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/runner.cjs +11 -2
- package/dist/development/src/migrations/runner.cjs.map +1 -1
- package/dist/development/src/migrations/runner.js +11 -2
- package/dist/development/src/migrations/runner.js.map +1 -1
- package/dist/development/src/migrations/snapshot.cjs +8 -2
- package/dist/development/src/migrations/snapshot.cjs.map +1 -1
- package/dist/development/src/migrations/snapshot.js +8 -2
- package/dist/development/src/migrations/snapshot.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/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/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/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/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/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/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/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 +1 -1
- package/dist/development/src/model/queries/person/PersonQueryBuilderFactory.cjs.map +1 -1
- package/dist/development/src/model/queries/person/PersonQueryBuilderFactory.js +1 -1
- package/dist/development/src/model/queries/person/PersonQueryBuilderFactory.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/IDPSignInManager.cjs +29 -2
- package/dist/development/src/model/service/IDPSignInManager.cjs.map +1 -1
- package/dist/development/src/model/service/IDPSignInManager.js +29 -2
- package/dist/development/src/model/service/IDPSignInManager.js.map +1 -1
- package/dist/development/src/model/service/PanelAccessResolver.cjs +31 -0
- package/dist/development/src/model/service/PanelAccessResolver.cjs.map +1 -0
- package/dist/development/src/model/service/PanelAccessResolver.js +31 -0
- package/dist/development/src/model/service/PanelAccessResolver.js.map +1 -0
- package/dist/development/src/model/service/PasswordResetManager.cjs +5 -0
- package/dist/development/src/model/service/PasswordResetManager.cjs.map +1 -1
- package/dist/development/src/model/service/PasswordResetManager.js +5 -0
- package/dist/development/src/model/service/PasswordResetManager.js.map +1 -1
- package/dist/development/src/model/service/PasswordlessSignInManager.cjs +19 -0
- package/dist/development/src/model/service/PasswordlessSignInManager.cjs.map +1 -1
- package/dist/development/src/model/service/PasswordlessSignInManager.js +19 -0
- 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/SignInManager.cjs +5 -0
- package/dist/development/src/model/service/SignInManager.cjs.map +1 -1
- package/dist/development/src/model/service/SignInManager.js +5 -0
- package/dist/development/src/model/service/SignInManager.js.map +1 -1
- package/dist/development/src/model/service/apiKey/ApiKeyManager.cjs +4 -3
- package/dist/development/src/model/service/apiKey/ApiKeyManager.cjs.map +1 -1
- package/dist/development/src/model/service/apiKey/ApiKeyManager.js +4 -3
- package/dist/development/src/model/service/apiKey/ApiKeyManager.js.map +1 -1
- package/dist/development/src/model/service/apiKey/UnpersistedApiKeyManager.cjs +7 -0
- package/dist/development/src/model/service/apiKey/UnpersistedApiKeyManager.cjs.map +1 -1
- package/dist/development/src/model/service/apiKey/UnpersistedApiKeyManager.js +8 -1
- 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 +260 -0
- package/dist/development/src/model/service/idp/IDPClaimSyncService.cjs.map +1 -0
- package/dist/development/src/model/service/idp/IDPClaimSyncService.js +260 -0
- package/dist/development/src/model/service/idp/IDPClaimSyncService.js.map +1 -0
- package/dist/development/src/model/service/idp/IDPManager.cjs +96 -20
- package/dist/development/src/model/service/idp/IDPManager.cjs.map +1 -1
- package/dist/development/src/model/service/idp/IDPManager.js +96 -20
- package/dist/development/src/model/service/idp/IDPManager.js.map +1 -1
- package/dist/development/src/model/service/idp/IdpSessionRevalidator.cjs +55 -1
- package/dist/development/src/model/service/idp/IdpSessionRevalidator.cjs.map +1 -1
- package/dist/development/src/model/service/idp/IdpSessionRevalidator.js +55 -1
- package/dist/development/src/model/service/idp/IdpSessionRevalidator.js.map +1 -1
- package/dist/development/src/model/service/idp/PersonIdentityProviderManager.cjs +6 -0
- package/dist/development/src/model/service/idp/PersonIdentityProviderManager.cjs.map +1 -1
- package/dist/development/src/model/service/idp/PersonIdentityProviderManager.js +6 -0
- 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 +7 -2
- package/dist/development/src/model/utils/DatabaseContext.cjs.map +1 -1
- package/dist/development/src/model/utils/DatabaseContext.js +8 -3
- package/dist/development/src/model/utils/DatabaseContext.js.map +1 -1
- package/dist/development/src/resolvers/ResolverFactory.cjs +6 -2
- package/dist/development/src/resolvers/ResolverFactory.cjs.map +1 -1
- package/dist/development/src/resolvers/ResolverFactory.js +6 -2
- package/dist/development/src/resolvers/ResolverFactory.js.map +1 -1
- package/dist/development/src/resolvers/mutation/apiKey/CreateApiKeyMutationResolver.cjs +2 -1
- package/dist/development/src/resolvers/mutation/apiKey/CreateApiKeyMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/apiKey/CreateApiKeyMutationResolver.js +2 -1
- package/dist/development/src/resolvers/mutation/apiKey/CreateApiKeyMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/apiKey/DisableApiKeyMutationResolver.cjs +2 -1
- package/dist/development/src/resolvers/mutation/apiKey/DisableApiKeyMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/apiKey/DisableApiKeyMutationResolver.js +2 -1
- package/dist/development/src/resolvers/mutation/apiKey/DisableApiKeyMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/configuration/AuthPolicyMutationResolver.cjs +2 -1
- package/dist/development/src/resolvers/mutation/configuration/AuthPolicyMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/configuration/AuthPolicyMutationResolver.js +2 -1
- package/dist/development/src/resolvers/mutation/configuration/AuthPolicyMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/configuration/ConfigurationMutationResolver.cjs +2 -1
- package/dist/development/src/resolvers/mutation/configuration/ConfigurationMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/configuration/ConfigurationMutationResolver.js +2 -1
- package/dist/development/src/resolvers/mutation/configuration/ConfigurationMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/identity/GlobalRolesMutationResolver.cjs +2 -1
- package/dist/development/src/resolvers/mutation/identity/GlobalRolesMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/identity/GlobalRolesMutationResolver.js +2 -1
- package/dist/development/src/resolvers/mutation/identity/GlobalRolesMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/idp/AddIDPMutationResolver.cjs +4 -2
- package/dist/development/src/resolvers/mutation/idp/AddIDPMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/idp/AddIDPMutationResolver.js +4 -2
- package/dist/development/src/resolvers/mutation/idp/AddIDPMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/idp/DisableIDPMutationResolver.cjs +2 -1
- package/dist/development/src/resolvers/mutation/idp/DisableIDPMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/idp/DisableIDPMutationResolver.js +2 -1
- package/dist/development/src/resolvers/mutation/idp/DisableIDPMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/idp/DisconnectMyIdentityProviderMutationResolver.cjs +2 -1
- package/dist/development/src/resolvers/mutation/idp/DisconnectMyIdentityProviderMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/idp/DisconnectMyIdentityProviderMutationResolver.js +2 -1
- package/dist/development/src/resolvers/mutation/idp/DisconnectMyIdentityProviderMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/idp/EnableIDPMutationResolver.cjs +2 -1
- package/dist/development/src/resolvers/mutation/idp/EnableIDPMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/idp/EnableIDPMutationResolver.js +2 -1
- package/dist/development/src/resolvers/mutation/idp/EnableIDPMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/idp/UpdateIDPMutationResolver.cjs +4 -2
- package/dist/development/src/resolvers/mutation/idp/UpdateIDPMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/idp/UpdateIDPMutationResolver.js +4 -2
- 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 +2 -1
- package/dist/development/src/resolvers/mutation/mailTemplates/MailTemplateMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/mailTemplates/MailTemplateMutationResolver.js +2 -1
- package/dist/development/src/resolvers/mutation/mailTemplates/MailTemplateMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/person/ChangePasswordMutationResolver.cjs +2 -1
- package/dist/development/src/resolvers/mutation/person/ChangePasswordMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/person/ChangePasswordMutationResolver.js +2 -1
- package/dist/development/src/resolvers/mutation/person/ChangePasswordMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/person/ChangeProfileMutationResolver.cjs +2 -1
- package/dist/development/src/resolvers/mutation/person/ChangeProfileMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/person/ChangeProfileMutationResolver.js +2 -1
- package/dist/development/src/resolvers/mutation/person/ChangeProfileMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/person/DisablePersonMutationResolver.cjs +4 -3
- package/dist/development/src/resolvers/mutation/person/DisablePersonMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/person/DisablePersonMutationResolver.js +4 -3
- package/dist/development/src/resolvers/mutation/person/DisablePersonMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/person/EmailOtpMutationResolver.cjs +2 -1
- package/dist/development/src/resolvers/mutation/person/EmailOtpMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/person/EmailOtpMutationResolver.js +2 -1
- package/dist/development/src/resolvers/mutation/person/EmailOtpMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/person/EmailVerificationMutationResolver.cjs +2 -1
- package/dist/development/src/resolvers/mutation/person/EmailVerificationMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/person/EmailVerificationMutationResolver.js +2 -1
- package/dist/development/src/resolvers/mutation/person/EmailVerificationMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/person/EnablePersonMutationResolver.cjs +60 -0
- package/dist/development/src/resolvers/mutation/person/EnablePersonMutationResolver.cjs.map +1 -0
- package/dist/development/src/resolvers/mutation/person/EnablePersonMutationResolver.js +60 -0
- package/dist/development/src/resolvers/mutation/person/EnablePersonMutationResolver.js.map +1 -0
- package/dist/development/src/resolvers/mutation/person/ForceSignOutMutationResolver.cjs +2 -1
- package/dist/development/src/resolvers/mutation/person/ForceSignOutMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/person/ForceSignOutMutationResolver.js +2 -1
- package/dist/development/src/resolvers/mutation/person/ForceSignOutMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/person/IDPMutationResolver.cjs +27 -1
- package/dist/development/src/resolvers/mutation/person/IDPMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/person/IDPMutationResolver.js +27 -1
- package/dist/development/src/resolvers/mutation/person/IDPMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/person/InviteMutationResolver.cjs +2 -1
- package/dist/development/src/resolvers/mutation/person/InviteMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/person/InviteMutationResolver.js +2 -1
- package/dist/development/src/resolvers/mutation/person/InviteMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/person/OtpMutationResolver.cjs +2 -1
- package/dist/development/src/resolvers/mutation/person/OtpMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/person/OtpMutationResolver.js +2 -1
- package/dist/development/src/resolvers/mutation/person/OtpMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/person/PasswordlessMutationResolver.cjs +6 -1
- package/dist/development/src/resolvers/mutation/person/PasswordlessMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/person/PasswordlessMutationResolver.js +6 -1
- package/dist/development/src/resolvers/mutation/person/PasswordlessMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/person/RegenerateBackupCodesMutationResolver.cjs +2 -1
- package/dist/development/src/resolvers/mutation/person/RegenerateBackupCodesMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/person/RegenerateBackupCodesMutationResolver.js +2 -1
- package/dist/development/src/resolvers/mutation/person/RegenerateBackupCodesMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/person/ResetPasswordMutationResolver.cjs +2 -1
- package/dist/development/src/resolvers/mutation/person/ResetPasswordMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/person/ResetPasswordMutationResolver.js +2 -1
- package/dist/development/src/resolvers/mutation/person/ResetPasswordMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/person/ResetPersonMfaMutationResolver.cjs +2 -1
- package/dist/development/src/resolvers/mutation/person/ResetPersonMfaMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/person/ResetPersonMfaMutationResolver.js +2 -1
- package/dist/development/src/resolvers/mutation/person/ResetPersonMfaMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/person/RevokeSessionMutationResolver.cjs +2 -1
- package/dist/development/src/resolvers/mutation/person/RevokeSessionMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/person/RevokeSessionMutationResolver.js +2 -1
- package/dist/development/src/resolvers/mutation/person/RevokeSessionMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/person/SignInMutationResolver.cjs +4 -3
- package/dist/development/src/resolvers/mutation/person/SignInMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/person/SignInMutationResolver.js +4 -3
- package/dist/development/src/resolvers/mutation/person/SignInMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/person/SignOutMutationResolver.cjs +2 -1
- package/dist/development/src/resolvers/mutation/person/SignOutMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/person/SignOutMutationResolver.js +2 -1
- package/dist/development/src/resolvers/mutation/person/SignOutMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/person/SignUpMutationResolver.cjs +2 -1
- package/dist/development/src/resolvers/mutation/person/SignUpMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/person/SignUpMutationResolver.js +2 -1
- package/dist/development/src/resolvers/mutation/person/SignUpMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/person/TogglePasswordlessMutationResolver.cjs +2 -1
- package/dist/development/src/resolvers/mutation/person/TogglePasswordlessMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/person/TogglePasswordlessMutationResolver.js +2 -1
- package/dist/development/src/resolvers/mutation/person/TogglePasswordlessMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/project/CreateProjectMutationResolver.cjs +2 -1
- package/dist/development/src/resolvers/mutation/project/CreateProjectMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/project/CreateProjectMutationResolver.js +2 -1
- package/dist/development/src/resolvers/mutation/project/CreateProjectMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/project/SetProjectSecretMutationResolver.cjs +2 -1
- package/dist/development/src/resolvers/mutation/project/SetProjectSecretMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/project/SetProjectSecretMutationResolver.js +2 -1
- package/dist/development/src/resolvers/mutation/project/SetProjectSecretMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/project/UpdateProjectMutationResolver.cjs +2 -1
- package/dist/development/src/resolvers/mutation/project/UpdateProjectMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/project/UpdateProjectMutationResolver.js +2 -1
- package/dist/development/src/resolvers/mutation/project/UpdateProjectMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/projectMember/AddProjectMemberMutationResolver.cjs +2 -1
- package/dist/development/src/resolvers/mutation/projectMember/AddProjectMemberMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/projectMember/AddProjectMemberMutationResolver.js +2 -1
- package/dist/development/src/resolvers/mutation/projectMember/AddProjectMemberMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/projectMember/RemoveProjectMemberMutationResolver.cjs +2 -1
- package/dist/development/src/resolvers/mutation/projectMember/RemoveProjectMemberMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/projectMember/RemoveProjectMemberMutationResolver.js +2 -1
- package/dist/development/src/resolvers/mutation/projectMember/RemoveProjectMemberMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/projectMember/UpdateProjectMemberMutationResolver.cjs +2 -1
- package/dist/development/src/resolvers/mutation/projectMember/UpdateProjectMemberMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/projectMember/UpdateProjectMemberMutationResolver.js +2 -1
- package/dist/development/src/resolvers/mutation/projectMember/UpdateProjectMemberMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/query/ApiKeyQueryResolver.cjs +2 -1
- package/dist/development/src/resolvers/query/ApiKeyQueryResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/query/ApiKeyQueryResolver.js +2 -1
- package/dist/development/src/resolvers/query/ApiKeyQueryResolver.js.map +1 -1
- package/dist/development/src/resolvers/query/AuthLogQueryResolver.cjs +2 -1
- package/dist/development/src/resolvers/query/AuthLogQueryResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/query/AuthLogQueryResolver.js +2 -1
- package/dist/development/src/resolvers/query/AuthLogQueryResolver.js.map +1 -1
- package/dist/development/src/resolvers/query/AuthPolicyQueryResolver.cjs +2 -1
- package/dist/development/src/resolvers/query/AuthPolicyQueryResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/query/AuthPolicyQueryResolver.js +2 -1
- package/dist/development/src/resolvers/query/AuthPolicyQueryResolver.js.map +1 -1
- package/dist/development/src/resolvers/query/ConfigurationQueryResolver.cjs +2 -1
- package/dist/development/src/resolvers/query/ConfigurationQueryResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/query/ConfigurationQueryResolver.js +2 -1
- package/dist/development/src/resolvers/query/ConfigurationQueryResolver.js.map +1 -1
- package/dist/development/src/resolvers/query/IDPQueryResolver.cjs +2 -1
- package/dist/development/src/resolvers/query/IDPQueryResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/query/IDPQueryResolver.js +2 -1
- package/dist/development/src/resolvers/query/IDPQueryResolver.js.map +1 -1
- package/dist/development/src/resolvers/query/MailTemplateQueryResolver.cjs +2 -1
- package/dist/development/src/resolvers/query/MailTemplateQueryResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/query/MailTemplateQueryResolver.js +2 -1
- package/dist/development/src/resolvers/query/MailTemplateQueryResolver.js.map +1 -1
- package/dist/development/src/resolvers/query/PersonQueryResolver.cjs +2 -1
- package/dist/development/src/resolvers/query/PersonQueryResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/query/PersonQueryResolver.js +2 -1
- package/dist/development/src/resolvers/query/PersonQueryResolver.js.map +1 -1
- package/dist/development/src/resolvers/query/ProjectMembersQueryResolver.cjs +2 -1
- package/dist/development/src/resolvers/query/ProjectMembersQueryResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/query/ProjectMembersQueryResolver.js +2 -1
- package/dist/development/src/resolvers/query/ProjectMembersQueryResolver.js.map +1 -1
- package/dist/development/src/resolvers/query/ProjectQueryResolver.cjs +5 -3
- package/dist/development/src/resolvers/query/ProjectQueryResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/query/ProjectQueryResolver.js +5 -3
- package/dist/development/src/resolvers/query/ProjectQueryResolver.js.map +1 -1
- package/dist/development/src/resolvers/responseHelpers/ApiKeyResponseFactory.cjs +2 -1
- package/dist/development/src/resolvers/responseHelpers/ApiKeyResponseFactory.cjs.map +1 -1
- package/dist/development/src/resolvers/responseHelpers/ApiKeyResponseFactory.js +2 -1
- 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 +2 -1
- package/dist/development/src/resolvers/responseHelpers/SignInResponseFactory.cjs.map +1 -1
- package/dist/development/src/resolvers/responseHelpers/SignInResponseFactory.js +2 -1
- package/dist/development/src/resolvers/responseHelpers/SignInResponseFactory.js.map +1 -1
- package/dist/development/src/resolvers/types/IdentityTypeResolver.cjs +37 -4
- package/dist/development/src/resolvers/types/IdentityTypeResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/types/IdentityTypeResolver.js +37 -4
- package/dist/development/src/resolvers/types/IdentityTypeResolver.js.map +1 -1
- package/dist/development/src/resolvers/types/PersonTypeResolver.cjs +30 -1
- package/dist/development/src/resolvers/types/PersonTypeResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/types/PersonTypeResolver.js +30 -1
- package/dist/development/src/resolvers/types/PersonTypeResolver.js.map +1 -1
- package/dist/development/src/resolvers/types/ProjectTypeResolver.cjs +25 -1
- package/dist/development/src/resolvers/types/ProjectTypeResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/types/ProjectTypeResolver.js +25 -1
- package/dist/development/src/resolvers/types/ProjectTypeResolver.js.map +1 -1
- package/dist/development/src/schema/tenant.graphql.cjs +144 -0
- package/dist/development/src/schema/tenant.graphql.cjs.map +1 -1
- package/dist/development/src/schema/tenant.graphql.js +144 -0
- package/dist/development/src/schema/tenant.graphql.js.map +1 -1
- package/dist/production/index.cjs +32 -0
- package/dist/production/index.cjs.map +1 -1
- package/dist/production/index.js +33 -1
- package/dist/production/index.js.map +1 -1
- package/dist/production/src/TenantContainer.cjs +15 -3
- package/dist/production/src/TenantContainer.cjs.map +1 -1
- package/dist/production/src/TenantContainer.js +15 -3
- package/dist/production/src/TenantContainer.js.map +1 -1
- package/dist/production/src/bridges/system/IdentityFetcher.cjs +2 -1
- package/dist/production/src/bridges/system/IdentityFetcher.cjs.map +1 -1
- package/dist/production/src/bridges/system/IdentityFetcher.js +2 -1
- 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/runner.cjs +11 -2
- package/dist/production/src/migrations/runner.cjs.map +1 -1
- package/dist/production/src/migrations/runner.js +11 -2
- package/dist/production/src/migrations/runner.js.map +1 -1
- package/dist/production/src/migrations/snapshot.cjs +8 -2
- package/dist/production/src/migrations/snapshot.cjs.map +1 -1
- package/dist/production/src/migrations/snapshot.js +8 -2
- package/dist/production/src/migrations/snapshot.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/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/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/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/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/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/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/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 +1 -1
- package/dist/production/src/model/queries/person/PersonQueryBuilderFactory.cjs.map +1 -1
- package/dist/production/src/model/queries/person/PersonQueryBuilderFactory.js +1 -1
- package/dist/production/src/model/queries/person/PersonQueryBuilderFactory.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/IDPSignInManager.cjs +29 -2
- package/dist/production/src/model/service/IDPSignInManager.cjs.map +1 -1
- package/dist/production/src/model/service/IDPSignInManager.js +29 -2
- package/dist/production/src/model/service/IDPSignInManager.js.map +1 -1
- package/dist/production/src/model/service/PanelAccessResolver.cjs +31 -0
- package/dist/production/src/model/service/PanelAccessResolver.cjs.map +1 -0
- package/dist/production/src/model/service/PanelAccessResolver.js +31 -0
- package/dist/production/src/model/service/PanelAccessResolver.js.map +1 -0
- package/dist/production/src/model/service/PasswordResetManager.cjs +5 -0
- package/dist/production/src/model/service/PasswordResetManager.cjs.map +1 -1
- package/dist/production/src/model/service/PasswordResetManager.js +5 -0
- package/dist/production/src/model/service/PasswordResetManager.js.map +1 -1
- package/dist/production/src/model/service/PasswordlessSignInManager.cjs +19 -0
- package/dist/production/src/model/service/PasswordlessSignInManager.cjs.map +1 -1
- package/dist/production/src/model/service/PasswordlessSignInManager.js +19 -0
- 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/SignInManager.cjs +5 -0
- package/dist/production/src/model/service/SignInManager.cjs.map +1 -1
- package/dist/production/src/model/service/SignInManager.js +5 -0
- package/dist/production/src/model/service/SignInManager.js.map +1 -1
- package/dist/production/src/model/service/apiKey/ApiKeyManager.cjs +4 -3
- package/dist/production/src/model/service/apiKey/ApiKeyManager.cjs.map +1 -1
- package/dist/production/src/model/service/apiKey/ApiKeyManager.js +4 -3
- package/dist/production/src/model/service/apiKey/ApiKeyManager.js.map +1 -1
- package/dist/production/src/model/service/apiKey/UnpersistedApiKeyManager.cjs +7 -0
- package/dist/production/src/model/service/apiKey/UnpersistedApiKeyManager.cjs.map +1 -1
- package/dist/production/src/model/service/apiKey/UnpersistedApiKeyManager.js +8 -1
- 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 +260 -0
- package/dist/production/src/model/service/idp/IDPClaimSyncService.cjs.map +1 -0
- package/dist/production/src/model/service/idp/IDPClaimSyncService.js +260 -0
- package/dist/production/src/model/service/idp/IDPClaimSyncService.js.map +1 -0
- package/dist/production/src/model/service/idp/IDPManager.cjs +96 -20
- package/dist/production/src/model/service/idp/IDPManager.cjs.map +1 -1
- package/dist/production/src/model/service/idp/IDPManager.js +96 -20
- package/dist/production/src/model/service/idp/IDPManager.js.map +1 -1
- package/dist/production/src/model/service/idp/IdpSessionRevalidator.cjs +55 -1
- package/dist/production/src/model/service/idp/IdpSessionRevalidator.cjs.map +1 -1
- package/dist/production/src/model/service/idp/IdpSessionRevalidator.js +55 -1
- package/dist/production/src/model/service/idp/IdpSessionRevalidator.js.map +1 -1
- package/dist/production/src/model/service/idp/PersonIdentityProviderManager.cjs +6 -0
- package/dist/production/src/model/service/idp/PersonIdentityProviderManager.cjs.map +1 -1
- package/dist/production/src/model/service/idp/PersonIdentityProviderManager.js +6 -0
- 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 +7 -2
- package/dist/production/src/model/utils/DatabaseContext.cjs.map +1 -1
- package/dist/production/src/model/utils/DatabaseContext.js +8 -3
- package/dist/production/src/model/utils/DatabaseContext.js.map +1 -1
- package/dist/production/src/resolvers/ResolverFactory.cjs +6 -2
- package/dist/production/src/resolvers/ResolverFactory.cjs.map +1 -1
- package/dist/production/src/resolvers/ResolverFactory.js +6 -2
- package/dist/production/src/resolvers/ResolverFactory.js.map +1 -1
- package/dist/production/src/resolvers/mutation/apiKey/CreateApiKeyMutationResolver.cjs +2 -1
- package/dist/production/src/resolvers/mutation/apiKey/CreateApiKeyMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/apiKey/CreateApiKeyMutationResolver.js +2 -1
- package/dist/production/src/resolvers/mutation/apiKey/CreateApiKeyMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/apiKey/DisableApiKeyMutationResolver.cjs +2 -1
- package/dist/production/src/resolvers/mutation/apiKey/DisableApiKeyMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/apiKey/DisableApiKeyMutationResolver.js +2 -1
- package/dist/production/src/resolvers/mutation/apiKey/DisableApiKeyMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/configuration/AuthPolicyMutationResolver.cjs +2 -1
- package/dist/production/src/resolvers/mutation/configuration/AuthPolicyMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/configuration/AuthPolicyMutationResolver.js +2 -1
- package/dist/production/src/resolvers/mutation/configuration/AuthPolicyMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/configuration/ConfigurationMutationResolver.cjs +2 -1
- package/dist/production/src/resolvers/mutation/configuration/ConfigurationMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/configuration/ConfigurationMutationResolver.js +2 -1
- package/dist/production/src/resolvers/mutation/configuration/ConfigurationMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/identity/GlobalRolesMutationResolver.cjs +2 -1
- package/dist/production/src/resolvers/mutation/identity/GlobalRolesMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/identity/GlobalRolesMutationResolver.js +2 -1
- package/dist/production/src/resolvers/mutation/identity/GlobalRolesMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/idp/AddIDPMutationResolver.cjs +4 -2
- package/dist/production/src/resolvers/mutation/idp/AddIDPMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/idp/AddIDPMutationResolver.js +4 -2
- package/dist/production/src/resolvers/mutation/idp/AddIDPMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/idp/DisableIDPMutationResolver.cjs +2 -1
- package/dist/production/src/resolvers/mutation/idp/DisableIDPMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/idp/DisableIDPMutationResolver.js +2 -1
- package/dist/production/src/resolvers/mutation/idp/DisableIDPMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/idp/DisconnectMyIdentityProviderMutationResolver.cjs +2 -1
- package/dist/production/src/resolvers/mutation/idp/DisconnectMyIdentityProviderMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/idp/DisconnectMyIdentityProviderMutationResolver.js +2 -1
- package/dist/production/src/resolvers/mutation/idp/DisconnectMyIdentityProviderMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/idp/EnableIDPMutationResolver.cjs +2 -1
- package/dist/production/src/resolvers/mutation/idp/EnableIDPMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/idp/EnableIDPMutationResolver.js +2 -1
- package/dist/production/src/resolvers/mutation/idp/EnableIDPMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/idp/UpdateIDPMutationResolver.cjs +4 -2
- package/dist/production/src/resolvers/mutation/idp/UpdateIDPMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/idp/UpdateIDPMutationResolver.js +4 -2
- 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 +2 -1
- package/dist/production/src/resolvers/mutation/mailTemplates/MailTemplateMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/mailTemplates/MailTemplateMutationResolver.js +2 -1
- package/dist/production/src/resolvers/mutation/mailTemplates/MailTemplateMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/person/ChangePasswordMutationResolver.cjs +2 -1
- package/dist/production/src/resolvers/mutation/person/ChangePasswordMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/person/ChangePasswordMutationResolver.js +2 -1
- package/dist/production/src/resolvers/mutation/person/ChangePasswordMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/person/ChangeProfileMutationResolver.cjs +2 -1
- package/dist/production/src/resolvers/mutation/person/ChangeProfileMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/person/ChangeProfileMutationResolver.js +2 -1
- package/dist/production/src/resolvers/mutation/person/ChangeProfileMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/person/DisablePersonMutationResolver.cjs +4 -3
- package/dist/production/src/resolvers/mutation/person/DisablePersonMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/person/DisablePersonMutationResolver.js +4 -3
- package/dist/production/src/resolvers/mutation/person/DisablePersonMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/person/EmailOtpMutationResolver.cjs +2 -1
- package/dist/production/src/resolvers/mutation/person/EmailOtpMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/person/EmailOtpMutationResolver.js +2 -1
- package/dist/production/src/resolvers/mutation/person/EmailOtpMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/person/EmailVerificationMutationResolver.cjs +2 -1
- package/dist/production/src/resolvers/mutation/person/EmailVerificationMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/person/EmailVerificationMutationResolver.js +2 -1
- package/dist/production/src/resolvers/mutation/person/EmailVerificationMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/person/EnablePersonMutationResolver.cjs +60 -0
- package/dist/production/src/resolvers/mutation/person/EnablePersonMutationResolver.cjs.map +1 -0
- package/dist/production/src/resolvers/mutation/person/EnablePersonMutationResolver.js +60 -0
- package/dist/production/src/resolvers/mutation/person/EnablePersonMutationResolver.js.map +1 -0
- package/dist/production/src/resolvers/mutation/person/ForceSignOutMutationResolver.cjs +2 -1
- package/dist/production/src/resolvers/mutation/person/ForceSignOutMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/person/ForceSignOutMutationResolver.js +2 -1
- package/dist/production/src/resolvers/mutation/person/ForceSignOutMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/person/IDPMutationResolver.cjs +27 -1
- package/dist/production/src/resolvers/mutation/person/IDPMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/person/IDPMutationResolver.js +27 -1
- package/dist/production/src/resolvers/mutation/person/IDPMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/person/InviteMutationResolver.cjs +2 -1
- package/dist/production/src/resolvers/mutation/person/InviteMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/person/InviteMutationResolver.js +2 -1
- package/dist/production/src/resolvers/mutation/person/InviteMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/person/OtpMutationResolver.cjs +2 -1
- package/dist/production/src/resolvers/mutation/person/OtpMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/person/OtpMutationResolver.js +2 -1
- package/dist/production/src/resolvers/mutation/person/OtpMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/person/PasswordlessMutationResolver.cjs +6 -1
- package/dist/production/src/resolvers/mutation/person/PasswordlessMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/person/PasswordlessMutationResolver.js +6 -1
- package/dist/production/src/resolvers/mutation/person/PasswordlessMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/person/RegenerateBackupCodesMutationResolver.cjs +2 -1
- package/dist/production/src/resolvers/mutation/person/RegenerateBackupCodesMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/person/RegenerateBackupCodesMutationResolver.js +2 -1
- package/dist/production/src/resolvers/mutation/person/RegenerateBackupCodesMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/person/ResetPasswordMutationResolver.cjs +2 -1
- package/dist/production/src/resolvers/mutation/person/ResetPasswordMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/person/ResetPasswordMutationResolver.js +2 -1
- package/dist/production/src/resolvers/mutation/person/ResetPasswordMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/person/ResetPersonMfaMutationResolver.cjs +2 -1
- package/dist/production/src/resolvers/mutation/person/ResetPersonMfaMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/person/ResetPersonMfaMutationResolver.js +2 -1
- package/dist/production/src/resolvers/mutation/person/ResetPersonMfaMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/person/RevokeSessionMutationResolver.cjs +2 -1
- package/dist/production/src/resolvers/mutation/person/RevokeSessionMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/person/RevokeSessionMutationResolver.js +2 -1
- package/dist/production/src/resolvers/mutation/person/RevokeSessionMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/person/SignInMutationResolver.cjs +4 -3
- package/dist/production/src/resolvers/mutation/person/SignInMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/person/SignInMutationResolver.js +4 -3
- package/dist/production/src/resolvers/mutation/person/SignInMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/person/SignOutMutationResolver.cjs +2 -1
- package/dist/production/src/resolvers/mutation/person/SignOutMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/person/SignOutMutationResolver.js +2 -1
- package/dist/production/src/resolvers/mutation/person/SignOutMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/person/SignUpMutationResolver.cjs +2 -1
- package/dist/production/src/resolvers/mutation/person/SignUpMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/person/SignUpMutationResolver.js +2 -1
- package/dist/production/src/resolvers/mutation/person/SignUpMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/person/TogglePasswordlessMutationResolver.cjs +2 -1
- package/dist/production/src/resolvers/mutation/person/TogglePasswordlessMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/person/TogglePasswordlessMutationResolver.js +2 -1
- package/dist/production/src/resolvers/mutation/person/TogglePasswordlessMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/project/CreateProjectMutationResolver.cjs +2 -1
- package/dist/production/src/resolvers/mutation/project/CreateProjectMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/project/CreateProjectMutationResolver.js +2 -1
- package/dist/production/src/resolvers/mutation/project/CreateProjectMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/project/SetProjectSecretMutationResolver.cjs +2 -1
- package/dist/production/src/resolvers/mutation/project/SetProjectSecretMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/project/SetProjectSecretMutationResolver.js +2 -1
- package/dist/production/src/resolvers/mutation/project/SetProjectSecretMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/project/UpdateProjectMutationResolver.cjs +2 -1
- package/dist/production/src/resolvers/mutation/project/UpdateProjectMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/project/UpdateProjectMutationResolver.js +2 -1
- package/dist/production/src/resolvers/mutation/project/UpdateProjectMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/projectMember/AddProjectMemberMutationResolver.cjs +2 -1
- package/dist/production/src/resolvers/mutation/projectMember/AddProjectMemberMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/projectMember/AddProjectMemberMutationResolver.js +2 -1
- package/dist/production/src/resolvers/mutation/projectMember/AddProjectMemberMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/projectMember/RemoveProjectMemberMutationResolver.cjs +2 -1
- package/dist/production/src/resolvers/mutation/projectMember/RemoveProjectMemberMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/projectMember/RemoveProjectMemberMutationResolver.js +2 -1
- package/dist/production/src/resolvers/mutation/projectMember/RemoveProjectMemberMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/projectMember/UpdateProjectMemberMutationResolver.cjs +2 -1
- package/dist/production/src/resolvers/mutation/projectMember/UpdateProjectMemberMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/projectMember/UpdateProjectMemberMutationResolver.js +2 -1
- package/dist/production/src/resolvers/mutation/projectMember/UpdateProjectMemberMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/query/ApiKeyQueryResolver.cjs +2 -1
- package/dist/production/src/resolvers/query/ApiKeyQueryResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/query/ApiKeyQueryResolver.js +2 -1
- package/dist/production/src/resolvers/query/ApiKeyQueryResolver.js.map +1 -1
- package/dist/production/src/resolvers/query/AuthLogQueryResolver.cjs +2 -1
- package/dist/production/src/resolvers/query/AuthLogQueryResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/query/AuthLogQueryResolver.js +2 -1
- package/dist/production/src/resolvers/query/AuthLogQueryResolver.js.map +1 -1
- package/dist/production/src/resolvers/query/AuthPolicyQueryResolver.cjs +2 -1
- package/dist/production/src/resolvers/query/AuthPolicyQueryResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/query/AuthPolicyQueryResolver.js +2 -1
- package/dist/production/src/resolvers/query/AuthPolicyQueryResolver.js.map +1 -1
- package/dist/production/src/resolvers/query/ConfigurationQueryResolver.cjs +2 -1
- package/dist/production/src/resolvers/query/ConfigurationQueryResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/query/ConfigurationQueryResolver.js +2 -1
- package/dist/production/src/resolvers/query/ConfigurationQueryResolver.js.map +1 -1
- package/dist/production/src/resolvers/query/IDPQueryResolver.cjs +2 -1
- package/dist/production/src/resolvers/query/IDPQueryResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/query/IDPQueryResolver.js +2 -1
- package/dist/production/src/resolvers/query/IDPQueryResolver.js.map +1 -1
- package/dist/production/src/resolvers/query/MailTemplateQueryResolver.cjs +2 -1
- package/dist/production/src/resolvers/query/MailTemplateQueryResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/query/MailTemplateQueryResolver.js +2 -1
- package/dist/production/src/resolvers/query/MailTemplateQueryResolver.js.map +1 -1
- package/dist/production/src/resolvers/query/PersonQueryResolver.cjs +2 -1
- package/dist/production/src/resolvers/query/PersonQueryResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/query/PersonQueryResolver.js +2 -1
- package/dist/production/src/resolvers/query/PersonQueryResolver.js.map +1 -1
- package/dist/production/src/resolvers/query/ProjectMembersQueryResolver.cjs +2 -1
- package/dist/production/src/resolvers/query/ProjectMembersQueryResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/query/ProjectMembersQueryResolver.js +2 -1
- package/dist/production/src/resolvers/query/ProjectMembersQueryResolver.js.map +1 -1
- package/dist/production/src/resolvers/query/ProjectQueryResolver.cjs +5 -3
- package/dist/production/src/resolvers/query/ProjectQueryResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/query/ProjectQueryResolver.js +5 -3
- package/dist/production/src/resolvers/query/ProjectQueryResolver.js.map +1 -1
- package/dist/production/src/resolvers/responseHelpers/ApiKeyResponseFactory.cjs +2 -1
- package/dist/production/src/resolvers/responseHelpers/ApiKeyResponseFactory.cjs.map +1 -1
- package/dist/production/src/resolvers/responseHelpers/ApiKeyResponseFactory.js +2 -1
- 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 +2 -1
- package/dist/production/src/resolvers/responseHelpers/SignInResponseFactory.cjs.map +1 -1
- package/dist/production/src/resolvers/responseHelpers/SignInResponseFactory.js +2 -1
- package/dist/production/src/resolvers/responseHelpers/SignInResponseFactory.js.map +1 -1
- package/dist/production/src/resolvers/types/IdentityTypeResolver.cjs +37 -4
- package/dist/production/src/resolvers/types/IdentityTypeResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/types/IdentityTypeResolver.js +37 -4
- package/dist/production/src/resolvers/types/IdentityTypeResolver.js.map +1 -1
- package/dist/production/src/resolvers/types/PersonTypeResolver.cjs +30 -1
- package/dist/production/src/resolvers/types/PersonTypeResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/types/PersonTypeResolver.js +30 -1
- package/dist/production/src/resolvers/types/PersonTypeResolver.js.map +1 -1
- package/dist/production/src/resolvers/types/ProjectTypeResolver.cjs +25 -1
- package/dist/production/src/resolvers/types/ProjectTypeResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/types/ProjectTypeResolver.js +25 -1
- package/dist/production/src/resolvers/types/ProjectTypeResolver.js.map +1 -1
- package/dist/production/src/schema/tenant.graphql.cjs +144 -0
- package/dist/production/src/schema/tenant.graphql.cjs.map +1 -1
- package/dist/production/src/schema/tenant.graphql.js +144 -0
- package/dist/production/src/schema/tenant.graphql.js.map +1 -1
- 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/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/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/getIdentityByIdSql.d.ts.map +1 -1
- 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.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.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.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/databaseContextRetry.test.d.ts +2 -0
- package/dist/tests/cases/unit/databaseContextRetry.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/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 +7 -1
- 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 +21 -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/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/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.map +1 -1
- package/dist/types/model/authorization/PermissionContext.d.ts.map +1 -1
- 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/commands/CommandBus.d.ts.map +1 -1
- package/dist/types/model/commands/apiKey/ApiKeyHelper.d.ts.map +1 -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 +1 -1
- package/dist/types/model/commands/apiKey/ProlongApiKeyCommand.d.ts.map +1 -1
- 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/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/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.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.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.map +1 -1
- 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.map +1 -1
- 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/identity/IdentityQuery.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/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/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/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 +1 -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.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/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/HibpChecker.d.ts.map +1 -1
- package/dist/types/model/service/IDPSignInManager.d.ts +11 -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.map +1 -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.map +1 -1
- package/dist/types/model/service/apiKey/ApiKeyManager.d.ts.map +1 -1
- 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 +13 -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 +1 -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/IdentityProvider.d.ts +2 -0
- package/dist/types/model/type/IdentityProvider.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/utils/DatabaseContext.d.ts +14 -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.map +1 -1
- package/dist/types/resolvers/ResolverFactory.d.ts +2 -0
- package/dist/types/resolvers/ResolverFactory.d.ts.map +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/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.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/IDPQueryResolver.d.ts.map +1 -1
- 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 +194 -4
- 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/src/TenantContainer.ts +17 -3
- 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/runner.ts +8 -0
- package/src/migrations/snapshot.ts +8 -2
- package/src/model/commands/configuration/UpdateConfigurationCommand.ts +5 -4
- package/src/model/commands/idp/CreateIdpCommand.ts +7 -1
- package/src/model/commands/idp/UpdateIdpCommand.ts +5 -1
- 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/EnablePersonCommand.ts +18 -0
- package/src/model/queries/configuration/ConfigurationQuery.ts +4 -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/membership/ProjectMembersQuery.ts +1 -0
- package/src/model/queries/person/PersonQueryBuilderFactory.ts +1 -0
- package/src/model/queries/person/types.ts +1 -0
- package/src/model/service/AuthLogService.ts +18 -2
- package/src/model/service/IDPSignInManager.ts +49 -1
- package/src/model/service/PanelAccessResolver.ts +32 -0
- package/src/model/service/PasswordResetManager.ts +9 -1
- package/src/model/service/PasswordlessSignInManager.ts +23 -1
- package/src/model/service/PersonAccessManager.ts +19 -3
- package/src/model/service/SignInManager.ts +9 -1
- package/src/model/service/apiKey/ApiKeyManager.ts +5 -3
- 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 +90 -0
- 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 +1 -0
- package/src/model/type/AuthLog.ts +3 -0
- package/src/model/type/Config.ts +3 -0
- package/src/model/type/IdentityProvider.ts +2 -0
- package/src/model/utils/DatabaseContext.ts +27 -6
- package/src/resolvers/ResolverFactory.ts +6 -0
- 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/person/DisablePersonMutationResolver.ts +3 -3
- package/src/resolvers/mutation/person/EnablePersonMutationResolver.ts +50 -0
- package/src/resolvers/mutation/person/IDPMutationResolver.ts +31 -0
- package/src/resolvers/mutation/person/PasswordlessMutationResolver.ts +7 -0
- package/src/resolvers/mutation/person/SignInMutationResolver.ts +2 -2
- 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/types/IdentityTypeResolver.ts +39 -3
- package/src/resolvers/types/PersonTypeResolver.ts +35 -2
- package/src/resolvers/types/ProjectTypeResolver.ts +33 -1
- package/src/schema/index.ts +212 -0
- package/src/schema/tenant.graphql.ts +144 -0
- package/tests/cases/integration/mocked/configurationPanel.test.ts +105 -0
- package/tests/cases/integration/mocked/disablePersonMutation.test.ts +89 -0
- package/tests/cases/integration/mocked/enablePersonMutation.test.ts +130 -0
- 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/permissionsQuery.test.ts +153 -0
- 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/signInAnomalyDetection.test.ts +11 -0
- 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 +5 -0
- package/tests/cases/integration/mocked/signInMfaEnforcement.test.ts +7 -0
- package/tests/cases/integration/mocked/signInMutation.test.ts +14 -0
- package/tests/cases/integration/mocked/signInPasswordlessMutation.test.ts +36 -0
- package/tests/cases/integration/mocked/sql/getConfigSql.ts +3 -0
- package/tests/cases/integration/mocked/sql/getIdpBySlugSql.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/localAuthDisablingIdpsSql.ts +21 -0
- package/tests/cases/integration/mocked/sql/personIdentityProvidersSql.ts +3 -1
- package/tests/cases/integration/mocked/sql/removeMembershipSql.ts +14 -0
- package/tests/cases/integration/mocked/trustForwardedClientInfo.test.ts +3 -0
- package/tests/cases/unit/databaseContextRetry.test.ts +81 -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 +226 -24
- 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/panelAccessResolver.test.ts +57 -0
- package/tests/cases/unit/updateConfigurationCommand.test.ts +63 -0
- package/tests/src/IdPMock.ts +4 -0
- package/tests/src/testTenant.ts +32 -1
- 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
|
@@ -12,18 +12,22 @@ import "@contember/schema";
|
|
|
12
12
|
import { CreateIdpCommand } from "../../commands/idp/CreateIdpCommand.js";
|
|
13
13
|
import { IdentityProviderNotFoundError } from "./IdentityProviderNotFoundError.js";
|
|
14
14
|
import { InvalidIDPConfigurationError } from "./InvalidIDPConfigurationError.js";
|
|
15
|
+
import { findRemovedRuleKeys, parseClaimMapping, findClaimMappingShapeErrors, isRecord } from "./ClaimMapping.js";
|
|
16
|
+
import { validateClaimMappingMembership } from "./ClaimMappingValidation.js";
|
|
15
17
|
import { DisableIdpCommand } from "../../commands/idp/DisableIdpCommand.js";
|
|
16
18
|
import { EnableIdpCommand } from "../../commands/idp/EnableIdpCommand.js";
|
|
17
19
|
import { UpdateIdpCommand } from "../../commands/idp/UpdateIdpCommand.js";
|
|
18
20
|
class IDPManager {
|
|
19
|
-
constructor(idpRegistry) {
|
|
21
|
+
constructor(idpRegistry, projectSchemaResolver) {
|
|
20
22
|
this.idpRegistry = idpRegistry;
|
|
23
|
+
this.projectSchemaResolver = projectSchemaResolver;
|
|
21
24
|
}
|
|
22
25
|
async addIDP(db, idp) {
|
|
23
26
|
return await db.transaction(async (db2) => {
|
|
24
27
|
try {
|
|
25
28
|
const providerService = this.idpRegistry.getHandler(idp.type);
|
|
26
|
-
providerService.validateConfiguration(idp.configuration);
|
|
29
|
+
this.assertNoUnknownConfigurationKeys(providerService.validateConfiguration(idp.configuration), idp.configuration);
|
|
30
|
+
await this.assertValidClaimMapping(idp.configuration);
|
|
27
31
|
} catch (e) {
|
|
28
32
|
if (e instanceof IdentityProviderNotFoundError) {
|
|
29
33
|
return new ResponseError("UNKNOWN_TYPE", `IDP type ${idp.type} not found`);
|
|
@@ -71,28 +75,13 @@ class IDPManager {
|
|
|
71
75
|
if (!existing) {
|
|
72
76
|
return new ResponseError("NOT_FOUND", `IDP ${slug} not found`);
|
|
73
77
|
}
|
|
74
|
-
const newConfiguration = (
|
|
75
|
-
if (!data.configuration) {
|
|
76
|
-
return existing.configuration;
|
|
77
|
-
}
|
|
78
|
-
if (!mergeConfiguration) {
|
|
79
|
-
return data.configuration;
|
|
80
|
-
}
|
|
81
|
-
const newConfiguration2 = { ...existing.configuration };
|
|
82
|
-
for (const [key, value] of Object.entries(data.configuration)) {
|
|
83
|
-
if (value === null) {
|
|
84
|
-
delete newConfiguration2[key];
|
|
85
|
-
} else {
|
|
86
|
-
newConfiguration2[key] = value;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return newConfiguration2;
|
|
90
|
-
})();
|
|
78
|
+
const newConfiguration = !data.configuration ? existing.configuration : mergeConfiguration ? deepMergeConfiguration(existing.configuration, data.configuration) : data.configuration;
|
|
91
79
|
try {
|
|
92
80
|
const type = data.type ?? existing.type;
|
|
93
81
|
const providerService = this.idpRegistry.getHandler(type);
|
|
94
82
|
if (data.configuration !== void 0 || type !== existing.type) {
|
|
95
|
-
providerService.validateConfiguration(newConfiguration);
|
|
83
|
+
this.assertNoUnknownConfigurationKeys(providerService.validateConfiguration(newConfiguration), newConfiguration);
|
|
84
|
+
await this.assertValidClaimMapping(newConfiguration);
|
|
96
85
|
}
|
|
97
86
|
} catch (e) {
|
|
98
87
|
if (e instanceof InvalidIDPConfigurationError) {
|
|
@@ -109,6 +98,76 @@ class IDPManager {
|
|
|
109
98
|
return new ResponseOk(null);
|
|
110
99
|
});
|
|
111
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* Reject top-level `configuration` keys the provider does not recognise.
|
|
103
|
+
*
|
|
104
|
+
* Every provider configuration is parsed with `Typesafe.partial`, which silently DROPS unknown
|
|
105
|
+
* properties. Without this check `addIDP` / `updateIDP` answer `ok` to a configuration the
|
|
106
|
+
* provider will never act on — a typo like `fetchUserinfo` (lowercase i) reads as a successfully
|
|
107
|
+
* applied setting while the option stays off, and an option that a given engine version does not
|
|
108
|
+
* support yet looks indistinguishable from one that works.
|
|
109
|
+
*
|
|
110
|
+
* The parsed result carries exactly the keys the provider understood, so the difference against
|
|
111
|
+
* the submitted object is the set of ignored keys. All of them are reported at once (rather than
|
|
112
|
+
* the first, as `Typesafe.noExtraProps` would) so a configuration with several typos takes one
|
|
113
|
+
* round trip to fix, matching {@link findRemovedRuleKeys}.
|
|
114
|
+
*
|
|
115
|
+
* Only the top level is checked: nested shapes that need strictness validate themselves
|
|
116
|
+
* (`claimMapping` via {@link parseClaimMapping}). Reading a stored configuration is deliberately
|
|
117
|
+
* left untouched — this runs at write time only, so a row written before this check keeps
|
|
118
|
+
* authenticating instead of locking its users out.
|
|
119
|
+
*/
|
|
120
|
+
assertNoUnknownConfigurationKeys(parsed, submitted) {
|
|
121
|
+
const known = new Set(Object.keys(parsed));
|
|
122
|
+
const unknown = Object.keys(submitted).filter((key) => !known.has(key));
|
|
123
|
+
if (unknown.length > 0) {
|
|
124
|
+
throw new InvalidIDPConfigurationError(
|
|
125
|
+
`unknown configuration ${unknown.length === 1 ? "property" : "properties"} ${unknown.join(", ")}; remove ${unknown.length === 1 ? "it" : "them"} or check the spelling — the provider would ignore ${unknown.length === 1 ? "it" : "them"}`
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Validate the optional A09 `claimMapping` embedded in an IdP `configuration`: reject a removed
|
|
131
|
+
* `grantRoles` (global-role mapping was dropped — see {@link parseClaimMapping}), reject a
|
|
132
|
+
* malformed shape, and validate each granted membership's role against the target project's ACL
|
|
133
|
+
* schema (mirroring the direct add-member path). Throws {@link InvalidIDPConfigurationError},
|
|
134
|
+
* surfaced as `INVALID_CONFIGURATION`.
|
|
135
|
+
*/
|
|
136
|
+
async assertValidClaimMapping(configuration) {
|
|
137
|
+
const removed = findRemovedRuleKeys(configuration);
|
|
138
|
+
if (removed.length > 0) {
|
|
139
|
+
throw new InvalidIDPConfigurationError(
|
|
140
|
+
`claimMapping no longer supports ${removed.join(", ")} (global-role mapping was removed); grant a project membership via grantMembership instead`
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
let mapping;
|
|
144
|
+
try {
|
|
145
|
+
mapping = parseClaimMapping(configuration);
|
|
146
|
+
} catch (e) {
|
|
147
|
+
throw new InvalidIDPConfigurationError(`Invalid claimMapping: ${e instanceof Error ? e.message : String(e)}`);
|
|
148
|
+
}
|
|
149
|
+
if (!mapping) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
const shapeErrors = findClaimMappingShapeErrors(mapping);
|
|
153
|
+
if (shapeErrors.length > 0) {
|
|
154
|
+
throw new InvalidIDPConfigurationError(shapeErrors[0]);
|
|
155
|
+
}
|
|
156
|
+
for (const rule of mapping.rules) {
|
|
157
|
+
const membership = rule.grantMembership;
|
|
158
|
+
if (!membership) {
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
161
|
+
const schema = await this.projectSchemaResolver.getSchema(membership.project);
|
|
162
|
+
if (!schema) {
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
const errors = validateClaimMappingMembership(schema.acl, membership);
|
|
166
|
+
if (errors.length > 0) {
|
|
167
|
+
throw new InvalidIDPConfigurationError(errors[0].message);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
112
171
|
async listIDP(db) {
|
|
113
172
|
const result = await db.queryHandler.fetch(new IdentityProvidersQuery());
|
|
114
173
|
return result.map((it) => {
|
|
@@ -118,6 +177,23 @@ class IDPManager {
|
|
|
118
177
|
});
|
|
119
178
|
}
|
|
120
179
|
}
|
|
180
|
+
const deepMergeConfiguration = (base, updates) => {
|
|
181
|
+
const result = { ...base };
|
|
182
|
+
for (const [key, value] of Object.entries(updates)) {
|
|
183
|
+
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
if (value === null) {
|
|
187
|
+
delete result[key];
|
|
188
|
+
} else if (isRecord(value)) {
|
|
189
|
+
const existingChild = result[key];
|
|
190
|
+
result[key] = deepMergeConfiguration(isRecord(existingChild) ? existingChild : {}, value);
|
|
191
|
+
} else {
|
|
192
|
+
result[key] = value;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return result;
|
|
196
|
+
};
|
|
121
197
|
export {
|
|
122
198
|
IDPManager
|
|
123
199
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IDPManager.js","sources":["../../../../../../../packages/engine-tenant-api/src/model/service/idp/IDPManager.ts"],"sourcesContent":["import { Response, ResponseError, ResponseOk } from '../../utils/Response.js'\nimport { AddIdpErrorCode, DisableIdpErrorCode, EnableIdpErrorCode, UpdateIdpErrorCode } from '../../../schema/index.js'\nimport { DatabaseContext } from '../../utils/index.js'\nimport { IdentityProviderData } from '../../type/index.js'\nimport { IdentityProviderBySlugQuery, IdentityProvidersQuery } from '../../queries/index.js'\nimport { CreateIdpCommand } from '../../commands/idp/CreateIdpCommand.js'\nimport { IDPHandlerRegistry } from './IDPHandlerRegistry.js'\nimport { IdentityProviderNotFoundError } from './IdentityProviderNotFoundError.js'\nimport { InvalidIDPConfigurationError } from './InvalidIDPConfigurationError.js'\nimport { DisableIdpCommand } from '../../commands/idp/DisableIdpCommand.js'\nimport { EnableIdpCommand } from '../../commands/idp/EnableIdpCommand.js'\nimport { UpdateIdpCommand, UpdateIdpData } from '../../commands/idp/UpdateIdpCommand.js'\nimport { IdentityProviderDto } from '../../queries/idp/types.js'\n\nexport class IDPManager {\n\tconstructor(\n\t\tprivate readonly idpRegistry: IDPHandlerRegistry,\n\t) {\n\t}\n\n\tpublic async addIDP(db: DatabaseContext, idp: IdentityProviderData): Promise<RegisterIDPResponse> {\n\t\treturn await db.transaction(async (db): Promise<RegisterIDPResponse> => {\n\t\t\ttry {\n\t\t\t\tconst providerService = this.idpRegistry.getHandler(idp.type)\n\t\t\t\tproviderService.validateConfiguration(idp.configuration)\n\t\t\t} catch (e) {\n\t\t\t\tif (e instanceof IdentityProviderNotFoundError) {\n\t\t\t\t\treturn new ResponseError('UNKNOWN_TYPE', `IDP type ${idp.type} not found`)\n\t\t\t\t}\n\t\t\t\tif (e instanceof InvalidIDPConfigurationError) {\n\t\t\t\t\treturn new ResponseError('INVALID_CONFIGURATION', `Invalid IDP configuration: ${e.message}`)\n\t\t\t\t}\n\t\t\t\tthrow e\n\t\t\t}\n\n\t\t\tconst existing = await db.queryHandler.fetch(new IdentityProviderBySlugQuery(idp.slug))\n\t\t\tif (existing) {\n\t\t\t\treturn new ResponseError('ALREADY_EXISTS', `IDP with slug ${idp.slug} already exists`)\n\t\t\t}\n\t\t\tawait db.commandBus.execute(new CreateIdpCommand(idp))\n\t\t\treturn new ResponseOk(null)\n\t\t})\n\t}\n\n\tpublic async disableIDP(db: DatabaseContext, slug: string): Promise<DisableIDPResponse> {\n\t\treturn await db.transaction(async db => {\n\t\t\tconst existing = await db.queryHandler.fetch(new IdentityProviderBySlugQuery(slug))\n\t\t\tif (!existing) {\n\t\t\t\treturn new ResponseError('NOT_FOUND', `IDP ${slug} not found`)\n\t\t\t}\n\t\t\tif (!existing.disabledAt) {\n\t\t\t\tawait db.commandBus.execute(new DisableIdpCommand(existing.id))\n\t\t\t}\n\t\t\treturn new ResponseOk(null)\n\t\t})\n\t}\n\n\tpublic async enableIDP(db: DatabaseContext, slug: string): Promise<EnableIDPResponse> {\n\t\treturn await db.transaction(async db => {\n\t\t\tconst existing = await db.queryHandler.fetch(new IdentityProviderBySlugQuery(slug))\n\t\t\tif (!existing) {\n\t\t\t\treturn new ResponseError('NOT_FOUND', `IDP ${slug} not found`)\n\t\t\t}\n\t\t\tif (existing.disabledAt) {\n\t\t\t\tawait db.commandBus.execute(new EnableIdpCommand(existing.id))\n\t\t\t}\n\t\t\treturn new ResponseOk(null)\n\t\t})\n\t}\n\n\tpublic async updateIDP(db: DatabaseContext, slug: string, data: UpdateIdpData, mergeConfiguration: boolean): Promise<UpdateIDPResponse> {\n\t\treturn await db.transaction(async db => {\n\t\t\tconst existing = await db.queryHandler.fetch(new IdentityProviderBySlugQuery(slug))\n\t\t\tif (!existing) {\n\t\t\t\treturn new ResponseError('NOT_FOUND', `IDP ${slug} not found`)\n\t\t\t}\n\n\t\t\tconst newConfiguration = (() => {\n\t\t\t\tif (!data.configuration) {\n\t\t\t\t\treturn existing.configuration\n\t\t\t\t}\n\t\t\t\tif (!mergeConfiguration) {\n\t\t\t\t\treturn data.configuration\n\t\t\t\t}\n\n\t\t\t\tconst newConfiguration = { ...existing.configuration }\n\t\t\t\tfor (const [key, value] of Object.entries(data.configuration)) {\n\t\t\t\t\tif (value === null) {\n\t\t\t\t\t\tdelete newConfiguration[key]\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnewConfiguration[key] = value\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn newConfiguration\n\t\t\t})()\n\n\t\t\ttry {\n\t\t\t\tconst type = data.type ?? existing.type\n\t\t\t\tconst providerService = this.idpRegistry.getHandler(type)\n\t\t\t\tif (data.configuration !== undefined || type !== existing.type) {\n\t\t\t\t\tproviderService.validateConfiguration(newConfiguration)\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\tif (e instanceof InvalidIDPConfigurationError) {\n\t\t\t\t\treturn new ResponseError('INVALID_CONFIGURATION', `Invalid IDP configuration: ${e.message}`)\n\t\t\t\t}\n\t\t\t\tthrow e\n\t\t\t}\n\n\t\t\tawait db.commandBus.execute(\n\t\t\t\tnew UpdateIdpCommand(existing.id, {\n\t\t\t\t\t...data,\n\t\t\t\t\tconfiguration: data.configuration ? newConfiguration : undefined,\n\t\t\t\t}),\n\t\t\t)\n\n\t\t\treturn new ResponseOk(null)\n\t\t})\n\t}\n\n\tpublic async listIDP(db: DatabaseContext): Promise<IdentityProviderDto[]> {\n\t\tconst result = await db.queryHandler.fetch(new IdentityProvidersQuery())\n\t\treturn result.map(it => {\n\t\t\tconst providerService = this.idpRegistry.getHandlerOrNull(it.type)\n\t\t\tconst configuration = providerService?.getPublicConfiguration\n\t\t\t\t? providerService.getPublicConfiguration(it.configuration)\n\t\t\t\t: it.configuration\n\n\t\t\treturn { ...it, configuration }\n\t\t})\n\t}\n}\n\nexport type RegisterIDPResponse = Response<null, AddIdpErrorCode>\nexport type DisableIDPResponse = Response<null, DisableIdpErrorCode>\nexport type EnableIDPResponse = Response<null, EnableIdpErrorCode>\nexport type UpdateIDPResponse = Response<null, UpdateIdpErrorCode>\n"],"names":["db","newConfiguration"],"mappings":";;;;;;;;;;;;;;;;;AAcO,MAAM,WAAW;AAAA,EACvB,YACkB,aAChB;AADgB,SAAA,cAAA;AAAA,EAElB;AAAA,EAEA,MAAa,OAAO,IAAqB,KAAyD;AACjG,WAAO,MAAM,GAAG,YAAY,OAAOA,QAAqC;AACvE,UAAI;AACH,cAAM,kBAAkB,KAAK,YAAY,WAAW,IAAI,IAAI;AAC5D,wBAAgB,sBAAsB,IAAI,aAAa;AAAA,MACxD,SAAS,GAAG;AACX,YAAI,aAAa,+BAA+B;AAC/C,iBAAO,IAAI,cAAc,gBAAgB,YAAY,IAAI,IAAI,YAAY;AAAA,QAC1E;AACA,YAAI,aAAa,8BAA8B;AAC9C,iBAAO,IAAI,cAAc,yBAAyB,8BAA8B,EAAE,OAAO,EAAE;AAAA,QAC5F;AACA,cAAM;AAAA,MACP;AAEA,YAAM,WAAW,MAAMA,IAAG,aAAa,MAAM,IAAI,4BAA4B,IAAI,IAAI,CAAC;AACtF,UAAI,UAAU;AACb,eAAO,IAAI,cAAc,kBAAkB,iBAAiB,IAAI,IAAI,iBAAiB;AAAA,MACtF;AACA,YAAMA,IAAG,WAAW,QAAQ,IAAI,iBAAiB,GAAG,CAAC;AACrD,aAAO,IAAI,WAAW,IAAI;AAAA,IAC3B,CAAC;AAAA,EACF;AAAA,EAEA,MAAa,WAAW,IAAqB,MAA2C;AACvF,WAAO,MAAM,GAAG,YAAY,OAAMA,QAAM;AACvC,YAAM,WAAW,MAAMA,IAAG,aAAa,MAAM,IAAI,4BAA4B,IAAI,CAAC;AAClF,UAAI,CAAC,UAAU;AACd,eAAO,IAAI,cAAc,aAAa,OAAO,IAAI,YAAY;AAAA,MAC9D;AACA,UAAI,CAAC,SAAS,YAAY;AACzB,cAAMA,IAAG,WAAW,QAAQ,IAA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K,YAAY,WAAW,IAAI;AACxD,YAAI,KAAK,kBAAkB,UAAa,SAAS,SAAS,MAAM;AAC/D,0BAAgB,sBAAsB,gBAAgB;AAAA,QACvD;AAAA,MACD,SAAS,GAAG;AACX,YAAI,aAAa,8BAA8B;AAC9C,iBAAO,IAAI,cAAc,yBAAyB,8BAA8B,EAAE,OAAO,EAAE;AAAA,QAC5F;AACA,cAAM;AAAA,MACP;AAEA,YAAMD,IAAG,WAAW;AAAA,QACnB,IAAI,iBAAiB,SAAS,IAAI;AAAA,UACjC,GAAG;AAAA,UACH,eAAe,KAAK,gBAAgB,mBAAmB;AAAA,QAAA,CACvD;AAAA,MAAA;AAGF,aAAO,IAAI,WAAW,IAAI;AAAA,IAC3B,CAAC;AAAA,EACF;AAAA,EAEA,MAAa,QAAQ,IAAqD;AACzE,UAAM,SAAS,MAAM,GAAG,aAAa,MAAM,IAAI,wBAAwB;AACvE,WAAO,OAAO,IAAI,CAAA,OAAM;AACvB,YAAM,kBAAkB,KAAK,YAAY,iBAAiB,GAAG,IAAI;AACjE,YAAM,gBAAgB,iBAAiB,yBACpC,gBAAgB,uBAAuB,GAAG,aAAa,IACvD,GAAG;AAEN,aAAO,EAAE,GAAG,IAAI,cAAA;AAAA,IACjB,CAAC;AAAA,EACF;AACD;"}
|
|
1
|
+
{"version":3,"file":"IDPManager.js","sources":["../../../../../../../packages/engine-tenant-api/src/model/service/idp/IDPManager.ts"],"sourcesContent":["import { Response, ResponseError, ResponseOk } from '../../utils/Response.js'\nimport { AddIdpErrorCode, DisableIdpErrorCode, EnableIdpErrorCode, UpdateIdpErrorCode } from '../../../schema/index.js'\nimport { DatabaseContext } from '../../utils/index.js'\nimport { IdentityProviderData } from '../../type/index.js'\nimport { IdentityProviderBySlugQuery, IdentityProvidersQuery } from '../../queries/index.js'\nimport { CreateIdpCommand } from '../../commands/idp/CreateIdpCommand.js'\nimport { IDPHandlerRegistry } from './IDPHandlerRegistry.js'\nimport { IdentityProviderNotFoundError } from './IdentityProviderNotFoundError.js'\nimport { InvalidIDPConfigurationError } from './InvalidIDPConfigurationError.js'\nimport { findClaimMappingShapeErrors, findRemovedRuleKeys, isRecord, parseClaimMapping } from './ClaimMapping.js'\nimport { validateClaimMappingMembership } from './ClaimMappingValidation.js'\nimport { ProjectSchemaResolver } from '../../type/index.js'\nimport { DisableIdpCommand } from '../../commands/idp/DisableIdpCommand.js'\nimport { EnableIdpCommand } from '../../commands/idp/EnableIdpCommand.js'\nimport { UpdateIdpCommand, UpdateIdpData } from '../../commands/idp/UpdateIdpCommand.js'\nimport { IdentityProviderDto } from '../../queries/idp/types.js'\n\nexport class IDPManager {\n\tconstructor(\n\t\tprivate readonly idpRegistry: IDPHandlerRegistry,\n\t\tprivate readonly projectSchemaResolver: ProjectSchemaResolver,\n\t) {\n\t}\n\n\tpublic async addIDP(db: DatabaseContext, idp: IdentityProviderData): Promise<RegisterIDPResponse> {\n\t\treturn await db.transaction(async (db): Promise<RegisterIDPResponse> => {\n\t\t\ttry {\n\t\t\t\tconst providerService = this.idpRegistry.getHandler(idp.type)\n\t\t\t\tthis.assertNoUnknownConfigurationKeys(providerService.validateConfiguration(idp.configuration), idp.configuration)\n\t\t\t\tawait this.assertValidClaimMapping(idp.configuration)\n\t\t\t} catch (e) {\n\t\t\t\tif (e instanceof IdentityProviderNotFoundError) {\n\t\t\t\t\treturn new ResponseError('UNKNOWN_TYPE', `IDP type ${idp.type} not found`)\n\t\t\t\t}\n\t\t\t\tif (e instanceof InvalidIDPConfigurationError) {\n\t\t\t\t\treturn new ResponseError('INVALID_CONFIGURATION', `Invalid IDP configuration: ${e.message}`)\n\t\t\t\t}\n\t\t\t\tthrow e\n\t\t\t}\n\n\t\t\tconst existing = await db.queryHandler.fetch(new IdentityProviderBySlugQuery(idp.slug))\n\t\t\tif (existing) {\n\t\t\t\treturn new ResponseError('ALREADY_EXISTS', `IDP with slug ${idp.slug} already exists`)\n\t\t\t}\n\t\t\tawait db.commandBus.execute(new CreateIdpCommand(idp))\n\t\t\treturn new ResponseOk(null)\n\t\t})\n\t}\n\n\tpublic async disableIDP(db: DatabaseContext, slug: string): Promise<DisableIDPResponse> {\n\t\treturn await db.transaction(async db => {\n\t\t\tconst existing = await db.queryHandler.fetch(new IdentityProviderBySlugQuery(slug))\n\t\t\tif (!existing) {\n\t\t\t\treturn new ResponseError('NOT_FOUND', `IDP ${slug} not found`)\n\t\t\t}\n\t\t\tif (!existing.disabledAt) {\n\t\t\t\tawait db.commandBus.execute(new DisableIdpCommand(existing.id))\n\t\t\t}\n\t\t\treturn new ResponseOk(null)\n\t\t})\n\t}\n\n\tpublic async enableIDP(db: DatabaseContext, slug: string): Promise<EnableIDPResponse> {\n\t\treturn await db.transaction(async db => {\n\t\t\tconst existing = await db.queryHandler.fetch(new IdentityProviderBySlugQuery(slug))\n\t\t\tif (!existing) {\n\t\t\t\treturn new ResponseError('NOT_FOUND', `IDP ${slug} not found`)\n\t\t\t}\n\t\t\tif (existing.disabledAt) {\n\t\t\t\tawait db.commandBus.execute(new EnableIdpCommand(existing.id))\n\t\t\t}\n\t\t\treturn new ResponseOk(null)\n\t\t})\n\t}\n\n\tpublic async updateIDP(db: DatabaseContext, slug: string, data: UpdateIdpData, mergeConfiguration: boolean): Promise<UpdateIDPResponse> {\n\t\treturn await db.transaction(async db => {\n\t\t\tconst existing = await db.queryHandler.fetch(new IdentityProviderBySlugQuery(slug))\n\t\t\tif (!existing) {\n\t\t\t\treturn new ResponseError('NOT_FOUND', `IDP ${slug} not found`)\n\t\t\t}\n\n\t\t\tconst newConfiguration = !data.configuration\n\t\t\t\t? existing.configuration\n\t\t\t\t: (mergeConfiguration ? deepMergeConfiguration(existing.configuration, data.configuration) : data.configuration)\n\n\t\t\ttry {\n\t\t\t\tconst type = data.type ?? existing.type\n\t\t\t\tconst providerService = this.idpRegistry.getHandler(type)\n\t\t\t\tif (data.configuration !== undefined || type !== existing.type) {\n\t\t\t\t\tthis.assertNoUnknownConfigurationKeys(providerService.validateConfiguration(newConfiguration), newConfiguration)\n\t\t\t\t\tawait this.assertValidClaimMapping(newConfiguration)\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\tif (e instanceof InvalidIDPConfigurationError) {\n\t\t\t\t\treturn new ResponseError('INVALID_CONFIGURATION', `Invalid IDP configuration: ${e.message}`)\n\t\t\t\t}\n\t\t\t\tthrow e\n\t\t\t}\n\n\t\t\tawait db.commandBus.execute(\n\t\t\t\tnew UpdateIdpCommand(existing.id, {\n\t\t\t\t\t...data,\n\t\t\t\t\tconfiguration: data.configuration ? newConfiguration : undefined,\n\t\t\t\t}),\n\t\t\t)\n\n\t\t\treturn new ResponseOk(null)\n\t\t})\n\t}\n\n\t/**\n\t * Reject top-level `configuration` keys the provider does not recognise.\n\t *\n\t * Every provider configuration is parsed with `Typesafe.partial`, which silently DROPS unknown\n\t * properties. Without this check `addIDP` / `updateIDP` answer `ok` to a configuration the\n\t * provider will never act on — a typo like `fetchUserinfo` (lowercase i) reads as a successfully\n\t * applied setting while the option stays off, and an option that a given engine version does not\n\t * support yet looks indistinguishable from one that works.\n\t *\n\t * The parsed result carries exactly the keys the provider understood, so the difference against\n\t * the submitted object is the set of ignored keys. All of them are reported at once (rather than\n\t * the first, as `Typesafe.noExtraProps` would) so a configuration with several typos takes one\n\t * round trip to fix, matching {@link findRemovedRuleKeys}.\n\t *\n\t * Only the top level is checked: nested shapes that need strictness validate themselves\n\t * (`claimMapping` via {@link parseClaimMapping}). Reading a stored configuration is deliberately\n\t * left untouched — this runs at write time only, so a row written before this check keeps\n\t * authenticating instead of locking its users out.\n\t */\n\tprivate assertNoUnknownConfigurationKeys(parsed: {}, submitted: Record<string, unknown>): void {\n\t\tconst known = new Set(Object.keys(parsed))\n\t\tconst unknown = Object.keys(submitted).filter(key => !known.has(key))\n\t\tif (unknown.length > 0) {\n\t\t\tthrow new InvalidIDPConfigurationError(\n\t\t\t\t`unknown configuration ${unknown.length === 1 ? 'property' : 'properties'} ${unknown.join(', ')}; `\n\t\t\t\t\t+ `remove ${unknown.length === 1 ? 'it' : 'them'} or check the spelling — the provider would ignore ${unknown.length === 1 ? 'it' : 'them'}`,\n\t\t\t)\n\t\t}\n\t}\n\n\t/**\n\t * Validate the optional A09 `claimMapping` embedded in an IdP `configuration`: reject a removed\n\t * `grantRoles` (global-role mapping was dropped — see {@link parseClaimMapping}), reject a\n\t * malformed shape, and validate each granted membership's role against the target project's ACL\n\t * schema (mirroring the direct add-member path). Throws {@link InvalidIDPConfigurationError},\n\t * surfaced as `INVALID_CONFIGURATION`.\n\t */\n\tprivate async assertValidClaimMapping(configuration: Record<string, unknown>): Promise<void> {\n\t\tconst removed = findRemovedRuleKeys(configuration)\n\t\tif (removed.length > 0) {\n\t\t\tthrow new InvalidIDPConfigurationError(\n\t\t\t\t`claimMapping no longer supports ${removed.join(', ')} (global-role mapping was removed); grant a project membership via grantMembership instead`,\n\t\t\t)\n\t\t}\n\t\tlet mapping\n\t\ttry {\n\t\t\tmapping = parseClaimMapping(configuration)\n\t\t} catch (e) {\n\t\t\tthrow new InvalidIDPConfigurationError(`Invalid claimMapping: ${e instanceof Error ? e.message : String(e)}`)\n\t\t}\n\t\tif (!mapping) {\n\t\t\treturn\n\t\t}\n\t\t// Reject contradictory / empty-by-construction rule shapes (a rule setting both equals+contains; a\n\t\t// variable's `from.where` without `from.pick`) before the per-project ACL checks, so a\n\t\t// misconfiguration is caught even when the target project does not exist yet (ACL loop skipped).\n\t\tconst shapeErrors = findClaimMappingShapeErrors(mapping)\n\t\tif (shapeErrors.length > 0) {\n\t\t\tthrow new InvalidIDPConfigurationError(shapeErrors[0])\n\t\t}\n\t\t// Validate each granted membership's role AND its variables against the target project's ACL schema,\n\t\t// via the shared {@link validateClaimMappingMembership} (the same checks `IDPClaimSyncService`\n\t\t// re-runs at apply time, so the two enforcement points can't drift). A project that does not (yet)\n\t\t// exist is skipped — it may be created later, and a sign-in referencing a missing project is\n\t\t// harmless (the grant is skipped). NOTE: this validation runs only here at add/update time and is\n\t\t// NOT re-checked when the project/role appears later; the unsafe-condition-variable case is caught\n\t\t// again at apply time by `IDPClaimSyncService`, but other drift (unknown role/variable) is not.\n\t\tfor (const rule of mapping.rules) {\n\t\t\tconst membership = rule.grantMembership\n\t\t\tif (!membership) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tconst schema = await this.projectSchemaResolver.getSchema(membership.project)\n\t\t\tif (!schema) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tconst errors = validateClaimMappingMembership(schema.acl, membership)\n\t\t\tif (errors.length > 0) {\n\t\t\t\tthrow new InvalidIDPConfigurationError(errors[0].message)\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic async listIDP(db: DatabaseContext): Promise<IdentityProviderDto[]> {\n\t\tconst result = await db.queryHandler.fetch(new IdentityProvidersQuery())\n\t\treturn result.map(it => {\n\t\t\tconst providerService = this.idpRegistry.getHandlerOrNull(it.type)\n\t\t\tconst configuration = providerService?.getPublicConfiguration\n\t\t\t\t? providerService.getPublicConfiguration(it.configuration)\n\t\t\t\t: it.configuration\n\n\t\t\treturn { ...it, configuration }\n\t\t})\n\t}\n}\n\n/**\n * Recursively merge configurer-supplied `updates` into the stored `base` configuration (the\n * `mergeConfiguration: true` path of {@link IDPManager.updateIDP}), returning a new object:\n * - a plain-object value is merged INTO an existing plain-object value at the same key, so updating one\n * field of a nested config object preserves its siblings. This matters for `configuration.claimMapping`,\n * which holds two independent concerns in one object — the OIDC identity-remap (`email` / `name` /\n * `externalIdentifier` / `attributesKey`) and the A09 `rules` — so a shallow replace of `claimMapping`\n * while updating one would silently wipe the other.\n * - any non-object value (including ARRAYS, e.g. the A09 `rules` list) REPLACES wholesale — arrays are\n * never merged element-wise.\n * - a `null` value DELETES the key (the established \"send null to unset\" convention).\n * - `__proto__` / `constructor` / `prototype` keys are skipped at EVERY level: they are never a legitimate\n * config field and writing one through could pollute the object's prototype.\n */\nconst deepMergeConfiguration = (base: Record<string, unknown>, updates: Record<string, unknown>): Record<string, unknown> => {\n\tconst result: Record<string, unknown> = { ...base }\n\tfor (const [key, value] of Object.entries(updates)) {\n\t\tif (key === '__proto__' || key === 'constructor' || key === 'prototype') {\n\t\t\tcontinue\n\t\t}\n\t\tif (value === null) {\n\t\t\tdelete result[key]\n\t\t} else if (isRecord(value)) {\n\t\t\tconst existingChild = result[key]\n\t\t\tresult[key] = deepMergeConfiguration(isRecord(existingChild) ? existingChild : {}, value)\n\t\t} else {\n\t\t\tresult[key] = value\n\t\t}\n\t}\n\treturn result\n}\n\nexport type RegisterIDPResponse = Response<null, AddIdpErrorCode>\nexport type DisableIDPResponse = Response<null, DisableIdpErrorCode>\nexport type EnableIDPResponse = Response<null, EnableIdpErrorCode>\nexport type UpdateIDPResponse = Response<null, UpdateIdpErrorCode>\n"],"names":["db"],"mappings":";;;;;;;;;;;;;;;;;;;AAiBO,MAAM,WAAW;AAAA,EACvB,YACkB,aACA,uBAChB;AAFgB,SAAA,cAAA;AACA,SAAA,wBAAA;AAAA,EAElB;AAAA,EAEA,MAAa,OAAO,IAAqB,KAAyD;AACjG,WAAO,MAAM,GAAG,YAAY,OAAOA,QAAqC;AACvE,UAAI;AACH,cAAM,kBAAkB,KAAK,YAAY,WAAW,IAAI,IAAI;AAC5D,aAAK,iCAAiC,gBAAgB,sBAAsB,IAAI,aAAa,GAAG,IAAI,aAAa;AACjH,cAAM,KAAK,wBAAwB,IAAI,aAAa;AAAA,MACrD,SAAS,GAAG;AACX,YAAI,aAAa,+BAA+B;AAC/C,iBAAO,IAAI,cAAc,gBAAgB,YAAY,IAAI,IAAI,YAAY;AAAA,QAC1E;AACA,YAAI,aAAa,8BAA8B;AAC9C,iBAAO,IAAI,cAAc,yBAAyB,8BAA8B,EAAE,OAAO,EAAE;AAAA,QAC5F;AACA,cAAM;AAAA,MACP;AAEA,YAAM,WAAW,MAAMA,IAAG,aAAa,MAAM,IAAI,4BAA4B,IAAI,IAAI,CAAC;AACtF,UAAI,UAAU;AACb,eAAO,IAAI,cAAc,kBAAk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F;AACD;AAgBA,MAAM,yBAAyB,CAAC,MAA+B,YAA8D;AAC5H,QAAM,SAAkC,EAAE,GAAG,KAAA;AAC7C,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,OAAO,GAAG;AACnD,QAAI,QAAQ,eAAe,QAAQ,iBAAiB,QAAQ,aAAa;AACxE;AAAA,IACD;AACA,QAAI,UAAU,MAAM;AACnB,aAAO,OAAO,GAAG;AAAA,IAClB,WAAW,SAAS,KAAK,GAAG;AAC3B,YAAM,gBAAgB,OAAO,GAAG;AAChC,aAAO,GAAG,IAAI,uBAAuB,SAAS,aAAa,IAAI,gBAAgB,CAAA,GAAI,KAAK;AAAA,IACzF,OAAO;AACN,aAAO,GAAG,IAAI;AAAA,IACf;AAAA,EACD;AACA,SAAO;AACR;"}
|
|
@@ -9,9 +9,11 @@ require("node:crypto");
|
|
|
9
9
|
const DisableApiKeyCommand = require("../../commands/apiKey/DisableApiKeyCommand.cjs");
|
|
10
10
|
const CreateAuthLogEntryCommand = require("../../commands/authLog/CreateAuthLogEntryCommand.cjs");
|
|
11
11
|
const IDPRevalidation = require("./IDPRevalidation.cjs");
|
|
12
|
+
const ClaimMapping = require("./ClaimMapping.cjs");
|
|
12
13
|
class IdpSessionRevalidator {
|
|
13
|
-
constructor(idpRegistry) {
|
|
14
|
+
constructor(idpRegistry, claimSyncService) {
|
|
14
15
|
this.idpRegistry = idpRegistry;
|
|
16
|
+
this.claimSyncService = claimSyncService;
|
|
15
17
|
}
|
|
16
18
|
async revalidate(dbContext, readDbContext, apiKeyRow, requestInfo) {
|
|
17
19
|
const row = await readDbContext.queryHandler.fetch(new IdpSessionByApiKeyQuery.IdpSessionByApiKeyQuery(apiKeyRow.id, readDbContext.providers));
|
|
@@ -97,8 +99,60 @@ class IdpSessionRevalidator {
|
|
|
97
99
|
} catch {
|
|
98
100
|
}
|
|
99
101
|
}
|
|
102
|
+
if (result.claims) {
|
|
103
|
+
await this.syncClaims(dbContext, row, apiKeyRow, result.claims, result.claimsComplete === true, requestInfo);
|
|
104
|
+
}
|
|
100
105
|
return "valid";
|
|
101
106
|
}
|
|
107
|
+
/**
|
|
108
|
+
* Re-apply the claim mapping on a successful refresh. Runs in its own transaction (atomic apply of
|
|
109
|
+
* the membership changes) and never throws: the IdP has already vouched for the session, so a
|
|
110
|
+
* malformed mapping or a transient apply error must not revoke or fail it. A real membership change
|
|
111
|
+
* is audited as `idp_role_mapped`; a failure is audited as `idp_role_mapping_failed` (fail-open
|
|
112
|
+
* marker), mirroring the sign-in path. `claimsComplete` carries whether the refresh rebuilt sign-in's
|
|
113
|
+
* full claim surface (so removal reconciliation is safe) — see `allowRemoval` below.
|
|
114
|
+
*/
|
|
115
|
+
async syncClaims(dbContext, row, apiKeyRow, claims, claimsComplete, requestInfo) {
|
|
116
|
+
try {
|
|
117
|
+
const mapping = ClaimMapping.parseClaimMapping(row.providerConfiguration);
|
|
118
|
+
if (!mapping) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
const { audit, droppedUnsafeRules } = await dbContext.transaction(
|
|
122
|
+
(db) => this.claimSyncService.sync(db, mapping, claims, { id: apiKeyRow.identity_id }, false, { allowRemoval: claimsComplete })
|
|
123
|
+
);
|
|
124
|
+
if (audit) {
|
|
125
|
+
await this.logRoleMapping(dbContext, apiKeyRow, row, "idp_role_mapped", audit, requestInfo);
|
|
126
|
+
}
|
|
127
|
+
if (droppedUnsafeRules) {
|
|
128
|
+
await this.logRoleMapping(dbContext, apiKeyRow, row, "idp_role_mapping_failed", void 0, requestInfo);
|
|
129
|
+
}
|
|
130
|
+
} catch {
|
|
131
|
+
await this.logRoleMapping(dbContext, apiKeyRow, row, "idp_role_mapping_failed", void 0, requestInfo);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
async logRoleMapping(dbContext, apiKeyRow, row, type, eventData, requestInfo) {
|
|
135
|
+
try {
|
|
136
|
+
await dbContext.commandBus.execute(
|
|
137
|
+
new CreateAuthLogEntryCommand.CreateAuthLogEntryCommand({
|
|
138
|
+
type,
|
|
139
|
+
invokedById: apiKeyRow.identity_id,
|
|
140
|
+
personId: apiKeyRow.person_id ?? void 0,
|
|
141
|
+
// The membership change affects this session's own person — record it as the target too,
|
|
142
|
+
// so an admin querying membership changes by target_person_id sees IdP-driven grants/revokes
|
|
143
|
+
// (consistent with the project_membership_* audit events).
|
|
144
|
+
targetPersonId: apiKeyRow.person_id ?? void 0,
|
|
145
|
+
identityProviderId: row.identityProviderId,
|
|
146
|
+
personTokenId: apiKeyRow.id,
|
|
147
|
+
success: true,
|
|
148
|
+
eventData,
|
|
149
|
+
ipAddress: requestInfo?.ip,
|
|
150
|
+
userAgent: requestInfo?.userAgent
|
|
151
|
+
})
|
|
152
|
+
);
|
|
153
|
+
} catch {
|
|
154
|
+
}
|
|
155
|
+
}
|
|
102
156
|
async logRevalidated(dbContext, apiKeyRow, row, requestInfo) {
|
|
103
157
|
await dbContext.commandBus.execute(
|
|
104
158
|
new CreateAuthLogEntryCommand.CreateAuthLogEntryCommand({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IdpSessionRevalidator.cjs","sources":["../../../../../../../packages/engine-tenant-api/src/model/service/idp/IdpSessionRevalidator.ts"],"sourcesContent":["import { DatabaseContext } from '../../utils/index.js'\nimport { ApiKeyRequestInfo } from '../../commands/index.js'\nimport { ApiKeyRow } from '../../queries/apiKey/ApiKeyQuery.js'\nimport { IdpSessionByApiKeyQuery, IdpSessionRow } from '../../queries/idp/IdpSessionByApiKeyQuery.js'\nimport { IDPHandlerRegistry } from './IDPHandlerRegistry.js'\nimport { ClaimIdpRevalidationCommand } from '../../commands/idp/ClaimIdpRevalidationCommand.js'\nimport { UpdateIdpSessionCommand } from '../../commands/idp/UpdateIdpSessionCommand.js'\nimport { DisableApiKeyCommand } from '../../commands/index.js'\nimport { CreateAuthLogEntryCommand } from '../../commands/authLog/CreateAuthLogEntryCommand.js'\nimport { REVALIDATION_DEFAULT_FALLBACK_INTERVAL, REVALIDATION_DEFAULT_MIN_INTERVAL, REVALIDATION_DEFAULT_SOFT_THRESHOLD } from './IDPRevalidation.js'\nimport { IdentityProviderHandler, RevalidationResult } from './IdentityProviderHandler.js'\n\nexport type RevalidationOutcome = 'valid' | 'revoked'\n\ntype ResolvedRevalidationConfig = {\n\tenabled: boolean\n\tsoftThreshold: number\n\tminInterval: string\n\tfallbackInterval: string\n\tmode: 'auto' | 'blocking'\n}\n\n/**\n * Decision for the current request: whether to attempt a revalidation, and if so whether it\n * must block the request. `claimInterval` is the single-flight floor for the atomic claim.\n */\ntype Decision = null | { blocking: boolean; claimInterval: string }\n\n/**\n * Re-validates IdP-backed sessions against their identity provider on the verify hot path\n * (A24). Invoked from `ApiKeyManager.verifyAndProlong`. Operates entirely through the supplied\n * database contexts and the command bus, so it does not depend on `ApiKeyManager` (no DI cycle).\n *\n * The cadence is driven by the **access-token lifetime**, not a fixed interval:\n * - while the token is fresh (before `softRefreshThreshold` of its lifetime) → skip, free;\n * - past the threshold but not yet expired → a proactive **background (SWR)** refresh, so the\n * request keeps zero added latency and the token is renewed before it dies;\n * - once the token has actually expired → a **blocking** refresh (we can't serve a dead token).\n * `mode: 'blocking'` forces every revalidation synchronous (zero revocation lag). When the IdP\n * returns no token expiry, falls back to a plain `fallbackInterval` background throttle.\n */\nexport class IdpSessionRevalidator {\n\tconstructor(\n\t\tprivate readonly idpRegistry: IDPHandlerRegistry,\n\t) {\n\t}\n\n\tasync revalidate(\n\t\tdbContext: DatabaseContext,\n\t\treadDbContext: DatabaseContext,\n\t\tapiKeyRow: ApiKeyRow,\n\t\trequestInfo?: ApiKeyRequestInfo,\n\t): Promise<RevalidationOutcome> {\n\t\tconst row = await readDbContext.queryHandler.fetch(new IdpSessionByApiKeyQuery(apiKeyRow.id, readDbContext.providers))\n\t\tif (!row) {\n\t\t\t// not a federated session (password / IdP without revalidation) — fast no-op\n\t\t\treturn 'valid'\n\t\t}\n\n\t\tconst config = this.resolveConfig(row.providerConfiguration)\n\t\tif (!config.enabled) {\n\t\t\treturn 'valid'\n\t\t}\n\n\t\t// A disabled IdP no longer vouches for its sessions.\n\t\tif (row.providerDisabledAt) {\n\t\t\tawait this.revoke(dbContext, apiKeyRow, row, 'idp_disabled', requestInfo)\n\t\t\treturn 'revoked'\n\t\t}\n\n\t\tconst handler = this.idpRegistry.getHandlerOrNull(row.providerType)\n\t\tif (!handler?.revalidate) {\n\t\t\t// provider can't actively re-validate (e.g. SAML) — rely on expiry / SLO\n\t\t\treturn 'valid'\n\t\t}\n\n\t\tconst decision = this.decide(row, config, dbContext.providers.now())\n\t\tif (!decision) {\n\t\t\t// token still fresh — vouched for, no IdP call\n\t\t\treturn 'valid'\n\t\t}\n\n\t\t// Atomic claim = single-flight. Loser (within the floor window, or lost the race) serves stale.\n\t\tlet claimed: boolean\n\t\ttry {\n\t\t\tclaimed = await dbContext.commandBus.execute(new ClaimIdpRevalidationCommand(row.id, decision.claimInterval))\n\t\t} catch {\n\t\t\t// invalid interval string or transient DB error — fail open, retry next request\n\t\t\treturn 'valid'\n\t\t}\n\t\tif (!claimed) {\n\t\t\treturn 'valid'\n\t\t}\n\n\t\tif (decision.blocking) {\n\t\t\treturn await this.runRevalidation(dbContext, handler, row, apiKeyRow, requestInfo)\n\t\t}\n\n\t\t// SWR: serve this request from the (still valid) token, refresh after the response.\n\t\t// The work runs detached (after the response is sent), so any rejection — a transient\n\t\t// DB error in the revoke / persist writes, a corrupt-config throw — must be swallowed\n\t\t// here; otherwise it becomes an unhandledRejection and can take the worker down. The\n\t\t// session is simply kept and re-tried on a later request (the claim floor throttles).\n\t\tsetImmediate(() => {\n\t\t\tthis.runRevalidation(dbContext, handler, row, apiKeyRow, requestInfo).catch(() => {})\n\t\t})\n\t\treturn 'valid'\n\t}\n\n\t/**\n\t * Decide whether (and how) to revalidate, purely from timestamps — no interval parsing in\n\t * JS (the claim handles intervals in SQL). Returns null to skip.\n\t */\n\tprivate decide(row: IdpSessionRow, config: ResolvedRevalidationConfig, now: Date): Decision {\n\t\tconst expiresAt = row.session.expiresAt\n\t\tconst obtainedAt = row.tokenObtainedAt\n\n\t\t// No lifetime info from the IdP → plain background throttle on fallbackInterval.\n\t\tif (!expiresAt || !obtainedAt) {\n\t\t\treturn { blocking: config.mode === 'blocking', claimInterval: config.fallbackInterval }\n\t\t}\n\n\t\tconst lifetimeMs = expiresAt.getTime() - obtainedAt.getTime()\n\t\tconst softAtMs = obtainedAt.getTime() + lifetimeMs * config.softThreshold\n\t\tconst nowMs = now.getTime()\n\n\t\tif (nowMs < softAtMs) {\n\t\t\treturn null // still within the trusted window\n\t\t}\n\n\t\tconst expired = nowMs >= expiresAt.getTime()\n\t\treturn { blocking: config.mode === 'blocking' || expired, claimInterval: config.minInterval }\n\t}\n\n\tprivate async runRevalidation(\n\t\tdbContext: DatabaseContext,\n\t\thandler: IdentityProviderHandler<{}>,\n\t\trow: IdpSessionRow,\n\t\tapiKeyRow: ApiKeyRow,\n\t\trequestInfo?: ApiKeyRequestInfo,\n\t): Promise<RevalidationOutcome> {\n\t\tlet config: {}\n\t\ttry {\n\t\t\tconfig = handler.validateConfiguration(row.providerConfiguration)\n\t\t} catch {\n\t\t\t// corrupt stored config — must NOT revoke; keep the session and retry later. Audit\n\t\t\t// it so the operator can tell \"vouched for\" apart from \"silently broken\" (without an\n\t\t\t// entry, a config typo disables re-validation invisibly for the life of every session).\n\t\t\tawait this.logRevalidationFailed(dbContext, apiKeyRow, row, 'config_invalid', requestInfo)\n\t\t\treturn 'valid'\n\t\t}\n\n\t\tlet result: RevalidationResult\n\t\ttry {\n\t\t\tresult = await handler.revalidate!(config, row.session)\n\t\t} catch {\n\t\t\t// transient failure (network / IdP down) — must NOT revoke; keep the session and retry\n\t\t\t// on a later request (the claim floor prevents hammering the IdP). Audited (throttled\n\t\t\t// to one entry per claim window) so a prolonged IdP outage is visible rather than a\n\t\t\t// silent fail-open.\n\t\t\tawait this.logRevalidationFailed(dbContext, apiKeyRow, row, 'revalidation_error', requestInfo)\n\t\t\treturn 'valid'\n\t\t}\n\n\t\tif (result.status === 'revoked') {\n\t\t\tawait this.revoke(dbContext, apiKeyRow, row, result.reason, requestInfo)\n\t\t\treturn 'revoked'\n\t\t}\n\n\t\t// Still valid — persist the rotated token (resets the lifetime reference) / refreshed\n\t\t// expiry. A rotation is a real, low-frequency event (token-lifetime cadence), so we\n\t\t// audit it as `idp_session_revalidated`; the no-op userinfo/introspection probes\n\t\t// (no rotated session) are intentionally NOT logged to keep the audit log usable.\n\t\t//\n\t\t// The IdP has already vouched for the session, so these post-success writes are pure\n\t\t// best-effort bookkeeping (they only reset the SWR cadence reference). A transient DB\n\t\t// error or an `encrypt()` throw here must NOT fail the request — otherwise a blocking\n\t\t// revalidation fails closed on a successful refresh, contradicting \"fail open\" (the SWR\n\t\t// path already swallows this). Keep the existing row; the claim floor throttles a retry.\n\t\tif (result.idpSession) {\n\t\t\ttry {\n\t\t\t\tawait dbContext.commandBus.execute(new UpdateIdpSessionCommand(row.id, result.idpSession))\n\t\t\t\tawait this.logRevalidated(dbContext, apiKeyRow, row, requestInfo)\n\t\t\t} catch {\n\t\t\t\t// fall through — session stays valid, persist retried on a later request\n\t\t\t}\n\t\t}\n\t\treturn 'valid'\n\t}\n\n\tprivate async logRevalidated(dbContext: DatabaseContext, apiKeyRow: ApiKeyRow, row: IdpSessionRow, requestInfo?: ApiKeyRequestInfo): Promise<void> {\n\t\tawait dbContext.commandBus.execute(\n\t\t\tnew CreateAuthLogEntryCommand({\n\t\t\t\ttype: 'idp_session_revalidated',\n\t\t\t\tinvokedById: apiKeyRow.identity_id,\n\t\t\t\tpersonId: apiKeyRow.person_id ?? undefined,\n\t\t\t\tidentityProviderId: row.identityProviderId,\n\t\t\t\tpersonTokenId: apiKeyRow.id,\n\t\t\t\tsuccess: true,\n\t\t\t\tipAddress: requestInfo?.ip,\n\t\t\t\tuserAgent: requestInfo?.userAgent,\n\t\t\t}),\n\t\t)\n\t}\n\n\t/**\n\t * Audit a fail-open: the IdP couldn't be consulted (transient outage) or the stored config is\n\t * corrupt, so we kept the session rather than revoking it. Naturally throttled to one entry\n\t * per claim window (we only reach here after a successful claim, which bumps\n\t * `last_validated_at`). The write is best-effort and self-contained — a failure to audit must\n\t * never propagate and fail a blocking verify request (the whole point of failing open).\n\t */\n\tprivate async logRevalidationFailed(\n\t\tdbContext: DatabaseContext,\n\t\tapiKeyRow: ApiKeyRow,\n\t\trow: IdpSessionRow,\n\t\terrorCode: 'config_invalid' | 'revalidation_error',\n\t\trequestInfo?: ApiKeyRequestInfo,\n\t): Promise<void> {\n\t\ttry {\n\t\t\tawait dbContext.commandBus.execute(\n\t\t\t\tnew CreateAuthLogEntryCommand({\n\t\t\t\t\ttype: 'idp_session_revalidation_failed',\n\t\t\t\t\tinvokedById: apiKeyRow.identity_id,\n\t\t\t\t\tpersonId: apiKeyRow.person_id ?? undefined,\n\t\t\t\t\tidentityProviderId: row.identityProviderId,\n\t\t\t\t\tpersonTokenId: apiKeyRow.id,\n\t\t\t\t\t// not a security failure (the session is kept) — a fail-open marker the operator\n\t\t\t\t\t// can alert on. `success: true` keeps it out of the failed-login funnels.\n\t\t\t\t\tsuccess: true,\n\t\t\t\t\terrorCode,\n\t\t\t\t\tipAddress: requestInfo?.ip,\n\t\t\t\t\tuserAgent: requestInfo?.userAgent,\n\t\t\t\t}),\n\t\t\t)\n\t\t} catch {\n\t\t\t// best-effort observability — never fail the request because the audit write failed\n\t\t}\n\t}\n\n\tprivate async revoke(\n\t\tdbContext: DatabaseContext,\n\t\tapiKeyRow: ApiKeyRow,\n\t\trow: IdpSessionRow,\n\t\treason: string,\n\t\trequestInfo?: ApiKeyRequestInfo,\n\t): Promise<void> {\n\t\tawait dbContext.commandBus.execute(new DisableApiKeyCommand(apiKeyRow.id))\n\t\tawait dbContext.commandBus.execute(\n\t\t\tnew CreateAuthLogEntryCommand({\n\t\t\t\ttype: 'idp_session_revoked',\n\t\t\t\tinvokedById: apiKeyRow.identity_id,\n\t\t\t\tpersonId: apiKeyRow.person_id ?? undefined,\n\t\t\t\tidentityProviderId: row.identityProviderId,\n\t\t\t\tpersonTokenId: apiKeyRow.id,\n\t\t\t\tsuccess: false,\n\t\t\t\terrorCode: reason,\n\t\t\t\tipAddress: requestInfo?.ip,\n\t\t\t\tuserAgent: requestInfo?.userAgent,\n\t\t\t\t// the action payload belongs in `event_data` (where every other audit event puts\n\t\t\t\t// it and where the admin UI / AuthLogQueryResolver reads it); `metadata` is for\n\t\t\t\t// transport context (forwarder IP/UA).\n\t\t\t\teventData: { reason },\n\t\t\t}),\n\t\t)\n\t}\n\n\tprivate resolveConfig(configuration: Record<string, unknown>): ResolvedRevalidationConfig {\n\t\tconst raw = (configuration.revalidation ?? {}) as Record<string, unknown>\n\t\tconst threshold = typeof raw.softRefreshThreshold === 'number' && raw.softRefreshThreshold > 0 && raw.softRefreshThreshold <= 1\n\t\t\t? raw.softRefreshThreshold\n\t\t\t: REVALIDATION_DEFAULT_SOFT_THRESHOLD\n\t\treturn {\n\t\t\tenabled: raw.enabled === true,\n\t\t\tsoftThreshold: threshold,\n\t\t\tminInterval: typeof raw.minInterval === 'string' ? raw.minInterval : REVALIDATION_DEFAULT_MIN_INTERVAL,\n\t\t\tfallbackInterval: typeof raw.fallbackInterval === 'string' ? raw.fallbackInterval : REVALIDATION_DEFAULT_FALLBACK_INTERVAL,\n\t\t\tmode: raw.mode === 'blocking' ? 'blocking' : 'auto',\n\t\t}\n\t}\n}\n"],"names":["IdpSessionByApiKeyQuery","ClaimIdpRevalidationCommand","UpdateIdpSessionCommand","CreateAuthLogEntryCommand","DisableApiKeyCommand","REVALIDATION_DEFAULT_SOFT_THRESHOLD","REVALIDATION_DEFAULT_MIN_INTERVAL","REVALIDATION_DEFAULT_FALLBACK_INTERVAL"],"mappings":";;;;;;;;;;;AAyCO,MAAM,sBAAsB;AAAA,EAClC,YACkB,aAChB;AADgB,SAAA,cAAA;AAAA,EAElB;AAAA,EAEA,MAAM,WACL,WACA,eACA,WACA,a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AO;AAAA,MACN,SAAS,IAAI,YAAY;AAAA,MACzB,eAAe;AAAA,MACf,aAAa,OAAO,IAAI,gBAAgB,WAAW,IAAI,cAAcC,gBAAAA;AAAAA,MACrE,kBAAkB,OAAO,IAAI,qBAAqB,WAAW,IAAI,mBAAmBC,gBAAAA;AAAAA,MACpF,MAAM,IAAI,SAAS,aAAa,aAAa;AAAA,IAAA;AAAA,EAE/C;AACD;;"}
|
|
1
|
+
{"version":3,"file":"IdpSessionRevalidator.cjs","sources":["../../../../../../../packages/engine-tenant-api/src/model/service/idp/IdpSessionRevalidator.ts"],"sourcesContent":["import { DatabaseContext } from '../../utils/index.js'\nimport { ApiKeyRequestInfo } from '../../commands/index.js'\nimport { ApiKeyRow } from '../../queries/apiKey/ApiKeyQuery.js'\nimport { IdpSessionByApiKeyQuery, IdpSessionRow } from '../../queries/idp/IdpSessionByApiKeyQuery.js'\nimport { IDPHandlerRegistry } from './IDPHandlerRegistry.js'\nimport { ClaimIdpRevalidationCommand } from '../../commands/idp/ClaimIdpRevalidationCommand.js'\nimport { UpdateIdpSessionCommand } from '../../commands/idp/UpdateIdpSessionCommand.js'\nimport { DisableApiKeyCommand } from '../../commands/index.js'\nimport { CreateAuthLogEntryCommand } from '../../commands/authLog/CreateAuthLogEntryCommand.js'\nimport { REVALIDATION_DEFAULT_FALLBACK_INTERVAL, REVALIDATION_DEFAULT_MIN_INTERVAL, REVALIDATION_DEFAULT_SOFT_THRESHOLD } from './IDPRevalidation.js'\nimport { IdentityProviderHandler, RevalidationResult } from './IdentityProviderHandler.js'\nimport { IDPClaimSyncService } from './IDPClaimSyncService.js'\nimport { parseClaimMapping } from './ClaimMapping.js'\nimport { JSONValue } from '@contember/schema'\n\nexport type RevalidationOutcome = 'valid' | 'revoked'\n\ntype ResolvedRevalidationConfig = {\n\tenabled: boolean\n\tsoftThreshold: number\n\tminInterval: string\n\tfallbackInterval: string\n\tmode: 'auto' | 'blocking'\n}\n\n/**\n * Decision for the current request: whether to attempt a revalidation, and if so whether it\n * must block the request. `claimInterval` is the single-flight floor for the atomic claim.\n */\ntype Decision = null | { blocking: boolean; claimInterval: string }\n\n/**\n * Re-validates IdP-backed sessions against their identity provider on the verify hot path\n * (A24). Invoked from `ApiKeyManager.verifyAndProlong`. Operates entirely through the supplied\n * database contexts and the command bus, so it does not depend on `ApiKeyManager` (no DI cycle).\n *\n * The cadence is driven by the **access-token lifetime**, not a fixed interval:\n * - while the token is fresh (before `softRefreshThreshold` of its lifetime) → skip, free;\n * - past the threshold but not yet expired → a proactive **background (SWR)** refresh, so the\n * request keeps zero added latency and the token is renewed before it dies;\n * - once the token has actually expired → a **blocking** refresh (we can't serve a dead token).\n * `mode: 'blocking'` forces every revalidation synchronous (zero revocation lag). When the IdP\n * returns no token expiry, falls back to a plain `fallbackInterval` background throttle.\n */\nexport class IdpSessionRevalidator {\n\tconstructor(\n\t\tprivate readonly idpRegistry: IDPHandlerRegistry,\n\t\tprivate readonly claimSyncService: IDPClaimSyncService,\n\t) {\n\t}\n\n\tasync revalidate(\n\t\tdbContext: DatabaseContext,\n\t\treadDbContext: DatabaseContext,\n\t\tapiKeyRow: ApiKeyRow,\n\t\trequestInfo?: ApiKeyRequestInfo,\n\t): Promise<RevalidationOutcome> {\n\t\tconst row = await readDbContext.queryHandler.fetch(new IdpSessionByApiKeyQuery(apiKeyRow.id, readDbContext.providers))\n\t\tif (!row) {\n\t\t\t// not a federated session (password / IdP without revalidation) — fast no-op\n\t\t\treturn 'valid'\n\t\t}\n\n\t\tconst config = this.resolveConfig(row.providerConfiguration)\n\t\tif (!config.enabled) {\n\t\t\treturn 'valid'\n\t\t}\n\n\t\t// A disabled IdP no longer vouches for its sessions.\n\t\tif (row.providerDisabledAt) {\n\t\t\tawait this.revoke(dbContext, apiKeyRow, row, 'idp_disabled', requestInfo)\n\t\t\treturn 'revoked'\n\t\t}\n\n\t\tconst handler = this.idpRegistry.getHandlerOrNull(row.providerType)\n\t\tif (!handler?.revalidate) {\n\t\t\t// provider can't actively re-validate (e.g. SAML) — rely on expiry / SLO\n\t\t\treturn 'valid'\n\t\t}\n\n\t\tconst decision = this.decide(row, config, dbContext.providers.now())\n\t\tif (!decision) {\n\t\t\t// token still fresh — vouched for, no IdP call\n\t\t\treturn 'valid'\n\t\t}\n\n\t\t// Atomic claim = single-flight. Loser (within the floor window, or lost the race) serves stale.\n\t\tlet claimed: boolean\n\t\ttry {\n\t\t\tclaimed = await dbContext.commandBus.execute(new ClaimIdpRevalidationCommand(row.id, decision.claimInterval))\n\t\t} catch {\n\t\t\t// invalid interval string or transient DB error — fail open, retry next request\n\t\t\treturn 'valid'\n\t\t}\n\t\tif (!claimed) {\n\t\t\treturn 'valid'\n\t\t}\n\n\t\tif (decision.blocking) {\n\t\t\treturn await this.runRevalidation(dbContext, handler, row, apiKeyRow, requestInfo)\n\t\t}\n\n\t\t// SWR: serve this request from the (still valid) token, refresh after the response.\n\t\t// The work runs detached (after the response is sent), so any rejection — a transient\n\t\t// DB error in the revoke / persist writes, a corrupt-config throw — must be swallowed\n\t\t// here; otherwise it becomes an unhandledRejection and can take the worker down. The\n\t\t// session is simply kept and re-tried on a later request (the claim floor throttles).\n\t\tsetImmediate(() => {\n\t\t\tthis.runRevalidation(dbContext, handler, row, apiKeyRow, requestInfo).catch(() => {})\n\t\t})\n\t\treturn 'valid'\n\t}\n\n\t/**\n\t * Decide whether (and how) to revalidate, purely from timestamps — no interval parsing in\n\t * JS (the claim handles intervals in SQL). Returns null to skip.\n\t */\n\tprivate decide(row: IdpSessionRow, config: ResolvedRevalidationConfig, now: Date): Decision {\n\t\tconst expiresAt = row.session.expiresAt\n\t\tconst obtainedAt = row.tokenObtainedAt\n\n\t\t// No lifetime info from the IdP → plain background throttle on fallbackInterval.\n\t\tif (!expiresAt || !obtainedAt) {\n\t\t\treturn { blocking: config.mode === 'blocking', claimInterval: config.fallbackInterval }\n\t\t}\n\n\t\tconst lifetimeMs = expiresAt.getTime() - obtainedAt.getTime()\n\t\tconst softAtMs = obtainedAt.getTime() + lifetimeMs * config.softThreshold\n\t\tconst nowMs = now.getTime()\n\n\t\tif (nowMs < softAtMs) {\n\t\t\treturn null // still within the trusted window\n\t\t}\n\n\t\tconst expired = nowMs >= expiresAt.getTime()\n\t\treturn { blocking: config.mode === 'blocking' || expired, claimInterval: config.minInterval }\n\t}\n\n\tprivate async runRevalidation(\n\t\tdbContext: DatabaseContext,\n\t\thandler: IdentityProviderHandler<{}>,\n\t\trow: IdpSessionRow,\n\t\tapiKeyRow: ApiKeyRow,\n\t\trequestInfo?: ApiKeyRequestInfo,\n\t): Promise<RevalidationOutcome> {\n\t\tlet config: {}\n\t\ttry {\n\t\t\tconfig = handler.validateConfiguration(row.providerConfiguration)\n\t\t} catch {\n\t\t\t// corrupt stored config — must NOT revoke; keep the session and retry later. Audit\n\t\t\t// it so the operator can tell \"vouched for\" apart from \"silently broken\" (without an\n\t\t\t// entry, a config typo disables re-validation invisibly for the life of every session).\n\t\t\tawait this.logRevalidationFailed(dbContext, apiKeyRow, row, 'config_invalid', requestInfo)\n\t\t\treturn 'valid'\n\t\t}\n\n\t\tlet result: RevalidationResult\n\t\ttry {\n\t\t\tresult = await handler.revalidate!(config, row.session)\n\t\t} catch {\n\t\t\t// transient failure (network / IdP down) — must NOT revoke; keep the session and retry\n\t\t\t// on a later request (the claim floor prevents hammering the IdP). Audited (throttled\n\t\t\t// to one entry per claim window) so a prolonged IdP outage is visible rather than a\n\t\t\t// silent fail-open.\n\t\t\tawait this.logRevalidationFailed(dbContext, apiKeyRow, row, 'revalidation_error', requestInfo)\n\t\t\treturn 'valid'\n\t\t}\n\n\t\tif (result.status === 'revoked') {\n\t\t\tawait this.revoke(dbContext, apiKeyRow, row, result.reason, requestInfo)\n\t\t\treturn 'revoked'\n\t\t}\n\n\t\t// Still valid — persist the rotated token (resets the lifetime reference) / refreshed\n\t\t// expiry. A rotation is a real, low-frequency event (token-lifetime cadence), so we\n\t\t// audit it as `idp_session_revalidated`; the no-op userinfo/introspection probes\n\t\t// (no rotated session) are intentionally NOT logged to keep the audit log usable.\n\t\t//\n\t\t// The IdP has already vouched for the session, so these post-success writes are pure\n\t\t// best-effort bookkeeping (they only reset the SWR cadence reference). A transient DB\n\t\t// error or an `encrypt()` throw here must NOT fail the request — otherwise a blocking\n\t\t// revalidation fails closed on a successful refresh, contradicting \"fail open\" (the SWR\n\t\t// path already swallows this). Keep the existing row; the claim floor throttles a retry.\n\t\tif (result.idpSession) {\n\t\t\ttry {\n\t\t\t\tawait dbContext.commandBus.execute(new UpdateIdpSessionCommand(row.id, result.idpSession))\n\t\t\t\tawait this.logRevalidated(dbContext, apiKeyRow, row, requestInfo)\n\t\t\t} catch {\n\t\t\t\t// fall through — session stays valid, persist retried on a later request\n\t\t\t}\n\t\t}\n\n\t\t// A09 — re-apply the IdP's claim mapping when the refresh returned fresh claims, so an `always`\n\t\t// mapping keeps an established session's project memberships in sync with the IdP's current claims\n\t\t// without requiring a full re-login. `sticky` mappings self-skip (the sync passes isNewPerson=false).\n\t\t// `claimsComplete` tells the sync whether the refresh rebuilt sign-in's full claim surface, so it can\n\t\t// reconcile (incl. `unmatched: \"remove\"`) exactly like sign-in. Strictly fail-open — see `syncClaims`.\n\t\tif (result.claims) {\n\t\t\tawait this.syncClaims(dbContext, row, apiKeyRow, result.claims, result.claimsComplete === true, requestInfo)\n\t\t}\n\t\treturn 'valid'\n\t}\n\n\t/**\n\t * Re-apply the claim mapping on a successful refresh. Runs in its own transaction (atomic apply of\n\t * the membership changes) and never throws: the IdP has already vouched for the session, so a\n\t * malformed mapping or a transient apply error must not revoke or fail it. A real membership change\n\t * is audited as `idp_role_mapped`; a failure is audited as `idp_role_mapping_failed` (fail-open\n\t * marker), mirroring the sign-in path. `claimsComplete` carries whether the refresh rebuilt sign-in's\n\t * full claim surface (so removal reconciliation is safe) — see `allowRemoval` below.\n\t */\n\tprivate async syncClaims(\n\t\tdbContext: DatabaseContext,\n\t\trow: IdpSessionRow,\n\t\tapiKeyRow: ApiKeyRow,\n\t\tclaims: Record<string, unknown>,\n\t\tclaimsComplete: boolean,\n\t\trequestInfo?: ApiKeyRequestInfo,\n\t): Promise<void> {\n\t\ttry {\n\t\t\tconst mapping = parseClaimMapping(row.providerConfiguration)\n\t\t\tif (!mapping) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// Atomic apply in its own transaction (the verify path has no surrounding one). `always`-only:\n\t\t\t// the sync passes isNewPerson=false, so a `sticky` mapping self-skips and returns a null audit.\n\t\t\t// Refresh mirrors sign-in as closely as the claim surface allows: when the provider returned its\n\t\t\t// COMPLETE surface (`claimsComplete` — `method: \"refresh\"` rebuilding sign-in's id-token + userinfo\n\t\t\t// merge), `unmatched: \"remove\"` reconciliation runs here too. A partial surface (a userinfo-only\n\t\t\t// probe, or a refresh whose userinfo fetch failed) passes `allowRemoval: false`, so refresh stays\n\t\t\t// additive-only and a membership the IdP still asserts is never stripped off an incomplete surface.\n\t\t\tconst { audit, droppedUnsafeRules } = await dbContext.transaction(db =>\n\t\t\t\tthis.claimSyncService.sync(db, mapping, claims, { id: apiKeyRow.identity_id }, false, { allowRemoval: claimsComplete })\n\t\t\t)\n\t\t\tif (audit) {\n\t\t\t\tawait this.logRoleMapping(dbContext, apiKeyRow, row, 'idp_role_mapped', audit, requestInfo)\n\t\t\t}\n\t\t\t// The apply-time safety backstop dropped a configured rule — emit the fail-open marker so a broken\n\t\t\t// mapping is visible on the refresh path too, mirroring sign-in (the marker carries no claim values).\n\t\t\tif (droppedUnsafeRules) {\n\t\t\t\tawait this.logRoleMapping(dbContext, apiKeyRow, row, 'idp_role_mapping_failed', undefined, requestInfo)\n\t\t\t}\n\t\t} catch {\n\t\t\t// Strictly fail-open: a malformed mapping or a transient apply error must never revoke or\n\t\t\t// fail an already-vouched-for session. The transaction rolls back any partial apply.\n\t\t\tawait this.logRoleMapping(dbContext, apiKeyRow, row, 'idp_role_mapping_failed', undefined, requestInfo)\n\t\t}\n\t}\n\n\tprivate async logRoleMapping(\n\t\tdbContext: DatabaseContext,\n\t\tapiKeyRow: ApiKeyRow,\n\t\trow: IdpSessionRow,\n\t\ttype: 'idp_role_mapped' | 'idp_role_mapping_failed',\n\t\teventData: JSONValue | undefined,\n\t\trequestInfo?: ApiKeyRequestInfo,\n\t): Promise<void> {\n\t\ttry {\n\t\t\tawait dbContext.commandBus.execute(\n\t\t\t\tnew CreateAuthLogEntryCommand({\n\t\t\t\t\ttype,\n\t\t\t\t\tinvokedById: apiKeyRow.identity_id,\n\t\t\t\t\tpersonId: apiKeyRow.person_id ?? undefined,\n\t\t\t\t\t// The membership change affects this session's own person — record it as the target too,\n\t\t\t\t\t// so an admin querying membership changes by target_person_id sees IdP-driven grants/revokes\n\t\t\t\t\t// (consistent with the project_membership_* audit events).\n\t\t\t\t\ttargetPersonId: apiKeyRow.person_id ?? undefined,\n\t\t\t\t\tidentityProviderId: row.identityProviderId,\n\t\t\t\t\tpersonTokenId: apiKeyRow.id,\n\t\t\t\t\tsuccess: true,\n\t\t\t\t\teventData,\n\t\t\t\t\tipAddress: requestInfo?.ip,\n\t\t\t\t\tuserAgent: requestInfo?.userAgent,\n\t\t\t\t}),\n\t\t\t)\n\t\t} catch {\n\t\t\t// best-effort audit — never fail the request because the audit write failed\n\t\t}\n\t}\n\n\tprivate async logRevalidated(dbContext: DatabaseContext, apiKeyRow: ApiKeyRow, row: IdpSessionRow, requestInfo?: ApiKeyRequestInfo): Promise<void> {\n\t\tawait dbContext.commandBus.execute(\n\t\t\tnew CreateAuthLogEntryCommand({\n\t\t\t\ttype: 'idp_session_revalidated',\n\t\t\t\tinvokedById: apiKeyRow.identity_id,\n\t\t\t\tpersonId: apiKeyRow.person_id ?? undefined,\n\t\t\t\tidentityProviderId: row.identityProviderId,\n\t\t\t\tpersonTokenId: apiKeyRow.id,\n\t\t\t\tsuccess: true,\n\t\t\t\tipAddress: requestInfo?.ip,\n\t\t\t\tuserAgent: requestInfo?.userAgent,\n\t\t\t}),\n\t\t)\n\t}\n\n\t/**\n\t * Audit a fail-open: the IdP couldn't be consulted (transient outage) or the stored config is\n\t * corrupt, so we kept the session rather than revoking it. Naturally throttled to one entry\n\t * per claim window (we only reach here after a successful claim, which bumps\n\t * `last_validated_at`). The write is best-effort and self-contained — a failure to audit must\n\t * never propagate and fail a blocking verify request (the whole point of failing open).\n\t */\n\tprivate async logRevalidationFailed(\n\t\tdbContext: DatabaseContext,\n\t\tapiKeyRow: ApiKeyRow,\n\t\trow: IdpSessionRow,\n\t\terrorCode: 'config_invalid' | 'revalidation_error',\n\t\trequestInfo?: ApiKeyRequestInfo,\n\t): Promise<void> {\n\t\ttry {\n\t\t\tawait dbContext.commandBus.execute(\n\t\t\t\tnew CreateAuthLogEntryCommand({\n\t\t\t\t\ttype: 'idp_session_revalidation_failed',\n\t\t\t\t\tinvokedById: apiKeyRow.identity_id,\n\t\t\t\t\tpersonId: apiKeyRow.person_id ?? undefined,\n\t\t\t\t\tidentityProviderId: row.identityProviderId,\n\t\t\t\t\tpersonTokenId: apiKeyRow.id,\n\t\t\t\t\t// not a security failure (the session is kept) — a fail-open marker the operator\n\t\t\t\t\t// can alert on. `success: true` keeps it out of the failed-login funnels.\n\t\t\t\t\tsuccess: true,\n\t\t\t\t\terrorCode,\n\t\t\t\t\tipAddress: requestInfo?.ip,\n\t\t\t\t\tuserAgent: requestInfo?.userAgent,\n\t\t\t\t}),\n\t\t\t)\n\t\t} catch {\n\t\t\t// best-effort observability — never fail the request because the audit write failed\n\t\t}\n\t}\n\n\tprivate async revoke(\n\t\tdbContext: DatabaseContext,\n\t\tapiKeyRow: ApiKeyRow,\n\t\trow: IdpSessionRow,\n\t\treason: string,\n\t\trequestInfo?: ApiKeyRequestInfo,\n\t): Promise<void> {\n\t\tawait dbContext.commandBus.execute(new DisableApiKeyCommand(apiKeyRow.id))\n\t\tawait dbContext.commandBus.execute(\n\t\t\tnew CreateAuthLogEntryCommand({\n\t\t\t\ttype: 'idp_session_revoked',\n\t\t\t\tinvokedById: apiKeyRow.identity_id,\n\t\t\t\tpersonId: apiKeyRow.person_id ?? undefined,\n\t\t\t\tidentityProviderId: row.identityProviderId,\n\t\t\t\tpersonTokenId: apiKeyRow.id,\n\t\t\t\tsuccess: false,\n\t\t\t\terrorCode: reason,\n\t\t\t\tipAddress: requestInfo?.ip,\n\t\t\t\tuserAgent: requestInfo?.userAgent,\n\t\t\t\t// the action payload belongs in `event_data` (where every other audit event puts\n\t\t\t\t// it and where the admin UI / AuthLogQueryResolver reads it); `metadata` is for\n\t\t\t\t// transport context (forwarder IP/UA).\n\t\t\t\teventData: { reason },\n\t\t\t}),\n\t\t)\n\t}\n\n\tprivate resolveConfig(configuration: Record<string, unknown>): ResolvedRevalidationConfig {\n\t\tconst raw = (configuration.revalidation ?? {}) as Record<string, unknown>\n\t\tconst threshold = typeof raw.softRefreshThreshold === 'number' && raw.softRefreshThreshold > 0 && raw.softRefreshThreshold <= 1\n\t\t\t? raw.softRefreshThreshold\n\t\t\t: REVALIDATION_DEFAULT_SOFT_THRESHOLD\n\t\treturn {\n\t\t\tenabled: raw.enabled === true,\n\t\t\tsoftThreshold: threshold,\n\t\t\tminInterval: typeof raw.minInterval === 'string' ? raw.minInterval : REVALIDATION_DEFAULT_MIN_INTERVAL,\n\t\t\tfallbackInterval: typeof raw.fallbackInterval === 'string' ? raw.fallbackInterval : REVALIDATION_DEFAULT_FALLBACK_INTERVAL,\n\t\t\tmode: raw.mode === 'blocking' ? 'blocking' : 'auto',\n\t\t}\n\t}\n}\n"],"names":["IdpSessionByApiKeyQuery","ClaimIdpRevalidationCommand","UpdateIdpSessionCommand","parseClaimMapping","CreateAuthLogEntryCommand","DisableApiKeyCommand","REVALIDATION_DEFAULT_SOFT_THRESHOLD","REVALIDATION_DEFAULT_MIN_INTERVAL","REVALIDATION_DEFAULT_FALLBACK_INTERVAL"],"mappings":";;;;;;;;;;;;AA4CO,MAAM,sBAAsB;AAAA,EAClC,YACkB,aACA,kBAChB;AAFgB,SAAA,cAAA;AACA,SAAA,mBAAA;AA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IAAI,uBACJE,gBAAAA;AACH,WAAO;AAAA,MACN,SAAS,IAAI,YAAY;AAAA,MACzB,eAAe;AAAA,MACf,aAAa,OAAO,IAAI,gBAAgB,WAAW,IAAI,cAAcC,gBAAAA;AAAAA,MACrE,kBAAkB,OAAO,IAAI,qBAAqB,WAAW,IAAI,mBAAmBC,gBAAAA;AAAAA,MACpF,MAAM,IAAI,SAAS,aAAa,aAAa;AAAA,IAAA;AAAA,EAE/C;AACD;;"}
|
|
@@ -7,9 +7,11 @@ import "node:crypto";
|
|
|
7
7
|
import { DisableApiKeyCommand } from "../../commands/apiKey/DisableApiKeyCommand.js";
|
|
8
8
|
import { CreateAuthLogEntryCommand } from "../../commands/authLog/CreateAuthLogEntryCommand.js";
|
|
9
9
|
import { REVALIDATION_DEFAULT_SOFT_THRESHOLD, REVALIDATION_DEFAULT_FALLBACK_INTERVAL, REVALIDATION_DEFAULT_MIN_INTERVAL } from "./IDPRevalidation.js";
|
|
10
|
+
import { parseClaimMapping } from "./ClaimMapping.js";
|
|
10
11
|
class IdpSessionRevalidator {
|
|
11
|
-
constructor(idpRegistry) {
|
|
12
|
+
constructor(idpRegistry, claimSyncService) {
|
|
12
13
|
this.idpRegistry = idpRegistry;
|
|
14
|
+
this.claimSyncService = claimSyncService;
|
|
13
15
|
}
|
|
14
16
|
async revalidate(dbContext, readDbContext, apiKeyRow, requestInfo) {
|
|
15
17
|
const row = await readDbContext.queryHandler.fetch(new IdpSessionByApiKeyQuery(apiKeyRow.id, readDbContext.providers));
|
|
@@ -95,8 +97,60 @@ class IdpSessionRevalidator {
|
|
|
95
97
|
} catch {
|
|
96
98
|
}
|
|
97
99
|
}
|
|
100
|
+
if (result.claims) {
|
|
101
|
+
await this.syncClaims(dbContext, row, apiKeyRow, result.claims, result.claimsComplete === true, requestInfo);
|
|
102
|
+
}
|
|
98
103
|
return "valid";
|
|
99
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* Re-apply the claim mapping on a successful refresh. Runs in its own transaction (atomic apply of
|
|
107
|
+
* the membership changes) and never throws: the IdP has already vouched for the session, so a
|
|
108
|
+
* malformed mapping or a transient apply error must not revoke or fail it. A real membership change
|
|
109
|
+
* is audited as `idp_role_mapped`; a failure is audited as `idp_role_mapping_failed` (fail-open
|
|
110
|
+
* marker), mirroring the sign-in path. `claimsComplete` carries whether the refresh rebuilt sign-in's
|
|
111
|
+
* full claim surface (so removal reconciliation is safe) — see `allowRemoval` below.
|
|
112
|
+
*/
|
|
113
|
+
async syncClaims(dbContext, row, apiKeyRow, claims, claimsComplete, requestInfo) {
|
|
114
|
+
try {
|
|
115
|
+
const mapping = parseClaimMapping(row.providerConfiguration);
|
|
116
|
+
if (!mapping) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
const { audit, droppedUnsafeRules } = await dbContext.transaction(
|
|
120
|
+
(db) => this.claimSyncService.sync(db, mapping, claims, { id: apiKeyRow.identity_id }, false, { allowRemoval: claimsComplete })
|
|
121
|
+
);
|
|
122
|
+
if (audit) {
|
|
123
|
+
await this.logRoleMapping(dbContext, apiKeyRow, row, "idp_role_mapped", audit, requestInfo);
|
|
124
|
+
}
|
|
125
|
+
if (droppedUnsafeRules) {
|
|
126
|
+
await this.logRoleMapping(dbContext, apiKeyRow, row, "idp_role_mapping_failed", void 0, requestInfo);
|
|
127
|
+
}
|
|
128
|
+
} catch {
|
|
129
|
+
await this.logRoleMapping(dbContext, apiKeyRow, row, "idp_role_mapping_failed", void 0, requestInfo);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
async logRoleMapping(dbContext, apiKeyRow, row, type, eventData, requestInfo) {
|
|
133
|
+
try {
|
|
134
|
+
await dbContext.commandBus.execute(
|
|
135
|
+
new CreateAuthLogEntryCommand({
|
|
136
|
+
type,
|
|
137
|
+
invokedById: apiKeyRow.identity_id,
|
|
138
|
+
personId: apiKeyRow.person_id ?? void 0,
|
|
139
|
+
// The membership change affects this session's own person — record it as the target too,
|
|
140
|
+
// so an admin querying membership changes by target_person_id sees IdP-driven grants/revokes
|
|
141
|
+
// (consistent with the project_membership_* audit events).
|
|
142
|
+
targetPersonId: apiKeyRow.person_id ?? void 0,
|
|
143
|
+
identityProviderId: row.identityProviderId,
|
|
144
|
+
personTokenId: apiKeyRow.id,
|
|
145
|
+
success: true,
|
|
146
|
+
eventData,
|
|
147
|
+
ipAddress: requestInfo?.ip,
|
|
148
|
+
userAgent: requestInfo?.userAgent
|
|
149
|
+
})
|
|
150
|
+
);
|
|
151
|
+
} catch {
|
|
152
|
+
}
|
|
153
|
+
}
|
|
100
154
|
async logRevalidated(dbContext, apiKeyRow, row, requestInfo) {
|
|
101
155
|
await dbContext.commandBus.execute(
|
|
102
156
|
new CreateAuthLogEntryCommand({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IdpSessionRevalidator.js","sources":["../../../../../../../packages/engine-tenant-api/src/model/service/idp/IdpSessionRevalidator.ts"],"sourcesContent":["import { DatabaseContext } from '../../utils/index.js'\nimport { ApiKeyRequestInfo } from '../../commands/index.js'\nimport { ApiKeyRow } from '../../queries/apiKey/ApiKeyQuery.js'\nimport { IdpSessionByApiKeyQuery, IdpSessionRow } from '../../queries/idp/IdpSessionByApiKeyQuery.js'\nimport { IDPHandlerRegistry } from './IDPHandlerRegistry.js'\nimport { ClaimIdpRevalidationCommand } from '../../commands/idp/ClaimIdpRevalidationCommand.js'\nimport { UpdateIdpSessionCommand } from '../../commands/idp/UpdateIdpSessionCommand.js'\nimport { DisableApiKeyCommand } from '../../commands/index.js'\nimport { CreateAuthLogEntryCommand } from '../../commands/authLog/CreateAuthLogEntryCommand.js'\nimport { REVALIDATION_DEFAULT_FALLBACK_INTERVAL, REVALIDATION_DEFAULT_MIN_INTERVAL, REVALIDATION_DEFAULT_SOFT_THRESHOLD } from './IDPRevalidation.js'\nimport { IdentityProviderHandler, RevalidationResult } from './IdentityProviderHandler.js'\n\nexport type RevalidationOutcome = 'valid' | 'revoked'\n\ntype ResolvedRevalidationConfig = {\n\tenabled: boolean\n\tsoftThreshold: number\n\tminInterval: string\n\tfallbackInterval: string\n\tmode: 'auto' | 'blocking'\n}\n\n/**\n * Decision for the current request: whether to attempt a revalidation, and if so whether it\n * must block the request. `claimInterval` is the single-flight floor for the atomic claim.\n */\ntype Decision = null | { blocking: boolean; claimInterval: string }\n\n/**\n * Re-validates IdP-backed sessions against their identity provider on the verify hot path\n * (A24). Invoked from `ApiKeyManager.verifyAndProlong`. Operates entirely through the supplied\n * database contexts and the command bus, so it does not depend on `ApiKeyManager` (no DI cycle).\n *\n * The cadence is driven by the **access-token lifetime**, not a fixed interval:\n * - while the token is fresh (before `softRefreshThreshold` of its lifetime) → skip, free;\n * - past the threshold but not yet expired → a proactive **background (SWR)** refresh, so the\n * request keeps zero added latency and the token is renewed before it dies;\n * - once the token has actually expired → a **blocking** refresh (we can't serve a dead token).\n * `mode: 'blocking'` forces every revalidation synchronous (zero revocation lag). When the IdP\n * returns no token expiry, falls back to a plain `fallbackInterval` background throttle.\n */\nexport class IdpSessionRevalidator {\n\tconstructor(\n\t\tprivate readonly idpRegistry: IDPHandlerRegistry,\n\t) {\n\t}\n\n\tasync revalidate(\n\t\tdbContext: DatabaseContext,\n\t\treadDbContext: DatabaseContext,\n\t\tapiKeyRow: ApiKeyRow,\n\t\trequestInfo?: ApiKeyRequestInfo,\n\t): Promise<RevalidationOutcome> {\n\t\tconst row = await readDbContext.queryHandler.fetch(new IdpSessionByApiKeyQuery(apiKeyRow.id, readDbContext.providers))\n\t\tif (!row) {\n\t\t\t// not a federated session (password / IdP without revalidation) — fast no-op\n\t\t\treturn 'valid'\n\t\t}\n\n\t\tconst config = this.resolveConfig(row.providerConfiguration)\n\t\tif (!config.enabled) {\n\t\t\treturn 'valid'\n\t\t}\n\n\t\t// A disabled IdP no longer vouches for its sessions.\n\t\tif (row.providerDisabledAt) {\n\t\t\tawait this.revoke(dbContext, apiKeyRow, row, 'idp_disabled', requestInfo)\n\t\t\treturn 'revoked'\n\t\t}\n\n\t\tconst handler = this.idpRegistry.getHandlerOrNull(row.providerType)\n\t\tif (!handler?.revalidate) {\n\t\t\t// provider can't actively re-validate (e.g. SAML) — rely on expiry / SLO\n\t\t\treturn 'valid'\n\t\t}\n\n\t\tconst decision = this.decide(row, config, dbContext.providers.now())\n\t\tif (!decision) {\n\t\t\t// token still fresh — vouched for, no IdP call\n\t\t\treturn 'valid'\n\t\t}\n\n\t\t// Atomic claim = single-flight. Loser (within the floor window, or lost the race) serves stale.\n\t\tlet claimed: boolean\n\t\ttry {\n\t\t\tclaimed = await dbContext.commandBus.execute(new ClaimIdpRevalidationCommand(row.id, decision.claimInterval))\n\t\t} catch {\n\t\t\t// invalid interval string or transient DB error — fail open, retry next request\n\t\t\treturn 'valid'\n\t\t}\n\t\tif (!claimed) {\n\t\t\treturn 'valid'\n\t\t}\n\n\t\tif (decision.blocking) {\n\t\t\treturn await this.runRevalidation(dbContext, handler, row, apiKeyRow, requestInfo)\n\t\t}\n\n\t\t// SWR: serve this request from the (still valid) token, refresh after the response.\n\t\t// The work runs detached (after the response is sent), so any rejection — a transient\n\t\t// DB error in the revoke / persist writes, a corrupt-config throw — must be swallowed\n\t\t// here; otherwise it becomes an unhandledRejection and can take the worker down. The\n\t\t// session is simply kept and re-tried on a later request (the claim floor throttles).\n\t\tsetImmediate(() => {\n\t\t\tthis.runRevalidation(dbContext, handler, row, apiKeyRow, requestInfo).catch(() => {})\n\t\t})\n\t\treturn 'valid'\n\t}\n\n\t/**\n\t * Decide whether (and how) to revalidate, purely from timestamps — no interval parsing in\n\t * JS (the claim handles intervals in SQL). Returns null to skip.\n\t */\n\tprivate decide(row: IdpSessionRow, config: ResolvedRevalidationConfig, now: Date): Decision {\n\t\tconst expiresAt = row.session.expiresAt\n\t\tconst obtainedAt = row.tokenObtainedAt\n\n\t\t// No lifetime info from the IdP → plain background throttle on fallbackInterval.\n\t\tif (!expiresAt || !obtainedAt) {\n\t\t\treturn { blocking: config.mode === 'blocking', claimInterval: config.fallbackInterval }\n\t\t}\n\n\t\tconst lifetimeMs = expiresAt.getTime() - obtainedAt.getTime()\n\t\tconst softAtMs = obtainedAt.getTime() + lifetimeMs * config.softThreshold\n\t\tconst nowMs = now.getTime()\n\n\t\tif (nowMs < softAtMs) {\n\t\t\treturn null // still within the trusted window\n\t\t}\n\n\t\tconst expired = nowMs >= expiresAt.getTime()\n\t\treturn { blocking: config.mode === 'blocking' || expired, claimInterval: config.minInterval }\n\t}\n\n\tprivate async runRevalidation(\n\t\tdbContext: DatabaseContext,\n\t\thandler: IdentityProviderHandler<{}>,\n\t\trow: IdpSessionRow,\n\t\tapiKeyRow: ApiKeyRow,\n\t\trequestInfo?: ApiKeyRequestInfo,\n\t): Promise<RevalidationOutcome> {\n\t\tlet config: {}\n\t\ttry {\n\t\t\tconfig = handler.validateConfiguration(row.providerConfiguration)\n\t\t} catch {\n\t\t\t// corrupt stored config — must NOT revoke; keep the session and retry later. Audit\n\t\t\t// it so the operator can tell \"vouched for\" apart from \"silently broken\" (without an\n\t\t\t// entry, a config typo disables re-validation invisibly for the life of every session).\n\t\t\tawait this.logRevalidationFailed(dbContext, apiKeyRow, row, 'config_invalid', requestInfo)\n\t\t\treturn 'valid'\n\t\t}\n\n\t\tlet result: RevalidationResult\n\t\ttry {\n\t\t\tresult = await handler.revalidate!(config, row.session)\n\t\t} catch {\n\t\t\t// transient failure (network / IdP down) — must NOT revoke; keep the session and retry\n\t\t\t// on a later request (the claim floor prevents hammering the IdP). Audited (throttled\n\t\t\t// to one entry per claim window) so a prolonged IdP outage is visible rather than a\n\t\t\t// silent fail-open.\n\t\t\tawait this.logRevalidationFailed(dbContext, apiKeyRow, row, 'revalidation_error', requestInfo)\n\t\t\treturn 'valid'\n\t\t}\n\n\t\tif (result.status === 'revoked') {\n\t\t\tawait this.revoke(dbContext, apiKeyRow, row, result.reason, requestInfo)\n\t\t\treturn 'revoked'\n\t\t}\n\n\t\t// Still valid — persist the rotated token (resets the lifetime reference) / refreshed\n\t\t// expiry. A rotation is a real, low-frequency event (token-lifetime cadence), so we\n\t\t// audit it as `idp_session_revalidated`; the no-op userinfo/introspection probes\n\t\t// (no rotated session) are intentionally NOT logged to keep the audit log usable.\n\t\t//\n\t\t// The IdP has already vouched for the session, so these post-success writes are pure\n\t\t// best-effort bookkeeping (they only reset the SWR cadence reference). A transient DB\n\t\t// error or an `encrypt()` throw here must NOT fail the request — otherwise a blocking\n\t\t// revalidation fails closed on a successful refresh, contradicting \"fail open\" (the SWR\n\t\t// path already swallows this). Keep the existing row; the claim floor throttles a retry.\n\t\tif (result.idpSession) {\n\t\t\ttry {\n\t\t\t\tawait dbContext.commandBus.execute(new UpdateIdpSessionCommand(row.id, result.idpSession))\n\t\t\t\tawait this.logRevalidated(dbContext, apiKeyRow, row, requestInfo)\n\t\t\t} catch {\n\t\t\t\t// fall through — session stays valid, persist retried on a later request\n\t\t\t}\n\t\t}\n\t\treturn 'valid'\n\t}\n\n\tprivate async logRevalidated(dbContext: DatabaseContext, apiKeyRow: ApiKeyRow, row: IdpSessionRow, requestInfo?: ApiKeyRequestInfo): Promise<void> {\n\t\tawait dbContext.commandBus.execute(\n\t\t\tnew CreateAuthLogEntryCommand({\n\t\t\t\ttype: 'idp_session_revalidated',\n\t\t\t\tinvokedById: apiKeyRow.identity_id,\n\t\t\t\tpersonId: apiKeyRow.person_id ?? undefined,\n\t\t\t\tidentityProviderId: row.identityProviderId,\n\t\t\t\tpersonTokenId: apiKeyRow.id,\n\t\t\t\tsuccess: true,\n\t\t\t\tipAddress: requestInfo?.ip,\n\t\t\t\tuserAgent: requestInfo?.userAgent,\n\t\t\t}),\n\t\t)\n\t}\n\n\t/**\n\t * Audit a fail-open: the IdP couldn't be consulted (transient outage) or the stored config is\n\t * corrupt, so we kept the session rather than revoking it. Naturally throttled to one entry\n\t * per claim window (we only reach here after a successful claim, which bumps\n\t * `last_validated_at`). The write is best-effort and self-contained — a failure to audit must\n\t * never propagate and fail a blocking verify request (the whole point of failing open).\n\t */\n\tprivate async logRevalidationFailed(\n\t\tdbContext: DatabaseContext,\n\t\tapiKeyRow: ApiKeyRow,\n\t\trow: IdpSessionRow,\n\t\terrorCode: 'config_invalid' | 'revalidation_error',\n\t\trequestInfo?: ApiKeyRequestInfo,\n\t): Promise<void> {\n\t\ttry {\n\t\t\tawait dbContext.commandBus.execute(\n\t\t\t\tnew CreateAuthLogEntryCommand({\n\t\t\t\t\ttype: 'idp_session_revalidation_failed',\n\t\t\t\t\tinvokedById: apiKeyRow.identity_id,\n\t\t\t\t\tpersonId: apiKeyRow.person_id ?? undefined,\n\t\t\t\t\tidentityProviderId: row.identityProviderId,\n\t\t\t\t\tpersonTokenId: apiKeyRow.id,\n\t\t\t\t\t// not a security failure (the session is kept) — a fail-open marker the operator\n\t\t\t\t\t// can alert on. `success: true` keeps it out of the failed-login funnels.\n\t\t\t\t\tsuccess: true,\n\t\t\t\t\terrorCode,\n\t\t\t\t\tipAddress: requestInfo?.ip,\n\t\t\t\t\tuserAgent: requestInfo?.userAgent,\n\t\t\t\t}),\n\t\t\t)\n\t\t} catch {\n\t\t\t// best-effort observability — never fail the request because the audit write failed\n\t\t}\n\t}\n\n\tprivate async revoke(\n\t\tdbContext: DatabaseContext,\n\t\tapiKeyRow: ApiKeyRow,\n\t\trow: IdpSessionRow,\n\t\treason: string,\n\t\trequestInfo?: ApiKeyRequestInfo,\n\t): Promise<void> {\n\t\tawait dbContext.commandBus.execute(new DisableApiKeyCommand(apiKeyRow.id))\n\t\tawait dbContext.commandBus.execute(\n\t\t\tnew CreateAuthLogEntryCommand({\n\t\t\t\ttype: 'idp_session_revoked',\n\t\t\t\tinvokedById: apiKeyRow.identity_id,\n\t\t\t\tpersonId: apiKeyRow.person_id ?? undefined,\n\t\t\t\tidentityProviderId: row.identityProviderId,\n\t\t\t\tpersonTokenId: apiKeyRow.id,\n\t\t\t\tsuccess: false,\n\t\t\t\terrorCode: reason,\n\t\t\t\tipAddress: requestInfo?.ip,\n\t\t\t\tuserAgent: requestInfo?.userAgent,\n\t\t\t\t// the action payload belongs in `event_data` (where every other audit event puts\n\t\t\t\t// it and where the admin UI / AuthLogQueryResolver reads it); `metadata` is for\n\t\t\t\t// transport context (forwarder IP/UA).\n\t\t\t\teventData: { reason },\n\t\t\t}),\n\t\t)\n\t}\n\n\tprivate resolveConfig(configuration: Record<string, unknown>): ResolvedRevalidationConfig {\n\t\tconst raw = (configuration.revalidation ?? {}) as Record<string, unknown>\n\t\tconst threshold = typeof raw.softRefreshThreshold === 'number' && raw.softRefreshThreshold > 0 && raw.softRefreshThreshold <= 1\n\t\t\t? raw.softRefreshThreshold\n\t\t\t: REVALIDATION_DEFAULT_SOFT_THRESHOLD\n\t\treturn {\n\t\t\tenabled: raw.enabled === true,\n\t\t\tsoftThreshold: threshold,\n\t\t\tminInterval: typeof raw.minInterval === 'string' ? raw.minInterval : REVALIDATION_DEFAULT_MIN_INTERVAL,\n\t\t\tfallbackInterval: typeof raw.fallbackInterval === 'string' ? raw.fallbackInterval : REVALIDATION_DEFAULT_FALLBACK_INTERVAL,\n\t\t\tmode: raw.mode === 'blocking' ? 'blocking' : 'auto',\n\t\t}\n\t}\n}\n"],"names":[],"mappings":";;;;;;;;;AAyCO,MAAM,sBAAsB;AAAA,EAClC,YACkB,aAChB;AADgB,SAAA,cAAA;AAAA,EAElB;AAAA,EAEA,MAAM,WACL,WACA,eACA,WACA,aAC+B;AAC/B,UAAM,MAAM,MAAM,cAAc,aAAa,MAAM,IAAI,wBAAwB,UAAU,IAAI,cAAc,SAAS,CAAC;AACrH,QAAI,CAAC,KAAK;AAET,aAAO;AAAA,IACR;AAEA,UAAM,SAAS,KAAK,cAAc,IAAI,qBAAqB;AAC3D,QAAI,CAAC,OAAO,SAAS;AACpB,aAAO;AAAA,IACR;AAGA,QAAI,IAAI,oBAAoB;AAC3B,YAAM,KAAK,OAAO,WAAW,WAAW,KAAK,gBAAgB,WAAW;AACxE,aAAO;AAAA,IACR;AAEA,UAAM,UAAU,KAAK,YAAY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AAAA,UACxB,eAAe,UAAU;AAAA;AAAA;AAAA,UAGzB,SAAS;AAAA,UACT;AAAA,UACA,WAAW,aAAa;AAAA,UACxB,WAAW,aAAa;AAAA,QAAA,CACxB;AAAA,MAAA;AAAA,IAEH,QAAQ;AAAA,IAER;AAAA,EACD;AAAA,EAEA,MAAc,OACb,WACA,WACA,KACA,QACA,aACgB;AAChB,UAAM,UAAU,WAAW,QAAQ,IAAI,qBAAqB,UAAU,EAAE,CAAC;AACzE,UAAM,UAAU,WAAW;AAAA,MAC1B,IAAI,0BAA0B;AAAA,QAC7B,MAAM;AAAA,QACN,aAAa,UAAU;AAAA,QACvB,UAAU,UAAU,aAAa;AAAA,QACjC,oBAAoB,IAAI;AAAA,QACxB,eAAe,UAAU;AAAA,QACzB,SAAS;AAAA,QACT,WAAW;AAAA,QACX,WAAW,aAAa;AAAA,QACxB,WAAW,aAAa;AAAA;AAAA;AAAA;AAAA,QAIxB,WAAW,EAAE,OAAA;AAAA,MAAO,CACpB;AAAA,IAAA;AAAA,EAEH;AAAA,EAEQ,cAAc,eAAoE;AACzF,UAAM,MAAO,cAAc,gBAAgB,CAAA;AAC3C,UAAM,YAAY,OAAO,IAAI,yBAAyB,YAAY,IAAI,uBAAuB,KAAK,IAAI,wBAAwB,IAC3H,IAAI,uBACJ;AACH,WAAO;AAAA,MACN,SAAS,IAAI,YAAY;AAAA,MACzB,eAAe;AAAA,MACf,aAAa,OAAO,IAAI,gBAAgB,WAAW,IAAI,cAAc;AAAA,MACrE,kBAAkB,OAAO,IAAI,qBAAqB,WAAW,IAAI,mBAAmB;AAAA,MACpF,MAAM,IAAI,SAAS,aAAa,aAAa;AAAA,IAAA;AAAA,EAE/C;AACD;"}
|
|
1
|
+
{"version":3,"file":"IdpSessionRevalidator.js","sources":["../../../../../../../packages/engine-tenant-api/src/model/service/idp/IdpSessionRevalidator.ts"],"sourcesContent":["import { DatabaseContext } from '../../utils/index.js'\nimport { ApiKeyRequestInfo } from '../../commands/index.js'\nimport { ApiKeyRow } from '../../queries/apiKey/ApiKeyQuery.js'\nimport { IdpSessionByApiKeyQuery, IdpSessionRow } from '../../queries/idp/IdpSessionByApiKeyQuery.js'\nimport { IDPHandlerRegistry } from './IDPHandlerRegistry.js'\nimport { ClaimIdpRevalidationCommand } from '../../commands/idp/ClaimIdpRevalidationCommand.js'\nimport { UpdateIdpSessionCommand } from '../../commands/idp/UpdateIdpSessionCommand.js'\nimport { DisableApiKeyCommand } from '../../commands/index.js'\nimport { CreateAuthLogEntryCommand } from '../../commands/authLog/CreateAuthLogEntryCommand.js'\nimport { REVALIDATION_DEFAULT_FALLBACK_INTERVAL, REVALIDATION_DEFAULT_MIN_INTERVAL, REVALIDATION_DEFAULT_SOFT_THRESHOLD } from './IDPRevalidation.js'\nimport { IdentityProviderHandler, RevalidationResult } from './IdentityProviderHandler.js'\nimport { IDPClaimSyncService } from './IDPClaimSyncService.js'\nimport { parseClaimMapping } from './ClaimMapping.js'\nimport { JSONValue } from '@contember/schema'\n\nexport type RevalidationOutcome = 'valid' | 'revoked'\n\ntype ResolvedRevalidationConfig = {\n\tenabled: boolean\n\tsoftThreshold: number\n\tminInterval: string\n\tfallbackInterval: string\n\tmode: 'auto' | 'blocking'\n}\n\n/**\n * Decision for the current request: whether to attempt a revalidation, and if so whether it\n * must block the request. `claimInterval` is the single-flight floor for the atomic claim.\n */\ntype Decision = null | { blocking: boolean; claimInterval: string }\n\n/**\n * Re-validates IdP-backed sessions against their identity provider on the verify hot path\n * (A24). Invoked from `ApiKeyManager.verifyAndProlong`. Operates entirely through the supplied\n * database contexts and the command bus, so it does not depend on `ApiKeyManager` (no DI cycle).\n *\n * The cadence is driven by the **access-token lifetime**, not a fixed interval:\n * - while the token is fresh (before `softRefreshThreshold` of its lifetime) → skip, free;\n * - past the threshold but not yet expired → a proactive **background (SWR)** refresh, so the\n * request keeps zero added latency and the token is renewed before it dies;\n * - once the token has actually expired → a **blocking** refresh (we can't serve a dead token).\n * `mode: 'blocking'` forces every revalidation synchronous (zero revocation lag). When the IdP\n * returns no token expiry, falls back to a plain `fallbackInterval` background throttle.\n */\nexport class IdpSessionRevalidator {\n\tconstructor(\n\t\tprivate readonly idpRegistry: IDPHandlerRegistry,\n\t\tprivate readonly claimSyncService: IDPClaimSyncService,\n\t) {\n\t}\n\n\tasync revalidate(\n\t\tdbContext: DatabaseContext,\n\t\treadDbContext: DatabaseContext,\n\t\tapiKeyRow: ApiKeyRow,\n\t\trequestInfo?: ApiKeyRequestInfo,\n\t): Promise<RevalidationOutcome> {\n\t\tconst row = await readDbContext.queryHandler.fetch(new IdpSessionByApiKeyQuery(apiKeyRow.id, readDbContext.providers))\n\t\tif (!row) {\n\t\t\t// not a federated session (password / IdP without revalidation) — fast no-op\n\t\t\treturn 'valid'\n\t\t}\n\n\t\tconst config = this.resolveConfig(row.providerConfiguration)\n\t\tif (!config.enabled) {\n\t\t\treturn 'valid'\n\t\t}\n\n\t\t// A disabled IdP no longer vouches for its sessions.\n\t\tif (row.providerDisabledAt) {\n\t\t\tawait this.revoke(dbContext, apiKeyRow, row, 'idp_disabled', requestInfo)\n\t\t\treturn 'revoked'\n\t\t}\n\n\t\tconst handler = this.idpRegistry.getHandlerOrNull(row.providerType)\n\t\tif (!handler?.revalidate) {\n\t\t\t// provider can't actively re-validate (e.g. SAML) — rely on expiry / SLO\n\t\t\treturn 'valid'\n\t\t}\n\n\t\tconst decision = this.decide(row, config, dbContext.providers.now())\n\t\tif (!decision) {\n\t\t\t// token still fresh — vouched for, no IdP call\n\t\t\treturn 'valid'\n\t\t}\n\n\t\t// Atomic claim = single-flight. Loser (within the floor window, or lost the race) serves stale.\n\t\tlet claimed: boolean\n\t\ttry {\n\t\t\tclaimed = await dbContext.commandBus.execute(new ClaimIdpRevalidationCommand(row.id, decision.claimInterval))\n\t\t} catch {\n\t\t\t// invalid interval string or transient DB error — fail open, retry next request\n\t\t\treturn 'valid'\n\t\t}\n\t\tif (!claimed) {\n\t\t\treturn 'valid'\n\t\t}\n\n\t\tif (decision.blocking) {\n\t\t\treturn await this.runRevalidation(dbContext, handler, row, apiKeyRow, requestInfo)\n\t\t}\n\n\t\t// SWR: serve this request from the (still valid) token, refresh after the response.\n\t\t// The work runs detached (after the response is sent), so any rejection — a transient\n\t\t// DB error in the revoke / persist writes, a corrupt-config throw — must be swallowed\n\t\t// here; otherwise it becomes an unhandledRejection and can take the worker down. The\n\t\t// session is simply kept and re-tried on a later request (the claim floor throttles).\n\t\tsetImmediate(() => {\n\t\t\tthis.runRevalidation(dbContext, handler, row, apiKeyRow, requestInfo).catch(() => {})\n\t\t})\n\t\treturn 'valid'\n\t}\n\n\t/**\n\t * Decide whether (and how) to revalidate, purely from timestamps — no interval parsing in\n\t * JS (the claim handles intervals in SQL). Returns null to skip.\n\t */\n\tprivate decide(row: IdpSessionRow, config: ResolvedRevalidationConfig, now: Date): Decision {\n\t\tconst expiresAt = row.session.expiresAt\n\t\tconst obtainedAt = row.tokenObtainedAt\n\n\t\t// No lifetime info from the IdP → plain background throttle on fallbackInterval.\n\t\tif (!expiresAt || !obtainedAt) {\n\t\t\treturn { blocking: config.mode === 'blocking', claimInterval: config.fallbackInterval }\n\t\t}\n\n\t\tconst lifetimeMs = expiresAt.getTime() - obtainedAt.getTime()\n\t\tconst softAtMs = obtainedAt.getTime() + lifetimeMs * config.softThreshold\n\t\tconst nowMs = now.getTime()\n\n\t\tif (nowMs < softAtMs) {\n\t\t\treturn null // still within the trusted window\n\t\t}\n\n\t\tconst expired = nowMs >= expiresAt.getTime()\n\t\treturn { blocking: config.mode === 'blocking' || expired, claimInterval: config.minInterval }\n\t}\n\n\tprivate async runRevalidation(\n\t\tdbContext: DatabaseContext,\n\t\thandler: IdentityProviderHandler<{}>,\n\t\trow: IdpSessionRow,\n\t\tapiKeyRow: ApiKeyRow,\n\t\trequestInfo?: ApiKeyRequestInfo,\n\t): Promise<RevalidationOutcome> {\n\t\tlet config: {}\n\t\ttry {\n\t\t\tconfig = handler.validateConfiguration(row.providerConfiguration)\n\t\t} catch {\n\t\t\t// corrupt stored config — must NOT revoke; keep the session and retry later. Audit\n\t\t\t// it so the operator can tell \"vouched for\" apart from \"silently broken\" (without an\n\t\t\t// entry, a config typo disables re-validation invisibly for the life of every session).\n\t\t\tawait this.logRevalidationFailed(dbContext, apiKeyRow, row, 'config_invalid', requestInfo)\n\t\t\treturn 'valid'\n\t\t}\n\n\t\tlet result: RevalidationResult\n\t\ttry {\n\t\t\tresult = await handler.revalidate!(config, row.session)\n\t\t} catch {\n\t\t\t// transient failure (network / IdP down) — must NOT revoke; keep the session and retry\n\t\t\t// on a later request (the claim floor prevents hammering the IdP). Audited (throttled\n\t\t\t// to one entry per claim window) so a prolonged IdP outage is visible rather than a\n\t\t\t// silent fail-open.\n\t\t\tawait this.logRevalidationFailed(dbContext, apiKeyRow, row, 'revalidation_error', requestInfo)\n\t\t\treturn 'valid'\n\t\t}\n\n\t\tif (result.status === 'revoked') {\n\t\t\tawait this.revoke(dbContext, apiKeyRow, row, result.reason, requestInfo)\n\t\t\treturn 'revoked'\n\t\t}\n\n\t\t// Still valid — persist the rotated token (resets the lifetime reference) / refreshed\n\t\t// expiry. A rotation is a real, low-frequency event (token-lifetime cadence), so we\n\t\t// audit it as `idp_session_revalidated`; the no-op userinfo/introspection probes\n\t\t// (no rotated session) are intentionally NOT logged to keep the audit log usable.\n\t\t//\n\t\t// The IdP has already vouched for the session, so these post-success writes are pure\n\t\t// best-effort bookkeeping (they only reset the SWR cadence reference). A transient DB\n\t\t// error or an `encrypt()` throw here must NOT fail the request — otherwise a blocking\n\t\t// revalidation fails closed on a successful refresh, contradicting \"fail open\" (the SWR\n\t\t// path already swallows this). Keep the existing row; the claim floor throttles a retry.\n\t\tif (result.idpSession) {\n\t\t\ttry {\n\t\t\t\tawait dbContext.commandBus.execute(new UpdateIdpSessionCommand(row.id, result.idpSession))\n\t\t\t\tawait this.logRevalidated(dbContext, apiKeyRow, row, requestInfo)\n\t\t\t} catch {\n\t\t\t\t// fall through — session stays valid, persist retried on a later request\n\t\t\t}\n\t\t}\n\n\t\t// A09 — re-apply the IdP's claim mapping when the refresh returned fresh claims, so an `always`\n\t\t// mapping keeps an established session's project memberships in sync with the IdP's current claims\n\t\t// without requiring a full re-login. `sticky` mappings self-skip (the sync passes isNewPerson=false).\n\t\t// `claimsComplete` tells the sync whether the refresh rebuilt sign-in's full claim surface, so it can\n\t\t// reconcile (incl. `unmatched: \"remove\"`) exactly like sign-in. Strictly fail-open — see `syncClaims`.\n\t\tif (result.claims) {\n\t\t\tawait this.syncClaims(dbContext, row, apiKeyRow, result.claims, result.claimsComplete === true, requestInfo)\n\t\t}\n\t\treturn 'valid'\n\t}\n\n\t/**\n\t * Re-apply the claim mapping on a successful refresh. Runs in its own transaction (atomic apply of\n\t * the membership changes) and never throws: the IdP has already vouched for the session, so a\n\t * malformed mapping or a transient apply error must not revoke or fail it. A real membership change\n\t * is audited as `idp_role_mapped`; a failure is audited as `idp_role_mapping_failed` (fail-open\n\t * marker), mirroring the sign-in path. `claimsComplete` carries whether the refresh rebuilt sign-in's\n\t * full claim surface (so removal reconciliation is safe) — see `allowRemoval` below.\n\t */\n\tprivate async syncClaims(\n\t\tdbContext: DatabaseContext,\n\t\trow: IdpSessionRow,\n\t\tapiKeyRow: ApiKeyRow,\n\t\tclaims: Record<string, unknown>,\n\t\tclaimsComplete: boolean,\n\t\trequestInfo?: ApiKeyRequestInfo,\n\t): Promise<void> {\n\t\ttry {\n\t\t\tconst mapping = parseClaimMapping(row.providerConfiguration)\n\t\t\tif (!mapping) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// Atomic apply in its own transaction (the verify path has no surrounding one). `always`-only:\n\t\t\t// the sync passes isNewPerson=false, so a `sticky` mapping self-skips and returns a null audit.\n\t\t\t// Refresh mirrors sign-in as closely as the claim surface allows: when the provider returned its\n\t\t\t// COMPLETE surface (`claimsComplete` — `method: \"refresh\"` rebuilding sign-in's id-token + userinfo\n\t\t\t// merge), `unmatched: \"remove\"` reconciliation runs here too. A partial surface (a userinfo-only\n\t\t\t// probe, or a refresh whose userinfo fetch failed) passes `allowRemoval: false`, so refresh stays\n\t\t\t// additive-only and a membership the IdP still asserts is never stripped off an incomplete surface.\n\t\t\tconst { audit, droppedUnsafeRules } = await dbContext.transaction(db =>\n\t\t\t\tthis.claimSyncService.sync(db, mapping, claims, { id: apiKeyRow.identity_id }, false, { allowRemoval: claimsComplete })\n\t\t\t)\n\t\t\tif (audit) {\n\t\t\t\tawait this.logRoleMapping(dbContext, apiKeyRow, row, 'idp_role_mapped', audit, requestInfo)\n\t\t\t}\n\t\t\t// The apply-time safety backstop dropped a configured rule — emit the fail-open marker so a broken\n\t\t\t// mapping is visible on the refresh path too, mirroring sign-in (the marker carries no claim values).\n\t\t\tif (droppedUnsafeRules) {\n\t\t\t\tawait this.logRoleMapping(dbContext, apiKeyRow, row, 'idp_role_mapping_failed', undefined, requestInfo)\n\t\t\t}\n\t\t} catch {\n\t\t\t// Strictly fail-open: a malformed mapping or a transient apply error must never revoke or\n\t\t\t// fail an already-vouched-for session. The transaction rolls back any partial apply.\n\t\t\tawait this.logRoleMapping(dbContext, apiKeyRow, row, 'idp_role_mapping_failed', undefined, requestInfo)\n\t\t}\n\t}\n\n\tprivate async logRoleMapping(\n\t\tdbContext: DatabaseContext,\n\t\tapiKeyRow: ApiKeyRow,\n\t\trow: IdpSessionRow,\n\t\ttype: 'idp_role_mapped' | 'idp_role_mapping_failed',\n\t\teventData: JSONValue | undefined,\n\t\trequestInfo?: ApiKeyRequestInfo,\n\t): Promise<void> {\n\t\ttry {\n\t\t\tawait dbContext.commandBus.execute(\n\t\t\t\tnew CreateAuthLogEntryCommand({\n\t\t\t\t\ttype,\n\t\t\t\t\tinvokedById: apiKeyRow.identity_id,\n\t\t\t\t\tpersonId: apiKeyRow.person_id ?? undefined,\n\t\t\t\t\t// The membership change affects this session's own person — record it as the target too,\n\t\t\t\t\t// so an admin querying membership changes by target_person_id sees IdP-driven grants/revokes\n\t\t\t\t\t// (consistent with the project_membership_* audit events).\n\t\t\t\t\ttargetPersonId: apiKeyRow.person_id ?? undefined,\n\t\t\t\t\tidentityProviderId: row.identityProviderId,\n\t\t\t\t\tpersonTokenId: apiKeyRow.id,\n\t\t\t\t\tsuccess: true,\n\t\t\t\t\teventData,\n\t\t\t\t\tipAddress: requestInfo?.ip,\n\t\t\t\t\tuserAgent: requestInfo?.userAgent,\n\t\t\t\t}),\n\t\t\t)\n\t\t} catch {\n\t\t\t// best-effort audit — never fail the request because the audit write failed\n\t\t}\n\t}\n\n\tprivate async logRevalidated(dbContext: DatabaseContext, apiKeyRow: ApiKeyRow, row: IdpSessionRow, requestInfo?: ApiKeyRequestInfo): Promise<void> {\n\t\tawait dbContext.commandBus.execute(\n\t\t\tnew CreateAuthLogEntryCommand({\n\t\t\t\ttype: 'idp_session_revalidated',\n\t\t\t\tinvokedById: apiKeyRow.identity_id,\n\t\t\t\tpersonId: apiKeyRow.person_id ?? undefined,\n\t\t\t\tidentityProviderId: row.identityProviderId,\n\t\t\t\tpersonTokenId: apiKeyRow.id,\n\t\t\t\tsuccess: true,\n\t\t\t\tipAddress: requestInfo?.ip,\n\t\t\t\tuserAgent: requestInfo?.userAgent,\n\t\t\t}),\n\t\t)\n\t}\n\n\t/**\n\t * Audit a fail-open: the IdP couldn't be consulted (transient outage) or the stored config is\n\t * corrupt, so we kept the session rather than revoking it. Naturally throttled to one entry\n\t * per claim window (we only reach here after a successful claim, which bumps\n\t * `last_validated_at`). The write is best-effort and self-contained — a failure to audit must\n\t * never propagate and fail a blocking verify request (the whole point of failing open).\n\t */\n\tprivate async logRevalidationFailed(\n\t\tdbContext: DatabaseContext,\n\t\tapiKeyRow: ApiKeyRow,\n\t\trow: IdpSessionRow,\n\t\terrorCode: 'config_invalid' | 'revalidation_error',\n\t\trequestInfo?: ApiKeyRequestInfo,\n\t): Promise<void> {\n\t\ttry {\n\t\t\tawait dbContext.commandBus.execute(\n\t\t\t\tnew CreateAuthLogEntryCommand({\n\t\t\t\t\ttype: 'idp_session_revalidation_failed',\n\t\t\t\t\tinvokedById: apiKeyRow.identity_id,\n\t\t\t\t\tpersonId: apiKeyRow.person_id ?? undefined,\n\t\t\t\t\tidentityProviderId: row.identityProviderId,\n\t\t\t\t\tpersonTokenId: apiKeyRow.id,\n\t\t\t\t\t// not a security failure (the session is kept) — a fail-open marker the operator\n\t\t\t\t\t// can alert on. `success: true` keeps it out of the failed-login funnels.\n\t\t\t\t\tsuccess: true,\n\t\t\t\t\terrorCode,\n\t\t\t\t\tipAddress: requestInfo?.ip,\n\t\t\t\t\tuserAgent: requestInfo?.userAgent,\n\t\t\t\t}),\n\t\t\t)\n\t\t} catch {\n\t\t\t// best-effort observability — never fail the request because the audit write failed\n\t\t}\n\t}\n\n\tprivate async revoke(\n\t\tdbContext: DatabaseContext,\n\t\tapiKeyRow: ApiKeyRow,\n\t\trow: IdpSessionRow,\n\t\treason: string,\n\t\trequestInfo?: ApiKeyRequestInfo,\n\t): Promise<void> {\n\t\tawait dbContext.commandBus.execute(new DisableApiKeyCommand(apiKeyRow.id))\n\t\tawait dbContext.commandBus.execute(\n\t\t\tnew CreateAuthLogEntryCommand({\n\t\t\t\ttype: 'idp_session_revoked',\n\t\t\t\tinvokedById: apiKeyRow.identity_id,\n\t\t\t\tpersonId: apiKeyRow.person_id ?? undefined,\n\t\t\t\tidentityProviderId: row.identityProviderId,\n\t\t\t\tpersonTokenId: apiKeyRow.id,\n\t\t\t\tsuccess: false,\n\t\t\t\terrorCode: reason,\n\t\t\t\tipAddress: requestInfo?.ip,\n\t\t\t\tuserAgent: requestInfo?.userAgent,\n\t\t\t\t// the action payload belongs in `event_data` (where every other audit event puts\n\t\t\t\t// it and where the admin UI / AuthLogQueryResolver reads it); `metadata` is for\n\t\t\t\t// transport context (forwarder IP/UA).\n\t\t\t\teventData: { reason },\n\t\t\t}),\n\t\t)\n\t}\n\n\tprivate resolveConfig(configuration: Record<string, unknown>): ResolvedRevalidationConfig {\n\t\tconst raw = (configuration.revalidation ?? {}) as Record<string, unknown>\n\t\tconst threshold = typeof raw.softRefreshThreshold === 'number' && raw.softRefreshThreshold > 0 && raw.softRefreshThreshold <= 1\n\t\t\t? raw.softRefreshThreshold\n\t\t\t: REVALIDATION_DEFAULT_SOFT_THRESHOLD\n\t\treturn {\n\t\t\tenabled: raw.enabled === true,\n\t\t\tsoftThreshold: threshold,\n\t\t\tminInterval: typeof raw.minInterval === 'string' ? raw.minInterval : REVALIDATION_DEFAULT_MIN_INTERVAL,\n\t\t\tfallbackInterval: typeof raw.fallbackInterval === 'string' ? raw.fallbackInterval : REVALIDATION_DEFAULT_FALLBACK_INTERVAL,\n\t\t\tmode: raw.mode === 'blocking' ? 'blocking' : 'auto',\n\t\t}\n\t}\n}\n"],"names":[],"mappings":";;;;;;;;;;AA4CO,MAAM,sBAAsB;AAAA,EAClC,YACkB,aACA,kBAChB;AAFgB,SAAA,cAAA;AACA,SAAA,mBAAA;AAAA,EAElB;AAAA,EAEA,MAAM,WACL,WACA,eACA,WACA,aAC+B;AAC/B,UAAM,MAAM,MAAM,cAAc,aAAa,MAAM,IAAI,wBAAwB,UAAU,IAAI,cAAc,SAAS,CAAC;AACrH,QAAI,CAAC,KAAK;AAET,aAAO;AAAA,IACR;AAEA,UAAM,SAAS,KAAK,cAAc,IAAI,qBAAqB;AAC3D,QAAI,CAAC,OAAO,SAAS;AACpB,aAAO;AAAA,IACR;AAGA,QAAI,IAAI,oBAAoB;AAC3B,YAAM,KAAK,OAAO,WAAW,WAAW,KAAK,gBAAgB,WAAW;AACxE,aAAO;AAAA,IACR;AAEA,UAAM,UAAU,KAAK,YAAY,iBAAiB,IAAI,YAAY;AAClE,QAAI,CAAC,SAAS,YAAY;AAEzB,aAAO;AAAA,IACR;AAEA,UAAM,WAAW,KAAK,OAAO,KAAK,QAAQ,UAAU,UAAU,KAAK;AACnE,QAAI,CAAC,UAAU;AAEd,aAAO;AAAA,IACR;AAGA,QAAI;AACJ,QAAI;AACH,gBAAU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U,WAAW,QAAQ,IAAI,qBAAqB,UAAU,EAAE,CAAC;AACzE,UAAM,UAAU,WAAW;AAAA,MAC1B,IAAI,0BAA0B;AAAA,QAC7B,MAAM;AAAA,QACN,aAAa,UAAU;AAAA,QACvB,UAAU,UAAU,aAAa;AAAA,QACjC,oBAAoB,IAAI;AAAA,QACxB,eAAe,UAAU;AAAA,QACzB,SAAS;AAAA,QACT,WAAW;AAAA,QACX,WAAW,aAAa;AAAA,QACxB,WAAW,aAAa;AAAA;AAAA;AAAA;AAAA,QAIxB,WAAW,EAAE,OAAA;AAAA,MAAO,CACpB;AAAA,IAAA;AAAA,EAEH;AAAA,EAEQ,cAAc,eAAoE;AACzF,UAAM,MAAO,cAAc,gBAAgB,CAAA;AAC3C,UAAM,YAAY,OAAO,IAAI,yBAAyB,YAAY,IAAI,uBAAuB,KAAK,IAAI,wBAAwB,IAC3H,IAAI,uBACJ;AACH,WAAO;AAAA,MACN,SAAS,IAAI,YAAY;AAAA,MACzB,eAAe;AAAA,MACf,aAAa,OAAO,IAAI,gBAAgB,WAAW,IAAI,cAAc;AAAA,MACrE,kBAAkB,OAAO,IAAI,qBAAqB,WAAW,IAAI,mBAAmB;AAAA,MACpF,MAAM,IAAI,SAAS,aAAa,aAAa;AAAA,IAAA;AAAA,EAE/C;AACD;"}
|
|
@@ -24,6 +24,12 @@ class PersonIdentityProviderManager {
|
|
|
24
24
|
if (!connection) {
|
|
25
25
|
return new Response.ResponseError("NOT_FOUND", `You are not connected to the identity provider connection "${connectionId}".`);
|
|
26
26
|
}
|
|
27
|
+
if (connection.identityProviderDisableLocalAuthentication) {
|
|
28
|
+
return new Response.ResponseError(
|
|
29
|
+
"IDP_REQUIRED",
|
|
30
|
+
`The identity provider "${connection.identityProviderSlug}" is the only way you may sign in; its connection cannot be removed.`
|
|
31
|
+
);
|
|
32
|
+
}
|
|
27
33
|
const configuration = await db2.queryHandler.fetch(new ConfigurationQuery.ConfigurationQuery(db2.providers));
|
|
28
34
|
const hasPassword = person.password_hash !== null;
|
|
29
35
|
const hasPasswordless = isPasswordlessEnabled.isPasswordlessEnabled(configuration.passwordless.enabled, person.passwordless_enabled);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PersonIdentityProviderManager.cjs","sources":["../../../../../../../packages/engine-tenant-api/src/model/service/idp/PersonIdentityProviderManager.ts"],"sourcesContent":["import { Response, ResponseError, ResponseOk } from '../../utils/Response.js'\nimport { DisconnectIdpErrorCode } from '../../../schema/index.js'\nimport { DatabaseContext } from '../../utils/index.js'\nimport { ConfigurationQuery, PersonIdentityProviderRow, PersonIdentityProvidersQuery, PersonRow } from '../../queries/index.js'\nimport { DisconnectPersonIdentityProviderCommand } from '../../commands/idp/DisconnectPersonIdentityProviderCommand.js'\nimport { isPasswordlessEnabled } from '../helpers/isPasswordlessEnabled.js'\n\n/**\n * Manages the external IdP connections of the *currently authenticated* person.\n *\n * Lock-out policy: a person may always disconnect a provider as long as it does\n * not remove their last remaining sign-in method. A connection is refused only\n * when, after removal, the person would have no password, no passwordless\n * sign-in enabled and no other *usable* IdP connection left — which would lock\n * them out of their account entirely. Whether passwordless counts is decided by\n * the same tenant policy the sign-in flow applies, and connections to disabled\n * providers are not counted as a usable fallback (they cannot sign in).\n */\nexport class PersonIdentityProviderManager {\n\tpublic async listPersonIdentityProviders(db: DatabaseContext, personId: string): Promise<PersonIdentityProviderRow[]> {\n\t\treturn await db.queryHandler.fetch(new PersonIdentityProvidersQuery(personId))\n\t}\n\n\tpublic async disconnectIdentityProvider(db: DatabaseContext, person: PersonRow, connectionId: string): Promise<DisconnectIDPResponse> {\n\t\treturn await db.transaction(async db => {\n\t\t\tconst connections = await db.queryHandler.fetch(new PersonIdentityProvidersQuery(person.id))\n\t\t\tconst connection = connections.find(it => it.id === connectionId)\n\t\t\tif (!connection) {\n\t\t\t\treturn new ResponseError('NOT_FOUND', `You are not connected to the identity provider connection \"${connectionId}\".`)\n\t\t\t}\n\n\t\t\tconst configuration = await db.queryHandler.fetch(new ConfigurationQuery(db.providers))\n\t\t\tconst hasPassword = person.password_hash !== null\n\t\t\tconst hasPasswordless = isPasswordlessEnabled(configuration.passwordless.enabled, person.passwordless_enabled)\n\t\t\tconst otherUsableConnections = connections.filter(it => it.id !== connection.id && it.identityProviderDisabledAt === null)\n\t\t\tconst wouldLockOut = !hasPassword && !hasPasswordless && otherUsableConnections.length === 0\n\t\t\tif (wouldLockOut) {\n\t\t\t\treturn new ResponseError(\n\t\t\t\t\t'LAST_AUTH_METHOD',\n\t\t\t\t\t'Cannot disconnect the only remaining sign-in method. Set up a password or another sign-in method first.',\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tawait db.commandBus.execute(new DisconnectPersonIdentityProviderCommand(person.id, connection.id))\n\t\t\treturn new ResponseOk({ slug: connection.identityProviderSlug })\n\t\t})\n\t}\n}\n\nexport interface DisconnectIDPResult {\n\treadonly slug: string\n}\n\nexport type DisconnectIDPResponse = Response<DisconnectIDPResult, DisconnectIdpErrorCode>\n"],"names":["PersonIdentityProvidersQuery","db","ResponseError","ConfigurationQuery","isPasswordlessEnabled","DisconnectPersonIdentityProviderCommand","ResponseOk"],"mappings":";;;;;;;;;;;;;;;AAkBO,MAAM,8BAA8B;AAAA,EAC1C,MAAa,4BAA4B,IAAqB,UAAwD;AACrH,WAAO,MAAM,GAAG,aAAa,MAAM,IAAIA,6BAAAA,6BAA6B,QAAQ,CAAC;AAAA,EAC9E;AAAA,EAEA,MAAa,2BAA2B,IAAqB,QAAmB,cAAsD;AACrI,WAAO,MAAM,GAAG,YAAY,OAAMC,QAAM;AACvC,YAAM,cAAc,MAAMA,IAAG,aAAa,MAAM,IAAID,6BAAAA,6BAA6B,OAAO,EAAE,CAAC;AAC3F,YAAM,aAAa,YAAY,KAAK,CAAA,OAAM,GAAG,OAAO,YAAY;AAChE,UAAI,CAAC,YAAY;AAChB,eAAO,IAAIE,SAAAA,cAAc,aAAa,8DAA8D,YAAY,IAAI;AAAA,MACrH;AAEA,YAAM,gBAAgB,MAAMD,IAAG,aAAa,MAAM,IAAIE,mBAAAA,mBAAmBF,IAAG,SAAS,CAAC;AACtF,YAAM,cAAc,OAAO,kBAAkB;AAC7C,YAAM,kBAAkBG,sBAAAA,sBAAsB,cAAc,aAAa,SAAS,OAAO,oBAAoB;AAC7G,YAAM,yBAAyB,YAAY,OAAO,CAAA,OAAM,GAAG,OAAO,WAAW,MAAM,GAAG,+BAA+B,IAAI;AACzH,YAAM,eAAe,CAAC,eAAe,CAAC,mBAAmB,uBAAuB,WAAW;AAC3F,UAAI,cAAc;AACjB,eAAO,IAAIF,SAAAA;AAAAA,UACV;AAAA,UACA;AAAA,QAAA;AAAA,MAEF;AAEA,YAAMD,IAAG,WAAW,QAAQ,IAAII,wCAAAA,wCAAwC,OAAO,IAAI,WAAW,EAAE,CAAC;AACjG,aAAO,IAAIC,SAAAA,WAAW,EAAE,MAAM,WAAW,sBAAsB;AAAA,IAChE,CAAC;AAAA,EACF;AACD;;"}
|
|
1
|
+
{"version":3,"file":"PersonIdentityProviderManager.cjs","sources":["../../../../../../../packages/engine-tenant-api/src/model/service/idp/PersonIdentityProviderManager.ts"],"sourcesContent":["import { Response, ResponseError, ResponseOk } from '../../utils/Response.js'\nimport { DisconnectIdpErrorCode } from '../../../schema/index.js'\nimport { DatabaseContext } from '../../utils/index.js'\nimport { ConfigurationQuery, PersonIdentityProviderRow, PersonIdentityProvidersQuery, PersonRow } from '../../queries/index.js'\nimport { DisconnectPersonIdentityProviderCommand } from '../../commands/idp/DisconnectPersonIdentityProviderCommand.js'\nimport { isPasswordlessEnabled } from '../helpers/isPasswordlessEnabled.js'\n\n/**\n * Manages the external IdP connections of the *currently authenticated* person.\n *\n * Lock-out policy: a person may always disconnect a provider as long as it does\n * not remove their last remaining sign-in method. A connection is refused only\n * when, after removal, the person would have no password, no passwordless\n * sign-in enabled and no other *usable* IdP connection left — which would lock\n * them out of their account entirely. Whether passwordless counts is decided by\n * the same tenant policy the sign-in flow applies, and connections to disabled\n * providers are not counted as a usable fallback (they cannot sign in).\n */\nexport class PersonIdentityProviderManager {\n\tpublic async listPersonIdentityProviders(db: DatabaseContext, personId: string): Promise<PersonIdentityProviderRow[]> {\n\t\treturn await db.queryHandler.fetch(new PersonIdentityProvidersQuery(personId))\n\t}\n\n\tpublic async disconnectIdentityProvider(db: DatabaseContext, person: PersonRow, connectionId: string): Promise<DisconnectIDPResponse> {\n\t\treturn await db.transaction(async db => {\n\t\t\tconst connections = await db.queryHandler.fetch(new PersonIdentityProvidersQuery(person.id))\n\t\t\tconst connection = connections.find(it => it.id === connectionId)\n\t\t\tif (!connection) {\n\t\t\t\treturn new ResponseError('NOT_FOUND', `You are not connected to the identity provider connection \"${connectionId}\".`)\n\t\t\t}\n\n\t\t\t// The link is what binds the person to the provider's policy, so they cannot remove it themselves.\n\t\t\tif (connection.identityProviderDisableLocalAuthentication) {\n\t\t\t\treturn new ResponseError(\n\t\t\t\t\t'IDP_REQUIRED',\n\t\t\t\t\t`The identity provider \"${connection.identityProviderSlug}\" is the only way you may sign in; its connection cannot be removed.`,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tconst configuration = await db.queryHandler.fetch(new ConfigurationQuery(db.providers))\n\t\t\tconst hasPassword = person.password_hash !== null\n\t\t\tconst hasPasswordless = isPasswordlessEnabled(configuration.passwordless.enabled, person.passwordless_enabled)\n\t\t\tconst otherUsableConnections = connections.filter(it => it.id !== connection.id && it.identityProviderDisabledAt === null)\n\t\t\tconst wouldLockOut = !hasPassword && !hasPasswordless && otherUsableConnections.length === 0\n\t\t\tif (wouldLockOut) {\n\t\t\t\treturn new ResponseError(\n\t\t\t\t\t'LAST_AUTH_METHOD',\n\t\t\t\t\t'Cannot disconnect the only remaining sign-in method. Set up a password or another sign-in method first.',\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tawait db.commandBus.execute(new DisconnectPersonIdentityProviderCommand(person.id, connection.id))\n\t\t\treturn new ResponseOk({ slug: connection.identityProviderSlug })\n\t\t})\n\t}\n}\n\nexport interface DisconnectIDPResult {\n\treadonly slug: string\n}\n\nexport type DisconnectIDPResponse = Response<DisconnectIDPResult, DisconnectIdpErrorCode>\n"],"names":["PersonIdentityProvidersQuery","db","ResponseError","ConfigurationQuery","isPasswordlessEnabled","DisconnectPersonIdentityProviderCommand","ResponseOk"],"mappings":";;;;;;;;;;;;;;;AAkBO,MAAM,8BAA8B;AAAA,EAC1C,MAAa,4BAA4B,IAAqB,UAAwD;AACrH,WAAO,MAAM,GAAG,aAAa,MAAM,IAAIA,6BAAAA,6BAA6B,QAAQ,CAAC;AAAA,EAC9E;AAAA,EAEA,MAAa,2BAA2B,IAAqB,QAAmB,cAAsD;AACrI,WAAO,MAAM,GAAG,YAAY,OAAMC,QAAM;AACvC,YAAM,cAAc,MAAMA,IAAG,aAAa,MAAM,IAAID,6BAAAA,6BAA6B,OAAO,EAAE,CAAC;AAC3F,YAAM,aAAa,YAAY,KAAK,CAAA,OAAM,GAAG,OAAO,YAAY;AAChE,UAAI,CAAC,YAAY;AAChB,eAAO,IAAIE,SAAAA,cAAc,aAAa,8DAA8D,YAAY,IAAI;AAAA,MACrH;AAGA,UAAI,WAAW,4CAA4C;AAC1D,eAAO,IAAIA,SAAAA;AAAAA,UACV;AAAA,UACA,0BAA0B,WAAW,oBAAoB;AAAA,QAAA;AAAA,MAE3D;AAEA,YAAM,gBAAgB,MAAMD,IAAG,aAAa,MAAM,IAAIE,mBAAAA,mBAAmBF,IAAG,SAAS,CAAC;AACtF,YAAM,cAAc,OAAO,kBAAkB;AAC7C,YAAM,kBAAkBG,sBAAAA,sBAAsB,cAAc,aAAa,SAAS,OAAO,oBAAoB;AAC7G,YAAM,yBAAyB,YAAY,OAAO,CAAA,OAAM,GAAG,OAAO,WAAW,MAAM,GAAG,+BAA+B,IAAI;AACzH,YAAM,eAAe,CAAC,eAAe,CAAC,mBAAmB,uBAAuB,WAAW;AAC3F,UAAI,cAAc;AACjB,eAAO,IAAIF,SAAAA;AAAAA,UACV;AAAA,UACA;AAAA,QAAA;AAAA,MAEF;AAEA,YAAMD,IAAG,WAAW,QAAQ,IAAII,wCAAAA,wCAAwC,OAAO,IAAI,WAAW,EAAE,CAAC;AACjG,aAAO,IAAIC,SAAAA,WAAW,EAAE,MAAM,WAAW,sBAAsB;AAAA,IAChE,CAAC;AAAA,EACF;AACD;;"}
|
|
@@ -22,6 +22,12 @@ class PersonIdentityProviderManager {
|
|
|
22
22
|
if (!connection) {
|
|
23
23
|
return new ResponseError("NOT_FOUND", `You are not connected to the identity provider connection "${connectionId}".`);
|
|
24
24
|
}
|
|
25
|
+
if (connection.identityProviderDisableLocalAuthentication) {
|
|
26
|
+
return new ResponseError(
|
|
27
|
+
"IDP_REQUIRED",
|
|
28
|
+
`The identity provider "${connection.identityProviderSlug}" is the only way you may sign in; its connection cannot be removed.`
|
|
29
|
+
);
|
|
30
|
+
}
|
|
25
31
|
const configuration = await db2.queryHandler.fetch(new ConfigurationQuery(db2.providers));
|
|
26
32
|
const hasPassword = person.password_hash !== null;
|
|
27
33
|
const hasPasswordless = isPasswordlessEnabled(configuration.passwordless.enabled, person.passwordless_enabled);
|