@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.
Files changed (1316) hide show
  1. package/CLAUDE.md +36 -2
  2. package/dist/development/index.cjs +32 -0
  3. package/dist/development/index.cjs.map +1 -1
  4. package/dist/development/index.js +33 -1
  5. package/dist/development/index.js.map +1 -1
  6. package/dist/development/src/TenantContainer.cjs +15 -3
  7. package/dist/development/src/TenantContainer.cjs.map +1 -1
  8. package/dist/development/src/TenantContainer.js +15 -3
  9. package/dist/development/src/TenantContainer.js.map +1 -1
  10. package/dist/development/src/bridges/system/IdentityFetcher.cjs +2 -1
  11. package/dist/development/src/bridges/system/IdentityFetcher.cjs.map +1 -1
  12. package/dist/development/src/bridges/system/IdentityFetcher.js +2 -1
  13. package/dist/development/src/bridges/system/IdentityFetcher.js.map +1 -1
  14. package/dist/development/src/migrations/2026-06-18-120000-idp-claim-mapping.cjs +10 -0
  15. package/dist/development/src/migrations/2026-06-18-120000-idp-claim-mapping.cjs.map +1 -0
  16. package/dist/development/src/migrations/2026-06-18-120000-idp-claim-mapping.js +11 -0
  17. package/dist/development/src/migrations/2026-06-18-120000-idp-claim-mapping.js.map +1 -0
  18. package/dist/development/src/migrations/2026-08-03-120000-person-enable-auth-log.cjs +9 -0
  19. package/dist/development/src/migrations/2026-08-03-120000-person-enable-auth-log.cjs.map +1 -0
  20. package/dist/development/src/migrations/2026-08-03-120000-person-enable-auth-log.js +10 -0
  21. package/dist/development/src/migrations/2026-08-03-120000-person-enable-auth-log.js.map +1 -0
  22. package/dist/development/src/migrations/2026-08-04-120000-config-panel.cjs +11 -0
  23. package/dist/development/src/migrations/2026-08-04-120000-config-panel.cjs.map +1 -0
  24. package/dist/development/src/migrations/2026-08-04-120000-config-panel.js +12 -0
  25. package/dist/development/src/migrations/2026-08-04-120000-config-panel.js.map +1 -0
  26. package/dist/development/src/migrations/2026-09-04-120000-idp-disable-local-authentication.cjs +18 -0
  27. package/dist/development/src/migrations/2026-09-04-120000-idp-disable-local-authentication.cjs.map +1 -0
  28. package/dist/development/src/migrations/2026-09-04-120000-idp-disable-local-authentication.js +19 -0
  29. package/dist/development/src/migrations/2026-09-04-120000-idp-disable-local-authentication.js.map +1 -0
  30. package/dist/development/src/migrations/runner.cjs +11 -2
  31. package/dist/development/src/migrations/runner.cjs.map +1 -1
  32. package/dist/development/src/migrations/runner.js +11 -2
  33. package/dist/development/src/migrations/runner.js.map +1 -1
  34. package/dist/development/src/migrations/snapshot.cjs +8 -2
  35. package/dist/development/src/migrations/snapshot.cjs.map +1 -1
  36. package/dist/development/src/migrations/snapshot.js +8 -2
  37. package/dist/development/src/migrations/snapshot.js.map +1 -1
  38. package/dist/development/src/model/commands/configuration/UpdateConfigurationCommand.cjs +5 -3
  39. package/dist/development/src/model/commands/configuration/UpdateConfigurationCommand.cjs.map +1 -1
  40. package/dist/development/src/model/commands/configuration/UpdateConfigurationCommand.js +5 -3
  41. package/dist/development/src/model/commands/configuration/UpdateConfigurationCommand.js.map +1 -1
  42. package/dist/development/src/model/commands/idp/CreateIdpCommand.cjs +8 -2
  43. package/dist/development/src/model/commands/idp/CreateIdpCommand.cjs.map +1 -1
  44. package/dist/development/src/model/commands/idp/CreateIdpCommand.js +8 -2
  45. package/dist/development/src/model/commands/idp/CreateIdpCommand.js.map +1 -1
  46. package/dist/development/src/model/commands/idp/UpdateIdpCommand.cjs +6 -2
  47. package/dist/development/src/model/commands/idp/UpdateIdpCommand.cjs.map +1 -1
  48. package/dist/development/src/model/commands/idp/UpdateIdpCommand.js +6 -2
  49. package/dist/development/src/model/commands/idp/UpdateIdpCommand.js.map +1 -1
  50. package/dist/development/src/model/commands/membership/{RemoveProjectMembershipsCommand.cjs → RemoveProjectMembershipCommand.cjs} +1 -1
  51. package/dist/development/src/model/commands/membership/RemoveProjectMembershipCommand.cjs.map +1 -0
  52. package/dist/development/src/model/commands/membership/{RemoveProjectMembershipsCommand.js → RemoveProjectMembershipCommand.js} +1 -1
  53. package/dist/development/src/model/commands/membership/RemoveProjectMembershipCommand.js.map +1 -0
  54. package/dist/development/src/model/commands/membership/UpdateProjectMemberCommand.cjs +2 -2
  55. package/dist/development/src/model/commands/membership/UpdateProjectMemberCommand.cjs.map +1 -1
  56. package/dist/development/src/model/commands/membership/UpdateProjectMemberCommand.js +1 -1
  57. package/dist/development/src/model/commands/membership/UpdateProjectMemberCommand.js.map +1 -1
  58. package/dist/development/src/model/commands/person/EnablePersonCommand.cjs +17 -0
  59. package/dist/development/src/model/commands/person/EnablePersonCommand.cjs.map +1 -0
  60. package/dist/development/src/model/commands/person/EnablePersonCommand.js +17 -0
  61. package/dist/development/src/model/commands/person/EnablePersonCommand.js.map +1 -0
  62. package/dist/development/src/model/queries/configuration/ConfigurationQuery.cjs +4 -0
  63. package/dist/development/src/model/queries/configuration/ConfigurationQuery.cjs.map +1 -1
  64. package/dist/development/src/model/queries/configuration/ConfigurationQuery.js +4 -0
  65. package/dist/development/src/model/queries/configuration/ConfigurationQuery.js.map +1 -1
  66. package/dist/development/src/model/queries/idp/LocalAuthDisablingIdpsQuery.cjs +21 -0
  67. package/dist/development/src/model/queries/idp/LocalAuthDisablingIdpsQuery.cjs.map +1 -0
  68. package/dist/development/src/model/queries/idp/LocalAuthDisablingIdpsQuery.js +21 -0
  69. package/dist/development/src/model/queries/idp/LocalAuthDisablingIdpsQuery.js.map +1 -0
  70. package/dist/development/src/model/queries/idp/PersonIdentityProvidersQuery.cjs +1 -1
  71. package/dist/development/src/model/queries/idp/PersonIdentityProvidersQuery.cjs.map +1 -1
  72. package/dist/development/src/model/queries/idp/PersonIdentityProvidersQuery.js +1 -1
  73. package/dist/development/src/model/queries/idp/PersonIdentityProvidersQuery.js.map +1 -1
  74. package/dist/development/src/model/queries/idp/helpers.cjs +3 -3
  75. package/dist/development/src/model/queries/idp/helpers.cjs.map +1 -1
  76. package/dist/development/src/model/queries/idp/helpers.js +3 -3
  77. package/dist/development/src/model/queries/idp/helpers.js.map +1 -1
  78. package/dist/development/src/model/queries/membership/ProjectMembersQuery.cjs +1 -1
  79. package/dist/development/src/model/queries/membership/ProjectMembersQuery.cjs.map +1 -1
  80. package/dist/development/src/model/queries/membership/ProjectMembersQuery.js +1 -1
  81. package/dist/development/src/model/queries/membership/ProjectMembersQuery.js.map +1 -1
  82. package/dist/development/src/model/queries/person/PersonQueryBuilderFactory.cjs +1 -1
  83. package/dist/development/src/model/queries/person/PersonQueryBuilderFactory.cjs.map +1 -1
  84. package/dist/development/src/model/queries/person/PersonQueryBuilderFactory.js +1 -1
  85. package/dist/development/src/model/queries/person/PersonQueryBuilderFactory.js.map +1 -1
  86. package/dist/development/src/model/service/AuthLogService.cjs +8 -2
  87. package/dist/development/src/model/service/AuthLogService.cjs.map +1 -1
  88. package/dist/development/src/model/service/AuthLogService.js +8 -2
  89. package/dist/development/src/model/service/AuthLogService.js.map +1 -1
  90. package/dist/development/src/model/service/IDPSignInManager.cjs +29 -2
  91. package/dist/development/src/model/service/IDPSignInManager.cjs.map +1 -1
  92. package/dist/development/src/model/service/IDPSignInManager.js +29 -2
  93. package/dist/development/src/model/service/IDPSignInManager.js.map +1 -1
  94. package/dist/development/src/model/service/PanelAccessResolver.cjs +31 -0
  95. package/dist/development/src/model/service/PanelAccessResolver.cjs.map +1 -0
  96. package/dist/development/src/model/service/PanelAccessResolver.js +31 -0
  97. package/dist/development/src/model/service/PanelAccessResolver.js.map +1 -0
  98. package/dist/development/src/model/service/PasswordResetManager.cjs +5 -0
  99. package/dist/development/src/model/service/PasswordResetManager.cjs.map +1 -1
  100. package/dist/development/src/model/service/PasswordResetManager.js +5 -0
  101. package/dist/development/src/model/service/PasswordResetManager.js.map +1 -1
  102. package/dist/development/src/model/service/PasswordlessSignInManager.cjs +19 -0
  103. package/dist/development/src/model/service/PasswordlessSignInManager.cjs.map +1 -1
  104. package/dist/development/src/model/service/PasswordlessSignInManager.js +19 -0
  105. package/dist/development/src/model/service/PasswordlessSignInManager.js.map +1 -1
  106. package/dist/development/src/model/service/PersonAccessManager.cjs +10 -2
  107. package/dist/development/src/model/service/PersonAccessManager.cjs.map +1 -1
  108. package/dist/development/src/model/service/PersonAccessManager.js +10 -2
  109. package/dist/development/src/model/service/PersonAccessManager.js.map +1 -1
  110. package/dist/development/src/model/service/SignInManager.cjs +5 -0
  111. package/dist/development/src/model/service/SignInManager.cjs.map +1 -1
  112. package/dist/development/src/model/service/SignInManager.js +5 -0
  113. package/dist/development/src/model/service/SignInManager.js.map +1 -1
  114. package/dist/development/src/model/service/apiKey/ApiKeyManager.cjs +4 -3
  115. package/dist/development/src/model/service/apiKey/ApiKeyManager.cjs.map +1 -1
  116. package/dist/development/src/model/service/apiKey/ApiKeyManager.js +4 -3
  117. package/dist/development/src/model/service/apiKey/ApiKeyManager.js.map +1 -1
  118. package/dist/development/src/model/service/apiKey/UnpersistedApiKeyManager.cjs +7 -0
  119. package/dist/development/src/model/service/apiKey/UnpersistedApiKeyManager.cjs.map +1 -1
  120. package/dist/development/src/model/service/apiKey/UnpersistedApiKeyManager.js +8 -1
  121. package/dist/development/src/model/service/apiKey/UnpersistedApiKeyManager.js.map +1 -1
  122. package/dist/development/src/model/service/idp/ClaimMapping.cjs +187 -0
  123. package/dist/development/src/model/service/idp/ClaimMapping.cjs.map +1 -0
  124. package/dist/development/src/model/service/idp/ClaimMapping.js +170 -0
  125. package/dist/development/src/model/service/idp/ClaimMapping.js.map +1 -0
  126. package/dist/development/src/model/service/idp/ClaimMappingEvaluator.cjs +155 -0
  127. package/dist/development/src/model/service/idp/ClaimMappingEvaluator.cjs.map +1 -0
  128. package/dist/development/src/model/service/idp/ClaimMappingEvaluator.js +155 -0
  129. package/dist/development/src/model/service/idp/ClaimMappingEvaluator.js.map +1 -0
  130. package/dist/development/src/model/service/idp/ClaimMappingValidation.cjs +83 -0
  131. package/dist/development/src/model/service/idp/ClaimMappingValidation.cjs.map +1 -0
  132. package/dist/development/src/model/service/idp/ClaimMappingValidation.js +83 -0
  133. package/dist/development/src/model/service/idp/ClaimMappingValidation.js.map +1 -0
  134. package/dist/development/src/model/service/idp/IDPClaimSyncService.cjs +260 -0
  135. package/dist/development/src/model/service/idp/IDPClaimSyncService.cjs.map +1 -0
  136. package/dist/development/src/model/service/idp/IDPClaimSyncService.js +260 -0
  137. package/dist/development/src/model/service/idp/IDPClaimSyncService.js.map +1 -0
  138. package/dist/development/src/model/service/idp/IDPManager.cjs +96 -20
  139. package/dist/development/src/model/service/idp/IDPManager.cjs.map +1 -1
  140. package/dist/development/src/model/service/idp/IDPManager.js +96 -20
  141. package/dist/development/src/model/service/idp/IDPManager.js.map +1 -1
  142. package/dist/development/src/model/service/idp/IdpSessionRevalidator.cjs +55 -1
  143. package/dist/development/src/model/service/idp/IdpSessionRevalidator.cjs.map +1 -1
  144. package/dist/development/src/model/service/idp/IdpSessionRevalidator.js +55 -1
  145. package/dist/development/src/model/service/idp/IdpSessionRevalidator.js.map +1 -1
  146. package/dist/development/src/model/service/idp/PersonIdentityProviderManager.cjs +6 -0
  147. package/dist/development/src/model/service/idp/PersonIdentityProviderManager.cjs.map +1 -1
  148. package/dist/development/src/model/service/idp/PersonIdentityProviderManager.js +6 -0
  149. package/dist/development/src/model/service/idp/PersonIdentityProviderManager.js.map +1 -1
  150. package/dist/development/src/model/service/idp/providers/OIDCHelpers.cjs +69 -33
  151. package/dist/development/src/model/service/idp/providers/OIDCHelpers.cjs.map +1 -1
  152. package/dist/development/src/model/service/idp/providers/OIDCHelpers.js +69 -33
  153. package/dist/development/src/model/service/idp/providers/OIDCHelpers.js.map +1 -1
  154. package/dist/development/src/model/service/idp/providers/OIDCProvider.cjs +4 -1
  155. package/dist/development/src/model/service/idp/providers/OIDCProvider.cjs.map +1 -1
  156. package/dist/development/src/model/service/idp/providers/OIDCProvider.js +4 -1
  157. package/dist/development/src/model/service/idp/providers/OIDCProvider.js.map +1 -1
  158. package/dist/development/src/model/utils/DatabaseContext.cjs +7 -2
  159. package/dist/development/src/model/utils/DatabaseContext.cjs.map +1 -1
  160. package/dist/development/src/model/utils/DatabaseContext.js +8 -3
  161. package/dist/development/src/model/utils/DatabaseContext.js.map +1 -1
  162. package/dist/development/src/resolvers/ResolverFactory.cjs +6 -2
  163. package/dist/development/src/resolvers/ResolverFactory.cjs.map +1 -1
  164. package/dist/development/src/resolvers/ResolverFactory.js +6 -2
  165. package/dist/development/src/resolvers/ResolverFactory.js.map +1 -1
  166. package/dist/development/src/resolvers/mutation/apiKey/CreateApiKeyMutationResolver.cjs +2 -1
  167. package/dist/development/src/resolvers/mutation/apiKey/CreateApiKeyMutationResolver.cjs.map +1 -1
  168. package/dist/development/src/resolvers/mutation/apiKey/CreateApiKeyMutationResolver.js +2 -1
  169. package/dist/development/src/resolvers/mutation/apiKey/CreateApiKeyMutationResolver.js.map +1 -1
  170. package/dist/development/src/resolvers/mutation/apiKey/DisableApiKeyMutationResolver.cjs +2 -1
  171. package/dist/development/src/resolvers/mutation/apiKey/DisableApiKeyMutationResolver.cjs.map +1 -1
  172. package/dist/development/src/resolvers/mutation/apiKey/DisableApiKeyMutationResolver.js +2 -1
  173. package/dist/development/src/resolvers/mutation/apiKey/DisableApiKeyMutationResolver.js.map +1 -1
  174. package/dist/development/src/resolvers/mutation/configuration/AuthPolicyMutationResolver.cjs +2 -1
  175. package/dist/development/src/resolvers/mutation/configuration/AuthPolicyMutationResolver.cjs.map +1 -1
  176. package/dist/development/src/resolvers/mutation/configuration/AuthPolicyMutationResolver.js +2 -1
  177. package/dist/development/src/resolvers/mutation/configuration/AuthPolicyMutationResolver.js.map +1 -1
  178. package/dist/development/src/resolvers/mutation/configuration/ConfigurationMutationResolver.cjs +2 -1
  179. package/dist/development/src/resolvers/mutation/configuration/ConfigurationMutationResolver.cjs.map +1 -1
  180. package/dist/development/src/resolvers/mutation/configuration/ConfigurationMutationResolver.js +2 -1
  181. package/dist/development/src/resolvers/mutation/configuration/ConfigurationMutationResolver.js.map +1 -1
  182. package/dist/development/src/resolvers/mutation/identity/GlobalRolesMutationResolver.cjs +2 -1
  183. package/dist/development/src/resolvers/mutation/identity/GlobalRolesMutationResolver.cjs.map +1 -1
  184. package/dist/development/src/resolvers/mutation/identity/GlobalRolesMutationResolver.js +2 -1
  185. package/dist/development/src/resolvers/mutation/identity/GlobalRolesMutationResolver.js.map +1 -1
  186. package/dist/development/src/resolvers/mutation/idp/AddIDPMutationResolver.cjs +4 -2
  187. package/dist/development/src/resolvers/mutation/idp/AddIDPMutationResolver.cjs.map +1 -1
  188. package/dist/development/src/resolvers/mutation/idp/AddIDPMutationResolver.js +4 -2
  189. package/dist/development/src/resolvers/mutation/idp/AddIDPMutationResolver.js.map +1 -1
  190. package/dist/development/src/resolvers/mutation/idp/DisableIDPMutationResolver.cjs +2 -1
  191. package/dist/development/src/resolvers/mutation/idp/DisableIDPMutationResolver.cjs.map +1 -1
  192. package/dist/development/src/resolvers/mutation/idp/DisableIDPMutationResolver.js +2 -1
  193. package/dist/development/src/resolvers/mutation/idp/DisableIDPMutationResolver.js.map +1 -1
  194. package/dist/development/src/resolvers/mutation/idp/DisconnectMyIdentityProviderMutationResolver.cjs +2 -1
  195. package/dist/development/src/resolvers/mutation/idp/DisconnectMyIdentityProviderMutationResolver.cjs.map +1 -1
  196. package/dist/development/src/resolvers/mutation/idp/DisconnectMyIdentityProviderMutationResolver.js +2 -1
  197. package/dist/development/src/resolvers/mutation/idp/DisconnectMyIdentityProviderMutationResolver.js.map +1 -1
  198. package/dist/development/src/resolvers/mutation/idp/EnableIDPMutationResolver.cjs +2 -1
  199. package/dist/development/src/resolvers/mutation/idp/EnableIDPMutationResolver.cjs.map +1 -1
  200. package/dist/development/src/resolvers/mutation/idp/EnableIDPMutationResolver.js +2 -1
  201. package/dist/development/src/resolvers/mutation/idp/EnableIDPMutationResolver.js.map +1 -1
  202. package/dist/development/src/resolvers/mutation/idp/UpdateIDPMutationResolver.cjs +4 -2
  203. package/dist/development/src/resolvers/mutation/idp/UpdateIDPMutationResolver.cjs.map +1 -1
  204. package/dist/development/src/resolvers/mutation/idp/UpdateIDPMutationResolver.js +4 -2
  205. package/dist/development/src/resolvers/mutation/idp/UpdateIDPMutationResolver.js.map +1 -1
  206. package/dist/development/src/resolvers/mutation/idp/audit.cjs +1 -0
  207. package/dist/development/src/resolvers/mutation/idp/audit.cjs.map +1 -1
  208. package/dist/development/src/resolvers/mutation/idp/audit.js +1 -0
  209. package/dist/development/src/resolvers/mutation/idp/audit.js.map +1 -1
  210. package/dist/development/src/resolvers/mutation/mailTemplates/MailTemplateMutationResolver.cjs +2 -1
  211. package/dist/development/src/resolvers/mutation/mailTemplates/MailTemplateMutationResolver.cjs.map +1 -1
  212. package/dist/development/src/resolvers/mutation/mailTemplates/MailTemplateMutationResolver.js +2 -1
  213. package/dist/development/src/resolvers/mutation/mailTemplates/MailTemplateMutationResolver.js.map +1 -1
  214. package/dist/development/src/resolvers/mutation/person/ChangePasswordMutationResolver.cjs +2 -1
  215. package/dist/development/src/resolvers/mutation/person/ChangePasswordMutationResolver.cjs.map +1 -1
  216. package/dist/development/src/resolvers/mutation/person/ChangePasswordMutationResolver.js +2 -1
  217. package/dist/development/src/resolvers/mutation/person/ChangePasswordMutationResolver.js.map +1 -1
  218. package/dist/development/src/resolvers/mutation/person/ChangeProfileMutationResolver.cjs +2 -1
  219. package/dist/development/src/resolvers/mutation/person/ChangeProfileMutationResolver.cjs.map +1 -1
  220. package/dist/development/src/resolvers/mutation/person/ChangeProfileMutationResolver.js +2 -1
  221. package/dist/development/src/resolvers/mutation/person/ChangeProfileMutationResolver.js.map +1 -1
  222. package/dist/development/src/resolvers/mutation/person/DisablePersonMutationResolver.cjs +4 -3
  223. package/dist/development/src/resolvers/mutation/person/DisablePersonMutationResolver.cjs.map +1 -1
  224. package/dist/development/src/resolvers/mutation/person/DisablePersonMutationResolver.js +4 -3
  225. package/dist/development/src/resolvers/mutation/person/DisablePersonMutationResolver.js.map +1 -1
  226. package/dist/development/src/resolvers/mutation/person/EmailOtpMutationResolver.cjs +2 -1
  227. package/dist/development/src/resolvers/mutation/person/EmailOtpMutationResolver.cjs.map +1 -1
  228. package/dist/development/src/resolvers/mutation/person/EmailOtpMutationResolver.js +2 -1
  229. package/dist/development/src/resolvers/mutation/person/EmailOtpMutationResolver.js.map +1 -1
  230. package/dist/development/src/resolvers/mutation/person/EmailVerificationMutationResolver.cjs +2 -1
  231. package/dist/development/src/resolvers/mutation/person/EmailVerificationMutationResolver.cjs.map +1 -1
  232. package/dist/development/src/resolvers/mutation/person/EmailVerificationMutationResolver.js +2 -1
  233. package/dist/development/src/resolvers/mutation/person/EmailVerificationMutationResolver.js.map +1 -1
  234. package/dist/development/src/resolvers/mutation/person/EnablePersonMutationResolver.cjs +60 -0
  235. package/dist/development/src/resolvers/mutation/person/EnablePersonMutationResolver.cjs.map +1 -0
  236. package/dist/development/src/resolvers/mutation/person/EnablePersonMutationResolver.js +60 -0
  237. package/dist/development/src/resolvers/mutation/person/EnablePersonMutationResolver.js.map +1 -0
  238. package/dist/development/src/resolvers/mutation/person/ForceSignOutMutationResolver.cjs +2 -1
  239. package/dist/development/src/resolvers/mutation/person/ForceSignOutMutationResolver.cjs.map +1 -1
  240. package/dist/development/src/resolvers/mutation/person/ForceSignOutMutationResolver.js +2 -1
  241. package/dist/development/src/resolvers/mutation/person/ForceSignOutMutationResolver.js.map +1 -1
  242. package/dist/development/src/resolvers/mutation/person/IDPMutationResolver.cjs +27 -1
  243. package/dist/development/src/resolvers/mutation/person/IDPMutationResolver.cjs.map +1 -1
  244. package/dist/development/src/resolvers/mutation/person/IDPMutationResolver.js +27 -1
  245. package/dist/development/src/resolvers/mutation/person/IDPMutationResolver.js.map +1 -1
  246. package/dist/development/src/resolvers/mutation/person/InviteMutationResolver.cjs +2 -1
  247. package/dist/development/src/resolvers/mutation/person/InviteMutationResolver.cjs.map +1 -1
  248. package/dist/development/src/resolvers/mutation/person/InviteMutationResolver.js +2 -1
  249. package/dist/development/src/resolvers/mutation/person/InviteMutationResolver.js.map +1 -1
  250. package/dist/development/src/resolvers/mutation/person/OtpMutationResolver.cjs +2 -1
  251. package/dist/development/src/resolvers/mutation/person/OtpMutationResolver.cjs.map +1 -1
  252. package/dist/development/src/resolvers/mutation/person/OtpMutationResolver.js +2 -1
  253. package/dist/development/src/resolvers/mutation/person/OtpMutationResolver.js.map +1 -1
  254. package/dist/development/src/resolvers/mutation/person/PasswordlessMutationResolver.cjs +6 -1
  255. package/dist/development/src/resolvers/mutation/person/PasswordlessMutationResolver.cjs.map +1 -1
  256. package/dist/development/src/resolvers/mutation/person/PasswordlessMutationResolver.js +6 -1
  257. package/dist/development/src/resolvers/mutation/person/PasswordlessMutationResolver.js.map +1 -1
  258. package/dist/development/src/resolvers/mutation/person/RegenerateBackupCodesMutationResolver.cjs +2 -1
  259. package/dist/development/src/resolvers/mutation/person/RegenerateBackupCodesMutationResolver.cjs.map +1 -1
  260. package/dist/development/src/resolvers/mutation/person/RegenerateBackupCodesMutationResolver.js +2 -1
  261. package/dist/development/src/resolvers/mutation/person/RegenerateBackupCodesMutationResolver.js.map +1 -1
  262. package/dist/development/src/resolvers/mutation/person/ResetPasswordMutationResolver.cjs +2 -1
  263. package/dist/development/src/resolvers/mutation/person/ResetPasswordMutationResolver.cjs.map +1 -1
  264. package/dist/development/src/resolvers/mutation/person/ResetPasswordMutationResolver.js +2 -1
  265. package/dist/development/src/resolvers/mutation/person/ResetPasswordMutationResolver.js.map +1 -1
  266. package/dist/development/src/resolvers/mutation/person/ResetPersonMfaMutationResolver.cjs +2 -1
  267. package/dist/development/src/resolvers/mutation/person/ResetPersonMfaMutationResolver.cjs.map +1 -1
  268. package/dist/development/src/resolvers/mutation/person/ResetPersonMfaMutationResolver.js +2 -1
  269. package/dist/development/src/resolvers/mutation/person/ResetPersonMfaMutationResolver.js.map +1 -1
  270. package/dist/development/src/resolvers/mutation/person/RevokeSessionMutationResolver.cjs +2 -1
  271. package/dist/development/src/resolvers/mutation/person/RevokeSessionMutationResolver.cjs.map +1 -1
  272. package/dist/development/src/resolvers/mutation/person/RevokeSessionMutationResolver.js +2 -1
  273. package/dist/development/src/resolvers/mutation/person/RevokeSessionMutationResolver.js.map +1 -1
  274. package/dist/development/src/resolvers/mutation/person/SignInMutationResolver.cjs +4 -3
  275. package/dist/development/src/resolvers/mutation/person/SignInMutationResolver.cjs.map +1 -1
  276. package/dist/development/src/resolvers/mutation/person/SignInMutationResolver.js +4 -3
  277. package/dist/development/src/resolvers/mutation/person/SignInMutationResolver.js.map +1 -1
  278. package/dist/development/src/resolvers/mutation/person/SignOutMutationResolver.cjs +2 -1
  279. package/dist/development/src/resolvers/mutation/person/SignOutMutationResolver.cjs.map +1 -1
  280. package/dist/development/src/resolvers/mutation/person/SignOutMutationResolver.js +2 -1
  281. package/dist/development/src/resolvers/mutation/person/SignOutMutationResolver.js.map +1 -1
  282. package/dist/development/src/resolvers/mutation/person/SignUpMutationResolver.cjs +2 -1
  283. package/dist/development/src/resolvers/mutation/person/SignUpMutationResolver.cjs.map +1 -1
  284. package/dist/development/src/resolvers/mutation/person/SignUpMutationResolver.js +2 -1
  285. package/dist/development/src/resolvers/mutation/person/SignUpMutationResolver.js.map +1 -1
  286. package/dist/development/src/resolvers/mutation/person/TogglePasswordlessMutationResolver.cjs +2 -1
  287. package/dist/development/src/resolvers/mutation/person/TogglePasswordlessMutationResolver.cjs.map +1 -1
  288. package/dist/development/src/resolvers/mutation/person/TogglePasswordlessMutationResolver.js +2 -1
  289. package/dist/development/src/resolvers/mutation/person/TogglePasswordlessMutationResolver.js.map +1 -1
  290. package/dist/development/src/resolvers/mutation/project/CreateProjectMutationResolver.cjs +2 -1
  291. package/dist/development/src/resolvers/mutation/project/CreateProjectMutationResolver.cjs.map +1 -1
  292. package/dist/development/src/resolvers/mutation/project/CreateProjectMutationResolver.js +2 -1
  293. package/dist/development/src/resolvers/mutation/project/CreateProjectMutationResolver.js.map +1 -1
  294. package/dist/development/src/resolvers/mutation/project/SetProjectSecretMutationResolver.cjs +2 -1
  295. package/dist/development/src/resolvers/mutation/project/SetProjectSecretMutationResolver.cjs.map +1 -1
  296. package/dist/development/src/resolvers/mutation/project/SetProjectSecretMutationResolver.js +2 -1
  297. package/dist/development/src/resolvers/mutation/project/SetProjectSecretMutationResolver.js.map +1 -1
  298. package/dist/development/src/resolvers/mutation/project/UpdateProjectMutationResolver.cjs +2 -1
  299. package/dist/development/src/resolvers/mutation/project/UpdateProjectMutationResolver.cjs.map +1 -1
  300. package/dist/development/src/resolvers/mutation/project/UpdateProjectMutationResolver.js +2 -1
  301. package/dist/development/src/resolvers/mutation/project/UpdateProjectMutationResolver.js.map +1 -1
  302. package/dist/development/src/resolvers/mutation/projectMember/AddProjectMemberMutationResolver.cjs +2 -1
  303. package/dist/development/src/resolvers/mutation/projectMember/AddProjectMemberMutationResolver.cjs.map +1 -1
  304. package/dist/development/src/resolvers/mutation/projectMember/AddProjectMemberMutationResolver.js +2 -1
  305. package/dist/development/src/resolvers/mutation/projectMember/AddProjectMemberMutationResolver.js.map +1 -1
  306. package/dist/development/src/resolvers/mutation/projectMember/RemoveProjectMemberMutationResolver.cjs +2 -1
  307. package/dist/development/src/resolvers/mutation/projectMember/RemoveProjectMemberMutationResolver.cjs.map +1 -1
  308. package/dist/development/src/resolvers/mutation/projectMember/RemoveProjectMemberMutationResolver.js +2 -1
  309. package/dist/development/src/resolvers/mutation/projectMember/RemoveProjectMemberMutationResolver.js.map +1 -1
  310. package/dist/development/src/resolvers/mutation/projectMember/UpdateProjectMemberMutationResolver.cjs +2 -1
  311. package/dist/development/src/resolvers/mutation/projectMember/UpdateProjectMemberMutationResolver.cjs.map +1 -1
  312. package/dist/development/src/resolvers/mutation/projectMember/UpdateProjectMemberMutationResolver.js +2 -1
  313. package/dist/development/src/resolvers/mutation/projectMember/UpdateProjectMemberMutationResolver.js.map +1 -1
  314. package/dist/development/src/resolvers/query/ApiKeyQueryResolver.cjs +2 -1
  315. package/dist/development/src/resolvers/query/ApiKeyQueryResolver.cjs.map +1 -1
  316. package/dist/development/src/resolvers/query/ApiKeyQueryResolver.js +2 -1
  317. package/dist/development/src/resolvers/query/ApiKeyQueryResolver.js.map +1 -1
  318. package/dist/development/src/resolvers/query/AuthLogQueryResolver.cjs +2 -1
  319. package/dist/development/src/resolvers/query/AuthLogQueryResolver.cjs.map +1 -1
  320. package/dist/development/src/resolvers/query/AuthLogQueryResolver.js +2 -1
  321. package/dist/development/src/resolvers/query/AuthLogQueryResolver.js.map +1 -1
  322. package/dist/development/src/resolvers/query/AuthPolicyQueryResolver.cjs +2 -1
  323. package/dist/development/src/resolvers/query/AuthPolicyQueryResolver.cjs.map +1 -1
  324. package/dist/development/src/resolvers/query/AuthPolicyQueryResolver.js +2 -1
  325. package/dist/development/src/resolvers/query/AuthPolicyQueryResolver.js.map +1 -1
  326. package/dist/development/src/resolvers/query/ConfigurationQueryResolver.cjs +2 -1
  327. package/dist/development/src/resolvers/query/ConfigurationQueryResolver.cjs.map +1 -1
  328. package/dist/development/src/resolvers/query/ConfigurationQueryResolver.js +2 -1
  329. package/dist/development/src/resolvers/query/ConfigurationQueryResolver.js.map +1 -1
  330. package/dist/development/src/resolvers/query/IDPQueryResolver.cjs +2 -1
  331. package/dist/development/src/resolvers/query/IDPQueryResolver.cjs.map +1 -1
  332. package/dist/development/src/resolvers/query/IDPQueryResolver.js +2 -1
  333. package/dist/development/src/resolvers/query/IDPQueryResolver.js.map +1 -1
  334. package/dist/development/src/resolvers/query/MailTemplateQueryResolver.cjs +2 -1
  335. package/dist/development/src/resolvers/query/MailTemplateQueryResolver.cjs.map +1 -1
  336. package/dist/development/src/resolvers/query/MailTemplateQueryResolver.js +2 -1
  337. package/dist/development/src/resolvers/query/MailTemplateQueryResolver.js.map +1 -1
  338. package/dist/development/src/resolvers/query/PersonQueryResolver.cjs +2 -1
  339. package/dist/development/src/resolvers/query/PersonQueryResolver.cjs.map +1 -1
  340. package/dist/development/src/resolvers/query/PersonQueryResolver.js +2 -1
  341. package/dist/development/src/resolvers/query/PersonQueryResolver.js.map +1 -1
  342. package/dist/development/src/resolvers/query/ProjectMembersQueryResolver.cjs +2 -1
  343. package/dist/development/src/resolvers/query/ProjectMembersQueryResolver.cjs.map +1 -1
  344. package/dist/development/src/resolvers/query/ProjectMembersQueryResolver.js +2 -1
  345. package/dist/development/src/resolvers/query/ProjectMembersQueryResolver.js.map +1 -1
  346. package/dist/development/src/resolvers/query/ProjectQueryResolver.cjs +5 -3
  347. package/dist/development/src/resolvers/query/ProjectQueryResolver.cjs.map +1 -1
  348. package/dist/development/src/resolvers/query/ProjectQueryResolver.js +5 -3
  349. package/dist/development/src/resolvers/query/ProjectQueryResolver.js.map +1 -1
  350. package/dist/development/src/resolvers/responseHelpers/ApiKeyResponseFactory.cjs +2 -1
  351. package/dist/development/src/resolvers/responseHelpers/ApiKeyResponseFactory.cjs.map +1 -1
  352. package/dist/development/src/resolvers/responseHelpers/ApiKeyResponseFactory.js +2 -1
  353. package/dist/development/src/resolvers/responseHelpers/ApiKeyResponseFactory.js.map +1 -1
  354. package/dist/development/src/resolvers/responseHelpers/PersonResponseFactory.cjs +5 -0
  355. package/dist/development/src/resolvers/responseHelpers/PersonResponseFactory.cjs.map +1 -1
  356. package/dist/development/src/resolvers/responseHelpers/PersonResponseFactory.js +5 -0
  357. package/dist/development/src/resolvers/responseHelpers/PersonResponseFactory.js.map +1 -1
  358. package/dist/development/src/resolvers/responseHelpers/ProjectResponseFactory.cjs +23 -0
  359. package/dist/development/src/resolvers/responseHelpers/ProjectResponseFactory.cjs.map +1 -0
  360. package/dist/development/src/resolvers/responseHelpers/ProjectResponseFactory.js +23 -0
  361. package/dist/development/src/resolvers/responseHelpers/ProjectResponseFactory.js.map +1 -0
  362. package/dist/development/src/resolvers/responseHelpers/SignInResponseFactory.cjs +2 -1
  363. package/dist/development/src/resolvers/responseHelpers/SignInResponseFactory.cjs.map +1 -1
  364. package/dist/development/src/resolvers/responseHelpers/SignInResponseFactory.js +2 -1
  365. package/dist/development/src/resolvers/responseHelpers/SignInResponseFactory.js.map +1 -1
  366. package/dist/development/src/resolvers/types/IdentityTypeResolver.cjs +37 -4
  367. package/dist/development/src/resolvers/types/IdentityTypeResolver.cjs.map +1 -1
  368. package/dist/development/src/resolvers/types/IdentityTypeResolver.js +37 -4
  369. package/dist/development/src/resolvers/types/IdentityTypeResolver.js.map +1 -1
  370. package/dist/development/src/resolvers/types/PersonTypeResolver.cjs +30 -1
  371. package/dist/development/src/resolvers/types/PersonTypeResolver.cjs.map +1 -1
  372. package/dist/development/src/resolvers/types/PersonTypeResolver.js +30 -1
  373. package/dist/development/src/resolvers/types/PersonTypeResolver.js.map +1 -1
  374. package/dist/development/src/resolvers/types/ProjectTypeResolver.cjs +25 -1
  375. package/dist/development/src/resolvers/types/ProjectTypeResolver.cjs.map +1 -1
  376. package/dist/development/src/resolvers/types/ProjectTypeResolver.js +25 -1
  377. package/dist/development/src/resolvers/types/ProjectTypeResolver.js.map +1 -1
  378. package/dist/development/src/schema/tenant.graphql.cjs +144 -0
  379. package/dist/development/src/schema/tenant.graphql.cjs.map +1 -1
  380. package/dist/development/src/schema/tenant.graphql.js +144 -0
  381. package/dist/development/src/schema/tenant.graphql.js.map +1 -1
  382. package/dist/production/index.cjs +32 -0
  383. package/dist/production/index.cjs.map +1 -1
  384. package/dist/production/index.js +33 -1
  385. package/dist/production/index.js.map +1 -1
  386. package/dist/production/src/TenantContainer.cjs +15 -3
  387. package/dist/production/src/TenantContainer.cjs.map +1 -1
  388. package/dist/production/src/TenantContainer.js +15 -3
  389. package/dist/production/src/TenantContainer.js.map +1 -1
  390. package/dist/production/src/bridges/system/IdentityFetcher.cjs +2 -1
  391. package/dist/production/src/bridges/system/IdentityFetcher.cjs.map +1 -1
  392. package/dist/production/src/bridges/system/IdentityFetcher.js +2 -1
  393. package/dist/production/src/bridges/system/IdentityFetcher.js.map +1 -1
  394. package/dist/production/src/migrations/2026-06-18-120000-idp-claim-mapping.cjs +10 -0
  395. package/dist/production/src/migrations/2026-06-18-120000-idp-claim-mapping.cjs.map +1 -0
  396. package/dist/production/src/migrations/2026-06-18-120000-idp-claim-mapping.js +11 -0
  397. package/dist/production/src/migrations/2026-06-18-120000-idp-claim-mapping.js.map +1 -0
  398. package/dist/production/src/migrations/2026-08-03-120000-person-enable-auth-log.cjs +9 -0
  399. package/dist/production/src/migrations/2026-08-03-120000-person-enable-auth-log.cjs.map +1 -0
  400. package/dist/production/src/migrations/2026-08-03-120000-person-enable-auth-log.js +10 -0
  401. package/dist/production/src/migrations/2026-08-03-120000-person-enable-auth-log.js.map +1 -0
  402. package/dist/production/src/migrations/2026-08-04-120000-config-panel.cjs +11 -0
  403. package/dist/production/src/migrations/2026-08-04-120000-config-panel.cjs.map +1 -0
  404. package/dist/production/src/migrations/2026-08-04-120000-config-panel.js +12 -0
  405. package/dist/production/src/migrations/2026-08-04-120000-config-panel.js.map +1 -0
  406. package/dist/production/src/migrations/2026-09-04-120000-idp-disable-local-authentication.cjs +18 -0
  407. package/dist/production/src/migrations/2026-09-04-120000-idp-disable-local-authentication.cjs.map +1 -0
  408. package/dist/production/src/migrations/2026-09-04-120000-idp-disable-local-authentication.js +19 -0
  409. package/dist/production/src/migrations/2026-09-04-120000-idp-disable-local-authentication.js.map +1 -0
  410. package/dist/production/src/migrations/runner.cjs +11 -2
  411. package/dist/production/src/migrations/runner.cjs.map +1 -1
  412. package/dist/production/src/migrations/runner.js +11 -2
  413. package/dist/production/src/migrations/runner.js.map +1 -1
  414. package/dist/production/src/migrations/snapshot.cjs +8 -2
  415. package/dist/production/src/migrations/snapshot.cjs.map +1 -1
  416. package/dist/production/src/migrations/snapshot.js +8 -2
  417. package/dist/production/src/migrations/snapshot.js.map +1 -1
  418. package/dist/production/src/model/commands/configuration/UpdateConfigurationCommand.cjs +5 -3
  419. package/dist/production/src/model/commands/configuration/UpdateConfigurationCommand.cjs.map +1 -1
  420. package/dist/production/src/model/commands/configuration/UpdateConfigurationCommand.js +5 -3
  421. package/dist/production/src/model/commands/configuration/UpdateConfigurationCommand.js.map +1 -1
  422. package/dist/production/src/model/commands/idp/CreateIdpCommand.cjs +8 -2
  423. package/dist/production/src/model/commands/idp/CreateIdpCommand.cjs.map +1 -1
  424. package/dist/production/src/model/commands/idp/CreateIdpCommand.js +8 -2
  425. package/dist/production/src/model/commands/idp/CreateIdpCommand.js.map +1 -1
  426. package/dist/production/src/model/commands/idp/UpdateIdpCommand.cjs +6 -2
  427. package/dist/production/src/model/commands/idp/UpdateIdpCommand.cjs.map +1 -1
  428. package/dist/production/src/model/commands/idp/UpdateIdpCommand.js +6 -2
  429. package/dist/production/src/model/commands/idp/UpdateIdpCommand.js.map +1 -1
  430. package/dist/production/src/model/commands/membership/{RemoveProjectMembershipsCommand.cjs → RemoveProjectMembershipCommand.cjs} +1 -1
  431. package/dist/production/src/model/commands/membership/RemoveProjectMembershipCommand.cjs.map +1 -0
  432. package/dist/production/src/model/commands/membership/{RemoveProjectMembershipsCommand.js → RemoveProjectMembershipCommand.js} +1 -1
  433. package/dist/production/src/model/commands/membership/RemoveProjectMembershipCommand.js.map +1 -0
  434. package/dist/production/src/model/commands/membership/UpdateProjectMemberCommand.cjs +2 -2
  435. package/dist/production/src/model/commands/membership/UpdateProjectMemberCommand.cjs.map +1 -1
  436. package/dist/production/src/model/commands/membership/UpdateProjectMemberCommand.js +1 -1
  437. package/dist/production/src/model/commands/membership/UpdateProjectMemberCommand.js.map +1 -1
  438. package/dist/production/src/model/commands/person/EnablePersonCommand.cjs +17 -0
  439. package/dist/production/src/model/commands/person/EnablePersonCommand.cjs.map +1 -0
  440. package/dist/production/src/model/commands/person/EnablePersonCommand.js +17 -0
  441. package/dist/production/src/model/commands/person/EnablePersonCommand.js.map +1 -0
  442. package/dist/production/src/model/queries/configuration/ConfigurationQuery.cjs +4 -0
  443. package/dist/production/src/model/queries/configuration/ConfigurationQuery.cjs.map +1 -1
  444. package/dist/production/src/model/queries/configuration/ConfigurationQuery.js +4 -0
  445. package/dist/production/src/model/queries/configuration/ConfigurationQuery.js.map +1 -1
  446. package/dist/production/src/model/queries/idp/LocalAuthDisablingIdpsQuery.cjs +21 -0
  447. package/dist/production/src/model/queries/idp/LocalAuthDisablingIdpsQuery.cjs.map +1 -0
  448. package/dist/production/src/model/queries/idp/LocalAuthDisablingIdpsQuery.js +21 -0
  449. package/dist/production/src/model/queries/idp/LocalAuthDisablingIdpsQuery.js.map +1 -0
  450. package/dist/production/src/model/queries/idp/PersonIdentityProvidersQuery.cjs +1 -1
  451. package/dist/production/src/model/queries/idp/PersonIdentityProvidersQuery.cjs.map +1 -1
  452. package/dist/production/src/model/queries/idp/PersonIdentityProvidersQuery.js +1 -1
  453. package/dist/production/src/model/queries/idp/PersonIdentityProvidersQuery.js.map +1 -1
  454. package/dist/production/src/model/queries/idp/helpers.cjs +3 -3
  455. package/dist/production/src/model/queries/idp/helpers.cjs.map +1 -1
  456. package/dist/production/src/model/queries/idp/helpers.js +3 -3
  457. package/dist/production/src/model/queries/idp/helpers.js.map +1 -1
  458. package/dist/production/src/model/queries/membership/ProjectMembersQuery.cjs +1 -1
  459. package/dist/production/src/model/queries/membership/ProjectMembersQuery.cjs.map +1 -1
  460. package/dist/production/src/model/queries/membership/ProjectMembersQuery.js +1 -1
  461. package/dist/production/src/model/queries/membership/ProjectMembersQuery.js.map +1 -1
  462. package/dist/production/src/model/queries/person/PersonQueryBuilderFactory.cjs +1 -1
  463. package/dist/production/src/model/queries/person/PersonQueryBuilderFactory.cjs.map +1 -1
  464. package/dist/production/src/model/queries/person/PersonQueryBuilderFactory.js +1 -1
  465. package/dist/production/src/model/queries/person/PersonQueryBuilderFactory.js.map +1 -1
  466. package/dist/production/src/model/service/AuthLogService.cjs +8 -2
  467. package/dist/production/src/model/service/AuthLogService.cjs.map +1 -1
  468. package/dist/production/src/model/service/AuthLogService.js +8 -2
  469. package/dist/production/src/model/service/AuthLogService.js.map +1 -1
  470. package/dist/production/src/model/service/IDPSignInManager.cjs +29 -2
  471. package/dist/production/src/model/service/IDPSignInManager.cjs.map +1 -1
  472. package/dist/production/src/model/service/IDPSignInManager.js +29 -2
  473. package/dist/production/src/model/service/IDPSignInManager.js.map +1 -1
  474. package/dist/production/src/model/service/PanelAccessResolver.cjs +31 -0
  475. package/dist/production/src/model/service/PanelAccessResolver.cjs.map +1 -0
  476. package/dist/production/src/model/service/PanelAccessResolver.js +31 -0
  477. package/dist/production/src/model/service/PanelAccessResolver.js.map +1 -0
  478. package/dist/production/src/model/service/PasswordResetManager.cjs +5 -0
  479. package/dist/production/src/model/service/PasswordResetManager.cjs.map +1 -1
  480. package/dist/production/src/model/service/PasswordResetManager.js +5 -0
  481. package/dist/production/src/model/service/PasswordResetManager.js.map +1 -1
  482. package/dist/production/src/model/service/PasswordlessSignInManager.cjs +19 -0
  483. package/dist/production/src/model/service/PasswordlessSignInManager.cjs.map +1 -1
  484. package/dist/production/src/model/service/PasswordlessSignInManager.js +19 -0
  485. package/dist/production/src/model/service/PasswordlessSignInManager.js.map +1 -1
  486. package/dist/production/src/model/service/PersonAccessManager.cjs +10 -2
  487. package/dist/production/src/model/service/PersonAccessManager.cjs.map +1 -1
  488. package/dist/production/src/model/service/PersonAccessManager.js +10 -2
  489. package/dist/production/src/model/service/PersonAccessManager.js.map +1 -1
  490. package/dist/production/src/model/service/SignInManager.cjs +5 -0
  491. package/dist/production/src/model/service/SignInManager.cjs.map +1 -1
  492. package/dist/production/src/model/service/SignInManager.js +5 -0
  493. package/dist/production/src/model/service/SignInManager.js.map +1 -1
  494. package/dist/production/src/model/service/apiKey/ApiKeyManager.cjs +4 -3
  495. package/dist/production/src/model/service/apiKey/ApiKeyManager.cjs.map +1 -1
  496. package/dist/production/src/model/service/apiKey/ApiKeyManager.js +4 -3
  497. package/dist/production/src/model/service/apiKey/ApiKeyManager.js.map +1 -1
  498. package/dist/production/src/model/service/apiKey/UnpersistedApiKeyManager.cjs +7 -0
  499. package/dist/production/src/model/service/apiKey/UnpersistedApiKeyManager.cjs.map +1 -1
  500. package/dist/production/src/model/service/apiKey/UnpersistedApiKeyManager.js +8 -1
  501. package/dist/production/src/model/service/apiKey/UnpersistedApiKeyManager.js.map +1 -1
  502. package/dist/production/src/model/service/idp/ClaimMapping.cjs +187 -0
  503. package/dist/production/src/model/service/idp/ClaimMapping.cjs.map +1 -0
  504. package/dist/production/src/model/service/idp/ClaimMapping.js +170 -0
  505. package/dist/production/src/model/service/idp/ClaimMapping.js.map +1 -0
  506. package/dist/production/src/model/service/idp/ClaimMappingEvaluator.cjs +155 -0
  507. package/dist/production/src/model/service/idp/ClaimMappingEvaluator.cjs.map +1 -0
  508. package/dist/production/src/model/service/idp/ClaimMappingEvaluator.js +155 -0
  509. package/dist/production/src/model/service/idp/ClaimMappingEvaluator.js.map +1 -0
  510. package/dist/production/src/model/service/idp/ClaimMappingValidation.cjs +83 -0
  511. package/dist/production/src/model/service/idp/ClaimMappingValidation.cjs.map +1 -0
  512. package/dist/production/src/model/service/idp/ClaimMappingValidation.js +83 -0
  513. package/dist/production/src/model/service/idp/ClaimMappingValidation.js.map +1 -0
  514. package/dist/production/src/model/service/idp/IDPClaimSyncService.cjs +260 -0
  515. package/dist/production/src/model/service/idp/IDPClaimSyncService.cjs.map +1 -0
  516. package/dist/production/src/model/service/idp/IDPClaimSyncService.js +260 -0
  517. package/dist/production/src/model/service/idp/IDPClaimSyncService.js.map +1 -0
  518. package/dist/production/src/model/service/idp/IDPManager.cjs +96 -20
  519. package/dist/production/src/model/service/idp/IDPManager.cjs.map +1 -1
  520. package/dist/production/src/model/service/idp/IDPManager.js +96 -20
  521. package/dist/production/src/model/service/idp/IDPManager.js.map +1 -1
  522. package/dist/production/src/model/service/idp/IdpSessionRevalidator.cjs +55 -1
  523. package/dist/production/src/model/service/idp/IdpSessionRevalidator.cjs.map +1 -1
  524. package/dist/production/src/model/service/idp/IdpSessionRevalidator.js +55 -1
  525. package/dist/production/src/model/service/idp/IdpSessionRevalidator.js.map +1 -1
  526. package/dist/production/src/model/service/idp/PersonIdentityProviderManager.cjs +6 -0
  527. package/dist/production/src/model/service/idp/PersonIdentityProviderManager.cjs.map +1 -1
  528. package/dist/production/src/model/service/idp/PersonIdentityProviderManager.js +6 -0
  529. package/dist/production/src/model/service/idp/PersonIdentityProviderManager.js.map +1 -1
  530. package/dist/production/src/model/service/idp/providers/OIDCHelpers.cjs +69 -33
  531. package/dist/production/src/model/service/idp/providers/OIDCHelpers.cjs.map +1 -1
  532. package/dist/production/src/model/service/idp/providers/OIDCHelpers.js +69 -33
  533. package/dist/production/src/model/service/idp/providers/OIDCHelpers.js.map +1 -1
  534. package/dist/production/src/model/service/idp/providers/OIDCProvider.cjs +4 -1
  535. package/dist/production/src/model/service/idp/providers/OIDCProvider.cjs.map +1 -1
  536. package/dist/production/src/model/service/idp/providers/OIDCProvider.js +4 -1
  537. package/dist/production/src/model/service/idp/providers/OIDCProvider.js.map +1 -1
  538. package/dist/production/src/model/utils/DatabaseContext.cjs +7 -2
  539. package/dist/production/src/model/utils/DatabaseContext.cjs.map +1 -1
  540. package/dist/production/src/model/utils/DatabaseContext.js +8 -3
  541. package/dist/production/src/model/utils/DatabaseContext.js.map +1 -1
  542. package/dist/production/src/resolvers/ResolverFactory.cjs +6 -2
  543. package/dist/production/src/resolvers/ResolverFactory.cjs.map +1 -1
  544. package/dist/production/src/resolvers/ResolverFactory.js +6 -2
  545. package/dist/production/src/resolvers/ResolverFactory.js.map +1 -1
  546. package/dist/production/src/resolvers/mutation/apiKey/CreateApiKeyMutationResolver.cjs +2 -1
  547. package/dist/production/src/resolvers/mutation/apiKey/CreateApiKeyMutationResolver.cjs.map +1 -1
  548. package/dist/production/src/resolvers/mutation/apiKey/CreateApiKeyMutationResolver.js +2 -1
  549. package/dist/production/src/resolvers/mutation/apiKey/CreateApiKeyMutationResolver.js.map +1 -1
  550. package/dist/production/src/resolvers/mutation/apiKey/DisableApiKeyMutationResolver.cjs +2 -1
  551. package/dist/production/src/resolvers/mutation/apiKey/DisableApiKeyMutationResolver.cjs.map +1 -1
  552. package/dist/production/src/resolvers/mutation/apiKey/DisableApiKeyMutationResolver.js +2 -1
  553. package/dist/production/src/resolvers/mutation/apiKey/DisableApiKeyMutationResolver.js.map +1 -1
  554. package/dist/production/src/resolvers/mutation/configuration/AuthPolicyMutationResolver.cjs +2 -1
  555. package/dist/production/src/resolvers/mutation/configuration/AuthPolicyMutationResolver.cjs.map +1 -1
  556. package/dist/production/src/resolvers/mutation/configuration/AuthPolicyMutationResolver.js +2 -1
  557. package/dist/production/src/resolvers/mutation/configuration/AuthPolicyMutationResolver.js.map +1 -1
  558. package/dist/production/src/resolvers/mutation/configuration/ConfigurationMutationResolver.cjs +2 -1
  559. package/dist/production/src/resolvers/mutation/configuration/ConfigurationMutationResolver.cjs.map +1 -1
  560. package/dist/production/src/resolvers/mutation/configuration/ConfigurationMutationResolver.js +2 -1
  561. package/dist/production/src/resolvers/mutation/configuration/ConfigurationMutationResolver.js.map +1 -1
  562. package/dist/production/src/resolvers/mutation/identity/GlobalRolesMutationResolver.cjs +2 -1
  563. package/dist/production/src/resolvers/mutation/identity/GlobalRolesMutationResolver.cjs.map +1 -1
  564. package/dist/production/src/resolvers/mutation/identity/GlobalRolesMutationResolver.js +2 -1
  565. package/dist/production/src/resolvers/mutation/identity/GlobalRolesMutationResolver.js.map +1 -1
  566. package/dist/production/src/resolvers/mutation/idp/AddIDPMutationResolver.cjs +4 -2
  567. package/dist/production/src/resolvers/mutation/idp/AddIDPMutationResolver.cjs.map +1 -1
  568. package/dist/production/src/resolvers/mutation/idp/AddIDPMutationResolver.js +4 -2
  569. package/dist/production/src/resolvers/mutation/idp/AddIDPMutationResolver.js.map +1 -1
  570. package/dist/production/src/resolvers/mutation/idp/DisableIDPMutationResolver.cjs +2 -1
  571. package/dist/production/src/resolvers/mutation/idp/DisableIDPMutationResolver.cjs.map +1 -1
  572. package/dist/production/src/resolvers/mutation/idp/DisableIDPMutationResolver.js +2 -1
  573. package/dist/production/src/resolvers/mutation/idp/DisableIDPMutationResolver.js.map +1 -1
  574. package/dist/production/src/resolvers/mutation/idp/DisconnectMyIdentityProviderMutationResolver.cjs +2 -1
  575. package/dist/production/src/resolvers/mutation/idp/DisconnectMyIdentityProviderMutationResolver.cjs.map +1 -1
  576. package/dist/production/src/resolvers/mutation/idp/DisconnectMyIdentityProviderMutationResolver.js +2 -1
  577. package/dist/production/src/resolvers/mutation/idp/DisconnectMyIdentityProviderMutationResolver.js.map +1 -1
  578. package/dist/production/src/resolvers/mutation/idp/EnableIDPMutationResolver.cjs +2 -1
  579. package/dist/production/src/resolvers/mutation/idp/EnableIDPMutationResolver.cjs.map +1 -1
  580. package/dist/production/src/resolvers/mutation/idp/EnableIDPMutationResolver.js +2 -1
  581. package/dist/production/src/resolvers/mutation/idp/EnableIDPMutationResolver.js.map +1 -1
  582. package/dist/production/src/resolvers/mutation/idp/UpdateIDPMutationResolver.cjs +4 -2
  583. package/dist/production/src/resolvers/mutation/idp/UpdateIDPMutationResolver.cjs.map +1 -1
  584. package/dist/production/src/resolvers/mutation/idp/UpdateIDPMutationResolver.js +4 -2
  585. package/dist/production/src/resolvers/mutation/idp/UpdateIDPMutationResolver.js.map +1 -1
  586. package/dist/production/src/resolvers/mutation/idp/audit.cjs +1 -0
  587. package/dist/production/src/resolvers/mutation/idp/audit.cjs.map +1 -1
  588. package/dist/production/src/resolvers/mutation/idp/audit.js +1 -0
  589. package/dist/production/src/resolvers/mutation/idp/audit.js.map +1 -1
  590. package/dist/production/src/resolvers/mutation/mailTemplates/MailTemplateMutationResolver.cjs +2 -1
  591. package/dist/production/src/resolvers/mutation/mailTemplates/MailTemplateMutationResolver.cjs.map +1 -1
  592. package/dist/production/src/resolvers/mutation/mailTemplates/MailTemplateMutationResolver.js +2 -1
  593. package/dist/production/src/resolvers/mutation/mailTemplates/MailTemplateMutationResolver.js.map +1 -1
  594. package/dist/production/src/resolvers/mutation/person/ChangePasswordMutationResolver.cjs +2 -1
  595. package/dist/production/src/resolvers/mutation/person/ChangePasswordMutationResolver.cjs.map +1 -1
  596. package/dist/production/src/resolvers/mutation/person/ChangePasswordMutationResolver.js +2 -1
  597. package/dist/production/src/resolvers/mutation/person/ChangePasswordMutationResolver.js.map +1 -1
  598. package/dist/production/src/resolvers/mutation/person/ChangeProfileMutationResolver.cjs +2 -1
  599. package/dist/production/src/resolvers/mutation/person/ChangeProfileMutationResolver.cjs.map +1 -1
  600. package/dist/production/src/resolvers/mutation/person/ChangeProfileMutationResolver.js +2 -1
  601. package/dist/production/src/resolvers/mutation/person/ChangeProfileMutationResolver.js.map +1 -1
  602. package/dist/production/src/resolvers/mutation/person/DisablePersonMutationResolver.cjs +4 -3
  603. package/dist/production/src/resolvers/mutation/person/DisablePersonMutationResolver.cjs.map +1 -1
  604. package/dist/production/src/resolvers/mutation/person/DisablePersonMutationResolver.js +4 -3
  605. package/dist/production/src/resolvers/mutation/person/DisablePersonMutationResolver.js.map +1 -1
  606. package/dist/production/src/resolvers/mutation/person/EmailOtpMutationResolver.cjs +2 -1
  607. package/dist/production/src/resolvers/mutation/person/EmailOtpMutationResolver.cjs.map +1 -1
  608. package/dist/production/src/resolvers/mutation/person/EmailOtpMutationResolver.js +2 -1
  609. package/dist/production/src/resolvers/mutation/person/EmailOtpMutationResolver.js.map +1 -1
  610. package/dist/production/src/resolvers/mutation/person/EmailVerificationMutationResolver.cjs +2 -1
  611. package/dist/production/src/resolvers/mutation/person/EmailVerificationMutationResolver.cjs.map +1 -1
  612. package/dist/production/src/resolvers/mutation/person/EmailVerificationMutationResolver.js +2 -1
  613. package/dist/production/src/resolvers/mutation/person/EmailVerificationMutationResolver.js.map +1 -1
  614. package/dist/production/src/resolvers/mutation/person/EnablePersonMutationResolver.cjs +60 -0
  615. package/dist/production/src/resolvers/mutation/person/EnablePersonMutationResolver.cjs.map +1 -0
  616. package/dist/production/src/resolvers/mutation/person/EnablePersonMutationResolver.js +60 -0
  617. package/dist/production/src/resolvers/mutation/person/EnablePersonMutationResolver.js.map +1 -0
  618. package/dist/production/src/resolvers/mutation/person/ForceSignOutMutationResolver.cjs +2 -1
  619. package/dist/production/src/resolvers/mutation/person/ForceSignOutMutationResolver.cjs.map +1 -1
  620. package/dist/production/src/resolvers/mutation/person/ForceSignOutMutationResolver.js +2 -1
  621. package/dist/production/src/resolvers/mutation/person/ForceSignOutMutationResolver.js.map +1 -1
  622. package/dist/production/src/resolvers/mutation/person/IDPMutationResolver.cjs +27 -1
  623. package/dist/production/src/resolvers/mutation/person/IDPMutationResolver.cjs.map +1 -1
  624. package/dist/production/src/resolvers/mutation/person/IDPMutationResolver.js +27 -1
  625. package/dist/production/src/resolvers/mutation/person/IDPMutationResolver.js.map +1 -1
  626. package/dist/production/src/resolvers/mutation/person/InviteMutationResolver.cjs +2 -1
  627. package/dist/production/src/resolvers/mutation/person/InviteMutationResolver.cjs.map +1 -1
  628. package/dist/production/src/resolvers/mutation/person/InviteMutationResolver.js +2 -1
  629. package/dist/production/src/resolvers/mutation/person/InviteMutationResolver.js.map +1 -1
  630. package/dist/production/src/resolvers/mutation/person/OtpMutationResolver.cjs +2 -1
  631. package/dist/production/src/resolvers/mutation/person/OtpMutationResolver.cjs.map +1 -1
  632. package/dist/production/src/resolvers/mutation/person/OtpMutationResolver.js +2 -1
  633. package/dist/production/src/resolvers/mutation/person/OtpMutationResolver.js.map +1 -1
  634. package/dist/production/src/resolvers/mutation/person/PasswordlessMutationResolver.cjs +6 -1
  635. package/dist/production/src/resolvers/mutation/person/PasswordlessMutationResolver.cjs.map +1 -1
  636. package/dist/production/src/resolvers/mutation/person/PasswordlessMutationResolver.js +6 -1
  637. package/dist/production/src/resolvers/mutation/person/PasswordlessMutationResolver.js.map +1 -1
  638. package/dist/production/src/resolvers/mutation/person/RegenerateBackupCodesMutationResolver.cjs +2 -1
  639. package/dist/production/src/resolvers/mutation/person/RegenerateBackupCodesMutationResolver.cjs.map +1 -1
  640. package/dist/production/src/resolvers/mutation/person/RegenerateBackupCodesMutationResolver.js +2 -1
  641. package/dist/production/src/resolvers/mutation/person/RegenerateBackupCodesMutationResolver.js.map +1 -1
  642. package/dist/production/src/resolvers/mutation/person/ResetPasswordMutationResolver.cjs +2 -1
  643. package/dist/production/src/resolvers/mutation/person/ResetPasswordMutationResolver.cjs.map +1 -1
  644. package/dist/production/src/resolvers/mutation/person/ResetPasswordMutationResolver.js +2 -1
  645. package/dist/production/src/resolvers/mutation/person/ResetPasswordMutationResolver.js.map +1 -1
  646. package/dist/production/src/resolvers/mutation/person/ResetPersonMfaMutationResolver.cjs +2 -1
  647. package/dist/production/src/resolvers/mutation/person/ResetPersonMfaMutationResolver.cjs.map +1 -1
  648. package/dist/production/src/resolvers/mutation/person/ResetPersonMfaMutationResolver.js +2 -1
  649. package/dist/production/src/resolvers/mutation/person/ResetPersonMfaMutationResolver.js.map +1 -1
  650. package/dist/production/src/resolvers/mutation/person/RevokeSessionMutationResolver.cjs +2 -1
  651. package/dist/production/src/resolvers/mutation/person/RevokeSessionMutationResolver.cjs.map +1 -1
  652. package/dist/production/src/resolvers/mutation/person/RevokeSessionMutationResolver.js +2 -1
  653. package/dist/production/src/resolvers/mutation/person/RevokeSessionMutationResolver.js.map +1 -1
  654. package/dist/production/src/resolvers/mutation/person/SignInMutationResolver.cjs +4 -3
  655. package/dist/production/src/resolvers/mutation/person/SignInMutationResolver.cjs.map +1 -1
  656. package/dist/production/src/resolvers/mutation/person/SignInMutationResolver.js +4 -3
  657. package/dist/production/src/resolvers/mutation/person/SignInMutationResolver.js.map +1 -1
  658. package/dist/production/src/resolvers/mutation/person/SignOutMutationResolver.cjs +2 -1
  659. package/dist/production/src/resolvers/mutation/person/SignOutMutationResolver.cjs.map +1 -1
  660. package/dist/production/src/resolvers/mutation/person/SignOutMutationResolver.js +2 -1
  661. package/dist/production/src/resolvers/mutation/person/SignOutMutationResolver.js.map +1 -1
  662. package/dist/production/src/resolvers/mutation/person/SignUpMutationResolver.cjs +2 -1
  663. package/dist/production/src/resolvers/mutation/person/SignUpMutationResolver.cjs.map +1 -1
  664. package/dist/production/src/resolvers/mutation/person/SignUpMutationResolver.js +2 -1
  665. package/dist/production/src/resolvers/mutation/person/SignUpMutationResolver.js.map +1 -1
  666. package/dist/production/src/resolvers/mutation/person/TogglePasswordlessMutationResolver.cjs +2 -1
  667. package/dist/production/src/resolvers/mutation/person/TogglePasswordlessMutationResolver.cjs.map +1 -1
  668. package/dist/production/src/resolvers/mutation/person/TogglePasswordlessMutationResolver.js +2 -1
  669. package/dist/production/src/resolvers/mutation/person/TogglePasswordlessMutationResolver.js.map +1 -1
  670. package/dist/production/src/resolvers/mutation/project/CreateProjectMutationResolver.cjs +2 -1
  671. package/dist/production/src/resolvers/mutation/project/CreateProjectMutationResolver.cjs.map +1 -1
  672. package/dist/production/src/resolvers/mutation/project/CreateProjectMutationResolver.js +2 -1
  673. package/dist/production/src/resolvers/mutation/project/CreateProjectMutationResolver.js.map +1 -1
  674. package/dist/production/src/resolvers/mutation/project/SetProjectSecretMutationResolver.cjs +2 -1
  675. package/dist/production/src/resolvers/mutation/project/SetProjectSecretMutationResolver.cjs.map +1 -1
  676. package/dist/production/src/resolvers/mutation/project/SetProjectSecretMutationResolver.js +2 -1
  677. package/dist/production/src/resolvers/mutation/project/SetProjectSecretMutationResolver.js.map +1 -1
  678. package/dist/production/src/resolvers/mutation/project/UpdateProjectMutationResolver.cjs +2 -1
  679. package/dist/production/src/resolvers/mutation/project/UpdateProjectMutationResolver.cjs.map +1 -1
  680. package/dist/production/src/resolvers/mutation/project/UpdateProjectMutationResolver.js +2 -1
  681. package/dist/production/src/resolvers/mutation/project/UpdateProjectMutationResolver.js.map +1 -1
  682. package/dist/production/src/resolvers/mutation/projectMember/AddProjectMemberMutationResolver.cjs +2 -1
  683. package/dist/production/src/resolvers/mutation/projectMember/AddProjectMemberMutationResolver.cjs.map +1 -1
  684. package/dist/production/src/resolvers/mutation/projectMember/AddProjectMemberMutationResolver.js +2 -1
  685. package/dist/production/src/resolvers/mutation/projectMember/AddProjectMemberMutationResolver.js.map +1 -1
  686. package/dist/production/src/resolvers/mutation/projectMember/RemoveProjectMemberMutationResolver.cjs +2 -1
  687. package/dist/production/src/resolvers/mutation/projectMember/RemoveProjectMemberMutationResolver.cjs.map +1 -1
  688. package/dist/production/src/resolvers/mutation/projectMember/RemoveProjectMemberMutationResolver.js +2 -1
  689. package/dist/production/src/resolvers/mutation/projectMember/RemoveProjectMemberMutationResolver.js.map +1 -1
  690. package/dist/production/src/resolvers/mutation/projectMember/UpdateProjectMemberMutationResolver.cjs +2 -1
  691. package/dist/production/src/resolvers/mutation/projectMember/UpdateProjectMemberMutationResolver.cjs.map +1 -1
  692. package/dist/production/src/resolvers/mutation/projectMember/UpdateProjectMemberMutationResolver.js +2 -1
  693. package/dist/production/src/resolvers/mutation/projectMember/UpdateProjectMemberMutationResolver.js.map +1 -1
  694. package/dist/production/src/resolvers/query/ApiKeyQueryResolver.cjs +2 -1
  695. package/dist/production/src/resolvers/query/ApiKeyQueryResolver.cjs.map +1 -1
  696. package/dist/production/src/resolvers/query/ApiKeyQueryResolver.js +2 -1
  697. package/dist/production/src/resolvers/query/ApiKeyQueryResolver.js.map +1 -1
  698. package/dist/production/src/resolvers/query/AuthLogQueryResolver.cjs +2 -1
  699. package/dist/production/src/resolvers/query/AuthLogQueryResolver.cjs.map +1 -1
  700. package/dist/production/src/resolvers/query/AuthLogQueryResolver.js +2 -1
  701. package/dist/production/src/resolvers/query/AuthLogQueryResolver.js.map +1 -1
  702. package/dist/production/src/resolvers/query/AuthPolicyQueryResolver.cjs +2 -1
  703. package/dist/production/src/resolvers/query/AuthPolicyQueryResolver.cjs.map +1 -1
  704. package/dist/production/src/resolvers/query/AuthPolicyQueryResolver.js +2 -1
  705. package/dist/production/src/resolvers/query/AuthPolicyQueryResolver.js.map +1 -1
  706. package/dist/production/src/resolvers/query/ConfigurationQueryResolver.cjs +2 -1
  707. package/dist/production/src/resolvers/query/ConfigurationQueryResolver.cjs.map +1 -1
  708. package/dist/production/src/resolvers/query/ConfigurationQueryResolver.js +2 -1
  709. package/dist/production/src/resolvers/query/ConfigurationQueryResolver.js.map +1 -1
  710. package/dist/production/src/resolvers/query/IDPQueryResolver.cjs +2 -1
  711. package/dist/production/src/resolvers/query/IDPQueryResolver.cjs.map +1 -1
  712. package/dist/production/src/resolvers/query/IDPQueryResolver.js +2 -1
  713. package/dist/production/src/resolvers/query/IDPQueryResolver.js.map +1 -1
  714. package/dist/production/src/resolvers/query/MailTemplateQueryResolver.cjs +2 -1
  715. package/dist/production/src/resolvers/query/MailTemplateQueryResolver.cjs.map +1 -1
  716. package/dist/production/src/resolvers/query/MailTemplateQueryResolver.js +2 -1
  717. package/dist/production/src/resolvers/query/MailTemplateQueryResolver.js.map +1 -1
  718. package/dist/production/src/resolvers/query/PersonQueryResolver.cjs +2 -1
  719. package/dist/production/src/resolvers/query/PersonQueryResolver.cjs.map +1 -1
  720. package/dist/production/src/resolvers/query/PersonQueryResolver.js +2 -1
  721. package/dist/production/src/resolvers/query/PersonQueryResolver.js.map +1 -1
  722. package/dist/production/src/resolvers/query/ProjectMembersQueryResolver.cjs +2 -1
  723. package/dist/production/src/resolvers/query/ProjectMembersQueryResolver.cjs.map +1 -1
  724. package/dist/production/src/resolvers/query/ProjectMembersQueryResolver.js +2 -1
  725. package/dist/production/src/resolvers/query/ProjectMembersQueryResolver.js.map +1 -1
  726. package/dist/production/src/resolvers/query/ProjectQueryResolver.cjs +5 -3
  727. package/dist/production/src/resolvers/query/ProjectQueryResolver.cjs.map +1 -1
  728. package/dist/production/src/resolvers/query/ProjectQueryResolver.js +5 -3
  729. package/dist/production/src/resolvers/query/ProjectQueryResolver.js.map +1 -1
  730. package/dist/production/src/resolvers/responseHelpers/ApiKeyResponseFactory.cjs +2 -1
  731. package/dist/production/src/resolvers/responseHelpers/ApiKeyResponseFactory.cjs.map +1 -1
  732. package/dist/production/src/resolvers/responseHelpers/ApiKeyResponseFactory.js +2 -1
  733. package/dist/production/src/resolvers/responseHelpers/ApiKeyResponseFactory.js.map +1 -1
  734. package/dist/production/src/resolvers/responseHelpers/PersonResponseFactory.cjs +5 -0
  735. package/dist/production/src/resolvers/responseHelpers/PersonResponseFactory.cjs.map +1 -1
  736. package/dist/production/src/resolvers/responseHelpers/PersonResponseFactory.js +5 -0
  737. package/dist/production/src/resolvers/responseHelpers/PersonResponseFactory.js.map +1 -1
  738. package/dist/production/src/resolvers/responseHelpers/ProjectResponseFactory.cjs +23 -0
  739. package/dist/production/src/resolvers/responseHelpers/ProjectResponseFactory.cjs.map +1 -0
  740. package/dist/production/src/resolvers/responseHelpers/ProjectResponseFactory.js +23 -0
  741. package/dist/production/src/resolvers/responseHelpers/ProjectResponseFactory.js.map +1 -0
  742. package/dist/production/src/resolvers/responseHelpers/SignInResponseFactory.cjs +2 -1
  743. package/dist/production/src/resolvers/responseHelpers/SignInResponseFactory.cjs.map +1 -1
  744. package/dist/production/src/resolvers/responseHelpers/SignInResponseFactory.js +2 -1
  745. package/dist/production/src/resolvers/responseHelpers/SignInResponseFactory.js.map +1 -1
  746. package/dist/production/src/resolvers/types/IdentityTypeResolver.cjs +37 -4
  747. package/dist/production/src/resolvers/types/IdentityTypeResolver.cjs.map +1 -1
  748. package/dist/production/src/resolvers/types/IdentityTypeResolver.js +37 -4
  749. package/dist/production/src/resolvers/types/IdentityTypeResolver.js.map +1 -1
  750. package/dist/production/src/resolvers/types/PersonTypeResolver.cjs +30 -1
  751. package/dist/production/src/resolvers/types/PersonTypeResolver.cjs.map +1 -1
  752. package/dist/production/src/resolvers/types/PersonTypeResolver.js +30 -1
  753. package/dist/production/src/resolvers/types/PersonTypeResolver.js.map +1 -1
  754. package/dist/production/src/resolvers/types/ProjectTypeResolver.cjs +25 -1
  755. package/dist/production/src/resolvers/types/ProjectTypeResolver.cjs.map +1 -1
  756. package/dist/production/src/resolvers/types/ProjectTypeResolver.js +25 -1
  757. package/dist/production/src/resolvers/types/ProjectTypeResolver.js.map +1 -1
  758. package/dist/production/src/schema/tenant.graphql.cjs +144 -0
  759. package/dist/production/src/schema/tenant.graphql.cjs.map +1 -1
  760. package/dist/production/src/schema/tenant.graphql.js +144 -0
  761. package/dist/production/src/schema/tenant.graphql.js.map +1 -1
  762. package/dist/tests/cases/integration/mocked/configurationPanel.test.d.ts +2 -0
  763. package/dist/tests/cases/integration/mocked/configurationPanel.test.d.ts.map +1 -0
  764. package/dist/tests/cases/integration/mocked/disablePersonMutation.test.d.ts +2 -0
  765. package/dist/tests/cases/integration/mocked/disablePersonMutation.test.d.ts.map +1 -0
  766. package/dist/tests/cases/integration/mocked/enablePersonMutation.test.d.ts +2 -0
  767. package/dist/tests/cases/integration/mocked/enablePersonMutation.test.d.ts.map +1 -0
  768. package/dist/tests/cases/integration/mocked/gql/addProjectMember.d.ts.map +1 -1
  769. package/dist/tests/cases/integration/mocked/gql/changeMyPassword.d.ts.map +1 -1
  770. package/dist/tests/cases/integration/mocked/gql/changeMyProfile.d.ts.map +1 -1
  771. package/dist/tests/cases/integration/mocked/gql/changePassword.d.ts.map +1 -1
  772. package/dist/tests/cases/integration/mocked/gql/changeProfile.d.ts.map +1 -1
  773. package/dist/tests/cases/integration/mocked/gql/confirmOtp.d.ts.map +1 -1
  774. package/dist/tests/cases/integration/mocked/gql/createApiKey.d.ts.map +1 -1
  775. package/dist/tests/cases/integration/mocked/gql/createResetPasswordRequest.d.ts.map +1 -1
  776. package/dist/tests/cases/integration/mocked/gql/createSessionToken.d.ts.map +1 -1
  777. package/dist/tests/cases/integration/mocked/gql/emailOtp.d.ts.map +1 -1
  778. package/dist/tests/cases/integration/mocked/gql/emailVerification.d.ts.map +1 -1
  779. package/dist/tests/cases/integration/mocked/gql/invite.d.ts.map +1 -1
  780. package/dist/tests/cases/integration/mocked/gql/myIdentityProviders.d.ts.map +1 -1
  781. package/dist/tests/cases/integration/mocked/gql/passwordless.d.ts +4 -1
  782. package/dist/tests/cases/integration/mocked/gql/passwordless.d.ts.map +1 -1
  783. package/dist/tests/cases/integration/mocked/gql/prepareOtp.d.ts.map +1 -1
  784. package/dist/tests/cases/integration/mocked/gql/resetPassword.d.ts.map +1 -1
  785. package/dist/tests/cases/integration/mocked/gql/signIn.d.ts.map +1 -1
  786. package/dist/tests/cases/integration/mocked/gql/signInIdp.d.ts.map +1 -1
  787. package/dist/tests/cases/integration/mocked/gql/signUp.d.ts.map +1 -1
  788. package/dist/tests/cases/integration/mocked/gql/unmanagedInvite.d.ts.map +1 -1
  789. package/dist/tests/cases/integration/mocked/gql/updateProjectMember.d.ts.map +1 -1
  790. package/dist/tests/cases/integration/mocked/idpClaimMappingConfig.test.d.ts +2 -0
  791. package/dist/tests/cases/integration/mocked/idpClaimMappingConfig.test.d.ts.map +1 -0
  792. package/dist/tests/cases/integration/mocked/localAuthenticationDisabled.test.d.ts +2 -0
  793. package/dist/tests/cases/integration/mocked/localAuthenticationDisabled.test.d.ts.map +1 -0
  794. package/dist/tests/cases/integration/mocked/permissionsQuery.test.d.ts +2 -0
  795. package/dist/tests/cases/integration/mocked/permissionsQuery.test.d.ts.map +1 -0
  796. package/dist/tests/cases/integration/mocked/signInIdpClaimMapping.test.d.ts +2 -0
  797. package/dist/tests/cases/integration/mocked/signInIdpClaimMapping.test.d.ts.map +1 -0
  798. package/dist/tests/cases/integration/mocked/signInIdpClaimMappingFixes.test.d.ts +2 -0
  799. package/dist/tests/cases/integration/mocked/signInIdpClaimMappingFixes.test.d.ts.map +1 -0
  800. package/dist/tests/cases/integration/mocked/signInIdpClaimMappingSafety.test.d.ts +2 -0
  801. package/dist/tests/cases/integration/mocked/signInIdpClaimMappingSafety.test.d.ts.map +1 -0
  802. package/dist/tests/cases/integration/mocked/sql/authLogSql.d.ts.map +1 -1
  803. package/dist/tests/cases/integration/mocked/sql/authPolicySql.d.ts.map +1 -1
  804. package/dist/tests/cases/integration/mocked/sql/consumeBackupCodeSql.d.ts.map +1 -1
  805. package/dist/tests/cases/integration/mocked/sql/createApiKeySql.d.ts.map +1 -1
  806. package/dist/tests/cases/integration/mocked/sql/createIdentitySql.d.ts.map +1 -1
  807. package/dist/tests/cases/integration/mocked/sql/createMembershipSql.d.ts.map +1 -1
  808. package/dist/tests/cases/integration/mocked/sql/createMembershipVariableSql.d.ts.map +1 -1
  809. package/dist/tests/cases/integration/mocked/sql/createPersonSql.d.ts.map +1 -1
  810. package/dist/tests/cases/integration/mocked/sql/createPersonTokenSql.d.ts.map +1 -1
  811. package/dist/tests/cases/integration/mocked/sql/createSessionKeySql.d.ts.map +1 -1
  812. package/dist/tests/cases/integration/mocked/sql/disableApiKeySql.d.ts.map +1 -1
  813. package/dist/tests/cases/integration/mocked/sql/disableOneOffKeySql.d.ts.map +1 -1
  814. package/dist/tests/cases/integration/mocked/sql/emailOtpSql.d.ts.map +1 -1
  815. package/dist/tests/cases/integration/mocked/sql/generateBackupCodesSql.d.ts.map +1 -1
  816. package/dist/tests/cases/integration/mocked/sql/getApiKeySql.d.ts.map +1 -1
  817. package/dist/tests/cases/integration/mocked/sql/getConfigSql.d.ts.map +1 -1
  818. package/dist/tests/cases/integration/mocked/sql/getIdentityByIdSql.d.ts.map +1 -1
  819. package/dist/tests/cases/integration/mocked/sql/getIdentityProjectsSql.d.ts.map +1 -1
  820. package/dist/tests/cases/integration/mocked/sql/getIdpBySlugSql.d.ts.map +1 -1
  821. package/dist/tests/cases/integration/mocked/sql/getIdpSessionByApiKeySql.d.ts.map +1 -1
  822. package/dist/tests/cases/integration/mocked/sql/getMailTemplateSql.d.ts.map +1 -1
  823. package/dist/tests/cases/integration/mocked/sql/getNextLoginAttemptSql.d.ts.map +1 -1
  824. package/dist/tests/cases/integration/mocked/sql/getNextMailAttemptSql.d.ts +1 -1
  825. package/dist/tests/cases/integration/mocked/sql/getNextMailAttemptSql.d.ts.map +1 -1
  826. package/dist/tests/cases/integration/mocked/sql/getPersonByEmailSql.d.ts.map +1 -1
  827. package/dist/tests/cases/integration/mocked/sql/getPersonByIdSql.d.ts.map +1 -1
  828. package/dist/tests/cases/integration/mocked/sql/getPersonByIdentity.d.ts.map +1 -1
  829. package/dist/tests/cases/integration/mocked/sql/getPersonByIdpSql.d.ts.map +1 -1
  830. package/dist/tests/cases/integration/mocked/sql/getPersonsByIdentitySql.d.ts.map +1 -1
  831. package/dist/tests/cases/integration/mocked/sql/getProjectBySlugSql.d.ts +1 -1
  832. package/dist/tests/cases/integration/mocked/sql/getProjectBySlugSql.d.ts.map +1 -1
  833. package/dist/tests/cases/integration/mocked/sql/getProjectMembershipSql.d.ts.map +1 -1
  834. package/dist/tests/cases/integration/mocked/sql/listApiKeysSql.d.ts.map +1 -1
  835. package/dist/tests/cases/integration/mocked/sql/listPersonsSql.d.ts +2 -0
  836. package/dist/tests/cases/integration/mocked/sql/listPersonsSql.d.ts.map +1 -1
  837. package/dist/tests/cases/integration/mocked/sql/listProjectSecretsSql.d.ts.map +1 -1
  838. package/dist/tests/cases/integration/mocked/sql/listSessionsSql.d.ts.map +1 -1
  839. package/dist/tests/cases/integration/mocked/sql/localAuthDisablingIdpsSql.d.ts +10 -0
  840. package/dist/tests/cases/integration/mocked/sql/localAuthDisablingIdpsSql.d.ts.map +1 -0
  841. package/dist/tests/cases/integration/mocked/sql/loginHistorySql.d.ts.map +1 -1
  842. package/dist/tests/cases/integration/mocked/sql/patchVariablesSql.d.ts.map +1 -1
  843. package/dist/tests/cases/integration/mocked/sql/personIdentityProvidersSql.d.ts +1 -0
  844. package/dist/tests/cases/integration/mocked/sql/personIdentityProvidersSql.d.ts.map +1 -1
  845. package/dist/tests/cases/integration/mocked/sql/removeMembershipSql.d.ts +8 -0
  846. package/dist/tests/cases/integration/mocked/sql/removeMembershipSql.d.ts.map +1 -0
  847. package/dist/tests/cases/integration/mocked/sql/selectMembershipsSql.d.ts.map +1 -1
  848. package/dist/tests/cases/integration/mocked/sql/setEmailOtpEnabledSql.d.ts.map +1 -1
  849. package/dist/tests/cases/integration/mocked/sql/sqlTransaction.d.ts.map +1 -1
  850. package/dist/tests/cases/integration/mocked/sql/updatePesonNameSql.d.ts.map +1 -1
  851. package/dist/tests/cases/integration/mocked/sql/updatePesonPasswordSql.d.ts.map +1 -1
  852. package/dist/tests/cases/unit/databaseContextRetry.test.d.ts +2 -0
  853. package/dist/tests/cases/unit/databaseContextRetry.test.d.ts.map +1 -0
  854. package/dist/tests/cases/unit/idp/claimMappingEvaluator.test.d.ts +2 -0
  855. package/dist/tests/cases/unit/idp/claimMappingEvaluator.test.d.ts.map +1 -0
  856. package/dist/tests/cases/unit/idp/claimMappingValidation.test.d.ts +2 -0
  857. package/dist/tests/cases/unit/idp/claimMappingValidation.test.d.ts.map +1 -0
  858. package/dist/tests/cases/unit/idp/idpManagerConfigMerge.test.d.ts +2 -0
  859. package/dist/tests/cases/unit/idp/idpManagerConfigMerge.test.d.ts.map +1 -0
  860. package/dist/tests/cases/unit/idp/idpManagerUnknownConfigKeys.test.d.ts +2 -0
  861. package/dist/tests/cases/unit/idp/idpManagerUnknownConfigKeys.test.d.ts.map +1 -0
  862. package/dist/tests/cases/unit/idp/oidcClaims.test.d.ts +2 -0
  863. package/dist/tests/cases/unit/idp/oidcClaims.test.d.ts.map +1 -0
  864. package/dist/tests/cases/unit/panelAccessResolver.test.d.ts +2 -0
  865. package/dist/tests/cases/unit/panelAccessResolver.test.d.ts.map +1 -0
  866. package/dist/tests/cases/unit/updateConfigurationCommand.test.d.ts +2 -0
  867. package/dist/tests/cases/unit/updateConfigurationCommand.test.d.ts.map +1 -0
  868. package/dist/tests/src/IdPMock.d.ts.map +1 -1
  869. package/dist/tests/src/dbUtils.d.ts.map +1 -1
  870. package/dist/tests/src/tags.d.ts.map +1 -1
  871. package/dist/tests/src/testGraphql.d.ts.map +1 -1
  872. package/dist/tests/src/testTenant.d.ts +7 -1
  873. package/dist/tests/src/testTenant.d.ts.map +1 -1
  874. package/dist/tests/src/testUuid.d.ts.map +1 -1
  875. package/dist/tests/tsconfig.tsbuildinfo +1 -1
  876. package/dist/types/TenantContainer.d.ts +21 -13
  877. package/dist/types/TenantContainer.d.ts.map +1 -1
  878. package/dist/types/bridges/system/IdentityFetcher.d.ts +2 -2
  879. package/dist/types/bridges/system/IdentityFetcher.d.ts.map +1 -1
  880. package/dist/types/exceptions.d.ts.map +1 -1
  881. package/dist/types/migrations/2026-06-18-120000-idp-claim-mapping.d.ts +3 -0
  882. package/dist/types/migrations/2026-06-18-120000-idp-claim-mapping.d.ts.map +1 -0
  883. package/dist/types/migrations/2026-08-03-120000-person-enable-auth-log.d.ts +3 -0
  884. package/dist/types/migrations/2026-08-03-120000-person-enable-auth-log.d.ts.map +1 -0
  885. package/dist/types/migrations/2026-08-04-120000-config-panel.d.ts +3 -0
  886. package/dist/types/migrations/2026-08-04-120000-config-panel.d.ts.map +1 -0
  887. package/dist/types/migrations/2026-09-04-120000-idp-disable-local-authentication.d.ts +3 -0
  888. package/dist/types/migrations/2026-09-04-120000-idp-disable-local-authentication.d.ts.map +1 -0
  889. package/dist/types/migrations/runner.d.ts.map +1 -1
  890. package/dist/types/migrations/snapshot-factory.d.ts.map +1 -1
  891. package/dist/types/migrations/snapshot.d.ts.map +1 -1
  892. package/dist/types/migrations/tenantCredentials.d.ts.map +1 -1
  893. package/dist/types/model/authorization/AclSchemaAccessNodeFactory.d.ts.map +1 -1
  894. package/dist/types/model/authorization/DirectPermissionsAccessNode.d.ts.map +1 -1
  895. package/dist/types/model/authorization/Identity.d.ts.map +1 -1
  896. package/dist/types/model/authorization/IdentityFactory.d.ts.map +1 -1
  897. package/dist/types/model/authorization/IdentityScope.d.ts.map +1 -1
  898. package/dist/types/model/authorization/MembershipMatcher.d.ts.map +1 -1
  899. package/dist/types/model/authorization/PermissionActions.d.ts.map +1 -1
  900. package/dist/types/model/authorization/PermissionContext.d.ts.map +1 -1
  901. package/dist/types/model/authorization/PermissionContextFactory.d.ts.map +1 -1
  902. package/dist/types/model/authorization/PermissionsFactory.d.ts.map +1 -1
  903. package/dist/types/model/authorization/ProjectScope.d.ts.map +1 -1
  904. package/dist/types/model/authorization/ProjectScopeFactory.d.ts.map +1 -1
  905. package/dist/types/model/commands/CommandBus.d.ts.map +1 -1
  906. package/dist/types/model/commands/apiKey/ApiKeyHelper.d.ts.map +1 -1
  907. package/dist/types/model/commands/apiKey/CreateApiKeyCommand.d.ts.map +1 -1
  908. package/dist/types/model/commands/apiKey/DisableApiKeyCommand.d.ts.map +1 -1
  909. package/dist/types/model/commands/apiKey/DisableIdentityApiKeysCommand.d.ts.map +1 -1
  910. package/dist/types/model/commands/apiKey/DisableOneOffApiKeyCommand.d.ts.map +1 -1
  911. package/dist/types/model/commands/apiKey/ProlongApiKeyCommand.d.ts +1 -1
  912. package/dist/types/model/commands/apiKey/ProlongApiKeyCommand.d.ts.map +1 -1
  913. package/dist/types/model/commands/authLog/CreateAuthLogEntryCommand.d.ts.map +1 -1
  914. package/dist/types/model/commands/authPolicy/CreateAuthPolicyCommand.d.ts.map +1 -1
  915. package/dist/types/model/commands/authPolicy/DeleteAuthPolicyCommand.d.ts.map +1 -1
  916. package/dist/types/model/commands/authPolicy/UpdateAuthPolicyCommand.d.ts.map +1 -1
  917. package/dist/types/model/commands/backupCode/ConsumeBackupCodeCommand.d.ts.map +1 -1
  918. package/dist/types/model/commands/backupCode/CreateBackupCodeCommand.d.ts.map +1 -1
  919. package/dist/types/model/commands/backupCode/DeleteBackupCodesCommand.d.ts.map +1 -1
  920. package/dist/types/model/commands/configuration/UpdateConfigurationCommand.d.ts.map +1 -1
  921. package/dist/types/model/commands/identity/CreateIdentityCommand.d.ts.map +1 -1
  922. package/dist/types/model/commands/identity/PatchIdentityGlobalRoles.d.ts.map +1 -1
  923. package/dist/types/model/commands/idp/ClaimIdpRevalidationCommand.d.ts.map +1 -1
  924. package/dist/types/model/commands/idp/CreateIdpCommand.d.ts.map +1 -1
  925. package/dist/types/model/commands/idp/CreateIdpSessionCommand.d.ts.map +1 -1
  926. package/dist/types/model/commands/idp/DisableIdpCommand.d.ts.map +1 -1
  927. package/dist/types/model/commands/idp/DisconnectPersonIdentityProviderCommand.d.ts.map +1 -1
  928. package/dist/types/model/commands/idp/EnableIdpCommand.d.ts.map +1 -1
  929. package/dist/types/model/commands/idp/UpdateIdpCommand.d.ts.map +1 -1
  930. package/dist/types/model/commands/idp/UpdateIdpSessionCommand.d.ts.map +1 -1
  931. package/dist/types/model/commands/mailTemplate/AddMailTemplateCommand.d.ts.map +1 -1
  932. package/dist/types/model/commands/mailTemplate/RemoveMailTemplateCommand.d.ts.map +1 -1
  933. package/dist/types/model/commands/membership/AddProjectMemberCommand.d.ts.map +1 -1
  934. package/dist/types/model/commands/membership/CreateOrUpdateProjectMembershipCommand.d.ts.map +1 -1
  935. package/dist/types/model/commands/membership/RemoveProjectMemberCommand.d.ts.map +1 -1
  936. package/dist/types/model/commands/membership/{RemoveProjectMembershipsCommand.d.ts → RemoveProjectMembershipCommand.d.ts} +1 -1
  937. package/dist/types/model/commands/membership/RemoveProjectMembershipCommand.d.ts.map +1 -0
  938. package/dist/types/model/commands/membership/UpdateProjectMemberCommand.d.ts.map +1 -1
  939. package/dist/types/model/commands/membership/index.d.ts +2 -1
  940. package/dist/types/model/commands/membership/index.d.ts.map +1 -1
  941. package/dist/types/model/commands/membership/variables/PatchProjectMembershipVariableValuesCommand.d.ts.map +1 -1
  942. package/dist/types/model/commands/membership/variables/PatchProjectMembershipVariablesCommand.d.ts.map +1 -1
  943. package/dist/types/model/commands/membership/variables/SetProjectMembershipVariableValuesCommand.d.ts.map +1 -1
  944. package/dist/types/model/commands/membership/variables/index.d.ts +1 -0
  945. package/dist/types/model/commands/membership/variables/index.d.ts.map +1 -1
  946. package/dist/types/model/commands/otp/ConfirmOtpCommand.d.ts.map +1 -1
  947. package/dist/types/model/commands/otp/DisableOtpCommand.d.ts.map +1 -1
  948. package/dist/types/model/commands/otp/PrepareOtpCommand.d.ts.map +1 -1
  949. package/dist/types/model/commands/otp/ReEncryptOtpSecretCommand.d.ts.map +1 -1
  950. package/dist/types/model/commands/otp/SetEmailOtpEnabledCommand.d.ts.map +1 -1
  951. package/dist/types/model/commands/person/ChangePasswordCommand.d.ts.map +1 -1
  952. package/dist/types/model/commands/person/ChangeProfileCommand.d.ts.map +1 -1
  953. package/dist/types/model/commands/person/CreatePersonCommand.d.ts.map +1 -1
  954. package/dist/types/model/commands/person/CreatePersonIdentityProviderIdentifierCommand.d.ts.map +1 -1
  955. package/dist/types/model/commands/person/DisablePersonCommand.d.ts.map +1 -1
  956. package/dist/types/model/commands/person/EnablePersonCommand.d.ts +7 -0
  957. package/dist/types/model/commands/person/EnablePersonCommand.d.ts.map +1 -0
  958. package/dist/types/model/commands/person/MarkEmailVerifiedCommand.d.ts.map +1 -1
  959. package/dist/types/model/commands/person/ResetPersonMfaCommand.d.ts.map +1 -1
  960. package/dist/types/model/commands/person/SetMfaGraceUntilCommand.d.ts.map +1 -1
  961. package/dist/types/model/commands/person/TogglePersonPasswordlessCommand.d.ts.map +1 -1
  962. package/dist/types/model/commands/personToken/ActivateOtpCommand.d.ts.map +1 -1
  963. package/dist/types/model/commands/personToken/ClaimOtpAttemptCommand.d.ts.map +1 -1
  964. package/dist/types/model/commands/personToken/CreatePersonTokenCommand.d.ts.map +1 -1
  965. package/dist/types/model/commands/personToken/IncreaseOtpAttemptCommand.d.ts.map +1 -1
  966. package/dist/types/model/commands/personToken/InvalidateEmailOtpTokensCommand.d.ts.map +1 -1
  967. package/dist/types/model/commands/personToken/InvalidateTokenCommand.d.ts.map +1 -1
  968. package/dist/types/model/commands/personToken/ResetPasswordCommand.d.ts.map +1 -1
  969. package/dist/types/model/commands/personToken/SaveEmailOtpTokenCommand.d.ts.map +1 -1
  970. package/dist/types/model/commands/personToken/SavePersonTokenCommand.d.ts.map +1 -1
  971. package/dist/types/model/commands/project/CreateProjectCommand.d.ts.map +1 -1
  972. package/dist/types/model/commands/project/SetProjectSecretCommand.d.ts.map +1 -1
  973. package/dist/types/model/commands/project/UpdateProjectCommand.d.ts.map +1 -1
  974. package/dist/types/model/commands/rateLimit/RecordRateLimitEventCommand.d.ts.map +1 -1
  975. package/dist/types/model/dtos/Password.d.ts.map +1 -1
  976. package/dist/types/model/mailing/UserMailer.d.ts.map +1 -1
  977. package/dist/types/model/mailing/templates/BackupCodesExhausted.mustache.d.ts.map +1 -1
  978. package/dist/types/model/mailing/templates/EmailChangeNotify.mustache.d.ts.map +1 -1
  979. package/dist/types/model/mailing/templates/EmailChangeVerify.mustache.d.ts.map +1 -1
  980. package/dist/types/model/mailing/templates/EmailOtp.mustache.d.ts.map +1 -1
  981. package/dist/types/model/mailing/templates/EmailVerification.mustache.d.ts.map +1 -1
  982. package/dist/types/model/mailing/templates/ExistingUserInvited.mustache.d.ts.map +1 -1
  983. package/dist/types/model/mailing/templates/ForcedSignOut.mustache.d.ts.map +1 -1
  984. package/dist/types/model/mailing/templates/Layout.mustache.d.ts.map +1 -1
  985. package/dist/types/model/mailing/templates/NewUserInvited.mustache.d.ts.map +1 -1
  986. package/dist/types/model/mailing/templates/PasswordReset.mustache.d.ts.map +1 -1
  987. package/dist/types/model/mailing/templates/PasswordlessSignIn.mustache.d.ts.map +1 -1
  988. package/dist/types/model/mailing/templates/UnusualLogin.mustache.d.ts.map +1 -1
  989. package/dist/types/model/mailing/type.d.ts.map +1 -1
  990. package/dist/types/model/queries/apiKey/ApiKeyListQuery.d.ts.map +1 -1
  991. package/dist/types/model/queries/apiKey/ApiKeyQuery.d.ts.map +1 -1
  992. package/dist/types/model/queries/apiKey/ApiKeySessionsQuery.d.ts.map +1 -1
  993. package/dist/types/model/queries/authLog/AuthLogQuery.d.ts.map +1 -1
  994. package/dist/types/model/queries/authLog/NextLoginAttemptQuery.d.ts.map +1 -1
  995. package/dist/types/model/queries/authLog/NextMailAttemptQuery.d.ts.map +1 -1
  996. package/dist/types/model/queries/authPolicy/AuthPoliciesQuery.d.ts.map +1 -1
  997. package/dist/types/model/queries/configuration/ConfigurationQuery.d.ts.map +1 -1
  998. package/dist/types/model/queries/identity/IdentityQuery.d.ts.map +1 -1
  999. package/dist/types/model/queries/idp/IdentityProviderBySlugQuery.d.ts.map +1 -1
  1000. package/dist/types/model/queries/idp/IdentityProvidersQuery.d.ts.map +1 -1
  1001. package/dist/types/model/queries/idp/IdpSessionByApiKeyQuery.d.ts.map +1 -1
  1002. package/dist/types/model/queries/idp/IdpSessionsBySidQuery.d.ts.map +1 -1
  1003. package/dist/types/model/queries/idp/IdpSessionsBySubQuery.d.ts.map +1 -1
  1004. package/dist/types/model/queries/idp/LocalAuthDisablingIdpsQuery.d.ts +18 -0
  1005. package/dist/types/model/queries/idp/LocalAuthDisablingIdpsQuery.d.ts.map +1 -0
  1006. package/dist/types/model/queries/idp/PersonIdentityProvidersQuery.d.ts +1 -0
  1007. package/dist/types/model/queries/idp/PersonIdentityProvidersQuery.d.ts.map +1 -1
  1008. package/dist/types/model/queries/idp/helpers.d.ts +1 -1
  1009. package/dist/types/model/queries/idp/helpers.d.ts.map +1 -1
  1010. package/dist/types/model/queries/idp/index.d.ts +1 -0
  1011. package/dist/types/model/queries/idp/index.d.ts.map +1 -1
  1012. package/dist/types/model/queries/idp/types.d.ts +1 -0
  1013. package/dist/types/model/queries/idp/types.d.ts.map +1 -1
  1014. package/dist/types/model/queries/mailTemplate/MailTemplateListQuery.d.ts.map +1 -1
  1015. package/dist/types/model/queries/mailTemplate/MailTemplateQuery.d.ts.map +1 -1
  1016. package/dist/types/model/queries/membership/AllProjectRolesByIdentityQuery.d.ts.map +1 -1
  1017. package/dist/types/model/queries/membership/ProjectMembersQuery.d.ts.map +1 -1
  1018. package/dist/types/model/queries/membership/ProjectMembershipByIdentityQuery.d.ts.map +1 -1
  1019. package/dist/types/model/queries/membership/ProjectRolesByIdentityQuery.d.ts.map +1 -1
  1020. package/dist/types/model/queries/membership/ProjectSlugSpecification.d.ts.map +1 -1
  1021. package/dist/types/model/queries/person/PersonByIdPQuery.d.ts.map +1 -1
  1022. package/dist/types/model/queries/person/PersonByIdentityBatchQuery.d.ts.map +1 -1
  1023. package/dist/types/model/queries/person/PersonQuery.d.ts.map +1 -1
  1024. package/dist/types/model/queries/person/PersonQueryBuilderFactory.d.ts.map +1 -1
  1025. package/dist/types/model/queries/person/PersonsQuery.d.ts.map +1 -1
  1026. package/dist/types/model/queries/person/types.d.ts +1 -0
  1027. package/dist/types/model/queries/person/types.d.ts.map +1 -1
  1028. package/dist/types/model/queries/personToken/PersonTokenQuery.d.ts.map +1 -1
  1029. package/dist/types/model/queries/project/ProjectBySlugQuery.d.ts.map +1 -1
  1030. package/dist/types/model/queries/project/ProjectSecretKeysQuery.d.ts.map +1 -1
  1031. package/dist/types/model/queries/project/ProjectSecretsQuery.d.ts.map +1 -1
  1032. package/dist/types/model/queries/project/ProjectUpdateTimestampQuery.d.ts.map +1 -1
  1033. package/dist/types/model/queries/project/ProjectsByIdentityQuery.d.ts.map +1 -1
  1034. package/dist/types/model/queries/project/ProjectsQuery.d.ts.map +1 -1
  1035. package/dist/types/model/queries/rateLimit/RateLimitCountQuery.d.ts.map +1 -1
  1036. package/dist/types/model/service/AuthLogService.d.ts.map +1 -1
  1037. package/dist/types/model/service/AuthPolicyManager.d.ts.map +1 -1
  1038. package/dist/types/model/service/AuthPolicyResolver.d.ts.map +1 -1
  1039. package/dist/types/model/service/BackupCodeManager.d.ts.map +1 -1
  1040. package/dist/types/model/service/ConfigurationManager.d.ts.map +1 -1
  1041. package/dist/types/model/service/EmailChangeManager.d.ts.map +1 -1
  1042. package/dist/types/model/service/EmailOtpManager.d.ts.map +1 -1
  1043. package/dist/types/model/service/EmailValidator.d.ts.map +1 -1
  1044. package/dist/types/model/service/EmailVerificationManager.d.ts.map +1 -1
  1045. package/dist/types/model/service/HibpChecker.d.ts.map +1 -1
  1046. package/dist/types/model/service/IDPSignInManager.d.ts +11 -1
  1047. package/dist/types/model/service/IDPSignInManager.d.ts.map +1 -1
  1048. package/dist/types/model/service/InviteManager.d.ts.map +1 -1
  1049. package/dist/types/model/service/LoginRiskAnalyzer.d.ts +1 -1
  1050. package/dist/types/model/service/LoginRiskAnalyzer.d.ts.map +1 -1
  1051. package/dist/types/model/service/MailTemplateManager.d.ts.map +1 -1
  1052. package/dist/types/model/service/MembershipValidator.d.ts.map +1 -1
  1053. package/dist/types/model/service/OtpAuthenticator.d.ts.map +1 -1
  1054. package/dist/types/model/service/OtpManager.d.ts.map +1 -1
  1055. package/dist/types/model/service/PanelAccessResolver.d.ts +19 -0
  1056. package/dist/types/model/service/PanelAccessResolver.d.ts.map +1 -0
  1057. package/dist/types/model/service/PasswordChangeManager.d.ts.map +1 -1
  1058. package/dist/types/model/service/PasswordResetManager.d.ts.map +1 -1
  1059. package/dist/types/model/service/PasswordStrengthValidator.d.ts.map +1 -1
  1060. package/dist/types/model/service/PasswordlessSignInManager.d.ts.map +1 -1
  1061. package/dist/types/model/service/PersonAccessManager.d.ts +5 -2
  1062. package/dist/types/model/service/PersonAccessManager.d.ts.map +1 -1
  1063. package/dist/types/model/service/PersonManager.d.ts.map +1 -1
  1064. package/dist/types/model/service/ProjectManager.d.ts.map +1 -1
  1065. package/dist/types/model/service/ProjectMemberManager.d.ts.map +1 -1
  1066. package/dist/types/model/service/RateLimiter.d.ts.map +1 -1
  1067. package/dist/types/model/service/RolesManager.d.ts.map +1 -1
  1068. package/dist/types/model/service/SecretsManager.d.ts.map +1 -1
  1069. package/dist/types/model/service/SignInManager.d.ts.map +1 -1
  1070. package/dist/types/model/service/SignOutManager.d.ts.map +1 -1
  1071. package/dist/types/model/service/SignUpManager.d.ts.map +1 -1
  1072. package/dist/types/model/service/apiKey/ApiKeyManager.d.ts.map +1 -1
  1073. package/dist/types/model/service/apiKey/ApiKeyService.d.ts.map +1 -1
  1074. package/dist/types/model/service/apiKey/UnpersistedApiKeyManager.d.ts +18 -0
  1075. package/dist/types/model/service/apiKey/UnpersistedApiKeyManager.d.ts.map +1 -1
  1076. package/dist/types/model/service/captcha/CaptchaValidator.d.ts.map +1 -1
  1077. package/dist/types/model/service/captcha/HCaptchaProvider.d.ts.map +1 -1
  1078. package/dist/types/model/service/captcha/RecaptchaV3Provider.d.ts.map +1 -1
  1079. package/dist/types/model/service/captcha/TurnstileProvider.d.ts.map +1 -1
  1080. package/dist/types/model/service/helpers/getPreferredProject.d.ts.map +1 -1
  1081. package/dist/types/model/service/helpers/isPasswordlessEnabled.d.ts.map +1 -1
  1082. package/dist/types/model/service/idp/BackchannelLogoutManager.d.ts.map +1 -1
  1083. package/dist/types/model/service/idp/ClaimMapping.d.ts +330 -0
  1084. package/dist/types/model/service/idp/ClaimMapping.d.ts.map +1 -0
  1085. package/dist/types/model/service/idp/ClaimMappingEvaluator.d.ts +30 -0
  1086. package/dist/types/model/service/idp/ClaimMappingEvaluator.d.ts.map +1 -0
  1087. package/dist/types/model/service/idp/ClaimMappingValidation.d.ts +55 -0
  1088. package/dist/types/model/service/idp/ClaimMappingValidation.d.ts.map +1 -0
  1089. package/dist/types/model/service/idp/IDPClaimSyncService.d.ts +113 -0
  1090. package/dist/types/model/service/idp/IDPClaimSyncService.d.ts.map +1 -0
  1091. package/dist/types/model/service/idp/IDPHandlerRegistry.d.ts.map +1 -1
  1092. package/dist/types/model/service/idp/IDPManager.d.ts +31 -1
  1093. package/dist/types/model/service/idp/IDPManager.d.ts.map +1 -1
  1094. package/dist/types/model/service/idp/IdentityProviderHandler.d.ts +7 -0
  1095. package/dist/types/model/service/idp/IdentityProviderHandler.d.ts.map +1 -1
  1096. package/dist/types/model/service/idp/IdpSessionRevalidator.d.ts +13 -1
  1097. package/dist/types/model/service/idp/IdpSessionRevalidator.d.ts.map +1 -1
  1098. package/dist/types/model/service/idp/PersonIdentityProviderManager.d.ts.map +1 -1
  1099. package/dist/types/model/service/idp/index.d.ts +4 -0
  1100. package/dist/types/model/service/idp/index.d.ts.map +1 -1
  1101. package/dist/types/model/service/idp/providers/AppleProvider.d.ts +2 -2
  1102. package/dist/types/model/service/idp/providers/AppleProvider.d.ts.map +1 -1
  1103. package/dist/types/model/service/idp/providers/FacebookProvider.d.ts +2 -2
  1104. package/dist/types/model/service/idp/providers/FacebookProvider.d.ts.map +1 -1
  1105. package/dist/types/model/service/idp/providers/OIDCHelpers.d.ts +13 -1
  1106. package/dist/types/model/service/idp/providers/OIDCHelpers.d.ts.map +1 -1
  1107. package/dist/types/model/service/idp/providers/OIDCProvider.d.ts +1 -1
  1108. package/dist/types/model/service/idp/providers/OIDCProvider.d.ts.map +1 -1
  1109. package/dist/types/model/service/idp/providers/OIDCTypes.d.ts +5 -5
  1110. package/dist/types/model/service/idp/providers/helpers.d.ts.map +1 -1
  1111. package/dist/types/model/service/index.d.ts +1 -0
  1112. package/dist/types/model/service/index.d.ts.map +1 -1
  1113. package/dist/types/model/service/membershipUtils.d.ts.map +1 -1
  1114. package/dist/types/model/type/AuthLog.d.ts +1 -1
  1115. package/dist/types/model/type/AuthLog.d.ts.map +1 -1
  1116. package/dist/types/model/type/Config.d.ts +2 -0
  1117. package/dist/types/model/type/Config.d.ts.map +1 -1
  1118. package/dist/types/model/type/IdentityProvider.d.ts +2 -0
  1119. package/dist/types/model/type/IdentityProvider.d.ts.map +1 -1
  1120. package/dist/types/model/type/RateLimit.d.ts +6 -6
  1121. package/dist/types/model/type/RateLimit.d.ts.map +1 -1
  1122. package/dist/types/model/utils/DatabaseContext.d.ts +14 -1
  1123. package/dist/types/model/utils/DatabaseContext.d.ts.map +1 -1
  1124. package/dist/types/model/utils/Response.d.ts.map +1 -1
  1125. package/dist/types/model/utils/email.d.ts.map +1 -1
  1126. package/dist/types/model/utils/hex.d.ts.map +1 -1
  1127. package/dist/types/model/utils/interval.d.ts.map +1 -1
  1128. package/dist/types/model/utils/time.d.ts.map +1 -1
  1129. package/dist/types/model/utils/token.d.ts.map +1 -1
  1130. package/dist/types/resolvers/ResolverFactory.d.ts +2 -0
  1131. package/dist/types/resolvers/ResolverFactory.d.ts.map +1 -1
  1132. package/dist/types/resolvers/TenantResolverContextFactory.d.ts.map +1 -1
  1133. package/dist/types/resolvers/errorUtils.d.ts.map +1 -1
  1134. package/dist/types/resolvers/membershipUtils.d.ts.map +1 -1
  1135. package/dist/types/resolvers/mutation/apiKey/CreateApiKeyMutationResolver.d.ts.map +1 -1
  1136. package/dist/types/resolvers/mutation/apiKey/DisableApiKeyMutationResolver.d.ts.map +1 -1
  1137. package/dist/types/resolvers/mutation/configuration/AuthPolicyMutationResolver.d.ts.map +1 -1
  1138. package/dist/types/resolvers/mutation/configuration/ConfigurationMutationResolver.d.ts.map +1 -1
  1139. package/dist/types/resolvers/mutation/identity/GlobalRolesMutationResolver.d.ts.map +1 -1
  1140. package/dist/types/resolvers/mutation/idp/AddIDPMutationResolver.d.ts.map +1 -1
  1141. package/dist/types/resolvers/mutation/idp/DisableIDPMutationResolver.d.ts.map +1 -1
  1142. package/dist/types/resolvers/mutation/idp/DisconnectMyIdentityProviderMutationResolver.d.ts.map +1 -1
  1143. package/dist/types/resolvers/mutation/idp/EnableIDPMutationResolver.d.ts.map +1 -1
  1144. package/dist/types/resolvers/mutation/idp/UpdateIDPMutationResolver.d.ts.map +1 -1
  1145. package/dist/types/resolvers/mutation/idp/audit.d.ts.map +1 -1
  1146. package/dist/types/resolvers/mutation/mailTemplates/MailTemplateMutationResolver.d.ts.map +1 -1
  1147. package/dist/types/resolvers/mutation/person/ChangePasswordMutationResolver.d.ts.map +1 -1
  1148. package/dist/types/resolvers/mutation/person/ChangeProfileMutationResolver.d.ts.map +1 -1
  1149. package/dist/types/resolvers/mutation/person/DisablePersonMutationResolver.d.ts +1 -1
  1150. package/dist/types/resolvers/mutation/person/DisablePersonMutationResolver.d.ts.map +1 -1
  1151. package/dist/types/resolvers/mutation/person/EmailOtpMutationResolver.d.ts.map +1 -1
  1152. package/dist/types/resolvers/mutation/person/EmailVerificationMutationResolver.d.ts.map +1 -1
  1153. package/dist/types/resolvers/mutation/person/EnablePersonMutationResolver.d.ts +11 -0
  1154. package/dist/types/resolvers/mutation/person/EnablePersonMutationResolver.d.ts.map +1 -0
  1155. package/dist/types/resolvers/mutation/person/ForceSignOutMutationResolver.d.ts.map +1 -1
  1156. package/dist/types/resolvers/mutation/person/IDPMutationResolver.d.ts.map +1 -1
  1157. package/dist/types/resolvers/mutation/person/InviteMutationResolver.d.ts.map +1 -1
  1158. package/dist/types/resolvers/mutation/person/OtpMutationResolver.d.ts.map +1 -1
  1159. package/dist/types/resolvers/mutation/person/PasswordlessMutationResolver.d.ts.map +1 -1
  1160. package/dist/types/resolvers/mutation/person/RegenerateBackupCodesMutationResolver.d.ts.map +1 -1
  1161. package/dist/types/resolvers/mutation/person/ResetPasswordMutationResolver.d.ts.map +1 -1
  1162. package/dist/types/resolvers/mutation/person/ResetPersonMfaMutationResolver.d.ts.map +1 -1
  1163. package/dist/types/resolvers/mutation/person/RevokeSessionMutationResolver.d.ts.map +1 -1
  1164. package/dist/types/resolvers/mutation/person/SignInMutationResolver.d.ts.map +1 -1
  1165. package/dist/types/resolvers/mutation/person/SignOutMutationResolver.d.ts.map +1 -1
  1166. package/dist/types/resolvers/mutation/person/SignUpMutationResolver.d.ts.map +1 -1
  1167. package/dist/types/resolvers/mutation/person/TogglePasswordlessMutationResolver.d.ts.map +1 -1
  1168. package/dist/types/resolvers/mutation/project/CreateProjectMutationResolver.d.ts.map +1 -1
  1169. package/dist/types/resolvers/mutation/project/SetProjectSecretMutationResolver.d.ts.map +1 -1
  1170. package/dist/types/resolvers/mutation/project/UpdateProjectMutationResolver.d.ts.map +1 -1
  1171. package/dist/types/resolvers/mutation/projectMember/AddProjectMemberMutationResolver.d.ts.map +1 -1
  1172. package/dist/types/resolvers/mutation/projectMember/RemoveProjectMemberMutationResolver.d.ts.map +1 -1
  1173. package/dist/types/resolvers/mutation/projectMember/UpdateProjectMemberMutationResolver.d.ts.map +1 -1
  1174. package/dist/types/resolvers/mutation/projectMember/audit.d.ts +1 -1
  1175. package/dist/types/resolvers/mutation/projectMember/audit.d.ts.map +1 -1
  1176. package/dist/types/resolvers/query/ApiKeyQueryResolver.d.ts.map +1 -1
  1177. package/dist/types/resolvers/query/AuthLogQueryResolver.d.ts.map +1 -1
  1178. package/dist/types/resolvers/query/AuthPolicyQueryResolver.d.ts.map +1 -1
  1179. package/dist/types/resolvers/query/ConfigurationQueryResolver.d.ts.map +1 -1
  1180. package/dist/types/resolvers/query/IDPQueryResolver.d.ts.map +1 -1
  1181. package/dist/types/resolvers/query/MailTemplateQueryResolver.d.ts.map +1 -1
  1182. package/dist/types/resolvers/query/MeQueryResolver.d.ts.map +1 -1
  1183. package/dist/types/resolvers/query/PersonQueryResolver.d.ts.map +1 -1
  1184. package/dist/types/resolvers/query/ProjectMembersQueryResolver.d.ts.map +1 -1
  1185. package/dist/types/resolvers/query/ProjectQueryResolver.d.ts.map +1 -1
  1186. package/dist/types/resolvers/responseHelpers/ApiKeyResponseFactory.d.ts.map +1 -1
  1187. package/dist/types/resolvers/responseHelpers/PersonResponseFactory.d.ts.map +1 -1
  1188. package/dist/types/resolvers/responseHelpers/ProjectResponseFactory.d.ts +10 -0
  1189. package/dist/types/resolvers/responseHelpers/ProjectResponseFactory.d.ts.map +1 -0
  1190. package/dist/types/resolvers/responseHelpers/SignInResponseFactory.d.ts.map +1 -1
  1191. package/dist/types/resolvers/types/IdentityTypeResolver.d.ts.map +1 -1
  1192. package/dist/types/resolvers/types/PersonTypeResolver.d.ts +15 -1
  1193. package/dist/types/resolvers/types/PersonTypeResolver.d.ts.map +1 -1
  1194. package/dist/types/resolvers/types/ProjectTypeResolver.d.ts +15 -6
  1195. package/dist/types/resolvers/types/ProjectTypeResolver.d.ts.map +1 -1
  1196. package/dist/types/schema/index.d.ts +194 -4
  1197. package/dist/types/schema/index.d.ts.map +1 -1
  1198. package/dist/types/schema/tenant.graphql.d.ts.map +1 -1
  1199. package/dist/types/schema/types.d.ts +2 -2
  1200. package/dist/types/schema/types.d.ts.map +1 -1
  1201. package/dist/types/tsconfig.tsbuildinfo +1 -1
  1202. package/dist/types/utils/Mailer.d.ts.map +1 -1
  1203. package/dist/types/utils/TemplateRenderer.d.ts.map +1 -1
  1204. package/dist/types/utils/array.d.ts.map +1 -1
  1205. package/dist/types/utils/batchQuery.d.ts.map +1 -1
  1206. package/package.json +12 -12
  1207. package/src/TenantContainer.ts +17 -3
  1208. package/src/migrations/2026-06-18-120000-idp-claim-mapping.ts +15 -0
  1209. package/src/migrations/2026-08-03-120000-person-enable-auth-log.ts +12 -0
  1210. package/src/migrations/2026-08-04-120000-config-panel.ts +13 -0
  1211. package/src/migrations/2026-09-04-120000-idp-disable-local-authentication.ts +18 -0
  1212. package/src/migrations/runner.ts +8 -0
  1213. package/src/migrations/snapshot.ts +8 -2
  1214. package/src/model/commands/configuration/UpdateConfigurationCommand.ts +5 -4
  1215. package/src/model/commands/idp/CreateIdpCommand.ts +7 -1
  1216. package/src/model/commands/idp/UpdateIdpCommand.ts +5 -1
  1217. package/src/model/commands/membership/UpdateProjectMemberCommand.ts +1 -1
  1218. package/src/model/commands/membership/index.ts +2 -1
  1219. package/src/model/commands/membership/variables/index.ts +1 -0
  1220. package/src/model/commands/person/EnablePersonCommand.ts +18 -0
  1221. package/src/model/queries/configuration/ConfigurationQuery.ts +4 -0
  1222. package/src/model/queries/idp/LocalAuthDisablingIdpsQuery.ts +41 -0
  1223. package/src/model/queries/idp/PersonIdentityProvidersQuery.ts +2 -0
  1224. package/src/model/queries/idp/helpers.ts +3 -2
  1225. package/src/model/queries/idp/index.ts +1 -0
  1226. package/src/model/queries/idp/types.ts +1 -0
  1227. package/src/model/queries/membership/ProjectMembersQuery.ts +1 -0
  1228. package/src/model/queries/person/PersonQueryBuilderFactory.ts +1 -0
  1229. package/src/model/queries/person/types.ts +1 -0
  1230. package/src/model/service/AuthLogService.ts +18 -2
  1231. package/src/model/service/IDPSignInManager.ts +49 -1
  1232. package/src/model/service/PanelAccessResolver.ts +32 -0
  1233. package/src/model/service/PasswordResetManager.ts +9 -1
  1234. package/src/model/service/PasswordlessSignInManager.ts +23 -1
  1235. package/src/model/service/PersonAccessManager.ts +19 -3
  1236. package/src/model/service/SignInManager.ts +9 -1
  1237. package/src/model/service/apiKey/ApiKeyManager.ts +5 -3
  1238. package/src/model/service/apiKey/UnpersistedApiKeyManager.ts +24 -0
  1239. package/src/model/service/idp/ClaimMapping.ts +283 -0
  1240. package/src/model/service/idp/ClaimMappingEvaluator.ts +226 -0
  1241. package/src/model/service/idp/ClaimMappingValidation.ts +158 -0
  1242. package/src/model/service/idp/IDPClaimSyncService.ts +401 -0
  1243. package/src/model/service/idp/IDPManager.ts +126 -21
  1244. package/src/model/service/idp/IdentityProviderHandler.ts +7 -0
  1245. package/src/model/service/idp/IdpSessionRevalidator.ts +90 -0
  1246. package/src/model/service/idp/PersonIdentityProviderManager.ts +8 -0
  1247. package/src/model/service/idp/index.ts +4 -0
  1248. package/src/model/service/idp/providers/OIDCHelpers.ts +161 -53
  1249. package/src/model/service/idp/providers/OIDCProvider.ts +4 -1
  1250. package/src/model/service/index.ts +1 -0
  1251. package/src/model/type/AuthLog.ts +3 -0
  1252. package/src/model/type/Config.ts +3 -0
  1253. package/src/model/type/IdentityProvider.ts +2 -0
  1254. package/src/model/utils/DatabaseContext.ts +27 -6
  1255. package/src/resolvers/ResolverFactory.ts +6 -0
  1256. package/src/resolvers/mutation/idp/AddIDPMutationResolver.ts +1 -0
  1257. package/src/resolvers/mutation/idp/UpdateIDPMutationResolver.ts +1 -0
  1258. package/src/resolvers/mutation/idp/audit.ts +1 -0
  1259. package/src/resolvers/mutation/person/DisablePersonMutationResolver.ts +3 -3
  1260. package/src/resolvers/mutation/person/EnablePersonMutationResolver.ts +50 -0
  1261. package/src/resolvers/mutation/person/IDPMutationResolver.ts +31 -0
  1262. package/src/resolvers/mutation/person/PasswordlessMutationResolver.ts +7 -0
  1263. package/src/resolvers/mutation/person/SignInMutationResolver.ts +2 -2
  1264. package/src/resolvers/query/ProjectQueryResolver.ts +3 -2
  1265. package/src/resolvers/responseHelpers/PersonResponseFactory.ts +5 -0
  1266. package/src/resolvers/responseHelpers/ProjectResponseFactory.ts +24 -0
  1267. package/src/resolvers/types/IdentityTypeResolver.ts +39 -3
  1268. package/src/resolvers/types/PersonTypeResolver.ts +35 -2
  1269. package/src/resolvers/types/ProjectTypeResolver.ts +33 -1
  1270. package/src/schema/index.ts +212 -0
  1271. package/src/schema/tenant.graphql.ts +144 -0
  1272. package/tests/cases/integration/mocked/configurationPanel.test.ts +105 -0
  1273. package/tests/cases/integration/mocked/disablePersonMutation.test.ts +89 -0
  1274. package/tests/cases/integration/mocked/enablePersonMutation.test.ts +130 -0
  1275. package/tests/cases/integration/mocked/gql/passwordless.ts +10 -0
  1276. package/tests/cases/integration/mocked/idpClaimMappingConfig.test.ts +332 -0
  1277. package/tests/cases/integration/mocked/listProjectMembersQuery.test.ts +8 -3
  1278. package/tests/cases/integration/mocked/localAuthenticationDisabled.test.ts +182 -0
  1279. package/tests/cases/integration/mocked/permissionsQuery.test.ts +153 -0
  1280. package/tests/cases/integration/mocked/personIdentityProviders.test.ts +67 -0
  1281. package/tests/cases/integration/mocked/personsQuery.test.ts +38 -5
  1282. package/tests/cases/integration/mocked/signInAnomalyDetection.test.ts +11 -0
  1283. package/tests/cases/integration/mocked/signInIdpClaimMapping.test.ts +1258 -0
  1284. package/tests/cases/integration/mocked/signInIdpClaimMappingFixes.test.ts +344 -0
  1285. package/tests/cases/integration/mocked/signInIdpClaimMappingSafety.test.ts +531 -0
  1286. package/tests/cases/integration/mocked/signInIdpMutation.test.ts +5 -0
  1287. package/tests/cases/integration/mocked/signInMfaEnforcement.test.ts +7 -0
  1288. package/tests/cases/integration/mocked/signInMutation.test.ts +14 -0
  1289. package/tests/cases/integration/mocked/signInPasswordlessMutation.test.ts +36 -0
  1290. package/tests/cases/integration/mocked/sql/getConfigSql.ts +3 -0
  1291. package/tests/cases/integration/mocked/sql/getIdpBySlugSql.ts +1 -1
  1292. package/tests/cases/integration/mocked/sql/getProjectBySlugSql.ts +1 -1
  1293. package/tests/cases/integration/mocked/sql/listPersonsSql.ts +5 -2
  1294. package/tests/cases/integration/mocked/sql/localAuthDisablingIdpsSql.ts +21 -0
  1295. package/tests/cases/integration/mocked/sql/personIdentityProvidersSql.ts +3 -1
  1296. package/tests/cases/integration/mocked/sql/removeMembershipSql.ts +14 -0
  1297. package/tests/cases/integration/mocked/trustForwardedClientInfo.test.ts +3 -0
  1298. package/tests/cases/unit/databaseContextRetry.test.ts +81 -0
  1299. package/tests/cases/unit/idp/claimMappingEvaluator.test.ts +554 -0
  1300. package/tests/cases/unit/idp/claimMappingValidation.test.ts +134 -0
  1301. package/tests/cases/unit/idp/idpManagerConfigMerge.test.ts +97 -0
  1302. package/tests/cases/unit/idp/idpManagerUnknownConfigKeys.test.ts +108 -0
  1303. package/tests/cases/unit/idp/idpSessionRevalidator.test.ts +226 -24
  1304. package/tests/cases/unit/idp/oidcClaims.test.ts +29 -0
  1305. package/tests/cases/unit/idp/oidcResponse.test.ts +54 -0
  1306. package/tests/cases/unit/idp/oidcRevalidate.test.ts +94 -2
  1307. package/tests/cases/unit/panelAccessResolver.test.ts +57 -0
  1308. package/tests/cases/unit/updateConfigurationCommand.test.ts +63 -0
  1309. package/tests/src/IdPMock.ts +4 -0
  1310. package/tests/src/testTenant.ts +32 -1
  1311. package/dist/development/src/model/commands/membership/RemoveProjectMembershipsCommand.cjs.map +0 -1
  1312. package/dist/development/src/model/commands/membership/RemoveProjectMembershipsCommand.js.map +0 -1
  1313. package/dist/production/src/model/commands/membership/RemoveProjectMembershipsCommand.cjs.map +0 -1
  1314. package/dist/production/src/model/commands/membership/RemoveProjectMembershipsCommand.js.map +0 -1
  1315. package/dist/types/model/commands/membership/RemoveProjectMembershipsCommand.d.ts.map +0 -1
  1316. /package/src/model/commands/membership/{RemoveProjectMembershipsCommand.ts → RemoveProjectMembershipCommand.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"OIDCHelpers.cjs","sources":["../../../../../../../../packages/engine-tenant-api/src/model/service/idp/providers/OIDCHelpers.ts"],"sourcesContent":["import { Client, custom, errors, generators, Issuer, TokenSet } from 'openid-client'\nimport { createRemoteJWKSet, jwtVerify } from 'jose'\nimport { OIDCClaimMapping, OIDCResponseData } from './OIDCTypes.js'\nimport { IDPValidationError } from '../IDPValidationError.js'\nimport { IDPResponseError } from '../IDPResponseError.js'\nimport {\n\tIDPResponse,\n\tIDPSessionState,\n\tInitIDPAuthResult,\n\tLogoutTokenClaims,\n\tLogoutUrlRequest,\n\tRevalidationResult,\n} from '../IdentityProviderHandler.js'\n\n/**\n * Build the persisted session state from an OIDC token set. Stores the tokens needed for\n * later re-validation (refresh/access) and SLO (id_token); the whole `tokens` blob is\n * encrypted at rest by the command layer.\n *\n * `prevTokens` carries the previously stored tokens forward: a refresh-grant response MAY omit\n * the refresh token (RFC 6749 §6 — IdPs that don't rotate just don't re-send it), in which case\n * the client must keep using the old one. Without this fallback a non-rotating IdP would persist\n * a session with no refresh token and be revoked (`no_refresh_token`) on the very next tick.\n */\nexport const tokenSetToSessionState = (tokenSet: TokenSet, sessionId?: string, prevTokens?: Record<string, unknown>): IDPSessionState => {\n\tconst refreshToken = tokenSet.refresh_token ?? (typeof prevTokens?.refresh_token === 'string' ? prevTokens.refresh_token : undefined)\n\tconst idToken = tokenSet.id_token ?? (typeof prevTokens?.id_token === 'string' ? prevTokens.id_token : undefined)\n\treturn {\n\t\tsessionId,\n\t\ttokens: {\n\t\t\t...(refreshToken ? { refresh_token: refreshToken } : {}),\n\t\t\t...(tokenSet.access_token ? { access_token: tokenSet.access_token } : {}),\n\t\t\t...(idToken ? { id_token: idToken } : {}),\n\t\t},\n\t\texpiresAt: tokenSet.expires_at ? new Date(tokenSet.expires_at * 1000) : undefined,\n\t}\n}\n\nexport const initOIDCAuth = async (\n\tclient: Client,\n\t{ redirectUrl, scope, responseMode }: { redirectUrl: string; scope?: string; responseMode?: string },\n): Promise<InitIDPAuthResult> => {\n\tconst nonce = generators.nonce()\n\tconst state = generators.state()\n\tconst url = client.authorizationUrl({\n\t\tredirect_uri: redirectUrl,\n\t\tresponse_mode: responseMode,\n\t\tscope: scope ?? 'openid email',\n\t\tnonce,\n\t\tstate,\n\t})\n\n\treturn {\n\t\tauthUrl: url,\n\t\tsessionData: { nonce, state },\n\t}\n}\n\nexport type HandleOIDCResponseOptions = {\n\tfetchUserInfo?: boolean\n\treturnOIDCResult?: boolean\n\tcaptureSession?: boolean\n\tclaimMapping?: OIDCClaimMapping\n}\n\n/** Read a claim by name, supporting dot-paths into nested objects (`a.b.c`). */\nconst getClaim = (source: Record<string, unknown>, path: string): unknown =>\n\tpath.split('.').reduce<unknown>(\n\t\t(acc, key) => (acc != null && typeof acc === 'object' ? (acc as Record<string, unknown>)[key] : undefined),\n\t\tsource,\n\t)\n\nexport const handleOIDCResponse = async (\n\tclient: Client,\n\t{ sessionData, redirectUrl, ...otherData }: OIDCResponseData,\n\t{ fetchUserInfo, returnOIDCResult, captureSession, claimMapping }: HandleOIDCResponseOptions = {},\n): Promise<IDPResponse> => {\n\tconst params = 'parameters' in otherData ? otherData.parameters : client.callbackParams(otherData.url)\n\tif (params.state && !sessionData?.state) {\n\t\tthrow new IDPValidationError(`state is present in parameters, but missing in session data`)\n\t}\n\ttry {\n\t\tconst result = await client.callback(redirectUrl, params, sessionData)\n\t\tconst claims = result.claims()\n\t\tconst { at_hash, c_hash, nonce, ...claimsWithoutHashes } = claims\n\t\tconst userInfo = result.access_token && fetchUserInfo ? await client.userinfo(result) : {}\n\t\tconst oidcResult = returnOIDCResult ? result : {}\n\t\tconst idpSession = captureSession ? tokenSetToSessionState(result, typeof claims.sid === 'string' ? claims.sid : undefined) : undefined\n\n\t\t// Merge ID-token claims with userInfo (userInfo wins, per spec). Then optionally lift a\n\t\t// nested attributes object to the top level so providers that nest their claims (notably\n\t\t// Apereo CAS userinfo, which returns them under `attributes`) map without a code change.\n\t\t// The nested attributes are UNSIGNED, so they must not override a claim already present in\n\t\t// the (signature-verified) ID-token / userInfo merge — spread them UNDER `source`, not over\n\t\t// it, so a signed `sub` / `email_verified` keeps precedence over an attributes-level value.\n\t\tlet source: Record<string, unknown> = { ...claimsWithoutHashes, ...userInfo }\n\t\tconst attributesKey = claimMapping?.attributesKey\n\t\tif (attributesKey) {\n\t\t\tconst nested = source[attributesKey]\n\t\t\tif (nested && typeof nested === 'object' && !Array.isArray(nested)) {\n\t\t\t\tsource = { ...(nested as Record<string, unknown>), ...source }\n\t\t\t}\n\t\t}\n\n\t\t// The OIDC `email_verified` claim is a boolean per spec, but some providers send the\n\t\t// string \"true\". userInfo (and any unwrapped attributes) take precedence over the ID token.\n\t\tconst rawEmailVerified = source.email_verified\n\t\tconst emailVerified = rawEmailVerified === true || rawEmailVerified === 'true'\n\n\t\t// `externalIdentifier` is the federation key persisted in `person_identity_provider` and\n\t\t// matched on the next sign-in, so it must be a stable scalar. A `claimMapping` that pointed\n\t\t// it at an object/array would otherwise be coerced by `String(...)` to `'[object Object]'` /\n\t\t// a comma-join — collapsing every user of the provider onto one key (account takeover). Fail\n\t\t// closed instead. The default `sub` path is safe (openid-client guarantees `sub` is a string).\n\t\tconst mappedSubject = getClaim(source, claimMapping?.externalIdentifier ?? 'sub')\n\t\tlet externalIdentifier: string\n\t\tif (mappedSubject === undefined || mappedSubject === null) {\n\t\t\texternalIdentifier = claims.sub\n\t\t} else if (typeof mappedSubject === 'string' || typeof mappedSubject === 'number') {\n\t\t\texternalIdentifier = String(mappedSubject)\n\t\t} else {\n\t\t\tthrow new IDPValidationError(`The mapped externalIdentifier claim is not a scalar value`)\n\t\t}\n\t\tif (externalIdentifier === '') {\n\t\t\tthrow new IDPValidationError(`The mapped externalIdentifier claim resolved to an empty value`)\n\t\t}\n\n\t\t// `email` / `name` are typed `string | undefined` on IDPResponse and feed the by-e-mail\n\t\t// account lookup (which crashes on a non-string). `...source` already placed the raw claim\n\t\t// of whatever type, so OVERWRITE (don't conditionally add) with the mapped value when it is\n\t\t// a string, otherwise `undefined` — a non-string claim must not leak through `...source`.\n\t\tconst email = getClaim(source, claimMapping?.email ?? 'email')\n\t\tconst name = getClaim(source, claimMapping?.name ?? 'name')\n\n\t\treturn {\n\t\t\t...oidcResult,\n\t\t\t...source,\n\t\t\texternalIdentifier,\n\t\t\temail: typeof email === 'string' ? email : undefined,\n\t\t\tname: typeof name === 'string' ? name : undefined,\n\t\t\temailVerified,\n\t\t\t...(idpSession ? { idpSession } : {}),\n\t\t}\n\t} catch (e: any) {\n\t\tif (e instanceof errors.RPError) {\n\t\t\tthrow new IDPValidationError(e.message)\n\t\t}\n\t\tif (e instanceof errors.OPError) {\n\t\t\tconst body = e.response?.body as any\n\t\t\tif (typeof body === 'object' && typeof body?.error === 'object' && typeof body.error?.message === 'string') {\n\t\t\t\tthrow new IDPResponseError(body.error.message)\n\t\t\t}\n\t\t\tthrow new IDPResponseError(e.message)\n\t\t}\n\t\tthrow e\n\t}\n}\n\n/** OIDC errors that definitively mean \"this session is no longer valid at the IdP\". */\nconst REVOKED_OIDC_ERRORS = new Set(['invalid_grant', 'invalid_token', 'expired_token'])\n\n/**\n * Re-validate a stored OIDC session against the IdP. Returns `revoked` only for definitive\n * IdP responses (invalid/expired grant or inactive introspection). Transient failures\n * (network, IdP down) re-throw so the caller can fail-open and keep the session — IdP\n * downtime must not log everyone out.\n */\nexport const revalidateOIDC = async (\n\tclient: Client,\n\tmethod: 'refresh' | 'userinfo' | 'introspection',\n\tsession: IDPSessionState,\n): Promise<RevalidationResult> => {\n\tconst tokens = session.tokens ?? {}\n\tconst refreshToken = typeof tokens.refresh_token === 'string' ? tokens.refresh_token : undefined\n\tconst accessToken = typeof tokens.access_token === 'string' ? tokens.access_token : undefined\n\ttry {\n\t\tif (method === 'refresh') {\n\t\t\tif (!refreshToken) {\n\t\t\t\treturn { status: 'revoked', reason: 'no_refresh_token' }\n\t\t\t}\n\t\t\tconst tokenSet = await client.refresh(refreshToken)\n\t\t\tlet claims: Record<string, unknown> | undefined\n\t\t\ttry {\n\t\t\t\tclaims = tokenSet.id_token ? tokenSet.claims() : undefined\n\t\t\t} catch {\n\t\t\t\tclaims = undefined\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tstatus: 'valid',\n\t\t\t\tclaims,\n\t\t\t\t// carry the stored tokens forward: a non-rotating IdP omits the refresh token here\n\t\t\t\tidpSession: tokenSetToSessionState(tokenSet, session.sessionId, tokens),\n\t\t\t}\n\t\t}\n\t\tif (method === 'userinfo') {\n\t\t\tif (!accessToken) {\n\t\t\t\treturn { status: 'revoked', reason: 'no_access_token' }\n\t\t\t}\n\t\t\tconst userInfo = await client.userinfo(accessToken)\n\t\t\treturn { status: 'valid', claims: userInfo }\n\t\t}\n\t\t// introspection\n\t\tconst token = accessToken ?? refreshToken\n\t\tif (!token) {\n\t\t\treturn { status: 'revoked', reason: 'no_token' }\n\t\t}\n\t\tconst result = await client.introspect(token, accessToken ? 'access_token' : 'refresh_token')\n\t\tif (!result.active) {\n\t\t\treturn { status: 'revoked', reason: 'inactive' }\n\t\t}\n\t\treturn { status: 'valid' }\n\t} catch (e: any) {\n\t\tif (e instanceof errors.OPError) {\n\t\t\tif (typeof e.error === 'string' && REVOKED_OIDC_ERRORS.has(e.error)) {\n\t\t\t\treturn { status: 'revoked', reason: e.error }\n\t\t\t}\n\t\t\t// The userinfo endpoint signals a rejected access token with a bare HTTP 401 — per\n\t\t\t// RFC 6750 the `WWW-Authenticate` error code is optional, so openid-client may not\n\t\t\t// surface a parseable `error` here. A 401 is still definitive: the token is no\n\t\t\t// longer accepted → revoked. (Introspection is NOT treated this way: it returns 200\n\t\t\t// `{active:false}` for revoked tokens, so a 401/400 there means client-auth/config\n\t\t\t// failure — transient, must not log users out.)\n\t\t\tif (method === 'userinfo' && e.response?.statusCode === 401) {\n\t\t\t\treturn { status: 'revoked', reason: 'userinfo_unauthorized' }\n\t\t\t}\n\t\t}\n\t\t// transient (network / IdP unavailable) — propagate, do not revoke\n\t\tthrow e\n\t}\n}\n\n/**\n * Build an RP-initiated (front-channel) logout URL (OIDC RP-Initiated Logout 1.0). Returns null\n * when the IdP advertises no `end_session_endpoint` — the caller then degrades to a local-only\n * logout (legacy-IdP graceful fallback). The `id_token_hint` lets the IdP identify and confirm the\n * session to terminate; `post_logout_redirect_uri` is where the IdP returns the browser afterwards.\n */\nexport const buildOIDCLogoutUrl = (client: Client, { idToken, postLogoutRedirectUri }: LogoutUrlRequest): string | null => {\n\tif (!client.issuer.metadata.end_session_endpoint) {\n\t\treturn null\n\t}\n\treturn client.endSessionUrl({\n\t\t...(idToken ? { id_token_hint: idToken } : {}),\n\t\t...(postLogoutRedirectUri ? { post_logout_redirect_uri: postLogoutRedirectUri } : {}),\n\t})\n}\n\n/**\n * The OIDC Back-Channel Logout 1.0 event member that MUST be present in a logout token's `events`\n * claim. Its presence (and the absence of a `nonce`) is what distinguishes a logout token from an\n * ID token — both are signed by the same IdP, so without this check an ID token could be replayed\n * to forcibly log a user out.\n */\nconst BACKCHANNEL_LOGOUT_EVENT = 'http://schemas.openid.net/event/backchannel-logout'\n\n/**\n * Max accepted age of a back-channel logout token, derived from its `iat`. OIDC Back-Channel Logout\n * tokens are single-use and short-lived; bounding the age (together with requiring `exp`) limits the\n * window in which a captured token could be replayed to force a logout.\n */\nconst LOGOUT_TOKEN_MAX_AGE_SECONDS = 120\nconst LOGOUT_TOKEN_CLOCK_TOLERANCE_SECONDS = 5\n\n/**\n * Remote JWKS sets keyed by `jwks_uri`. `createRemoteJWKSet` returns a function with its own internal\n * key cache + fetch cooldown, so it MUST be reused across requests — re-creating it per call (as the\n * unauthenticated back-channel endpoint would otherwise do) defeats the cache and turns every request\n * into a potential outbound JWKS fetch. Keyed by URL, so two providers sharing an IdP share the set.\n */\nconst remoteJwksCache = new Map<string, ReturnType<typeof createRemoteJWKSet>>()\n\nconst getRemoteJwks = (jwksUri: string): ReturnType<typeof createRemoteJWKSet> => {\n\tlet jwks = remoteJwksCache.get(jwksUri)\n\tif (!jwks) {\n\t\tjwks = createRemoteJWKSet(new URL(jwksUri))\n\t\tremoteJwksCache.set(jwksUri, jwks)\n\t}\n\treturn jwks\n}\n\n/**\n * Validate an OIDC back-channel logout token (OIDC Back-Channel Logout 1.0 §2.4–2.6) and extract\n * the targeted `sid` / `sub`. The token is a JWT signed by the IdP; we verify the signature against\n * the issuer's JWKS and enforce the issuer + audience (client_id) the same way ID tokens are\n * verified, pinning the signing algorithm to the provider's configured one, then assert the\n * back-channel-specific claims:\n * - `iat` is present and recent and `exp` is present (§2.4 requires both) — bounds the replay window;\n * - `events` contains the back-channel-logout member (it really is a logout token);\n * - it carries a `sid` and/or `sub` (otherwise there is nothing to act on);\n * - it does NOT carry a `nonce` (a `nonce` means it is an ID token being replayed).\n * Throws {@link IDPValidationError} on any failure so the caller can answer 400.\n */\nexport const validateOIDCLogoutToken = async (client: Client, issuer: Issuer<Client>, logoutToken: string): Promise<LogoutTokenClaims> => {\n\tconst jwksUri = issuer.metadata.jwks_uri\n\tif (!jwksUri) {\n\t\tthrow new IDPValidationError('IdP has no jwks_uri; cannot verify logout token')\n\t}\n\tconst clientId = client.metadata.client_id\n\tif (typeof clientId !== 'string' || clientId === '') {\n\t\t// The `aud` check is a core anti-token-substitution defence on this unauthenticated endpoint.\n\t\t// jose treats `audience: undefined` as \"skip the aud check entirely\", so a missing client_id\n\t\t// must fail closed (reject the token) rather than fall through and accept any audience.\n\t\tthrow new IDPValidationError('cannot verify logout token audience: client_id is missing')\n\t}\n\tconst expectedAlg = typeof client.metadata.id_token_signed_response_alg === 'string'\n\t\t? client.metadata.id_token_signed_response_alg\n\t\t: 'RS256'\n\tconst jwks = getRemoteJwks(jwksUri)\n\tlet payload: Record<string, unknown>\n\ttry {\n\t\tconst verified = await jwtVerify(logoutToken, jwks, {\n\t\t\tissuer: issuer.metadata.issuer,\n\t\t\taudience: clientId,\n\t\t\t// pin to the provider's configured signing alg so a JWKS containing a symmetric/none key\n\t\t\t// can never be selected (defence-in-depth on top of jose's own key-type check).\n\t\t\talgorithms: [expectedAlg],\n\t\t\t// §2.4: `iat` and `exp` are REQUIRED. `maxTokenAge` makes `iat` required + bounds freshness;\n\t\t\t// `requiredClaims` makes `exp` required (jose only checks `exp` when present).\n\t\t\tmaxTokenAge: LOGOUT_TOKEN_MAX_AGE_SECONDS,\n\t\t\trequiredClaims: ['exp'],\n\t\t\tclockTolerance: LOGOUT_TOKEN_CLOCK_TOLERANCE_SECONDS,\n\t\t})\n\t\tpayload = verified.payload as Record<string, unknown>\n\t} catch (e: any) {\n\t\tthrow new IDPValidationError(`Invalid logout token: ${e?.message ?? 'verification failed'}`)\n\t}\n\n\t// A logout token MUST NOT contain a nonce; its presence means an ID token is being replayed.\n\tif ('nonce' in payload) {\n\t\tthrow new IDPValidationError('Logout token must not contain a nonce')\n\t}\n\n\tconst events = payload.events\n\tconst hasLogoutEvent = typeof events === 'object' && events !== null && BACKCHANNEL_LOGOUT_EVENT in (events as Record<string, unknown>)\n\tif (!hasLogoutEvent) {\n\t\tthrow new IDPValidationError('Logout token is missing the back-channel-logout event')\n\t}\n\n\tconst sid = typeof payload.sid === 'string' ? payload.sid : undefined\n\tconst sub = typeof payload.sub === 'string' ? payload.sub : undefined\n\tif (!sid && !sub) {\n\t\tthrow new IDPValidationError('Logout token must contain a sid or sub claim')\n\t}\n\n\treturn { sid, sub }\n}\n"],"names":["generators","IDPValidationError","errors","IDPResponseError","createRemoteJWKSet","jwtVerify"],"mappings":";;;;;;AAwBO,MAAM,yBAAyB,CAAC,UAAoB,WAAoB,eAA0D;AACxI,QAAM,eAAe,SAAS,kBAAkB,OAAO,YAAY,kBAAkB,WAAW,WAAW,gBAAgB;AAC3H,QAAM,UAAU,SAAS,aAAa,OAAO,YAAY,aAAa,WAAW,WAAW,WAAW;AACvG,SAAO;AAAA,IACN;AAAA,IACA,QAAQ;AAAA,MACP,GAAI,eAAe,EAAE,eAAe,aAAA,IAAiB,CAAA;AAAA,MACrD,GAAI,SAAS,eAAe,EAAE,cAAc,SAAS,aAAA,IAAiB,CAAA;AAAA,MACtE,GAAI,UAAU,EAAE,UAAU,YAAY,CAAA;AAAA,IAAC;AAAA,IAExC,WAAW,SAAS,aAAa,IAAI,KAAK,SAAS,aAAa,GAAI,IAAI;AAAA,EAAA;AAE1E;AAEO,MAAM,eA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EACzF;AACA,QAAM,cAAc,OAAO,OAAO,SAAS,iCAAiC,WACzE,OAAO,SAAS,+BAChB;AACH,QAAM,OAAO,cAAc,OAAO;AAClC,MAAI;AACJ,MAAI;AACH,UAAM,WAAW,MAAMI,eAAU,aAAa,MAAM;AAAA,MACnD,QAAQ,OAAO,SAAS;AAAA,MACxB,UAAU;AAAA;AAAA;AAAA,MAGV,YAAY,CAAC,WAAW;AAAA;AAAA;AAAA,MAGxB,aAAa;AAAA,MACb,gBAAgB,CAAC,KAAK;AAAA,MACtB,gBAAgB;AAAA,IAAA,CAChB;AACD,cAAU,SAAS;AAAA,EACpB,SAAS,GAAQ;AAChB,UAAM,IAAIJ,mBAAAA,mBAAmB,yBAAyB,GAAG,WAAW,qBAAqB,EAAE;AAAA,EAC5F;AAGA,MAAI,WAAW,SAAS;AACvB,UAAM,IAAIA,mBAAAA,mBAAmB,uCAAuC;AAAA,EACrE;AAEA,QAAM,SAAS,QAAQ;AACvB,QAAM,iBAAiB,OAAO,WAAW,YAAY,WAAW,QAAQ,4BAA6B;AACrG,MAAI,CAAC,gBAAgB;AACpB,UAAM,IAAIA,mBAAAA,mBAAmB,uDAAuD;AAAA,EACrF;AAEA,QAAM,MAAM,OAAO,QAAQ,QAAQ,WAAW,QAAQ,MAAM;AAC5D,QAAM,MAAM,OAAO,QAAQ,QAAQ,WAAW,QAAQ,MAAM;AAC5D,MAAI,CAAC,OAAO,CAAC,KAAK;AACjB,UAAM,IAAIA,mBAAAA,mBAAmB,8CAA8C;AAAA,EAC5E;AAEA,SAAO,EAAE,KAAK,IAAA;AACf;;;;;;;"}
