@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,306 @@
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
+ var __rest = (this && this.__rest) || function (s, e) {
11
+ var t = {};
12
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
13
+ t[p] = s[p];
14
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
15
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
16
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
17
+ t[p[i]] = s[p[i]];
18
+ }
19
+ return t;
20
+ };
21
+ import saml from '@boxyhq/saml20';
22
+ import crypto from 'crypto';
23
+ import { promisify } from 'util';
24
+ import { deflateRaw } from 'zlib';
25
+ import { getDefaultCertificate } from '../saml/x509';
26
+ import * as dbutils from '../db/utils';
27
+ import { JacksonError } from './error';
28
+ import { IndexNames } from './utils';
29
+ import { relayStatePrefix } from './utils';
30
+ import * as redirect from './oauth/redirect';
31
+ import * as allowed from './oauth/allowed';
32
+ import { oidcClientConfig } from './oauth/oidc-client';
33
+ const deflateRawAsync = promisify(deflateRaw);
34
+ export class SSOHandler {
35
+ constructor({ connection, session, opts, }) {
36
+ this.createSAMLResponse = (_a) => __awaiter(this, [_a], void 0, function* ({ profile, session }) {
37
+ const certificate = yield getDefaultCertificate();
38
+ const mappedClaims = profile.claims;
39
+ if (session.mappings) {
40
+ session.mappings.forEach((elem) => {
41
+ const key = elem.key;
42
+ const value = elem.value;
43
+ if (mappedClaims.raw[value]) {
44
+ mappedClaims.raw[key] = mappedClaims.raw[value];
45
+ }
46
+ });
47
+ session.mappings.forEach((elem) => {
48
+ const value = elem.value;
49
+ delete mappedClaims.raw[value];
50
+ });
51
+ }
52
+ try {
53
+ const responseSigned = yield saml.createSAMLResponse(Object.assign(Object.assign({ audience: session.requested.entityId, acsUrl: session.requested.acsUrl, requestId: session.requested.id, issuer: `${this.opts.samlAudience}`, claims: mappedClaims }, certificate), { flattenArray: true }));
54
+ const params = [];
55
+ if (session.requested.relayState) {
56
+ params.push({
57
+ name: 'RelayState',
58
+ value: session.requested.relayState,
59
+ });
60
+ }
61
+ params.push({
62
+ name: 'SAMLResponse',
63
+ value: Buffer.from(responseSigned).toString('base64'),
64
+ });
65
+ const responseForm = saml.createPostForm(session.requested.acsUrl, params);
66
+ return { responseForm };
67
+ }
68
+ catch (err) {
69
+ console.error('Error creating SAML response:', err);
70
+ // TODO: Instead send saml response with status code
71
+ throw new JacksonError('Unable to validate SAML Response.', 403);
72
+ }
73
+ });
74
+ // Create a new session to store SP request information
75
+ this.createSession = (_a) => __awaiter(this, [_a], void 0, function* ({ requestId, requested, oidcCodeVerifier, oidcNonce, mappings, }) {
76
+ const sessionId = crypto.randomBytes(16).toString('hex');
77
+ const session = {
78
+ id: requestId,
79
+ requested,
80
+ samlFederated: true,
81
+ mappings,
82
+ };
83
+ if (oidcCodeVerifier) {
84
+ session['oidcCodeVerifier'] = oidcCodeVerifier;
85
+ }
86
+ if (oidcNonce) {
87
+ session['oidcNonce'] = oidcNonce;
88
+ }
89
+ yield this.session.put(sessionId, session);
90
+ return `${relayStatePrefix}${sessionId}`;
91
+ });
92
+ this.connection = connection;
93
+ this.session = session;
94
+ this.opts = opts;
95
+ }
96
+ // If there are multiple connections for the given tenant and product, return the url to the IdP selection page
97
+ // If idp_hint is provided, return the connection with the matching clientID
98
+ // If there is only one connection, return the connection
99
+ resolveConnection(params) {
100
+ return __awaiter(this, void 0, void 0, function* () {
101
+ const { authFlow, originalParams, tenant, product, idp_hint, entityId, tenants, idFedAppId = '', fedType = '', thirdPartyLogin = null, ssoTraces, } = params;
102
+ let connections = null;
103
+ const noSSOConnectionErrMessage = 'No SSO connection found.';
104
+ // If an IdP is specified, find the connection for that IdP
105
+ if (idp_hint) {
106
+ const connection = yield this.connection.get(idp_hint);
107
+ if (!connection) {
108
+ throw new JacksonError(noSSOConnectionErrMessage, 404);
109
+ }
110
+ return { connection };
111
+ }
112
+ // Find SAML connections for the app
113
+ if (tenants && tenants.length > 0 && product) {
114
+ const result = yield Promise.all(tenants.map((tenant) => this.connection.getByIndex({
115
+ name: IndexNames.TenantProduct,
116
+ value: dbutils.keyFromParts(tenant, product),
117
+ })));
118
+ connections = result.flatMap((r) => r.data);
119
+ }
120
+ else if (tenant && product) {
121
+ const result = yield this.connection.getByIndex({
122
+ name: IndexNames.TenantProduct,
123
+ value: dbutils.keyFromParts(tenant, product),
124
+ });
125
+ connections = result.data;
126
+ }
127
+ else if (entityId) {
128
+ const result = yield this.connection.getByIndex({
129
+ name: IndexNames.EntityID,
130
+ value: entityId,
131
+ });
132
+ connections = result.data;
133
+ }
134
+ if (!connections || connections.length === 0) {
135
+ throw new JacksonError(noSSOConnectionErrMessage, 404);
136
+ }
137
+ // Third party login from an oidcProvider, here we match the connection from the iss param
138
+ if ((thirdPartyLogin === null || thirdPartyLogin === void 0 ? void 0 : thirdPartyLogin.idpInitiatorType) === 'oidc') {
139
+ const oidcConnections = connections.filter((connection) => 'oidcProvider' in connection);
140
+ for (let _a of oidcConnections) {
141
+ const { oidcProvider } = _a, rest = __rest(_a, ["oidcProvider"]);
142
+ const connection = Object.assign({ oidcProvider }, rest);
143
+ const { discoveryUrl, metadata, clientId, clientSecret } = oidcProvider;
144
+ const oidcConfig = yield oidcClientConfig({
145
+ discoveryUrl,
146
+ metadata,
147
+ clientId,
148
+ clientSecret,
149
+ ssoTraces: ssoTraces,
150
+ });
151
+ if (oidcConfig.serverMetadata().issuer === thirdPartyLogin.iss) {
152
+ if (thirdPartyLogin.target_link_uri) {
153
+ if (!allowed.redirect(thirdPartyLogin.target_link_uri, connection.redirectUrl)) {
154
+ throw new JacksonError('target_link_uri is not allowed');
155
+ }
156
+ }
157
+ return { connection };
158
+ }
159
+ }
160
+ // No match found for iss
161
+ throw new JacksonError(noSSOConnectionErrMessage, 404);
162
+ }
163
+ // If more than one, redirect to the connection selection page
164
+ if (connections.length > 1) {
165
+ const url = new URL(`${this.opts.externalUrl}${this.opts.idpDiscoveryPath}`);
166
+ // SP initiated flow
167
+ if (['oauth', 'saml'].includes(authFlow)) {
168
+ const qps = Object.assign({ authFlow: 'sp-initiated', idFedAppId,
169
+ fedType }, originalParams);
170
+ if (tenant && product && fedType !== 'oidc') {
171
+ qps['tenant'] = tenant;
172
+ qps['product'] = product;
173
+ }
174
+ const params = new URLSearchParams(qps);
175
+ return { redirectUrl: `${url}?${params}` };
176
+ }
177
+ // IdP initiated flow
178
+ if (authFlow === 'idp-initiated') {
179
+ if (entityId) {
180
+ const params = new URLSearchParams({
181
+ entityId,
182
+ authFlow,
183
+ });
184
+ const postForm = saml.createPostForm(`${this.opts.idpDiscoveryPath}?${params}`, [
185
+ {
186
+ name: 'SAMLResponse',
187
+ value: originalParams.SAMLResponse,
188
+ },
189
+ ]);
190
+ return { postForm };
191
+ }
192
+ }
193
+ }
194
+ // If only one, use that connection
195
+ return { connection: connections[0] };
196
+ });
197
+ }
198
+ createSAMLRequest(_a) {
199
+ return __awaiter(this, arguments, void 0, function* ({ connection, requestParams, mappings, }) {
200
+ // We have a connection now, so we can create the SAML request
201
+ const certificate = yield getDefaultCertificate();
202
+ const { sso } = connection.idpMetadata;
203
+ let ssoUrl;
204
+ let post = false;
205
+ if ('redirectUrl' in sso) {
206
+ ssoUrl = sso.redirectUrl;
207
+ }
208
+ else if ('postUrl' in sso) {
209
+ ssoUrl = sso.postUrl;
210
+ post = true;
211
+ }
212
+ const samlRequest = saml.request({
213
+ ssoUrl,
214
+ entityID: `${this.opts.samlAudience}`,
215
+ callbackUrl: this.opts.externalUrl + this.opts.samlPath,
216
+ signingKey: certificate.privateKey,
217
+ publicKey: certificate.publicKey,
218
+ forceAuthn: !!connection.forceAuthn,
219
+ identifierFormat: connection.identifierFormat
220
+ ? connection.identifierFormat
221
+ : 'urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress',
222
+ });
223
+ const relayState = yield this.createSession({
224
+ requestId: samlRequest.id,
225
+ requested: Object.assign(Object.assign({}, requestParams), { client_id: connection.clientID }),
226
+ mappings,
227
+ });
228
+ let redirectUrl;
229
+ let authorizeForm;
230
+ // Decide whether to use HTTP Redirect or HTTP POST binding
231
+ if (!post) {
232
+ redirectUrl = redirect.success(ssoUrl, {
233
+ RelayState: relayState,
234
+ SAMLRequest: Buffer.from(yield deflateRawAsync(samlRequest.request)).toString('base64'),
235
+ });
236
+ }
237
+ else {
238
+ authorizeForm = saml.createPostForm(ssoUrl, [
239
+ {
240
+ name: 'RelayState',
241
+ value: relayState,
242
+ },
243
+ {
244
+ name: 'SAMLRequest',
245
+ value: Buffer.from(samlRequest.request).toString('base64'),
246
+ },
247
+ ]);
248
+ }
249
+ return {
250
+ redirect_url: redirectUrl,
251
+ authorize_form: authorizeForm,
252
+ };
253
+ });
254
+ }
255
+ createOIDCRequest(_a) {
256
+ return __awaiter(this, arguments, void 0, function* ({ connection, requestParams, mappings, ssoTraces, }) {
257
+ var _b;
258
+ if (!this.opts.oidcPath) {
259
+ throw new JacksonError('OpenID response handler path (oidcPath) is not set', 400);
260
+ }
261
+ const { discoveryUrl, metadata, clientId, clientSecret } = connection.oidcProvider;
262
+ try {
263
+ const client = yield import('openid-client');
264
+ const oidcConfig = yield oidcClientConfig({
265
+ discoveryUrl,
266
+ metadata,
267
+ clientId,
268
+ clientSecret,
269
+ ssoTraces,
270
+ });
271
+ const oidcCodeVerifier = client.randomPKCECodeVerifier();
272
+ const code_challenge = yield client.calculatePKCECodeChallenge(oidcCodeVerifier);
273
+ const oidcNonce = client.randomNonce();
274
+ const standardScopes = ((_b = this.opts.openid) === null || _b === void 0 ? void 0 : _b.requestProfileScope)
275
+ ? ['openid', 'email', 'profile']
276
+ : ['openid', 'email'];
277
+ const relayState = yield this.createSession({
278
+ requestId: connection.clientID,
279
+ requested: requestParams,
280
+ oidcCodeVerifier,
281
+ oidcNonce,
282
+ mappings,
283
+ });
284
+ const ssoUrl = client.buildAuthorizationUrl(oidcConfig, {
285
+ scope: standardScopes
286
+ .filter((value, index, self) => self.indexOf(value) === index) // filter out duplicates
287
+ .join(' '),
288
+ code_challenge,
289
+ code_challenge_method: 'S256',
290
+ state: relayState,
291
+ nonce: oidcNonce,
292
+ redirect_uri: this.opts.externalUrl + this.opts.oidcPath,
293
+ }).href;
294
+ return {
295
+ redirect_url: ssoUrl,
296
+ authorize_form: null,
297
+ };
298
+ }
299
+ catch (err) {
300
+ console.error(err);
301
+ throw new JacksonError(`Unable to complete OIDC request. - ${err.message}`, 400);
302
+ }
303
+ });
304
+ }
305
+ }
306
+ //# sourceMappingURL=sso-handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sso-handler.js","sourceRoot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C;gBAER,OAAO;oBACL,YAAY,EAAE,MAAM;oBACpB,cAAc,EAAE,IAAI;iBACrB,CAAC;YACJ,CAAC;YAAC,OAAO,GAAQ,EAAE,CAAC;gBAClB,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACnB,MAAM,IAAI,YAAY,CAAC,sCAAsC,GAAG,CAAC,OAAO,EAAE,EAAE,GAAG,CAAC,CAAC;YACnF,CAAC;QACH,CAAC;KAAA;CA0FF"}
@@ -0,0 +1,84 @@
1
+ import * as jose from 'jose';
2
+ import type { Configuration, authorizationCodeGrant } from 'openid-client' with { 'resolution-mode': 'import' };
3
+ import type { ConnectionType, OAuthErrorHandlerParams, SAMLSSOConnectionWithEncodedMetadata, SAMLSSOConnectionWithRawMetadata, OIDCSSOConnectionWithDiscoveryUrl, OIDCSSOConnectionWithMetadata, Profile, SAMLSSORecord, OIDCSSORecord, Directory } from '../typings';
4
+ export declare enum IndexNames {
5
+ EntityID = "entityID",
6
+ TenantProduct = "tenantProduct",
7
+ OIDCProviderClientID = "OIDCProviderClientID",
8
+ SSOClientID = "SSOClientID",
9
+ Product = "product",
10
+ Service = "service",
11
+ SetupToken = "token",
12
+ ProductService = "productService",
13
+ TenantProductService = "tenantProductService"
14
+ }
15
+ export declare const storeNamespacePrefix: {
16
+ dsync: {
17
+ config: string;
18
+ logs: string;
19
+ users: string;
20
+ groups: string;
21
+ members: string;
22
+ providers: string;
23
+ events: string;
24
+ lock: string;
25
+ };
26
+ saml: {
27
+ config: string;
28
+ };
29
+ };
30
+ export declare const relayStatePrefix = "boxyhq_jackson_";
31
+ export declare const clientIDFederatedPrefix = "fed_";
32
+ export declare const clientIDOIDCPrefix = "oidc_";
33
+ export declare const validateAbsoluteUrl: (url: any, message: any) => void;
34
+ export declare const OAuthErrorResponse: ({ error, error_description, redirect_uri, state, }: OAuthErrorHandlerParams) => string;
35
+ export declare function getErrorMessage(error: unknown): string;
36
+ export declare const createRandomSecret: (length: number) => Promise<string>;
37
+ export declare function loadJWSPrivateKey(key: string, alg: string): Promise<jose.KeyLike>;
38
+ export declare function isJWSKeyPairLoaded(jwsKeyPair: {
39
+ private: string;
40
+ public: string;
41
+ }): boolean;
42
+ export declare const importJWTPublicKey: (key: string, jwsAlg: string) => Promise<jose.KeyLike>;
43
+ export declare const exportPublicKeyJWK: (key: jose.KeyLike) => Promise<jose.JWK>;
44
+ export declare const generateJwkThumbprint: (jwk: jose.JWK) => Promise<string>;
45
+ export declare const computeKid: (key: string, jwsAlg: string) => Promise<string>;
46
+ export declare const validateSSOConnection: (body: SAMLSSOConnectionWithRawMetadata | SAMLSSOConnectionWithEncodedMetadata | OIDCSSOConnectionWithDiscoveryUrl | OIDCSSOConnectionWithMetadata, strategy: ConnectionType) => void;
47
+ export declare const validateRedirectUrl: ({ redirectUrlList, defaultRedirectUrl }: {
48
+ redirectUrlList: any;
49
+ defaultRedirectUrl: any;
50
+ }) => void;
51
+ export declare const extractRedirectUrls: (urls: string[] | string) => string[];
52
+ export declare const extractHostName: (url: string) => string | null;
53
+ export type AuthorizationCodeGrantResult = Awaited<ReturnType<typeof authorizationCodeGrant>>;
54
+ export declare const extractOIDCUserProfile: (tokens: AuthorizationCodeGrantResult, oidcConfig: Configuration) => Promise<{
55
+ claims: Partial<Profile & {
56
+ raw: Record<string, unknown>;
57
+ }>;
58
+ }>;
59
+ export declare const getScopeValues: (scope?: string) => string[];
60
+ export declare const getEncodedTenantProduct: (param: string) => {
61
+ tenant: string | null;
62
+ product: string | null;
63
+ } | null;
64
+ export declare const validateTenantAndProduct: (tenant: string, product: string) => void;
65
+ export declare const appID: (tenant: string, product: string) => string;
66
+ export declare const fedAppID: (tenant: string, product: string, type?: string) => string;
67
+ declare const wellKnownProviders: {
68
+ readonly 'okta.com': "Okta";
69
+ readonly 'sts.windows.net': "Entra ID";
70
+ readonly 'mocksaml.com': "MockSAML";
71
+ readonly 'onelogin.com': "OneLogin";
72
+ readonly 'keycloak.com': "Keycloak";
73
+ readonly 'jumpcloud.com': "JumpCloud";
74
+ readonly 'google.com': "Google";
75
+ readonly 'auth0.com': "Auth0";
76
+ readonly 'pingone.com': "PingOne";
77
+ };
78
+ export declare const findFriendlyProviderName: (providerName: string) => keyof typeof wellKnownProviders | "null";
79
+ export declare const transformConnections: (connections: Array<SAMLSSORecord | OIDCSSORecord>) => (SAMLSSORecord | OIDCSSORecord)[];
80
+ export declare const transformConnection: (connection: SAMLSSORecord | OIDCSSORecord) => SAMLSSORecord | OIDCSSORecord;
81
+ export declare const isLocalhost: (url: string) => boolean;
82
+ export declare const isConnectionActive: (connection: SAMLSSORecord | OIDCSSORecord | Directory) => boolean;
83
+ export declare const validateSortOrder: (sortOrder: unknown) => void;
84
+ export {};