@boxyhq/saml-jackson 1.32.0 → 1.33.1-beta.1

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 (332) hide show
  1. package/dist/controller/api.js +17 -7
  2. package/dist/controller/api.js.map +1 -1
  3. package/dist/controller/connection/oidc.js +17 -7
  4. package/dist/controller/connection/oidc.js.map +1 -1
  5. package/dist/controller/connection/saml.js +17 -7
  6. package/dist/controller/connection/saml.js.map +1 -1
  7. package/dist/controller/logout.js +17 -7
  8. package/dist/controller/logout.js.map +1 -1
  9. package/dist/controller/oauth/oidc-client.d.ts +9 -4
  10. package/dist/controller/oauth/oidc-client.js +80 -11
  11. package/dist/controller/oauth/oidc-client.js.map +1 -1
  12. package/dist/controller/oauth/oidc-issuer.d.ts +2 -0
  13. package/dist/controller/oauth/oidc-issuer.js +25 -0
  14. package/dist/controller/oauth/oidc-issuer.js.map +1 -0
  15. package/dist/controller/oauth.js +97 -46
  16. package/dist/controller/oauth.js.map +1 -1
  17. package/dist/controller/setup-link.js +17 -7
  18. package/dist/controller/setup-link.js.map +1 -1
  19. package/dist/controller/sso-handler.d.ts +10 -2
  20. package/dist/controller/sso-handler.js +34 -12
  21. package/dist/controller/sso-handler.js.map +1 -1
  22. package/dist/controller/utils.d.ts +5 -3
  23. package/dist/controller/utils.js +27 -9
  24. package/dist/controller/utils.js.map +1 -1
  25. package/dist/db/db.js +17 -7
  26. package/dist/db/db.js.map +1 -1
  27. package/dist/db/dynamoDb.js +17 -7
  28. package/dist/db/dynamoDb.js.map +1 -1
  29. package/dist/db/mem.js +17 -7
  30. package/dist/db/mem.js.map +1 -1
  31. package/dist/db/mongo.js +17 -7
  32. package/dist/db/mongo.js.map +1 -1
  33. package/dist/db/redis.js +17 -7
  34. package/dist/db/redis.js.map +1 -1
  35. package/dist/db/sql/sql.js +17 -7
  36. package/dist/db/sql/sql.js.map +1 -1
  37. package/dist/db/store.js +17 -7
  38. package/dist/db/store.js.map +1 -1
  39. package/dist/directory-sync/batch-events/queue.js +17 -7
  40. package/dist/directory-sync/batch-events/queue.js.map +1 -1
  41. package/dist/directory-sync/scim/DirectoryConfig.js +17 -7
  42. package/dist/directory-sync/scim/DirectoryConfig.js.map +1 -1
  43. package/dist/directory-sync/scim/Groups.js +17 -7
  44. package/dist/directory-sync/scim/Groups.js.map +1 -1
  45. package/dist/ee/identity-federation/idp-login.js +20 -14
  46. package/dist/ee/identity-federation/idp-login.js.map +1 -1
  47. package/dist/ee/identity-federation/sso.js +16 -11
  48. package/dist/ee/identity-federation/sso.js.map +1 -1
  49. package/dist/event/axios.d.ts +2 -1
  50. package/dist/index.js +17 -7
  51. package/dist/index.js.map +1 -1
  52. package/dist/loadConnection.js +17 -7
  53. package/dist/loadConnection.js.map +1 -1
  54. package/dist/saml/lib.js +17 -7
  55. package/dist/saml/lib.js.map +1 -1
  56. package/dist/saml/x509.js +17 -7
  57. package/dist/saml/x509.js.map +1 -1
  58. package/dist/src/controller/admin.d.ts +27 -0
  59. package/dist/src/controller/admin.js +60 -0
  60. package/dist/src/controller/admin.js.map +1 -0
  61. package/dist/src/controller/analytics.d.ts +16 -0
  62. package/dist/src/controller/analytics.js +79 -0
  63. package/dist/src/controller/analytics.js.map +1 -0
  64. package/dist/src/controller/api.d.ts +557 -0
  65. package/dist/src/controller/api.js +806 -0
  66. package/dist/src/controller/api.js.map +1 -0
  67. package/dist/src/controller/connection/oidc.d.ts +7 -0
  68. package/dist/src/controller/connection/oidc.js +181 -0
  69. package/dist/src/controller/connection/oidc.js.map +1 -0
  70. package/dist/src/controller/connection/saml.d.ts +7 -0
  71. package/dist/src/controller/connection/saml.js +250 -0
  72. package/dist/src/controller/connection/saml.js.map +1 -0
  73. package/dist/src/controller/error.d.ts +10 -0
  74. package/dist/src/controller/error.js +13 -0
  75. package/dist/src/controller/error.js.map +1 -0
  76. package/dist/src/controller/health-check.d.ts +11 -0
  77. package/dist/src/controller/health-check.js +51 -0
  78. package/dist/src/controller/health-check.js.map +1 -0
  79. package/dist/src/controller/logout.d.ts +18 -0
  80. package/dist/src/controller/logout.js +132 -0
  81. package/dist/src/controller/logout.js.map +1 -0
  82. package/dist/src/controller/oauth/allowed.d.ts +1 -0
  83. package/dist/src/controller/oauth/allowed.js +30 -0
  84. package/dist/src/controller/oauth/allowed.js.map +1 -0
  85. package/dist/src/controller/oauth/code-verifier.d.ts +1 -0
  86. package/dist/src/controller/oauth/code-verifier.js +8 -0
  87. package/dist/src/controller/oauth/code-verifier.js.map +1 -0
  88. package/dist/src/controller/oauth/oidc-client.d.ts +12 -0
  89. package/dist/src/controller/oauth/oidc-client.js +89 -0
  90. package/dist/src/controller/oauth/oidc-client.js.map +1 -0
  91. package/dist/src/controller/oauth/redirect.d.ts +1 -0
  92. package/dist/src/controller/oauth/redirect.js +13 -0
  93. package/dist/src/controller/oauth/redirect.js.map +1 -0
  94. package/dist/src/controller/oauth.d.ts +142 -0
  95. package/dist/src/controller/oauth.js +1112 -0
  96. package/dist/src/controller/oauth.js.map +1 -0
  97. package/dist/src/controller/oidc-discovery.d.ts +22 -0
  98. package/dist/src/controller/oidc-discovery.js +47 -0
  99. package/dist/src/controller/oidc-discovery.js.map +1 -0
  100. package/dist/src/controller/setup-link.d.ts +307 -0
  101. package/dist/src/controller/setup-link.js +462 -0
  102. package/dist/src/controller/setup-link.js.map +1 -0
  103. package/dist/src/controller/sp-config.d.ts +22 -0
  104. package/dist/src/controller/sp-config.js +89 -0
  105. package/dist/src/controller/sp-config.js.map +1 -0
  106. package/dist/src/controller/sso-handler.d.ts +66 -0
  107. package/dist/src/controller/sso-handler.js +306 -0
  108. package/dist/src/controller/sso-handler.js.map +1 -0
  109. package/dist/src/controller/utils.d.ts +84 -0
  110. package/dist/src/controller/utils.js +328 -0
  111. package/dist/src/controller/utils.js.map +1 -0
  112. package/dist/src/cron/lock.d.ts +18 -0
  113. package/dist/src/cron/lock.js +98 -0
  114. package/dist/src/cron/lock.js.map +1 -0
  115. package/dist/src/db/db.d.ts +5 -0
  116. package/dist/src/db/db.js +178 -0
  117. package/dist/src/db/db.js.map +1 -0
  118. package/dist/src/db/defaultDb.d.ts +2 -0
  119. package/dist/src/db/defaultDb.js +18 -0
  120. package/dist/src/db/defaultDb.js.map +1 -0
  121. package/dist/src/db/dynamoDb.d.ts +19 -0
  122. package/dist/src/db/dynamoDb.js +320 -0
  123. package/dist/src/db/dynamoDb.js.map +1 -0
  124. package/dist/src/db/encrypter.d.ts +3 -0
  125. package/dist/src/db/encrypter.js +22 -0
  126. package/dist/src/db/encrypter.js.map +1 -0
  127. package/dist/src/db/mem.d.ts +23 -0
  128. package/dist/src/db/mem.js +186 -0
  129. package/dist/src/db/mem.js.map +1 -0
  130. package/dist/src/db/mongo.d.ts +22 -0
  131. package/dist/src/db/mongo.js +177 -0
  132. package/dist/src/db/mongo.js.map +1 -0
  133. package/dist/src/db/planetscale/entity/JacksonIndex.d.ts +5 -0
  134. package/dist/src/db/planetscale/entity/JacksonIndex.js +32 -0
  135. package/dist/src/db/planetscale/entity/JacksonIndex.js.map +1 -0
  136. package/dist/src/db/planetscale/entity/JacksonStore.d.ts +9 -0
  137. package/dist/src/db/planetscale/entity/JacksonStore.js +63 -0
  138. package/dist/src/db/planetscale/entity/JacksonStore.js.map +1 -0
  139. package/dist/src/db/planetscale/entity/JacksonTTL.d.ts +4 -0
  140. package/dist/src/db/planetscale/entity/JacksonTTL.js +27 -0
  141. package/dist/src/db/planetscale/entity/JacksonTTL.js.map +1 -0
  142. package/dist/src/db/redis.d.ts +18 -0
  143. package/dist/src/db/redis.js +214 -0
  144. package/dist/src/db/redis.js.map +1 -0
  145. package/dist/src/db/sql/entity/JacksonIndex.d.ts +7 -0
  146. package/dist/src/db/sql/entity/JacksonIndex.js +39 -0
  147. package/dist/src/db/sql/entity/JacksonIndex.js.map +1 -0
  148. package/dist/src/db/sql/entity/JacksonStore.d.ts +9 -0
  149. package/dist/src/db/sql/entity/JacksonStore.js +61 -0
  150. package/dist/src/db/sql/entity/JacksonStore.js.map +1 -0
  151. package/dist/src/db/sql/entity/JacksonTTL.d.ts +4 -0
  152. package/dist/src/db/sql/entity/JacksonTTL.js +27 -0
  153. package/dist/src/db/sql/entity/JacksonTTL.js.map +1 -0
  154. package/dist/src/db/sql/mariadb/entity/JacksonIndex.d.ts +7 -0
  155. package/dist/src/db/sql/mariadb/entity/JacksonIndex.js +39 -0
  156. package/dist/src/db/sql/mariadb/entity/JacksonIndex.js.map +1 -0
  157. package/dist/src/db/sql/mariadb/entity/JacksonStore.d.ts +9 -0
  158. package/dist/src/db/sql/mariadb/entity/JacksonStore.js +63 -0
  159. package/dist/src/db/sql/mariadb/entity/JacksonStore.js.map +1 -0
  160. package/dist/src/db/sql/mariadb/entity/JacksonTTL.d.ts +4 -0
  161. package/dist/src/db/sql/mariadb/entity/JacksonTTL.js +27 -0
  162. package/dist/src/db/sql/mariadb/entity/JacksonTTL.js.map +1 -0
  163. package/dist/src/db/sql/mssql/entity/JacksonIndex.d.ts +7 -0
  164. package/dist/src/db/sql/mssql/entity/JacksonIndex.js +39 -0
  165. package/dist/src/db/sql/mssql/entity/JacksonIndex.js.map +1 -0
  166. package/dist/src/db/sql/mssql/entity/JacksonStore.d.ts +9 -0
  167. package/dist/src/db/sql/mssql/entity/JacksonStore.js +61 -0
  168. package/dist/src/db/sql/mssql/entity/JacksonStore.js.map +1 -0
  169. package/dist/src/db/sql/mssql/entity/JacksonTTL.d.ts +4 -0
  170. package/dist/src/db/sql/mssql/entity/JacksonTTL.js +27 -0
  171. package/dist/src/db/sql/mssql/entity/JacksonTTL.js.map +1 -0
  172. package/dist/src/db/sql/mssql.d.ts +1 -0
  173. package/dist/src/db/sql/mssql.js +44 -0
  174. package/dist/src/db/sql/mssql.js.map +1 -0
  175. package/dist/src/db/sql/sql.d.ts +32 -0
  176. package/dist/src/db/sql/sql.js +318 -0
  177. package/dist/src/db/sql/sql.js.map +1 -0
  178. package/dist/src/db/sql/sqlite/entity/JacksonIndex.d.ts +7 -0
  179. package/dist/src/db/sql/sqlite/entity/JacksonIndex.js +39 -0
  180. package/dist/src/db/sql/sqlite/entity/JacksonIndex.js.map +1 -0
  181. package/dist/src/db/sql/sqlite/entity/JacksonStore.d.ts +9 -0
  182. package/dist/src/db/sql/sqlite/entity/JacksonStore.js +61 -0
  183. package/dist/src/db/sql/sqlite/entity/JacksonStore.js.map +1 -0
  184. package/dist/src/db/sql/sqlite/entity/JacksonTTL.d.ts +4 -0
  185. package/dist/src/db/sql/sqlite/entity/JacksonTTL.js +27 -0
  186. package/dist/src/db/sql/sqlite/entity/JacksonTTL.js.map +1 -0
  187. package/dist/src/db/store.d.ts +5 -0
  188. package/dist/src/db/store.js +65 -0
  189. package/dist/src/db/store.js.map +1 -0
  190. package/dist/src/db/utils.d.ts +16 -0
  191. package/dist/src/db/utils.js +28 -0
  192. package/dist/src/db/utils.js.map +1 -0
  193. package/dist/src/directory-sync/batch-events/queue.d.ts +40 -0
  194. package/dist/src/directory-sync/batch-events/queue.js +225 -0
  195. package/dist/src/directory-sync/batch-events/queue.js.map +1 -0
  196. package/dist/src/directory-sync/index.d.ts +27 -0
  197. package/dist/src/directory-sync/index.js +97 -0
  198. package/dist/src/directory-sync/index.js.map +1 -0
  199. package/dist/src/directory-sync/non-scim/google/api.d.ts +36 -0
  200. package/dist/src/directory-sync/non-scim/google/api.js +143 -0
  201. package/dist/src/directory-sync/non-scim/google/api.js.map +1 -0
  202. package/dist/src/directory-sync/non-scim/google/index.d.ts +12 -0
  203. package/dist/src/directory-sync/non-scim/google/index.js +10 -0
  204. package/dist/src/directory-sync/non-scim/google/index.js.map +1 -0
  205. package/dist/src/directory-sync/non-scim/google/oauth.d.ts +27 -0
  206. package/dist/src/directory-sync/non-scim/google/oauth.js +105 -0
  207. package/dist/src/directory-sync/non-scim/google/oauth.js.map +1 -0
  208. package/dist/src/directory-sync/non-scim/index.d.ts +24 -0
  209. package/dist/src/directory-sync/non-scim/index.js +85 -0
  210. package/dist/src/directory-sync/non-scim/index.js.map +1 -0
  211. package/dist/src/directory-sync/non-scim/syncGroupMembers.d.ts +23 -0
  212. package/dist/src/directory-sync/non-scim/syncGroupMembers.js +105 -0
  213. package/dist/src/directory-sync/non-scim/syncGroupMembers.js.map +1 -0
  214. package/dist/src/directory-sync/non-scim/syncGroups.d.ts +24 -0
  215. package/dist/src/directory-sync/non-scim/syncGroups.js +120 -0
  216. package/dist/src/directory-sync/non-scim/syncGroups.js.map +1 -0
  217. package/dist/src/directory-sync/non-scim/syncUsers.d.ts +24 -0
  218. package/dist/src/directory-sync/non-scim/syncUsers.js +120 -0
  219. package/dist/src/directory-sync/non-scim/syncUsers.js.map +1 -0
  220. package/dist/src/directory-sync/non-scim/utils.d.ts +36 -0
  221. package/dist/src/directory-sync/non-scim/utils.js +109 -0
  222. package/dist/src/directory-sync/non-scim/utils.js.map +1 -0
  223. package/dist/src/directory-sync/request.d.ts +14 -0
  224. package/dist/src/directory-sync/request.js +29 -0
  225. package/dist/src/directory-sync/request.js.map +1 -0
  226. package/dist/src/directory-sync/scim/Base.d.ts +12 -0
  227. package/dist/src/directory-sync/scim/Base.js +23 -0
  228. package/dist/src/directory-sync/scim/Base.js.map +1 -0
  229. package/dist/src/directory-sync/scim/DirectoryConfig.d.ts +343 -0
  230. package/dist/src/directory-sync/scim/DirectoryConfig.js +580 -0
  231. package/dist/src/directory-sync/scim/DirectoryConfig.js.map +1 -0
  232. package/dist/src/directory-sync/scim/DirectoryGroups.d.ts +28 -0
  233. package/dist/src/directory-sync/scim/DirectoryGroups.js +252 -0
  234. package/dist/src/directory-sync/scim/DirectoryGroups.js.map +1 -0
  235. package/dist/src/directory-sync/scim/DirectoryUsers.d.ts +25 -0
  236. package/dist/src/directory-sync/scim/DirectoryUsers.js +193 -0
  237. package/dist/src/directory-sync/scim/DirectoryUsers.js.map +1 -0
  238. package/dist/src/directory-sync/scim/Groups.d.ts +166 -0
  239. package/dist/src/directory-sync/scim/Groups.js +348 -0
  240. package/dist/src/directory-sync/scim/Groups.js.map +1 -0
  241. package/dist/src/directory-sync/scim/Users.d.ts +99 -0
  242. package/dist/src/directory-sync/scim/Users.js +215 -0
  243. package/dist/src/directory-sync/scim/Users.js.map +1 -0
  244. package/dist/src/directory-sync/scim/WebhookEventsLogger.d.ts +101 -0
  245. package/dist/src/directory-sync/scim/WebhookEventsLogger.js +165 -0
  246. package/dist/src/directory-sync/scim/WebhookEventsLogger.js.map +1 -0
  247. package/dist/src/directory-sync/scim/transform.d.ts +6 -0
  248. package/dist/src/directory-sync/scim/transform.js +37 -0
  249. package/dist/src/directory-sync/scim/transform.js.map +1 -0
  250. package/dist/src/directory-sync/scim/utils.d.ts +33 -0
  251. package/dist/src/directory-sync/scim/utils.js +129 -0
  252. package/dist/src/directory-sync/scim/utils.js.map +1 -0
  253. package/dist/src/directory-sync/types.d.ts +195 -0
  254. package/dist/src/directory-sync/types.js +10 -0
  255. package/dist/src/directory-sync/types.js.map +1 -0
  256. package/dist/src/directory-sync/utils.d.ts +19 -0
  257. package/dist/src/directory-sync/utils.js +56 -0
  258. package/dist/src/directory-sync/utils.js.map +1 -0
  259. package/dist/src/ee/branding/index.d.ts +17 -0
  260. package/dist/src/ee/branding/index.js +49 -0
  261. package/dist/src/ee/branding/index.js.map +1 -0
  262. package/dist/src/ee/common/checkLicense.d.ts +3 -0
  263. package/dist/src/ee/common/checkLicense.js +23 -0
  264. package/dist/src/ee/common/checkLicense.js.map +1 -0
  265. package/dist/src/ee/identity-federation/app.d.ts +328 -0
  266. package/dist/src/ee/identity-federation/app.js +532 -0
  267. package/dist/src/ee/identity-federation/app.js.map +1 -0
  268. package/dist/src/ee/identity-federation/idp-login.d.ts +18 -0
  269. package/dist/src/ee/identity-federation/idp-login.js +98 -0
  270. package/dist/src/ee/identity-federation/idp-login.js.map +1 -0
  271. package/dist/src/ee/identity-federation/index.d.ts +15 -0
  272. package/dist/src/ee/identity-federation/index.js +43 -0
  273. package/dist/src/ee/identity-federation/index.js.map +1 -0
  274. package/dist/src/ee/identity-federation/sso.d.ts +24 -0
  275. package/dist/src/ee/identity-federation/sso.js +124 -0
  276. package/dist/src/ee/identity-federation/sso.js.map +1 -0
  277. package/dist/src/ee/identity-federation/types.d.ts +38 -0
  278. package/dist/src/ee/identity-federation/types.js +2 -0
  279. package/dist/src/ee/identity-federation/types.js.map +1 -0
  280. package/dist/src/ee/ory/ory.d.ts +18 -0
  281. package/dist/src/ee/ory/ory.js +195 -0
  282. package/dist/src/ee/ory/ory.js.map +1 -0
  283. package/dist/src/ee/product/index.d.ts +14 -0
  284. package/dist/src/ee/product/index.js +45 -0
  285. package/dist/src/ee/product/index.js.map +1 -0
  286. package/dist/src/event/axios.d.ts +2 -0
  287. package/dist/src/event/axios.js +27 -0
  288. package/dist/src/event/axios.js.map +1 -0
  289. package/dist/src/event/index.d.ts +11 -0
  290. package/dist/src/event/index.js +53 -0
  291. package/dist/src/event/index.js.map +1 -0
  292. package/dist/src/event/types.d.ts +21 -0
  293. package/dist/src/event/types.js +2 -0
  294. package/dist/src/event/types.js.map +1 -0
  295. package/dist/src/event/utils.d.ts +4 -0
  296. package/dist/src/event/utils.js +33 -0
  297. package/dist/src/event/utils.js.map +1 -0
  298. package/dist/src/event/webhook.d.ts +3 -0
  299. package/dist/src/event/webhook.js +34 -0
  300. package/dist/src/event/webhook.js.map +1 -0
  301. package/dist/src/index.d.ts +35 -0
  302. package/dist/src/index.js +161 -0
  303. package/dist/src/index.js.map +1 -0
  304. package/dist/src/loadConnection.d.ts +4 -0
  305. package/dist/src/loadConnection.js +38 -0
  306. package/dist/src/loadConnection.js.map +1 -0
  307. package/dist/src/opentelemetry/metrics.d.ts +14 -0
  308. package/dist/src/opentelemetry/metrics.js +64 -0
  309. package/dist/src/opentelemetry/metrics.js.map +1 -0
  310. package/dist/src/saml/claims.d.ts +12 -0
  311. package/dist/src/saml/claims.js +57 -0
  312. package/dist/src/saml/claims.js.map +1 -0
  313. package/dist/src/saml/lib.d.ts +8 -0
  314. package/dist/src/saml/lib.js +29 -0
  315. package/dist/src/saml/lib.js.map +1 -0
  316. package/dist/src/saml/x509.d.ts +9 -0
  317. package/dist/src/saml/x509.js +93 -0
  318. package/dist/src/saml/x509.js.map +1 -0
  319. package/dist/src/sso-traces/index.d.ts +114 -0
  320. package/dist/src/sso-traces/index.js +229 -0
  321. package/dist/src/sso-traces/index.js.map +1 -0
  322. package/dist/src/sso-traces/types.d.ts +44 -0
  323. package/dist/src/sso-traces/types.js +2 -0
  324. package/dist/src/sso-traces/types.js.map +1 -0
  325. package/dist/src/typings.d.ts +540 -0
  326. package/dist/src/typings.js +5 -0
  327. package/dist/src/typings.js.map +1 -0
  328. package/dist/typeorm.d.ts +3 -0
  329. package/dist/typeorm.js +58 -0
  330. package/dist/typeorm.js.map +1 -0
  331. package/dist/typings.d.ts +1 -1
  332. package/package.json +13 -13