1
+ {"version":3,"file":"OIDCHelpers.cjs","sources":["../../../../../../../../packages/engine-tenant-api/src/model/service/idp/providers/OIDCHelpers.ts"],"sourcesContent":["import { Client, custom, errors, generators, Issuer, TokenSet } from 'openid-client'\nimport { createRemoteJWKSet, jwtVerify } from 'jose'\nimport { OIDCClaimMapping, OIDCResponseData } from './OIDCTypes.js'\nimport { IDPValidationError } from '../IDPValidationError.js'\nimport { IDPResponseError } from '../IDPResponseError.js'\nimport {\n\tIDPResponse,\n\tIDPSessionState,\n\tInitIDPAuthResult,\n\tLogoutTokenClaims,\n\tLogoutUrlRequest,\n\tRevalidationResult,\n} from '../IdentityProviderHandler.js'\n\n/**\n * Build the persisted session state from an OIDC token set. Stores the tokens needed for\n * later re-validation (refresh/access) and SLO (id_token); the whole `tokens` blob is\n * encrypted at rest by the command layer.\n *\n * `prevTokens` carries the previously stored tokens forward: a refresh-grant response MAY omit\n * the refresh token (RFC 6749 §6 — IdPs that don't rotate just don't re-send it), in which case\n * the client must keep using the old one. Without this fallback a non-rotating IdP would persist\n * a session with no refresh token and be revoked (`no_refresh_token`) on the very next tick.\n */\nexport const tokenSetToSessionState = (tokenSet: TokenSet, sessionId?: string, prevTokens?: Record<string, unknown>): IDPSessionState => {\n\tconst refreshToken = tokenSet.refresh_token ?? (typeof prevTokens?.refresh_token === 'string' ? prevTokens.refresh_token : undefined)\n\tconst idToken = tokenSet.id_token ?? (typeof prevTokens?.id_token === 'string' ? prevTokens.id_token : undefined)\n\treturn {\n\t\tsessionId,\n\t\ttokens: {\n\t\t\t...(refreshToken ? { refresh_token: refreshToken } : {}),\n\t\t\t...(tokenSet.access_token ? { access_token: tokenSet.access_token } : {}),\n\t\t\t...(idToken ? { id_token: idToken } : {}),\n\t\t},\n\t\texpiresAt: tokenSet.expires_at ? new Date(tokenSet.expires_at * 1000) : undefined,\n\t}\n}\n\nexport const initOIDCAuth = async (\n\tclient: Client,\n\t{ redirectUrl, scope, responseMode }: { redirectUrl: string; scope?: string; responseMode?: string },\n): Promise<InitIDPAuthResult> => {\n\tconst nonce = generators.nonce()\n\tconst state = generators.state()\n\tconst url = client.authorizationUrl({\n\t\tredirect_uri: redirectUrl,\n\t\tresponse_mode: responseMode,\n\t\tscope: scope ?? 'openid email',\n\t\tnonce,\n\t\tstate,\n\t})\n\n\treturn {\n\t\tauthUrl: url,\n\t\tsessionData: { nonce, state },\n\t}\n}\n\nexport type HandleOIDCResponseOptions = {\n\tfetchUserInfo?: boolean\n\treturnOIDCResult?: boolean\n\tcaptureSession?: boolean\n\tclaimMapping?: OIDCClaimMapping\n}\n\n/**\n * Read a claim by name, supporting dot-paths into nested objects (`a.b.c`). Own-property only at every\n * segment (mirrors `ClaimMappingEvaluator.resolvePath`): a configured path must never descend into an\n * inherited member, so a `__proto__` / `constructor` segment cannot surface an `Object.prototype` value\n * as the externalIdentifier / email / name.\n */\nconst getClaim = (source: Record<string, unknown>, path: string): unknown =>\n\tpath.split('.').reduce<unknown>(\n\t\t(\n\t\t\tacc,\n\t\t\tkey,\n\t\t) => (acc != null && typeof acc === 'object' && Object.prototype.hasOwnProperty.call(acc, key) ? (acc as Record<string, unknown>)[key] : undefined),\n\t\tsource,\n\t)\n\n/**\n * Lift a configured nested attributes object (`attributesKey`, notably Apereo CAS's `attributes`) to the\n * top level so providers that nest their claims map without a code change. The nested attributes are\n * UNSIGNED, so they are spread UNDER `source` — a signed top-level claim keeps precedence over an\n * attributes-level value. Shared by the sign-in response handler ({@link handleOIDCResponse}) and the\n * session-refresh path ({@link revalidateOIDC}) so BOTH see the same claim surface; without this, an\n * `attributesKey` provider's A09 claim mapping would resolve at sign-in but silently not on refresh.\n */\nexport const liftNestedClaims = (source: Record<string, unknown>, attributesKey: string | undefined): Record<string, unknown> => {\n\tif (!attributesKey) {\n\t\treturn source\n\t}\n\tconst nested = Object.prototype.hasOwnProperty.call(source, attributesKey) ? source[attributesKey] : undefined\n\tif (nested !== null && typeof nested === 'object' && !Array.isArray(nested)) {\n\t\treturn { ...nested, ...source }\n\t}\n\treturn source\n}\n\ntype NormalizedClaims = Record<string, unknown> & {\n\texternalIdentifier: string\n\temail: string | undefined\n\tname: string | undefined\n\temailVerified: boolean\n}\n\n/**\n * Build the normalized claim surface shared by sign-in ({@link handleOIDCResponse}) and session refresh\n * ({@link revalidateOIDC}): lift any configured nested attributes object to the top level, then layer the\n * mapped identity fields (`externalIdentifier` / `email` / `name` / `emailVerified`) over the raw claims.\n * BOTH paths run this SAME normalization so an A09 claim-mapping rule resolves identically whether it\n * targets a raw provider claim or one of the normalized identity fields — without it the two surfaces\n * diverged (refresh saw the raw claim, sign-in the mapped value).\n *\n * `subFallback` is the signature-verified ID-token `sub`, used when a custom `externalIdentifier` mapping\n * resolves to nothing: at sign-in it is guaranteed present; on refresh it is the refreshed id-token's `sub`\n * (or, for the userinfo method, the userinfo `sub`). Throws (account-takeover guard) when the mapped\n * subject is a non-scalar or resolves empty — the refresh caller catches this and skips the sync.\n */\nconst normalizeClaims = (\n\trawSource: Record<string, unknown>,\n\tclaimMapping: OIDCClaimMapping | undefined,\n\tsubFallback: string | undefined,\n): NormalizedClaims => {\n\tconst source = liftNestedClaims(rawSource, claimMapping?.attributesKey)\n\n\t// The OIDC `email_verified` claim is a boolean per spec, but some providers send the\n\t// string \"true\". userInfo (and any unwrapped attributes) take precedence over the ID token.\n\tconst rawEmailVerified = source.email_verified\n\tconst emailVerified = rawEmailVerified === true || rawEmailVerified === 'true'\n\n\t// `externalIdentifier` is the federation key persisted in `person_identity_provider` and\n\t// matched on the next sign-in, so it must be a stable scalar. A `claimMapping` that pointed\n\t// it at an object/array would otherwise be coerced by `String(...)` to `'[object Object]'` /\n\t// a comma-join — collapsing every user of the provider onto one key (account takeover). Fail\n\t// closed instead. The default `sub` path is safe (openid-client guarantees `sub` is a string).\n\tconst mappedSubject = getClaim(source, claimMapping?.externalIdentifier ?? 'sub')\n\tlet externalIdentifier: string\n\tif (mappedSubject === undefined || mappedSubject === null) {\n\t\texternalIdentifier = subFallback ?? ''\n\t} else if (typeof mappedSubject === 'string' || typeof mappedSubject === 'number') {\n\t\texternalIdentifier = String(mappedSubject)\n\t} else {\n\t\tthrow new IDPValidationError(`The mapped externalIdentifier claim is not a scalar value`)\n\t}\n\tif (externalIdentifier === '') {\n\t\tthrow new IDPValidationError(`The mapped externalIdentifier claim resolved to an empty value`)\n\t}\n\n\t// `email` / `name` are typed `string | undefined` on IDPResponse and feed the by-e-mail\n\t// account lookup (which crashes on a non-string). `...source` already placed the raw claim\n\t// of whatever type, so OVERWRITE (don't conditionally add) with the mapped value when it is\n\t// a string, otherwise `undefined` — a non-string claim must not leak through `...source`.\n\tconst email = getClaim(source, claimMapping?.email ?? 'email')\n\tconst name = resolveName(source, claimMapping)\n\n\treturn {\n\t\t...source,\n\t\texternalIdentifier,\n\t\temail: typeof email === 'string' ? email : undefined,\n\t\tname,\n\t\temailVerified,\n\t}\n}\n\n/**\n * Resolve the display name, falling back to `given_name` + `family_name` when there is no usable\n * `name` claim.\n *\n * `name` is optional in OIDC core and plenty of providers omit it while sending the parts — Apereo\n * CAS and Entra ID do, and so does Keycloak under its default mappers. Without the fallback,\n * `CreatePersonCommand` lands on its own last-resort default and a federated person ends up named\n * after the local part of their e-mail (`jan.novak`) despite the IdP having reported \"Jan Novák\".\n * A single-path `claimMapping.name` cannot express this: the value has to be composed from two\n * claims, not selected from one.\n *\n * An explicitly configured `claimMapping.name` is honoured as-is, fallback included — mapping a\n * claim is a statement about where the name lives, and quietly substituting a different source\n * would defeat it. A blank claim counts as absent: an empty string is not a display name, and\n * treating it as one would keep the fallback (and `CreatePersonCommand`'s) from ever running.\n */\nconst resolveName = (source: Record<string, unknown>, claimMapping: OIDCClaimMapping | undefined): string | undefined => {\n\tconst mapped = getClaim(source, claimMapping?.name ?? 'name')\n\tif (typeof mapped === 'string' && mapped.trim() !== '') {\n\t\treturn mapped\n\t}\n\tif (claimMapping?.name !== undefined) {\n\t\treturn undefined\n\t}\n\tconst parts = [getClaim(source, 'given_name'), getClaim(source, 'family_name')]\n\t\t.filter((part): part is string => typeof part === 'string' && part.trim() !== '')\n\t\t.map(part => part.trim())\n\treturn parts.length > 0 ? parts.join(' ') : undefined\n}\n\nexport const handleOIDCResponse = async (\n\tclient: Client,\n\t{ sessionData, redirectUrl, ...otherData }: OIDCResponseData,\n\t{ fetchUserInfo, returnOIDCResult, captureSession, claimMapping }: HandleOIDCResponseOptions = {},\n): Promise<IDPResponse> => {\n\tconst params = 'parameters' in otherData ? otherData.parameters : client.callbackParams(otherData.url)\n\tif (params.state && !sessionData?.state) {\n\t\tthrow new IDPValidationError(`state is present in parameters, but missing in session data`)\n\t}\n\ttry {\n\t\tconst result = await client.callback(redirectUrl, params, sessionData)\n\t\tconst claims = result.claims()\n\t\tconst { at_hash, c_hash, nonce, ...claimsWithoutHashes } = claims\n\t\tconst userInfo = result.access_token && fetchUserInfo ? await client.userinfo(result) : {}\n\t\tconst oidcResult = returnOIDCResult ? result : {}\n\t\tconst idpSession = captureSession ? tokenSetToSessionState(result, typeof claims.sid === 'string' ? claims.sid : undefined) : undefined\n\n\t\t// Merge ID-token claims with userInfo (userInfo wins, per spec), then normalize the surface (lift\n\t\t// nested attributes + map the identity fields). The refresh path runs the SAME normalization, so a\n\t\t// claim mapping resolves identically at sign-in and on refresh. The default `sub` fallback is safe —\n\t\t// openid-client guarantees `sub` is a string.\n\t\tconst normalized = normalizeClaims({ ...claimsWithoutHashes, ...userInfo }, claimMapping, claims.sub)\n\n\t\treturn {\n\t\t\t...oidcResult,\n\t\t\t...normalized,\n\t\t\t...(idpSession ? { idpSession } : {}),\n\t\t}\n\t} catch (e: any) {\n\t\tif (e instanceof errors.RPError) {\n\t\t\tthrow new IDPValidationError(e.message)\n\t\t}\n\t\tif (e instanceof errors.OPError) {\n\t\t\tconst body = e.response?.body as any\n\t\t\tif (typeof body === 'object' && typeof body?.error === 'object' && typeof body.error?.message === 'string') {\n\t\t\t\tthrow new IDPResponseError(body.error.message)\n\t\t\t}\n\t\t\tthrow new IDPResponseError(e.message)\n\t\t}\n\t\tthrow e\n\t}\n}\n\n/** OIDC errors that definitively mean \"this session is no longer valid at the IdP\". */\nconst REVOKED_OIDC_ERRORS = new Set(['invalid_grant', 'invalid_token', 'expired_token'])\n\n/**\n * Re-validate a stored OIDC session against the IdP. Returns `revoked` only for definitive\n * IdP responses (invalid/expired grant or inactive introspection). Transient failures\n * (network, IdP down) re-throw so the caller can fail-open and keep the session — IdP\n * downtime must not log everyone out.\n */\nexport const revalidateOIDC = async (\n\tclient: Client,\n\tmethod: 'refresh' | 'userinfo' | 'introspection',\n\tsession: IDPSessionState,\n\toptions: { claimMapping?: OIDCClaimMapping; fetchUserInfo?: boolean } = {},\n): Promise<RevalidationResult> => {\n\tconst { claimMapping, fetchUserInfo } = options\n\tconst tokens = session.tokens ?? {}\n\tconst refreshToken = typeof tokens.refresh_token === 'string' ? tokens.refresh_token : undefined\n\tconst accessToken = typeof tokens.access_token === 'string' ? tokens.access_token : undefined\n\ttry {\n\t\tif (method === 'refresh') {\n\t\t\tif (!refreshToken) {\n\t\t\t\treturn { status: 'revoked', reason: 'no_refresh_token' }\n\t\t\t}\n\t\t\tconst tokenSet = await client.refresh(refreshToken)\n\t\t\tlet claims: Record<string, unknown> | undefined\n\t\t\tlet claimsComplete = false\n\t\t\ttry {\n\t\t\t\t// Reconstruct the SAME claim surface sign-in builds (handleOIDCResponse): the refreshed id-token\n\t\t\t\t// claims merged with userInfo when `fetchUserInfo` is set — exactly as at sign-in — then the shared\n\t\t\t\t// normalization (lift nested attributes + map identity fields). An `always` mapping therefore\n\t\t\t\t// reconciles against an identical surface on refresh, so `claimsComplete` lets the caller enable\n\t\t\t\t// `unmatched: \"remove\"` reconciliation here too (see IdpSessionRevalidator).\n\t\t\t\tif (tokenSet.id_token) {\n\t\t\t\t\tconst idClaims = tokenSet.claims()\n\t\t\t\t\tconst userInfo = tokenSet.access_token && fetchUserInfo ? await client.userinfo(tokenSet) : {}\n\t\t\t\t\tclaims = normalizeClaims({ ...idClaims, ...userInfo }, claimMapping, typeof idClaims.sub === 'string' ? idClaims.sub : undefined)\n\t\t\t\t\tclaimsComplete = true\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// Building the surface failed (userinfo unreachable, a non-scalar `externalIdentifier`, …). The IdP\n\t\t\t\t// already vouched for the session via the successful refresh, so KEEP it — just skip the claim sync\n\t\t\t\t// this tick (no claims → no grant, no removal) and retry on a later refresh. Leaving claimsComplete\n\t\t\t\t// false also guarantees a half-built surface can never drive a removal.\n\t\t\t\tclaims = undefined\n\t\t\t\tclaimsComplete = false\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tstatus: 'valid',\n\t\t\t\tclaims,\n\t\t\t\tclaimsComplete,\n\t\t\t\t// carry the stored tokens forward: a non-rotating IdP omits the refresh token here\n\t\t\t\tidpSession: tokenSetToSessionState(tokenSet, session.sessionId, tokens),\n\t\t\t}\n\t\t}\n\t\tif (method === 'userinfo') {\n\t\t\tif (!accessToken) {\n\t\t\t\treturn { status: 'revoked', reason: 'no_access_token' }\n\t\t\t}\n\t\t\tconst userInfo = await client.userinfo(accessToken)\n\t\t\tlet claims: Record<string, unknown> | undefined\n\t\t\ttry {\n\t\t\t\tclaims = normalizeClaims(userInfo, claimMapping, typeof userInfo.sub === 'string' ? userInfo.sub : undefined)\n\t\t\t} catch {\n\t\t\t\tclaims = undefined\n\t\t\t}\n\t\t\t// A userinfo probe carries no id-token claims, so its surface is NARROWER than sign-in's (id-token +\n\t\t\t// userinfo): a rule keyed on an id-token-only claim would miss here. Keep refresh-time sync additive-only\n\t\t\t// (`claimsComplete: false`) so `unmatched: \"remove\"` never strips a membership off this partial surface.\n\t\t\treturn { status: 'valid', claims, claimsComplete: false }\n\t\t}\n\t\t// introspection\n\t\tconst token = accessToken ?? refreshToken\n\t\tif (!token) {\n\t\t\treturn { status: 'revoked', reason: 'no_token' }\n\t\t}\n\t\tconst result = await client.introspect(token, accessToken ? 'access_token' : 'refresh_token')\n\t\tif (!result.active) {\n\t\t\treturn { status: 'revoked', reason: 'inactive' }\n\t\t}\n\t\treturn { status: 'valid' }\n\t} catch (e: any) {\n\t\tif (e instanceof errors.OPError) {\n\t\t\tif (typeof e.error === 'string' && REVOKED_OIDC_ERRORS.has(e.error)) {\n\t\t\t\treturn { status: 'revoked', reason: e.error }\n\t\t\t}\n\t\t\t// The userinfo endpoint signals a rejected access token with a bare HTTP 401 — per\n\t\t\t// RFC 6750 the `WWW-Authenticate` error code is optional, so openid-client may not\n\t\t\t// surface a parseable `error` here. A 401 is still definitive: the token is no\n\t\t\t// longer accepted → revoked. (Introspection is NOT treated this way: it returns 200\n\t\t\t// `{active:false}` for revoked tokens, so a 401/400 there means client-auth/config\n\t\t\t// failure — transient, must not log users out.)\n\t\t\tif (method === 'userinfo' && e.response?.statusCode === 401) {\n\t\t\t\treturn { status: 'revoked', reason: 'userinfo_unauthorized' }\n\t\t\t}\n\t\t}\n\t\t// transient (network / IdP unavailable) — propagate, do not revoke\n\t\tthrow e\n\t}\n}\n\n/**\n * Build an RP-initiated (front-channel) logout URL (OIDC RP-Initiated Logout 1.0). Returns null\n * when the IdP advertises no `end_session_endpoint` — the caller then degrades to a local-only\n * logout (legacy-IdP graceful fallback). The `id_token_hint` lets the IdP identify and confirm the\n * session to terminate; `post_logout_redirect_uri` is where the IdP returns the browser afterwards.\n */\nexport const buildOIDCLogoutUrl = (client: Client, { idToken, postLogoutRedirectUri }: LogoutUrlRequest): string | null => {\n\tif (!client.issuer.metadata.end_session_endpoint) {\n\t\treturn null\n\t}\n\treturn client.endSessionUrl({\n\t\t...(idToken ? { id_token_hint: idToken } : {}),\n\t\t...(postLogoutRedirectUri ? { post_logout_redirect_uri: postLogoutRedirectUri } : {}),\n\t})\n}\n\n/**\n * The OIDC Back-Channel Logout 1.0 event member that MUST be present in a logout token's `events`\n * claim. Its presence (and the absence of a `nonce`) is what distinguishes a logout token from an\n * ID token — both are signed by the same IdP, so without this check an ID token could be replayed\n * to forcibly log a user out.\n */\nconst BACKCHANNEL_LOGOUT_EVENT = 'http://schemas.openid.net/event/backchannel-logout'\n\n/**\n * Max accepted age of a back-channel logout token, derived from its `iat`. OIDC Back-Channel Logout\n * tokens are single-use and short-lived; bounding the age (together with requiring `exp`) limits the\n * window in which a captured token could be replayed to force a logout.\n */\nconst LOGOUT_TOKEN_MAX_AGE_SECONDS = 120\nconst LOGOUT_TOKEN_CLOCK_TOLERANCE_SECONDS = 5\n\n/**\n * Remote JWKS sets keyed by `jwks_uri`. `createRemoteJWKSet` returns a function with its own internal\n * key cache + fetch cooldown, so it MUST be reused across requests — re-creating it per call (as the\n * unauthenticated back-channel endpoint would otherwise do) defeats the cache and turns every request\n * into a potential outbound JWKS fetch. Keyed by URL, so two providers sharing an IdP share the set.\n */\nconst remoteJwksCache = new Map<string, ReturnType<typeof createRemoteJWKSet>>()\n\nconst getRemoteJwks = (jwksUri: string): ReturnType<typeof createRemoteJWKSet> => {\n\tlet jwks = remoteJwksCache.get(jwksUri)\n\tif (!jwks) {\n\t\tjwks = createRemoteJWKSet(new URL(jwksUri))\n\t\tremoteJwksCache.set(jwksUri, jwks)\n\t}\n\treturn jwks\n}\n\n/**\n * Validate an OIDC back-channel logout token (OIDC Back-Channel Logout 1.0 §2.4–2.6) and extract\n * the targeted `sid` / `sub`. The token is a JWT signed by the IdP; we verify the signature against\n * the issuer's JWKS and enforce the issuer + audience (client_id) the same way ID tokens are\n * verified, pinning the signing algorithm to the provider's configured one, then assert the\n * back-channel-specific claims:\n * - `iat` is present and recent and `exp` is present (§2.4 requires both) — bounds the replay window;\n * - `events` contains the back-channel-logout member (it really is a logout token);\n * - it carries a `sid` and/or `sub` (otherwise there is nothing to act on);\n * - it does NOT carry a `nonce` (a `nonce` means it is an ID token being replayed).\n * Throws {@link IDPValidationError} on any failure so the caller can answer 400.\n */\nexport const validateOIDCLogoutToken = async (client: Client, issuer: Issuer<Client>, logoutToken: string): Promise<LogoutTokenClaims> => {\n\tconst jwksUri = issuer.metadata.jwks_uri\n\tif (!jwksUri) {\n\t\tthrow new IDPValidationError('IdP has no jwks_uri; cannot verify logout token')\n\t}\n\tconst clientId = client.metadata.client_id\n\tif (typeof clientId !== 'string' || clientId === '') {\n\t\t// The `aud` check is a core anti-token-substitution defence on this unauthenticated endpoint.\n\t\t// jose treats `audience: undefined` as \"skip the aud check entirely\", so a missing client_id\n\t\t// must fail closed (reject the token) rather than fall through and accept any audience.\n\t\tthrow new IDPValidationError('cannot verify logout token audience: client_id is missing')\n\t}\n\tconst expectedAlg = typeof client.metadata.id_token_signed_response_alg === 'string'\n\t\t? client.metadata.id_token_signed_response_alg\n\t\t: 'RS256'\n\tconst jwks = getRemoteJwks(jwksUri)\n\tlet payload: Record<string, unknown>\n\ttry {\n\t\tconst verified = await jwtVerify(logoutToken, jwks, {\n\t\t\tissuer: issuer.metadata.issuer,\n\t\t\taudience: clientId,\n\t\t\t// pin to the provider's configured signing alg so a JWKS containing a symmetric/none key\n\t\t\t// can never be selected (defence-in-depth on top of jose's own key-type check).\n\t\t\talgorithms: [expectedAlg],\n\t\t\t// §2.4: `iat` and `exp` are REQUIRED. `maxTokenAge` makes `iat` required + bounds freshness;\n\t\t\t// `requiredClaims` makes `exp` required (jose only checks `exp` when present).\n\t\t\tmaxTokenAge: LOGOUT_TOKEN_MAX_AGE_SECONDS,\n\t\t\trequiredClaims: ['exp'],\n\t\t\tclockTolerance: LOGOUT_TOKEN_CLOCK_TOLERANCE_SECONDS,\n\t\t})\n\t\tpayload = verified.payload as Record<string, unknown>\n\t} catch (e: any) {\n\t\tthrow new IDPValidationError(`Invalid logout token: ${e?.message ?? 'verification failed'}`)\n\t}\n\n\t// A logout token MUST NOT contain a nonce; its presence means an ID token is being replayed.\n\tif ('nonce' in payload) {\n\t\tthrow new IDPValidationError('Logout token must not contain a nonce')\n\t}\n\n\tconst events = payload.events\n\tconst hasLogoutEvent = typeof events === 'object' && events !== null && BACKCHANNEL_LOGOUT_EVENT in (events as Record<string, unknown>)\n\tif (!hasLogoutEvent) {\n\t\tthrow new IDPValidationError('Logout token is missing the back-channel-logout event')\n\t}\n\n\tconst sid = typeof payload.sid === 'string' ? payload.sid : undefined\n\tconst sub = typeof payload.sub === 'string' ? payload.sub : undefined\n\tif (!sid && !sub) {\n\t\tthrow new IDPValidationError('Logout token must contain a sid or sub claim')\n\t}\n\n\treturn { sid, sub }\n}\n"],"names":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ACpB,UAAM,IAAIA,mBAAAA,mBAAmB,uDAAuD;AAAA,EACrF;AAEA,QAAM,MAAM,OAAO,QAAQ,QAAQ,WAAW,QAAQ,MAAM;AAC5D,QAAM,MAAM,OAAO,QAAQ,QAAQ,WAAW,QAAQ,MAAM;AAC5D,MAAI,CAAC,OAAO,CAAC,KAAK;AACjB,UAAM,IAAIA,mBAAAA,mBAAmB,8CAA8C;AAAA,EAC5E;AAEA,SAAO,EAAE,KAAK,IAAA;AACf;;;;;;;;"}
@@ -31,9 +31,56 @@ const initOIDCAuth = async (client, { redirectUrl, scope, responseMode }) => {
31
31
  };
32
32
  };
