@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.
- package/cell.yml +13 -7
- package/esm/browser/index.d.ts +1 -0
- package/esm/browser/index.js +2 -0
- package/esm/browser/index.js.map +1 -0
- package/esm/browser/module.d.ts +3 -0
- package/esm/browser/module.js +4 -0
- package/esm/browser/module.js.map +1 -0
- package/esm/browser/user/index.d.ts +2 -0
- package/esm/browser/user/index.js +3 -0
- package/esm/browser/user/index.js.map +1 -0
- package/esm/browser/user/user-manager.d.ts +22 -0
- package/esm/browser/user/user-manager.js +122 -0
- package/esm/browser/user/user-manager.js.map +1 -0
- package/esm/browser/user/user-protocol.d.ts +9 -0
- package/esm/browser/user/user-protocol.js +2 -0
- package/esm/browser/user/user-protocol.js.map +1 -0
- package/esm/common/index.d.ts +1 -0
- package/esm/common/index.js +2 -0
- package/esm/common/index.js.map +1 -0
- package/esm/common/security-protocol.d.ts +59 -0
- package/esm/common/security-protocol.js +30 -0
- package/esm/common/security-protocol.js.map +1 -0
- package/esm/node/access/access-decision-manager.d.ts +8 -0
- package/esm/node/access/access-decision-manager.js +53 -0
- package/esm/node/access/access-decision-manager.js.map +1 -0
- package/esm/node/access/access-decision-utils.d.ts +4 -0
- package/esm/node/access/access-decision-utils.js +20 -0
- package/esm/node/access/access-decision-utils.js.map +1 -0
- package/esm/node/access/access-decision-voter.d.ts +13 -0
- package/esm/node/access/access-decision-voter.js +83 -0
- package/esm/node/access/access-decision-voter.js.map +1 -0
- package/esm/node/access/access-protocol.d.ts +74 -0
- package/esm/node/access/access-protocol.js +17 -0
- package/esm/node/access/access-protocol.js.map +1 -0
- package/esm/node/access/action-name-resolver.d.ts +4 -0
- package/esm/node/access/action-name-resolver.js +27 -0
- package/esm/node/access/action-name-resolver.js.map +1 -0
- package/esm/node/access/index.d.ts +11 -0
- package/esm/node/access/index.js +12 -0
- package/esm/node/access/index.js.map +1 -0
- package/esm/node/access/jexl-engine-provider.d.ts +5 -0
- package/esm/node/access/jexl-engine-provider.js +22 -0
- package/esm/node/access/jexl-engine-provider.js.map +1 -0
- package/esm/node/access/method-advice.d.ts +16 -0
- package/esm/node/access/method-advice.js +78 -0
- package/esm/node/access/method-advice.js.map +1 -0
- package/esm/node/access/policy-provider.d.ts +16 -0
- package/esm/node/access/policy-provider.js +82 -0
- package/esm/node/access/policy-provider.js.map +1 -0
- package/esm/node/access/policy-resolver.d.ts +14 -0
- package/esm/node/access/policy-resolver.js +88 -0
- package/esm/node/access/policy-resolver.js.map +1 -0
- package/esm/node/access/resource-name-resolver.d.ts +6 -0
- package/esm/node/access/resource-name-resolver.js +55 -0
- package/esm/node/access/resource-name-resolver.js.map +1 -0
- package/esm/node/access/security-metadata-source.d.ts +6 -0
- package/esm/node/access/security-metadata-source.js +58 -0
- package/esm/node/access/security-metadata-source.js.map +1 -0
- package/esm/node/annotation/action.d.ts +1 -0
- package/esm/node/annotation/action.js +7 -0
- package/esm/node/annotation/action.js.map +1 -0
- package/esm/node/annotation/anonymous.d.ts +1 -0
- package/esm/node/annotation/anonymous.js +6 -0
- package/esm/node/annotation/anonymous.js.map +1 -0
- package/esm/node/annotation/authenticated.d.ts +1 -0
- package/esm/node/annotation/authenticated.js +6 -0
- package/esm/node/annotation/authenticated.js.map +1 -0
- package/esm/node/annotation/authorize.d.ts +10 -0
- package/esm/node/annotation/authorize.js +35 -0
- package/esm/node/annotation/authorize.js.map +1 -0
- package/esm/node/annotation/index.d.ts +7 -0
- package/esm/node/annotation/index.js +8 -0
- package/esm/node/annotation/index.js.map +1 -0
- package/esm/node/annotation/post-authorize.d.ts +1 -0
- package/esm/node/annotation/post-authorize.js +6 -0
- package/esm/node/annotation/post-authorize.js.map +1 -0
- package/esm/node/annotation/pre-authorize.d.ts +1 -0
- package/esm/node/annotation/pre-authorize.js +6 -0
- package/esm/node/annotation/pre-authorize.js.map +1 -0
- package/esm/node/annotation/resource.d.ts +1 -0
- package/esm/node/annotation/resource.js +12 -0
- package/esm/node/annotation/resource.js.map +1 -0
- package/esm/node/authentication/authentication-manager.d.ts +9 -0
- package/esm/node/authentication/authentication-manager.js +78 -0
- package/esm/node/authentication/authentication-manager.js.map +1 -0
- package/esm/node/authentication/authentication-middleware.d.ts +7 -0
- package/esm/node/authentication/authentication-middleware.js +33 -0
- package/esm/node/authentication/authentication-middleware.js.map +1 -0
- package/esm/node/authentication/authentication-protocol.d.ts +29 -0
- package/esm/node/authentication/authentication-protocol.js +9 -0
- package/esm/node/authentication/authentication-protocol.js.map +1 -0
- package/esm/node/authentication/authentication-provider.d.ts +32 -0
- package/esm/node/authentication/authentication-provider.js +171 -0
- package/esm/node/authentication/authentication-provider.js.map +1 -0
- package/esm/node/authentication/authentication-success-handler.d.ts +15 -0
- package/esm/node/authentication/authentication-success-handler.js +94 -0
- package/esm/node/authentication/authentication-success-handler.js.map +1 -0
- package/esm/node/authentication/index.d.ts +5 -0
- package/esm/node/authentication/index.js +6 -0
- package/esm/node/authentication/index.js.map +1 -0
- package/esm/node/cache/cache-protocol.d.ts +15 -0
- package/esm/node/cache/cache-protocol.js +3 -0
- package/esm/node/cache/cache-protocol.js.map +1 -0
- package/esm/node/cache/index.d.ts +2 -0
- package/esm/node/cache/index.js +3 -0
- package/esm/node/cache/index.js.map +1 -0
- package/esm/node/cache/request-cache.d.ts +9 -0
- package/esm/node/cache/request-cache.js +49 -0
- package/esm/node/cache/request-cache.js.map +1 -0
- package/esm/node/constants.d.ts +5 -0
- package/esm/node/constants.js +6 -0
- package/esm/node/constants.js.map +1 -0
- package/esm/node/context/context-protocol.d.ts +21 -0
- package/esm/node/context/context-protocol.js +27 -0
- package/esm/node/context/context-protocol.js.map +1 -0
- package/esm/node/context/index.d.ts +4 -0
- package/esm/node/context/index.js +5 -0
- package/esm/node/context/index.js.map +1 -0
- package/esm/node/context/security-context-middleware.d.ts +8 -0
- package/esm/node/context/security-context-middleware.js +41 -0
- package/esm/node/context/security-context-middleware.js.map +1 -0
- package/esm/node/context/security-context-store.d.ts +7 -0
- package/esm/node/context/security-context-store.js +37 -0
- package/esm/node/context/security-context-store.js.map +1 -0
- package/esm/node/context/security-context-strategy.d.ts +8 -0
- package/esm/node/context/security-context-strategy.js +28 -0
- package/esm/node/context/security-context-strategy.js.map +1 -0
- package/esm/node/crypto/index.d.ts +2 -0
- package/esm/node/crypto/index.js +3 -0
- package/esm/node/crypto/index.js.map +1 -0
- package/esm/node/crypto/keygen/base64-string-key-generator.d.ts +5 -0
- package/esm/node/crypto/keygen/base64-string-key-generator.js +28 -0
- package/esm/node/crypto/keygen/base64-string-key-generator.js.map +1 -0
- package/esm/node/crypto/keygen/index.d.ts +2 -0
- package/esm/node/crypto/keygen/index.js +3 -0
- package/esm/node/crypto/keygen/index.js.map +1 -0
- package/esm/node/crypto/keygen/keygen-protocol.d.ts +4 -0
- package/esm/node/crypto/keygen/keygen-protocol.js +2 -0
- package/esm/node/crypto/keygen/keygen-protocol.js.map +1 -0
- package/esm/node/crypto/password/index.d.ts +2 -0
- package/esm/node/crypto/password/index.js +3 -0
- package/esm/node/crypto/password/index.js.map +1 -0
- package/esm/node/crypto/password/password-encoder.d.ts +8 -0
- package/esm/node/crypto/password/password-encoder.js +49 -0
- package/esm/node/crypto/password/password-encoder.js.map +1 -0
- package/esm/node/crypto/password/password-protocol.d.ts +5 -0
- package/esm/node/crypto/password/password-protocol.js +2 -0
- package/esm/node/crypto/password/password-protocol.js.map +1 -0
- package/esm/node/error/error-handler.d.ts +18 -0
- package/esm/node/error/error-handler.js +78 -0
- package/esm/node/error/error-handler.js.map +1 -0
- package/esm/node/error/error-protocol.d.ts +2 -0
- package/esm/node/error/error-protocol.js +4 -0
- package/esm/node/error/error-protocol.js.map +1 -0
- package/esm/node/error/error.d.ts +20 -0
- package/esm/node/error/error.js +23 -0
- package/esm/node/error/error.js.map +1 -0
- package/esm/node/error/index.d.ts +3 -0
- package/esm/node/error/index.js +4 -0
- package/esm/node/error/index.js.map +1 -0
- package/esm/node/index.d.ts +10 -0
- package/esm/node/index.js +11 -0
- package/esm/node/index.js.map +1 -0
- package/esm/node/logout/index.d.ts +4 -0
- package/esm/node/logout/index.js +5 -0
- package/esm/node/logout/index.js.map +1 -0
- package/esm/node/logout/logout-handler.d.ts +4 -0
- package/esm/node/logout/logout-handler.js +19 -0
- package/esm/node/logout/logout-handler.js.map +1 -0
- package/esm/node/logout/logout-middleware.d.ts +15 -0
- package/esm/node/logout/logout-middleware.js +63 -0
- package/esm/node/logout/logout-middleware.js.map +1 -0
- package/esm/node/logout/logout-protocol.d.ts +11 -0
- package/esm/node/logout/logout-protocol.js +6 -0
- package/esm/node/logout/logout-protocol.js.map +1 -0
- package/esm/node/logout/logout-success-handler-provider.d.ts +7 -0
- package/esm/node/logout/logout-success-handler-provider.js +32 -0
- package/esm/node/logout/logout-success-handler-provider.js.map +1 -0
- package/esm/node/logout/logout-success-handler.d.ts +8 -0
- package/esm/node/logout/logout-success-handler.js +36 -0
- package/esm/node/logout/logout-success-handler.js.map +1 -0
- package/esm/node/module.d.ts +4 -0
- package/esm/node/module.js +5 -0
- package/esm/node/module.js.map +1 -0
- package/esm/node/user/index.d.ts +5 -0
- package/esm/node/user/index.js +6 -0
- package/esm/node/user/index.js.map +1 -0
- package/esm/node/user/user-checker.d.ts +7 -0
- package/esm/node/user/user-checker.js +41 -0
- package/esm/node/user/user-checker.js.map +1 -0
- package/esm/node/user/user-mapper.d.ts +8 -0
- package/esm/node/user/user-mapper.js +37 -0
- package/esm/node/user/user-mapper.js.map +1 -0
- package/esm/node/user/user-middleware.d.ts +10 -0
- package/esm/node/user/user-middleware.js +52 -0
- package/esm/node/user/user-middleware.js.map +1 -0
- package/esm/node/user/user-protocol.d.ts +14 -0
- package/esm/node/user/user-protocol.js +6 -0
- package/esm/node/user/user-protocol.js.map +1 -0
- package/esm/node/user/user-service.d.ts +6 -0
- package/esm/node/user/user-service.js +39 -0
- package/esm/node/user/user-service.js.map +1 -0
- package/esm/package.json +3 -0
- package/package.json +93 -6
|
@@ -0,0 +1,94 @@
|
|
|
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 { AuthenticationSuccessHandler } from './authentication-protocol.js';
|
|
11
|
+
import { Component, Value, Autowired, Logger } from '@celljs/core';
|
|
12
|
+
import { Context, RedirectStrategy } from '@celljs/web/lib/node';
|
|
13
|
+
import { HttpHeaders, XML_HTTP_REQUEST } from '@celljs/http';
|
|
14
|
+
import { RequestCache } from '../cache/index.js';
|
|
15
|
+
let DefaultAuthenticationSuccessHandler = class DefaultAuthenticationSuccessHandler {
|
|
16
|
+
async onAuthenticationSuccess(authentication) {
|
|
17
|
+
const response = Context.getResponse();
|
|
18
|
+
if (Context.getRequest().get(HttpHeaders.X_REQUESTED_WITH) === XML_HTTP_REQUEST) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if (!this.loginSuccessUrl) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const targetUrl = await this.determineTargetUrl(authentication);
|
|
25
|
+
if (response.writableEnded) {
|
|
26
|
+
this.logger.debug(`Response has already been committed. Unable to redirect to ${targetUrl}`);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
await this.redirectStrategy.send(targetUrl);
|
|
30
|
+
}
|
|
31
|
+
async determineTargetUrl(authentication) {
|
|
32
|
+
if (this.alwaysUseLoginSuccessUrl) {
|
|
33
|
+
return this.loginSuccessUrl;
|
|
34
|
+
}
|
|
35
|
+
let targetUrl;
|
|
36
|
+
const request = Context.getRequest();
|
|
37
|
+
if (this.targetUrlParameter) {
|
|
38
|
+
targetUrl = request.query[this.targetUrlParameter];
|
|
39
|
+
if (targetUrl) {
|
|
40
|
+
this.logger.debug(`Found targetUrlParameter in request: ${targetUrl}`);
|
|
41
|
+
return targetUrl;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (this.useReferer) {
|
|
45
|
+
const referer = request.get(HttpHeaders.REFERER);
|
|
46
|
+
targetUrl = (referer === null || referer === void 0 ? void 0 : referer.length) ? referer[0] : '';
|
|
47
|
+
this.logger.debug(`Using Referer header: ${targetUrl}`);
|
|
48
|
+
}
|
|
49
|
+
const savedRequest = await this.requestCache.get();
|
|
50
|
+
if (savedRequest) {
|
|
51
|
+
await this.requestCache.remove();
|
|
52
|
+
targetUrl = savedRequest.redirectUrl;
|
|
53
|
+
this.logger.debug(`Redirecting to SavedRequest Url: ${targetUrl}`);
|
|
54
|
+
}
|
|
55
|
+
if (!targetUrl) {
|
|
56
|
+
targetUrl = this.loginSuccessUrl;
|
|
57
|
+
this.logger.debug(`Using default Url: ${targetUrl}`);
|
|
58
|
+
}
|
|
59
|
+
return targetUrl;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
__decorate([
|
|
63
|
+
Value('cell.security.targetUrlParameter'),
|
|
64
|
+
__metadata("design:type", String)
|
|
65
|
+
], DefaultAuthenticationSuccessHandler.prototype, "targetUrlParameter", void 0);
|
|
66
|
+
__decorate([
|
|
67
|
+
Value('cell.security.loginSuccessUrl'),
|
|
68
|
+
__metadata("design:type", String)
|
|
69
|
+
], DefaultAuthenticationSuccessHandler.prototype, "loginSuccessUrl", void 0);
|
|
70
|
+
__decorate([
|
|
71
|
+
Value('cell.security.alwaysUseLoginSuccessUrl'),
|
|
72
|
+
__metadata("design:type", Boolean)
|
|
73
|
+
], DefaultAuthenticationSuccessHandler.prototype, "alwaysUseLoginSuccessUrl", void 0);
|
|
74
|
+
__decorate([
|
|
75
|
+
Value('cell.security.useReferer'),
|
|
76
|
+
__metadata("design:type", Boolean)
|
|
77
|
+
], DefaultAuthenticationSuccessHandler.prototype, "useReferer", void 0);
|
|
78
|
+
__decorate([
|
|
79
|
+
Autowired(Logger),
|
|
80
|
+
__metadata("design:type", Object)
|
|
81
|
+
], DefaultAuthenticationSuccessHandler.prototype, "logger", void 0);
|
|
82
|
+
__decorate([
|
|
83
|
+
Autowired(RedirectStrategy),
|
|
84
|
+
__metadata("design:type", Object)
|
|
85
|
+
], DefaultAuthenticationSuccessHandler.prototype, "redirectStrategy", void 0);
|
|
86
|
+
__decorate([
|
|
87
|
+
Autowired(RequestCache),
|
|
88
|
+
__metadata("design:type", Object)
|
|
89
|
+
], DefaultAuthenticationSuccessHandler.prototype, "requestCache", void 0);
|
|
90
|
+
DefaultAuthenticationSuccessHandler = __decorate([
|
|
91
|
+
Component(AuthenticationSuccessHandler)
|
|
92
|
+
], DefaultAuthenticationSuccessHandler);
|
|
93
|
+
export { DefaultAuthenticationSuccessHandler };
|
|
94
|
+
//# sourceMappingURL=authentication-success-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authentication-success-handler.js","sourceRoot":"","sources":["../../../src/node/authentication/authentication-success-handler.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,4BAA4B,EAAkB,MAAM,2BAA2B,CAAC;AACzF,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO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
|
|
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 @@
|
|
|
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 @@
|
|
|
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,IAA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xB,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 @@
|
|
|
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 @@
|
|
|
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,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 @@
|
|
|
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 @@
|
|
|
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 @@
|
|
|
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
|