@celljs/security 3.0.0

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 (344) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1 -0
  3. package/cell.yml +36 -0
  4. package/lib/browser/index.d.ts +2 -0
  5. package/lib/browser/index.d.ts.map +1 -0
  6. package/lib/browser/index.js +18 -0
  7. package/lib/browser/index.js.map +1 -0
  8. package/lib/browser/module.d.ts +4 -0
  9. package/lib/browser/module.d.ts.map +1 -0
  10. package/lib/browser/module.js +6 -0
  11. package/lib/browser/module.js.map +1 -0
  12. package/lib/browser/user/index.d.ts +3 -0
  13. package/lib/browser/user/index.d.ts.map +1 -0
  14. package/lib/browser/user/index.js +19 -0
  15. package/lib/browser/user/index.js.map +1 -0
  16. package/lib/browser/user/user-manager.d.ts +23 -0
  17. package/lib/browser/user/user-manager.d.ts.map +1 -0
  18. package/lib/browser/user/user-manager.js +125 -0
  19. package/lib/browser/user/user-manager.js.map +1 -0
  20. package/lib/browser/user/user-protocol.d.ts +10 -0
  21. package/lib/browser/user/user-protocol.d.ts.map +1 -0
  22. package/lib/browser/user/user-protocol.js +5 -0
  23. package/lib/browser/user/user-protocol.js.map +1 -0
  24. package/lib/common/index.d.ts +2 -0
  25. package/lib/common/index.d.ts.map +1 -0
  26. package/lib/common/index.js +18 -0
  27. package/lib/common/index.js.map +1 -0
  28. package/lib/common/security-protocol.d.ts +60 -0
  29. package/lib/common/security-protocol.d.ts.map +1 -0
  30. package/lib/common/security-protocol.js +33 -0
  31. package/lib/common/security-protocol.js.map +1 -0
  32. package/lib/node/access/access-decision-manager.d.ts +9 -0
  33. package/lib/node/access/access-decision-manager.d.ts.map +1 -0
  34. package/lib/node/access/access-decision-manager.js +56 -0
  35. package/lib/node/access/access-decision-manager.js.map +1 -0
  36. package/lib/node/access/access-decision-utils.d.ts +5 -0
  37. package/lib/node/access/access-decision-utils.d.ts.map +1 -0
  38. package/lib/node/access/access-decision-utils.js +23 -0
  39. package/lib/node/access/access-decision-utils.js.map +1 -0
  40. package/lib/node/access/access-decision-voter.d.ts +14 -0
  41. package/lib/node/access/access-decision-voter.d.ts.map +1 -0
  42. package/lib/node/access/access-decision-voter.js +86 -0
  43. package/lib/node/access/access-decision-voter.js.map +1 -0
  44. package/lib/node/access/access-protocol.d.ts +75 -0
  45. package/lib/node/access/access-protocol.d.ts.map +1 -0
  46. package/lib/node/access/access-protocol.js +20 -0
  47. package/lib/node/access/access-protocol.js.map +1 -0
  48. package/lib/node/access/action-name-resolver.d.ts +5 -0
  49. package/lib/node/access/action-name-resolver.d.ts.map +1 -0
  50. package/lib/node/access/action-name-resolver.js +30 -0
  51. package/lib/node/access/action-name-resolver.js.map +1 -0
  52. package/lib/node/access/index.d.ts +12 -0
  53. package/lib/node/access/index.d.ts.map +1 -0
  54. package/lib/node/access/index.js +28 -0
  55. package/lib/node/access/index.js.map +1 -0
  56. package/lib/node/access/jexl-engine-provider.d.ts +6 -0
  57. package/lib/node/access/jexl-engine-provider.d.ts.map +1 -0
  58. package/lib/node/access/jexl-engine-provider.js +25 -0
  59. package/lib/node/access/jexl-engine-provider.js.map +1 -0
  60. package/lib/node/access/method-advice.d.ts +17 -0
  61. package/lib/node/access/method-advice.d.ts.map +1 -0
  62. package/lib/node/access/method-advice.js +81 -0
  63. package/lib/node/access/method-advice.js.map +1 -0
  64. package/lib/node/access/policy-provider.d.ts +17 -0
  65. package/lib/node/access/policy-provider.d.ts.map +1 -0
  66. package/lib/node/access/policy-provider.js +84 -0
  67. package/lib/node/access/policy-provider.js.map +1 -0
  68. package/lib/node/access/policy-resolver.d.ts +15 -0
  69. package/lib/node/access/policy-resolver.d.ts.map +1 -0
  70. package/lib/node/access/policy-resolver.js +91 -0
  71. package/lib/node/access/policy-resolver.js.map +1 -0
  72. package/lib/node/access/resource-name-resolver.d.ts +7 -0
  73. package/lib/node/access/resource-name-resolver.d.ts.map +1 -0
  74. package/lib/node/access/resource-name-resolver.js +57 -0
  75. package/lib/node/access/resource-name-resolver.js.map +1 -0
  76. package/lib/node/access/security-metadata-source.d.ts +7 -0
  77. package/lib/node/access/security-metadata-source.d.ts.map +1 -0
  78. package/lib/node/access/security-metadata-source.js +58 -0
  79. package/lib/node/access/security-metadata-source.js.map +1 -0
  80. package/lib/node/annotation/action.d.ts +2 -0
  81. package/lib/node/annotation/action.d.ts.map +1 -0
  82. package/lib/node/annotation/action.js +11 -0
  83. package/lib/node/annotation/action.js.map +1 -0
  84. package/lib/node/annotation/anonymous.d.ts +2 -0
  85. package/lib/node/annotation/anonymous.d.ts.map +1 -0
  86. package/lib/node/annotation/anonymous.js +10 -0
  87. package/lib/node/annotation/anonymous.js.map +1 -0
  88. package/lib/node/annotation/authenticated.d.ts +2 -0
  89. package/lib/node/annotation/authenticated.d.ts.map +1 -0
  90. package/lib/node/annotation/authenticated.js +10 -0
  91. package/lib/node/annotation/authenticated.js.map +1 -0
  92. package/lib/node/annotation/authorize.d.ts +11 -0
  93. package/lib/node/annotation/authorize.d.ts.map +1 -0
  94. package/lib/node/annotation/authorize.js +40 -0
  95. package/lib/node/annotation/authorize.js.map +1 -0
  96. package/lib/node/annotation/index.d.ts +8 -0
  97. package/lib/node/annotation/index.d.ts.map +1 -0
  98. package/lib/node/annotation/index.js +24 -0
  99. package/lib/node/annotation/index.js.map +1 -0
  100. package/lib/node/annotation/post-authorize.d.ts +2 -0
  101. package/lib/node/annotation/post-authorize.d.ts.map +1 -0
  102. package/lib/node/annotation/post-authorize.js +10 -0
  103. package/lib/node/annotation/post-authorize.js.map +1 -0
  104. package/lib/node/annotation/pre-authorize.d.ts +2 -0
  105. package/lib/node/annotation/pre-authorize.d.ts.map +1 -0
  106. package/lib/node/annotation/pre-authorize.js +10 -0
  107. package/lib/node/annotation/pre-authorize.js.map +1 -0
  108. package/lib/node/annotation/resource.d.ts +2 -0
  109. package/lib/node/annotation/resource.d.ts.map +1 -0
  110. package/lib/node/annotation/resource.js +16 -0
  111. package/lib/node/annotation/resource.js.map +1 -0
  112. package/lib/node/authentication/authentication-manager.d.ts +10 -0
  113. package/lib/node/authentication/authentication-manager.d.ts.map +1 -0
  114. package/lib/node/authentication/authentication-manager.js +81 -0
  115. package/lib/node/authentication/authentication-manager.js.map +1 -0
  116. package/lib/node/authentication/authentication-middleware.d.ts +8 -0
  117. package/lib/node/authentication/authentication-middleware.d.ts.map +1 -0
  118. package/lib/node/authentication/authentication-middleware.js +36 -0
  119. package/lib/node/authentication/authentication-middleware.js.map +1 -0
  120. package/lib/node/authentication/authentication-protocol.d.ts +30 -0
  121. package/lib/node/authentication/authentication-protocol.d.ts.map +1 -0
  122. package/lib/node/authentication/authentication-protocol.js +12 -0
  123. package/lib/node/authentication/authentication-protocol.js.map +1 -0
  124. package/lib/node/authentication/authentication-provider.d.ts +33 -0
  125. package/lib/node/authentication/authentication-provider.d.ts.map +1 -0
  126. package/lib/node/authentication/authentication-provider.js +174 -0
  127. package/lib/node/authentication/authentication-provider.js.map +1 -0
  128. package/lib/node/authentication/authentication-success-handler.d.ts +16 -0
  129. package/lib/node/authentication/authentication-success-handler.d.ts.map +1 -0
  130. package/lib/node/authentication/authentication-success-handler.js +97 -0
  131. package/lib/node/authentication/authentication-success-handler.js.map +1 -0
  132. package/lib/node/authentication/index.d.ts +6 -0
  133. package/lib/node/authentication/index.d.ts.map +1 -0
  134. package/lib/node/authentication/index.js +22 -0
  135. package/lib/node/authentication/index.js.map +1 -0
  136. package/lib/node/cache/cache-protocol.d.ts +16 -0
  137. package/lib/node/cache/cache-protocol.d.ts.map +1 -0
  138. package/lib/node/cache/cache-protocol.js +6 -0
  139. package/lib/node/cache/cache-protocol.js.map +1 -0
  140. package/lib/node/cache/index.d.ts +3 -0
  141. package/lib/node/cache/index.d.ts.map +1 -0
  142. package/lib/node/cache/index.js +19 -0
  143. package/lib/node/cache/index.js.map +1 -0
  144. package/lib/node/cache/request-cache.d.ts +10 -0
  145. package/lib/node/cache/request-cache.d.ts.map +1 -0
  146. package/lib/node/cache/request-cache.js +52 -0
  147. package/lib/node/cache/request-cache.js.map +1 -0
  148. package/lib/node/constants.d.ts +6 -0
  149. package/lib/node/constants.d.ts.map +1 -0
  150. package/lib/node/constants.js +9 -0
  151. package/lib/node/constants.js.map +1 -0
  152. package/lib/node/context/context-protocol.d.ts +22 -0
  153. package/lib/node/context/context-protocol.d.ts.map +1 -0
  154. package/lib/node/context/context-protocol.js +30 -0
  155. package/lib/node/context/context-protocol.js.map +1 -0
  156. package/lib/node/context/index.d.ts +5 -0
  157. package/lib/node/context/index.d.ts.map +1 -0
  158. package/lib/node/context/index.js +21 -0
  159. package/lib/node/context/index.js.map +1 -0
  160. package/lib/node/context/security-context-middleware.d.ts +9 -0
  161. package/lib/node/context/security-context-middleware.d.ts.map +1 -0
  162. package/lib/node/context/security-context-middleware.js +44 -0
  163. package/lib/node/context/security-context-middleware.js.map +1 -0
  164. package/lib/node/context/security-context-store.d.ts +8 -0
  165. package/lib/node/context/security-context-store.d.ts.map +1 -0
  166. package/lib/node/context/security-context-store.js +40 -0
  167. package/lib/node/context/security-context-store.js.map +1 -0
  168. package/lib/node/context/security-context-strategy.d.ts +9 -0
  169. package/lib/node/context/security-context-strategy.d.ts.map +1 -0
  170. package/lib/node/context/security-context-strategy.js +32 -0
  171. package/lib/node/context/security-context-strategy.js.map +1 -0
  172. package/lib/node/crypto/index.d.ts +3 -0
  173. package/lib/node/crypto/index.d.ts.map +1 -0
  174. package/lib/node/crypto/index.js +19 -0
  175. package/lib/node/crypto/index.js.map +1 -0
  176. package/lib/node/crypto/keygen/base64-string-key-generator.d.ts +6 -0
  177. package/lib/node/crypto/keygen/base64-string-key-generator.d.ts.map +1 -0
  178. package/lib/node/crypto/keygen/base64-string-key-generator.js +30 -0
  179. package/lib/node/crypto/keygen/base64-string-key-generator.js.map +1 -0
  180. package/lib/node/crypto/keygen/index.d.ts +3 -0
  181. package/lib/node/crypto/keygen/index.d.ts.map +1 -0
  182. package/lib/node/crypto/keygen/index.js +19 -0
  183. package/lib/node/crypto/keygen/index.js.map +1 -0
  184. package/lib/node/crypto/keygen/keygen-protocol.d.ts +5 -0
  185. package/lib/node/crypto/keygen/keygen-protocol.d.ts.map +1 -0
  186. package/lib/node/crypto/keygen/keygen-protocol.js +5 -0
  187. package/lib/node/crypto/keygen/keygen-protocol.js.map +1 -0
  188. package/lib/node/crypto/password/index.d.ts +3 -0
  189. package/lib/node/crypto/password/index.d.ts.map +1 -0
  190. package/lib/node/crypto/password/index.js +19 -0
  191. package/lib/node/crypto/password/index.js.map +1 -0
  192. package/lib/node/crypto/password/password-encoder.d.ts +9 -0
  193. package/lib/node/crypto/password/password-encoder.d.ts.map +1 -0
  194. package/lib/node/crypto/password/password-encoder.js +51 -0
  195. package/lib/node/crypto/password/password-encoder.js.map +1 -0
  196. package/lib/node/crypto/password/password-protocol.d.ts +6 -0
  197. package/lib/node/crypto/password/password-protocol.d.ts.map +1 -0
  198. package/lib/node/crypto/password/password-protocol.js +5 -0
  199. package/lib/node/crypto/password/password-protocol.js.map +1 -0
  200. package/lib/node/error/error-handler.d.ts +19 -0
  201. package/lib/node/error/error-handler.d.ts.map +1 -0
  202. package/lib/node/error/error-handler.js +81 -0
  203. package/lib/node/error/error-handler.js.map +1 -0
  204. package/lib/node/error/error-protocol.d.ts +3 -0
  205. package/lib/node/error/error-protocol.d.ts.map +1 -0
  206. package/lib/node/error/error-protocol.js +7 -0
  207. package/lib/node/error/error-protocol.js.map +1 -0
  208. package/lib/node/error/error.d.ts +21 -0
  209. package/lib/node/error/error.d.ts.map +1 -0
  210. package/lib/node/error/error.js +35 -0
  211. package/lib/node/error/error.js.map +1 -0
  212. package/lib/node/error/index.d.ts +4 -0
  213. package/lib/node/error/index.d.ts.map +1 -0
  214. package/lib/node/error/index.js +20 -0
  215. package/lib/node/error/index.js.map +1 -0
  216. package/lib/node/index.d.ts +11 -0
  217. package/lib/node/index.d.ts.map +1 -0
  218. package/lib/node/index.js +27 -0
  219. package/lib/node/index.js.map +1 -0
  220. package/lib/node/logout/index.d.ts +5 -0
  221. package/lib/node/logout/index.d.ts.map +1 -0
  222. package/lib/node/logout/index.js +21 -0
  223. package/lib/node/logout/index.js.map +1 -0
  224. package/lib/node/logout/logout-handler.d.ts +5 -0
  225. package/lib/node/logout/logout-handler.d.ts.map +1 -0
  226. package/lib/node/logout/logout-handler.js +22 -0
  227. package/lib/node/logout/logout-handler.js.map +1 -0
  228. package/lib/node/logout/logout-middleware.d.ts +16 -0
  229. package/lib/node/logout/logout-middleware.d.ts.map +1 -0
  230. package/lib/node/logout/logout-middleware.js +66 -0
  231. package/lib/node/logout/logout-middleware.js.map +1 -0
  232. package/lib/node/logout/logout-protocol.d.ts +12 -0
  233. package/lib/node/logout/logout-protocol.d.ts.map +1 -0
  234. package/lib/node/logout/logout-protocol.js +9 -0
  235. package/lib/node/logout/logout-protocol.js.map +1 -0
  236. package/lib/node/logout/logout-success-handler-provider.d.ts +8 -0
  237. package/lib/node/logout/logout-success-handler-provider.d.ts.map +1 -0
  238. package/lib/node/logout/logout-success-handler-provider.js +35 -0
  239. package/lib/node/logout/logout-success-handler-provider.js.map +1 -0
  240. package/lib/node/logout/logout-success-handler.d.ts +9 -0
  241. package/lib/node/logout/logout-success-handler.d.ts.map +1 -0
  242. package/lib/node/logout/logout-success-handler.js +39 -0
  243. package/lib/node/logout/logout-success-handler.js.map +1 -0
  244. package/lib/node/module.d.ts +5 -0
  245. package/lib/node/module.d.ts.map +1 -0
  246. package/lib/node/module.js +7 -0
  247. package/lib/node/module.js.map +1 -0
  248. package/lib/node/user/index.d.ts +6 -0
  249. package/lib/node/user/index.d.ts.map +1 -0
  250. package/lib/node/user/index.js +22 -0
  251. package/lib/node/user/index.js.map +1 -0
  252. package/lib/node/user/user-checker.d.ts +8 -0
  253. package/lib/node/user/user-checker.d.ts.map +1 -0
  254. package/lib/node/user/user-checker.js +44 -0
  255. package/lib/node/user/user-checker.js.map +1 -0
  256. package/lib/node/user/user-mapper.d.ts +9 -0
  257. package/lib/node/user/user-mapper.d.ts.map +1 -0
  258. package/lib/node/user/user-mapper.js +40 -0
  259. package/lib/node/user/user-mapper.js.map +1 -0
  260. package/lib/node/user/user-middleware.d.ts +11 -0
  261. package/lib/node/user/user-middleware.d.ts.map +1 -0
  262. package/lib/node/user/user-middleware.js +55 -0
  263. package/lib/node/user/user-middleware.js.map +1 -0
  264. package/lib/node/user/user-protocol.d.ts +15 -0
  265. package/lib/node/user/user-protocol.d.ts.map +1 -0
  266. package/lib/node/user/user-protocol.js +9 -0
  267. package/lib/node/user/user-protocol.js.map +1 -0
  268. package/lib/node/user/user-service.d.ts +7 -0
  269. package/lib/node/user/user-service.d.ts.map +1 -0
  270. package/lib/node/user/user-service.js +42 -0
  271. package/lib/node/user/user-service.js.map +1 -0
  272. package/lib/package.spec.d.ts +1 -0
  273. package/lib/package.spec.d.ts.map +1 -0
  274. package/lib/package.spec.js +4 -0
  275. package/lib/package.spec.js.map +1 -0
  276. package/package.json +53 -0
  277. package/src/browser/index.ts +1 -0
  278. package/src/browser/module.ts +4 -0
  279. package/src/browser/user/index.ts +2 -0
  280. package/src/browser/user/user-manager.ts +103 -0
  281. package/src/browser/user/user-protocol.ts +11 -0
  282. package/src/common/index.ts +1 -0
  283. package/src/common/security-protocol.ts +65 -0
  284. package/src/node/access/access-decision-manager.ts +43 -0
  285. package/src/node/access/access-decision-utils.ts +18 -0
  286. package/src/node/access/access-decision-voter.ts +73 -0
  287. package/src/node/access/access-protocol.ts +93 -0
  288. package/src/node/access/action-name-resolver.ts +19 -0
  289. package/src/node/access/index.ts +11 -0
  290. package/src/node/access/jexl-engine-provider.ts +18 -0
  291. package/src/node/access/method-advice.ts +64 -0
  292. package/src/node/access/policy-provider.ts +64 -0
  293. package/src/node/access/policy-resolver.ts +79 -0
  294. package/src/node/access/resource-name-resolver.ts +41 -0
  295. package/src/node/access/security-metadata-source.ts +47 -0
  296. package/src/node/annotation/action.ts +8 -0
  297. package/src/node/annotation/anonymous.ts +6 -0
  298. package/src/node/annotation/authenticated.ts +6 -0
  299. package/src/node/annotation/authorize.ts +39 -0
  300. package/src/node/annotation/index.ts +7 -0
  301. package/src/node/annotation/post-authorize.ts +6 -0
  302. package/src/node/annotation/pre-authorize.ts +6 -0
  303. package/src/node/annotation/resource.ts +12 -0
  304. package/src/node/authentication/authentication-manager.ts +61 -0
  305. package/src/node/authentication/authentication-middleware.ts +21 -0
  306. package/src/node/authentication/authentication-protocol.ts +37 -0
  307. package/src/node/authentication/authentication-provider.ts +155 -0
  308. package/src/node/authentication/authentication-success-handler.ts +83 -0
  309. package/src/node/authentication/index.ts +5 -0
  310. package/src/node/cache/cache-protocol.ts +17 -0
  311. package/src/node/cache/index.ts +2 -0
  312. package/src/node/cache/request-cache.ts +38 -0
  313. package/src/node/constants.ts +5 -0
  314. package/src/node/context/context-protocol.ts +43 -0
  315. package/src/node/context/index.ts +4 -0
  316. package/src/node/context/security-context-middleware.ts +28 -0
  317. package/src/node/context/security-context-store.ts +25 -0
  318. package/src/node/context/security-context-strategy.ts +24 -0
  319. package/src/node/crypto/index.ts +2 -0
  320. package/src/node/crypto/keygen/base64-string-key-generator.ts +15 -0
  321. package/src/node/crypto/keygen/index.ts +2 -0
  322. package/src/node/crypto/keygen/keygen-protocol.ts +7 -0
  323. package/src/node/crypto/password/index.ts +2 -0
  324. package/src/node/crypto/password/password-encoder.ts +39 -0
  325. package/src/node/crypto/password/password-protocol.ts +6 -0
  326. package/src/node/error/error-handler.ts +58 -0
  327. package/src/node/error/error-protocol.ts +5 -0
  328. package/src/node/error/error.ts +41 -0
  329. package/src/node/error/index.ts +3 -0
  330. package/src/node/index.ts +10 -0
  331. package/src/node/logout/index.ts +4 -0
  332. package/src/node/logout/logout-handler.ts +12 -0
  333. package/src/node/logout/logout-middleware.ts +49 -0
  334. package/src/node/logout/logout-protocol.ts +17 -0
  335. package/src/node/logout/logout-success-handler-provider.ts +21 -0
  336. package/src/node/logout/logout-success-handler.ts +22 -0
  337. package/src/node/module.ts +5 -0
  338. package/src/node/user/index.ts +6 -0
  339. package/src/node/user/user-checker.ts +37 -0
  340. package/src/node/user/user-mapper.ts +26 -0
  341. package/src/node/user/user-middleware.ts +40 -0
  342. package/src/node/user/user-protocol.ts +20 -0
  343. package/src/node/user/user-service.ts +28 -0
  344. package/src/package.spec.ts +4 -0
