@cellaware/utils 3.4.37 → 3.5.1
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/chatwms/user.d.ts +10 -0
- package/dist/chatwms/user.js +22 -1
- package/package.json +1 -1
package/dist/chatwms/user.d.ts
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* https://learn.microsoft.com/en-us/entra/identity-platform/id-token-claims-reference
|
|
3
|
+
*/
|
|
4
|
+
export interface ChatWMSUserClaim {
|
|
5
|
+
typ: string;
|
|
6
|
+
val: string;
|
|
7
|
+
}
|
|
1
8
|
export interface ChatWMSUserData {
|
|
2
9
|
userId: string;
|
|
3
10
|
userDetails: string;
|
|
4
11
|
identityProvider: string;
|
|
12
|
+
claims?: ChatWMSUserClaim[];
|
|
5
13
|
}
|
|
6
14
|
export declare function chatwmsInitUserData(): ChatWMSUserData;
|
|
15
|
+
export declare function chatwmsGetObjectIdClaim(claims?: ChatWMSUserClaim[]): string | undefined;
|
|
16
|
+
export declare function chatwmsGetTenantIdClaim(claims?: ChatWMSUserClaim[]): string | undefined;
|
package/dist/chatwms/user.js
CHANGED
|
@@ -2,6 +2,27 @@ export function chatwmsInitUserData() {
|
|
|
2
2
|
return {
|
|
3
3
|
userId: '',
|
|
4
4
|
userDetails: '',
|
|
5
|
-
identityProvider: ''
|
|
5
|
+
identityProvider: '',
|
|
6
|
+
claims: [],
|
|
6
7
|
};
|
|
7
8
|
}
|
|
9
|
+
export function chatwmsGetObjectIdClaim(claims) {
|
|
10
|
+
let oid = undefined;
|
|
11
|
+
for (const claim of claims ?? []) {
|
|
12
|
+
if (claim.typ === 'oid' || claim.typ.endsWith('/objectidentifier')) {
|
|
13
|
+
oid = claim.val;
|
|
14
|
+
break;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return oid;
|
|
18
|
+
}
|
|
19
|
+
export function chatwmsGetTenantIdClaim(claims) {
|
|
20
|
+
let tenantId = undefined;
|
|
21
|
+
for (const claim of claims ?? []) {
|
|
22
|
+
if (claim.typ === 'tid' || claim.typ.endsWith('/tenantid')) {
|
|
23
|
+
tenantId = claim.val;
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return tenantId;
|
|
28
|
+
}
|