@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,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 { UserMapper } from './user-protocol.js';
|
|
11
|
+
import { Component, Value } from '@celljs/core';
|
|
12
|
+
let UserMapperImpl = class UserMapperImpl {
|
|
13
|
+
async map(user) {
|
|
14
|
+
if (user.type && user.claims) {
|
|
15
|
+
const rule = this.rules[user.type];
|
|
16
|
+
if (rule) {
|
|
17
|
+
for (const prop in rule) {
|
|
18
|
+
if (Object.prototype.hasOwnProperty.call(rule, prop)) {
|
|
19
|
+
const value = rule[prop];
|
|
20
|
+
if (value) {
|
|
21
|
+
user[prop] = user.claims[value];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
__decorate([
|
|
30
|
+
Value('cell.security.userMapperRule'),
|
|
31
|
+
__metadata("design:type", Object)
|
|
32
|
+
], UserMapperImpl.prototype, "rules", void 0);
|
|
33
|
+
UserMapperImpl = __decorate([
|
|
34
|
+
Component(UserMapper)
|
|
35
|
+
], UserMapperImpl);
|
|
36
|
+
export { UserMapperImpl };
|
|
37
|
+
//# sourceMappingURL=user-mapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-mapper.js","sourceRoot":"","sources":["../../../src/node/user/user-mapper.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAIzC,IAAM,cAAc,GAApB,MAAM,cAAc;IAKvB,KAAK,CAAC,GAAG,CAAC,IAAU;QAChB,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAC3B,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACnC,IAAI,IAAI,EAAE,CAAC;gBACP,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE,CAAC;oBACtB,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC;wBACnD,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;wBACzB,IAAI,KAAK,EAAE,CAAC;4BACR,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;wBACpC,CAAC;oBACL,CAAC;gBACL,CAAC;YACL,CAAC;QACL,CAAC;IACL,CAAC;CACJ,CAAA;AAjBa;IADT,KAAK,CAAC,8BAA8B,CAAC;;6CACY;AAHzC,cAAc;IAD1B,SAAS,CAAC,UAAU,CAAC;GACT,cAAc,CAoB1B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RequestMatcher, Middleware, Context } from '@celljs/web/lib/node';
|
|
2
|
+
import { PathResolver } from '@celljs/web';
|
|
3
|
+
export declare class UserMiddleware implements Middleware {
|
|
4
|
+
protected readonly userInfoEndpoint: any;
|
|
5
|
+
protected readonly pathResolver: PathResolver;
|
|
6
|
+
protected readonly requestMatcher: RequestMatcher;
|
|
7
|
+
handle(ctx: Context, next: () => Promise<void>): Promise<void>;
|
|
8
|
+
canHandle(): Promise<boolean>;
|
|
9
|
+
readonly priority: number;
|
|
10
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
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 { RequestMatcher, Middleware } from '@celljs/web/lib/node';
|
|
11
|
+
import { Component, Autowired, Value } from '@celljs/core';
|
|
12
|
+
import { HttpHeaders, MediaType } from '@celljs/http';
|
|
13
|
+
import { PathResolver } from '@celljs/web';
|
|
14
|
+
import { USER_MIDDLEWARE_PRIORITY } from './user-protocol.js';
|
|
15
|
+
import { SecurityContext } from '../context/context-protocol.js';
|
|
16
|
+
let UserMiddleware = class UserMiddleware {
|
|
17
|
+
constructor() {
|
|
18
|
+
this.priority = USER_MIDDLEWARE_PRIORITY;
|
|
19
|
+
}
|
|
20
|
+
async handle(ctx, next) {
|
|
21
|
+
if (await this.canHandle()) {
|
|
22
|
+
const auth = SecurityContext.getAuthentication();
|
|
23
|
+
if (auth.authenticated) {
|
|
24
|
+
ctx.response.setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_UTF8);
|
|
25
|
+
ctx.response.body = JSON.stringify(auth.principal);
|
|
26
|
+
}
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
await next();
|
|
30
|
+
}
|
|
31
|
+
async canHandle() {
|
|
32
|
+
const { url, method } = this.userInfoEndpoint;
|
|
33
|
+
return !!await this.requestMatcher.match(await this.pathResolver.resolve(url), method);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
__decorate([
|
|
37
|
+
Value('cell.security.userInfoEndpoint'),
|
|
38
|
+
__metadata("design:type", Object)
|
|
39
|
+
], UserMiddleware.prototype, "userInfoEndpoint", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
Autowired(PathResolver),
|
|
42
|
+
__metadata("design:type", Object)
|
|
43
|
+
], UserMiddleware.prototype, "pathResolver", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
Autowired(RequestMatcher),
|
|
46
|
+
__metadata("design:type", Object)
|
|
47
|
+
], UserMiddleware.prototype, "requestMatcher", void 0);
|
|
48
|
+
UserMiddleware = __decorate([
|
|
49
|
+
Component(Middleware)
|
|
50
|
+
], UserMiddleware);
|
|
51
|
+
export { UserMiddleware };
|
|
52
|
+
//# sourceMappingURL=user-middleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-middleware.js","sourceRoot":"","sources":["../../../src/node/user/user-middleware.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAW,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAGvD,IAAM,cAAc,GAApB,MAAM,cAAc;IAApB;QA6BM,aAAQ,GAAW,wBAAwB,CAAC;IAEzD,CAAC;IApBG,KAAK,CAAC,MAAM,CAAC,GAAY,EAAE,IAAyB;QAChD,IAAI,MAAM,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC;YACzB,MAAM,IAAI,GAAG,eAAe,CAAC,iBAAiB,EAAE,CAAC;YACjD,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;gBACrB,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC,WAAW,CAAC,YAAY,EAAE,SAAS,CAAC,qBAAqB,CAAC,CAAC;gBAClF,GAAG,CAAC,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YACvD,CAAC;YACD,OAAO;QACX,CAAC;QACD,MAAM,IAAI,EAAE,CAAC;IAEjB,CAAC;IAED,KAAK,CAAC,SAAS;QACX,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,gBAAgB,CAAC;QAC9C,OAAO,CAAC,CAAC,MAAM,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC;IAC3F,CAAC;CAIJ,CAAA;AA5BsB;IADlB,KAAK,CAAC,gCAAgC,CAAC;;wDACC;AAGtB;IADlB,SAAS,CAAC,YAAY,CAAC;;oDACsB;AAG3B;IADlB,SAAS,CAAC,cAAc,CAAC;;sDACwB;AATzC,cAAc;IAD1B,SAAS,CAAC,UAAU,CAAC;GACT,cAAc,CA+B1B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { User } from '../../common/index.js';
|
|
2
|
+
export declare const UserService: unique symbol;
|
|
3
|
+
export declare const UserChecker: unique symbol;
|
|
4
|
+
export declare const UserMapper: unique symbol;
|
|
5
|
+
export declare const USER_MIDDLEWARE_PRIORITY: number;
|
|
6
|
+
export interface UserService<R, U extends User> {
|
|
7
|
+
load(userRequest: R): Promise<U>;
|
|
8
|
+
}
|
|
9
|
+
export interface UserChecker {
|
|
10
|
+
check(user: User): Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
export interface UserMapper {
|
|
13
|
+
map(user: User): Promise<void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { SECURITY_CONTEXT_MIDDLEWARE_PRIORITY } from '../context/context-protocol.js';
|
|
2
|
+
export const UserService = Symbol('UserService');
|
|
3
|
+
export const UserChecker = Symbol('UserChecker');
|
|
4
|
+
export const UserMapper = Symbol('UserMapper');
|
|
5
|
+
export const USER_MIDDLEWARE_PRIORITY = SECURITY_CONTEXT_MIDDLEWARE_PRIORITY - 100;
|
|
6
|
+
//# sourceMappingURL=user-protocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-protocol.js","sourceRoot":"","sources":["../../../src/node/user/user-protocol.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oCAAoC,EAAE,MAAM,6BAA6B,CAAC;AAEnF,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;AACjD,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;AACjD,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;AAE/C,MAAM,CAAC,MAAM,wBAAwB,GAAG,oCAAoC,GAAG,GAAG,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
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 { UserService } from './user-protocol.js';
|
|
11
|
+
import { Value, Component } from '@celljs/core';
|
|
12
|
+
import { UsernameNotFoundError } from '../error/index.js';
|
|
13
|
+
import { UserType } from '../../common/index.js';
|
|
14
|
+
let UserServiceImpl = class UserServiceImpl {
|
|
15
|
+
async load(username) {
|
|
16
|
+
if (this.options.username === username) {
|
|
17
|
+
return {
|
|
18
|
+
type: UserType.Memery,
|
|
19
|
+
username,
|
|
20
|
+
password: this.options.password,
|
|
21
|
+
accountNonExpired: true,
|
|
22
|
+
accountNonLocked: true,
|
|
23
|
+
credentialsNonExpired: true,
|
|
24
|
+
enabled: true,
|
|
25
|
+
policies: []
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
throw new UsernameNotFoundError(`Could not find: ${username}`);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
__decorate([
|
|
32
|
+
Value('cell.security'),
|
|
33
|
+
__metadata("design:type", Object)
|
|
34
|
+
], UserServiceImpl.prototype, "options", void 0);
|
|
35
|
+
UserServiceImpl = __decorate([
|
|
36
|
+
Component(UserService)
|
|
37
|
+
], UserServiceImpl);
|
|
38
|
+
export { UserServiceImpl };
|
|
39
|
+
//# sourceMappingURL=user-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-service.js","sourceRoot":"","sources":["../../../src/node/user/user-service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAQ,QAAQ,EAAE,MAAM,cAAc,CAAC;AAGvC,IAAM,eAAe,GAArB,MAAM,eAAe;IAKxB,KAAK,CAAC,IAAI,CAAC,QAAgB;QACvB,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;YACrC,OAAO;gBACH,IAAI,EAAE,QAAQ,CAAC,MAAM;gBACrB,QAAQ;gBACR,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ;gBAC/B,iBAAiB,EAAE,IAAI;gBACvB,gBAAgB,EAAE,IAAI;gBACtB,qBAAqB,EAAE,IAAI;gBAC3B,OAAO,EAAE,IAAI;gBACb,QAAQ,EAAE,EAAE;aACf,CAAC;QACN,CAAC;QAED,MAAM,IAAI,qBAAqB,CAAC,mBAAmB,QAAQ,EAAE,CAAC,CAAC;IACnE,CAAC;CACJ,CAAA;AAlBsB;IADlB,KAAK,CAAC,eAAe,CAAC;;gDACS;AAHvB,eAAe;IAD3B,SAAS,CAAC,WAAW,CAAC;GACV,eAAe,CAqB3B"}
|
package/esm/package.json
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@celljs/security",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cell-component"
|
|
@@ -18,19 +18,20 @@
|
|
|
18
18
|
"typings": "lib/common/index.d.ts",
|
|
19
19
|
"files": [
|
|
20
20
|
"lib",
|
|
21
|
+
"esm",
|
|
21
22
|
"src",
|
|
22
23
|
"cell.yml"
|
|
23
24
|
],
|
|
24
25
|
"scripts": {
|
|
25
|
-
"build": "tsc -b",
|
|
26
|
-
"clean": "rm -rf lib *.tsbuildinfo",
|
|
26
|
+
"build": "tsc -b && bun ../../scripts/build-esm.ts",
|
|
27
|
+
"clean": "rm -rf lib esm *.tsbuildinfo",
|
|
27
28
|
"test": "bun test --preload reflect-metadata ./lib",
|
|
28
29
|
"watch": "tsc -b -w --preserveWatchOutput"
|
|
29
30
|
},
|
|
30
31
|
"dependencies": {
|
|
31
|
-
"@celljs/core": "
|
|
32
|
-
"@celljs/http": "
|
|
33
|
-
"@celljs/web": "
|
|
32
|
+
"@celljs/core": "4.0.0",
|
|
33
|
+
"@celljs/http": "4.0.0",
|
|
34
|
+
"@celljs/web": "4.0.0",
|
|
34
35
|
"axios": "^0.26.1",
|
|
35
36
|
"crypto-js": "^4.0.0",
|
|
36
37
|
"jexl": "^2.2.0",
|
|
@@ -47,5 +48,91 @@
|
|
|
47
48
|
},
|
|
48
49
|
"publishConfig": {
|
|
49
50
|
"access": "public"
|
|
51
|
+
},
|
|
52
|
+
"exports": {
|
|
53
|
+
".": {
|
|
54
|
+
"import": "./esm/common/index.js",
|
|
55
|
+
"default": "./lib/common/index.js"
|
|
56
|
+
},
|
|
57
|
+
"./package.json": "./package.json",
|
|
58
|
+
"./lib/browser": {
|
|
59
|
+
"import": "./esm/browser/index.js",
|
|
60
|
+
"default": "./lib/browser/index.js"
|
|
61
|
+
},
|
|
62
|
+
"./lib/browser/user": {
|
|
63
|
+
"import": "./esm/browser/user/index.js",
|
|
64
|
+
"default": "./lib/browser/user/index.js"
|
|
65
|
+
},
|
|
66
|
+
"./lib/common": {
|
|
67
|
+
"import": "./esm/common/index.js",
|
|
68
|
+
"default": "./lib/common/index.js"
|
|
69
|
+
},
|
|
70
|
+
"./lib/node": {
|
|
71
|
+
"import": "./esm/node/index.js",
|
|
72
|
+
"default": "./lib/node/index.js"
|
|
73
|
+
},
|
|
74
|
+
"./lib/node/access": {
|
|
75
|
+
"import": "./esm/node/access/index.js",
|
|
76
|
+
"default": "./lib/node/access/index.js"
|
|
77
|
+
},
|
|
78
|
+
"./lib/node/annotation": {
|
|
79
|
+
"import": "./esm/node/annotation/index.js",
|
|
80
|
+
"default": "./lib/node/annotation/index.js"
|
|
81
|
+
},
|
|
82
|
+
"./lib/node/authentication": {
|
|
83
|
+
"import": "./esm/node/authentication/index.js",
|
|
84
|
+
"default": "./lib/node/authentication/index.js"
|
|
85
|
+
},
|
|
86
|
+
"./lib/node/cache": {
|
|
87
|
+
"import": "./esm/node/cache/index.js",
|
|
88
|
+
"default": "./lib/node/cache/index.js"
|
|
89
|
+
},
|
|
90
|
+
"./lib/node/context": {
|
|
91
|
+
"import": "./esm/node/context/index.js",
|
|
92
|
+
"default": "./lib/node/context/index.js"
|
|
93
|
+
},
|
|
94
|
+
"./lib/node/crypto": {
|
|
95
|
+
"import": "./esm/node/crypto/index.js",
|
|
96
|
+
"default": "./lib/node/crypto/index.js"
|
|
97
|
+
},
|
|
98
|
+
"./lib/node/crypto/keygen": {
|
|
99
|
+
"import": "./esm/node/crypto/keygen/index.js",
|
|
100
|
+
"default": "./lib/node/crypto/keygen/index.js"
|
|
101
|
+
},
|
|
102
|
+
"./lib/node/crypto/password": {
|
|
103
|
+
"import": "./esm/node/crypto/password/index.js",
|
|
104
|
+
"default": "./lib/node/crypto/password/index.js"
|
|
105
|
+
},
|
|
106
|
+
"./lib/node/error": {
|
|
107
|
+
"import": "./esm/node/error/index.js",
|
|
108
|
+
"default": "./lib/node/error/index.js"
|
|
109
|
+
},
|
|
110
|
+
"./lib/node/logout": {
|
|
111
|
+
"import": "./esm/node/logout/index.js",
|
|
112
|
+
"default": "./lib/node/logout/index.js"
|
|
113
|
+
},
|
|
114
|
+
"./lib/node/user": {
|
|
115
|
+
"import": "./esm/node/user/index.js",
|
|
116
|
+
"default": "./lib/node/user/index.js"
|
|
117
|
+
},
|
|
118
|
+
"./lib/*.js": {
|
|
119
|
+
"import": "./esm/*.js",
|
|
120
|
+
"default": "./lib/*.js"
|
|
121
|
+
},
|
|
122
|
+
"./lib/*": {
|
|
123
|
+
"import": "./esm/*.js",
|
|
124
|
+
"default": "./lib/*.js"
|
|
125
|
+
},
|
|
126
|
+
"./*": "./*"
|
|
127
|
+
},
|
|
128
|
+
"cell": {
|
|
129
|
+
"modules": {
|
|
130
|
+
"frontend": [
|
|
131
|
+
"lib/browser/module"
|
|
132
|
+
],
|
|
133
|
+
"backend": [
|
|
134
|
+
"lib/node/module"
|
|
135
|
+
]
|
|
136
|
+
}
|
|
50
137
|
}
|
|
51
138
|
}
|