@alanszp/jwt 14.1.2 → 14.3.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/dist/JWTUser.d.ts +3 -1
- package/dist/JWTUser.js +10 -2
- package/dist/JWTUser.js.map +1 -1
- package/dist/types.d.ts +6 -0
- package/package.json +2 -2
package/dist/JWTUser.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ export declare class JWTUser implements IJWTUser {
|
|
|
6
6
|
employeeReference: string | null;
|
|
7
7
|
organizationReference: string;
|
|
8
8
|
originalOrganizationReference: string | null;
|
|
9
|
+
originalId: string | null;
|
|
10
|
+
originalEmployeeReference: string | null;
|
|
9
11
|
roles: string[];
|
|
10
12
|
permissions: string;
|
|
11
13
|
segmentReference: string | null;
|
|
@@ -17,7 +19,7 @@ export declare class JWTUser implements IJWTUser {
|
|
|
17
19
|
* @throws {PermissionServiceNotInstantiated}
|
|
18
20
|
*/
|
|
19
21
|
static getPermissionService(): IPermissionService;
|
|
20
|
-
constructor({ id, employeeReference, organizationReference, roles, permissions, segmentReference, }: IJWTUser);
|
|
22
|
+
constructor({ id, employeeReference, organizationReference, roles, permissions, segmentReference, originalOrganizationReference, originalId, originalEmployeeReference, }: IJWTUser);
|
|
21
23
|
static fromPayload(payload: JWTPayload): JWTUser;
|
|
22
24
|
toTokenPayload(): JWTPayload;
|
|
23
25
|
/**
|
package/dist/JWTUser.js
CHANGED
|
@@ -27,14 +27,16 @@ const PermissionNotFound_1 = require("./errors/PermissionNotFound");
|
|
|
27
27
|
const PermissionServiceNotInstantiated_1 = require("./errors/PermissionServiceNotInstantiated");
|
|
28
28
|
const NoPermissionError_1 = require("./errors/NoPermissionError");
|
|
29
29
|
class JWTUser {
|
|
30
|
-
constructor({ id, employeeReference, organizationReference, roles, permissions, segmentReference, }) {
|
|
30
|
+
constructor({ id, employeeReference, organizationReference, roles, permissions, segmentReference, originalOrganizationReference, originalId, originalEmployeeReference, }) {
|
|
31
31
|
this.id = id;
|
|
32
32
|
this.employeeReference = employeeReference;
|
|
33
33
|
this.organizationReference = organizationReference;
|
|
34
|
-
this.originalOrganizationReference = organizationReference;
|
|
35
34
|
this.roles = roles;
|
|
36
35
|
this.permissions = permissions;
|
|
37
36
|
this.segmentReference = segmentReference;
|
|
37
|
+
this.originalOrganizationReference = originalOrganizationReference !== null && originalOrganizationReference !== void 0 ? originalOrganizationReference : null;
|
|
38
|
+
this.originalId = originalId !== null && originalId !== void 0 ? originalId : null;
|
|
39
|
+
this.originalEmployeeReference = originalEmployeeReference !== null && originalEmployeeReference !== void 0 ? originalEmployeeReference : null;
|
|
38
40
|
}
|
|
39
41
|
/**
|
|
40
42
|
* Instantiate the permission service for all instances of JWTUser
|
|
@@ -59,6 +61,9 @@ class JWTUser {
|
|
|
59
61
|
roles: payload.rls,
|
|
60
62
|
permissions: payload.prms,
|
|
61
63
|
segmentReference: payload.seg || null,
|
|
64
|
+
originalOrganizationReference: payload.oorg,
|
|
65
|
+
originalId: payload.osub,
|
|
66
|
+
originalEmployeeReference: payload.oref,
|
|
62
67
|
});
|
|
63
68
|
}
|
|
64
69
|
toTokenPayload() {
|
|
@@ -69,6 +74,9 @@ class JWTUser {
|
|
|
69
74
|
rls: this.roles,
|
|
70
75
|
prms: this.permissions,
|
|
71
76
|
seg: this.segmentReference,
|
|
77
|
+
oorg: this.originalOrganizationReference,
|
|
78
|
+
osub: this.originalId,
|
|
79
|
+
oref: this.originalEmployeeReference,
|
|
72
80
|
};
|
|
73
81
|
}
|
|
74
82
|
/**
|
package/dist/JWTUser.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JWTUser.js","sourceRoot":"","sources":["../src/JWTUser.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA8C;AAE9C,oEAA2E;AAC3E,gGAA6F;AAE7F,kEAA+D;AAE/D,MAAa,OAAO;
|
|
1
|
+
{"version":3,"file":"JWTUser.js","sourceR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CAAC,CAAC;aAChD;QACH,CAAC;KAAA;IAED;;;;;;OAMG;IACU,iBAAiB,CAAC,eAAyB;;YACtD,KAAK,MAAM,cAAc,IAAI,eAAe,EAAE;gBAC5C,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;gBAC/D,IAAI,aAAa,EAAE;oBACjB,OAAO,IAAI,CAAC;iBACb;aACF;YACD,OAAO,KAAK,CAAC;QACf,CAAC;KAAA;IAED;;;;;;OAMG;IACU,sBAAsB,CACjC,eAAyB;;YAEzB,MAAM,iBAAiB,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAAC;YACxE,IAAI,CAAC,iBAAiB,EAAE;gBACtB,MAAM,IAAI,qCAAiB,CAAC,eAAe,CAAC,CAAC;aAC9C;QACH,CAAC;KAAA;IAED;;;OAGG;IACW,uBAAuB,CACnC,cAAsB;;YAEtB,MAAM,WAAW,GAAG,MAAM,OAAO,CAAC,oBAAoB,EAAE,CAAC,cAAc,EAAE,CAAC;YAC1E,MAAM,UAAU,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,cAAc,CAAC,CAAC;YAC1E,IAAI,CAAC,UAAU,EAAE;gBACf,MAAM,IAAI,iDAA4B,CAAC,cAAc,CAAC,CAAC;aACxD;YACD,OAAO,UAAU,CAAC;QACpB,CAAC;KAAA;;AAnOH,0BAoOC;;AAjNC;;;;GAIG;AACH,sCAAuD,IAAI,EAAC,CAAA"}
|
package/dist/types.d.ts
CHANGED
|
@@ -5,6 +5,9 @@ export interface JWTPayload extends LibPayload {
|
|
|
5
5
|
org: string;
|
|
6
6
|
rls: string[];
|
|
7
7
|
prms: string;
|
|
8
|
+
oorg: string | null;
|
|
9
|
+
osub: string | null;
|
|
10
|
+
oref: string | null;
|
|
8
11
|
seg: string | null;
|
|
9
12
|
}
|
|
10
13
|
export interface IJWTUser {
|
|
@@ -14,6 +17,9 @@ export interface IJWTUser {
|
|
|
14
17
|
roles: string[];
|
|
15
18
|
permissions: string;
|
|
16
19
|
segmentReference: string | null;
|
|
20
|
+
originalOrganizationReference?: string | null;
|
|
21
|
+
originalId?: string | null;
|
|
22
|
+
originalEmployeeReference?: string | null;
|
|
17
23
|
}
|
|
18
24
|
export interface SignOptions {
|
|
19
25
|
issuer: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alanszp/jwt",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.3.0",
|
|
4
4
|
"description": "Alan's jwt validator & signer.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"@alanszp/logger": "^14.0.4",
|
|
35
35
|
"jose": "^5.2.2"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "04e3c02c5398f797fb4cb160296ce8d6de7d96d3"
|
|
38
38
|
}
|