@celljs/security 3.8.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (204) hide show
  1. package/cell.yml +13 -7
  2. package/esm/browser/index.d.ts +1 -0
  3. package/esm/browser/index.js +2 -0
  4. package/esm/browser/index.js.map +1 -0
  5. package/esm/browser/module.d.ts +3 -0
  6. package/esm/browser/module.js +4 -0
  7. package/esm/browser/module.js.map +1 -0
  8. package/esm/browser/user/index.d.ts +2 -0
  9. package/esm/browser/user/index.js +3 -0
  10. package/esm/browser/user/index.js.map +1 -0
  11. package/esm/browser/user/user-manager.d.ts +22 -0
  12. package/esm/browser/user/user-manager.js +122 -0
  13. package/esm/browser/user/user-manager.js.map +1 -0
  14. package/esm/browser/user/user-protocol.d.ts +9 -0
  15. package/esm/browser/user/user-protocol.js +2 -0
  16. package/esm/browser/user/user-protocol.js.map +1 -0
  17. package/esm/common/index.d.ts +1 -0
  18. package/esm/common/index.js +2 -0
  19. package/esm/common/index.js.map +1 -0
  20. package/esm/common/security-protocol.d.ts +59 -0
  21. package/esm/common/security-protocol.js +30 -0
  22. package/esm/common/security-protocol.js.map +1 -0
  23. package/esm/node/access/access-decision-manager.d.ts +8 -0
  24. package/esm/node/access/access-decision-manager.js +53 -0
  25. package/esm/node/access/access-decision-manager.js.map +1 -0
  26. package/esm/node/access/access-decision-utils.d.ts +4 -0
  27. package/esm/node/access/access-decision-utils.js +20 -0
  28. package/esm/node/access/access-decision-utils.js.map +1 -0
  29. package/esm/node/access/access-decision-voter.d.ts +13 -0
  30. package/esm/node/access/access-decision-voter.js +83 -0
  31. package/esm/node/access/access-decision-voter.js.map +1 -0
  32. package/esm/node/access/access-protocol.d.ts +74 -0
  33. package/esm/node/access/access-protocol.js +17 -0
  34. package/esm/node/access/access-protocol.js.map +1 -0
  35. package/esm/node/access/action-name-resolver.d.ts +4 -0
  36. package/esm/node/access/action-name-resolver.js +27 -0
  37. package/esm/node/access/action-name-resolver.js.map +1 -0
  38. package/esm/node/access/index.d.ts +11 -0
  39. package/esm/node/access/index.js +12 -0
  40. package/esm/node/access/index.js.map +1 -0
  41. package/esm/node/access/jexl-engine-provider.d.ts +5 -0
  42. package/esm/node/access/jexl-engine-provider.js +22 -0
  43. package/esm/node/access/jexl-engine-provider.js.map +1 -0
  44. package/esm/node/access/method-advice.d.ts +16 -0
  45. package/esm/node/access/method-advice.js +78 -0
  46. package/esm/node/access/method-advice.js.map +1 -0
  47. package/esm/node/access/policy-provider.d.ts +16 -0
  48. package/esm/node/access/policy-provider.js +82 -0
  49. package/esm/node/access/policy-provider.js.map +1 -0
  50. package/esm/node/access/policy-resolver.d.ts +14 -0
  51. package/esm/node/access/policy-resolver.js +88 -0
  52. package/esm/node/access/policy-resolver.js.map +1 -0
  53. package/esm/node/access/resource-name-resolver.d.ts +6 -0
  54. package/esm/node/access/resource-name-resolver.js +55 -0
  55. package/esm/node/access/resource-name-resolver.js.map +1 -0
  56. package/esm/node/access/security-metadata-source.d.ts +6 -0
  57. package/esm/node/access/security-metadata-source.js +58 -0
  58. package/esm/node/access/security-metadata-source.js.map +1 -0
  59. package/esm/node/annotation/action.d.ts +1 -0
  60. package/esm/node/annotation/action.js +7 -0
  61. package/esm/node/annotation/action.js.map +1 -0
  62. package/esm/node/annotation/anonymous.d.ts +1 -0
  63. package/esm/node/annotation/anonymous.js +6 -0
  64. package/esm/node/annotation/anonymous.js.map +1 -0
  65. package/esm/node/annotation/authenticated.d.ts +1 -0
  66. package/esm/node/annotation/authenticated.js +6 -0
  67. package/esm/node/annotation/authenticated.js.map +1 -0
  68. package/esm/node/annotation/authorize.d.ts +10 -0
  69. package/esm/node/annotation/authorize.js +35 -0
  70. package/esm/node/annotation/authorize.js.map +1 -0
  71. package/esm/node/annotation/index.d.ts +7 -0
  72. package/esm/node/annotation/index.js +8 -0
  73. package/esm/node/annotation/index.js.map +1 -0
  74. package/esm/node/annotation/post-authorize.d.ts +1 -0
  75. package/esm/node/annotation/post-authorize.js +6 -0
  76. package/esm/node/annotation/post-authorize.js.map +1 -0
  77. package/esm/node/annotation/pre-authorize.d.ts +1 -0
  78. package/esm/node/annotation/pre-authorize.js +6 -0
  79. package/esm/node/annotation/pre-authorize.js.map +1 -0
  80. package/esm/node/annotation/resource.d.ts +1 -0
  81. package/esm/node/annotation/resource.js +12 -0
  82. package/esm/node/annotation/resource.js.map +1 -0
  83. package/esm/node/authentication/authentication-manager.d.ts +9 -0
  84. package/esm/node/authentication/authentication-manager.js +78 -0
  85. package/esm/node/authentication/authentication-manager.js.map +1 -0
  86. package/esm/node/authentication/authentication-middleware.d.ts +7 -0
  87. package/esm/node/authentication/authentication-middleware.js +33 -0
  88. package/esm/node/authentication/authentication-middleware.js.map +1 -0
  89. package/esm/node/authentication/authentication-protocol.d.ts +29 -0
  90. package/esm/node/authentication/authentication-protocol.js +9 -0
  91. package/esm/node/authentication/authentication-protocol.js.map +1 -0
  92. package/esm/node/authentication/authentication-provider.d.ts +32 -0
  93. package/esm/node/authentication/authentication-provider.js +171 -0
  94. package/esm/node/authentication/authentication-provider.js.map +1 -0
  95. package/esm/node/authentication/authentication-success-handler.d.ts +15 -0
  96. package/esm/node/authentication/authentication-success-handler.js +94 -0
  97. package/esm/node/authentication/authentication-success-handler.js.map +1 -0
  98. package/esm/node/authentication/index.d.ts +5 -0
  99. package/esm/node/authentication/index.js +6 -0
  100. package/esm/node/authentication/index.js.map +1 -0
  101. package/esm/node/cache/cache-protocol.d.ts +15 -0
  102. package/esm/node/cache/cache-protocol.js +3 -0
  103. package/esm/node/cache/cache-protocol.js.map +1 -0
  104. package/esm/node/cache/index.d.ts +2 -0
  105. package/esm/node/cache/index.js +3 -0
  106. package/esm/node/cache/index.js.map +1 -0
  107. package/esm/node/cache/request-cache.d.ts +9 -0
  108. package/esm/node/cache/request-cache.js +49 -0
  109. package/esm/node/cache/request-cache.js.map +1 -0
  110. package/esm/node/constants.d.ts +5 -0
  111. package/esm/node/constants.js +6 -0
  112. package/esm/node/constants.js.map +1 -0
  113. package/esm/node/context/context-protocol.d.ts +21 -0
  114. package/esm/node/context/context-protocol.js +27 -0
  115. package/esm/node/context/context-protocol.js.map +1 -0
  116. package/esm/node/context/index.d.ts +4 -0
  117. package/esm/node/context/index.js +5 -0
  118. package/esm/node/context/index.js.map +1 -0
  119. package/esm/node/context/security-context-middleware.d.ts +8 -0
  120. package/esm/node/context/security-context-middleware.js +41 -0
  121. package/esm/node/context/security-context-middleware.js.map +1 -0
  122. package/esm/node/context/security-context-store.d.ts +7 -0
  123. package/esm/node/context/security-context-store.js +37 -0
  124. package/esm/node/context/security-context-store.js.map +1 -0
  125. package/esm/node/context/security-context-strategy.d.ts +8 -0
  126. package/esm/node/context/security-context-strategy.js +28 -0
  127. package/esm/node/context/security-context-strategy.js.map +1 -0
  128. package/esm/node/crypto/index.d.ts +2 -0
  129. package/esm/node/crypto/index.js +3 -0
  130. package/esm/node/crypto/index.js.map +1 -0
  131. package/esm/node/crypto/keygen/base64-string-key-generator.d.ts +5 -0
  132. package/esm/node/crypto/keygen/base64-string-key-generator.js +28 -0
  133. package/esm/node/crypto/keygen/base64-string-key-generator.js.map +1 -0
  134. package/esm/node/crypto/keygen/index.d.ts +2 -0
  135. package/esm/node/crypto/keygen/index.js +3 -0
  136. package/esm/node/crypto/keygen/index.js.map +1 -0
  137. package/esm/node/crypto/keygen/keygen-protocol.d.ts +4 -0
  138. package/esm/node/crypto/keygen/keygen-protocol.js +2 -0
  139. package/esm/node/crypto/keygen/keygen-protocol.js.map +1 -0
  140. package/esm/node/crypto/password/index.d.ts +2 -0
  141. package/esm/node/crypto/password/index.js +3 -0
  142. package/esm/node/crypto/password/index.js.map +1 -0
  143. package/esm/node/crypto/password/password-encoder.d.ts +8 -0
  144. package/esm/node/crypto/password/password-encoder.js +49 -0
  145. package/esm/node/crypto/password/password-encoder.js.map +1 -0
  146. package/esm/node/crypto/password/password-protocol.d.ts +5 -0
  147. package/esm/node/crypto/password/password-protocol.js +2 -0
  148. package/esm/node/crypto/password/password-protocol.js.map +1 -0
  149. package/esm/node/error/error-handler.d.ts +18 -0
  150. package/esm/node/error/error-handler.js +78 -0
  151. package/esm/node/error/error-handler.js.map +1 -0
  152. package/esm/node/error/error-protocol.d.ts +2 -0
  153. package/esm/node/error/error-protocol.js +4 -0
  154. package/esm/node/error/error-protocol.js.map +1 -0
  155. package/esm/node/error/error.d.ts +20 -0
  156. package/esm/node/error/error.js +23 -0
  157. package/esm/node/error/error.js.map +1 -0
  158. package/esm/node/error/index.d.ts +3 -0
  159. package/esm/node/error/index.js +4 -0
  160. package/esm/node/error/index.js.map +1 -0
  161. package/esm/node/index.d.ts +10 -0
  162. package/esm/node/index.js +11 -0
  163. package/esm/node/index.js.map +1 -0
  164. package/esm/node/logout/index.d.ts +4 -0
  165. package/esm/node/logout/index.js +5 -0
  166. package/esm/node/logout/index.js.map +1 -0
  167. package/esm/node/logout/logout-handler.d.ts +4 -0
  168. package/esm/node/logout/logout-handler.js +19 -0
  169. package/esm/node/logout/logout-handler.js.map +1 -0
  170. package/esm/node/logout/logout-middleware.d.ts +15 -0
  171. package/esm/node/logout/logout-middleware.js +63 -0
  172. package/esm/node/logout/logout-middleware.js.map +1 -0
  173. package/esm/node/logout/logout-protocol.d.ts +11 -0
  174. package/esm/node/logout/logout-protocol.js +6 -0
  175. package/esm/node/logout/logout-protocol.js.map +1 -0
  176. package/esm/node/logout/logout-success-handler-provider.d.ts +7 -0
  177. package/esm/node/logout/logout-success-handler-provider.js +32 -0
  178. package/esm/node/logout/logout-success-handler-provider.js.map +1 -0
  179. package/esm/node/logout/logout-success-handler.d.ts +8 -0
  180. package/esm/node/logout/logout-success-handler.js +36 -0
  181. package/esm/node/logout/logout-success-handler.js.map +1 -0
  182. package/esm/node/module.d.ts +4 -0
  183. package/esm/node/module.js +5 -0
  184. package/esm/node/module.js.map +1 -0
  185. package/esm/node/user/index.d.ts +5 -0
  186. package/esm/node/user/index.js +6 -0
  187. package/esm/node/user/index.js.map +1 -0
  188. package/esm/node/user/user-checker.d.ts +7 -0
  189. package/esm/node/user/user-checker.js +41 -0
  190. package/esm/node/user/user-checker.js.map +1 -0
  191. package/esm/node/user/user-mapper.d.ts +8 -0
  192. package/esm/node/user/user-mapper.js +37 -0
  193. package/esm/node/user/user-mapper.js.map +1 -0
  194. package/esm/node/user/user-middleware.d.ts +10 -0
  195. package/esm/node/user/user-middleware.js +52 -0
  196. package/esm/node/user/user-middleware.js.map +1 -0
  197. package/esm/node/user/user-protocol.d.ts +14 -0
  198. package/esm/node/user/user-protocol.js +6 -0
  199. package/esm/node/user/user-protocol.js.map +1 -0
  200. package/esm/node/user/user-service.d.ts +6 -0
  201. package/esm/node/user/user-service.js +39 -0
  202. package/esm/node/user/user-service.js.map +1 -0
  203. package/esm/package.json +3 -0
  204. package/package.json +93 -6
