@celljs/security 3.7.8 → 3.9.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 (293) hide show
  1. package/esm/browser/index.d.ts +1 -0
  2. package/esm/browser/index.js +2 -0
  3. package/esm/browser/index.js.map +1 -0
  4. package/esm/browser/module.d.ts +3 -0
  5. package/esm/browser/module.js +4 -0
  6. package/esm/browser/module.js.map +1 -0
  7. package/esm/browser/user/index.d.ts +2 -0
  8. package/esm/browser/user/index.js +3 -0
  9. package/esm/browser/user/index.js.map +1 -0
  10. package/esm/browser/user/user-manager.d.ts +22 -0
  11. package/esm/browser/user/user-manager.js +122 -0
  12. package/esm/browser/user/user-manager.js.map +1 -0
  13. package/esm/browser/user/user-protocol.d.ts +9 -0
  14. package/esm/browser/user/user-protocol.js +2 -0
  15. package/esm/browser/user/user-protocol.js.map +1 -0
  16. package/esm/common/index.d.ts +1 -0
  17. package/esm/common/index.js +2 -0
  18. package/esm/common/index.js.map +1 -0
  19. package/esm/common/security-protocol.d.ts +59 -0
  20. package/esm/common/security-protocol.js +30 -0
  21. package/esm/common/security-protocol.js.map +1 -0
  22. package/esm/node/access/access-decision-manager.d.ts +8 -0
  23. package/esm/node/access/access-decision-manager.js +53 -0
  24. package/esm/node/access/access-decision-manager.js.map +1 -0
  25. package/esm/node/access/access-decision-utils.d.ts +4 -0
  26. package/esm/node/access/access-decision-utils.js +20 -0
  27. package/esm/node/access/access-decision-utils.js.map +1 -0
  28. package/esm/node/access/access-decision-voter.d.ts +13 -0
  29. package/esm/node/access/access-decision-voter.js +83 -0
  30. package/esm/node/access/access-decision-voter.js.map +1 -0
  31. package/esm/node/access/access-protocol.d.ts +74 -0
  32. package/esm/node/access/access-protocol.js +17 -0
  33. package/esm/node/access/access-protocol.js.map +1 -0
  34. package/esm/node/access/action-name-resolver.d.ts +4 -0
  35. package/esm/node/access/action-name-resolver.js +27 -0
  36. package/esm/node/access/action-name-resolver.js.map +1 -0
  37. package/esm/node/access/index.d.ts +11 -0
  38. package/esm/node/access/index.js +12 -0
  39. package/esm/node/access/index.js.map +1 -0
  40. package/esm/node/access/jexl-engine-provider.d.ts +5 -0
  41. package/esm/node/access/jexl-engine-provider.js +22 -0
  42. package/esm/node/access/jexl-engine-provider.js.map +1 -0
  43. package/esm/node/access/method-advice.d.ts +16 -0
  44. package/esm/node/access/method-advice.js +78 -0
  45. package/esm/node/access/method-advice.js.map +1 -0
  46. package/esm/node/access/policy-provider.d.ts +16 -0
  47. package/esm/node/access/policy-provider.js +82 -0
  48. package/esm/node/access/policy-provider.js.map +1 -0
  49. package/esm/node/access/policy-resolver.d.ts +14 -0
  50. package/esm/node/access/policy-resolver.js +88 -0
  51. package/esm/node/access/policy-resolver.js.map +1 -0
  52. package/esm/node/access/resource-name-resolver.d.ts +6 -0
  53. package/esm/node/access/resource-name-resolver.js +55 -0
  54. package/esm/node/access/resource-name-resolver.js.map +1 -0
  55. package/esm/node/access/security-metadata-source.d.ts +6 -0
  56. package/esm/node/access/security-metadata-source.js +58 -0
  57. package/esm/node/access/security-metadata-source.js.map +1 -0
  58. package/esm/node/annotation/action.d.ts +1 -0
  59. package/esm/node/annotation/action.js +7 -0
  60. package/esm/node/annotation/action.js.map +1 -0
  61. package/esm/node/annotation/anonymous.d.ts +1 -0
  62. package/esm/node/annotation/anonymous.js +6 -0
  63. package/esm/node/annotation/anonymous.js.map +1 -0
  64. package/esm/node/annotation/authenticated.d.ts +1 -0
  65. package/esm/node/annotation/authenticated.js +6 -0
  66. package/esm/node/annotation/authenticated.js.map +1 -0
  67. package/esm/node/annotation/authorize.d.ts +10 -0
  68. package/esm/node/annotation/authorize.js +35 -0
  69. package/esm/node/annotation/authorize.js.map +1 -0
  70. package/esm/node/annotation/index.d.ts +7 -0
  71. package/esm/node/annotation/index.js +8 -0
  72. package/esm/node/annotation/index.js.map +1 -0
  73. package/esm/node/annotation/post-authorize.d.ts +1 -0
  74. package/esm/node/annotation/post-authorize.js +6 -0
  75. package/esm/node/annotation/post-authorize.js.map +1 -0
  76. package/esm/node/annotation/pre-authorize.d.ts +1 -0
  77. package/esm/node/annotation/pre-authorize.js +6 -0
  78. package/esm/node/annotation/pre-authorize.js.map +1 -0
  79. package/esm/node/annotation/resource.d.ts +1 -0
  80. package/esm/node/annotation/resource.js +12 -0
  81. package/esm/node/annotation/resource.js.map +1 -0
  82. package/esm/node/authentication/authentication-manager.d.ts +9 -0
  83. package/esm/node/authentication/authentication-manager.js +78 -0
  84. package/esm/node/authentication/authentication-manager.js.map +1 -0
  85. package/esm/node/authentication/authentication-middleware.d.ts +7 -0
  86. package/esm/node/authentication/authentication-middleware.js +33 -0
  87. package/esm/node/authentication/authentication-middleware.js.map +1 -0
  88. package/esm/node/authentication/authentication-protocol.d.ts +29 -0
  89. package/esm/node/authentication/authentication-protocol.js +9 -0
  90. package/esm/node/authentication/authentication-protocol.js.map +1 -0
  91. package/esm/node/authentication/authentication-provider.d.ts +32 -0
  92. package/esm/node/authentication/authentication-provider.js +171 -0
  93. package/esm/node/authentication/authentication-provider.js.map +1 -0
  94. package/esm/node/authentication/authentication-success-handler.d.ts +15 -0
  95. package/esm/node/authentication/authentication-success-handler.js +94 -0
  96. package/esm/node/authentication/authentication-success-handler.js.map +1 -0
  97. package/esm/node/authentication/index.d.ts +5 -0
  98. package/esm/node/authentication/index.js +6 -0
  99. package/esm/node/authentication/index.js.map +1 -0
  100. package/esm/node/cache/cache-protocol.d.ts +15 -0
  101. package/esm/node/cache/cache-protocol.js +3 -0
  102. package/esm/node/cache/cache-protocol.js.map +1 -0
  103. package/esm/node/cache/index.d.ts +2 -0
  104. package/esm/node/cache/index.js +3 -0
  105. package/esm/node/cache/index.js.map +1 -0
  106. package/esm/node/cache/request-cache.d.ts +9 -0
  107. package/esm/node/cache/request-cache.js +49 -0
  108. package/esm/node/cache/request-cache.js.map +1 -0
  109. package/esm/node/constants.d.ts +5 -0
  110. package/esm/node/constants.js +6 -0
  111. package/esm/node/constants.js.map +1 -0
  112. package/esm/node/context/context-protocol.d.ts +21 -0
  113. package/esm/node/context/context-protocol.js +27 -0
  114. package/esm/node/context/context-protocol.js.map +1 -0
  115. package/esm/node/context/index.d.ts +4 -0
  116. package/esm/node/context/index.js +5 -0
  117. package/esm/node/context/index.js.map +1 -0
  118. package/esm/node/context/security-context-middleware.d.ts +8 -0
  119. package/esm/node/context/security-context-middleware.js +41 -0
  120. package/esm/node/context/security-context-middleware.js.map +1 -0
  121. package/esm/node/context/security-context-store.d.ts +7 -0
  122. package/esm/node/context/security-context-store.js +37 -0
  123. package/esm/node/context/security-context-store.js.map +1 -0
  124. package/esm/node/context/security-context-strategy.d.ts +8 -0
  125. package/esm/node/context/security-context-strategy.js +28 -0
  126. package/esm/node/context/security-context-strategy.js.map +1 -0
  127. package/esm/node/crypto/index.d.ts +2 -0
  128. package/esm/node/crypto/index.js +3 -0
  129. package/esm/node/crypto/index.js.map +1 -0
  130. package/esm/node/crypto/keygen/base64-string-key-generator.d.ts +5 -0
  131. package/esm/node/crypto/keygen/base64-string-key-generator.js +28 -0
  132. package/esm/node/crypto/keygen/base64-string-key-generator.js.map +1 -0
  133. package/esm/node/crypto/keygen/index.d.ts +2 -0
  134. package/esm/node/crypto/keygen/index.js +3 -0
  135. package/esm/node/crypto/keygen/index.js.map +1 -0
  136. package/esm/node/crypto/keygen/keygen-protocol.d.ts +4 -0
  137. package/esm/node/crypto/keygen/keygen-protocol.js +2 -0
  138. package/esm/node/crypto/keygen/keygen-protocol.js.map +1 -0
  139. package/esm/node/crypto/password/index.d.ts +2 -0
  140. package/esm/node/crypto/password/index.js +3 -0
  141. package/esm/node/crypto/password/index.js.map +1 -0
  142. package/esm/node/crypto/password/password-encoder.d.ts +8 -0
  143. package/esm/node/crypto/password/password-encoder.js +49 -0
  144. package/esm/node/crypto/password/password-encoder.js.map +1 -0
  145. package/esm/node/crypto/password/password-protocol.d.ts +5 -0
  146. package/esm/node/crypto/password/password-protocol.js +2 -0
  147. package/esm/node/crypto/password/password-protocol.js.map +1 -0
  148. package/esm/node/error/error-handler.d.ts +18 -0
  149. package/esm/node/error/error-handler.js +78 -0
  150. package/esm/node/error/error-handler.js.map +1 -0
  151. package/esm/node/error/error-protocol.d.ts +2 -0
  152. package/esm/node/error/error-protocol.js +4 -0
  153. package/esm/node/error/error-protocol.js.map +1 -0
  154. package/esm/node/error/error.d.ts +20 -0
  155. package/esm/node/error/error.js +23 -0
  156. package/esm/node/error/error.js.map +1 -0
  157. package/esm/node/error/index.d.ts +3 -0
  158. package/esm/node/error/index.js +4 -0
  159. package/esm/node/error/index.js.map +1 -0
  160. package/esm/node/index.d.ts +10 -0
  161. package/esm/node/index.js +11 -0
  162. package/esm/node/index.js.map +1 -0
  163. package/esm/node/logout/index.d.ts +4 -0
  164. package/esm/node/logout/index.js +5 -0
  165. package/esm/node/logout/index.js.map +1 -0
  166. package/esm/node/logout/logout-handler.d.ts +4 -0
  167. package/esm/node/logout/logout-handler.js +19 -0
  168. package/esm/node/logout/logout-handler.js.map +1 -0
  169. package/esm/node/logout/logout-middleware.d.ts +15 -0
  170. package/esm/node/logout/logout-middleware.js +63 -0
  171. package/esm/node/logout/logout-middleware.js.map +1 -0
  172. package/esm/node/logout/logout-protocol.d.ts +11 -0
  173. package/esm/node/logout/logout-protocol.js +6 -0
  174. package/esm/node/logout/logout-protocol.js.map +1 -0
  175. package/esm/node/logout/logout-success-handler-provider.d.ts +7 -0
  176. package/esm/node/logout/logout-success-handler-provider.js +32 -0
  177. package/esm/node/logout/logout-success-handler-provider.js.map +1 -0
  178. package/esm/node/logout/logout-success-handler.d.ts +8 -0
  179. package/esm/node/logout/logout-success-handler.js +36 -0
  180. package/esm/node/logout/logout-success-handler.js.map +1 -0
  181. package/esm/node/module.d.ts +4 -0
  182. package/esm/node/module.js +5 -0
  183. package/esm/node/module.js.map +1 -0
  184. package/esm/node/user/index.d.ts +5 -0
  185. package/esm/node/user/index.js +6 -0
  186. package/esm/node/user/index.js.map +1 -0
  187. package/esm/node/user/user-checker.d.ts +7 -0
  188. package/esm/node/user/user-checker.js +41 -0
  189. package/esm/node/user/user-checker.js.map +1 -0
  190. package/esm/node/user/user-mapper.d.ts +8 -0
  191. package/esm/node/user/user-mapper.js +37 -0
  192. package/esm/node/user/user-mapper.js.map +1 -0
  193. package/esm/node/user/user-middleware.d.ts +10 -0
  194. package/esm/node/user/user-middleware.js +52 -0
  195. package/esm/node/user/user-middleware.js.map +1 -0
  196. package/esm/node/user/user-protocol.d.ts +14 -0
  197. package/esm/node/user/user-protocol.js +6 -0
  198. package/esm/node/user/user-protocol.js.map +1 -0
  199. package/esm/node/user/user-service.d.ts +6 -0
  200. package/esm/node/user/user-service.js +39 -0
  201. package/esm/node/user/user-service.js.map +1 -0
  202. package/esm/package.json +3 -0
  203. package/lib/browser/module.d.ts.map +1 -1
  204. package/lib/browser/module.js.map +1 -1
  205. package/lib/browser/user/user-manager.d.ts.map +1 -1
  206. package/lib/browser/user/user-manager.js.map +1 -1
  207. package/lib/common/security-protocol.js.map +1 -1
  208. package/lib/node/access/access-decision-manager.d.ts.map +1 -1
  209. package/lib/node/access/access-decision-manager.js.map +1 -1
  210. package/lib/node/access/access-decision-utils.js.map +1 -1
  211. package/lib/node/access/access-decision-voter.d.ts.map +1 -1
  212. package/lib/node/access/access-decision-voter.js.map +1 -1
  213. package/lib/node/access/access-protocol.js.map +1 -1
  214. package/lib/node/access/action-name-resolver.d.ts.map +1 -1
  215. package/lib/node/access/action-name-resolver.js.map +1 -1
  216. package/lib/node/access/jexl-engine-provider.d.ts.map +1 -1
  217. package/lib/node/access/jexl-engine-provider.js.map +1 -1
  218. package/lib/node/access/method-advice.d.ts.map +1 -1
  219. package/lib/node/access/method-advice.js.map +1 -1
  220. package/lib/node/access/policy-provider.d.ts.map +1 -1
  221. package/lib/node/access/policy-provider.js.map +1 -1
  222. package/lib/node/access/policy-resolver.d.ts +1 -1
  223. package/lib/node/access/policy-resolver.d.ts.map +1 -1
  224. package/lib/node/access/policy-resolver.js.map +1 -1
  225. package/lib/node/access/resource-name-resolver.d.ts.map +1 -1
  226. package/lib/node/access/resource-name-resolver.js.map +1 -1
  227. package/lib/node/access/security-metadata-source.d.ts.map +1 -1
  228. package/lib/node/access/security-metadata-source.js.map +1 -1
  229. package/lib/node/annotation/action.d.ts.map +1 -1
  230. package/lib/node/annotation/action.js.map +1 -1
  231. package/lib/node/annotation/anonymous.js.map +1 -1
  232. package/lib/node/annotation/authenticated.js.map +1 -1
  233. package/lib/node/annotation/authorize.d.ts.map +1 -1
  234. package/lib/node/annotation/authorize.js.map +1 -1
  235. package/lib/node/annotation/post-authorize.d.ts.map +1 -1
  236. package/lib/node/annotation/post-authorize.js.map +1 -1
  237. package/lib/node/annotation/pre-authorize.d.ts.map +1 -1
  238. package/lib/node/annotation/pre-authorize.js.map +1 -1
  239. package/lib/node/annotation/resource.d.ts.map +1 -1
  240. package/lib/node/annotation/resource.js.map +1 -1
  241. package/lib/node/authentication/authentication-manager.d.ts.map +1 -1
  242. package/lib/node/authentication/authentication-manager.js.map +1 -1
  243. package/lib/node/authentication/authentication-middleware.d.ts.map +1 -1
  244. package/lib/node/authentication/authentication-middleware.js.map +1 -1
  245. package/lib/node/authentication/authentication-protocol.js.map +1 -1
  246. package/lib/node/authentication/authentication-provider.d.ts.map +1 -1
  247. package/lib/node/authentication/authentication-provider.js.map +1 -1
  248. package/lib/node/authentication/authentication-success-handler.d.ts.map +1 -1
  249. package/lib/node/authentication/authentication-success-handler.js.map +1 -1
  250. package/lib/node/cache/request-cache.d.ts.map +1 -1
  251. package/lib/node/cache/request-cache.js +34 -1
  252. package/lib/node/cache/request-cache.js.map +1 -1
  253. package/lib/node/constants.d.ts.map +1 -1
  254. package/lib/node/context/context-protocol.js.map +1 -1
  255. package/lib/node/context/security-context-middleware.d.ts.map +1 -1
  256. package/lib/node/context/security-context-middleware.js.map +1 -1
  257. package/lib/node/context/security-context-store.d.ts.map +1 -1
  258. package/lib/node/context/security-context-store.js.map +1 -1
  259. package/lib/node/context/security-context-strategy.d.ts.map +1 -1
  260. package/lib/node/context/security-context-strategy.js.map +1 -1
  261. package/lib/node/crypto/keygen/base64-string-key-generator.d.ts.map +1 -1
  262. package/lib/node/crypto/keygen/base64-string-key-generator.js.map +1 -1
  263. package/lib/node/crypto/password/password-encoder.d.ts.map +1 -1
  264. package/lib/node/crypto/password/password-encoder.js.map +1 -1
  265. package/lib/node/error/error-handler.d.ts.map +1 -1
  266. package/lib/node/error/error-handler.js.map +1 -1
  267. package/lib/node/error/error-protocol.js.map +1 -1
  268. package/lib/node/error/error.d.ts.map +1 -1
  269. package/lib/node/error/error.js.map +1 -1
  270. package/lib/node/logout/logout-handler.d.ts.map +1 -1
  271. package/lib/node/logout/logout-handler.js.map +1 -1
  272. package/lib/node/logout/logout-middleware.d.ts.map +1 -1
  273. package/lib/node/logout/logout-middleware.js.map +1 -1
  274. package/lib/node/logout/logout-success-handler-provider.d.ts.map +1 -1
  275. package/lib/node/logout/logout-success-handler-provider.js.map +1 -1
  276. package/lib/node/logout/logout-success-handler.d.ts.map +1 -1
  277. package/lib/node/logout/logout-success-handler.js.map +1 -1
  278. package/lib/node/module.d.ts.map +1 -1
  279. package/lib/node/module.js.map +1 -1
  280. package/lib/node/user/user-checker.d.ts.map +1 -1
  281. package/lib/node/user/user-checker.js.map +1 -1
  282. package/lib/node/user/user-mapper.d.ts.map +1 -1
  283. package/lib/node/user/user-mapper.js.map +1 -1
  284. package/lib/node/user/user-middleware.d.ts.map +1 -1
  285. package/lib/node/user/user-middleware.js.map +1 -1
  286. package/lib/node/user/user-service.d.ts.map +1 -1
  287. package/lib/node/user/user-service.js.map +1 -1
  288. package/lib/package.spec.d.ts +1 -0
  289. package/lib/package.spec.js +5 -2
  290. package/lib/package.spec.js.map +1 -1
  291. package/package.json +103 -11
  292. package/src/package.spec.ts +1 -0
  293. package/LICENSE +0 -21