@@ -0,0 +1,6 @@
1
+ export declare const METADATA_KEY: {
2
+ authorize: string;
3
+ resource: string;
4
+ action: string;
5
+ };
6
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/node/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY;;;;CAIxB,CAAC"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.METADATA_KEY = void 0;
4
+ exports.METADATA_KEY = {
5
+ authorize: 'cell:authorize',
6
+ resource: 'cell:resource',
7
+ action: 'cell:atcion'
8
+ };
9
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/node/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GAAG;IACxB,SAAS,EAAE,gBAAgB;IAC3B,QAAQ,EAAE,eAAe;IACzB,MAAM,EAAE,aAAa;CACxB,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { Authentication } from '../authentication';
2
+ export declare const SECURITY_CONTEXT_MIDDLEWARE_PRIORITY: number;
3
+ export declare const CURRENT_SECURITY_CONTEXT_REQUEST_KEY = "CurrentSecurityContextRequest";
4
+ export declare const SecurityContextStore: unique symbol;
5
+ export declare const SecurityContextStrategy: unique symbol;
6
+ export interface SecurityContext {
7
+ authentication: Authentication;
8
+ }
9
+ export interface SecurityContextStore {
10
+ load(): Promise<SecurityContext>;
11
+ save(context: SecurityContext): Promise<void>;
12
+ }
13
+ export interface SecurityContextStrategy {
14
+ create(): Promise<SecurityContext>;
15
+ }
16
+ export declare namespace SecurityContext {
17
+ function setCurrent(context: SecurityContext | undefined): void;
18
+ function getCurrent<T extends SecurityContext>(): T;
19
+ function getAuthentication(): Authentication;
20
+ function setAuthentication(authentication: Authentication): void;
21
+ }
22
+ //# sourceMappingURL=context-protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-protocol.d.ts","sourceRoot":"","sources":["../../../src/node/context/context-protocol.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAInD,eAAO,MAAM,oCAAoC,QAAoC,CAAC;AACtF,eAAO,MAAM,oCAAoC,kCAAkC,CAAC;AAEpF,eAAO,MAAM,oBAAoB,eAAiC,CAAC;AACnE,eAAO,MAAM,uBAAuB,eAAoC,CAAC;AAEzE,MAAM,WAAW,eAAe;IAC5B,cAAc,EAAE,cAAc,CAAC;CAClC;AAED,MAAM,WAAW,oBAAoB;IACjC,IAAI,IAAI,OAAO,CAAC,eAAe,CAAC,CAAC;IACjC,IAAI,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACjD;AAED,MAAM,WAAW,uBAAuB;IACpC,MAAM,IAAI,OAAO,CAAC,eAAe,CAAC,CAAC;CACtC;AAED,yBAAiB,eAAe,CAAC;IAE7B,SAAgB,UAAU,CAAC,OAAO,EAAE,eAAe,GAAG,SAAS,QAE9D;IAED,SAAgB,UAAU,CAAC,CAAC,SAAS,eAAe,KAAK,CAAC,CAEzD;IAED,SAAgB,iBAAiB,IAAI,cAAc,CAElD;IAED,SAAgB,iBAAiB,CAAC,cAAc,EAAE,cAAc,GAAG,IAAI,CAEtE;CAEJ"}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SecurityContext = exports.SecurityContextStrategy = exports.SecurityContextStore = exports.CURRENT_SECURITY_CONTEXT_REQUEST_KEY = exports.SECURITY_CONTEXT_MIDDLEWARE_PRIORITY = void 0;
4
+ const node_1 = require("@celljs/web/lib/node");
5
+ const session_protocol_1 = require("@celljs/web/lib/node/session/session-protocol");
6
+ const node_2 = require("@celljs/core/lib/node");
7
+ exports.SECURITY_CONTEXT_MIDDLEWARE_PRIORITY = session_protocol_1.SESSION_MIDDLEWARE_PRIORITY - 100;
8
+ exports.CURRENT_SECURITY_CONTEXT_REQUEST_KEY = 'CurrentSecurityContextRequest';
9
+ exports.SecurityContextStore = Symbol('SecurityContextStore');
10
+ exports.SecurityContextStrategy = Symbol('SecurityContextStrategy');
11
+ var SecurityContext;
12
+ (function (SecurityContext) {
13
+ function setCurrent(context) {
14
+ node_1.Context.setAttr(exports.CURRENT_SECURITY_CONTEXT_REQUEST_KEY, context);
15
+ }
16
+ SecurityContext.setCurrent = setCurrent;
17
+ function getCurrent() {
18
+ return node_1.Context.getAttr(exports.CURRENT_SECURITY_CONTEXT_REQUEST_KEY, node_2.AttributeScope.Request);
19
+ }
20
+ SecurityContext.getCurrent = getCurrent;
21
+ function getAuthentication() {
22
+ return getCurrent().authentication;
23
+ }
24
+ SecurityContext.getAuthentication = getAuthentication;
25
+ function setAuthentication(authentication) {
26
+ getCurrent().authentication = authentication;
27
+ }
28
+ SecurityContext.setAuthentication = setAuthentication;
29
+ })(SecurityContext = exports.SecurityContext || (exports.SecurityContext = {}));
30
+ //# sourceMappingURL=context-protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-protocol.js","sourceRoot":"","sources":["../../../src/node/context/context-protocol.ts"],"names":[],"mappings":";;;AAAA,+CAA+C;AAE/C,oFAA4F;AAC5F,gDAAuD;AAE1C,QAAA,oCAAoC,GAAG,8CAA2B,GAAG,GAAG,CAAC;AACzE,QAAA,oCAAoC,GAAG,+BAA+B,CAAC;AAEvE,QAAA,oBAAoB,GAAG,MAAM,CAAC,sBAAsB,CAAC,CAAC;AACtD,QAAA,uBAAuB,GAAG,MAAM,CAAC,yBAAyB,CAAC,CAAC;AAezE,IAAiB,eAAe,CAkB/B;AAlBD,WAAiB,eAAe;IAE5B,SAAgB,UAAU,CAAC,OAAoC;QAC3D,cAAO,CAAC,OAAO,CAAC,4CAAoC,EAAE,OAAO,CAAC,CAAC;IACnE,CAAC;IAFe,0BAAU,aAEzB,CAAA;IAED,SAAgB,UAAU;QACtB,OAAO,cAAO,CAAC,OAAO,CAAC,4CAAoC,EAAE,qBAAc,CAAC,OAAO,CAAC,CAAC;IACzF,CAAC;IAFe,0BAAU,aAEzB,CAAA;IAED,SAAgB,iBAAiB;QAC7B,OAAO,UAAU,EAAE,CAAC,cAAc,CAAC;IACvC,CAAC;IAFe,iCAAiB,oBAEhC,CAAA;IAED,SAAgB,iBAAiB,CAAC,cAA8B;QAC5D,UAAU,EAAE,CAAC,cAAc,GAAG,cAAc,CAAC;IACjD,CAAC;IAFe,iCAAiB,oBAEhC,CAAA;AAEL,CAAC,EAlBgB,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAkB/B"}
@@ -0,0 +1,5 @@
1
+ export * from './context-protocol';
2
+ export * from './security-context-middleware';
3
+ export * from './security-context-store';
4
+ export * from './security-context-strategy';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/node/context/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./context-protocol"), exports);
18
+ __exportStar(require("./security-context-middleware"), exports);
19
+ __exportStar(require("./security-context-store"), exports);
20
+ __exportStar(require("./security-context-strategy"), exports);
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/node/context/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,gEAA8C;AAC9C,2DAAyC;AACzC,8DAA4C"}
@@ -0,0 +1,9 @@
1
+ import { Middleware, Context } from '@celljs/web/lib/node';
2
+ import { SecurityContextStore } from './context-protocol';
3
+ export declare class SecurityContextMiddleWare implements Middleware {
4
+ protected readonly options: any;
5
+ protected readonly securityContextStore: SecurityContextStore;
6
+ handle(ctx: Context, next: () => Promise<void>): Promise<void>;
7
+ readonly priority: number;
8
+ }
9
+ //# sourceMappingURL=security-context-middleware.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"security-context-middleware.d.ts","sourceRoot":"","sources":["../../../src/node/context/security-context-middleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE3D,OAAO,EAAE,oBAAoB,EAAyD,MAAM,oBAAoB,CAAC;AAEjH,qBACa,yBAA0B,YAAW,UAAU;IAGxD,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC;IAGhC,SAAS,CAAC,QAAQ,CAAC,oBAAoB,EAAE,oBAAoB,CAAC;IAExD,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAYpE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAwC;CAEpE"}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.SecurityContextMiddleWare = void 0;
13
+ const node_1 = require("@celljs/web/lib/node");
14
+ const core_1 = require("@celljs/core");
15
+ const context_protocol_1 = require("./context-protocol");
16
+ let SecurityContextMiddleWare = class SecurityContextMiddleWare {
17
+ constructor() {
18
+ this.priority = context_protocol_1.SECURITY_CONTEXT_MIDDLEWARE_PRIORITY;
19
+ }
20
+ async handle(ctx, next) {
21
+ const context = await this.securityContextStore.load();
22
+ try {
23
+ context_protocol_1.SecurityContext.setCurrent(context);
24
+ node_1.Context.setTenant(context.authentication.name);
25
+ await next();
26
+ }
27
+ finally {
28
+ await this.securityContextStore.save(context_protocol_1.SecurityContext.getCurrent());
29
+ }
30
+ }
31
+ };
32
+ __decorate([
33
+ (0, core_1.Value)('cell.security'),
34
+ __metadata("design:type", Object)
35
+ ], SecurityContextMiddleWare.prototype, "options", void 0);
36
+ __decorate([
37
+ (0, core_1.Autowired)(context_protocol_1.SecurityContextStore),
38
+ __metadata("design:type", Object)
39
+ ], SecurityContextMiddleWare.prototype, "securityContextStore", void 0);
40
+ SecurityContextMiddleWare = __decorate([
41
+ (0, core_1.Component)(node_1.Middleware)
42
+ ], SecurityContextMiddleWare);
43
+ exports.SecurityContextMiddleWare = SecurityContextMiddleWare;
44
+ //# sourceMappingURL=security-context-middleware.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"security-context-middleware.js","sourceRoot":"","sources":["../../../src/node/context/security-context-middleware.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAA2D;AAC3D,uCAA2D;AAC3D,yDAAiH;AAG1G,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;IAA/B;QAoBM,aAAQ,GAAW,uDAAoC,CAAC;IAErE,CAAC;IAdG,KAAK,CAAC,MAAM,CAAC,GAAY,EAAE,IAAyB;QAEhD,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,IAAI,EAAE,CAAC;QACvD,IAAI;YACA,kCAAe,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;YACpC,cAAO,CAAC,SAAS,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;YAC/C,MAAM,IAAI,EAAE,CAAC;SAChB;gBAAS;YACN,MAAM,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,kCAAe,CAAC,UAAU,EAAE,CAAC,CAAC;SACtE;IACL,CAAC;CAIJ,CAAA;AApBG;IAAC,IAAA,YAAK,EAAC,eAAe,CAAC;;0DACS;AAEhC;IAAC,IAAA,gBAAS,EAAC,uCAAoB,CAAC;;uEAC8B;AANrD,yBAAyB;IADrC,IAAA,gBAAS,EAAC,iBAAU,CAAC;GACT,yBAAyB,CAsBrC;AAtBY,8DAAyB"}
@@ -0,0 +1,8 @@
1
+ import { SecurityContextStore, SecurityContext, SecurityContextStrategy } from './context-protocol';
2
+ export declare class SessionSecurityContextStore implements SecurityContextStore {
3
+ protected readonly options: any;
4
+ protected readonly securityContextStrategy: SecurityContextStrategy;
5
+ load(): Promise<SecurityContext>;
6
+ save(context: SecurityContext): Promise<void>;
7
+ }
8
+ //# sourceMappingURL=security-context-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"security-context-store.d.ts","sourceRoot":"","sources":["../../../src/node/context/security-context-store.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAGpG,qBACa,2BAA4B,YAAW,oBAAoB;IAGpE,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC;IAGhC,SAAS,CAAC,QAAQ,CAAC,uBAAuB,EAAE,uBAAuB,CAAC;IAE9D,IAAI,IAAI,OAAO,CAAC,eAAe,CAAC;IAOhC,IAAI,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;CAItD"}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.SessionSecurityContextStore = void 0;
13
+ const core_1 = require("@celljs/core");
14
+ const context_protocol_1 = require("./context-protocol");
15
+ const node_1 = require("@celljs/web/lib/node");
16
+ let SessionSecurityContextStore = class SessionSecurityContextStore {
17
+ async load() {
18
+ const context = node_1.Context.getSession()[this.options.contextKey];
19
+ if (!context) {
20
+ return this.securityContextStrategy.create();
21
+ }
22
+ return context;
23
+ }
24
+ async save(context) {
25
+ node_1.Context.getSession()[this.options.contextKey] = context;
26
+ }
27
+ };
28
+ __decorate([
29
+ (0, core_1.Value)('cell.security'),
30
+ __metadata("design:type", Object)
31
+ ], SessionSecurityContextStore.prototype, "options", void 0);
32
+ __decorate([
33
+ (0, core_1.Autowired)(context_protocol_1.SecurityContextStrategy),
34
+ __metadata("design:type", Object)
35
+ ], SessionSecurityContextStore.prototype, "securityContextStrategy", void 0);
36
+ SessionSecurityContextStore = __decorate([
37
+ (0, core_1.Component)(context_protocol_1.SecurityContextStore)
38
+ ], SessionSecurityContextStore);
39
+ exports.SessionSecurityContextStore = SessionSecurityContextStore;
40
+ //# sourceMappingURL=security-context-store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"security-context-store.js","sourceRoot":"","sources":["../../../src/node/context/security-context-store.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAA2D;AAC3D,yDAAoG;AACpG,+CAA+C;AAGxC,IAAM,2BAA2B,GAAjC,MAAM,2BAA2B;IAQpC,KAAK,CAAC,IAAI;QACN,MAAM,OAAO,GAAG,cAAO,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAC9D,IAAI,CAAC,OAAO,EAAE;YACV,OAAO,IAAI,CAAC,uBAAuB,CAAC,MAAM,EAAE,CAAC;SAChD;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,OAAwB;QAC/B,cAAO,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC;IAC5D,CAAC;CAEJ,CAAA;AAjBG;IAAC,IAAA,YAAK,EAAC,eAAe,CAAC;;4DACS;AAEhC;IAAC,IAAA,gBAAS,EAAC,0CAAuB,CAAC;;4EACiC;AAN3D,2BAA2B;IADvC,IAAA,gBAAS,EAAC,uCAAoB,CAAC;GACnB,2BAA2B,CAmBvC;AAnBY,kEAA2B"}
@@ -0,0 +1,9 @@
1
+ import { SecurityContext, SecurityContextStrategy } from './context-protocol';
2
+ import { Authentication } from '../authentication';
3
+ export declare class SecurityContextImpl implements SecurityContext {
4
+ authentication: Authentication;
5
+ }
6
+ export declare class SessionSecurityContextStrategy implements SecurityContextStrategy {
7
+ create(): Promise<SecurityContext>;
8
+ }
9
+ //# sourceMappingURL=security-context-strategy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"security-context-strategy.d.ts","sourceRoot":"","sources":["../../../src/node/context/security-context-strategy.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,qBAAa,mBAAoB,YAAW,eAAe;IACvD,cAAc,EAAE,cAAc,CAAC;CAClC;AAED,qBACa,8BAA+B,YAAW,uBAAuB;IAE1E,MAAM,IAAI,OAAO,CAAC,eAAe,CAAC;CAYrC"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.SessionSecurityContextStrategy = exports.SecurityContextImpl = void 0;
10
+ const core_1 = require("@celljs/core");
11
+ const context_protocol_1 = require("./context-protocol");
12
+ class SecurityContextImpl {
13
+ }
14
+ exports.SecurityContextImpl = SecurityContextImpl;
15
+ let SessionSecurityContextStrategy = class SessionSecurityContextStrategy {
16
+ create() {
17
+ const securityContext = new SecurityContextImpl();
18
+ securityContext.authentication = {
19
+ name: 'anonymousUser',
20
+ principal: 'anonymousUser',
21
+ policies: [],
22
+ credentials: '',
23
+ authenticated: false
24
+ };
25
+ return Promise.resolve(securityContext);
26
+ }
27
+ };
28
+ SessionSecurityContextStrategy = __decorate([
29
+ (0, core_1.Component)(context_protocol_1.SecurityContextStrategy)
30
+ ], SessionSecurityContextStrategy);
31
+ exports.SessionSecurityContextStrategy = SessionSecurityContextStrategy;
32
+ //# sourceMappingURL=security-context-strategy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"security-context-strategy.js","sourceRoot":"","sources":["../../../src/node/context/security-context-strategy.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uCAAyC;AACzC,yDAA8E;AAG9E,MAAa,mBAAmB;CAE/B;AAFD,kDAEC;AAGM,IAAM,8BAA8B,GAApC,MAAM,8BAA8B;IAEvC,MAAM;QACF,MAAM,eAAe,GAAG,IAAI,mBAAmB,EAAE,CAAC;QAClD,eAAe,CAAC,cAAc,GAAG;YAC7B,IAAI,EAAE,eAAe;YACrB,SAAS,EAAE,eAAe;YAC1B,QAAQ,EAAE,EAAE;YACZ,WAAW,EAAE,EAAE;YACf,aAAa,EAAE,KAAK;SACvB,CAAC;QACF,OAAO,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IAC5C,CAAC;CAEJ,CAAA;AAdY,8BAA8B;IAD1C,IAAA,gBAAS,EAAC,0CAAuB,CAAC;GACtB,8BAA8B,CAc1C;AAdY,wEAA8B"}
@@ -0,0 +1,3 @@
1
+ export * from './keygen';
2
+ export * from './password';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/node/crypto/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./keygen"), exports);
18
+ __exportStar(require("./password"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/node/crypto/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,6CAA2B"}
@@ -0,0 +1,6 @@
1
+ import { StringKeyGenerator } from './keygen-protocol';
2
+ export declare class Base64StringKeyGenerator implements StringKeyGenerator {
3
+ protected readonly keyLength: number;
4
+ generateKey(keyLength?: number): Promise<string>;
5
+ }
6
+ //# sourceMappingURL=base64-string-key-generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base64-string-key-generator.d.ts","sourceRoot":"","sources":["../../../../src/node/crypto/keygen/base64-string-key-generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAIvD,qBACa,wBAAyB,YAAW,kBAAkB;IAG/D,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAE/B,WAAW,CAAC,SAAS,CAAC,EAAE,MAAM;CAIvC"}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.Base64StringKeyGenerator = void 0;
13
+ const keygen_protocol_1 = require("./keygen-protocol");
14
+ const crypto_js_1 = require("crypto-js");
15
+ const core_1 = require("@celljs/core");
16
+ let Base64StringKeyGenerator = class Base64StringKeyGenerator {
17
+ async generateKey(keyLength) {
18
+ const key = crypto_js_1.lib.WordArray.random(keyLength || this.keyLength);
19
+ return crypto_js_1.enc.Base64.stringify(key);
20
+ }
21
+ };
22
+ __decorate([
23
+ (0, core_1.Value)('cell.security.base64StringKeyLength'),
24
+ __metadata("design:type", Number)
25
+ ], Base64StringKeyGenerator.prototype, "keyLength", void 0);
26
+ Base64StringKeyGenerator = __decorate([
27
+ (0, core_1.Component)(keygen_protocol_1.StringKeyGenerator)
28
+ ], Base64StringKeyGenerator);
29
+ exports.Base64StringKeyGenerator = Base64StringKeyGenerator;
30
+ //# sourceMappingURL=base64-string-key-generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base64-string-key-generator.js","sourceRoot":"","sources":["../../../../src/node/crypto/keygen/base64-string-key-generator.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uDAAuD;AACvD,yCAAqC;AACrC,uCAAgD;AAGzC,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IAKjC,KAAK,CAAC,WAAW,CAAC,SAAkB;QAChC,MAAM,GAAG,GAAG,eAAG,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC;QAC9D,OAAO,eAAG,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IACrC,CAAC;CACJ,CAAA;AAPG;IAAC,IAAA,YAAK,EAAC,qCAAqC,CAAC;;2DACR;AAH5B,wBAAwB;IADpC,IAAA,gBAAS,EAAC,oCAAkB,CAAC;GACjB,wBAAwB,CASpC;AATY,4DAAwB"}
@@ -0,0 +1,3 @@
1
+ export * from './keygen-protocol';
2
+ export * from './base64-string-key-generator';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/node/crypto/keygen/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,+BAA+B,CAAC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./keygen-protocol"), exports);
18
+ __exportStar(require("./base64-string-key-generator"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/node/crypto/keygen/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,gEAA8C"}
@@ -0,0 +1,5 @@
1
+ export declare const StringKeyGenerator: unique symbol;
2
+ export interface StringKeyGenerator {
3
+ generateKey(keyLength?: number): Promise<string>;
4
+ }
5
+ //# sourceMappingURL=keygen-protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keygen-protocol.d.ts","sourceRoot":"","sources":["../../../../src/node/crypto/keygen/keygen-protocol.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,eAA+B,CAAC;AAE/D,MAAM,WAAW,kBAAkB;IAE/B,WAAW,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAEpD"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StringKeyGenerator = void 0;
4
+ exports.StringKeyGenerator = Symbol('StringKeyGenerator');
5
+ //# sourceMappingURL=keygen-protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keygen-protocol.js","sourceRoot":"","sources":["../../../../src/node/crypto/keygen/keygen-protocol.ts"],"names":[],"mappings":";;;AAAa,QAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './password-protocol';
2
+ export * from './password-encoder';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/node/crypto/password/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./password-protocol"), exports);
18
+ __exportStar(require("./password-encoder"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/node/crypto/password/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC;AACpC,qDAAmC"}
@@ -0,0 +1,9 @@
1
+ import { PasswordEncoder } from './password-protocol';
2
+ export declare class Pbkdf2PasswordEncoder implements PasswordEncoder {
3
+ protected readonly options: any;
4
+ encode(rawPassword: string): Promise<string>;
5
+ protected doEncode(rawPassword: string, salt: string): string;
6
+ matches(rawPassword: string, encodedPassword: string): Promise<boolean>;
7
+ protected doDecode(encoded: string): string;
8
+ }
9
+ //# sourceMappingURL=password-encoder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"password-encoder.d.ts","sourceRoot":"","sources":["../../../../src/node/crypto/password/password-encoder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAItD,qBACa,qBAAsB,YAAW,eAAe;IAGzD,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC;IAE1B,MAAM,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAUlD,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM;IAKvD,OAAO,CAAC,WAAW,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAM7E,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;CAO9C"}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.Pbkdf2PasswordEncoder = void 0;
13
+ const password_protocol_1 = require("./password-protocol");
14
+ const crypto_js_1 = require("crypto-js");
15
+ const core_1 = require("@celljs/core");
16
+ let Pbkdf2PasswordEncoder = class Pbkdf2PasswordEncoder {
17
+ async encode(rawPassword) {
18
+ const { encodeHashAsBase64 } = this.options;
19
+ const salt = crypto_js_1.lib.WordArray.random(8);
20
+ const encoded = this.doEncode(rawPassword, salt.toString());
21
+ if (encodeHashAsBase64) {
22
+ return crypto_js_1.enc.Base64.stringify(crypto_js_1.enc.Utf8.parse(encoded));
23
+ }
24
+ return encoded;
25
+ }
26
+ doEncode(rawPassword, salt) {
27
+ const { secret } = this.options;
28
+ return salt + (0, crypto_js_1.PBKDF2)(rawPassword, salt + secret, this.options).toString();
29
+ }
30
+ async matches(rawPassword, encodedPassword) {
31
+ const digested = this.doDecode(encodedPassword);
32
+ const salt = digested.substring(0, 16);
33
+ return digested === this.doEncode(rawPassword, salt);
34
+ }
35
+ doDecode(encoded) {
36
+ const { encodeHashAsBase64 } = this.options;
37
+ if (encodeHashAsBase64) {
38
+ return crypto_js_1.enc.Base64.parse(encoded).toString(crypto_js_1.enc.Utf8);
39
+ }
40
+ return encoded;
41
+ }
42
+ };
43
+ __decorate([
44
+ (0, core_1.Value)('cell.security.passwordEncoder'),
45
+ __metadata("design:type", Object)
46
+ ], Pbkdf2PasswordEncoder.prototype, "options", void 0);
47
+ Pbkdf2PasswordEncoder = __decorate([
48
+ (0, core_1.Component)(password_protocol_1.PasswordEncoder)
49
+ ], Pbkdf2PasswordEncoder);
50
+ exports.Pbkdf2PasswordEncoder = Pbkdf2PasswordEncoder;
51
+ //# sourceMappingURL=password-encoder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"password-encoder.js","sourceRoot":"","sources":["../../../../src/node/crypto/password/password-encoder.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2DAAsD;AACtD,yCAA4C;AAC5C,uCAAgD;AAGzC,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAK9B,KAAK,CAAC,MAAM,CAAC,WAAmB;QAC5B,MAAM,EAAE,kBAAkB,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5C,MAAM,IAAI,GAAG,eAAG,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACrC,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC5D,IAAI,kBAAkB,EAAE;YACpB,OAAO,eAAG,CAAC,MAAM,CAAC,SAAS,CAAC,eAAG,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;SACxD;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;IAES,QAAQ,CAAC,WAAmB,EAAE,IAAY;QAChD,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC;QAChC,OAAO,IAAI,GAAG,IAAA,kBAAM,EAAC,WAAW,EAAE,IAAI,GAAG,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC9E,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,WAAmB,EAAE,eAAuB;QACtD,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;QAChD,MAAM,IAAI,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACvC,OAAO,QAAQ,KAAK,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;IACzD,CAAC;IAES,QAAQ,CAAC,OAAe;QAC9B,MAAM,EAAE,kBAAkB,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5C,IAAI,kBAAkB,EAAE;YACpB,OAAO,eAAG,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,eAAG,CAAC,IAAI,CAAC,CAAC;SACvD;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ,CAAA;AA/BG;IAAC,IAAA,YAAK,EAAC,+BAA+B,CAAC;;sDACP;AAHvB,qBAAqB;IADjC,IAAA,gBAAS,EAAC,mCAAe,CAAC;GACd,qBAAqB,CAiCjC;AAjCY,sDAAqB"}
@@ -0,0 +1,6 @@
1
+ export declare const PasswordEncoder: unique symbol;
2
+ export interface PasswordEncoder {
3
+ encode(rawPassword: string): Promise<string>;
4
+ matches(rawPassword: string, encodedPassword: string): Promise<boolean>;
5
+ }
6
+ //# sourceMappingURL=password-protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"password-protocol.d.ts","sourceRoot":"","sources":["../../../../src/node/crypto/password/password-protocol.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,eAA4B,CAAC;AAEzD,MAAM,WAAW,eAAe;IAC5B,MAAM,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7C,OAAO,CAAC,WAAW,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC3E"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PasswordEncoder = void 0;
4
+ exports.PasswordEncoder = Symbol('PasswordEncoder');
5
+ //# sourceMappingURL=password-protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"password-protocol.js","sourceRoot":"","sources":["../../../../src/node/crypto/password/password-protocol.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { AuthenticationError, AccessDeniedError } from './error';
2
+ import { ErrorHandler, Context, RedirectStrategy } from '@celljs/web/lib/node';
3
+ import { RequestCache } from '../cache';
4
+ export declare class AuthenticationErrorHandler implements ErrorHandler {
5
+ readonly priority: number;
6
+ protected realm: string;
7
+ protected readonly baseEnabled: boolean;
8
+ protected loginPage: string;
9
+ protected readonly redirectStrategy: RedirectStrategy;
10
+ protected readonly requestCache: RequestCache;
11
+ canHandle(ctx: Context, err: Error): Promise<boolean>;
12
+ handle(ctx: Context, err: AuthenticationError): Promise<void>;
13
+ }
14
+ export declare class AccessDeniedErrorHandler implements ErrorHandler {
15
+ readonly priority: number;
16
+ canHandle(ctx: Context, err: Error): Promise<boolean>;
17
+ handle(ctx: Context, err: AccessDeniedError): Promise<void>;
18
+ }
19
+ //# sourceMappingURL=error-handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-handler.d.ts","sourceRoot":"","sources":["../../../src/node/error/error-handler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAG/E,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,qBACa,0BAA2B,YAAW,YAAY;IAC3D,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAyC;IAGlE,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC;IAGxB,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAGxC,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC;IAG5B,SAAS,CAAC,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAGtD,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IAE9C,SAAS,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC;IAI/C,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;CAatE;AAED,qBACa,wBAAyB,YAAW,YAAY;IACzD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAwC;IAEjE,SAAS,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC;IAI/C,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;CAIpE"}