33
33
  const getClaim = (source, path) => path.split(".").reduce(
34
- (acc, key) => acc != null && typeof acc === "object" ? acc[key] : void 0,
34
+ (acc, key) => acc != null && typeof acc === "object" && Object.prototype.hasOwnProperty.call(acc, key) ? acc[key] : void 0,
35
35
  source
36
36
  );
37
+ const liftNestedClaims = (source, attributesKey) => {
38
+ if (!attributesKey) {
39
+ return source;
40
+ }
41
+ const nested = Object.prototype.hasOwnProperty.call(source, attributesKey) ? source[attributesKey] : void 0;
42
+ if (nested !== null && typeof nested === "object" && !Array.isArray(nested)) {
43
+ return { ...nested, ...source };
44
+ }
45
+ return source;
46
+ };
47
+ const normalizeClaims = (rawSource, claimMapping, subFallback) => {
48
+ const source = liftNestedClaims(rawSource, claimMapping?.attributesKey);
49
+ const rawEmailVerified = source.email_verified;
50
+ const emailVerified = rawEmailVerified === true || rawEmailVerified === "true";
51
+ const mappedSubject = getClaim(source, claimMapping?.externalIdentifier ?? "sub");
52
+ let externalIdentifier;
53
+ if (mappedSubject === void 0 || mappedSubject === null) {
54
+ externalIdentifier = subFallback ?? "";
55
+ } else if (typeof mappedSubject === "string" || typeof mappedSubject === "number") {
56
+ externalIdentifier = String(mappedSubject);
57
+ } else {
58
+ throw new IDPValidationError(`The mapped externalIdentifier claim is not a scalar value`);
59
+ }
60
+ if (externalIdentifier === "") {
61
+ throw new IDPValidationError(`The mapped externalIdentifier claim resolved to an empty value`);
62
+ }
63
+ const email = getClaim(source, claimMapping?.email ?? "email");
64
+ const name = resolveName(source, claimMapping);
65
+ return {
66
+ ...source,
67
+ externalIdentifier,
68
+ email: typeof email === "string" ? email : void 0,
69
+ name,
70
+ emailVerified
71
+ };
72
+ };
73
+ const resolveName = (source, claimMapping) => {
74
+ const mapped = getClaim(source, claimMapping?.name ?? "name");
75
+ if (typeof mapped === "string" && mapped.trim() !== "") {
76
+ return mapped;
77
+ }
78
+ if (claimMapping?.name !== void 0) {
79
+ return void 0;
80
+ }
81
+ const parts = [getClaim(source, "given_name"), getClaim(source, "family_name")].filter((part) => typeof part === "string" && part.trim() !== "").map((part) => part.trim());
82
+ return parts.length > 0 ? parts.join(" ") : void 0;
83
+ };
37
84
  const handleOIDCResponse = async (client, { sessionData, redirectUrl, ...otherData }, { fetchUserInfo, returnOIDCResult, captureSession, claimMapping } = {}) => {
38
85
  const params = "parameters" in otherData ? otherData.parameters : client.callbackParams(otherData.url);
39
86
  if (params.state && !sessionData?.state) {
@@ -46,37 +93,10 @@ const handleOIDCResponse = async (client, { sessionData, redirectUrl, ...otherDa
46
93
  const userInfo = result.access_token && fetchUserInfo ? await client.userinfo(result) : {};
47
94
  const oidcResult = returnOIDCResult ? result : {};
48
95
  const idpSession = captureSession ? tokenSetToSessionState(result, typeof claims.sid === "string" ? claims.sid : void 0) : void 0;
49
- let source = { ...claimsWithoutHashes, ...userInfo };
50
- const attributesKey = claimMapping?.attributesKey;
51
- if (attributesKey) {
52
- const nested = source[attributesKey];
53
- if (nested && typeof nested === "object" && !Array.isArray(nested)) {
54
- source = { ...nested, ...source };
55
- }
56
- }
57
- const rawEmailVerified = source.email_verified;
58
- const emailVerified = rawEmailVerified === true || rawEmailVerified === "true";
59
- const mappedSubject = getClaim(source, claimMapping?.externalIdentifier ?? "sub");
60
- let externalIdentifier;
61
- if (mappedSubject === void 0 || mappedSubject === null) {
62
- externalIdentifier = claims.sub;
63
- } else if (typeof mappedSubject === "string" || typeof mappedSubject === "number") {
64
- externalIdentifier = String(mappedSubject);
65
- } else {
66
- throw new IDPValidationError(`The mapped externalIdentifier claim is not a scalar value`);
67
- }
68
- if (externalIdentifier === "") {
69
- throw new IDPValidationError(`The mapped externalIdentifier claim resolved to an empty value`);
70
- }
71
- const email = getClaim(source, claimMapping?.email ?? "email");
72
- const name = getClaim(source, claimMapping?.name ?? "name");
96
+ const normalized = normalizeClaims({ ...claimsWithoutHashes, ...userInfo }, claimMapping, claims.sub);
73
97
  return {
74
98
  ...oidcResult,
75
- ...source,
76
- externalIdentifier,
77
- email: typeof email === "string" ? email : void 0,
78
- name: typeof name === "string" ? name : void 0,
79
- emailVerified,
99
+ ...normalized,
80
100
  ...idpSession ? { idpSession } : {}
81
101
  };
82
102
  } catch (e) {
@@ -94,7 +114,8 @@ const handleOIDCResponse = async (client, { sessionData, redirectUrl, ...otherDa
94
114
  }
95
115
  };
96
116
  const REVOKED_OIDC_ERRORS = /* @__PURE__ */ new Set(["invalid_grant", "invalid_token", "expired_token"]);
97
- const revalidateOIDC = async (client, method, session) => {
117
+ const revalidateOIDC = async (client, method, session, options = {}) => {
118
+ const { claimMapping, fetchUserInfo } = options;
98
119
  const tokens = session.tokens ?? {};
99
120
  const refreshToken = typeof tokens.refresh_token === "string" ? tokens.refresh_token : void 0;
100
121
  const accessToken = typeof tokens.access_token === "string" ? tokens.access_token : void 0;
@@ -105,14 +126,22 @@ const revalidateOIDC = async (client, method, session) => {
105
126
  }
106
127
  const tokenSet = await client.refresh(refreshToken);
107
128
  let claims;
129
+ let claimsComplete = false;
108
130
  try {
109
- claims = tokenSet.id_token ? tokenSet.claims() : void 0;
131
+ if (tokenSet.id_token) {
132
+ const idClaims = tokenSet.claims();
133
+ const userInfo = tokenSet.access_token && fetchUserInfo ? await client.userinfo(tokenSet) : {};
134
+ claims = normalizeClaims({ ...idClaims, ...userInfo }, claimMapping, typeof idClaims.sub === "string" ? idClaims.sub : void 0);
135
+ claimsComplete = true;
136
+ }
110
137
  } catch {
111
138
  claims = void 0;
139
+ claimsComplete = false;
112
140
  }
113
141
  return {
114
142
  status: "valid",
115
143
  claims,
144
+ claimsComplete,
116
145
  // carry the stored tokens forward: a non-rotating IdP omits the refresh token here
117
146
  idpSession: tokenSetToSessionState(tokenSet, session.sessionId, tokens)
118
147
  };
@@ -122,7 +151,13 @@ const revalidateOIDC = async (client, method, session) => {
122
151
  return { status: "revoked", reason: "no_access_token" };
123
152
  }
124
153
  const userInfo = await client.userinfo(accessToken);
125
- return { status: "valid", claims: userInfo };
154
+ let claims;
155
+ try {
156
+ claims = normalizeClaims(userInfo, claimMapping, typeof userInfo.sub === "string" ? userInfo.sub : void 0);
157
+ } catch {
158
+ claims = void 0;
159
+ }
160
+ return { status: "valid", claims, claimsComplete: false };
126
161
  }
127
162
  const token = accessToken ?? refreshToken;
128
163
  if (!token) {
@@ -214,6 +249,7 @@ export {
214
249
  buildOIDCLogoutUrl,
215
250
  handleOIDCResponse,
216
251
  initOIDCAuth,
252
+ liftNestedClaims,
217
253
  revalidateOIDC,
218
254
  tokenSetToSessionState,
219
255
  validateOIDCLogoutToken
@@ -1 +1 @@
1
- {"version":3,"file":"OIDCHelpers.js","sources":["../../../../../../../../packages/engine-tenant-api/src/model/service/idp/providers/OIDCHelpers.ts"],"sourcesContent":["import { Client, custom, errors, generators, Issuer, TokenSet } from 'openid-client'\nimport { createRemoteJWKSet, jwtVerify } from 'jose'\nimport { OIDCClaimMapping, OIDCResponseData } from './OIDCTypes.js'\nimport { IDPValidationError } from '../IDPValidationError.js'\nimport { IDPResponseError } from '../IDPResponseError.js'\nimport {\n\tIDPResponse,\n\tIDPSessionState,\n\tInitIDPAuthResult,\n\tLogoutTokenClaims,\n\tLogoutUrlRequest,\n\tRevalidationResult,\n} from '../IdentityProviderHandler.js'\n\n/**\n * Build the persisted session state from an OIDC token set. Stores the tokens needed for\n * later re-validation (refresh/access) and SLO (id_token); the whole `tokens` blob is\n * encrypted at rest by the command layer.\n *\n * `prevTokens` carries the previously stored tokens forward: a refresh-grant response MAY omit\n * the refresh token (RFC 6749 §6 — IdPs that don't rotate just don't re-send it), in which case\n * the client must keep using the old one. Without this fallback a non-rotating IdP would persist\n * a session with no refresh token and be revoked (`no_refresh_token`) on the very next tick.\n */\nexport const tokenSetToSessionState = (tokenSet: TokenSet, sessionId?: string, prevTokens?: Record<string, unknown>): IDPSessionState => {\n\tconst refreshToken = tokenSet.refresh_token ?? (typeof prevTokens?.refresh_token === 'string' ? prevTokens.refresh_token : undefined)\n\tconst idToken = tokenSet.id_token ?? (typeof prevTokens?.id_token === 'string' ? prevTokens.id_token : undefined)\n\treturn {\n\t\tsessionId,\n\t\ttokens: {\n\t\t\t...(refreshToken ? { refresh_token: refreshToken } : {}),\n\t\t\t...(tokenSet.access_token ? { access_token: tokenSet.access_token } : {}),\n\t\t\t...(idToken ? { id_token: idToken } : {}),\n\t\t},\n\t\texpiresAt: tokenSet.expires_at ? new Date(tokenSet.expires_at * 1000) : undefined,\n\t}\n}\n\nexport const initOIDCAuth = async (\n\tclient: Client,\n\t{ redirectUrl, scope, responseMode }: { redirectUrl: string; scope?: string; responseMode?: string },\n): Promise<InitIDPAuthResult> => {\n\tconst nonce = generators.nonce()\n\tconst state = generators.state()\n\tconst url = client.authorizationUrl({\n\t\tredirect_uri: redirectUrl,\n\t\tresponse_mode: responseMode,\n\t\tscope: scope ?? 'openid email',\n\t\tnonce,\n\t\tstate,\n\t})\n\n\treturn {\n\t\tauthUrl: url,\n\t\tsessionData: { nonce, state },\n\t}\n}\n\nexport type HandleOIDCResponseOptions = {\n\tfetchUserInfo?: boolean\n\treturnOIDCResult?: boolean\n\tcaptureSession?: boolean\n\tclaimMapping?: OIDCClaimMapping\n}\n\n/** Read a claim by name, supporting dot-paths into nested objects (`a.b.c`). */\nconst getClaim = (source: Record<string, unknown>, path: string): unknown =>\n\tpath.split('.').reduce<unknown>(\n\t\t(acc, key) => (acc != null && typeof acc === 'object' ? (acc as Record<string, unknown>)[key] : undefined),\n\t\tsource,\n\t)\n\nexport const handleOIDCResponse = async (\n\tclient: Client,\n\t{ sessionData, redirectUrl, ...otherData }: OIDCResponseData,\n\t{ fetchUserInfo, returnOIDCResult, captureSession, claimMapping }: HandleOIDCResponseOptions = {},\n): Promise<IDPResponse> => {\n\tconst params = 'parameters' in otherData ? otherData.parameters : client.callbackParams(otherData.url)\n\tif (params.state && !sessionData?.state) {\n\t\tthrow new IDPValidationError(`state is present in parameters, but missing in session data`)\n\t}\n\ttry {\n\t\tconst result = await client.callback(redirectUrl, params, sessionData)\n\t\tconst claims = result.claims()\n\t\tconst { at_hash, c_hash, nonce, ...claimsWithoutHashes } = claims\n\t\tconst userInfo = result.access_token && fetchUserInfo ? await client.userinfo(result) : {}\n\t\tconst oidcResult = returnOIDCResult ? result : {}\n\t\tconst idpSession = captureSession ? tokenSetToSessionState(result, typeof claims.sid === 'string' ? claims.sid : undefined) : undefined\n\n\t\t// Merge ID-token claims with userInfo (userInfo wins, per spec). Then optionally lift a\n\t\t// nested attributes object to the top level so providers that nest their claims (notably\n\t\t// Apereo CAS userinfo, which returns them under `attributes`) map without a code change.\n\t\t// The nested attributes are UNSIGNED, so they must not override a claim already present in\n\t\t// the (signature-verified) ID-token / userInfo merge — spread them UNDER `source`, not over\n\t\t// it, so a signed `sub` / `email_verified` keeps precedence over an attributes-level value.\n\t\tlet source: Record<string, unknown> = { ...claimsWithoutHashes, ...userInfo }\n\t\tconst attributesKey = claimMapping?.attributesKey\n\t\tif (attributesKey) {\n\t\t\tconst nested = source[attributesKey]\n\t\t\tif (nested && typeof nested === 'object' && !Array.isArray(nested)) {\n\t\t\t\tsource = { ...(nested as Record<string, unknown>), ...source }\n\t\t\t}\n\t\t}\n\n\t\t// The OIDC `email_verified` claim is a boolean per spec, but some providers send the\n\t\t// string \"true\". userInfo (and any unwrapped attributes) take precedence over the ID token.\n\t\tconst rawEmailVerified = source.email_verified\n\t\tconst emailVerified = rawEmailVerified === true || rawEmailVerified === 'true'\n\n\t\t// `externalIdentifier` is the federation key persisted in `person_identity_provider` and\n\t\t// matched on the next sign-in, so it must be a stable scalar. A `claimMapping` that pointed\n\t\t// it at an object/array would otherwise be coerced by `String(...)` to `'[object Object]'` /\n\t\t// a comma-join — collapsing every user of the provider onto one key (account takeover). Fail\n\t\t// closed instead. The default `sub` path is safe (openid-client guarantees `sub` is a string).\n\t\tconst mappedSubject = getClaim(source, claimMapping?.externalIdentifier ?? 'sub')\n\t\tlet externalIdentifier: string\n\t\tif (mappedSubject === undefined || mappedSubject === null) {\n\t\t\texternalIdentifier = claims.sub\n\t\t} else if (typeof mappedSubject === 'string' || typeof mappedSubject === 'number') {\n\t\t\texternalIdentifier = String(mappedSubject)\n\t\t} else {\n\t\t\tthrow new IDPValidationError(`The mapped externalIdentifier claim is not a scalar value`)\n\t\t}\n\t\tif (externalIdentifier === '') {\n\t\t\tthrow new IDPValidationError(`The mapped externalIdentifier claim resolved to an empty value`)\n\t\t}\n\n\t\t// `email` / `name` are typed `string | undefined` on IDPResponse and feed the by-e-mail\n\t\t// account lookup (which crashes on a non-string). `...source` already placed the raw claim\n\t\t// of whatever type, so OVERWRITE (don't conditionally add) with the mapped value when it is\n\t\t// a string, otherwise `undefined` — a non-string claim must not leak through `...source`.\n\t\tconst email = getClaim(source, claimMapping?.email ?? 'email')\n\t\tconst name = getClaim(source, claimMapping?.name ?? 'name')\n\n\t\treturn {\n\t\t\t...oidcResult,\n\t\t\t...source,\n\t\t\texternalIdentifier,\n\t\t\temail: typeof email === 'string' ? email : undefined,\n\t\t\tname: typeof name === 'string' ? name : undefined,\n\t\t\temailVerified,\n\t\t\t...(idpSession ? { idpSession } : {}),\n\t\t}\n\t} catch (e: any) {\n\t\tif (e instanceof errors.RPError) {\n\t\t\tthrow new IDPValidationError(e.message)\n\t\t}\n\t\tif (e instanceof errors.OPError) {\n\t\t\tconst body = e.response?.body as any\n\t\t\tif (typeof body === 'object' && typeof body?.error === 'object' && typeof body.error?.message === 'string') {\n\t\t\t\tthrow new IDPResponseError(body.error.message)\n\t\t\t}\n\t\t\tthrow new IDPResponseError(e.message)\n\t\t}\n\t\tthrow e\n\t}\n}\n\n/** OIDC errors that definitively mean \"this session is no longer valid at the IdP\". */\nconst REVOKED_OIDC_ERRORS = new Set(['invalid_grant', 'invalid_token', 'expired_token'])\n\n/**\n * Re-validate a stored OIDC session against the IdP. Returns `revoked` only for definitive\n * IdP responses (invalid/expired grant or inactive introspection). Transient failures\n * (network, IdP down) re-throw so the caller can fail-open and keep the session — IdP\n * downtime must not log everyone out.\n */\nexport const revalidateOIDC = async (\n\tclient: Client,\n\tmethod: 'refresh' | 'userinfo' | 'introspection',\n\tsession: IDPSessionState,\n): Promise<RevalidationResult> => {\n\tconst tokens = session.tokens ?? {}\n\tconst refreshToken = typeof tokens.refresh_token === 'string' ? tokens.refresh_token : undefined\n\tconst accessToken = typeof tokens.access_token === 'string' ? tokens.access_token : undefined\n\ttry {\n\t\tif (method === 'refresh') {\n\t\t\tif (!refreshToken) {\n\t\t\t\treturn { status: 'revoked', reason: 'no_refresh_token' }\n\t\t\t}\n\t\t\tconst tokenSet = await client.refresh(refreshToken)\n\t\t\tlet claims: Record<string, unknown> | undefined\n\t\t\ttry {\n\t\t\t\tclaims = tokenSet.id_token ? tokenSet.claims() : undefined\n\t\t\t} catch {\n\t\t\t\tclaims = undefined\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tstatus: 'valid',\n\t\t\t\tclaims,\n\t\t\t\t// carry the stored tokens forward: a non-rotating IdP omits the refresh token here\n\t\t\t\tidpSession: tokenSetToSessionState(tokenSet, session.sessionId, tokens),\n\t\t\t}\n\t\t}\n\t\tif (method === 'userinfo') {\n\t\t\tif (!accessToken) {\n\t\t\t\treturn { status: 'revoked', reason: 'no_access_token' }\n\t\t\t}\n\t\t\tconst userInfo = await client.userinfo(accessToken)\n\t\t\treturn { status: 'valid', claims: userInfo }\n\t\t}\n\t\t// introspection\n\t\tconst token = accessToken ?? refreshToken\n\t\tif (!token) {\n\t\t\treturn { status: 'revoked', reason: 'no_token' }\n\t\t}\n\t\tconst result = await client.introspect(token, accessToken ? 'access_token' : 'refresh_token')\n\t\tif (!result.active) {\n\t\t\treturn { status: 'revoked', reason: 'inactive' }\n\t\t}\n\t\treturn { status: 'valid' }\n\t} catch (e: any) {\n\t\tif (e instanceof errors.OPError) {\n\t\t\tif (typeof e.error === 'string' && REVOKED_OIDC_ERRORS.has(e.error)) {\n\t\t\t\treturn { status: 'revoked', reason: e.error }\n\t\t\t}\n\t\t\t// The userinfo endpoint signals a rejected access token with a bare HTTP 401 — per\n\t\t\t// RFC 6750 the `WWW-Authenticate` error code is optional, so openid-client may not\n\t\t\t// surface a parseable `error` here. A 401 is still definitive: the token is no\n\t\t\t// longer accepted → revoked. (Introspection is NOT treated this way: it returns 200\n\t\t\t// `{active:false}` for revoked tokens, so a 401/400 there means client-auth/config\n\t\t\t// failure — transient, must not log users out.)\n\t\t\tif (method === 'userinfo' && e.response?.statusCode === 401) {\n\t\t\t\treturn { status: 'revoked', reason: 'userinfo_unauthorized' }\n\t\t\t}\n\t\t}\n\t\t// transient (network / IdP unavailable) — propagate, do not revoke\n\t\tthrow e\n\t}\n}\n\n/**\n * Build an RP-initiated (front-channel) logout URL (OIDC RP-Initiated Logout 1.0). Returns null\n * when the IdP advertises no `end_session_endpoint` — the caller then degrades to a local-only\n * logout (legacy-IdP graceful fallback). The `id_token_hint` lets the IdP identify and confirm the\n * session to terminate; `post_logout_redirect_uri` is where the IdP returns the browser afterwards.\n */\nexport const buildOIDCLogoutUrl = (client: Client, { idToken, postLogoutRedirectUri }: LogoutUrlRequest): string | null => {\n\tif (!client.issuer.metadata.end_session_endpoint) {\n\t\treturn null\n\t}\n\treturn client.endSessionUrl({\n\t\t...(idToken ? { id_token_hint: idToken } : {}),\n\t\t...(postLogoutRedirectUri ? { post_logout_redirect_uri: postLogoutRedirectUri } : {}),\n\t})\n}\n\n/**\n * The OIDC Back-Channel Logout 1.0 event member that MUST be present in a logout token's `events`\n * claim. Its presence (and the absence of a `nonce`) is what distinguishes a logout token from an\n * ID token — both are signed by the same IdP, so without this check an ID token could be replayed\n * to forcibly log a user out.\n */\nconst BACKCHANNEL_LOGOUT_EVENT = 'http://schemas.openid.net/event/backchannel-logout'\n\n/**\n * Max accepted age of a back-channel logout token, derived from its `iat`. OIDC Back-Channel Logout\n * tokens are single-use and short-lived; bounding the age (together with requiring `exp`) limits the\n * window in which a captured token could be replayed to force a logout.\n */\nconst LOGOUT_TOKEN_MAX_AGE_SECONDS = 120\nconst LOGOUT_TOKEN_CLOCK_TOLERANCE_SECONDS = 5\n\n/**\n * Remote JWKS sets keyed by `jwks_uri`. `createRemoteJWKSet` returns a function with its own internal\n * key cache + fetch cooldown, so it MUST be reused across requests — re-creating it per call (as the\n * unauthenticated back-channel endpoint would otherwise do) defeats the cache and turns every request\n * into a potential outbound JWKS fetch. Keyed by URL, so two providers sharing an IdP share the set.\n */\nconst remoteJwksCache = new Map<string, ReturnType<typeof createRemoteJWKSet>>()\n\nconst getRemoteJwks = (jwksUri: string): ReturnType<typeof createRemoteJWKSet> => {\n\tlet jwks = remoteJwksCache.get(jwksUri)\n\tif (!jwks) {\n\t\tjwks = createRemoteJWKSet(new URL(jwksUri))\n\t\tremoteJwksCache.set(jwksUri, jwks)\n\t}\n\treturn jwks\n}\n\n/**\n * Validate an OIDC back-channel logout token (OIDC Back-Channel Logout 1.0 §2.4–2.6) and extract\n * the targeted `sid` / `sub`. The token is a JWT signed by the IdP; we verify the signature against\n * the issuer's JWKS and enforce the issuer + audience (client_id) the same way ID tokens are\n * verified, pinning the signing algorithm to the provider's configured one, then assert the\n * back-channel-specific claims:\n * - `iat` is present and recent and `exp` is present (§2.4 requires both) — bounds the replay window;\n * - `events` contains the back-channel-logout member (it really is a logout token);\n * - it carries a `sid` and/or `sub` (otherwise there is nothing to act on);\n * - it does NOT carry a `nonce` (a `nonce` means it is an ID token being replayed).\n * Throws {@link IDPValidationError} on any failure so the caller can answer 400.\n */\nexport const validateOIDCLogoutToken = async (client: Client, issuer: Issuer<Client>, logoutToken: string): Promise<LogoutTokenClaims> => {\n\tconst jwksUri = issuer.metadata.jwks_uri\n\tif (!jwksUri) {\n\t\tthrow new IDPValidationError('IdP has no jwks_uri; cannot verify logout token')\n\t}\n\tconst clientId = client.metadata.client_id\n\tif (typeof clientId !== 'string' || clientId === '') {\n\t\t// The `aud` check is a core anti-token-substitution defence on this unauthenticated endpoint.\n\t\t// jose treats `audience: undefined` as \"skip the aud check entirely\", so a missing client_id\n\t\t// must fail closed (reject the token) rather than fall through and accept any audience.\n\t\tthrow new IDPValidationError('cannot verify logout token audience: client_id is missing')\n\t}\n\tconst expectedAlg = typeof client.metadata.id_token_signed_response_alg === 'string'\n\t\t? client.metadata.id_token_signed_response_alg\n\t\t: 'RS256'\n\tconst jwks = getRemoteJwks(jwksUri)\n\tlet payload: Record<string, unknown>\n\ttry {\n\t\tconst verified = await jwtVerify(logoutToken, jwks, {\n\t\t\tissuer: issuer.metadata.issuer,\n\t\t\taudience: clientId,\n\t\t\t// pin to the provider's configured signing alg so a JWKS containing a symmetric/none key\n\t\t\t// can never be selected (defence-in-depth on top of jose's own key-type check).\n\t\t\talgorithms: [expectedAlg],\n\t\t\t// §2.4: `iat` and `exp` are REQUIRED. `maxTokenAge` makes `iat` required + bounds freshness;\n\t\t\t// `requiredClaims` makes `exp` required (jose only checks `exp` when present).\n\t\t\tmaxTokenAge: LOGOUT_TOKEN_MAX_AGE_SECONDS,\n\t\t\trequiredClaims: ['exp'],\n\t\t\tclockTolerance: LOGOUT_TOKEN_CLOCK_TOLERANCE_SECONDS,\n\t\t})\n\t\tpayload = verified.payload as Record<string, unknown>\n\t} catch (e: any) {\n\t\tthrow new IDPValidationError(`Invalid logout token: ${e?.message ?? 'verification failed'}`)\n\t}\n\n\t// A logout token MUST NOT contain a nonce; its presence means an ID token is being replayed.\n\tif ('nonce' in payload) {\n\t\tthrow new IDPValidationError('Logout token must not contain a nonce')\n\t}\n\n\tconst events = payload.events\n\tconst hasLogoutEvent = typeof events === 'object' && events !== null && BACKCHANNEL_LOGOUT_EVENT in (events as Record<string, unknown>)\n\tif (!hasLogoutEvent) {\n\t\tthrow new IDPValidationError('Logout token is missing the back-channel-logout event')\n\t}\n\n\tconst sid = typeof payload.sid === 'string' ? payload.sid : undefined\n\tconst sub = typeof payload.sub === 'string' ? payload.sub : undefined\n\tif (!sid && !sub) {\n\t\tthrow new IDPValidationError('Logout token must contain a sid or sub claim')\n\t}\n\n\treturn { sid, sub }\n}\n"],"names":[],"mappings":";;;;AAwBO,MAAM,yBAAyB,CAAC,UAAoB,WAAoB,eAA0D;AACxI,QAAM,eAAe,SAAS,kBAAkB,OAAO,YAAY,kBAAkB,WAAW,WAAW,gBAAgB;AAC3H,QAAM,UAAU,SAAS,aAAa,OAAO,YAAY,aAAa,WAAW,WAAW,WAAW;AACvG,SAAO;AAAA,IACN;AAAA,IACA,QAAQ;AAAA,MACP,GAAI,eAAe,EAAE,eAAe,aAAA,IAAiB,CAAA;AAAA,MACrD,GAAI,SAAS,eAAe,EAAE,cAAc,SAAS,aAAA,IAAiB,CAAA;AAAA,MACtE,GAAI,UAAU,EAAE,UAAU,YAAY,CAAA;AAAA,IAAC;AAAA,IAExC,WAAW,SAAS,aAAa,IAAI,KAAK,SAAS,aAAa,GAAI,IAAI;AAAA,EAAA;AAE1E;AAEO,MAAM,eAAe,OAC3B,QACA,EAAE,aAAa,OAAO,mBACU;AAChC,QAAM,QAAQ,WAAW,MAAA;AACzB,QAAM,QAAQ,WAAW,MAAA;AACzB,QAAM,MAAM,OAAO,iBAAiB;AAAA,IACnC,cAAc;AAAA,IACd,eAAe;AAAA,IACf,OAAO,SAAS;AAAA,IAChB;AAAA,IACA;AAAA,EAAA,CACA;AAED,SAAO;AAAA,IACN,SAAS;AAAA,IACT,aAAa,EAAE,OAAO,MAAA;AAAA,EAAM;AAE9B;AAUA,MAAM,WAAW,CAAC,QAAiC,SAClD,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F;AAGA,MAAI,WAAW,SAAS;AACvB,UAAM,IAAI,mBAAmB,uCAAuC;AAAA,EACrE;AAEA,QAAM,SAAS,QAAQ;AACvB,QAAM,iBAAiB,OAAO,WAAW,YAAY,WAAW,QAAQ,4BAA6B;AACrG,MAAI,CAAC,gBAAgB;AACpB,UAAM,IAAI,mBAAmB,uDAAuD;AAAA,EACrF;AAEA,QAAM,MAAM,OAAO,QAAQ,QAAQ,WAAW,QAAQ,MAAM;AAC5D,QAAM,MAAM,OAAO,QAAQ,QAAQ,WAAW,QAAQ,MAAM;AAC5D,MAAI,CAAC,OAAO,CAAC,KAAK;AACjB,UAAM,IAAI,mBAAmB,8CAA8C;AAAA,EAC5E;AAEA,SAAO,EAAE,KAAK,IAAA;AACf;"}
1
+ {"version":3,"file":"OIDCHelpers.js","sources":["../../../../../../../../packages/engine-tenant-api/src/model/service/idp/providers/OIDCHelpers.ts"],"sourcesContent":["import { Client, custom, errors, generators, Issuer, TokenSet } from 'openid-client'\nimport { createRemoteJWKSet, jwtVerify } from 'jose'\nimport { OIDCClaimMapping, OIDCResponseData } from './OIDCTypes.js'\nimport { IDPValidationError } from '../IDPValidationError.js'\nimport { IDPResponseError } from '../IDPResponseError.js'\nimport {\n\tIDPResponse,\n\tIDPSessionState,\n\tInitIDPAuthResult,\n\tLogoutTokenClaims,\n\tLogoutUrlRequest,\n\tRevalidationResult,\n} from '../IdentityProviderHandler.js'\n\n/**\n * Build the persisted session state from an OIDC token set. Stores the tokens needed for\n * later re-validation (refresh/access) and SLO (id_token); the whole `tokens` blob is\n * encrypted at rest by the command layer.\n *\n * `prevTokens` carries the previously stored tokens forward: a refresh-grant response MAY omit\n * the refresh token (RFC 6749 §6 — IdPs that don't rotate just don't re-send it), in which case\n * the client must keep using the old one. Without this fallback a non-rotating IdP would persist\n * a session with no refresh token and be revoked (`no_refresh_token`) on the very next tick.\n */\nexport const tokenSetToSessionState = (tokenSet: TokenSet, sessionId?: string, prevTokens?: Record<string, unknown>): IDPSessionState => {\n\tconst refreshToken = tokenSet.refresh_token ?? (typeof prevTokens?.refresh_token === 'string' ? prevTokens.refresh_token : undefined)\n\tconst idToken = tokenSet.id_token ?? (typeof prevTokens?.id_token === 'string' ? prevTokens.id_token : undefined)\n\treturn {\n\t\tsessionId,\n\t\ttokens: {\n\t\t\t...(refreshToken ? { refresh_token: refreshToken } : {}),\n\t\t\t...(tokenSet.access_token ? { access_token: tokenSet.access_token } : {}),\n\t\t\t...(idToken ? { id_token: idToken } : {}),\n\t\t},\n\t\texpiresAt: tokenSet.expires_at ? new Date(tokenSet.expires_at * 1000) : undefined,\n\t}\n}\n\nexport const initOIDCAuth = async (\n\tclient: Client,\n\t{ redirectUrl, scope, responseMode }: { redirectUrl: string; scope?: string; responseMode?: string },\n): Promise<InitIDPAuthResult> => {\n\tconst nonce = generators.nonce()\n\tconst state = generators.state()\n\tconst url = client.authorizationUrl({\n\t\tredirect_uri: redirectUrl,\n\t\tresponse_mode: responseMode,\n\t\tscope: scope ?? 'openid email',\n\t\tnonce,\n\t\tstate,\n\t})\n\n\treturn {\n\t\tauthUrl: url,\n\t\tsessionData: { nonce, state },\n\t}\n}\n\nexport type HandleOIDCResponseOptions = {\n\tfetchUserInfo?: boolean\n\treturnOIDCResult?: boolean\n\tcaptureSession?: boolean\n\tclaimMapping?: OIDCClaimMapping\n}\n\n/**\n * Read a claim by name, supporting dot-paths into nested objects (`a.b.c`). Own-property only at every\n * segment (mirrors `ClaimMappingEvaluator.resolvePath`): a configured path must never descend into an\n * inherited member, so a `__proto__` / `constructor` segment cannot surface an `Object.prototype` value\n * as the externalIdentifier / email / name.\n */\nconst getClaim = (source: Record<string, unknown>, path: string): unknown =>\n\tpath.split('.').reduce<unknown>(\n\t\t(\n\t\t\tacc,\n\t\t\tkey,\n\t\t) => (acc != null && typeof acc === 'object' && Object.prototype.hasOwnProperty.call(acc, key) ? (acc as Record<string, unknown>)[key] : undefined),\n\t\tsource,\n\t)\n\n/**\n * Lift a configured nested attributes object (`attributesKey`, notably Apereo CAS's `attributes`) to the\n * top level so providers that nest their claims map without a code change. The nested attributes are\n * UNSIGNED, so they are spread UNDER `source` — a signed top-level claim keeps precedence over an\n * attributes-level value. Shared by the sign-in response handler ({@link handleOIDCResponse}) and the\n * session-refresh path ({@link revalidateOIDC}) so BOTH see the same claim surface; without this, an\n * `attributesKey` provider's A09 claim mapping would resolve at sign-in but silently not on refresh.\n */\nexport const liftNestedClaims = (source: Record<string, unknown>, attributesKey: string | undefined): Record<string, unknown> => {\n\tif (!attributesKey) {\n\t\treturn source\n\t}\n\tconst nested = Object.prototype.hasOwnProperty.call(source, attributesKey) ? source[attributesKey] : undefined\n\tif (nested !== null && typeof nested === 'object' && !Array.isArray(nested)) {\n\t\treturn { ...nested, ...source }\n\t}\n\treturn source\n}\n\ntype NormalizedClaims = Record<string, unknown> & {\n\texternalIdentifier: string\n\temail: string | undefined\n\tname: string | undefined\n\temailVerified: boolean\n}\n\n/**\n * Build the normalized claim surface shared by sign-in ({@link handleOIDCResponse}) and session refresh\n * ({@link revalidateOIDC}): lift any configured nested attributes object to the top level, then layer the\n * mapped identity fields (`externalIdentifier` / `email` / `name` / `emailVerified`) over the raw claims.\n * BOTH paths run this SAME normalization so an A09 claim-mapping rule resolves identically whether it\n * targets a raw provider claim or one of the normalized identity fields — without it the two surfaces\n * diverged (refresh saw the raw claim, sign-in the mapped value).\n *\n * `subFallback` is the signature-verified ID-token `sub`, used when a custom `externalIdentifier` mapping\n * resolves to nothing: at sign-in it is guaranteed present; on refresh it is the refreshed id-token's `sub`\n * (or, for the userinfo method, the userinfo `sub`). Throws (account-takeover guard) when the mapped\n * subject is a non-scalar or resolves empty — the refresh caller catches this and skips the sync.\n */\nconst normalizeClaims = (\n\trawSource: Record<string, unknown>,\n\tclaimMapping: OIDCClaimMapping | undefined,\n\tsubFallback: string | undefined,\n): NormalizedClaims => {\n\tconst source = liftNestedClaims(rawSource, claimMapping?.attributesKey)\n\n\t// The OIDC `email_verified` claim is a boolean per spec, but some providers send the\n\t// string \"true\". userInfo (and any unwrapped attributes) take precedence over the ID token.\n\tconst rawEmailVerified = source.email_verified\n\tconst emailVerified = rawEmailVerified === true || rawEmailVerified === 'true'\n\n\t// `externalIdentifier` is the federation key persisted in `person_identity_provider` and\n\t// matched on the next sign-in, so it must be a stable scalar. A `claimMapping` that pointed\n\t// it at an object/array would otherwise be coerced by `String(...)` to `'[object Object]'` /\n\t// a comma-join — collapsing every user of the provider onto one key (account takeover). Fail\n\t// closed instead. The default `sub` path is safe (openid-client guarantees `sub` is a string).\n\tconst mappedSubject = getClaim(source, claimMapping?.externalIdentifier ?? 'sub')\n\tlet externalIdentifier: string\n\tif (mappedSubject === undefined || mappedSubject === null) {\n\t\texternalIdentifier = subFallback ?? ''\n\t} else if (typeof mappedSubject === 'string' || typeof mappedSubject === 'number') {\n\t\texternalIdentifier = String(mappedSubject)\n\t} else {\n\t\tthrow new IDPValidationError(`The mapped externalIdentifier claim is not a scalar value`)\n\t}\n\tif (externalIdentifier === '') {\n\t\tthrow new IDPValidationError(`The mapped externalIdentifier claim resolved to an empty value`)\n\t}\n\n\t// `email` / `name` are typed `string | undefined` on IDPResponse and feed the by-e-mail\n\t// account lookup (which crashes on a non-string). `...source` already placed the raw claim\n\t// of whatever type, so OVERWRITE (don't conditionally add) with the mapped value when it is\n\t// a string, otherwise `undefined` — a non-string claim must not leak through `...source`.\n\tconst email = getClaim(source, claimMapping?.email ?? 'email')\n\tconst name = resolveName(source, claimMapping)\n\n\treturn {\n\t\t...source,\n\t\texternalIdentifier,\n\t\temail: typeof email === 'string' ? email : undefined,\n\t\tname,\n\t\temailVerified,\n\t}\n}\n\n/**\n * Resolve the display name, falling back to `given_name` + `family_name` when there is no usable\n * `name` claim.\n *\n * `name` is optional in OIDC core and plenty of providers omit it while sending the parts — Apereo\n * CAS and Entra ID do, and so does Keycloak under its default mappers. Without the fallback,\n * `CreatePersonCommand` lands on its own last-resort default and a federated person ends up named\n * after the local part of their e-mail (`jan.novak`) despite the IdP having reported \"Jan Novák\".\n * A single-path `claimMapping.name` cannot express this: the value has to be composed from two\n * claims, not selected from one.\n *\n * An explicitly configured `claimMapping.name` is honoured as-is, fallback included — mapping a\n * claim is a statement about where the name lives, and quietly substituting a different source\n * would defeat it. A blank claim counts as absent: an empty string is not a display name, and\n * treating it as one would keep the fallback (and `CreatePersonCommand`'s) from ever running.\n */\nconst resolveName = (source: Record<string, unknown>, claimMapping: OIDCClaimMapping | undefined): string | undefined => {\n\tconst mapped = getClaim(source, claimMapping?.name ?? 'name')\n\tif (typeof mapped === 'string' && mapped.trim() !== '') {\n\t\treturn mapped\n\t}\n\tif (claimMapping?.name !== undefined) {\n\t\treturn undefined\n\t}\n\tconst parts = [getClaim(source, 'given_name'), getClaim(source, 'family_name')]\n\t\t.filter((part): part is string => typeof part === 'string' && part.trim() !== '')\n\t\t.map(part => part.trim())\n\treturn parts.length > 0 ? parts.join(' ') : undefined\n}\n\nexport const handleOIDCResponse = async (\n\tclient: Client,\n\t{ sessionData, redirectUrl, ...otherData }: OIDCResponseData,\n\t{ fetchUserInfo, returnOIDCResult, captureSession, claimMapping }: HandleOIDCResponseOptions = {},\n): Promise<IDPResponse> => {\n\tconst params = 'parameters' in otherData ? otherData.parameters : client.callbackParams(otherData.url)\n\tif (params.state && !sessionData?.state) {\n\t\tthrow new IDPValidationError(`state is present in parameters, but missing in session data`)\n\t}\n\ttry {\n\t\tconst result = await client.callback(redirectUrl, params, sessionData)\n\t\tconst claims = result.claims()\n\t\tconst { at_hash, c_hash, nonce, ...claimsWithoutHashes } = claims\n\t\tconst userInfo = result.access_token && fetchUserInfo ? await client.userinfo(result) : {}\n\t\tconst oidcResult = returnOIDCResult ? result : {}\n\t\tconst idpSession = captureSession ? tokenSetToSessionState(result, typeof claims.sid === 'string' ? claims.sid : undefined) : undefined\n\n\t\t// Merge ID-token claims with userInfo (userInfo wins, per spec), then normalize the surface (lift\n\t\t// nested attributes + map the identity fields). The refresh path runs the SAME normalization, so a\n\t\t// claim mapping resolves identically at sign-in and on refresh. The default `sub` fallback is safe —\n\t\t// openid-client guarantees `sub` is a string.\n\t\tconst normalized = normalizeClaims({ ...claimsWithoutHashes, ...userInfo }, claimMapping, claims.sub)\n\n\t\treturn {\n\t\t\t...oidcResult,\n\t\t\t...normalized,\n\t\t\t...(idpSession ? { idpSession } : {}),\n\t\t}\n\t} catch (e: any) {\n\t\tif (e instanceof errors.RPError) {\n\t\t\tthrow new IDPValidationError(e.message)\n\t\t}\n\t\tif (e instanceof errors.OPError) {\n\t\t\tconst body = e.response?.body as any\n\t\t\tif (typeof body === 'object' && typeof body?.error === 'object' && typeof body.error?.message === 'string') {\n\t\t\t\tthrow new IDPResponseError(body.error.message)\n\t\t\t}\n\t\t\tthrow new IDPResponseError(e.message)\n\t\t}\n\t\tthrow e\n\t}\n}\n\n/** OIDC errors that definitively mean \"this session is no longer valid at the IdP\". */\nconst REVOKED_OIDC_ERRORS = new Set(['invalid_grant', 'invalid_token', 'expired_token'])\n\n/**\n * Re-validate a stored OIDC session against the IdP. Returns `revoked` only for definitive\n * IdP responses (invalid/expired grant or inactive introspection). Transient failures\n * (network, IdP down) re-throw so the caller can fail-open and keep the session — IdP\n * downtime must not log everyone out.\n */\nexport const revalidateOIDC = async (\n\tclient: Client,\n\tmethod: 'refresh' | 'userinfo' | 'introspection',\n\tsession: IDPSessionState,\n\toptions: { claimMapping?: OIDCClaimMapping; fetchUserInfo?: boolean } = {},\n): Promise<RevalidationResult> => {\n\tconst { claimMapping, fetchUserInfo } = options\n\tconst tokens = session.tokens ?? {}\n\tconst refreshToken = typeof tokens.refresh_token === 'string' ? tokens.refresh_token : undefined\n\tconst accessToken = typeof tokens.access_token === 'string' ? tokens.access_token : undefined\n\ttry {\n\t\tif (method === 'refresh') {\n\t\t\tif (!refreshToken) {\n\t\t\t\treturn { status: 'revoked', reason: 'no_refresh_token' }\n\t\t\t}\n\t\t\tconst tokenSet = await client.refresh(refreshToken)\n\t\t\tlet claims: Record<string, unknown> | undefined\n\t\t\tlet claimsComplete = false\n\t\t\ttry {\n\t\t\t\t// Reconstruct the SAME claim surface sign-in builds (handleOIDCResponse): the refreshed id-token\n\t\t\t\t// claims merged with userInfo when `fetchUserInfo` is set — exactly as at sign-in — then the shared\n\t\t\t\t// normalization (lift nested attributes + map identity fields). An `always` mapping therefore\n\t\t\t\t// reconciles against an identical surface on refresh, so `claimsComplete` lets the caller enable\n\t\t\t\t// `unmatched: \"remove\"` reconciliation here too (see IdpSessionRevalidator).\n\t\t\t\tif (tokenSet.id_token) {\n\t\t\t\t\tconst idClaims = tokenSet.claims()\n\t\t\t\t\tconst userInfo = tokenSet.access_token && fetchUserInfo ? await client.userinfo(tokenSet) : {}\n\t\t\t\t\tclaims = normalizeClaims({ ...idClaims, ...userInfo }, claimMapping, typeof idClaims.sub === 'string' ? idClaims.sub : undefined)\n\t\t\t\t\tclaimsComplete = true\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// Building the surface failed (userinfo unreachable, a non-scalar `externalIdentifier`, …). The IdP\n\t\t\t\t// already vouched for the session via the successful refresh, so KEEP it — just skip the claim sync\n\t\t\t\t// this tick (no claims → no grant, no removal) and retry on a later refresh. Leaving claimsComplete\n\t\t\t\t// false also guarantees a half-built surface can never drive a removal.\n\t\t\t\tclaims = undefined\n\t\t\t\tclaimsComplete = false\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tstatus: 'valid',\n\t\t\t\tclaims,\n\t\t\t\tclaimsComplete,\n\t\t\t\t// carry the stored tokens forward: a non-rotating IdP omits the refresh token here\n\t\t\t\tidpSession: tokenSetToSessionState(tokenSet, session.sessionId, tokens),\n\t\t\t}\n\t\t}\n\t\tif (method === 'userinfo') {\n\t\t\tif (!accessToken) {\n\t\t\t\treturn { status: 'revoked', reason: 'no_access_token' }\n\t\t\t}\n\t\t\tconst userInfo = await client.userinfo(accessToken)\n\t\t\tlet claims: Record<string, unknown> | undefined\n\t\t\ttry {\n\t\t\t\tclaims = normalizeClaims(userInfo, claimMapping, typeof userInfo.sub === 'string' ? userInfo.sub : undefined)\n\t\t\t} catch {\n\t\t\t\tclaims = undefined\n\t\t\t}\n\t\t\t// A userinfo probe carries no id-token claims, so its surface is NARROWER than sign-in's (id-token +\n\t\t\t// userinfo): a rule keyed on an id-token-only claim would miss here. Keep refresh-time sync additive-only\n\t\t\t// (`claimsComplete: false`) so `unmatched: \"remove\"` never strips a membership off this partial surface.\n\t\t\treturn { status: 'valid', claims, claimsComplete: false }\n\t\t}\n\t\t// introspection\n\t\tconst token = accessToken ?? refreshToken\n\t\tif (!token) {\n\t\t\treturn { status: 'revoked', reason: 'no_token' }\n\t\t}\n\t\tconst result = await client.introspect(token, accessToken ? 'access_token' : 'refresh_token')\n\t\tif (!result.active) {\n\t\t\treturn { status: 'revoked', reason: 'inactive' }\n\t\t}\n\t\treturn { status: 'valid' }\n\t} catch (e: any) {\n\t\tif (e instanceof errors.OPError) {\n\t\t\tif (typeof e.error === 'string' && REVOKED_OIDC_ERRORS.has(e.error)) {\n\t\t\t\treturn { status: 'revoked', reason: e.error }\n\t\t\t}\n\t\t\t// The userinfo endpoint signals a rejected access token with a bare HTTP 401 — per\n\t\t\t// RFC 6750 the `WWW-Authenticate` error code is optional, so openid-client may not\n\t\t\t// surface a parseable `error` here. A 401 is still definitive: the token is no\n\t\t\t// longer accepted → revoked. (Introspection is NOT treated this way: it returns 200\n\t\t\t// `{active:false}` for revoked tokens, so a 401/400 there means client-auth/config\n\t\t\t// failure — transient, must not log users out.)\n\t\t\tif (method === 'userinfo' && e.response?.statusCode === 401) {\n\t\t\t\treturn { status: 'revoked', reason: 'userinfo_unauthorized' }\n\t\t\t}\n\t\t}\n\t\t// transient (network / IdP unavailable) — propagate, do not revoke\n\t\tthrow e\n\t}\n}\n\n/**\n * Build an RP-initiated (front-channel) logout URL (OIDC RP-Initiated Logout 1.0). Returns null\n * when the IdP advertises no `end_session_endpoint` — the caller then degrades to a local-only\n * logout (legacy-IdP graceful fallback). The `id_token_hint` lets the IdP identify and confirm the\n * session to terminate; `post_logout_redirect_uri` is where the IdP returns the browser afterwards.\n */\nexport const buildOIDCLogoutUrl = (client: Client, { idToken, postLogoutRedirectUri }: LogoutUrlRequest): string | null => {\n\tif (!client.issuer.metadata.end_session_endpoint) {\n\t\treturn null\n\t}\n\treturn client.endSessionUrl({\n\t\t...(idToken ? { id_token_hint: idToken } : {}),\n\t\t...(postLogoutRedirectUri ? { post_logout_redirect_uri: postLogoutRedirectUri } : {}),\n\t})\n}\n\n/**\n * The OIDC Back-Channel Logout 1.0 event member that MUST be present in a logout token's `events`\n * claim. Its presence (and the absence of a `nonce`) is what distinguishes a logout token from an\n * ID token — both are signed by the same IdP, so without this check an ID token could be replayed\n * to forcibly log a user out.\n */\nconst BACKCHANNEL_LOGOUT_EVENT = 'http://schemas.openid.net/event/backchannel-logout'\n\n/**\n * Max accepted age of a back-channel logout token, derived from its `iat`. OIDC Back-Channel Logout\n * tokens are single-use and short-lived; bounding the age (together with requiring `exp`) limits the\n * window in which a captured token could be replayed to force a logout.\n */\nconst LOGOUT_TOKEN_MAX_AGE_SECONDS = 120\nconst LOGOUT_TOKEN_CLOCK_TOLERANCE_SECONDS = 5\n\n/**\n * Remote JWKS sets keyed by `jwks_uri`. `createRemoteJWKSet` returns a function with its own internal\n * key cache + fetch cooldown, so it MUST be reused across requests — re-creating it per call (as the\n * unauthenticated back-channel endpoint would otherwise do) defeats the cache and turns every request\n * into a potential outbound JWKS fetch. Keyed by URL, so two providers sharing an IdP share the set.\n */\nconst remoteJwksCache = new Map<string, ReturnType<typeof createRemoteJWKSet>>()\n\nconst getRemoteJwks = (jwksUri: string): ReturnType<typeof createRemoteJWKSet> => {\n\tlet jwks = remoteJwksCache.get(jwksUri)\n\tif (!jwks) {\n\t\tjwks = createRemoteJWKSet(new URL(jwksUri))\n\t\tremoteJwksCache.set(jwksUri, jwks)\n\t}\n\treturn jwks\n}\n\n/**\n * Validate an OIDC back-channel logout token (OIDC Back-Channel Logout 1.0 §2.4–2.6) and extract\n * the targeted `sid` / `sub`. The token is a JWT signed by the IdP; we verify the signature against\n * the issuer's JWKS and enforce the issuer + audience (client_id) the same way ID tokens are\n * verified, pinning the signing algorithm to the provider's configured one, then assert the\n * back-channel-specific claims:\n * - `iat` is present and recent and `exp` is present (§2.4 requires both) — bounds the replay window;\n * - `events` contains the back-channel-logout member (it really is a logout token);\n * - it carries a `sid` and/or `sub` (otherwise there is nothing to act on);\n * - it does NOT carry a `nonce` (a `nonce` means it is an ID token being replayed).\n * Throws {@link IDPValidationError} on any failure so the caller can answer 400.\n */\nexport const validateOIDCLogoutToken = async (client: Client, issuer: Issuer<Client>, logoutToken: string): Promise<LogoutTokenClaims> => {\n\tconst jwksUri = issuer.metadata.jwks_uri\n\tif (!jwksUri) {\n\t\tthrow new IDPValidationError('IdP has no jwks_uri; cannot verify logout token')\n\t}\n\tconst clientId = client.metadata.client_id\n\tif (typeof clientId !== 'string' || clientId === '') {\n\t\t// The `aud` check is a core anti-token-substitution defence on this unauthenticated endpoint.\n\t\t// jose treats `audience: undefined` as \"skip the aud check entirely\", so a missing client_id\n\t\t// must fail closed (reject the token) rather than fall through and accept any audience.\n\t\tthrow new IDPValidationError('cannot verify logout token audience: client_id is missing')\n\t}\n\tconst expectedAlg = typeof client.metadata.id_token_signed_response_alg === 'string'\n\t\t? client.metadata.id_token_signed_response_alg\n\t\t: 'RS256'\n\tconst jwks = getRemoteJwks(jwksUri)\n\tlet payload: Record<string, unknown>\n\ttry {\n\t\tconst verified = await jwtVerify(logoutToken, jwks, {\n\t\t\tissuer: issuer.metadata.issuer,\n\t\t\taudience: clientId,\n\t\t\t// pin to the provider's configured signing alg so a JWKS containing a symmetric/none key\n\t\t\t// can never be selected (defence-in-depth on top of jose's own key-type check).\n\t\t\talgorithms: [expectedAlg],\n\t\t\t// §2.4: `iat` and `exp` are REQUIRED. `maxTokenAge` makes `iat` required + bounds freshness;\n\t\t\t// `requiredClaims` makes `exp` required (jose only checks `exp` when present).\n\t\t\tmaxTokenAge: LOGOUT_TOKEN_MAX_AGE_SECONDS,\n\t\t\trequiredClaims: ['exp'],\n\t\t\tclockTolerance: LOGOUT_TOKEN_CLOCK_TOLERANCE_SECONDS,\n\t\t})\n\t\tpayload = verified.payload as Record<string, unknown>\n\t} catch (e: any) {\n\t\tthrow new IDPValidationError(`Invalid logout token: ${e?.message ?? 'verification failed'}`)\n\t}\n\n\t// A logout token MUST NOT contain a nonce; its presence means an ID token is being replayed.\n\tif ('nonce' in payload) {\n\t\tthrow new IDPValidationError('Logout token must not contain a nonce')\n\t}\n\n\tconst events = payload.events\n\tconst hasLogoutEvent = typeof events === 'object' && events !== null && BACKCHANNEL_LOGOUT_EVENT in (events as Record<string, unknown>)\n\tif (!hasLogoutEvent) {\n\t\tthrow new IDPValidationError('Logout token is missing the back-channel-logout event')\n\t}\n\n\tconst sid = typeof payload.sid === 'string' ? payload.sid : undefined\n\tconst sub = typeof payload.sub === 'string' ? payload.sub : undefined\n\tif (!sid && !sub) {\n\t\tthrow new IDPValidationError('Logout token must contain a sid or sub claim')\n\t}\n\n\treturn { sid, sub }\n}\n"],"names":[],"mappings":";;;;AAwBO,MAAM,yBAAyB,CAAC,UAAoB,WAAoB,eAA0D;AACxI,QAAM,eAAe,SAAS,kBAAkB,OAAO,YAAY,kBAAkB,WAAW,WAAW,gBAAgB;AAC3H,QAAM,UAAU,SAAS,aAAa,OAAO,YAAY,aAAa,WAAW,WAAW,WAAW;AACvG,SAAO;AAAA,IACN;AAAA,IACA,QAAQ;AAAA,MACP,GAAI,eAAe,EAAE,eAAe,aAAA,IAAiB,CAAA;AAAA,MACrD,GAAI,SAAS,eAAe,EAAE,cAAc,SAAS,aAAA,IAAiB,CAAA;AAAA,MACtE,GAAI,UAAU,EAAE,UAAU,YAAY,CAAA;AAAA,IAAC;AAAA,IAExC,WAAW,SAAS,aAAa,IAAI,KAAK,SAAS,aAAa,GAAI,IAAI;AAAA,EAAA;AAE1E;AAEO,MAAM,eA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AAU,aAAa,MAAM;AAAA,MACnD,QAAQ,OAAO,SAAS;AAAA,MACxB,UAAU;AAAA;AAAA;AAAA,MAGV,YAAY,CAAC,WAAW;AAAA;AAAA;AAAA,MAGxB,aAAa;AAAA,MACb,gBAAgB,CAAC,KAAK;AAAA,MACtB,gBAAgB;AAAA,IAAA,CAChB;AACD,cAAU,SAAS;AAAA,EACpB,SAAS,GAAQ;AAChB,UAAM,IAAI,mBAAmB,yBAAyB,GAAG,WAAW,qBAAqB,EAAE;AAAA,EAC5F;AAGA,MAAI,WAAW,SAAS;AACvB,UAAM,IAAI,mBAAmB,uCAAuC;AAAA,EACrE;AAEA,QAAM,SAAS,QAAQ;AACvB,QAAM,iBAAiB,OAAO,WAAW,YAAY,WAAW,QAAQ,4BAA6B;AACrG,MAAI,CAAC,gBAAgB;AACpB,UAAM,IAAI,mBAAmB,uDAAuD;AAAA,EACrF;AAEA,QAAM,MAAM,OAAO,QAAQ,QAAQ,WAAW,QAAQ,MAAM;AAC5D,QAAM,MAAM,OAAO,QAAQ,QAAQ,WAAW,QAAQ,MAAM;AAC5D,MAAI,CAAC,OAAO,CAAC,KAAK;AACjB,UAAM,IAAI,mBAAmB,8CAA8C;AAAA,EAC5E;AAEA,SAAO,EAAE,KAAK,IAAA;AACf;"}
@@ -40,7 +40,10 @@ class OIDCProvider {
40
40
  }
41
41
  async revalidate(configuration, session) {
42
42
  const client = await this.createOIDCClient(configuration);
43
- return await OIDCHelpers.revalidateOIDC(client, configuration.revalidation?.method ?? "refresh", session);
43
+ return await OIDCHelpers.revalidateOIDC(client, configuration.revalidation?.method ?? "refresh", session, {
44
+ claimMapping: configuration.claimMapping,
45
+ fetchUserInfo: configuration.fetchUserInfo
46
+ });
44
47
  }
45
48
  async buildLogoutUrl(configuration, request) {
46
49
  const client = await this.createOIDCClient(configuration);
@@ -1 +1 @@
1
- {"version":3,"file":"OIDCProvider.cjs","sources":["../../../../../../../../packages/engine-tenant-api/src/model/service/idp/providers/OIDCProvider.ts"],"sourcesContent":["import { Client, custom, Issuer } from 'openid-client'\nimport {\n\tIdentityProviderHandler,\n\tIDPResponse,\n\tIDPSessionState,\n\tInitIDPAuthResult,\n\tLogoutTokenClaims,\n\tLogoutUrlRequest,\n\tRevalidationResult,\n} from '../IdentityProviderHandler.js'\nimport { InvalidIDPConfigurationError } from '../InvalidIDPConfigurationError.js'\nimport { catchTypesafe } from './helpers.js'\nimport { OIDCConfiguration, OIDCInitData, OIDCResponseData } from './OIDCTypes.js'\nimport { buildOIDCLogoutUrl, handleOIDCResponse, initOIDCAuth, revalidateOIDC, validateOIDCLogoutToken } from './OIDCHelpers.js'\nimport { IDPValidationError } from '../IDPValidationError.js'\n\nconst DEFAULT_OIDC_TIMEOUT = 5000\nconst OFFLINE_ACCESS_SCOPE = 'offline_access'\n\nexport class OIDCProvider implements IdentityProviderHandler<OIDCConfiguration> {\n\tprivate issuerCache: Record<string, Issuer<Client>> = {}\n\n\tvalidateConfiguration = catchTypesafe(OIDCConfiguration, InvalidIDPConfigurationError)\n\n\tpublic async initAuth(configuration: OIDCConfiguration, data: unknown): Promise<InitIDPAuthResult> {\n\t\tconst initData = catchTypesafe(OIDCInitData, IDPValidationError)(data)\n\t\tconst client = await this.createOIDCClient(configuration)\n\t\treturn await initOIDCAuth(client, {\n\t\t\tscope: this.resolveScope(configuration),\n\t\t\t...initData,\n\t\t})\n\t}\n\n\tpublic async processResponse(configuration: OIDCConfiguration, data: unknown): Promise<IDPResponse> {\n\t\tconst responseData = catchTypesafe(OIDCResponseData, IDPValidationError)(data)\n\t\tconst client = await this.createOIDCClient(configuration)\n\t\treturn await handleOIDCResponse(\n\t\t\tclient,\n\t\t\tresponseData,\n\t\t\t{\n\t\t\t\tfetchUserInfo: configuration.fetchUserInfo,\n\t\t\t\treturnOIDCResult: configuration.returnOIDCResult,\n\t\t\t\tcaptureSession: configuration.revalidation?.enabled === true,\n\t\t\t\tclaimMapping: configuration.claimMapping,\n\t\t\t},\n\t\t)\n\t}\n\n\tpublic async revalidate(configuration: OIDCConfiguration, session: IDPSessionState): Promise<RevalidationResult> {\n\t\tconst client = await this.createOIDCClient(configuration)\n\t\treturn await revalidateOIDC(client, configuration.revalidation?.method ?? 'refresh', session)\n\t}\n\n\tpublic async buildLogoutUrl(configuration: OIDCConfiguration, request: LogoutUrlRequest): Promise<string | null> {\n\t\tconst client = await this.createOIDCClient(configuration)\n\t\treturn buildOIDCLogoutUrl(client, request)\n\t}\n\n\tpublic async validateLogoutToken(configuration: OIDCConfiguration, logoutToken: string): Promise<LogoutTokenClaims> {\n\t\tconst client = await this.createOIDCClient(configuration)\n\t\treturn await validateOIDCLogoutToken(client, client.issuer, logoutToken)\n\t}\n\n\t/**\n\t * Resolve the requested scope, appending `offline_access` when refresh-token\n\t * re-validation is enabled (so the IdP issues a refresh token to revalidate against).\n\t */\n\tprivate resolveScope(configuration: OIDCConfiguration): string {\n\t\tconst baseScope = configuration.scope ?? configuration.claims ?? 'openid email'\n\t\tconst needsOfflineAccess = configuration.revalidation?.enabled === true\n\t\t\t&& (configuration.revalidation.method ?? 'refresh') === 'refresh'\n\t\tif (needsOfflineAccess && !baseScope.split(/\\s+/).includes(OFFLINE_ACCESS_SCOPE)) {\n\t\t\treturn `${baseScope} ${OFFLINE_ACCESS_SCOPE}`\n\t\t}\n\t\treturn baseScope\n\t}\n\n\tgetPublicConfiguration({ clientSecret, ...config }: OIDCConfiguration): Partial<OIDCConfiguration> {\n\t\treturn config\n\t}\n\n\tprivate async createOIDCClient(configuration: OIDCConfiguration): Promise<Client> {\n\t\tthis.issuerCache[configuration.url] ??= await Issuer.discover(configuration.url)\n\n\t\tconst client = new this.issuerCache[configuration.url].Client(\n\t\t\t{\n\t\t\t\tclient_id: configuration.clientId,\n\t\t\t\tclient_secret: configuration.clientSecret,\n\t\t\t\tresponse_types: [configuration.responseType || 'code'],\n\t\t\t\tid_token_signed_response_alg: configuration.idTokenSignedResponseAlg ?? 'RS256',\n\t\t\t\t...(configuration.tokenEndpointAuthMethod ? { token_endpoint_auth_method: configuration.tokenEndpointAuthMethod } : {}),\n\t\t\t},\n\t\t\tundefined,\n\t\t\t{\n\t\t\t\tadditionalAuthorizedParties: [...(configuration.additionalAuthorizedParties ?? [])],\n\t\t\t},\n\t\t)\n\n\t\tclient[custom.http_options] = () => ({ timeout: configuration.timeout ?? DEFAULT_OIDC_TIMEOUT })\n\n\t\treturn client\n\t}\n}\n"],"names":["catchTypesafe","OIDCConfiguration","InvalidIDPConfigurationError","OIDCInitData","IDPValidationError","initOIDCAuth","OIDCResponseData","handleOIDCResponse","revalidateOIDC","buildOIDCLogoutUrl","validateOIDCLogoutToken","Issuer","custom"],"mappings":";;;;;;;;;;;AAgBA,MAAM,uBAAuB;AAC7B,MAAM,uBAAuB;AAEtB,MAAM,aAAmE;AAAA,EAAzE,cAAA;AACN,kBAAA,MAAQ,eAA8C,EAAC;AAEvD,kBAAA,MAAA,yBAAwBA,QAAAA,cAAcC,UAAAA,mBAAmBC,6BAAAA,4BAA4B,CAAA;AAAA,EAAA;AAAA,EAErF,MAAa,SAAS,eAAkC,MAA2C;AAClG,UAAM,WAAWF,QAAAA,cAAcG,UAAAA,cAAcC,mBAAAA,kBAAkB,EAAE,IAAI;AACrE,UAAM,SAAS,MAAM,KAAK,iBAAiB,aAAa;AACxD,WAAO,MAAMC,YAAAA,aAAa,QAAQ;AAAA,MACjC,OAAO,KAAK,aAAa,aAAa;AAAA,MACtC,GAAG;AAAA,IAAA,CACH;AAAA,EACF;AAAA,EAEA,MAAa,gBAAgB,eAAkC,MAAqC;AACnG,UAAM,eAAeL,QAAAA,cAAcM,UAAAA,kBAAkBF,mBAAAA,kBAAkB,EAAE,IAAI;AAC7E,UAAM,SAAS,MAAM,KAAK,iBAAiB,aAAa;AACxD,WAAO,MAAMG,YAAAA;AAAAA,MACZ;AAAA,MACA;AAAA,MACA;AAAA,QACC,eAAe,cAAc;AAAA,QAC7B,kBAAkB,cAAc;AAAA,QAChC,gBAAgB,cAAc,cAAc,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,QACrD,8BAA8B,cAAc,4BAA4B;AAAA,QACxE,GAAI,cAAc,0BAA0B,EAAE,4BAA4B,cAAc,wBAAA,IAA4B,CAAA;AAAA,MAAC;AAAA,MAEtH;AAAA,MACA;AAAA,QACC,6BAA6B,CAAC,GAAI,cAAc,+BAA+B,CAAA,CAAG;AAAA,MAAA;AAAA,IACnF;AAGD,WAAOC,aAAAA,OAAO,YAAY,IAAI,OAAO,EAAE,SAAS,cAAc,WAAW;AAEzE,WAAO;AAAA,EACR;AACD;;"}
1
+ {"version":3,"file":"OIDCProvider.cjs","sources":["../../../../../../../../packages/engine-tenant-api/src/model/service/idp/providers/OIDCProvider.ts"],"sourcesContent":["import { Client, custom, Issuer } from 'openid-client'\nimport {\n\tIdentityProviderHandler,\n\tIDPResponse,\n\tIDPSessionState,\n\tInitIDPAuthResult,\n\tLogoutTokenClaims,\n\tLogoutUrlRequest,\n\tRevalidationResult,\n} from '../IdentityProviderHandler.js'\nimport { InvalidIDPConfigurationError } from '../InvalidIDPConfigurationError.js'\nimport { catchTypesafe } from './helpers.js'\nimport { OIDCConfiguration, OIDCInitData, OIDCResponseData } from './OIDCTypes.js'\nimport { buildOIDCLogoutUrl, handleOIDCResponse, initOIDCAuth, revalidateOIDC, validateOIDCLogoutToken } from './OIDCHelpers.js'\nimport { IDPValidationError } from '../IDPValidationError.js'\n\nconst DEFAULT_OIDC_TIMEOUT = 5000\nconst OFFLINE_ACCESS_SCOPE = 'offline_access'\n\nexport class OIDCProvider implements IdentityProviderHandler<OIDCConfiguration> {\n\tprivate issuerCache: Record<string, Issuer<Client>> = {}\n\n\tvalidateConfiguration = catchTypesafe(OIDCConfiguration, InvalidIDPConfigurationError)\n\n\tpublic async initAuth(configuration: OIDCConfiguration, data: unknown): Promise<InitIDPAuthResult> {\n\t\tconst initData = catchTypesafe(OIDCInitData, IDPValidationError)(data)\n\t\tconst client = await this.createOIDCClient(configuration)\n\t\treturn await initOIDCAuth(client, {\n\t\t\tscope: this.resolveScope(configuration),\n\t\t\t...initData,\n\t\t})\n\t}\n\n\tpublic async processResponse(configuration: OIDCConfiguration, data: unknown): Promise<IDPResponse> {\n\t\tconst responseData = catchTypesafe(OIDCResponseData, IDPValidationError)(data)\n\t\tconst client = await this.createOIDCClient(configuration)\n\t\treturn await handleOIDCResponse(\n\t\t\tclient,\n\t\t\tresponseData,\n\t\t\t{\n\t\t\t\tfetchUserInfo: configuration.fetchUserInfo,\n\t\t\t\treturnOIDCResult: configuration.returnOIDCResult,\n\t\t\t\tcaptureSession: configuration.revalidation?.enabled === true,\n\t\t\t\tclaimMapping: configuration.claimMapping,\n\t\t\t},\n\t\t)\n\t}\n\n\tpublic async revalidate(configuration: OIDCConfiguration, session: IDPSessionState): Promise<RevalidationResult> {\n\t\tconst client = await this.createOIDCClient(configuration)\n\t\treturn await revalidateOIDC(client, configuration.revalidation?.method ?? 'refresh', session, {\n\t\t\tclaimMapping: configuration.claimMapping,\n\t\t\tfetchUserInfo: configuration.fetchUserInfo,\n\t\t})\n\t}\n\n\tpublic async buildLogoutUrl(configuration: OIDCConfiguration, request: LogoutUrlRequest): Promise<string | null> {\n\t\tconst client = await this.createOIDCClient(configuration)\n\t\treturn buildOIDCLogoutUrl(client, request)\n\t}\n\n\tpublic async validateLogoutToken(configuration: OIDCConfiguration, logoutToken: string): Promise<LogoutTokenClaims> {\n\t\tconst client = await this.createOIDCClient(configuration)\n\t\treturn await validateOIDCLogoutToken(client, client.issuer, logoutToken)\n\t}\n\n\t/**\n\t * Resolve the requested scope, appending `offline_access` when refresh-token\n\t * re-validation is enabled (so the IdP issues a refresh token to revalidate against).\n\t */\n\tprivate resolveScope(configuration: OIDCConfiguration): string {\n\t\tconst baseScope = configuration.scope ?? configuration.claims ?? 'openid email'\n\t\tconst needsOfflineAccess = configuration.revalidation?.enabled === true\n\t\t\t&& (configuration.revalidation.method ?? 'refresh') === 'refresh'\n\t\tif (needsOfflineAccess && !baseScope.split(/\\s+/).includes(OFFLINE_ACCESS_SCOPE)) {\n\t\t\treturn `${baseScope} ${OFFLINE_ACCESS_SCOPE}`\n\t\t}\n\t\treturn baseScope\n\t}\n\n\tgetPublicConfiguration({ clientSecret, ...config }: OIDCConfiguration): Partial<OIDCConfiguration> {\n\t\treturn config\n\t}\n\n\tprivate async createOIDCClient(configuration: OIDCConfiguration): Promise<Client> {\n\t\tthis.issuerCache[configuration.url] ??= await Issuer.discover(configuration.url)\n\n\t\tconst client = new this.issuerCache[configuration.url].Client(\n\t\t\t{\n\t\t\t\tclient_id: configuration.clientId,\n\t\t\t\tclient_secret: configuration.clientSecret,\n\t\t\t\tresponse_types: [configuration.responseType || 'code'],\n\t\t\t\tid_token_signed_response_alg: configuration.idTokenSignedResponseAlg ?? 'RS256',\n\t\t\t\t...(configuration.tokenEndpointAuthMethod ? { token_endpoint_auth_method: configuration.tokenEndpointAuthMethod } : {}),\n\t\t\t},\n\t\t\tundefined,\n\t\t\t{\n\t\t\t\tadditionalAuthorizedParties: [...(configuration.additionalAuthorizedParties ?? [])],\n\t\t\t},\n\t\t)\n\n\t\tclient[custom.http_options] = () => ({ timeout: configuration.timeout ?? DEFAULT_OIDC_TIMEOUT })\n\n\t\treturn client\n\t}\n}\n"],"names":["catchTypesafe","OIDCConfiguration","InvalidIDPConfigurationError","OIDCInitData","IDPValidationError","initOIDCAuth","OIDCResponseData","handleOIDCResponse","revalidateOIDC","buildOIDCLogoutUrl","validateOIDCLogoutToken","Issuer","custom"],"mappings":";;;;;;;;;;;AAgBA,MAAM,uBAAuB;AAC7B,MAAM,uBAAuB;AAEtB,MAAM,aAAmE;AAAA,EAAzE,cAAA;AACN,kBAAA,MAAQ,eAA8C,EAAC;AAEvD,kBAAA,MAAA,yBAAwBA,QAAAA,cAAcC,UAAAA,mBAAmBC,6BAAAA,4BAA4B,CAAA;AAAA,EAAA;AAAA,EAErF,MAAa,SAAS,eAAkC,MAA2C;AAClG,UAAM,WAAWF,QAAAA,cAAcG,UAAAA,cAAcC,mBAAAA,kBAAkB,EAA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a,UAAU,eAAe;AACzD,QAAI,sBAAsB,CAAC,UAAU,MAAM,KAAK,EAAE,SAAS,oBAAoB,GAAG;AACjF,aAAO,GAAG,SAAS,IAAI,oBAAoB;AAAA,IAC5C;AACA,WAAO;AAAA,EACR;AAAA,EAEA,uBAAuB,EAAE,cAAc,GAAG,UAAyD;AAClG,WAAO;AAAA,EACR;AAAA,EAEA,MAAc,iBAAiB,eAAmD;AApFnF,QAAA,IAAA;AAqFE,KAAA,KAAA,KAAK,aAAL,KAAiB,cAAc,GAAA,MAA/B,SAAwC,MAAMC,aAAAA,OAAO,SAAS,cAAc,GAAG;AAE/E,UAAM,SAAS,IAAI,KAAK,YAAY,cAAc,GAAG,EAAE;AAAA,MACtD;AAAA,QACC,WAAW,cAAc;AAAA,QACzB,eAAe,cAAc;AAAA,QAC7B,gBAAgB,CAAC,cAAc,gBAAgB,MAAM;AAAA,QACrD,8BAA8B,cAAc,4BAA4B;AAAA,QACxE,GAAI,cAAc,0BAA0B,EAAE,4BAA4B,cAAc,wBAAA,IAA4B,CAAA;AAAA,MAAC;AAAA,MAEtH;AAAA,MACA;AAAA,QACC,6BAA6B,CAAC,GAAI,cAAc,+BAA+B,CAAA,CAAG;AAAA,MAAA;AAAA,IACnF;AAGD,WAAOC,aAAAA,OAAO,YAAY,IAAI,OAAO,EAAE,SAAS,cAAc,WAAW;AAEzE,WAAO;AAAA,EACR;AACD;;"}
@@ -38,7 +38,10 @@ class OIDCProvider {
38
38
  }
39
39
  async revalidate(configuration, session) {
40
40
  const client = await this.createOIDCClient(configuration);
41
- return await revalidateOIDC(client, configuration.revalidation?.method ?? "refresh", session);
41
+ return await revalidateOIDC(client, configuration.revalidation?.method ?? "refresh", session, {
42
+ claimMapping: configuration.claimMapping,
43
+ fetchUserInfo: configuration.fetchUserInfo
44
+ });
42
45
  }
43
46
  async buildLogoutUrl(configuration, request) {
44
47
  const client = await this.createOIDCClient(configuration);
@@ -1 +1 @@
1
- {"version":3,"file":"OIDCProvider.js","sources":["../../../../../../../../packages/engine-tenant-api/src/model/service/idp/providers/OIDCProvider.ts"],"sourcesContent":["import { Client, custom, Issuer } from 'openid-client'\nimport {\n\tIdentityProviderHandler,\n\tIDPResponse,\n\tIDPSessionState,\n\tInitIDPAuthResult,\n\tLogoutTokenClaims,\n\tLogoutUrlRequest,\n\tRevalidationResult,\n} from '../IdentityProviderHandler.js'\nimport { InvalidIDPConfigurationError } from '../InvalidIDPConfigurationError.js'\nimport { catchTypesafe } from './helpers.js'\nimport { OIDCConfiguration, OIDCInitData, OIDCResponseData } from './OIDCTypes.js'\nimport { buildOIDCLogoutUrl, handleOIDCResponse, initOIDCAuth, revalidateOIDC, validateOIDCLogoutToken } from './OIDCHelpers.js'\nimport { IDPValidationError } from '../IDPValidationError.js'\n\nconst DEFAULT_OIDC_TIMEOUT = 5000\nconst OFFLINE_ACCESS_SCOPE = 'offline_access'\n\nexport class OIDCProvider implements IdentityProviderHandler<OIDCConfiguration> {\n\tprivate issuerCache: Record<string, Issuer<Client>> = {}\n\n\tvalidateConfiguration = catchTypesafe(OIDCConfiguration, InvalidIDPConfigurationError)\n\n\tpublic async initAuth(configuration: OIDCConfiguration, data: unknown): Promise<InitIDPAuthResult> {\n\t\tconst initData = catchTypesafe(OIDCInitData, IDPValidationError)(data)\n\t\tconst client = await this.createOIDCClient(configuration)\n\t\treturn await initOIDCAuth(client, {\n\t\t\tscope: this.resolveScope(configuration),\n\t\t\t...initData,\n\t\t})\n\t}\n\n\tpublic async processResponse(configuration: OIDCConfiguration, data: unknown): Promise<IDPResponse> {\n\t\tconst responseData = catchTypesafe(OIDCResponseData, IDPValidationError)(data)\n\t\tconst client = await this.createOIDCClient(configuration)\n\t\treturn await handleOIDCResponse(\n\t\t\tclient,\n\t\t\tresponseData,\n\t\t\t{\n\t\t\t\tfetchUserInfo: configuration.fetchUserInfo,\n\t\t\t\treturnOIDCResult: configuration.returnOIDCResult,\n\t\t\t\tcaptureSession: configuration.revalidation?.enabled === true,\n\t\t\t\tclaimMapping: configuration.claimMapping,\n\t\t\t},\n\t\t)\n\t}\n\n\tpublic async revalidate(configuration: OIDCConfiguration, session: IDPSessionState): Promise<RevalidationResult> {\n\t\tconst client = await this.createOIDCClient(configuration)\n\t\treturn await revalidateOIDC(client, configuration.revalidation?.method ?? 'refresh', session)\n\t}\n\n\tpublic async buildLogoutUrl(configuration: OIDCConfiguration, request: LogoutUrlRequest): Promise<string | null> {\n\t\tconst client = await this.createOIDCClient(configuration)\n\t\treturn buildOIDCLogoutUrl(client, request)\n\t}\n\n\tpublic async validateLogoutToken(configuration: OIDCConfiguration, logoutToken: string): Promise<LogoutTokenClaims> {\n\t\tconst client = await this.createOIDCClient(configuration)\n\t\treturn await validateOIDCLogoutToken(client, client.issuer, logoutToken)\n\t}\n\n\t/**\n\t * Resolve the requested scope, appending `offline_access` when refresh-token\n\t * re-validation is enabled (so the IdP issues a refresh token to revalidate against).\n\t */\n\tprivate resolveScope(configuration: OIDCConfiguration): string {\n\t\tconst baseScope = configuration.scope ?? configuration.claims ?? 'openid email'\n\t\tconst needsOfflineAccess = configuration.revalidation?.enabled === true\n\t\t\t&& (configuration.revalidation.method ?? 'refresh') === 'refresh'\n\t\tif (needsOfflineAccess && !baseScope.split(/\\s+/).includes(OFFLINE_ACCESS_SCOPE)) {\n\t\t\treturn `${baseScope} ${OFFLINE_ACCESS_SCOPE}`\n\t\t}\n\t\treturn baseScope\n\t}\n\n\tgetPublicConfiguration({ clientSecret, ...config }: OIDCConfiguration): Partial<OIDCConfiguration> {\n\t\treturn config\n\t}\n\n\tprivate async createOIDCClient(configuration: OIDCConfiguration): Promise<Client> {\n\t\tthis.issuerCache[configuration.url] ??= await Issuer.discover(configuration.url)\n\n\t\tconst client = new this.issuerCache[configuration.url].Client(\n\t\t\t{\n\t\t\t\tclient_id: configuration.clientId,\n\t\t\t\tclient_secret: configuration.clientSecret,\n\t\t\t\tresponse_types: [configuration.responseType || 'code'],\n\t\t\t\tid_token_signed_response_alg: configuration.idTokenSignedResponseAlg ?? 'RS256',\n\t\t\t\t...(configuration.tokenEndpointAuthMethod ? { token_endpoint_auth_method: configuration.tokenEndpointAuthMethod } : {}),\n\t\t\t},\n\t\t\tundefined,\n\t\t\t{\n\t\t\t\tadditionalAuthorizedParties: [...(configuration.additionalAuthorizedParties ?? [])],\n\t\t\t},\n\t\t)\n\n\t\tclient[custom.http_options] = () => ({ timeout: configuration.timeout ?? DEFAULT_OIDC_TIMEOUT })\n\n\t\treturn client\n\t}\n}\n"],"names":[],"mappings":";;;;;;;;;AAgBA,MAAM,uBAAuB;AAC7B,MAAM,uBAAuB;AAEtB,MAAM,aAAmE;AAAA,EAAzE,cAAA;AACN,kBAAA,MAAQ,eAA8C,EAAC;AAEvD,kBAAA,MAAA,yBAAwB,cAAc,mBAAmB,4BAA4B,CAAA;AAAA,EAAA;AAAA,EAErF,MAAa,SAAS,eAAkC,MAA2C;AAClG,UAAM,WAAW,cAAc,cAAc,kBAAkB,EAAE,IAAI;AACrE,UAAM,SAAS,MAAM,KAAK,iBAAiB,aAAa;AACxD,WAAO,MAAM,aAAa,QAAQ;AAAA,MACjC,OAAO,KAAK,aAAa,aAAa;AAAA,MACtC,GAAG;AAAA,IAAA,CACH;AAAA,EACF;AAAA,EAEA,MAAa,gBAAgB,eAAkC,MAAqC;AACnG,UAAM,eAAe,cAAc,kBAAkB,kBAAkB,EAAE,IAAI;AAC7E,UAAM,SAAS,MAAM,KAAK,iBAAiB,aAAa;AACxD,WAAO,MAAM;AAAA,MACZ;AAAA,MACA;AAAA,MACA;AAAA,QACC,eAAe,cAAc;AAAA,QAC7B,kBAAkB,cAAc;AAAA,QAChC,gBAAgB,cAAc,cAAc,YAAY;AAAA,QACxD,cAAc,cAAc;AAAA,MAAA;AAAA,IAC7B;AAAA,EAEF;AAAA,EAEA,MAAa,WAAW,eAAkC,SAAuD;AAChH,UAAM,SAAS,MAAM,KAAK,iBAAiB,aAAa;AACxD,WAAO,MAAM,eAAe,QAAQ,cAAc,cA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GD,WAAO,OAAO,YAAY,IAAI,OAAO,EAAE,SAAS,cAAc,WAAW;AAEzE,WAAO;AAAA,EACR;AACD;"}
1
+ {"version":3,"file":"OIDCProvider.js","sources":["../../../../../../../../packages/engine-tenant-api/src/model/service/idp/providers/OIDCProvider.ts"],"sourcesContent":["import { Client, custom, Issuer } from 'openid-client'\nimport {\n\tIdentityProviderHandler,\n\tIDPResponse,\n\tIDPSessionState,\n\tInitIDPAuthResult,\n\tLogoutTokenClaims,\n\tLogoutUrlRequest,\n\tRevalidationResult,\n} from '../IdentityProviderHandler.js'\nimport { InvalidIDPConfigurationError } from '../InvalidIDPConfigurationError.js'\nimport { catchTypesafe } from './helpers.js'\nimport { OIDCConfiguration, OIDCInitData, OIDCResponseData } from './OIDCTypes.js'\nimport { buildOIDCLogoutUrl, handleOIDCResponse, initOIDCAuth, revalidateOIDC, validateOIDCLogoutToken } from './OIDCHelpers.js'\nimport { IDPValidationError } from '../IDPValidationError.js'\n\nconst DEFAULT_OIDC_TIMEOUT = 5000\nconst OFFLINE_ACCESS_SCOPE = 'offline_access'\n\nexport class OIDCProvider implements IdentityProviderHandler<OIDCConfiguration> {\n\tprivate issuerCache: Record<string, Issuer<Client>> = {}\n\n\tvalidateConfiguration = catchTypesafe(OIDCConfiguration, InvalidIDPConfigurationError)\n\n\tpublic async initAuth(configuration: OIDCConfiguration, data: unknown): Promise<InitIDPAuthResult> {\n\t\tconst initData = catchTypesafe(OIDCInitData, IDPValidationError)(data)\n\t\tconst client = await this.createOIDCClient(configuration)\n\t\treturn await initOIDCAuth(client, {\n\t\t\tscope: this.resolveScope(configuration),\n\t\t\t...initData,\n\t\t})\n\t}\n\n\tpublic async processResponse(configuration: OIDCConfiguration, data: unknown): Promise<IDPResponse> {\n\t\tconst responseData = catchTypesafe(OIDCResponseData, IDPValidationError)(data)\n\t\tconst client = await this.createOIDCClient(configuration)\n\t\treturn await handleOIDCResponse(\n\t\t\tclient,\n\t\t\tresponseData,\n\t\t\t{\n\t\t\t\tfetchUserInfo: configuration.fetchUserInfo,\n\t\t\t\treturnOIDCResult: configuration.returnOIDCResult,\n\t\t\t\tcaptureSession: configuration.revalidation?.enabled === true,\n\t\t\t\tclaimMapping: configuration.claimMapping,\n\t\t\t},\n\t\t)\n\t}\n\n\tpublic async revalidate(configuration: OIDCConfiguration, session: IDPSessionState): Promise<RevalidationResult> {\n\t\tconst client = await this.createOIDCClient(configuration)\n\t\treturn await revalidateOIDC(client, configuration.revalidation?.method ?? 'refresh', session, {\n\t\t\tclaimMapping: configuration.claimMapping,\n\t\t\tfetchUserInfo: configuration.fetchUserInfo,\n\t\t})\n\t}\n\n\tpublic async buildLogoutUrl(configuration: OIDCConfiguration, request: LogoutUrlRequest): Promise<string | null> {\n\t\tconst client = await this.createOIDCClient(configuration)\n\t\treturn buildOIDCLogoutUrl(client, request)\n\t}\n\n\tpublic async validateLogoutToken(configuration: OIDCConfiguration, logoutToken: string): Promise<LogoutTokenClaims> {\n\t\tconst client = await this.createOIDCClient(configuration)\n\t\treturn await validateOIDCLogoutToken(client, client.issuer, logoutToken)\n\t}\n\n\t/**\n\t * Resolve the requested scope, appending `offline_access` when refresh-token\n\t * re-validation is enabled (so the IdP issues a refresh token to revalidate against).\n\t */\n\tprivate resolveScope(configuration: OIDCConfiguration): string {\n\t\tconst baseScope = configuration.scope ?? configuration.claims ?? 'openid email'\n\t\tconst needsOfflineAccess = configuration.revalidation?.enabled === true\n\t\t\t&& (configuration.revalidation.method ?? 'refresh') === 'refresh'\n\t\tif (needsOfflineAccess && !baseScope.split(/\\s+/).includes(OFFLINE_ACCESS_SCOPE)) {\n\t\t\treturn `${baseScope} ${OFFLINE_ACCESS_SCOPE}`\n\t\t}\n\t\treturn baseScope\n\t}\n\n\tgetPublicConfiguration({ clientSecret, ...config }: OIDCConfiguration): Partial<OIDCConfiguration> {\n\t\treturn config\n\t}\n\n\tprivate async createOIDCClient(configuration: OIDCConfiguration): Promise<Client> {\n\t\tthis.issuerCache[configuration.url] ??= await Issuer.discover(configuration.url)\n\n\t\tconst client = new this.issuerCache[configuration.url].Client(\n\t\t\t{\n\t\t\t\tclient_id: configuration.clientId,\n\t\t\t\tclient_secret: configuration.clientSecret,\n\t\t\t\tresponse_types: [configuration.responseType || 'code'],\n\t\t\t\tid_token_signed_response_alg: configuration.idTokenSignedResponseAlg ?? 'RS256',\n\t\t\t\t...(configuration.tokenEndpointAuthMethod ? { token_endpoint_auth_method: configuration.tokenEndpointAuthMethod } : {}),\n\t\t\t},\n\t\t\tundefined,\n\t\t\t{\n\t\t\t\tadditionalAuthorizedParties: [...(configuration.additionalAuthorizedParties ?? [])],\n\t\t\t},\n\t\t)\n\n\t\tclient[custom.http_options] = () => ({ timeout: configuration.timeout ?? DEFAULT_OIDC_TIMEOUT })\n\n\t\treturn client\n\t}\n}\n"],"names":[],"mappings":";;;;;;;;;AAgBA,MAAM,uBAAuB;AAC7B,MAAM,uBAAuB;AAEtB,MAAM,aAAmE;AAAA,EAAzE,cAAA;AACN,kBAAA,MAAQ,eAA8C,EAAC;AAEvD,kBAAA,MAAA,yBAAwB,cAAc,mBAAmB,4BAA4B,CAAA;AAAA,EAAA;AAAA,EAErF,MAAa,SAAS,eAAkC,MAA2C;AAClG,UAAM,WAAW,cAAc,cAAc,kBAAkB,EAAE,IAAI;AACrE,UAAM,SAAS,MAAM,KAAK,iBAAiB,aAAa;AACxD,WAAO,MAAM,aAAa,QAAQ;AAAA,MACjC,OAAO,KAAK,aAAa,aAAa;AAAA,MACtC,GAAG;AAAA,IAAA,CACH;AAAA,EACF;AAAA,EAEA,MAAa,gBAAgB,eAAkC,MAAqC;AACnG,UAAM,eAAe,cAAc,kBAAkB,kBAAkB,EAAE,IAAI;AAC7E,UAAM,SAAS,MAAM,KAAK,iBAAiB,aAAa;AACxD,WAAO,MAAM;AAAA,MACZ;AAAA,MACA;AAAA,MACA;AAAA,QACC,eAAe,cAAc;AAAA,QAC7B,kBAAkB,cAAc;AAAA,QAChC,gBAAgB,cAAc,c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AAgB,CAAC,cAAc,gBAAgB,MAAM;AAAA,QACrD,8BAA8B,cAAc,4BAA4B;AAAA,QACxE,GAAI,cAAc,0BAA0B,EAAE,4BAA4B,cAAc,wBAAA,IAA4B,CAAA;AAAA,MAAC;AAAA,MAEtH;AAAA,MACA;AAAA,QACC,6BAA6B,CAAC,GAAI,cAAc,+BAA+B,CAAA,CAAG;AAAA,MAAA;AAAA,IACnF;AAGD,WAAO,OAAO,YAAY,IAAI,OAAO,EAAE,SAAS,cAAc,WAAW;AAEzE,WAAO;AAAA,EACR;AACD;"}
@@ -20,11 +20,16 @@ class DatabaseContext {
20
20
  get queryHandler() {
21
21
  return this.client.createQueryHandler();
22
22
  }
23
- async transaction(cb) {
24
- return await this.client.transaction(async (db) => {
23
+ async transaction(cb, options = {}) {
24
+ const run = async () => await this.client.transaction(async (db) => {
25
25
  await db.query(Database.Connection.REPEATABLE_READ);
26
26
  return await cb(new DatabaseContext(db, this.providers));
27
27
  });
28
+ const retry = options.retry;
29
+ if (!retry) {
30
+ return await run();
31
+ }
32
+ return await Database.retryTransaction(run, (message) => retry.logger.warn(message));
28
33
  }
29
34
  async scope(cb) {
30
35
  return await this.client.scope(async (db) => {
@@ -1 +1 @@
1
- {"version":3,"file":"DatabaseContext.cjs","sources":["../../../../../../packages/engine-tenant-api/src/model/utils/DatabaseContext.ts"],"sourcesContent":["import { Client, Connection } from '@contember/database'\nimport { Providers } from '../providers.js'\nimport { CommandBus } from '../commands/index.js'\nimport { BatchLoaderArgs, initBatchLoader, ItemLoader } from '../../utils/batchQuery.js'\n\nexport class DatabaseContext<Conn extends Connection.ConnectionLike = Connection.ConnectionLike> {\n\tprivate loaders = new Map<BatchLoaderArgs<any, any, any>, ItemLoader<any, any>>()\n\n\tconstructor(\n\t\tpublic readonly client: Client<Conn>,\n\t\tpublic readonly providers: Providers,\n\t) {\n\t}\n\n\tpublic get commandBus() {\n\t\treturn new CommandBus(this.client, this.providers)\n\t}\n\n\tpublic get queryHandler() {\n\t\treturn this.client.createQueryHandler()\n\t}\n\n\tpublic async transaction<T>(cb: (dbContext: DatabaseContext<Connection.TransactionLike>) => Promise<T>): Promise<T> {\n\t\treturn await this.client.transaction(async db => {\n\t\t\tawait db.query(Connection.REPEATABLE_READ)\n\t\t\treturn await cb(new DatabaseContext(db, this.providers))\n\t\t})\n\t}\n\n\tpublic async scope<T>(cb: (dbContext: DatabaseContext<Connection.AcquiredConnectionLike>) => Promise<T>): Promise<T> {\n\t\treturn await this.client.scope(async db => {\n\t\t\treturn await cb(new DatabaseContext(db, this.providers))\n\t\t})\n\t}\n\n\tpublic batchLoad<Arg, Result, Item>(loaderArgs: BatchLoaderArgs<Arg, Result, Item>, arg: Arg): Promise<Item> {\n\t\tconst existing = this.loaders.get(loaderArgs)\n\t\tif (existing) {\n\t\t\treturn existing(arg)\n\t\t}\n\t\tconst newLoader = initBatchLoader(loaderArgs, this)\n\t\tthis.loaders.set(loaderArgs, newLoader)\n\t\treturn newLoader(arg)\n\t}\n}\n"],"names":["CommandBus","Connection","initBatchLoader"],"mappings":";;;;;;;;;;AAKO,MAAM,gBAAoF;AAAA,EAGhG,YACiB,QACA,WACf;AAFe,SAAA,SAAA;AACA,SAAA,YAAA;AAJjB,kBAAA,MAAQ,+BAAc,IAAA,CAA0D;AAAA,EAMhF;AAAA,EAEA,IAAW,aAAa;AACvB,WAAO,IAAIA,WAAAA,WAAW,KAAK,QAAQ,KAAK,SAAS;AAAA,EAClD;AAAA,EAEA,IAAW,eAAe;AACzB,WAAO,KAAK,OAAO,mBAAA;AAAA,EACpB;AAAA,EAEA,MAAa,YAAe,IAAwF;AACnH,WAAO,MAAM,KAAK,OAAO,YAAY,OAAM,OAAM;AAChD,YAAM,GAAG,MAAMC,SAAAA,WAAW,eAAe;AACzC,aAAO,MAAM,GAAG,IAAI,gBAAgB,IAAI,KAAK,SAAS,CAAC;AAAA,IACxD,CAAC;AAAA,EACF;AAAA,EAEA,MAAa,MAAS,IAA+F;AACpH,WAAO,MAAM,KAAK,OAAO,MAAM,OAAM,OAAM;AAC1C,aAAO,MAAM,GAAG,IAAI,gBAAgB,IAAI,KAAK,SAAS,CAAC;AAAA,IACxD,CAAC;AAAA,EACF;AAAA,EAEO,UAA6B,YAAgD,KAAyB;AAC5G,UAAM,WAAW,KAAK,QAAQ,IAAI,UAAU;AAC5C,QAAI,UAAU;AACb,aAAO,SAAS,GAAG;AAAA,IACpB;AACA,UAAM,YAAYC,WAAAA,gBAAgB,YAAY,IAAI;AAClD,SAAK,QAAQ,IAAI,YAAY,SAAS;AACtC,WAAO,UAAU,GAAG;AAAA,EACrB;AACD;;"}
1
+ {"version":3,"file":"DatabaseContext.cjs","sources":["../../../../../../packages/engine-tenant-api/src/model/utils/DatabaseContext.ts"],"sourcesContent":["import { Client, Connection, retryTransaction } from '@contember/database'\nimport { Logger } from '@contember/logger'\nimport { Providers } from '../providers.js'\nimport { CommandBus } from '../commands/index.js'\nimport { BatchLoaderArgs, initBatchLoader, ItemLoader } from '../../utils/batchQuery.js'\n\nexport interface TransactionOptions {\n\t/**\n\t * Repeat the transaction when postgres aborts it with a serialization failure (40001) — the standing cost of the\n\t * repeatable-read level every transaction here runs at.\n\t *\n\t * Opt in only when the callback has no effect outside the transaction: several managers send a mail from inside\n\t * one (InviteManager, EmailChangeManager, PasswordlessSignInManager) and a retry would send it twice.\n\t */\n\tretry?: { logger: Logger }\n}\n\nexport class DatabaseContext<Conn extends Connection.ConnectionLike = Connection.ConnectionLike> {\n\tprivate loaders = new Map<BatchLoaderArgs<any, any, any>, ItemLoader<any, any>>()\n\n\tconstructor(\n\t\tpublic readonly client: Client<Conn>,\n\t\tpublic readonly providers: Providers,\n\t) {\n\t}\n\n\tpublic get commandBus() {\n\t\treturn new CommandBus(this.client, this.providers)\n\t}\n\n\tpublic get queryHandler() {\n\t\treturn this.client.createQueryHandler()\n\t}\n\n\tpublic async transaction<T>(\n\t\tcb: (dbContext: DatabaseContext<Connection.TransactionLike>) => Promise<T>,\n\t\toptions: TransactionOptions = {},\n\t): Promise<T> {\n\t\tconst run = async () =>\n\t\t\tawait this.client.transaction(async db => {\n\t\t\t\tawait db.query(Connection.REPEATABLE_READ)\n\t\t\t\treturn await cb(new DatabaseContext(db, this.providers))\n\t\t\t})\n\t\tconst retry = options.retry\n\t\tif (!retry) {\n\t\t\treturn await run()\n\t\t}\n\t\treturn await retryTransaction(run, message => retry.logger.warn(message))\n\t}\n\n\tpublic async scope<T>(cb: (dbContext: DatabaseContext<Connection.AcquiredConnectionLike>) => Promise<T>): Promise<T> {\n\t\treturn await this.client.scope(async db => {\n\t\t\treturn await cb(new DatabaseContext(db, this.providers))\n\t\t})\n\t}\n\n\tpublic batchLoad<Arg, Result, Item>(loaderArgs: BatchLoaderArgs<Arg, Result, Item>, arg: Arg): Promise<Item> {\n\t\tconst existing = this.loaders.get(loaderArgs)\n\t\tif (existing) {\n\t\t\treturn existing(arg)\n\t\t}\n\t\tconst newLoader = initBatchLoader(loaderArgs, this)\n\t\tthis.loaders.set(loaderArgs, newLoader)\n\t\treturn newLoader(arg)\n\t}\n}\n"],"names":["CommandBus","Connection","retryTransaction","initBatchLoader"],"mappings":";;;;;;;;;;AAiBO,MAAM,gBAAoF;AAAA,EAGhG,YACiB,QACA,WACf;AAFe,SAAA,SAAA;AACA,SAAA,YAAA;AAJjB,kBAAA,MAAQ,+BAAc,IAAA,CAA0D;AAAA,EAMhF;AAAA,EAEA,IAAW,aAAa;AACvB,WAAO,IAAIA,WAAAA,WAAW,KAAK,QAAQ,KAAK,SAAS;AAAA,EAClD;AAAA,EAEA,IAAW,eAAe;AACzB,WAAO,KAAK,OAAO,mBAAA;AAAA,EACpB;AAAA,EAEA,MAAa,YACZ,IACA,UAA8B,IACjB;AACb,UAAM,MAAM,YACX,MAAM,KAAK,OAAO,YAAY,OAAM,OAAM;AACzC,YAAM,GAAG,MAAMC,SAAAA,WAAW,eAAe;AACzC,aAAO,MAAM,GAAG,IAAI,gBAAgB,IAAI,KAAK,SAAS,CAAC;AAAA,IACxD,CAAC;AACF,UAAM,QAAQ,QAAQ;AACtB,QAAI,CAAC,OAAO;AACX,aAAO,MAAM,IAAA;AAAA,IACd;AACA,WAAO,MAAMC,SAAAA,iBAAiB,KAAK,CAAA,YAAW,MAAM,OAAO,KAAK,OAAO,CAAC;AAAA,EACzE;AAAA,EAEA,MAAa,MAAS,IAA+F;AACpH,WAAO,MAAM,KAAK,OAAO,MAAM,OAAM,OAAM;AAC1C,aAAO,MAAM,GAAG,IAAI,gBAAgB,IAAI,KAAK,SAAS,CAAC;AAAA,IACxD,CAAC;AAAA,EACF;AAAA,EAEO,UAA6B,YAAgD,KAAyB;AAC5G,UAAM,WAAW,KAAK,QAAQ,IAAI,UAAU;AAC5C,QAAI,UAAU;AACb,aAAO,SAAS,GAAG;AAAA,IACpB;AACA,UAAM,YAAYC,WAAAA,gBAAgB,YAAY,IAAI;AAClD,SAAK,QAAQ,IAAI,YAAY,SAAS;AACtC,WAAO,UAAU,GAAG;AAAA,EACrB;AACD;;"}
@@ -1,4 +1,4 @@
1
- import { Connection } from "@contember/database";
1
+ import { retryTransaction, Connection } from "@contember/database";
2
2
  import "../type/ApiKey.js";
3
3
  import { initBatchLoader } from "../../utils/batchQuery.js";
4
4
  import "node:crypto";
@@ -18,11 +18,16 @@ class DatabaseContext {
18
18
  get queryHandler() {
19
19
  return this.client.createQueryHandler();
20
20
  }
21
- async transaction(cb) {
22
- return await this.client.transaction(async (db) => {
21
+ async transaction(cb, options = {}) {
22
+ const run = async () => await this.client.transaction(async (db) => {
23
23
  await db.query(Connection.REPEATABLE_READ);
24
24
  return await cb(new DatabaseContext(db, this.providers));
25
25
  });
26
+ const retry = options.retry;
27
+ if (!retry) {
28
+ return await run();
29
+ }
30
+ return await retryTransaction(run, (message) => retry.logger.warn(message));
26
31
  }
27
32
  async scope(cb) {
28
33
  return await this.client.scope(async (db) => {
@@ -1 +1 @@
1
- {"version":3,"file":"DatabaseContext.js","sources":["../../../../../../packages/engine-tenant-api/src/model/utils/DatabaseContext.ts"],"sourcesContent":["import { Client, Connection } from '@contember/database'\nimport { Providers } from '../providers.js'\nimport { CommandBus } from '../commands/index.js'\nimport { BatchLoaderArgs, initBatchLoader, ItemLoader } from '../../utils/batchQuery.js'\n\nexport class DatabaseContext<Conn extends Connection.ConnectionLike = Connection.ConnectionLike> {\n\tprivate loaders = new Map<BatchLoaderArgs<any, any, any>, ItemLoader<any, any>>()\n\n\tconstructor(\n\t\tpublic readonly client: Client<Conn>,\n\t\tpublic readonly providers: Providers,\n\t) {\n\t}\n\n\tpublic get commandBus() {\n\t\treturn new CommandBus(this.client, this.providers)\n\t}\n\n\tpublic get queryHandler() {\n\t\treturn this.client.createQueryHandler()\n\t}\n\n\tpublic async transaction<T>(cb: (dbContext: DatabaseContext<Connection.TransactionLike>) => Promise<T>): Promise<T> {\n\t\treturn await this.client.transaction(async db => {\n\t\t\tawait db.query(Connection.REPEATABLE_READ)\n\t\t\treturn await cb(new DatabaseContext(db, this.providers))\n\t\t})\n\t}\n\n\tpublic async scope<T>(cb: (dbContext: DatabaseContext<Connection.AcquiredConnectionLike>) => Promise<T>): Promise<T> {\n\t\treturn await this.client.scope(async db => {\n\t\t\treturn await cb(new DatabaseContext(db, this.providers))\n\t\t})\n\t}\n\n\tpublic batchLoad<Arg, Result, Item>(loaderArgs: BatchLoaderArgs<Arg, Result, Item>, arg: Arg): Promise<Item> {\n\t\tconst existing = this.loaders.get(loaderArgs)\n\t\tif (existing) {\n\t\t\treturn existing(arg)\n\t\t}\n\t\tconst newLoader = initBatchLoader(loaderArgs, this)\n\t\tthis.loaders.set(loaderArgs, newLoader)\n\t\treturn newLoader(arg)\n\t}\n}\n"],"names":[],"mappings":";;;;;;;;AAKO,MAAM,gBAAoF;AAAA,EAGhG,YACiB,QACA,WACf;AAFe,SAAA,SAAA;AACA,SAAA,YAAA;AAJjB,kBAAA,MAAQ,+BAAc,IAAA,CAA0D;AAAA,EAMhF;AAAA,EAEA,IAAW,aAAa;AACvB,WAAO,IAAI,WAAW,KAAK,QAAQ,KAAK,SAAS;AAAA,EAClD;AAAA,EAEA,IAAW,eAAe;AACzB,WAAO,KAAK,OAAO,mBAAA;AAAA,EACpB;AAAA,EAEA,MAAa,YAAe,IAAwF;AACnH,WAAO,MAAM,KAAK,OAAO,YAAY,OAAM,OAAM;AAChD,YAAM,GAAG,MAAM,WAAW,eAAe;AACzC,aAAO,MAAM,GAAG,IAAI,gBAAgB,IAAI,KAAK,SAAS,CAAC;AAAA,IACxD,CAAC;AAAA,EACF;AAAA,EAEA,MAAa,MAAS,IAA+F;AACpH,WAAO,MAAM,KAAK,OAAO,MAAM,OAAM,OAAM;AAC1C,aAAO,MAAM,GAAG,IAAI,gBAAgB,IAAI,KAAK,SAAS,CAAC;AAAA,IACxD,CAAC;AAAA,EACF;AAAA,EAEO,UAA6B,YAAgD,KAAyB;AAC5G,UAAM,WAAW,KAAK,QAAQ,IAAI,UAAU;AAC5C,QAAI,UAAU;AACb,aAAO,SAAS,GAAG;AAAA,IACpB;AACA,UAAM,YAAY,gBAAgB,YAAY,IAAI;AAClD,SAAK,QAAQ,IAAI,YAAY,SAAS;AACtC,WAAO,UAAU,GAAG;AAAA,EACrB;AACD;"}
1
+ {"version":3,"file":"DatabaseContext.js","sources":["../../../../../../packages/engine-tenant-api/src/model/utils/DatabaseContext.ts"],"sourcesContent":["import { Client, Connection, retryTransaction } from '@contember/database'\nimport { Logger } from '@contember/logger'\nimport { Providers } from '../providers.js'\nimport { CommandBus } from '../commands/index.js'\nimport { BatchLoaderArgs, initBatchLoader, ItemLoader } from '../../utils/batchQuery.js'\n\nexport interface TransactionOptions {\n\t/**\n\t * Repeat the transaction when postgres aborts it with a serialization failure (40001) — the standing cost of the\n\t * repeatable-read level every transaction here runs at.\n\t *\n\t * Opt in only when the callback has no effect outside the transaction: several managers send a mail from inside\n\t * one (InviteManager, EmailChangeManager, PasswordlessSignInManager) and a retry would send it twice.\n\t */\n\tretry?: { logger: Logger }\n}\n\nexport class DatabaseContext<Conn extends Connection.ConnectionLike = Connection.ConnectionLike> {\n\tprivate loaders = new Map<BatchLoaderArgs<any, any, any>, ItemLoader<any, any>>()\n\n\tconstructor(\n\t\tpublic readonly client: Client<Conn>,\n\t\tpublic readonly providers: Providers,\n\t) {\n\t}\n\n\tpublic get commandBus() {\n\t\treturn new CommandBus(this.client, this.providers)\n\t}\n\n\tpublic get queryHandler() {\n\t\treturn this.client.createQueryHandler()\n\t}\n\n\tpublic async transaction<T>(\n\t\tcb: (dbContext: DatabaseContext<Connection.TransactionLike>) => Promise<T>,\n\t\toptions: TransactionOptions = {},\n\t): Promise<T> {\n\t\tconst run = async () =>\n\t\t\tawait this.client.transaction(async db => {\n\t\t\t\tawait db.query(Connection.REPEATABLE_READ)\n\t\t\t\treturn await cb(new DatabaseContext(db, this.providers))\n\t\t\t})\n\t\tconst retry = options.retry\n\t\tif (!retry) {\n\t\t\treturn await run()\n\t\t}\n\t\treturn await retryTransaction(run, message => retry.logger.warn(message))\n\t}\n\n\tpublic async scope<T>(cb: (dbContext: DatabaseContext<Connection.AcquiredConnectionLike>) => Promise<T>): Promise<T> {\n\t\treturn await this.client.scope(async db => {\n\t\t\treturn await cb(new DatabaseContext(db, this.providers))\n\t\t})\n\t}\n\n\tpublic batchLoad<Arg, Result, Item>(loaderArgs: BatchLoaderArgs<Arg, Result, Item>, arg: Arg): Promise<Item> {\n\t\tconst existing = this.loaders.get(loaderArgs)\n\t\tif (existing) {\n\t\t\treturn existing(arg)\n\t\t}\n\t\tconst newLoader = initBatchLoader(loaderArgs, this)\n\t\tthis.loaders.set(loaderArgs, newLoader)\n\t\treturn newLoader(arg)\n\t}\n}\n"],"names":[],"mappings":";;;;;;;;AAiBO,MAAM,gBAAoF;AAAA,EAGhG,YACiB,QACA,WACf;AAFe,SAAA,SAAA;AACA,SAAA,YAAA;AAJjB,kBAAA,MAAQ,+BAAc,IAAA,CAA0D;AAAA,EAMhF;AAAA,EAEA,IAAW,aAAa;AACvB,WAAO,I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