@@ -0,0 +1,5 @@
1
+ export * from './authentication-protocol.js';
2
+ export * from './authentication-manager.js';
3
+ export * from './authentication-provider.js';
4
+ export * from './authentication-middleware.js';
5
+ export * from './authentication-success-handler.js';
@@ -0,0 +1,6 @@
1
+ export * from './authentication-protocol.js';
2
+ export * from './authentication-manager.js';
3
+ export * from './authentication-provider.js';
4
+ export * from './authentication-middleware.js';
5
+ export * from './authentication-success-handler.js';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/node/authentication/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kCAAkC,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { HttpMethod } from '@celljs/http';
2
+ export declare const RequestCache: unique symbol;
3
+ export declare const SAVED_REQUEST = "CELL_SECURITY_SAVED_REQUEST";
4
+ export interface SavedRequest {
5
+ redirectUrl: string;
6
+ method: HttpMethod;
7
+ query: {
8
+ [key: string]: string;
9
+ };
10
+ }
11
+ export interface RequestCache {
12
+ save(savedRequest?: SavedRequest): Promise<void>;
13
+ get(): Promise<SavedRequest | undefined>;
14
+ remove(): Promise<void>;
15
+ }
@@ -0,0 +1,3 @@
1
+ export const RequestCache = Symbol('RequestCache');
2
+ export const SAVED_REQUEST = 'CELL_SECURITY_SAVED_REQUEST';
3
+ //# sourceMappingURL=cache-protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache-protocol.js","sourceRoot":"","sources":["../../../src/node/cache/cache-protocol.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AACnD,MAAM,CAAC,MAAM,aAAa,GAAG,6BAA6B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './cache-protocol.js';
2
+ export * from './request-cache.js';
@@ -0,0 +1,3 @@
1
+ export * from './cache-protocol.js';
2
+ export * from './request-cache.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/node/cache/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { RequestCache, SavedRequest } from './cache-protocol.js';
2
+ import { PathResolver } from '@celljs/web';
3
+ export declare class HttpSessionRequestCache implements RequestCache {
4
+ protected readonly endpoint: string;
5
+ protected readonly pathResolver: PathResolver;
6
+ save(savedRequest?: SavedRequest): Promise<void>;
7
+ get(): Promise<SavedRequest | undefined>;
8
+ remove(): Promise<void>;
9
+ }
@@ -0,0 +1,49 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ 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;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { RequestCache, SAVED_REQUEST } from './cache-protocol.js';
11
+ import { AttributeScope, Context } from '@celljs/web/lib/node';
12
+ import { Component, Value, Autowired } from '@celljs/core';
13
+ import { ENDPOINT, PathResolver } from '@celljs/web';
14
+ import * as qs from 'qs';
15
+ let HttpSessionRequestCache = class HttpSessionRequestCache {
16
+ async save(savedRequest) {
17
+ if (Context.getSession()) {
18
+ const request = Context.getRequest();
19
+ Context.setAttr(SAVED_REQUEST, savedRequest || {
20
+ redirectUrl: await this.pathResolver.resolve(this.endpoint, request.path, qs.stringify(request.query)),
21
+ method: request.method.toUpperCase(),
22
+ query: { ...request.query }
23
+ }, AttributeScope.Session);
24
+ }
25
+ }
26
+ async get() {
27
+ if (Context.getSession()) {
28
+ return Context.getAttr(SAVED_REQUEST, AttributeScope.Session);
29
+ }
30
+ }
31
+ async remove() {
32
+ if (Context.getSession()) {
33
+ Context.setAttr(SAVED_REQUEST, undefined, AttributeScope.Session);
34
+ }
35
+ }
36
+ };
37
+ __decorate([
38
+ Value(ENDPOINT),
39
+ __metadata("design:type", String)
40
+ ], HttpSessionRequestCache.prototype, "endpoint", void 0);
41
+ __decorate([
42
+ Autowired(PathResolver),
43
+ __metadata("design:type", Object)
44
+ ], HttpSessionRequestCache.prototype, "pathResolver", void 0);
45
+ HttpSessionRequestCache = __decorate([
46
+ Component(RequestCache)
47
+ ], HttpSessionRequestCache);
48
+ export { HttpSessionRequestCache };
49
+ //# sourceMappingURL=request-cache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-cache.js","sourceRoot":"","sources":["../../../src/node/cache/request-cache.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,YAAY,EAAgB,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAGlB,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAQhC,KAAK,CAAC,IAAI,CAAC,YAA2B;QAClC,IAAI,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;YACvB,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;YACrC,OAAO,CAAC,OAAO,CAAC,aAAa,EAAE,YAAY,IAAI;gBAC3C,WAAW,EAAE,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;gBACtG,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE;gBACpC,KAAK,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,EAAE;aAC9B,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;QAC/B,CAAC;IACL,CAAC;IACD,KAAK,CAAC,GAAG;QACL,IAAI,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;YACvB,OAAO,OAAO,CAAC,OAAO,CAAe,aAAa,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;QAChF,CAAC;IACL,CAAC;IAED,KAAK,CAAC,MAAM;QACR,IAAI,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;YACvB,OAAO,CAAC,OAAO,CAAC,aAAa,EAAE,SAAS,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;QACtE,CAAC;IACL,CAAC;CAEJ,CAAA;AA3BsB;IADlB,KAAK,CAAC,QAAQ,CAAC;;yDACoB;AAGjB;IADlB,SAAS,CAAC,YAAY,CAAC;;6DACsB;AANrC,uBAAuB;IADnC,SAAS,CAAC,YAAY,CAAC;GACX,uBAAuB,CA8BnC"}
@@ -0,0 +1,5 @@
1
+ export declare const METADATA_KEY: {
2
+ authorize: string;
3
+ resource: string;
4
+ action: string;
5
+ };
@@ -0,0 +1,6 @@
1
+ export const METADATA_KEY = {
2
+ authorize: 'cell:authorize',
3
+ resource: 'cell:resource',
4
+ action: 'cell:atcion'
5
+ };
6
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/node/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG;IACxB,SAAS,EAAE,gBAAgB;IAC3B,QAAQ,EAAE,eAAe;IACzB,MAAM,EAAE,aAAa;CACxB,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { Authentication } from '../authentication/index.js';
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
+ }
@@ -0,0 +1,27 @@
1
+ import { Context } from '@celljs/web/lib/node';
2
+ import { SESSION_MIDDLEWARE_PRIORITY } from '@celljs/web/lib/node/session/session-protocol';
3
+ import { AttributeScope } from '@celljs/core/lib/node';
4
+ export const SECURITY_CONTEXT_MIDDLEWARE_PRIORITY = SESSION_MIDDLEWARE_PRIORITY - 100;
5
+ export const CURRENT_SECURITY_CONTEXT_REQUEST_KEY = 'CurrentSecurityContextRequest';
6
+ export const SecurityContextStore = Symbol('SecurityContextStore');
7
+ export const SecurityContextStrategy = Symbol('SecurityContextStrategy');
8
+ export var SecurityContext;
9
+ (function (SecurityContext) {
10
+ function setCurrent(context) {
11
+ Context.setAttr(CURRENT_SECURITY_CONTEXT_REQUEST_KEY, context);
12
+ }
13
+ SecurityContext.setCurrent = setCurrent;
14
+ function getCurrent() {
15
+ return Context.getAttr(CURRENT_SECURITY_CONTEXT_REQUEST_KEY, AttributeScope.Request);
16
+ }
17
+ SecurityContext.getCurrent = getCurrent;
18
+ function getAuthentication() {
19
+ return getCurrent().authentication;
20
+ }
21
+ SecurityContext.getAuthentication = getAuthentication;
22
+ function setAuthentication(authentication) {
23
+ getCurrent().authentication = authentication;
24
+ }
25
+ SecurityContext.setAuthentication = setAuthentication;
26
+ })(SecurityContext || (SecurityContext = {}));
27
+ //# 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,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,OAAO,EAAE,2BAA2B,EAAE,MAAM,+CAA+C,CAAC;AAC5F,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,MAAM,CAAC,MAAM,oCAAoC,GAAG,2BAA2B,GAAG,GAAG,CAAC;AACtF,MAAM,CAAC,MAAM,oCAAoC,GAAG,+BAA+B,CAAC;AAEpF,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,sBAAsB,CAAC,CAAC;AACnE,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,yBAAyB,CAAC,CAAC;AAezE,MAAM,KAAW,eAAe,CAkB/B;AAlBD,WAAiB,eAAe;IAE5B,SAAgB,UAAU,CAAC,OAAoC;QAC3D,OAAO,CAAC,OAAO,CAAC,oCAAoC,EAAE,OAAO,CAAC,CAAC;IACnE,CAAC;IAFe,gBAAA,UAAU,aAEzB,CAAA;IAED,SAAgB,UAAU;QACtB,OAAO,OAAO,CAAC,OAAO,CAAC,oCAAoC,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;IACzF,CAAC;IAFe,gBAAA,UAAU,aAEzB,CAAA;IAED,SAAgB,iBAAiB;QAC7B,OAAO,UAAU,EAAE,CAAC,cAAc,CAAC;IACvC,CAAC;IAFe,gBAAA,iBAAiB,oBAEhC,CAAA;IAED,SAAgB,iBAAiB,CAAC,cAA8B;QAC5D,UAAU,EAAE,CAAC,cAAc,GAAG,cAAc,CAAC;IACjD,CAAC;IAFe,gBAAA,iBAAiB,oBAEhC,CAAA;AAEL,CAAC,EAlBgB,eAAe,KAAf,eAAe,QAkB/B"}
@@ -0,0 +1,4 @@
1
+ export * from './context-protocol.js';
2
+ export * from './security-context-middleware.js';
3
+ export * from './security-context-store.js';
4
+ export * from './security-context-strategy.js';
@@ -0,0 +1,5 @@
1
+ export * from './context-protocol.js';
2
+ export * from './security-context-middleware.js';
3
+ export * from './security-context-store.js';
4
+ export * from './security-context-strategy.js';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","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,8 @@
1
+ import { Middleware, Context } from '@celljs/web/lib/node';
2
+ import { SecurityContextStore } from './context-protocol.js';
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
+ }
@@ -0,0 +1,41 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ 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;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { Middleware, Context } from '@celljs/web/lib/node';
11
+ import { Component, Value, Autowired } from '@celljs/core';
12
+ import { SecurityContextStore, SecurityContext, SECURITY_CONTEXT_MIDDLEWARE_PRIORITY } from './context-protocol.js';
13
+ let SecurityContextMiddleWare = class SecurityContextMiddleWare {
14
+ constructor() {
15
+ this.priority = SECURITY_CONTEXT_MIDDLEWARE_PRIORITY;
16
+ }
17
+ async handle(ctx, next) {
18
+ const context = await this.securityContextStore.load();
19
+ try {
20
+ SecurityContext.setCurrent(context);
21
+ Context.setTenant(context.authentication.name);
22
+ await next();
23
+ }
24
+ finally {
25
+ await this.securityContextStore.save(SecurityContext.getCurrent());
26
+ }
27
+ }
28
+ };
29
+ __decorate([
30
+ Value('cell.security'),
31
+ __metadata("design:type", Object)
32
+ ], SecurityContextMiddleWare.prototype, "options", void 0);
33
+ __decorate([
34
+ Autowired(SecurityContextStore),
35
+ __metadata("design:type", Object)
36
+ ], SecurityContextMiddleWare.prototype, "securityContextStore", void 0);
37
+ SecurityContextMiddleWare = __decorate([
38
+ Component(Middleware)
39
+ ], SecurityContextMiddleWare);
40
+ export { SecurityContextMiddleWare };
41
+ //# 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,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,oCAAoC,EAAE,MAAM,oBAAoB,CAAC;AAG1G,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;IAA/B;QAoBM,aAAQ,GAAW,oCAAoC,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,CAAC;YACD,eAAe,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;YACpC,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;YAC/C,MAAM,IAAI,EAAE,CAAC;QACjB,CAAC;gBAAS,CAAC;YACP,MAAM,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,CAAC,CAAC;QACvE,CAAC;IACL,CAAC;CAIJ,CAAA;AAnBsB;IADlB,KAAK,CAAC,eAAe,CAAC;;0DACS;AAGb;IADlB,SAAS,CAAC,oBAAoB,CAAC;;uEAC8B;AANrD,yBAAyB;IADrC,SAAS,CAAC,UAAU,CAAC;GACT,yBAAyB,CAsBrC"}
@@ -0,0 +1,7 @@
1
+ import { SecurityContextStore, SecurityContext, SecurityContextStrategy } from './context-protocol.js';
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
+ }
@@ -0,0 +1,37 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ 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;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { Component, Value, Autowired } from '@celljs/core';
11
+ import { SecurityContextStore, SecurityContextStrategy } from './context-protocol.js';
12
+ import { Context } from '@celljs/web/lib/node';
13
+ let SessionSecurityContextStore = class SessionSecurityContextStore {
14
+ async load() {
15
+ const context = Context.getSession()[this.options.contextKey];
16
+ if (!context) {
17
+ return this.securityContextStrategy.create();
18
+ }
19
+ return context;
20
+ }
21
+ async save(context) {
22
+ Context.getSession()[this.options.contextKey] = context;
23
+ }
24
+ };
25
+ __decorate([
26
+ Value('cell.security'),
27
+ __metadata("design:type", Object)
28
+ ], SessionSecurityContextStore.prototype, "options", void 0);
29
+ __decorate([
30
+ Autowired(SecurityContextStrategy),
31
+ __metadata("design:type", Object)
32
+ ], SessionSecurityContextStore.prototype, "securityContextStrategy", void 0);
33
+ SessionSecurityContextStore = __decorate([
34
+ Component(SecurityContextStore)
35
+ ], SessionSecurityContextStore);
36
+ export { SessionSecurityContextStore };
37
+ //# 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,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAmB,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AACpG,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAGxC,IAAM,2BAA2B,GAAjC,MAAM,2BAA2B;IAQpC,KAAK,CAAC,IAAI;QACN,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAC9D,IAAI,CAAC,OAAO,EAAE,CAAC;YACX,OAAO,IAAI,CAAC,uBAAuB,CAAC,MAAM,EAAE,CAAC;QACjD,CAAC;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,OAAwB;QAC/B,OAAO,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC;IAC5D,CAAC;CAEJ,CAAA;AAhBsB;IADlB,KAAK,CAAC,eAAe,CAAC;;4DACS;AAGb;IADlB,SAAS,CAAC,uBAAuB,CAAC;;4EACiC;AAN3D,2BAA2B;IADvC,SAAS,CAAC,oBAAoB,CAAC;GACnB,2BAA2B,CAmBvC"}
@@ -0,0 +1,8 @@
1
+ import { SecurityContext, SecurityContextStrategy } from './context-protocol.js';
2
+ import { Authentication } from '../authentication/index.js';
3
+ export declare class SecurityContextImpl implements SecurityContext {
4
+ authentication: Authentication;
5
+ }
6
+ export declare class SessionSecurityContextStrategy implements SecurityContextStrategy {
7
+ create(): Promise<SecurityContext>;
8
+ }
@@ -0,0 +1,28 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ 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;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { Component } from '@celljs/core';
8
+ import { SecurityContextStrategy } from './context-protocol.js';
9
+ export class SecurityContextImpl {
10
+ }
11
+ let SessionSecurityContextStrategy = class SessionSecurityContextStrategy {
12
+ create() {
13
+ const securityContext = new SecurityContextImpl();
14
+ securityContext.authentication = {
15
+ name: 'anonymousUser',
16
+ principal: 'anonymousUser',
17
+ policies: [],
18
+ credentials: '',
19
+ authenticated: false
20
+ };
21
+ return Promise.resolve(securityContext);
22
+ }
23
+ };
24
+ SessionSecurityContextStrategy = __decorate([
25
+ Component(SecurityContextStrategy)
26
+ ], SessionSecurityContextStrategy);
27
+ export { SessionSecurityContextStrategy };
28
+ //# 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,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAmB,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAG9E,MAAM,OAAO,mBAAmB;CAE/B;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,SAAS,CAAC,uBAAuB,CAAC;GACtB,8BAA8B,CAc1C"}
@@ -0,0 +1,2 @@
1
+ export * from './keygen/index.js';
2
+ export * from './password/index.js';
@@ -0,0 +1,3 @@
1
+ export * from './keygen/index.js';
2
+ export * from './password/index.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/node/crypto/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { StringKeyGenerator } from './keygen-protocol.js';
2
+ export declare class Base64StringKeyGenerator implements StringKeyGenerator {
3
+ protected readonly keyLength: number;
4
+ generateKey(keyLength?: number): Promise<string>;
5
+ }
@@ -0,0 +1,28 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ 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;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { StringKeyGenerator } from './keygen-protocol.js';
11
+ import __cellCjs1 from 'crypto-js';
12
+ const { enc, lib } = __cellCjs1;
13
+ import { Value, Component } from '@celljs/core';
14
+ let Base64StringKeyGenerator = class Base64StringKeyGenerator {
15
+ async generateKey(keyLength) {
16
+ const key = lib.WordArray.random(keyLength || this.keyLength);
17
+ return enc.Base64.stringify(key);
18
+ }
19
+ };
20
+ __decorate([
21
+ Value('cell.security.base64StringKeyLength'),
22
+ __metadata("design:type", Number)
23
+ ], Base64StringKeyGenerator.prototype, "keyLength", void 0);
24
+ Base64StringKeyGenerator = __decorate([
25
+ Component(StringKeyGenerator)
26
+ ], Base64StringKeyGenerator);
27
+ export { Base64StringKeyGenerator };
28
+ //# 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,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IAKjC,KAAK,CAAC,WAAW,CAAC,SAAkB;QAChC,MAAM,GAAG,GAAG,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC;QAC9D,OAAO,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IACrC,CAAC;CACJ,CAAA;AANsB;IADlB,KAAK,CAAC,qCAAqC,CAAC;;2DACR;AAH5B,wBAAwB;IADpC,SAAS,CAAC,kBAAkB,CAAC;GACjB,wBAAwB,CASpC"}
@@ -0,0 +1,2 @@
1
+ export * from './keygen-protocol.js';
2
+ export * from './base64-string-key-generator.js';
@@ -0,0 +1,3 @@
1
+ export * from './keygen-protocol.js';
2
+ export * from './base64-string-key-generator.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/node/crypto/keygen/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,+BAA+B,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare const StringKeyGenerator: unique symbol;
2
+ export interface StringKeyGenerator {
3
+ generateKey(keyLength?: number): Promise<string>;
4
+ }
@@ -0,0 +1,2 @@
1
+ export const StringKeyGenerator = Symbol('StringKeyGenerator');
2
+ //# 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,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './password-protocol.js';
2
+ export * from './password-encoder.js';
@@ -0,0 +1,3 @@
1
+ export * from './password-protocol.js';
2
+ export * from './password-encoder.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/node/crypto/password/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { PasswordEncoder } from './password-protocol.js';
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
+ }
@@ -0,0 +1,49 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ 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;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { PasswordEncoder } from './password-protocol.js';
11
+ import __cellCjs0 from 'crypto-js';
12
+ const { PBKDF2, lib, enc } = __cellCjs0;
13
+ import { Value, Component } from '@celljs/core';
14
+ let Pbkdf2PasswordEncoder = class Pbkdf2PasswordEncoder {
15
+ async encode(rawPassword) {
16
+ const { encodeHashAsBase64 } = this.options;
17
+ const salt = lib.WordArray.random(8);
18
+ const encoded = this.doEncode(rawPassword, salt.toString());
19
+ if (encodeHashAsBase64) {
20
+ return enc.Base64.stringify(enc.Utf8.parse(encoded));
21
+ }
22
+ return encoded;
23
+ }
24
+ doEncode(rawPassword, salt) {
25
+ const { secret } = this.options;
26
+ return salt + PBKDF2(rawPassword, salt + secret, this.options).toString();
27
+ }
28
+ async matches(rawPassword, encodedPassword) {
29
+ const digested = this.doDecode(encodedPassword);
30
+ const salt = digested.substring(0, 16);
31
+ return digested === this.doEncode(rawPassword, salt);
32
+ }
33
+ doDecode(encoded) {
34
+ const { encodeHashAsBase64 } = this.options;
35
+ if (encodeHashAsBase64) {
36
+ return enc.Base64.parse(encoded).toString(enc.Utf8);
37
+ }
38
+ return encoded;
39
+ }
40
+ };
41
+ __decorate([
42
+ Value('cell.security.passwordEncoder'),
43
+ __metadata("design:type", Object)
44
+ ], Pbkdf2PasswordEncoder.prototype, "options", void 0);
45
+ Pbkdf2PasswordEncoder = __decorate([
46
+ Component(PasswordEncoder)
47
+ ], Pbkdf2PasswordEncoder);
48
+ export { Pbkdf2PasswordEncoder };
49
+ //# 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,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAC,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;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,GAAG,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,CAAC;YACrB,OAAO,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QACzD,CAAC;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,MAAM,CAAC,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,CAAC;YACrB,OAAO,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACxD,CAAC;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ,CAAA;AA9BsB;IADlB,KAAK,CAAC,+BAA+B,CAAC;;sDACP;AAHvB,qBAAqB;IADjC,SAAS,CAAC,eAAe,CAAC;GACd,qBAAqB,CAiCjC"}
@@ -0,0 +1,5 @@
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
+ }
@@ -0,0 +1,2 @@
1
+ export const PasswordEncoder = Symbol('PasswordEncoder');
2
+ //# 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,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { AuthenticationError, AccessDeniedError } from './error.js';
2
+ import { ErrorHandler, Context, RedirectStrategy } from '@celljs/web/lib/node';
3
+ import { RequestCache } from '../cache/index.js';
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
+ }