@celljs/security 3.8.0 → 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 (203) 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/package.json +101 -6
@@ -0,0 +1,27 @@
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 { ActionNameResolver } from './access-protocol.js';
8
+ import { Component, getOwnMetadata } from '@celljs/core';
9
+ import { METADATA_KEY } from '../constants.js';
10
+ let DefaultActionNameResolver = class DefaultActionNameResolver {
11
+ async resolve(ctx) {
12
+ const classResources = getOwnMetadata(METADATA_KEY.resource, ctx.target.constructor);
13
+ const actions = getOwnMetadata(METADATA_KEY.action, ctx.target.constructor, ctx.method);
14
+ const action = actions.length ? actions[0] : ctx.method;
15
+ if (classResources.length) {
16
+ return `${classResources[0]}:${action}`;
17
+ }
18
+ else {
19
+ return `${ctx.target.constructor.name}:${action}`;
20
+ }
21
+ }
22
+ };
23
+ DefaultActionNameResolver = __decorate([
24
+ Component(ActionNameResolver)
25
+ ], DefaultActionNameResolver);
26
+ export { DefaultActionNameResolver };
27
+ //# sourceMappingURL=action-name-resolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action-name-resolver.js","sourceRoot":"","sources":["../../../src/node/access/action-name-resolver.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAiC,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACtF,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAGrC,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;IAElC,KAAK,CAAC,OAAO,CAAC,GAAkC;QAC5C,MAAM,cAAc,GAAa,cAAc,CAAC,YAAY,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QAC/F,MAAM,OAAO,GAAa,cAAc,CAAC,YAAY,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;QAClG,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC;QACxD,IAAI,cAAc,CAAC,MAAM,EAAE,CAAC;YACxB,OAAO,GAAG,cAAc,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE,CAAC;QAC5C,CAAC;aAAM,CAAC;YACJ,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,IAAI,MAAM,EAAE,CAAC;QACtD,CAAC;IAEL,CAAC;CACJ,CAAA;AAbY,yBAAyB;IADrC,SAAS,CAAC,kBAAkB,CAAC;GACjB,yBAAyB,CAarC"}
@@ -0,0 +1,11 @@
1
+ export * from './access-decision-manager.js';
2
+ export * from './access-protocol.js';
3
+ export * from './access-decision-voter.js';
4
+ export * from './method-advice.js';
5
+ export * from './policy-provider.js';
6
+ export * from './policy-resolver.js';
7
+ export * from './security-metadata-source.js';
8
+ export * from './resource-name-resolver.js';
9
+ export * from './action-name-resolver.js';
10
+ export * from './access-decision-utils.js';
11
+ export * from './jexl-engine-provider.js';
@@ -0,0 +1,12 @@
1
+ export * from './access-decision-manager.js';
2
+ export * from './access-protocol.js';
3
+ export * from './access-decision-voter.js';
4
+ export * from './method-advice.js';
5
+ export * from './policy-provider.js';
6
+ export * from './policy-resolver.js';
7
+ export * from './security-metadata-source.js';
8
+ export * from './resource-name-resolver.js';
9
+ export * from './action-name-resolver.js';
10
+ export * from './access-decision-utils.js';
11
+ export * from './jexl-engine-provider.js';
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/node/access/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { JexlEngineProvider } from './access-protocol.js';
2
+ export declare class JexlEngineProviderImpl implements JexlEngineProvider<any> {
3
+ protected jexlEngine: any;
4
+ provide(): any;
5
+ }
@@ -0,0 +1,22 @@
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 { JexlEngineProvider } from './access-protocol.js';
9
+ import { Jexl } from 'jexl';
10
+ let JexlEngineProviderImpl = class JexlEngineProviderImpl {
11
+ provide() {
12
+ if (!this.jexlEngine) {
13
+ this.jexlEngine = new Jexl();
14
+ }
15
+ return this.jexlEngine;
16
+ }
17
+ };
18
+ JexlEngineProviderImpl = __decorate([
19
+ Component(JexlEngineProvider)
20
+ ], JexlEngineProviderImpl);
21
+ export { JexlEngineProviderImpl };
22
+ //# sourceMappingURL=jexl-engine-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jexl-engine-provider.js","sourceRoot":"","sources":["../../../src/node/access/jexl-engine-provider.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAGrB,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IAI/B,OAAO;QAEH,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;YACnB,IAAI,CAAC,UAAU,GAAG,IAAI,IAAI,EAAE,CAAC;QACjC,CAAC;QACD,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;CAEJ,CAAA;AAZY,sBAAsB;IADlC,SAAS,CAAC,kBAAkB,CAAC;GACjB,sBAAsB,CAYlC"}
@@ -0,0 +1,16 @@
1
+ import { MethodBeforeAdvice, AfterReturningAdvice } from '@celljs/core';
2
+ import { AccessDecisionManager, ResourceNameResolver, SecurityMetadataSource } from './access-protocol.js';
3
+ import { SecurityContext } from '../context/index.js';
4
+ export declare abstract class AbstractSecurityMethodAdivice {
5
+ protected readonly accessDecisionManager: AccessDecisionManager;
6
+ protected readonly securityMetadataSource: SecurityMetadataSource;
7
+ protected readonly resourceNameResolver: ResourceNameResolver;
8
+ protected readonly enabled: boolean;
9
+ protected needAccessDecision(method: string | number | symbol): false | SecurityContext;
10
+ }
11
+ export declare class SecurityMethodBeforeAdivice extends AbstractSecurityMethodAdivice implements MethodBeforeAdvice {
12
+ before(method: string | number | symbol, args: any[], target: any): Promise<void>;
13
+ }
14
+ export declare class SecurityAfterReturningAdvice extends AbstractSecurityMethodAdivice implements AfterReturningAdvice {
15
+ afterReturning(returnValue: any, method: string | number | symbol, args: any[], target: any): Promise<void>;
16
+ }
@@ -0,0 +1,78 @@
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
+ var _a;
11
+ import { MethodBeforeAdvice, Autowired, Aspect, AfterReturningAdvice, Value, ConfigUtil, Injectable } from '@celljs/core';
12
+ import { AccessDecisionManager, ResourceNameResolver, SecurityMetadataSource, SECURITY_EXPRESSION_CONTEXT_KEY } from './access-protocol.js';
13
+ import { AOP_POINTCUT } from '@celljs/web';
14
+ import { SecurityContext } from '../context/index.js';
15
+ import { AuthorizeType } from '../../common/index.js';
16
+ import { Context } from '@celljs/web/lib/node';
17
+ const pointcut = ((_a = ConfigUtil.getRaw().cell.security.aop) === null || _a === void 0 ? void 0 : _a.pointcut) || AOP_POINTCUT;
18
+ let AbstractSecurityMethodAdivice = class AbstractSecurityMethodAdivice {
19
+ needAccessDecision(method) {
20
+ return this.enabled && typeof method === 'string' && SecurityContext.getCurrent();
21
+ }
22
+ };
23
+ __decorate([
24
+ Autowired(AccessDecisionManager),
25
+ __metadata("design:type", Object)
26
+ ], AbstractSecurityMethodAdivice.prototype, "accessDecisionManager", void 0);
27
+ __decorate([
28
+ Autowired(SecurityMetadataSource),
29
+ __metadata("design:type", Object)
30
+ ], AbstractSecurityMethodAdivice.prototype, "securityMetadataSource", void 0);
31
+ __decorate([
32
+ Autowired(ResourceNameResolver),
33
+ __metadata("design:type", Object)
34
+ ], AbstractSecurityMethodAdivice.prototype, "resourceNameResolver", void 0);
35
+ __decorate([
36
+ Value('cell.security.enabled'),
37
+ __metadata("design:type", Boolean)
38
+ ], AbstractSecurityMethodAdivice.prototype, "enabled", void 0);
39
+ AbstractSecurityMethodAdivice = __decorate([
40
+ Injectable()
41
+ ], AbstractSecurityMethodAdivice);
42
+ export { AbstractSecurityMethodAdivice };
43
+ let SecurityMethodBeforeAdivice = class SecurityMethodBeforeAdivice extends AbstractSecurityMethodAdivice {
44
+ async before(method, args, target) {
45
+ if (this.needAccessDecision(method)) {
46
+ const ctx = { method: method, args, target, authorizeType: AuthorizeType.Pre, grant: 0 };
47
+ const securityMetadata = await this.securityMetadataSource.load(ctx);
48
+ const resouces = await this.resourceNameResolver.resolve(ctx);
49
+ for (const resource of resouces) {
50
+ securityMetadata.resource = resource;
51
+ await this.accessDecisionManager.decide(securityMetadata);
52
+ }
53
+ }
54
+ }
55
+ };
56
+ SecurityMethodBeforeAdivice = __decorate([
57
+ Aspect({ id: MethodBeforeAdvice, pointcut })
58
+ ], SecurityMethodBeforeAdivice);
59
+ export { SecurityMethodBeforeAdivice };
60
+ let SecurityAfterReturningAdvice = class SecurityAfterReturningAdvice extends AbstractSecurityMethodAdivice {
61
+ async afterReturning(returnValue, method, args, target) {
62
+ if (this.needAccessDecision(method)) {
63
+ const oldCtx = Context.getAttr(SECURITY_EXPRESSION_CONTEXT_KEY);
64
+ const newCtx = { method: method, args, target, returnValue, authorizeType: AuthorizeType.Post, grant: oldCtx.grant };
65
+ const securityMetadata = await this.securityMetadataSource.load(newCtx);
66
+ const resouces = await this.resourceNameResolver.resolve(newCtx);
67
+ for (const resource of resouces) {
68
+ securityMetadata.resource = resource;
69
+ await this.accessDecisionManager.decide(securityMetadata);
70
+ }
71
+ }
72
+ }
73
+ };
74
+ SecurityAfterReturningAdvice = __decorate([
75
+ Aspect({ id: AfterReturningAdvice, pointcut })
76
+ ], SecurityAfterReturningAdvice);
77
+ export { SecurityAfterReturningAdvice };
78
+ //# sourceMappingURL=method-advice.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"method-advice.js","sourceRoot":"","sources":["../../../src/node/access/method-advice.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,EAAE,oBAAoB,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1H,OAAO,EAAE,qBAAqB,EAAiC,oBAAoB,EAAE,sBAAsB,EAAE,+BAA+B,EAAE,MAAM,mBAAmB,CAAC;AACxK,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,MAAM,QAAQ,GAAG,CAAA,MAAA,UAAU,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,0CAAE,QAAQ,KAAI,YAAY,CAAC;AAG1E,IAAe,6BAA6B,GAA5C,MAAe,6BAA6B;IAcrC,kBAAkB,CAAC,MAAgC;QACzD,OAAO,IAAI,CAAC,OAAO,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,eAAe,CAA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MAAgC,EAAE,IAAW,EAAE,MAAW;QAC7F,IAAI,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,EAAE,CAAC;YAClC,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAgC,+BAA+B,CAAC,CAAC;YAC/F,MAAM,MAAM,GAAG,EAAE,MAAM,EAAE,MAAgB,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC;YAC/H,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACxE,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YACjE,KAAK,MAAM,QAAQ,IAAI,QAAQ,EAAE,CAAC;gBAC9B,gBAAgB,CAAC,QAAQ,GAAG,QAAQ,CAAC;gBACrC,MAAM,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;YAC9D,CAAC;QACL,CAAC;IACL,CAAC;CAEJ,CAAA;AAfY,4BAA4B;IADxC,MAAM,CAAC,EAAE,EAAE,EAAE,oBAAoB,EAAE,QAAQ,EAAE,CAAC;GAClC,4BAA4B,CAexC"}
@@ -0,0 +1,16 @@
1
+ import { PolicyContext, PolicyProvider } from './access-protocol.js';
2
+ import { Policy } from '../../common/index.js';
3
+ export declare class PrincipalPolicyProvider implements PolicyProvider {
4
+ provide(ctx: PolicyContext): Promise<Policy[]>;
5
+ }
6
+ export declare class ResourcePolicyProvider implements PolicyProvider {
7
+ protected readonly policyMap?: {
8
+ [resource: string]: (Policy[] | Policy);
9
+ };
10
+ protected readonly metadata: {
11
+ Pre: Map<string, Policy[]>;
12
+ Post: Map<string, Policy[]>;
13
+ };
14
+ protected init(): void;
15
+ provide(ctx: PolicyContext): Promise<Policy[]>;
16
+ }
@@ -0,0 +1,82 @@
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 { PolicyProvider } from './access-protocol.js';
11
+ import { Component, Value, PostConstruct } from '@celljs/core';
12
+ import { AuthorizeType } from '../../common/index.js';
13
+ import __cellCjs2 from 'micromatch';
14
+ const { contains } = __cellCjs2;
15
+ let PrincipalPolicyProvider = class PrincipalPolicyProvider {
16
+ async provide(ctx) {
17
+ const { principal, type } = ctx;
18
+ const policies = principal && principal.policies || [];
19
+ return policies.filter(p => p.authorizeType === type);
20
+ }
21
+ };
22
+ PrincipalPolicyProvider = __decorate([
23
+ Component(PolicyProvider)
24
+ ], PrincipalPolicyProvider);
25
+ export { PrincipalPolicyProvider };
26
+ let ResourcePolicyProvider = class ResourcePolicyProvider {
27
+ constructor() {
28
+ this.metadata = {
29
+ [AuthorizeType.Pre]: new Map(),
30
+ [AuthorizeType.Post]: new Map()
31
+ };
32
+ }
33
+ init() {
34
+ if (this.policyMap) {
35
+ for (const pattarn of Object.keys(this.policyMap)) {
36
+ const temp = this.policyMap[pattarn];
37
+ if (!temp) {
38
+ continue;
39
+ }
40
+ const policies = Array.isArray(temp) ? temp : [temp];
41
+ for (const policy of policies) {
42
+ if (policy.authorizeType !== AuthorizeType.Post) {
43
+ policy.authorizeType = AuthorizeType.Pre;
44
+ }
45
+ const map = this.metadata[policy.authorizeType];
46
+ let ps = map.get(pattarn);
47
+ if (!ps) {
48
+ ps = [];
49
+ map.set(pattarn, ps);
50
+ }
51
+ ps.push(policy);
52
+ }
53
+ }
54
+ }
55
+ }
56
+ async provide(ctx) {
57
+ const { resource, type } = ctx;
58
+ const map = this.metadata[type];
59
+ const policies = [];
60
+ for (const pattarn of map.keys()) {
61
+ if (contains(resource, pattarn)) {
62
+ policies.push(...map.get(pattarn));
63
+ }
64
+ }
65
+ return policies;
66
+ }
67
+ };
68
+ __decorate([
69
+ Value('cell.security.policy'),
70
+ __metadata("design:type", Object)
71
+ ], ResourcePolicyProvider.prototype, "policyMap", void 0);
72
+ __decorate([
73
+ PostConstruct(),
74
+ __metadata("design:type", Function),
75
+ __metadata("design:paramtypes", []),
76
+ __metadata("design:returntype", void 0)
77
+ ], ResourcePolicyProvider.prototype, "init", null);
78
+ ResourcePolicyProvider = __decorate([
79
+ Component(PolicyProvider)
80
+ ], ResourcePolicyProvider);
81
+ export { ResourcePolicyProvider };
82
+ //# sourceMappingURL=policy-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"policy-provider.js","sourceRoot":"","sources":["../../../src/node/access/policy-provider.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAiB,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAU,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAG/B,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAEhC,KAAK,CAAC,OAAO,CAAC,GAAkB;QAC5B,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC;QAChC,MAAM,QAAQ,GAAa,SAAS,IAAI,SAAS,CAAC,QAAQ,IAAI,EAAE,CAAC;QACjE,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,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AAC;oBACzB,CAAC;oBACD,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;gBACpB,CAAC;YACL,CAAC;QACL,CAAC;IACL,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,GAAkB;QAC5B,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC;QAC/B,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAChC,MAAM,QAAQ,GAAa,EAAE,CAAC;QAC9B,KAAK,MAAM,OAAO,IAAI,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC;YAC/B,IAAI,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,CAAC;gBAC9B,QAAQ,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,OAAO,CAAE,CAAC,CAAC;YACxC,CAAC;QACL,CAAC;QACD,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ,CAAA;AA5CsB;IADlB,KAAK,CAAC,sBAAsB,CAAC;;yDAC6C;AAQjE;IADT,aAAa,EAAE;;;;kDAwBf;AAlCQ,sBAAsB;IADlC,SAAS,CAAC,cAAc,CAAC;GACb,sBAAsB,CA+ClC"}
@@ -0,0 +1,14 @@
1
+ import { JexlEngineProvider, PolicyResolver, SecurityMetadata } from './access-protocol.js';
2
+ import { AclPolicy, ElPolicy, Policy, Statement } from '../../common/index.js';
3
+ export declare class ElPolicyResolver implements PolicyResolver {
4
+ protected readonly jexlEngineProvider: JexlEngineProvider<any>;
5
+ resolve(policy: ElPolicy, securityMetadata: SecurityMetadata): Promise<number>;
6
+ support(policy: Policy, securityMetadata: SecurityMetadata): Promise<boolean>;
7
+ }
8
+ export declare class AclPolicyResolver implements PolicyResolver {
9
+ protected match(pattern: string, resource: string): boolean;
10
+ protected toArray(value: string | string[]): string[];
11
+ resolve(policy: AclPolicy, securityMetadata: SecurityMetadata): Promise<number>;
12
+ protected resolveStatement(statement: Statement, securityMetadata: SecurityMetadata): -1 | 0 | 1;
13
+ support(policy: Policy, securityMetadata: SecurityMetadata): Promise<boolean>;
14
+ }
@@ -0,0 +1,88 @@
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 { ACCESS_ABSTAIN, ACCESS_DENIED, ACCESS_GRANTED, JexlEngineProvider, PolicyResolver, SECURITY_EXPRESSION_CONTEXT_KEY } from './access-protocol.js';
11
+ import { Autowired, Component } from '@celljs/core';
12
+ import { Context } from '@celljs/web/lib/node';
13
+ import { Effect, PolicyType } from '../../common/index.js';
14
+ import __cellCjs4 from 'micromatch';
15
+ const { contains } = __cellCjs4;
16
+ let ElPolicyResolver = class ElPolicyResolver {
17
+ async resolve(policy, securityMetadata) {
18
+ const expression = this.jexlEngineProvider.provide().createExpression(policy.el);
19
+ // eslint-disable-next-line no-eval
20
+ const result = await expression.eval(policy.context || Context.getAttr(SECURITY_EXPRESSION_CONTEXT_KEY));
21
+ if (result === true) {
22
+ return ACCESS_GRANTED;
23
+ }
24
+ return ACCESS_DENIED;
25
+ }
26
+ async support(policy, securityMetadata) {
27
+ return policy.type === PolicyType.el;
28
+ }
29
+ };
30
+ __decorate([
31
+ Autowired(JexlEngineProvider),
32
+ __metadata("design:type", Object)
33
+ ], ElPolicyResolver.prototype, "jexlEngineProvider", void 0);
34
+ ElPolicyResolver = __decorate([
35
+ Component(PolicyResolver)
36
+ ], ElPolicyResolver);
37
+ export { ElPolicyResolver };
38
+ let AclPolicyResolver = class AclPolicyResolver {
39
+ match(pattern, resource) {
40
+ return contains(resource, pattern);
41
+ }
42
+ toArray(value) {
43
+ return Array.isArray(value) ? value : [value];
44
+ }
45
+ async resolve(policy, securityMetadata) {
46
+ const acl = policy;
47
+ let grant = 0;
48
+ for (const statement of acl.statement) {
49
+ const result = this.resolveStatement(statement, securityMetadata);
50
+ if (result === ACCESS_DENIED) {
51
+ return ACCESS_DENIED;
52
+ }
53
+ else if (result === ACCESS_GRANTED) {
54
+ grant++;
55
+ }
56
+ }
57
+ if (grant > 0) {
58
+ return ACCESS_GRANTED;
59
+ }
60
+ return ACCESS_ABSTAIN;
61
+ }
62
+ resolveStatement(statement, securityMetadata) {
63
+ const resources = this.toArray(statement.resource);
64
+ for (const pattern of resources) {
65
+ if (this.match(pattern, securityMetadata.resource)) {
66
+ const actions = this.toArray(statement.action);
67
+ for (const actionPattern of actions) {
68
+ if (this.match(actionPattern, securityMetadata.action)) {
69
+ if (statement.effect === Effect.Allow) {
70
+ return ACCESS_GRANTED;
71
+ }
72
+ return ACCESS_DENIED;
73
+ }
74
+ }
75
+ break;
76
+ }
77
+ }
78
+ return ACCESS_ABSTAIN;
79
+ }
80
+ async support(policy, securityMetadata) {
81
+ return policy.type === PolicyType.acl;
82
+ }
83
+ };
84
+ AclPolicyResolver = __decorate([
85
+ Component(PolicyResolver)
86
+ ], AclPolicyResolver);
87
+ export { AclPolicyResolver };
88
+ //# sourceMappingURL=policy-resolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"policy-resolver.js","sourceRoot":"","sources":["../../../src/node/access/policy-resolver.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,cAAc,EAAE,kBAAkB,EAAE,cAAc,EAAoB,+BAA+B,EAAE,MAAM,mBAAmB,CAAC;AACzK,OAAO,EAAE,SAAS,EAAE,SAAS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C;IAED,KAAK,CAAC,OAAO,CAAC,MAAc,EAAE,gBAAkC;QAC5D,OAAO,MAAM,CAAC,IAAI,KAAK,UAAU,CAAC,GAAG,CAAC;IAC1C,CAAC;CACJ,CAAA;AAlDY,iBAAiB;IAD7B,SAAS,CAAC,cAAc,CAAC;GACb,iBAAiB,CAkD7B"}
@@ -0,0 +1,6 @@
1
+ import { MethodSecurityMetadataContext, ResourceNameResolver } from './access-protocol.js';
2
+ export declare class DefaultResourceNameResolver implements ResourceNameResolver {
3
+ protected tenantEnabled: boolean;
4
+ resolve(ctx: MethodSecurityMetadataContext): Promise<string[]>;
5
+ protected appendTenantIfNeed(resources: string[]): Promise<string[]>;
6
+ }
@@ -0,0 +1,55 @@
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 { ResourceNameResolver } from './access-protocol.js';
11
+ import { Component, Value, TENANT_ENABLED, getOwnMetadata } from '@celljs/core';
12
+ import { METADATA_KEY } from '../constants.js';
13
+ import __cellCjs3 from 'jexl';
14
+ const { evalSync } = __cellCjs3;
15
+ import { Context } from '@celljs/web/lib/node';
16
+ let DefaultResourceNameResolver = class DefaultResourceNameResolver {
17
+ async resolve(ctx) {
18
+ const classResources = getOwnMetadata(METADATA_KEY.resource, ctx.target.constructor);
19
+ const methodResources = getOwnMetadata(METADATA_KEY.resource, ctx.target.constructor, ctx.method);
20
+ let resources = [];
21
+ if (classResources.length && methodResources.length) {
22
+ for (const resource of methodResources) {
23
+ // eslint-disable-next-line no-eval
24
+ resources.push(`${classResources[0]}:${evalSync(resource === null || resource === void 0 ? void 0 : resource.toString(), ctx)}`);
25
+ }
26
+ }
27
+ else if (methodResources.length) {
28
+ // eslint-disable-next-line no-eval
29
+ resources = methodResources.map(r => { var _a; return (_a = evalSync(r === null || r === void 0 ? void 0 : r.toString(), ctx)) === null || _a === void 0 ? void 0 : _a.toString(); });
30
+ }
31
+ else if (classResources.length) {
32
+ resources = classResources;
33
+ }
34
+ else {
35
+ resources = [ctx.target.constructor.name];
36
+ }
37
+ return this.appendTenantIfNeed(resources);
38
+ }
39
+ async appendTenantIfNeed(resources) {
40
+ if (this.tenantEnabled) {
41
+ const tenant = Context.getTenant();
42
+ return resources.map(r => `${tenant}:${r}`);
43
+ }
44
+ return resources;
45
+ }
46
+ };
47
+ __decorate([
48
+ Value(TENANT_ENABLED),
49
+ __metadata("design:type", Boolean)
50
+ ], DefaultResourceNameResolver.prototype, "tenantEnabled", void 0);
51
+ DefaultResourceNameResolver = __decorate([
52
+ Component(ResourceNameResolver)
53
+ ], DefaultResourceNameResolver);
54
+ export { DefaultResourceNameResolver };
55
+ //# sourceMappingURL=resource-name-resolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource-name-resolver.js","sourceRoot":"","sources":["../../../src/node/access/resource-name-resolver.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAiC,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACxF,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAGxC,IAAM,2BAA2B,GAAjC,MA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AAa,EAAE,CAAC;YACrB,MAAM,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;YACnC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,MAAM,IAAI,CAAC,EAAE,CAAC,CAAC;QAChD,CAAC;QACD,OAAO,SAAS,CAAC;IACrB,CAAC;CACJ,CAAA;AA9Ba;IADT,KAAK,CAAC,cAAc,CAAC;;kEACW;AAHxB,2BAA2B;IADvC,SAAS,CAAC,oBAAoB,CAAC;GACnB,2BAA2B,CAiCvC"}
@@ -0,0 +1,6 @@
1
+ import { SecurityMetadataSource, SecurityMetadata, MethodSecurityMetadataContext, SecurityExpressionContextHandler, ActionNameResolver } from './access-protocol.js';
2
+ export declare class MethodSecurityMetadataSource implements SecurityMetadataSource {
3
+ protected readonly securityExpressionContextHandler: SecurityExpressionContextHandler;
4
+ protected readonly actionNameResolver: ActionNameResolver;
5
+ load(context: MethodSecurityMetadataContext): Promise<SecurityMetadata>;
6
+ }
@@ -0,0 +1,58 @@
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, Autowired, Optional, getOwnMetadata } from '@celljs/core';
11
+ import { SecurityMetadataSource, SecurityExpressionContextHandler, SECURITY_EXPRESSION_CONTEXT_KEY, ActionNameResolver } from './access-protocol.js';
12
+ import { SecurityContext } from '../context/index.js';
13
+ import { METADATA_KEY } from '../constants.js';
14
+ import { Context } from '@celljs/web/lib/node';
15
+ let MethodSecurityMetadataSource = class MethodSecurityMetadataSource {
16
+ async load(context) {
17
+ const classPolicies = getOwnMetadata(METADATA_KEY.authorize, context.target.constructor);
18
+ const methodPolicies = getOwnMetadata(METADATA_KEY.authorize, context.target.constructor, context.method);
19
+ const ctx = {
20
+ ...context,
21
+ ...SecurityContext.getAuthentication()
22
+ };
23
+ if (this.securityExpressionContextHandler) {
24
+ await this.securityExpressionContextHandler.handle(ctx);
25
+ }
26
+ Context.setAttr(SECURITY_EXPRESSION_CONTEXT_KEY, ctx);
27
+ const policies = classPolicies.concat(...methodPolicies)
28
+ .filter(item => item.authorizeType === context.authorizeType);
29
+ const action = await this.actionNameResolver.resolve(context);
30
+ return {
31
+ authorizeType: context.authorizeType,
32
+ principal: SecurityContext.getAuthentication().principal,
33
+ action,
34
+ resource: '',
35
+ policies: policies,
36
+ get grant() {
37
+ return ctx.grant;
38
+ },
39
+ set grant(grant) {
40
+ ctx.grant = grant;
41
+ }
42
+ };
43
+ }
44
+ };
45
+ __decorate([
46
+ Autowired(SecurityExpressionContextHandler),
47
+ Optional(),
48
+ __metadata("design:type", Object)
49
+ ], MethodSecurityMetadataSource.prototype, "securityExpressionContextHandler", void 0);
50
+ __decorate([
51
+ Autowired(ActionNameResolver),
52
+ __metadata("design:type", Object)
53
+ ], MethodSecurityMetadataSource.prototype, "actionNameResolver", void 0);
54
+ MethodSecurityMetadataSource = __decorate([
55
+ Component(SecurityMetadataSource)
56
+ ], MethodSecurityMetadataSource);
57
+ export { MethodSecurityMetadataSource };
58
+ //# sourceMappingURL=security-metadata-source.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"security-metadata-source.js","sourceRoot":"","sources":["../../../src/node/access/security-metadata-source.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,cAAc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YACZ,QAAQ,EAAE,QAAQ;YAClB,IAAI,KAAK;gBACL,OAAO,GAAG,CAAC,KAAK,CAAC;YACrB,CAAC;YACD,IAAI,KAAK,CAAC,KAAa;gBACnB,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC;YACtB,CAAC;SACJ,CAAC;IACN,CAAC;CACJ,CAAA;AAjCsB;IADlB,SAAS,CAAC,gCAAgC,CAAC;IAAE,QAAQ,EAAE;;sFAC8B;AAGnE;IADlB,SAAS,CAAC,kBAAkB,CAAC;;wEAC4B;AANjD,4BAA4B;IADxC,SAAS,CAAC,sBAAsB,CAAC;GACrB,4BAA4B,CAoCxC"}
@@ -0,0 +1 @@
1
+ export declare const Action: (name: string) => (target: any, targetKey: string | symbol, descriptor: any) => void;
@@ -0,0 +1,7 @@
1
+ import { METADATA_KEY } from '../constants.js';
2
+ export const Action = function (name) {
3
+ return (target, targetKey, descriptor) => {
4
+ Reflect.defineMetadata(METADATA_KEY.action, name, target.constructor, targetKey);
5
+ };
6
+ };
7
+ //# sourceMappingURL=action.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action.js","sourceRoot":"","sources":["../../../src/node/annotation/action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,MAAM,CAAC,MAAM,MAAM,GAAG,UAAU,IAAY;IACxC,OAAO,CAAC,MAAW,EAAE,SAA0B,EAAE,UAAe,EAAE,EAAE;QAChE,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;IACrF,CAAC,CAAC;AAEN,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const Anonymous: () => (target: any, targetKey?: string | symbol, descriptor?: any) => void;
@@ -0,0 +1,6 @@
1
+ import { Authorize } from './authorize.js';
2
+ import { AuthorizeType } from '../../common/index.js';
3
+ export const Anonymous = function () {
4
+ return Authorize({ el: 'true', authorizeType: AuthorizeType.Pre });
5
+ };
6
+ //# sourceMappingURL=anonymous.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"anonymous.js","sourceRoot":"","sources":["../../../src/node/annotation/anonymous.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,CAAC,MAAM,SAAS,GAAG;IACrB,OAAO,SAAS,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,CAAC,GAAG,EAAE,CAAC,CAAC;AACvE,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const Authenticated: () => (target: any, targetKey?: string | symbol, descriptor?: any) => void;
@@ -0,0 +1,6 @@
1
+ import { AuthorizeType } from '../../common/index.js';
2
+ import { Authorize } from './authorize.js';
3
+ export const Authenticated = function () {
4
+ return Authorize({ el: 'authenticated', authorizeType: AuthorizeType.Pre });
5
+ };
6
+ //# sourceMappingURL=authenticated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authenticated.js","sourceRoot":"","sources":["../../../src/node/annotation/authenticated.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,CAAC,MAAM,aAAa,GAAG;IACzB,OAAO,SAAS,CAAC,EAAE,EAAE,EAAE,eAAe,EAAE,aAAa,EAAE,aAAa,CAAC,GAAG,EAAE,CAAC,CAAC;AAChF,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { AuthorizeType, Policy } from '../../common/index.js';
2
+ export interface ElOption {
3
+ el: string;
4
+ authorizeType: AuthorizeType;
5
+ }
6
+ export declare namespace ElOption {
7
+ function is(option: any): option is ElOption;
8
+ }
9
+ export declare const Authorize: (elOrElOptionOrPolicy: string | ElOption | Policy) => (target: any, targetKey?: string | symbol, descriptor?: any) => void;
10
+ export declare function getPolicy(elOrElOptionOrPolicy: string | ElOption | Policy): Policy;