@@ -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;
@@ -0,0 +1,35 @@
1
+ import { METADATA_KEY } from '../constants.js';
2
+ import { AuthorizeType, PolicyType } from '../../common/index.js';
3
+ export var ElOption;
4
+ (function (ElOption) {
5
+ function is(option) {
6
+ return option && (option.el !== undefined || option.authorizeType);
7
+ }
8
+ ElOption.is = is;
9
+ })(ElOption || (ElOption = {}));
10
+ export const Authorize = function (elOrElOptionOrPolicy) {
11
+ const policy = getPolicy(elOrElOptionOrPolicy);
12
+ return (target, targetKey, descriptor) => {
13
+ if (targetKey) {
14
+ const policies = Reflect.getOwnMetadata(METADATA_KEY.authorize, target.constructor, targetKey) || [];
15
+ policies.push(policy);
16
+ Reflect.defineMetadata(METADATA_KEY.authorize, policies, target.constructor, targetKey);
17
+ }
18
+ else {
19
+ const policies = Reflect.getOwnMetadata(METADATA_KEY.authorize, target.constructor) || [];
20
+ policies.push(policy);
21
+ Reflect.defineMetadata(METADATA_KEY.authorize, policies, target);
22
+ }
23
+ };
24
+ };
25
+ export function getPolicy(elOrElOptionOrPolicy) {
26
+ let policy = elOrElOptionOrPolicy;
27
+ if (typeof elOrElOptionOrPolicy === 'string') {
28
+ policy = { authorizeType: AuthorizeType.Pre, el: elOrElOptionOrPolicy, type: PolicyType.el };
29
+ }
30
+ else if (elOrElOptionOrPolicy.el) {
31
+ policy = { type: PolicyType.el, ...elOrElOptionOrPolicy };
32
+ }
33
+ return policy;
34
+ }
35
+ //# sourceMappingURL=authorize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authorize.js","sourceRoot":"","sources":["../../../src/node/annotation/authorize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAU,UAAU,EAAE,MAAM,cAAc,CAAC;AAOjE,MAAM,KAAW,QAAQ,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AC,GAAG,EAAE,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,UAAU,CAAC,EAAE,EAAE,CAAC;IACjG,CAAC;SAAM,IAAI,oBAAoB,CAAC,EAAE,EAAE,CAAC;QACjC,MAAM,GAAG,EAAE,IAAI,EAAE,UAAU,CAAC,EAAE,EAAE,GAAG,oBAAoB,EAAC,CAAC;IAC7D,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC"}
@@ -0,0 +1,7 @@
1
+ export * from './anonymous.js';
2
+ export * from './authenticated.js';
3
+ export * from './authorize.js';
4
+ export * from './post-authorize.js';
5
+ export * from './pre-authorize.js';
6
+ export * from './resource.js';
7
+ export * from './action.js';
@@ -0,0 +1,8 @@
1
+ export * from './anonymous.js';
2
+ export * from './authenticated.js';
3
+ export * from './authorize.js';
4
+ export * from './post-authorize.js';
5
+ export * from './pre-authorize.js';
6
+ export * from './resource.js';
7
+ export * from './action.js';
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/node/annotation/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const PostAuthorize: (el: string) => (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 PostAuthorize = function (el) {
4
+ return Authorize({ el, authorizeType: AuthorizeType.Post });
5
+ };
6
+ //# sourceMappingURL=post-authorize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"post-authorize.js","sourceRoot":"","sources":["../../../src/node/annotation/post-authorize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,CAAC,MAAM,aAAa,GAAG,UAAU,EAAU;IAC7C,OAAO,SAAS,CAAC,EAAE,EAAE,EAAE,aAAa,EAAE,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC;AAChE,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const PreAuthorize: (el: string) => (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 PreAuthorize = function (el) {
4
+ return Authorize({ el, authorizeType: AuthorizeType.Pre });
5
+ };
6
+ //# sourceMappingURL=pre-authorize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pre-authorize.js","sourceRoot":"","sources":["../../../src/node/annotation/pre-authorize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,CAAC,MAAM,YAAY,GAAG,UAAU,EAAU;IAC5C,OAAO,SAAS,CAAC,EAAE,EAAE,EAAE,aAAa,EAAE,aAAa,CAAC,GAAG,EAAE,CAAC,CAAC;AAC/D,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const Resource: (...resources: string[]) => (target: any, targetKey?: string | symbol, descriptor?: any) => void;
@@ -0,0 +1,12 @@
1
+ import { METADATA_KEY } from '../constants.js';
2
+ export const Resource = function (...resources) {
3
+ return (target, targetKey, descriptor) => {
4
+ if (targetKey) {
5
+ Reflect.defineMetadata(METADATA_KEY.resource, resources, target.constructor, targetKey);
6
+ }
7
+ else {
8
+ Reflect.defineMetadata(METADATA_KEY.resource, resources, target);
9
+ }
10
+ };
11
+ };
12
+ //# sourceMappingURL=resource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource.js","sourceRoot":"","sources":["../../../src/node/annotation/resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,GAAG,SAAmB;IACpD,OAAO,CAAC,MAAW,EAAE,SAA2B,EAAE,UAAgB,EAAE,EAAE;QAClE,IAAI,SAAS,EAAE,CAAC;YACZ,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;QAC5F,CAAC;aAAM,CAAC;YACJ,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;QACrE,CAAC;IACL,CAAC,CAAC;AAEN,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { AuthenticationProvider, AuthenticationManager, AuthenticationSuccessHandler } from './authentication-protocol.js';
2
+ export declare class AuthenticationManagerImpl implements AuthenticationManager {
3
+ protected prioritized: AuthenticationProvider[];
4
+ protected readonly authenticationProviders: AuthenticationProvider[];
5
+ protected readonly authenticationSuccessHandler: AuthenticationSuccessHandler;
6
+ init(): void;
7
+ authenticate(next: () => Promise<void>): Promise<void>;
8
+ support(): Promise<boolean>;
9
+ }
@@ -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
+ import { Component, Autowired, Prioritizeable, PostConstruct } from '@celljs/core';
11
+ import { AuthenticationProvider, AuthenticationManager, AuthenticationSuccessHandler } from './authentication-protocol.js';
12
+ import { AccountStatusError, AuthenticationError } from '../error/index.js';
13
+ import { SecurityContext } from '../context/index.js';
14
+ let AuthenticationManagerImpl = class AuthenticationManagerImpl {
15
+ init() {
16
+ this.prioritized = Prioritizeable.prioritizeAllSync(this.authenticationProviders).map(c => c.value);
17
+ }
18
+ async authenticate(next) {
19
+ let result;
20
+ let lastError;
21
+ for (const authenticationProvider of this.prioritized) {
22
+ try {
23
+ if (await authenticationProvider.support()) {
24
+ result = await authenticationProvider.authenticate();
25
+ if (result) {
26
+ await this.authenticationSuccessHandler.onAuthenticationSuccess(result);
27
+ SecurityContext.setAuthentication(result);
28
+ if (result.next) {
29
+ await next();
30
+ }
31
+ return;
32
+ }
33
+ }
34
+ }
35
+ catch (error) {
36
+ if (error instanceof AccountStatusError) {
37
+ throw error;
38
+ }
39
+ else if (error instanceof AuthenticationError) {
40
+ lastError = error;
41
+ }
42
+ else {
43
+ throw error;
44
+ }
45
+ }
46
+ }
47
+ if (lastError) {
48
+ throw lastError;
49
+ }
50
+ }
51
+ async support() {
52
+ for (const authenticationProvider of this.prioritized) {
53
+ if (await authenticationProvider.support()) {
54
+ return true;
55
+ }
56
+ }
57
+ return false;
58
+ }
59
+ };
60
+ __decorate([
61
+ Autowired(AuthenticationProvider),
62
+ __metadata("design:type", Array)
63
+ ], AuthenticationManagerImpl.prototype, "authenticationProviders", void 0);
64
+ __decorate([
65
+ Autowired(AuthenticationSuccessHandler),
66
+ __metadata("design:type", Object)
67
+ ], AuthenticationManagerImpl.prototype, "authenticationSuccessHandler", void 0);
68
+ __decorate([
69
+ PostConstruct(),
70
+ __metadata("design:type", Function),
71
+ __metadata("design:paramtypes", []),
72
+ __metadata("design:returntype", void 0)
73
+ ], AuthenticationManagerImpl.prototype, "init", null);
74
+ AuthenticationManagerImpl = __decorate([
75
+ Component(AuthenticationManager)
76
+ ], AuthenticationManagerImpl);
77
+ export { AuthenticationManagerImpl };
78
+ //# sourceMappingURL=authentication-manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authentication-manager.js","sourceRoot":"","sources":["../../../src/node/authentication/authentication-manager.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACnF,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAkB,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AACxI,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAGtC,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;IAWlC,IAAI;QACA,IAAI,CAAC,WAAW,GAAG,cAAc,CAAC,iBAAiB,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IACxG,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,IAAyB;QACxC,IAAI,MAAkC,CAAC;QACvC,IAAI,SAAc,CAAC;QACnB,KAAK,MAAM,sBAAsB,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACpD,IAAI,CAAC;gBACD,IAAI,MAAM,sBAAsB,CAAC,OAAO,EAAE,EAAE,CAAC;oBACzC,MAAM,GAAG,MAAM,sBAAsB,CAAC,YAAY,EAAE,CAAC;oBACrD,IAAI,MAAM,EAAE,CAAC;wBACT,MAAM,IAAI,CAAC,4BAA4B,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAC;wBACxE,eAAe,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;wBAC1C,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;4BACd,MAAM,IAAI,EAAE,CAAC;wBACjB,CAAC;wBACD,OAAO;oBACX,CAAC;gBACL,CAAC;YACL,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACb,IAAI,KAAK,YAAY,kBAAkB,EAAE,CAAC;oBACtC,MAAM,KAAK,CAAC;gBAChB,CAAC;qBAAM,IAAI,KAAK,YAAY,mBAAmB,EAAE,CAAC;oBAC9C,SAAS,GAAG,KAAK,CAAC;gBACtB,CAAC;qBAAM,CAAC;oBACJ,MAAM,KAAK,CAAC;gBAChB,CAAC;YACL,CAAC;QACL,CAAC;QACD,IAAI,SAAS,EAAE,CAAC;YACZ,MAAM,SAAS,CAAC;QACpB,CAAC;IACL,CAAC;IAED,KAAK,CAAC,OAAO;QACT,KAAK,MAAM,sBAAsB,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACpD,IAAI,MAAM,sBAAsB,CAAC,OAAO,EAAE,EAAE,CAAC;gBACzC,OAAO,IAAI,CAAC;YAChB,CAAC;QACL,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ,CAAA;AAjDsB;IADlB,SAAS,CAAC,sBAAsB,CAAC;;0EACmC;AAGlD;IADlB,SAAS,CAAC,4BAA4B,CAAC;;+EACsC;AAG9E;IADC,aAAa,EAAE;;;;qDAGf;AAbQ,yBAAyB;IADrC,SAAS,CAAC,qBAAqB,CAAC;GACpB,yBAAyB,CAsDrC"}
@@ -0,0 +1,7 @@
1
+ import { Middleware, Context } from '@celljs/web/lib/node';
2
+ import { AuthenticationManager } from './authentication-protocol.js';
3
+ export declare class AuthenticationMiddleware implements Middleware {
4
+ protected readonly authenticationManager: AuthenticationManager;
5
+ handle(ctx: Context, next: () => Promise<void>): Promise<void>;
6
+ readonly priority: number;
7
+ }
@@ -0,0 +1,33 @@
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 } from '@celljs/web/lib/node';
11
+ import { Component, Autowired } from '@celljs/core';
12
+ import { AuthenticationManager, AUTHENTICATION_MIDDLE_PRIORITY } from './authentication-protocol.js';
13
+ let AuthenticationMiddleware = class AuthenticationMiddleware {
14
+ constructor() {
15
+ this.priority = AUTHENTICATION_MIDDLE_PRIORITY;
16
+ }
17
+ async handle(ctx, next) {
18
+ if (await this.authenticationManager.support()) {
19
+ await this.authenticationManager.authenticate(next);
20
+ return;
21
+ }
22
+ await next();
23
+ }
24
+ };
25
+ __decorate([
26
+ Autowired(AuthenticationManager),
27
+ __metadata("design:type", Object)
28
+ ], AuthenticationMiddleware.prototype, "authenticationManager", void 0);
29
+ AuthenticationMiddleware = __decorate([
30
+ Component(Middleware)
31
+ ], AuthenticationMiddleware);
32
+ export { AuthenticationMiddleware };
33
+ //# sourceMappingURL=authentication-middleware.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authentication-middleware.js","sourceRoot":"","sources":["../../../src/node/authentication/authentication-middleware.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAW,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,8BAA8B,EAAE,MAAM,2BAA2B,CAAC;AAG3F,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IAA9B;QAaM,aAAQ,GAAW,8BAA8B,CAAC;IAE/D,CAAC;IAVG,KAAK,CAAC,MAAM,CAAC,GAAY,EAAE,IAAyB;QAChD,IAAI,MAAM,IAAI,CAAC,qBAAqB,CAAC,OAAO,EAAE,EAAE,CAAC;YAC7C,MAAM,IAAI,CAAC,qBAAqB,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;YACpD,OAAO;QACX,CAAC;QACD,MAAM,IAAI,EAAE,CAAC;IACjB,CAAC;CAIJ,CAAA;AAZsB;IADlB,SAAS,CAAC,qBAAqB,CAAC;;uEAC+B;AAHvD,wBAAwB;IADpC,SAAS,CAAC,UAAU,CAAC;GACT,wBAAwB,CAepC"}
@@ -0,0 +1,29 @@
1
+ import { Policy } from '../../common/index.js';
2
+ export declare const AuthenticationProvider: unique symbol;
3
+ export declare const AuthenticationManager: unique symbol;
4
+ export declare const AuthenticationSuccessHandler: unique symbol;
5
+ export declare const AUTHENTICATION_SCHEME_BASIC = "Basic";
6
+ export declare const AUTHENTICATION_MIDDLE_PRIORITY: number;
7
+ export declare const USERNAME_PASSWORD_AUTHENTICATION_PROVIDER_PRIORITY = 2000;
8
+ export declare const BASE_AUTHENTICATION_PROVIDER_PRIORITY: number;
9
+ export interface AuthenticationManager {
10
+ authenticate(next: () => Promise<void>): Promise<void>;
11
+ support(): Promise<boolean>;
12
+ }
13
+ export interface AuthenticationProvider {
14
+ readonly priority: number;
15
+ authenticate(): Promise<Authentication | undefined>;
16
+ support(): Promise<boolean>;
17
+ }
18
+ export interface Authentication {
19
+ name: string;
20
+ policies: Policy[];
21
+ credentials: any;
22
+ details?: any;
23
+ principal: any;
24
+ next?: boolean;
25
+ authenticated: boolean;
26
+ }
27
+ export interface AuthenticationSuccessHandler {
28
+ onAuthenticationSuccess(authentication: Authentication): Promise<void>;
29
+ }
@@ -0,0 +1,9 @@
1
+ import { SECURITY_CONTEXT_MIDDLEWARE_PRIORITY } from '../context/index.js';
2
+ export const AuthenticationProvider = Symbol('AuthenticationProvider');
3
+ export const AuthenticationManager = Symbol('AuthenticationManager');
4
+ export const AuthenticationSuccessHandler = Symbol('AuthenticationSuccessHandler');
5
+ export const AUTHENTICATION_SCHEME_BASIC = 'Basic';
6
+ export const AUTHENTICATION_MIDDLE_PRIORITY = SECURITY_CONTEXT_MIDDLEWARE_PRIORITY - 100;
7
+ export const USERNAME_PASSWORD_AUTHENTICATION_PROVIDER_PRIORITY = 2000;
8
+ export const BASE_AUTHENTICATION_PROVIDER_PRIORITY = USERNAME_PASSWORD_AUTHENTICATION_PROVIDER_PRIORITY - 100;
9
+ //# sourceMappingURL=authentication-protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authentication-protocol.js","sourceRoot":"","sources":["../../../src/node/authentication/authentication-protocol.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oCAAoC,EAAE,MAAM,YAAY,CAAC;AAElE,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,wBAAwB,CAAC,CAAC;AACvE,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC,uBAAuB,CAAC,CAAC;AACrE,MAAM,CAAC,MAAM,4BAA4B,GAAG,MAAM,CAAC,8BAA8B,CAAC,CAAC;AACnF,MAAM,CAAC,MAAM,2BAA2B,GAAG,OAAO,CAAC;AAEnD,MAAM,CAAC,MAAM,8BAA8B,GAAG,oCAAoC,GAAG,GAAG,CAAC;AAEzF,MAAM,CAAC,MAAM,kDAAkD,GAAI,IAAI,CAAC;AACxE,MAAM,CAAC,MAAM,qCAAqC,GAAI,kDAAkD,GAAG,GAAG,CAAC"}
@@ -0,0 +1,32 @@
1
+ import { AuthenticationProvider, Authentication } from './authentication-protocol.js';
2
+ import { RequestMatcher, RedirectStrategy } from '@celljs/web/lib/node';
3
+ import { PasswordEncoder } from '../crypto/index.js';
4
+ import { UserService, UserChecker, UserMapper } from '../user/index.js';
5
+ import { PathResolver } from '@celljs/web';
6
+ import { User } from '../../common/index.js';
7
+ export declare class UsernamePasswordAuthenticationProvider implements AuthenticationProvider {
8
+ protected readonly options: any;
9
+ protected readonly passwordEncoder: PasswordEncoder;
10
+ protected readonly userService: UserService<string, User>;
11
+ protected readonly userChecker: UserChecker;
12
+ protected readonly userMapper: UserMapper;
13
+ protected readonly requestMatcher: RequestMatcher;
14
+ protected readonly pathResolver: PathResolver;
15
+ protected readonly redirectStrategy: RedirectStrategy;
16
+ priority: number;
17
+ authenticate(): Promise<Authentication | undefined>;
18
+ protected doGetValue(key: string): string;
19
+ support(): Promise<boolean>;
20
+ }
21
+ export declare class BasicAuthenticationProvider implements AuthenticationProvider {
22
+ protected readonly passwordEncoder: PasswordEncoder;
23
+ protected readonly userService: UserService<string, User>;
24
+ protected readonly userChecker: UserChecker;
25
+ protected readonly userMapper: UserMapper;
26
+ protected readonly requestMatcher: RequestMatcher;
27
+ protected readonly pathResolver: PathResolver;
28
+ protected readonly redirectStrategy: RedirectStrategy;
29
+ priority: number;
30
+ authenticate(): Promise<Authentication | undefined>;
31
+ support(): Promise<boolean>;
32
+ }
@@ -0,0 +1,171 @@
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, Value } from '@celljs/core';
11
+ import { AuthenticationProvider, USERNAME_PASSWORD_AUTHENTICATION_PROVIDER_PRIORITY, BASE_AUTHENTICATION_PROVIDER_PRIORITY, AUTHENTICATION_SCHEME_BASIC } from './authentication-protocol.js';
12
+ import { Context, RequestMatcher, RedirectStrategy } from '@celljs/web/lib/node';
13
+ import { PasswordEncoder } from '../crypto/index.js';
14
+ import { UserService, UserChecker, UserMapper } from '../user/index.js';
15
+ import { BadCredentialsError } from '../error/index.js';
16
+ import { HttpHeaders } from '@celljs/http';
17
+ import { PathResolver } from '@celljs/web';
18
+ let UsernamePasswordAuthenticationProvider = class UsernamePasswordAuthenticationProvider {
19
+ constructor() {
20
+ this.priority = USERNAME_PASSWORD_AUTHENTICATION_PROVIDER_PRIORITY;
21
+ }
22
+ async authenticate() {
23
+ const username = this.doGetValue(this.options.usernameKey);
24
+ const password = this.doGetValue(this.options.passwordKey);
25
+ if (!password || !username) {
26
+ throw new BadCredentialsError('Bad credentials');
27
+ }
28
+ const user = await this.userService.load(username);
29
+ await this.userChecker.check(user);
30
+ if (!await this.passwordEncoder.matches(password, user.password)) {
31
+ throw new BadCredentialsError('Bad credentials');
32
+ }
33
+ await this.userMapper.map(user);
34
+ return {
35
+ name: user.username,
36
+ principal: user,
37
+ credentials: '',
38
+ policies: user.policies,
39
+ authenticated: true
40
+ };
41
+ }
42
+ doGetValue(key) {
43
+ const request = Context.getRequest();
44
+ if (request.body) {
45
+ return request.body[key];
46
+ }
47
+ else {
48
+ return request.query[key];
49
+ }
50
+ }
51
+ async support() {
52
+ return !!await this.requestMatcher.match(await this.pathResolver.resolve(this.options.loginUrl), this.options.loginMethod);
53
+ }
54
+ };
55
+ __decorate([
56
+ Value('cell.security'),
57
+ __metadata("design:type", Object)
58
+ ], UsernamePasswordAuthenticationProvider.prototype, "options", void 0);
59
+ __decorate([
60
+ Autowired(PasswordEncoder),
61
+ __metadata("design:type", Object)
62
+ ], UsernamePasswordAuthenticationProvider.prototype, "passwordEncoder", void 0);
63
+ __decorate([
64
+ Autowired(UserService),
65
+ __metadata("design:type", Object)
66
+ ], UsernamePasswordAuthenticationProvider.prototype, "userService", void 0);
67
+ __decorate([
68
+ Autowired(UserChecker),
69
+ __metadata("design:type", Object)
70
+ ], UsernamePasswordAuthenticationProvider.prototype, "userChecker", void 0);
71
+ __decorate([
72
+ Autowired(UserMapper),
73
+ __metadata("design:type", Object)
74
+ ], UsernamePasswordAuthenticationProvider.prototype, "userMapper", void 0);
75
+ __decorate([
76
+ Autowired(RequestMatcher),
77
+ __metadata("design:type", Object)
78
+ ], UsernamePasswordAuthenticationProvider.prototype, "requestMatcher", void 0);
79
+ __decorate([
80
+ Autowired(PathResolver),
81
+ __metadata("design:type", Object)
82
+ ], UsernamePasswordAuthenticationProvider.prototype, "pathResolver", void 0);
83
+ __decorate([
84
+ Autowired(RedirectStrategy),
85
+ __metadata("design:type", Object)
86
+ ], UsernamePasswordAuthenticationProvider.prototype, "redirectStrategy", void 0);
87
+ UsernamePasswordAuthenticationProvider = __decorate([
88
+ Component(AuthenticationProvider)
89
+ ], UsernamePasswordAuthenticationProvider);
90
+ export { UsernamePasswordAuthenticationProvider };
91
+ let BasicAuthenticationProvider = class BasicAuthenticationProvider {
92
+ constructor() {
93
+ this.priority = BASE_AUTHENTICATION_PROVIDER_PRIORITY;
94
+ }
95
+ async authenticate() {
96
+ const request = Context.getRequest();
97
+ const header = request.get(HttpHeaders.AUTHORIZATION).trim();
98
+ const token = Buffer.from(header.substring(6), 'base64').toString('utf8');
99
+ if (!token) {
100
+ throw new BadCredentialsError('Empty basic authentication token');
101
+ }
102
+ const delim = token.indexOf(':');
103
+ if (delim === -1) {
104
+ throw new BadCredentialsError('Invalid basic authentication token');
105
+ }
106
+ const username = token.substring(0, delim);
107
+ const password = token.substring(delim);
108
+ if (!password || !username) {
109
+ throw new BadCredentialsError('Bad credentials');
110
+ }
111
+ const user = await this.userService.load(username);
112
+ await this.userChecker.check(user);
113
+ if (!await this.passwordEncoder.matches(password, user.password)) {
114
+ throw new BadCredentialsError('Bad credentials');
115
+ }
116
+ await this.userMapper.map(user);
117
+ return {
118
+ name: user.username,
119
+ principal: user,
120
+ credentials: '',
121
+ policies: user.policies,
122
+ authenticated: true,
123
+ next: true
124
+ };
125
+ }
126
+ async support() {
127
+ const request = Context.getRequest();
128
+ let header = request.get(HttpHeaders.AUTHORIZATION);
129
+ if (!header) {
130
+ return false;
131
+ }
132
+ header = header.trim();
133
+ if (header.toLowerCase().startsWith(AUTHENTICATION_SCHEME_BASIC.toLowerCase())) {
134
+ return true;
135
+ }
136
+ return false;
137
+ }
138
+ };
139
+ __decorate([
140
+ Autowired(PasswordEncoder),
141
+ __metadata("design:type", Object)
142
+ ], BasicAuthenticationProvider.prototype, "passwordEncoder", void 0);
143
+ __decorate([
144
+ Autowired(UserService),
145
+ __metadata("design:type", Object)
146
+ ], BasicAuthenticationProvider.prototype, "userService", void 0);
147
+ __decorate([
148
+ Autowired(UserChecker),
149
+ __metadata("design:type", Object)
150
+ ], BasicAuthenticationProvider.prototype, "userChecker", void 0);
151
+ __decorate([
152
+ Autowired(UserMapper),
153
+ __metadata("design:type", Object)
154
+ ], BasicAuthenticationProvider.prototype, "userMapper", void 0);
155
+ __decorate([
156
+ Autowired(RequestMatcher),
157
+ __metadata("design:type", Object)
158
+ ], BasicAuthenticationProvider.prototype, "requestMatcher", void 0);
159
+ __decorate([
160
+ Autowired(PathResolver),
161
+ __metadata("design:type", Object)
162
+ ], BasicAuthenticationProvider.prototype, "pathResolver", void 0);
163
+ __decorate([
164
+ Autowired(RedirectStrategy),
165
+ __metadata("design:type", Object)
166
+ ], BasicAuthenticationProvider.prototype, "redirectStrategy", void 0);
167
+ BasicAuthenticationProvider = __decorate([
168
+ Component(AuthenticationProvider)
169
+ ], BasicAuthenticationProvider);
170
+ export { BasicAuthenticationProvider };
171
+ //# sourceMappingURL=authentication-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authentication-provider.js","sourceRoot":"","sources":["../../../src/node/authentication/authentication-provider.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAk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CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAEhC,OAAO;YACH,IAAI,EAAE,IAAI,CAAC,QAAQ;YACnB,SAAS,EAAE,IAAI;YACf,WAAW,EAAE,EAAE;YACf,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,aAAa,EAAE,IAAI;YACnB,IAAI,EAAE,IAAI;SACb,CAAC;IAEN,CAAC;IAED,KAAK,CAAC,OAAO;QACT,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;QACrC,IAAI,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;QACpD,IAAI,CAAC,MAAM,EAAE,CAAC;YACV,OAAO,KAAK,CAAC;QACjB,CAAC;QACD,MAAM,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;QACvB,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,2BAA2B,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;YAC7E,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;CAEJ,CAAA;AAvEsB;IADlB,SAAS,CAAC,eAAe,CAAC;;oEACyB;AAGjC;IADlB,SAAS,CAAC,WAAW,CAAC;;gEACmC;AAGvC;IADlB,SAAS,CAAC,WAAW,CAAC;;gEACqB;AAGzB;IADlB,SAAS,CAAC,UAAU,CAAC;;+DACoB;AAGvB;IADlB,SAAS,CAAC,cAAc,CAAC;;mEACwB;AAG/B;IADlB,SAAS,CAAC,YAAY,CAAC;;iEACsB;AAG3B;IADlB,SAAS,CAAC,gBAAgB,CAAC;;qEAC0B;AArB7C,2BAA2B;IADvC,SAAS,CAAC,sBAAsB,CAAC;GACrB,2BAA2B,CA0EvC"}
@@ -0,0 +1,15 @@
1
+ import { AuthenticationSuccessHandler, Authentication } from './authentication-protocol.js';
2
+ import { Logger } from '@celljs/core';
3
+ import { RedirectStrategy } from '@celljs/web/lib/node';
4
+ import { RequestCache } from '../cache/index.js';
5
+ export declare class DefaultAuthenticationSuccessHandler implements AuthenticationSuccessHandler {
6
+ protected readonly targetUrlParameter: string;
7
+ protected readonly loginSuccessUrl: string;
8
+ protected readonly alwaysUseLoginSuccessUrl: boolean;
9
+ protected readonly useReferer: boolean;
10
+ protected readonly logger: Logger;
11
+ protected readonly redirectStrategy: RedirectStrategy;
12
+ protected readonly requestCache: RequestCache;
13
+ onAuthenticationSuccess(authentication: Authentication): Promise<void>;
14
+ protected determineTargetUrl(authentication: Authentication): Promise<string>;
15
+ }