@@ -0,0 +1,806 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import * as dbutils from '../db/utils';
11
+ import * as metrics from '../opentelemetry/metrics';
12
+ import { JacksonError } from './error';
13
+ import { IndexNames, appID, transformConnections, transformConnection, isConnectionActive } from './utils';
14
+ import oidcConnection from './connection/oidc';
15
+ import samlConnection from './connection/saml';
16
+ export class ConnectionAPIController {
17
+ constructor({ connectionStore, opts, eventController, oryController }) {
18
+ this.connectionStore = connectionStore;
19
+ this.opts = opts;
20
+ this.eventController = eventController;
21
+ this.oryController = oryController;
22
+ }
23
+ /**
24
+ * @swagger
25
+ * definitions:
26
+ * Connection:
27
+ * type: object
28
+ * example:
29
+ * {
30
+ * "idpMetadata": {
31
+ * "sso": {
32
+ * "postUrl": "https://dev-20901260.okta.com/app/dev-20901260_jacksonnext_1/xxxxxxxxxxxsso/saml",
33
+ * "redirectUrl": "https://dev-20901260.okta.com/app/dev-20901260_jacksonnext_1/xxxxxxxxxxxsso/saml"
34
+ * },
35
+ * "entityID": "http://www.okta.com/xxxxxxxxxxxxx",
36
+ * "thumbprint": "Eo+eUi3UM3XIMkFFtdVK3yJ5vO9f7YZdasdasdad",
37
+ * "loginType": "idp",
38
+ * "provider": "okta.com"
39
+ * },
40
+ * "defaultRedirectUrl": "https://hoppscotch.io/",
41
+ * "redirectUrl": ["https://hoppscotch.io/"],
42
+ * "tenant": "hoppscotch.io",
43
+ * "product": "API Engine",
44
+ * "name": "Hoppscotch-SP",
45
+ * "description": "SP for hoppscotch.io",
46
+ * "clientID": "Xq8AJt3yYAxmXizsCWmUBDRiVP1iTC8Y/otnvFIMitk",
47
+ * "clientSecret": "00e3e11a3426f97d8000000738300009130cd45419c5943",
48
+ * "deactivated": false
49
+ * }
50
+ * validationErrorsPost:
51
+ * description: Please provide rawMetadata or encodedRawMetadata | Please provide a defaultRedirectUrl | Please provide redirectUrl | redirectUrl is invalid | Exceeded maximum number of allowed redirect urls | defaultRedirectUrl is invalid | Please provide tenant | Please provide product | Please provide a friendly name | Description should not exceed 100 characters | Strategy: xxxx not supported | Please provide the clientId from OpenID Provider | Please provide the clientSecret from OpenID Provider | Please provide the discoveryUrl for the OpenID Provider
52
+ *
53
+ * parameters:
54
+ * nameParamPost:
55
+ * name: name
56
+ * description: Name/identifier for the connection
57
+ * type: string
58
+ * in: formData
59
+ * labelParamPost:
60
+ * name: label
61
+ * description: An internal label to identify the connection
62
+ * type: string
63
+ * in: formData
64
+ * descriptionParamPost:
65
+ * name: description
66
+ * description: A short description for the connection not more than 100 characters
67
+ * type: string
68
+ * in: formData
69
+ * encodedRawMetadataParamPost:
70
+ * name: encodedRawMetadata
71
+ * description: Base64 encoding of the XML metadata
72
+ * in: formData
73
+ * type: string
74
+ * rawMetadataParamPost:
75
+ * name: rawMetadata
76
+ * description: Raw XML metadata
77
+ * in: formData
78
+ * type: string
79
+ * metadataUrlParamPost:
80
+ * name: metadataUrl
81
+ * description: URL containing raw XML metadata
82
+ * in: formData
83
+ * type: string
84
+ * defaultRedirectUrlParamPost:
85
+ * name: defaultRedirectUrl
86
+ * description: The redirect URL to use in the IdP login flow
87
+ * in: formData
88
+ * required: true
89
+ * type: string
90
+ * redirectUrlParamPost:
91
+ * name: redirectUrl
92
+ * description: JSON encoded array containing a list of allowed redirect URLs
93
+ * in: formData
94
+ * required: true
95
+ * type: string
96
+ * tenantParamPost:
97
+ * name: tenant
98
+ * description: Tenant
99
+ * in: formData
100
+ * required: true
101
+ * type: string
102
+ * productParamPost:
103
+ * name: product
104
+ * description: Product
105
+ * in: formData
106
+ * required: true
107
+ * type: string
108
+ * oidcDiscoveryUrlPost:
109
+ * name: oidcDiscoveryUrl
110
+ * description: well-known URL where the OpenID Provider configuration is exposed
111
+ * in: formData
112
+ * type: string
113
+ * oidcMetadataPost:
114
+ * name: oidcMetadata
115
+ * description: metadata (JSON) for the OpenID Provider in the absence of discoveryUrl
116
+ * in: formData
117
+ * type: string
118
+ * oidcClientIdPost:
119
+ * name: oidcClientId
120
+ * description: clientId of the application set up on the OpenID Provider
121
+ * in: formData
122
+ * type: string
123
+ * oidcClientSecretPost:
124
+ * name: oidcClientSecret
125
+ * description: clientSecret of the application set up on the OpenID Provider
126
+ * in: formData
127
+ * type: string
128
+ * sortOrder:
129
+ * name: sortOrder
130
+ * description: Indicate the position of the connection in the IdP selection screen
131
+ * in: formData
132
+ * type: number
133
+ * required: false
134
+ * forceAuthn:
135
+ * name: forceAuthn
136
+ * description: Require a new authentication instead of reusing an existing session.
137
+ * in: formData
138
+ * type: boolean
139
+ * required: false
140
+ * /api/v1/sso:
141
+ * post:
142
+ * summary: Create SSO connection
143
+ * operationId: create-sso-connection
144
+ * tags: [Single Sign-On]
145
+ * produces:
146
+ * - application/json
147
+ * consumes:
148
+ * - application/x-www-form-urlencoded
149
+ * - application/json
150
+ * parameters:
151
+ * - $ref: '#/parameters/nameParamPost'
152
+ * - $ref: '#/parameters/labelParamPost'
153
+ * - $ref: '#/parameters/descriptionParamPost'
154
+ * - $ref: '#/parameters/encodedRawMetadataParamPost'
155
+ * - $ref: '#/parameters/rawMetadataParamPost'
156
+ * - $ref: '#/parameters/metadataUrlParamPost'
157
+ * - $ref: '#/parameters/defaultRedirectUrlParamPost'
158
+ * - $ref: '#/parameters/redirectUrlParamPost'
159
+ * - $ref: '#/parameters/tenantParamPost'
160
+ * - $ref: '#/parameters/productParamPost'
161
+ * - $ref: '#/parameters/oidcDiscoveryUrlPost'
162
+ * - $ref: '#/parameters/oidcMetadataPost'
163
+ * - $ref: '#/parameters/oidcClientIdPost'
164
+ * - $ref: '#/parameters/oidcClientSecretPost'
165
+ * - $ref: '#/parameters/sortOrder'
166
+ * - $ref: '#/parameters/forceAuthn'
167
+ * responses:
168
+ * 200:
169
+ * description: Success
170
+ * schema:
171
+ * $ref: '#/definitions/Connection'
172
+ * 400:
173
+ * $ref: '#/definitions/validationErrorsPost'
174
+ * 401:
175
+ * description: Unauthorized
176
+ */
177
+ createSAMLConnection(body) {
178
+ return __awaiter(this, void 0, void 0, function* () {
179
+ metrics.increment('createConnection');
180
+ const connection = yield samlConnection.create(body, this.connectionStore, this.oryController);
181
+ yield this.eventController.notify('sso.created', connection);
182
+ return connection;
183
+ });
184
+ }
185
+ // For backwards compatibility
186
+ config(...args) {
187
+ return __awaiter(this, void 0, void 0, function* () {
188
+ return this.createSAMLConnection(...args);
189
+ });
190
+ }
191
+ createOIDCConnection(body) {
192
+ return __awaiter(this, void 0, void 0, function* () {
193
+ metrics.increment('createConnection');
194
+ if (!this.opts.oidcPath) {
195
+ throw new JacksonError('Please set OpenID response handler path (oidcPath) on Jackson', 500);
196
+ }
197
+ const connection = yield oidcConnection.create(body, this.connectionStore, this.oryController);
198
+ yield this.eventController.notify('sso.created', connection);
199
+ return connection;
200
+ });
201
+ }
202
+ /**
203
+ * @swagger
204
+ * definitions:
205
+ * validationErrorsPatch:
206
+ * description: Please provide clientID | Please provide clientSecret | clientSecret mismatch | Tenant/Product config mismatch with IdP metadata | Description should not exceed 100 characters| redirectUrl is invalid | Exceeded maximum number of allowed redirect urls | defaultRedirectUrl is invalid | Tenant/Product config mismatch with OIDC Provider metadata
207
+ * parameters:
208
+ * clientIDParamPatch:
209
+ * name: clientID
210
+ * description: Client ID for the connection
211
+ * type: string
212
+ * in: formData
213
+ * required: true
214
+ * clientSecretParamPatch:
215
+ * name: clientSecret
216
+ * description: Client Secret for the connection
217
+ * type: string
218
+ * in: formData
219
+ * required: true
220
+ * tenantParamPatch:
221
+ * name: tenant
222
+ * description: Tenant
223
+ * in: formData
224
+ * required: true
225
+ * type: string
226
+ * productParamPatch:
227
+ * name: product
228
+ * description: Product
229
+ * in: formData
230
+ * required: true
231
+ * type: string
232
+ * nameParamPatch:
233
+ * name: name
234
+ * description: Name/identifier for the connection
235
+ * type: string
236
+ * in: formData
237
+ * labelParamPatch:
238
+ * name: label
239
+ * description: An internal label to identify the connection
240
+ * type: string
241
+ * in: formData
242
+ * descriptionParamPatch:
243
+ * name: description
244
+ * description: A short description for the connection not more than 100 characters
245
+ * type: string
246
+ * in: formData
247
+ * encodedRawMetadataParamPatch:
248
+ * name: encodedRawMetadata
249
+ * description: Base64 encoding of the XML metadata
250
+ * in: formData
251
+ * type: string
252
+ * rawMetadataParamPatch:
253
+ * name: rawMetadata
254
+ * description: Raw XML metadata
255
+ * in: formData
256
+ * type: string
257
+ * metadataUrlParamPatch:
258
+ * name: metadataUrl
259
+ * description: URL containing raw XML metadata
260
+ * in: formData
261
+ * type: string
262
+ * oidcDiscoveryUrlPatch:
263
+ * name: oidcDiscoveryUrl
264
+ * description: well-known URL where the OpenID Provider configuration is exposed
265
+ * in: formData
266
+ * type: string
267
+ * oidcMetadataPatch:
268
+ * name: oidcMetadata
269
+ * description: metadata (JSON) for the OpenID Provider in the absence of discoveryUrl
270
+ * in: formData
271
+ * type: string
272
+ * oidcClientIdPatch:
273
+ * name: oidcClientId
274
+ * description: clientId of the application set up on the OpenID Provider
275
+ * in: formData
276
+ * type: string
277
+ * oidcClientSecretPatch:
278
+ * name: oidcClientSecret
279
+ * description: clientSecret of the application set up on the OpenID Provider
280
+ * in: formData
281
+ * type: string
282
+ * defaultRedirectUrlParamPatch:
283
+ * name: defaultRedirectUrl
284
+ * description: The redirect URL to use in the IdP login flow
285
+ * in: formData
286
+ * type: string
287
+ * redirectUrlParamPatch:
288
+ * name: redirectUrl
289
+ * description: JSON encoded array containing a list of allowed redirect URLs
290
+ * in: formData
291
+ * type: string
292
+ * deactivatedParamPatch:
293
+ * name: deactivated
294
+ * description: Connection status
295
+ * in: formData
296
+ * required: false
297
+ * type: boolean
298
+ * sortOrderParamPatch:
299
+ * name: sortOrder
300
+ * description: Indicate the position of the connection in the IdP selection screen
301
+ * in: formData
302
+ * type: number
303
+ * required: false
304
+ * forceAuthnParamPatch:
305
+ * name: forceAuthn
306
+ * description: Require a new authentication instead of reusing an existing session.
307
+ * in: formData
308
+ * type: boolean
309
+ * required: false
310
+ * /api/v1/sso:
311
+ * patch:
312
+ * summary: Update SSO Connection
313
+ * operationId: update-sso-connection
314
+ * tags: [Single Sign-On]
315
+ * consumes:
316
+ * - application/json
317
+ * - application/x-www-form-urlencoded
318
+ * parameters:
319
+ * - $ref: '#/parameters/clientIDParamPatch'
320
+ * - $ref: '#/parameters/clientSecretParamPatch'
321
+ * - $ref: '#/parameters/nameParamPatch'
322
+ * - $ref: '#/parameters/labelParamPatch'
323
+ * - $ref: '#/parameters/descriptionParamPatch'
324
+ * - $ref: '#/parameters/encodedRawMetadataParamPatch'
325
+ * - $ref: '#/parameters/rawMetadataParamPatch'
326
+ * - $ref: '#/parameters/metadataUrlParamPatch'
327
+ * - $ref: '#/parameters/oidcDiscoveryUrlPatch'
328
+ * - $ref: '#/parameters/oidcMetadataPatch'
329
+ * - $ref: '#/parameters/oidcClientIdPatch'
330
+ * - $ref: '#/parameters/oidcClientSecretPatch'
331
+ * - $ref: '#/parameters/defaultRedirectUrlParamPatch'
332
+ * - $ref: '#/parameters/redirectUrlParamPatch'
333
+ * - $ref: '#/parameters/tenantParamPatch'
334
+ * - $ref: '#/parameters/productParamPatch'
335
+ * - $ref: '#/parameters/deactivatedParamPatch'
336
+ * - $ref: '#/parameters/sortOrderParamPatch'
337
+ * - $ref: '#/parameters/forceAuthnParamPatch'
338
+ * responses:
339
+ * 204:
340
+ * description: Success
341
+ * 400:
342
+ * $ref: '#/definitions/validationErrorsPatch'
343
+ * 401:
344
+ * description: Unauthorized
345
+ * 500:
346
+ * description: Please set OpenID response handler path (oidcPath) on Jackson
347
+ */
348
+ updateSAMLConnection(body) {
349
+ return __awaiter(this, void 0, void 0, function* () {
350
+ const connection = yield samlConnection.update(body, this.connectionStore, this.getConnections.bind(this), this.oryController);
351
+ if ('deactivated' in body) {
352
+ if (isConnectionActive(connection)) {
353
+ yield this.eventController.notify('sso.activated', connection);
354
+ }
355
+ else {
356
+ yield this.eventController.notify('sso.deactivated', connection);
357
+ }
358
+ }
359
+ });
360
+ }
361
+ // For backwards compatibility
362
+ updateConfig(...args) {
363
+ return __awaiter(this, void 0, void 0, function* () {
364
+ yield this.updateSAMLConnection(...args);
365
+ });
366
+ }
367
+ updateOIDCConnection(body) {
368
+ return __awaiter(this, void 0, void 0, function* () {
369
+ if (!this.opts.oidcPath) {
370
+ throw new JacksonError('Please set OpenID response handler path (oidcPath) on Jackson', 500);
371
+ }
372
+ const connection = yield oidcConnection.update(body, this.connectionStore, this.getConnections.bind(this), this.oryController);
373
+ if ('deactivated' in body) {
374
+ if (isConnectionActive(connection)) {
375
+ yield this.eventController.notify('sso.activated', connection);
376
+ }
377
+ else {
378
+ yield this.eventController.notify('sso.deactivated', connection);
379
+ }
380
+ }
381
+ });
382
+ }
383
+ getIDPEntityID(body) {
384
+ const tenant = 'tenant' in body ? body.tenant : undefined;
385
+ const product = 'product' in body ? body.product : undefined;
386
+ if (!tenant || !product) {
387
+ throw new JacksonError('Please provide `tenant` and `product`.', 400);
388
+ }
389
+ else {
390
+ return `${this.opts.samlAudience}/${appID(tenant, product)}`;
391
+ }
392
+ }
393
+ /**
394
+ * @swagger
395
+ * parameters:
396
+ * tenantParamGet:
397
+ * in: query
398
+ * name: tenant
399
+ * type: string
400
+ * description: Tenant (Optional if clientID provided)
401
+ * productParamGet:
402
+ * in: query
403
+ * name: product
404
+ * type: string
405
+ * description: Product (Optional if clientID provided)
406
+ * clientIDParamGet:
407
+ * in: query
408
+ * name: clientID
409
+ * type: string
410
+ * description: Client ID (Optional if tenant/product provided)
411
+ * strategyParamGet:
412
+ * in: query
413
+ * name: strategy
414
+ * type: string
415
+ * description: Strategy which can help to filter connections with tenant/product query
416
+ * sortParamGet:
417
+ * in: query
418
+ * name: sort
419
+ * type: string
420
+ * description: If present, the connections will be sorted by `sortOrder`. It won't consider if pagination is used.
421
+ * definitions:
422
+ * Connection:
423
+ * type: object
424
+ * properties:
425
+ * clientID:
426
+ * type: string
427
+ * description: Connection clientID
428
+ * clientSecret:
429
+ * type: string
430
+ * description: Connection clientSecret
431
+ * name:
432
+ * type: string
433
+ * description: Connection name
434
+ * label:
435
+ * type: string
436
+ * description: Connection label
437
+ * description:
438
+ * type: string
439
+ * description: Connection description
440
+ * redirectUrl:
441
+ * type: string
442
+ * description: A list of allowed redirect URLs
443
+ * defaultRedirectUrl:
444
+ * type: string
445
+ * description: The redirect URL to use in the IdP login flow
446
+ * tenant:
447
+ * type: string
448
+ * description: Connection tenant
449
+ * product:
450
+ * type: string
451
+ * description: Connection product
452
+ * idpMetadata:
453
+ * type: object
454
+ * description: SAML IdP metadata
455
+ * oidcProvider:
456
+ * type: object
457
+ * description: OIDC IdP metadata
458
+ * deactivated:
459
+ * type: boolean
460
+ * description: Connection status
461
+ * sortOrder:
462
+ * type: number
463
+ * description: Connection sort order
464
+ * responses:
465
+ * '200Get':
466
+ * description: Success
467
+ * schema:
468
+ * type: array
469
+ * items:
470
+ * $ref: '#/definitions/Connection'
471
+ * '400Get':
472
+ * description: Please provide `clientID` or `tenant` and `product`.
473
+ * '401Get':
474
+ * description: Unauthorized
475
+ * /api/v1/sso:
476
+ * get:
477
+ * summary: Get SSO Connections
478
+ * parameters:
479
+ * - $ref: '#/parameters/tenantParamGet'
480
+ * - $ref: '#/parameters/productParamGet'
481
+ * - $ref: '#/parameters/clientIDParamGet'
482
+ * - $ref: '#/parameters/strategyParamGet'
483
+ * - $ref: '#/parameters/sortParamGet'
484
+ * operationId: get-connections
485
+ * tags: [Single Sign-On]
486
+ * responses:
487
+ * '200':
488
+ * $ref: '#/responses/200Get'
489
+ * '400':
490
+ * $ref: '#/responses/400Get'
491
+ * '401':
492
+ * $ref: '#/responses/401Get'
493
+ */
494
+ getConnections(body) {
495
+ return __awaiter(this, void 0, void 0, function* () {
496
+ const clientID = 'clientID' in body ? body.clientID : undefined;
497
+ const tenant = 'tenant' in body ? body.tenant : undefined;
498
+ const product = 'product' in body ? body.product : undefined;
499
+ const strategy = 'strategy' in body ? body.strategy : undefined;
500
+ const entityId = 'entityId' in body ? body.entityId : undefined;
501
+ metrics.increment('getConnections');
502
+ let connections = null;
503
+ // Fetch connections by entityId
504
+ if (entityId) {
505
+ const result = yield this.connectionStore.getByIndex({
506
+ name: IndexNames.EntityID,
507
+ value: entityId,
508
+ });
509
+ if (!result || typeof result !== 'object') {
510
+ connections = [];
511
+ }
512
+ else {
513
+ connections = result.data;
514
+ }
515
+ }
516
+ // Fetch connections by clientID
517
+ else if (clientID) {
518
+ const result = yield this.connectionStore.get(clientID);
519
+ if (!result || typeof result !== 'object') {
520
+ connections = [];
521
+ }
522
+ else {
523
+ connections = [result];
524
+ }
525
+ }
526
+ // Fetch connections by multiple tenants
527
+ else if (tenant && product && Array.isArray(tenant)) {
528
+ const tenants = tenant.filter((t) => t).filter((t, i, a) => a.indexOf(t) === i);
529
+ const result = yield Promise.all(tenants.map((t) => __awaiter(this, void 0, void 0, function* () {
530
+ return this.connectionStore.getByIndex({
531
+ name: IndexNames.TenantProduct,
532
+ value: dbutils.keyFromParts(t, product),
533
+ });
534
+ })));
535
+ if (!result || !result.length) {
536
+ connections = [];
537
+ }
538
+ else {
539
+ connections = result.flatMap((r) => r.data);
540
+ }
541
+ }
542
+ // Fetch connections by tenant and product
543
+ else if (tenant && product && !Array.isArray(tenant)) {
544
+ const result = yield this.connectionStore.getByIndex({
545
+ name: IndexNames.TenantProduct,
546
+ value: dbutils.keyFromParts(tenant, product),
547
+ });
548
+ if (!result || !result.data.length) {
549
+ connections = [];
550
+ }
551
+ else {
552
+ connections = result.data;
553
+ }
554
+ // Filter connections by strategy
555
+ if (connections && connections.length > 0 && strategy) {
556
+ connections = connections.filter((connection) => {
557
+ if (strategy === 'saml') {
558
+ return 'idpMetadata' in connection;
559
+ }
560
+ if (strategy === 'oidc') {
561
+ return 'oidcProvider' in connection;
562
+ }
563
+ return false;
564
+ });
565
+ }
566
+ }
567
+ if (connections) {
568
+ const sort = 'sort' in body ? body.sort : false;
569
+ if (sort) {
570
+ connections.sort((a, b) => (b.sortOrder || 0) - (a.sortOrder || 0));
571
+ }
572
+ return transformConnections(connections);
573
+ }
574
+ throw new JacksonError('Please provide `clientID` or `tenant` and `product`.', 400);
575
+ });
576
+ }
577
+ getConfig(body) {
578
+ return __awaiter(this, void 0, void 0, function* () {
579
+ const clientID = 'clientID' in body ? body.clientID : undefined;
580
+ const tenant = 'tenant' in body ? body.tenant : undefined;
581
+ const product = 'product' in body ? body.product : undefined;
582
+ metrics.increment('getConnections');
583
+ if (clientID) {
584
+ const samlConfig = yield this.connectionStore.get(clientID);
585
+ return samlConfig || {};
586
+ }
587
+ if (tenant && product) {
588
+ const samlConfigs = (yield this.connectionStore.getByIndex({
589
+ name: IndexNames.TenantProduct,
590
+ value: dbutils.keyFromParts(tenant, product),
591
+ })).data;
592
+ if (!samlConfigs || !samlConfigs.length) {
593
+ return {};
594
+ }
595
+ return Object.assign({}, samlConfigs[0]);
596
+ }
597
+ throw new JacksonError('Please provide `clientID` or `tenant` and `product`.', 400);
598
+ });
599
+ }
600
+ /**
601
+ * @swagger
602
+ * parameters:
603
+ * clientIDDel:
604
+ * name: clientID
605
+ * in: query
606
+ * type: string
607
+ * description: Client ID (Optional if tenant/product provided)
608
+ * clientSecretDel:
609
+ * name: clientSecret
610
+ * in: query
611
+ * type: string
612
+ * description: Client Secret (Optional if tenant/product provided)
613
+ * tenantDel:
614
+ * name: tenant
615
+ * in: query
616
+ * type: string
617
+ * description: Tenant (Optional if clientID/Secret provided)
618
+ * productDel:
619
+ * name: product
620
+ * in: query
621
+ * type: string
622
+ * description: Product (Optional if clientID/Secret provided)
623
+ * strategyDel:
624
+ * name: strategy
625
+ * in: query
626
+ * type: string
627
+ * description: Strategy which can help to filter connections with tenant/product query
628
+ * /api/v1/sso:
629
+ * delete:
630
+ * parameters:
631
+ * - $ref: '#/parameters/clientIDDel'
632
+ * - $ref: '#/parameters/clientSecretDel'
633
+ * - $ref: '#/parameters/tenantDel'
634
+ * - $ref: '#/parameters/productDel'
635
+ * - $ref: '#/parameters/strategyDel'
636
+ * summary: Delete SSO Connections
637
+ * operationId: delete-sso-connection
638
+ * tags: [Single Sign-On]
639
+ * responses:
640
+ * '200':
641
+ * description: Success
642
+ * '400':
643
+ * description: clientSecret mismatch | Please provide `clientID` and `clientSecret` or `tenant` and `product`.
644
+ * '401':
645
+ * description: Unauthorized
646
+ */
647
+ deleteConnections(body) {
648
+ return __awaiter(this, void 0, void 0, function* () {
649
+ const clientID = 'clientID' in body ? body.clientID : undefined;
650
+ const clientSecret = 'clientSecret' in body ? body.clientSecret : undefined;
651
+ const tenant = 'tenant' in body ? body.tenant : undefined;
652
+ const product = 'product' in body ? body.product : undefined;
653
+ const strategy = 'strategy' in body ? body.strategy : undefined;
654
+ metrics.increment('deleteConnections');
655
+ if (clientID && clientSecret) {
656
+ const connection = yield this.connectionStore.get(clientID);
657
+ if (!connection) {
658
+ return;
659
+ }
660
+ if (connection.clientSecret === clientSecret) {
661
+ yield this.connectionStore.delete(clientID);
662
+ yield this.eventController.notify('sso.deleted', transformConnection(connection));
663
+ }
664
+ else {
665
+ throw new JacksonError('clientSecret mismatch', 400);
666
+ }
667
+ return;
668
+ }
669
+ if (tenant && product) {
670
+ const connections = (yield this.connectionStore.getByIndex({
671
+ name: IndexNames.TenantProduct,
672
+ value: dbutils.keyFromParts(tenant, product),
673
+ })).data;
674
+ if (!connections || !connections.length) {
675
+ return;
676
+ }
677
+ // filter if strategy is passed
678
+ const filteredConnections = strategy
679
+ ? connections.filter((connection) => {
680
+ if (strategy === 'saml') {
681
+ if (connection.idpMetadata) {
682
+ return true;
683
+ }
684
+ }
685
+ if (strategy === 'oidc') {
686
+ if (connection.oidcProvider) {
687
+ return true;
688
+ }
689
+ }
690
+ return false;
691
+ })
692
+ : connections;
693
+ for (const conf of transformConnections(filteredConnections)) {
694
+ yield this.connectionStore.delete(conf.clientID);
695
+ yield this.eventController.notify('sso.deleted', conf);
696
+ }
697
+ return;
698
+ }
699
+ throw new JacksonError('Please provide `clientID` and `clientSecret` or `tenant` and `product`.', 400);
700
+ });
701
+ }
702
+ deleteConfig(body) {
703
+ return __awaiter(this, void 0, void 0, function* () {
704
+ yield this.deleteConnections(Object.assign(Object.assign({}, body), { strategy: 'saml' }));
705
+ });
706
+ }
707
+ /**
708
+ * @swagger
709
+ * parameters:
710
+ * productParamGet:
711
+ * in: query
712
+ * name: product
713
+ * type: string
714
+ * description: Product
715
+ * required: true
716
+ * definitions:
717
+ * Connection:
718
+ * type: object
719
+ * properties:
720
+ * clientID:
721
+ * type: string
722
+ * description: Connection clientID
723
+ * clientSecret:
724
+ * type: string
725
+ * description: Connection clientSecret
726
+ * name:
727
+ * type: string
728
+ * description: Connection name
729
+ * description:
730
+ * type: string
731
+ * description: Connection description
732
+ * redirectUrl:
733
+ * type: string
734
+ * description: A list of allowed redirect URLs
735
+ * defaultRedirectUrl:
736
+ * type: string
737
+ * description: The redirect URL to use in the IdP login flow
738
+ * tenant:
739
+ * type: string
740
+ * description: Connection tenant
741
+ * product:
742
+ * type: string
743
+ * description: Connection product
744
+ * idpMetadata:
745
+ * type: object
746
+ * description: SAML IdP metadata
747
+ * oidcProvider:
748
+ * type: object
749
+ * description: OIDC IdP metadata
750
+ * responses:
751
+ * '200GetByProduct':
752
+ * description: Success
753
+ * content:
754
+ * application/json:
755
+ * schema:
756
+ * type: object
757
+ * properties:
758
+ * data:
759
+ * type: array
760
+ * items:
761
+ * $ref: '#/definitions/Connection'
762
+ * pageToken:
763
+ * type: string
764
+ * description: token for pagination
765
+ * '400Get':
766
+ * description: Please provide a `product`.
767
+ * '401Get':
768
+ * description: Unauthorized
769
+ * /api/v1/sso/product:
770
+ * get:
771
+ * summary: Get SSO Connections by product
772
+ * parameters:
773
+ * - $ref: '#/parameters/productParamGet'
774
+ * - $ref: '#/parameters/pageOffset'
775
+ * - $ref: '#/parameters/pageLimit'
776
+ * - $ref: '#/parameters/pageToken'
777
+ * operationId: get-connections-by-product
778
+ * tags: [Single Sign-On]
779
+ * responses:
780
+ * '200':
781
+ * $ref: '#/responses/200GetByProduct'
782
+ * '400':
783
+ * $ref: '#/responses/400Get'
784
+ * '401':
785
+ * $ref: '#/responses/401Get'
786
+ */
787
+ getConnectionsByProduct(body) {
788
+ return __awaiter(this, void 0, void 0, function* () {
789
+ const { product, pageOffset, pageLimit, pageToken } = body;
790
+ if (!product) {
791
+ throw new JacksonError('Please provide a `product`.', 400);
792
+ }
793
+ const connections = yield this.connectionStore.getByIndex({
794
+ name: IndexNames.Product,
795
+ value: product,
796
+ }, pageOffset, pageLimit, pageToken);
797
+ return { data: transformConnections(connections.data), pageToken };
798
+ });
799
+ }
800
+ getCount(idx) {
801
+ return __awaiter(this, void 0, void 0, function* () {
802
+ return yield this.connectionStore.getCount(idx);
803
+ });
804
+ }
805
+ }
806
+ //# sourceMappingURL=api.js.map