@azure/msal-node 2.0.2 → 2.2.0-alpha.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/README.md +3 -1
- package/dist/cache/ITokenCache.d.ts +15 -15
- package/dist/cache/NodeStorage.cjs +401 -401
- package/dist/cache/NodeStorage.cjs.map +1 -1
- package/dist/cache/NodeStorage.d.ts +182 -182
- package/dist/cache/NodeStorage.d.ts.map +1 -1
- package/dist/cache/NodeStorage.mjs +401 -401
- package/dist/cache/NodeStorage.mjs.map +1 -1
- package/dist/cache/TokenCache.cjs +265 -269
- package/dist/cache/TokenCache.cjs.map +1 -1
- package/dist/cache/TokenCache.d.ts +90 -90
- package/dist/cache/TokenCache.d.ts.map +1 -1
- package/dist/cache/TokenCache.mjs +266 -270
- package/dist/cache/TokenCache.mjs.map +1 -1
- package/dist/cache/distributed/DistributedCachePlugin.cjs +26 -26
- package/dist/cache/distributed/DistributedCachePlugin.cjs.map +1 -1
- package/dist/cache/distributed/DistributedCachePlugin.d.ts +10 -10
- package/dist/cache/distributed/DistributedCachePlugin.d.ts.map +1 -1
- package/dist/cache/distributed/DistributedCachePlugin.mjs +26 -26
- package/dist/cache/distributed/DistributedCachePlugin.mjs.map +1 -1
- package/dist/cache/distributed/ICacheClient.d.ts +17 -17
- package/dist/cache/distributed/IPartitionManager.d.ts +28 -28
- package/dist/cache/serializer/Deserializer.cjs +173 -175
- package/dist/cache/serializer/Deserializer.cjs.map +1 -1
- package/dist/cache/serializer/Deserializer.d.ts +42 -42
- package/dist/cache/serializer/Deserializer.d.ts.map +1 -1
- package/dist/cache/serializer/Deserializer.mjs +174 -176
- package/dist/cache/serializer/Deserializer.mjs.map +1 -1
- package/dist/cache/serializer/Serializer.cjs +134 -134
- package/dist/cache/serializer/Serializer.cjs.map +1 -1
- package/dist/cache/serializer/Serializer.d.ts +39 -39
- package/dist/cache/serializer/Serializer.d.ts.map +1 -1
- package/dist/cache/serializer/Serializer.mjs +134 -134
- package/dist/cache/serializer/Serializer.mjs.map +1 -1
- package/dist/cache/serializer/SerializerTypes.d.ts +101 -101
- package/dist/client/ClientApplication.cjs +333 -333
- package/dist/client/ClientApplication.cjs.map +1 -1
- package/dist/client/ClientApplication.d.ts +142 -142
- package/dist/client/ClientApplication.d.ts.map +1 -1
- package/dist/client/ClientApplication.mjs +334 -334
- package/dist/client/ClientApplication.mjs.map +1 -1
- package/dist/client/ClientAssertion.cjs +116 -116
- package/dist/client/ClientAssertion.cjs.map +1 -1
- package/dist/client/ClientAssertion.d.ts +46 -46
- package/dist/client/ClientAssertion.d.ts.map +1 -1
- package/dist/client/ClientAssertion.mjs +117 -117
- package/dist/client/ClientAssertion.mjs.map +1 -1
- package/dist/client/ClientCredentialClient.cjs +189 -168
- package/dist/client/ClientCredentialClient.cjs.map +1 -1
- package/dist/client/ClientCredentialClient.d.ts +33 -33
- package/dist/client/ClientCredentialClient.d.ts.map +1 -1
- package/dist/client/ClientCredentialClient.mjs +190 -169
- package/dist/client/ClientCredentialClient.mjs.map +1 -1
- package/dist/client/ConfidentialClientApplication.cjs +163 -164
- package/dist/client/ConfidentialClientApplication.cjs.map +1 -1
- package/dist/client/ConfidentialClientApplication.d.ts +58 -58
- package/dist/client/ConfidentialClientApplication.d.ts.map +1 -1
- package/dist/client/ConfidentialClientApplication.mjs +164 -165
- package/dist/client/ConfidentialClientApplication.mjs.map +1 -1
- package/dist/client/DeviceCodeClient.cjs +207 -207
- package/dist/client/DeviceCodeClient.cjs.map +1 -1
- package/dist/client/DeviceCodeClient.d.ts +53 -53
- package/dist/client/DeviceCodeClient.d.ts.map +1 -1
- package/dist/client/DeviceCodeClient.mjs +208 -208
- package/dist/client/DeviceCodeClient.mjs.map +1 -1
- package/dist/client/IConfidentialClientApplication.d.ts +39 -39
- package/dist/client/IConfidentialClientApplication.d.ts.map +1 -1
- package/dist/client/IPublicClientApplication.d.ts +42 -42
- package/dist/client/IPublicClientApplication.d.ts.map +1 -1
- package/dist/client/OnBehalfOfClient.cjs +203 -204
- package/dist/client/OnBehalfOfClient.cjs.map +1 -1
- package/dist/client/OnBehalfOfClient.d.ts +47 -47
- package/dist/client/OnBehalfOfClient.d.ts.map +1 -1
- package/dist/client/OnBehalfOfClient.mjs +204 -205
- package/dist/client/OnBehalfOfClient.mjs.map +1 -1
- package/dist/client/PublicClientApplication.cjs +229 -175
- package/dist/client/PublicClientApplication.cjs.map +1 -1
- package/dist/client/PublicClientApplication.d.ts +71 -65
- package/dist/client/PublicClientApplication.d.ts.map +1 -1
- package/dist/client/PublicClientApplication.mjs +232 -178
- package/dist/client/PublicClientApplication.mjs.map +1 -1
- package/dist/client/UsernamePasswordClient.cjs +95 -95
- package/dist/client/UsernamePasswordClient.cjs.map +1 -1
- package/dist/client/UsernamePasswordClient.d.ts +25 -25
- package/dist/client/UsernamePasswordClient.d.ts.map +1 -1
- package/dist/client/UsernamePasswordClient.mjs +95 -95
- package/dist/client/UsernamePasswordClient.mjs.map +1 -1
- package/dist/config/Configuration.cjs +72 -72
- package/dist/config/Configuration.cjs.map +1 -1
- package/dist/config/Configuration.d.ts +107 -107
- package/dist/config/Configuration.mjs +72 -72
- package/dist/config/Configuration.mjs.map +1 -1
- package/dist/crypto/CryptoProvider.cjs +75 -75
- package/dist/crypto/CryptoProvider.cjs.map +1 -1
- package/dist/crypto/CryptoProvider.d.ts +52 -52
- package/dist/crypto/CryptoProvider.mjs +75 -75
- package/dist/crypto/CryptoProvider.mjs.map +1 -1
- package/dist/crypto/GuidGenerator.cjs +22 -22
- package/dist/crypto/GuidGenerator.cjs.map +1 -1
- package/dist/crypto/GuidGenerator.d.ts +14 -14
- package/dist/crypto/GuidGenerator.mjs +22 -22
- package/dist/crypto/GuidGenerator.mjs.map +1 -1
- package/dist/crypto/HashUtils.cjs +13 -13
- package/dist/crypto/HashUtils.cjs.map +1 -1
- package/dist/crypto/HashUtils.d.ts +8 -8
- package/dist/crypto/HashUtils.mjs +13 -13
- package/dist/crypto/HashUtils.mjs.map +1 -1
- package/dist/crypto/PkceGenerator.cjs +49 -49
- package/dist/crypto/PkceGenerator.cjs.map +1 -1
- package/dist/crypto/PkceGenerator.d.ts +22 -22
- package/dist/crypto/PkceGenerator.mjs +49 -49
- package/dist/crypto/PkceGenerator.mjs.map +1 -1
- package/dist/error/NodeAuthError.cjs +85 -85
- package/dist/error/NodeAuthError.cjs.map +1 -1
- package/dist/error/NodeAuthError.d.ts +65 -65
- package/dist/error/NodeAuthError.mjs +85 -85
- package/dist/error/NodeAuthError.mjs.map +1 -1
- package/dist/index.cjs +17 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +42 -42
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/internals.cjs +8 -8
- package/dist/internals.cjs.map +1 -1
- package/dist/internals.d.ts +6 -6
- package/dist/internals.d.ts.map +1 -1
- package/dist/internals.mjs +8 -8
- package/dist/internals.mjs.map +1 -1
- package/dist/network/HttpClient.cjs +277 -276
- package/dist/network/HttpClient.cjs.map +1 -1
- package/dist/network/HttpClient.d.ts +25 -25
- package/dist/network/HttpClient.d.ts.map +1 -1
- package/dist/network/HttpClient.mjs +278 -277
- package/dist/network/HttpClient.mjs.map +1 -1
- package/dist/network/ILoopbackClient.d.ts +10 -10
- package/dist/network/LoopbackClient.cjs +75 -84
- package/dist/network/LoopbackClient.cjs.map +1 -1
- package/dist/network/LoopbackClient.d.ts +21 -21
- package/dist/network/LoopbackClient.d.ts.map +1 -1
- package/dist/network/LoopbackClient.mjs +77 -86
- package/dist/network/LoopbackClient.mjs.map +1 -1
- package/dist/packageMetadata.cjs +4 -4
- package/dist/packageMetadata.cjs.map +1 -1
- package/dist/packageMetadata.d.ts +2 -2
- package/dist/packageMetadata.mjs +4 -4
- package/dist/packageMetadata.mjs.map +1 -1
- package/dist/request/AuthorizationCodeRequest.d.ts +21 -21
- package/dist/request/AuthorizationUrlRequest.d.ts +33 -33
- package/dist/request/ClientCredentialRequest.d.ts +14 -14
- package/dist/request/DeviceCodeRequest.d.ts +15 -15
- package/dist/request/InteractiveRequest.d.ts +22 -22
- package/dist/request/InteractiveRequest.d.ts.map +1 -1
- package/dist/request/OnBehalfOfRequest.d.ts +14 -14
- package/dist/request/RefreshTokenRequest.d.ts +17 -17
- package/dist/request/SignOutRequest.d.ts +5 -5
- package/dist/request/SilentFlowRequest.d.ts +16 -16
- package/dist/request/UsernamePasswordRequest.d.ts +19 -19
- package/dist/utils/Constants.cjs +80 -90
- package/dist/utils/Constants.cjs.map +1 -1
- package/dist/utils/Constants.d.ts +86 -96
- package/dist/utils/Constants.d.ts.map +1 -1
- package/dist/utils/Constants.mjs +81 -90
- package/dist/utils/Constants.mjs.map +1 -1
- package/dist/utils/EncodingUtils.cjs +44 -44
- package/dist/utils/EncodingUtils.cjs.map +1 -1
- package/dist/utils/EncodingUtils.d.ts +26 -26
- package/dist/utils/EncodingUtils.mjs +44 -44
- package/dist/utils/EncodingUtils.mjs.map +1 -1
- package/dist/utils/NetworkUtils.cjs +38 -38
- package/dist/utils/NetworkUtils.cjs.map +1 -1
- package/dist/utils/NetworkUtils.d.ts +5 -5
- package/dist/utils/NetworkUtils.mjs +38 -38
- package/dist/utils/NetworkUtils.mjs.map +1 -1
- package/package.json +8 -5
- package/src/cache/ITokenCache.ts +24 -0
- package/src/cache/NodeStorage.ts +533 -0
- package/src/cache/TokenCache.ts +358 -0
- package/src/cache/distributed/DistributedCachePlugin.ts +56 -0
- package/src/cache/distributed/ICacheClient.ts +23 -0
- package/src/cache/distributed/IPartitionManager.ts +35 -0
- package/src/cache/serializer/Deserializer.ts +218 -0
- package/src/cache/serializer/Serializer.ts +173 -0
- package/src/cache/serializer/SerializerTypes.ts +121 -0
- package/src/client/ClientApplication.ts +596 -0
- package/src/client/ClientAssertion.ts +165 -0
- package/src/client/ClientCredentialClient.ts +346 -0
- package/src/client/ConfidentialClientApplication.ts +268 -0
- package/src/client/DeviceCodeClient.ts +369 -0
- package/src/client/IConfidentialClientApplication.ts +72 -0
- package/src/client/IPublicClientApplication.ts +72 -0
- package/src/client/OnBehalfOfClient.ts +368 -0
- package/src/client/PublicClientApplication.ts +339 -0
- package/src/client/UsernamePasswordClient.ts +180 -0
- package/src/config/Configuration.ts +201 -0
- package/src/crypto/CryptoProvider.ts +98 -0
- package/src/crypto/GuidGenerator.ts +28 -0
- package/src/crypto/HashUtils.ts +17 -0
- package/src/crypto/PkceGenerator.ts +63 -0
- package/src/error/NodeAuthError.ts +117 -0
- package/src/index.ts +125 -0
- package/src/internals.ts +12 -0
- package/src/network/HttpClient.ts +425 -0
- package/src/network/ILoopbackClient.ts +19 -0
- package/src/network/LoopbackClient.ts +110 -0
- package/src/packageMetadata.ts +3 -0
- package/src/request/AuthorizationCodeRequest.ts +39 -0
- package/src/request/AuthorizationUrlRequest.ts +50 -0
- package/src/request/ClientCredentialRequest.ts +29 -0
- package/src/request/DeviceCodeRequest.ts +34 -0
- package/src/request/InteractiveRequest.ts +39 -0
- package/src/request/OnBehalfOfRequest.ts +30 -0
- package/src/request/RefreshTokenRequest.ts +34 -0
- package/src/request/SignOutRequest.ts +11 -0
- package/src/request/SilentFlowRequest.ts +32 -0
- package/src/request/UsernamePasswordRequest.ts +36 -0
- package/src/utils/Constants.ts +103 -0
- package/src/utils/EncodingUtils.ts +50 -0
- package/src/utils/NetworkUtils.ts +49 -0
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import { AccountCache, IdTokenCache, AccessTokenCache, RefreshTokenCache, AppMetadataCache } from "@azure/msal-common";
|
|
2
|
-
import { JsonCache, InMemoryCache, SerializedAccountEntity, SerializedIdTokenEntity, SerializedAccessTokenEntity, SerializedRefreshTokenEntity, SerializedAppMetadataEntity } from "./SerializerTypes";
|
|
3
|
-
/**
|
|
4
|
-
* This class deserializes cache entities read from the file into in memory object types defined internally
|
|
5
|
-
*/
|
|
6
|
-
export declare class Deserializer {
|
|
7
|
-
/**
|
|
8
|
-
* Parse the JSON blob in memory and deserialize the content
|
|
9
|
-
* @param cachedJson
|
|
10
|
-
*/
|
|
11
|
-
static deserializeJSONBlob(jsonFile: string): JsonCache;
|
|
12
|
-
/**
|
|
13
|
-
* Deserializes accounts to AccountEntity objects
|
|
14
|
-
* @param accounts
|
|
15
|
-
*/
|
|
16
|
-
static deserializeAccounts(accounts: Record<string, SerializedAccountEntity>): AccountCache;
|
|
17
|
-
/**
|
|
18
|
-
* Deserializes id tokens to IdTokenEntity objects
|
|
19
|
-
* @param idTokens
|
|
20
|
-
*/
|
|
21
|
-
static deserializeIdTokens(idTokens: Record<string, SerializedIdTokenEntity>): IdTokenCache;
|
|
22
|
-
/**
|
|
23
|
-
* Deserializes access tokens to AccessTokenEntity objects
|
|
24
|
-
* @param accessTokens
|
|
25
|
-
*/
|
|
26
|
-
static deserializeAccessTokens(accessTokens: Record<string, SerializedAccessTokenEntity>): AccessTokenCache;
|
|
27
|
-
/**
|
|
28
|
-
* Deserializes refresh tokens to RefreshTokenEntity objects
|
|
29
|
-
* @param refreshTokens
|
|
30
|
-
*/
|
|
31
|
-
static deserializeRefreshTokens(refreshTokens: Record<string, SerializedRefreshTokenEntity>): RefreshTokenCache;
|
|
32
|
-
/**
|
|
33
|
-
* Deserializes appMetadata to AppMetaData objects
|
|
34
|
-
* @param appMetadata
|
|
35
|
-
*/
|
|
36
|
-
static deserializeAppMetadata(appMetadata: Record<string, SerializedAppMetadataEntity>): AppMetadataCache;
|
|
37
|
-
/**
|
|
38
|
-
* Deserialize an inMemory Cache
|
|
39
|
-
* @param jsonCache
|
|
40
|
-
*/
|
|
41
|
-
static deserializeAllCache(jsonCache: JsonCache): InMemoryCache;
|
|
42
|
-
}
|
|
1
|
+
import { AccountCache, IdTokenCache, AccessTokenCache, RefreshTokenCache, AppMetadataCache } from "@azure/msal-common";
|
|
2
|
+
import { JsonCache, InMemoryCache, SerializedAccountEntity, SerializedIdTokenEntity, SerializedAccessTokenEntity, SerializedRefreshTokenEntity, SerializedAppMetadataEntity } from "./SerializerTypes.js";
|
|
3
|
+
/**
|
|
4
|
+
* This class deserializes cache entities read from the file into in memory object types defined internally
|
|
5
|
+
*/
|
|
6
|
+
export declare class Deserializer {
|
|
7
|
+
/**
|
|
8
|
+
* Parse the JSON blob in memory and deserialize the content
|
|
9
|
+
* @param cachedJson
|
|
10
|
+
*/
|
|
11
|
+
static deserializeJSONBlob(jsonFile: string): JsonCache;
|
|
12
|
+
/**
|
|
13
|
+
* Deserializes accounts to AccountEntity objects
|
|
14
|
+
* @param accounts
|
|
15
|
+
*/
|
|
16
|
+
static deserializeAccounts(accounts: Record<string, SerializedAccountEntity>): AccountCache;
|
|
17
|
+
/**
|
|
18
|
+
* Deserializes id tokens to IdTokenEntity objects
|
|
19
|
+
* @param idTokens
|
|
20
|
+
*/
|
|
21
|
+
static deserializeIdTokens(idTokens: Record<string, SerializedIdTokenEntity>): IdTokenCache;
|
|
22
|
+
/**
|
|
23
|
+
* Deserializes access tokens to AccessTokenEntity objects
|
|
24
|
+
* @param accessTokens
|
|
25
|
+
*/
|
|
26
|
+
static deserializeAccessTokens(accessTokens: Record<string, SerializedAccessTokenEntity>): AccessTokenCache;
|
|
27
|
+
/**
|
|
28
|
+
* Deserializes refresh tokens to RefreshTokenEntity objects
|
|
29
|
+
* @param refreshTokens
|
|
30
|
+
*/
|
|
31
|
+
static deserializeRefreshTokens(refreshTokens: Record<string, SerializedRefreshTokenEntity>): RefreshTokenCache;
|
|
32
|
+
/**
|
|
33
|
+
* Deserializes appMetadata to AppMetaData objects
|
|
34
|
+
* @param appMetadata
|
|
35
|
+
*/
|
|
36
|
+
static deserializeAppMetadata(appMetadata: Record<string, SerializedAppMetadataEntity>): AppMetadataCache;
|
|
37
|
+
/**
|
|
38
|
+
* Deserialize an inMemory Cache
|
|
39
|
+
* @param jsonCache
|
|
40
|
+
*/
|
|
41
|
+
static deserializeAllCache(jsonCache: JsonCache): InMemoryCache;
|
|
42
|
+
}
|
|
43
43
|
//# sourceMappingURL=Deserializer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Deserializer.d.ts","sourceRoot":"","sources":["../../../src/cache/serializer/Deserializer.ts"],"names":[],"mappings":"AAKA,OAAO,
|
|
1
|
+
{"version":3,"file":"Deserializer.d.ts","sourceRoot":"","sources":["../../../src/cache/serializer/Deserializer.ts"],"names":[],"mappings":"AAKA,OAAO,EACH,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAOnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACH,SAAS,EACT,aAAa,EACb,uBAAuB,EACvB,uBAAuB,EACvB,2BAA2B,EAC3B,4BAA4B,EAC5B,2BAA2B,EAC9B,MAAM,sBAAsB,CAAC;AAE9B;;GAEG;AACH,qBAAa,YAAY;IACrB;;;OAGG;IACH,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS;IAKvD;;;OAGG;IACH,MAAM,CAAC,mBAAmB,CACtB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,GAClD,YAAY;IA0Bf;;;OAGG;IACH,MAAM,CAAC,mBAAmB,CACtB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,GAClD,YAAY;IAqBf;;;OAGG;IACH,MAAM,CAAC,uBAAuB,CAC1B,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,2BAA2B,CAAC,GAC1D,gBAAgB;IAgCnB;;;OAGG;IACH,MAAM,CAAC,wBAAwB,CAC3B,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,4BAA4B,CAAC,GAC5D,iBAAiB;IAyBpB;;;OAGG;IACH,MAAM,CAAC,sBAAsB,CACzB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,2BAA2B,CAAC,GACzD,gBAAgB;IAmBnB;;;OAGG;IACH,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,SAAS,GAAG,aAAa;CAmBlE"}
|
|
@@ -1,181 +1,179 @@
|
|
|
1
|
-
/*! @azure/msal-node v2.0.
|
|
1
|
+
/*! @azure/msal-node v2.2.0-alpha.0 2023-09-20 */
|
|
2
2
|
'use strict';
|
|
3
|
-
import {
|
|
3
|
+
import { AccountEntity, CacheManager, IdTokenEntity, AccessTokenEntity, RefreshTokenEntity, AppMetadataEntity } from '@azure/msal-common';
|
|
4
4
|
|
|
5
|
-
/*
|
|
6
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7
|
-
* Licensed under the MIT License.
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* This class deserializes cache entities read from the file into in memory object types defined internally
|
|
11
|
-
*/
|
|
12
|
-
class Deserializer {
|
|
13
|
-
/**
|
|
14
|
-
* Parse the JSON blob in memory and deserialize the content
|
|
15
|
-
* @param cachedJson
|
|
16
|
-
*/
|
|
17
|
-
static deserializeJSONBlob(jsonFile) {
|
|
18
|
-
const deserializedCache =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
};
|
|
178
|
-
}
|
|
5
|
+
/*
|
|
6
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7
|
+
* Licensed under the MIT License.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* This class deserializes cache entities read from the file into in memory object types defined internally
|
|
11
|
+
*/
|
|
12
|
+
class Deserializer {
|
|
13
|
+
/**
|
|
14
|
+
* Parse the JSON blob in memory and deserialize the content
|
|
15
|
+
* @param cachedJson
|
|
16
|
+
*/
|
|
17
|
+
static deserializeJSONBlob(jsonFile) {
|
|
18
|
+
const deserializedCache = !jsonFile ? {} : JSON.parse(jsonFile);
|
|
19
|
+
return deserializedCache;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Deserializes accounts to AccountEntity objects
|
|
23
|
+
* @param accounts
|
|
24
|
+
*/
|
|
25
|
+
static deserializeAccounts(accounts) {
|
|
26
|
+
const accountObjects = {};
|
|
27
|
+
if (accounts) {
|
|
28
|
+
Object.keys(accounts).map(function (key) {
|
|
29
|
+
const serializedAcc = accounts[key];
|
|
30
|
+
const mappedAcc = {
|
|
31
|
+
homeAccountId: serializedAcc.home_account_id,
|
|
32
|
+
environment: serializedAcc.environment,
|
|
33
|
+
realm: serializedAcc.realm,
|
|
34
|
+
localAccountId: serializedAcc.local_account_id,
|
|
35
|
+
username: serializedAcc.username,
|
|
36
|
+
authorityType: serializedAcc.authority_type,
|
|
37
|
+
name: serializedAcc.name,
|
|
38
|
+
clientInfo: serializedAcc.client_info,
|
|
39
|
+
lastModificationTime: serializedAcc.last_modification_time,
|
|
40
|
+
lastModificationApp: serializedAcc.last_modification_app,
|
|
41
|
+
};
|
|
42
|
+
const account = new AccountEntity();
|
|
43
|
+
CacheManager.toObject(account, mappedAcc);
|
|
44
|
+
accountObjects[key] = account;
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
return accountObjects;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Deserializes id tokens to IdTokenEntity objects
|
|
51
|
+
* @param idTokens
|
|
52
|
+
*/
|
|
53
|
+
static deserializeIdTokens(idTokens) {
|
|
54
|
+
const idObjects = {};
|
|
55
|
+
if (idTokens) {
|
|
56
|
+
Object.keys(idTokens).map(function (key) {
|
|
57
|
+
const serializedIdT = idTokens[key];
|
|
58
|
+
const mappedIdT = {
|
|
59
|
+
homeAccountId: serializedIdT.home_account_id,
|
|
60
|
+
environment: serializedIdT.environment,
|
|
61
|
+
credentialType: serializedIdT.credential_type,
|
|
62
|
+
clientId: serializedIdT.client_id,
|
|
63
|
+
secret: serializedIdT.secret,
|
|
64
|
+
realm: serializedIdT.realm,
|
|
65
|
+
};
|
|
66
|
+
const idToken = new IdTokenEntity();
|
|
67
|
+
CacheManager.toObject(idToken, mappedIdT);
|
|
68
|
+
idObjects[key] = idToken;
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
return idObjects;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Deserializes access tokens to AccessTokenEntity objects
|
|
75
|
+
* @param accessTokens
|
|
76
|
+
*/
|
|
77
|
+
static deserializeAccessTokens(accessTokens) {
|
|
78
|
+
const atObjects = {};
|
|
79
|
+
if (accessTokens) {
|
|
80
|
+
Object.keys(accessTokens).map(function (key) {
|
|
81
|
+
const serializedAT = accessTokens[key];
|
|
82
|
+
const mappedAT = {
|
|
83
|
+
homeAccountId: serializedAT.home_account_id,
|
|
84
|
+
environment: serializedAT.environment,
|
|
85
|
+
credentialType: serializedAT.credential_type,
|
|
86
|
+
clientId: serializedAT.client_id,
|
|
87
|
+
secret: serializedAT.secret,
|
|
88
|
+
realm: serializedAT.realm,
|
|
89
|
+
target: serializedAT.target,
|
|
90
|
+
cachedAt: serializedAT.cached_at,
|
|
91
|
+
expiresOn: serializedAT.expires_on,
|
|
92
|
+
extendedExpiresOn: serializedAT.extended_expires_on,
|
|
93
|
+
refreshOn: serializedAT.refresh_on,
|
|
94
|
+
keyId: serializedAT.key_id,
|
|
95
|
+
tokenType: serializedAT.token_type,
|
|
96
|
+
requestedClaims: serializedAT.requestedClaims,
|
|
97
|
+
requestedClaimsHash: serializedAT.requestedClaimsHash,
|
|
98
|
+
userAssertionHash: serializedAT.userAssertionHash,
|
|
99
|
+
};
|
|
100
|
+
const accessToken = new AccessTokenEntity();
|
|
101
|
+
CacheManager.toObject(accessToken, mappedAT);
|
|
102
|
+
atObjects[key] = accessToken;
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
return atObjects;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Deserializes refresh tokens to RefreshTokenEntity objects
|
|
109
|
+
* @param refreshTokens
|
|
110
|
+
*/
|
|
111
|
+
static deserializeRefreshTokens(refreshTokens) {
|
|
112
|
+
const rtObjects = {};
|
|
113
|
+
if (refreshTokens) {
|
|
114
|
+
Object.keys(refreshTokens).map(function (key) {
|
|
115
|
+
const serializedRT = refreshTokens[key];
|
|
116
|
+
const mappedRT = {
|
|
117
|
+
homeAccountId: serializedRT.home_account_id,
|
|
118
|
+
environment: serializedRT.environment,
|
|
119
|
+
credentialType: serializedRT.credential_type,
|
|
120
|
+
clientId: serializedRT.client_id,
|
|
121
|
+
secret: serializedRT.secret,
|
|
122
|
+
familyId: serializedRT.family_id,
|
|
123
|
+
target: serializedRT.target,
|
|
124
|
+
realm: serializedRT.realm,
|
|
125
|
+
};
|
|
126
|
+
const refreshToken = new RefreshTokenEntity();
|
|
127
|
+
CacheManager.toObject(refreshToken, mappedRT);
|
|
128
|
+
rtObjects[key] = refreshToken;
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
return rtObjects;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Deserializes appMetadata to AppMetaData objects
|
|
135
|
+
* @param appMetadata
|
|
136
|
+
*/
|
|
137
|
+
static deserializeAppMetadata(appMetadata) {
|
|
138
|
+
const appMetadataObjects = {};
|
|
139
|
+
if (appMetadata) {
|
|
140
|
+
Object.keys(appMetadata).map(function (key) {
|
|
141
|
+
const serializedAmdt = appMetadata[key];
|
|
142
|
+
const mappedAmd = {
|
|
143
|
+
clientId: serializedAmdt.client_id,
|
|
144
|
+
environment: serializedAmdt.environment,
|
|
145
|
+
familyId: serializedAmdt.family_id,
|
|
146
|
+
};
|
|
147
|
+
const amd = new AppMetadataEntity();
|
|
148
|
+
CacheManager.toObject(amd, mappedAmd);
|
|
149
|
+
appMetadataObjects[key] = amd;
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
return appMetadataObjects;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Deserialize an inMemory Cache
|
|
156
|
+
* @param jsonCache
|
|
157
|
+
*/
|
|
158
|
+
static deserializeAllCache(jsonCache) {
|
|
159
|
+
return {
|
|
160
|
+
accounts: jsonCache.Account
|
|
161
|
+
? this.deserializeAccounts(jsonCache.Account)
|
|
162
|
+
: {},
|
|
163
|
+
idTokens: jsonCache.IdToken
|
|
164
|
+
? this.deserializeIdTokens(jsonCache.IdToken)
|
|
165
|
+
: {},
|
|
166
|
+
accessTokens: jsonCache.AccessToken
|
|
167
|
+
? this.deserializeAccessTokens(jsonCache.AccessToken)
|
|
168
|
+
: {},
|
|
169
|
+
refreshTokens: jsonCache.RefreshToken
|
|
170
|
+
? this.deserializeRefreshTokens(jsonCache.RefreshToken)
|
|
171
|
+
: {},
|
|
172
|
+
appMetadata: jsonCache.AppMetadata
|
|
173
|
+
? this.deserializeAppMetadata(jsonCache.AppMetadata)
|
|
174
|
+
: {},
|
|
175
|
+
};
|
|
176
|
+
}
|
|
179
177
|
}
|
|
180
178
|
|
|
181
179
|
export { Deserializer };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Deserializer.mjs","sources":["../../../src/cache/serializer/Deserializer.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"Deserializer.mjs","sources":["../../../src/cache/serializer/Deserializer.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAKA;AAaA;AAUA;;AAGA;AACI;;;AAGG;AACH;AAKA;;;AAGG,QAAA,MAAA,iBAAA,GAAA,CAAA,QAAA,GAAA,EAAA,GAAA,IAAA,CAAA,KAAA,CAAA,QAAA,CAAA,CAAA;AACH,QAAA,OAAO,iBACH,CAAA;AA2BJ,KAAA;;;AAGG;AACH;AAuBA,IAAA,OAAA,mBAAA,CAAA,QAAA,EAAA;;;AAGG,YAAA,MAAA,CAAA,IAAA,CAAA,QAAA,CAAA,CAAA,GAAA,CAAA,UAAA,GAAA,EAAA;AACH,gBAAO,MAAA,aACH,GAAA,QAAA,CAAY,GAAE,CAAA,CAAA;AAiClB,gBAAA,MAAA,SAAA,GAAA;;;AAGG,oBAAA,KAAA,EAAA,aAAA,CAAA,KAAA;AACH,oBAAO,cAAA,EACH,aAAa,CAAE,gBAAe;AA0BlC,oBAAA,QAAA,EAAA,aAAA,CAAA,QAAA;;;AAGG,oBAAA,UAAA,EAAA,aAAA,CAAA,WAAA;AACH,oBAAO,oBACH,EAAA,aAAoB,CAAA,sBAAQ;AAoBhC,oBAAA,mBAAA,EAAA,aAAA,CAAA,qBAAA;;;AAGG,gBAAA,YAAA,CAAA,QAAA,CAAA,OAAA,EAAA,SAAA,CAAA,CAAA;AACH,gBAA0B,cAAA,CAAC,cAAW,CAAA;AAmBzC,aAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|