@azure/msal-node 2.2.0 → 2.4.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/cache/NodeStorage.cjs +24 -20
- package/dist/cache/NodeStorage.cjs.map +1 -1
- package/dist/cache/NodeStorage.d.ts +2 -2
- package/dist/cache/NodeStorage.d.ts.map +1 -1
- package/dist/cache/NodeStorage.mjs +25 -21
- package/dist/cache/NodeStorage.mjs.map +1 -1
- package/dist/cache/TokenCache.cjs +1 -1
- package/dist/cache/TokenCache.mjs +1 -1
- package/dist/cache/distributed/DistributedCachePlugin.cjs +1 -1
- package/dist/cache/distributed/DistributedCachePlugin.mjs +1 -1
- package/dist/cache/serializer/Deserializer.cjs +4 -10
- package/dist/cache/serializer/Deserializer.cjs.map +1 -1
- package/dist/cache/serializer/Deserializer.d.ts.map +1 -1
- package/dist/cache/serializer/Deserializer.mjs +5 -11
- package/dist/cache/serializer/Deserializer.mjs.map +1 -1
- package/dist/cache/serializer/Serializer.cjs +1 -1
- package/dist/cache/serializer/Serializer.mjs +1 -1
- package/dist/client/ClientApplication.cjs +2 -2
- package/dist/client/ClientApplication.cjs.map +1 -1
- package/dist/client/ClientApplication.d.ts.map +1 -1
- package/dist/client/ClientApplication.mjs +3 -3
- package/dist/client/ClientApplication.mjs.map +1 -1
- package/dist/client/ClientAssertion.cjs +1 -1
- package/dist/client/ClientAssertion.mjs +1 -1
- package/dist/client/ClientCredentialClient.cjs +1 -1
- package/dist/client/ClientCredentialClient.mjs +1 -1
- package/dist/client/ConfidentialClientApplication.cjs +1 -1
- package/dist/client/ConfidentialClientApplication.mjs +1 -1
- package/dist/client/DeviceCodeClient.cjs +1 -1
- package/dist/client/DeviceCodeClient.mjs +1 -1
- package/dist/client/OnBehalfOfClient.cjs +1 -1
- package/dist/client/OnBehalfOfClient.mjs +1 -1
- package/dist/client/PublicClientApplication.cjs +1 -1
- package/dist/client/PublicClientApplication.mjs +1 -1
- package/dist/client/UsernamePasswordClient.cjs +1 -1
- package/dist/client/UsernamePasswordClient.mjs +1 -1
- package/dist/config/Configuration.cjs +1 -1
- package/dist/config/Configuration.mjs +1 -1
- package/dist/crypto/CryptoProvider.cjs +1 -1
- package/dist/crypto/CryptoProvider.mjs +1 -1
- package/dist/crypto/GuidGenerator.cjs +1 -1
- package/dist/crypto/GuidGenerator.mjs +1 -1
- package/dist/crypto/HashUtils.cjs +1 -1
- package/dist/crypto/HashUtils.mjs +1 -1
- package/dist/crypto/PkceGenerator.cjs +1 -1
- package/dist/crypto/PkceGenerator.mjs +1 -1
- package/dist/error/NodeAuthError.cjs +1 -1
- package/dist/error/NodeAuthError.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/internals.cjs +1 -1
- package/dist/internals.mjs +1 -1
- package/dist/network/HttpClient.cjs +1 -1
- package/dist/network/HttpClient.mjs +1 -1
- package/dist/network/LoopbackClient.cjs +1 -1
- package/dist/network/LoopbackClient.mjs +1 -1
- package/dist/packageMetadata.cjs +2 -2
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.mjs +2 -2
- package/dist/utils/Constants.cjs +1 -1
- package/dist/utils/Constants.mjs +1 -1
- package/dist/utils/EncodingUtils.cjs +1 -1
- package/dist/utils/EncodingUtils.mjs +1 -1
- package/dist/utils/NetworkUtils.cjs +1 -1
- package/dist/utils/NetworkUtils.mjs +1 -1
- package/package.json +2 -2
- package/src/cache/NodeStorage.ts +31 -25
- package/src/cache/serializer/Deserializer.ts +12 -14
- package/src/client/ClientApplication.ts +3 -1
- package/src/packageMetadata.ts +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @azure/msal-node v2.
|
|
1
|
+
/*! @azure/msal-node v2.4.0 2023-10-30 */
|
|
2
2
|
'use strict';
|
|
3
3
|
import { BaseClient, TimeUtils, ResponseHandler, UrlString, RequestParameterBuilder, createClientAuthError, ClientAuthErrorCodes, Constants, createAuthError, AuthErrorCodes, GrantType, StringUtils } from '@azure/msal-common';
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @azure/msal-node v2.
|
|
1
|
+
/*! @azure/msal-node v2.4.0 2023-10-30 */
|
|
2
2
|
'use strict';
|
|
3
3
|
import { BaseClient, ScopeSet, CacheOutcome, createClientAuthError, ClientAuthErrorCodes, TimeUtils, AuthToken, ResponseHandler, AuthenticationScheme, CredentialType, UrlString, RequestParameterBuilder, GrantType, AADServerParamKeys, Constants } from '@azure/msal-common';
|
|
4
4
|
import { EncodingUtils } from '../utils/EncodingUtils.mjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @azure/msal-node v2.
|
|
1
|
+
/*! @azure/msal-node v2.4.0 2023-10-30 */
|
|
2
2
|
'use strict';
|
|
3
3
|
import { ApiId, LOOPBACK_SERVER_CONSTANTS, Constants as Constants$1 } from '../utils/Constants.mjs';
|
|
4
4
|
import { AuthError, OIDC_DEFAULT_SCOPES, ResponseMode, CodeChallengeMethodValues, ServerError, Constants } from '@azure/msal-common';
|
package/dist/index.cjs
CHANGED
package/dist/index.mjs
CHANGED
package/dist/internals.cjs
CHANGED
package/dist/internals.mjs
CHANGED
package/dist/packageMetadata.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/*! @azure/msal-node v2.
|
|
1
|
+
/*! @azure/msal-node v2.4.0 2023-10-30 */
|
|
2
2
|
'use strict';
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
5
|
/* eslint-disable header/header */
|
|
6
6
|
const name = "@azure/msal-node";
|
|
7
|
-
const version = "2.
|
|
7
|
+
const version = "2.4.0";
|
|
8
8
|
|
|
9
9
|
exports.name = name;
|
|
10
10
|
exports.version = version;
|
package/dist/packageMetadata.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/*! @azure/msal-node v2.
|
|
1
|
+
/*! @azure/msal-node v2.4.0 2023-10-30 */
|
|
2
2
|
'use strict';
|
|
3
3
|
/* eslint-disable header/header */
|
|
4
4
|
const name = "@azure/msal-node";
|
|
5
|
-
const version = "2.
|
|
5
|
+
const version = "2.4.0";
|
|
6
6
|
|
|
7
7
|
export { name, version };
|
|
8
8
|
//# sourceMappingURL=packageMetadata.mjs.map
|
package/dist/utils/Constants.cjs
CHANGED
package/dist/utils/Constants.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@azure/msal-node",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.4.0",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Microsoft",
|
|
7
7
|
"email": "nugetaad@microsoft.com",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"yargs": "^17.3.1"
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
|
-
"@azure/msal-common": "14.
|
|
80
|
+
"@azure/msal-common": "14.3.0",
|
|
81
81
|
"jsonwebtoken": "^9.0.0",
|
|
82
82
|
"uuid": "^8.3.0"
|
|
83
83
|
},
|
package/src/cache/NodeStorage.ts
CHANGED
|
@@ -18,6 +18,8 @@ import {
|
|
|
18
18
|
ICrypto,
|
|
19
19
|
AuthorityMetadataEntity,
|
|
20
20
|
ValidCredentialType,
|
|
21
|
+
StaticAuthorityOptions,
|
|
22
|
+
CacheHelpers,
|
|
21
23
|
} from "@azure/msal-common";
|
|
22
24
|
|
|
23
25
|
import { Deserializer } from "./serializer/Deserializer.js";
|
|
@@ -38,8 +40,13 @@ export class NodeStorage extends CacheManager {
|
|
|
38
40
|
private cache: CacheKVStore = {};
|
|
39
41
|
private changeEmitters: Array<Function> = [];
|
|
40
42
|
|
|
41
|
-
constructor(
|
|
42
|
-
|
|
43
|
+
constructor(
|
|
44
|
+
logger: Logger,
|
|
45
|
+
clientId: string,
|
|
46
|
+
cryptoImpl: ICrypto,
|
|
47
|
+
staticAuthorityOptions?: StaticAuthorityOptions
|
|
48
|
+
) {
|
|
49
|
+
super(clientId, cryptoImpl, logger, staticAuthorityOptions);
|
|
43
50
|
this.logger = logger;
|
|
44
51
|
}
|
|
45
52
|
|
|
@@ -72,22 +79,20 @@ export class NodeStorage extends CacheManager {
|
|
|
72
79
|
};
|
|
73
80
|
|
|
74
81
|
for (const key in cache) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
inMemoryCache.
|
|
81
|
-
|
|
82
|
-
] as
|
|
83
|
-
} else if (
|
|
84
|
-
inMemoryCache.
|
|
85
|
-
|
|
86
|
-
] as RefreshTokenEntity;
|
|
87
|
-
} else if (
|
|
88
|
-
inMemoryCache.appMetadata[key] =
|
|
89
|
-
key
|
|
90
|
-
] as AppMetadataEntity;
|
|
82
|
+
const value = cache[key];
|
|
83
|
+
if (typeof value !== "object") {
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
if (value instanceof AccountEntity) {
|
|
87
|
+
inMemoryCache.accounts[key] = value as AccountEntity;
|
|
88
|
+
} else if (CacheHelpers.isIdTokenEntity(value)) {
|
|
89
|
+
inMemoryCache.idTokens[key] = value as IdTokenEntity;
|
|
90
|
+
} else if (CacheHelpers.isAccessTokenEntity(value)) {
|
|
91
|
+
inMemoryCache.accessTokens[key] = value as AccessTokenEntity;
|
|
92
|
+
} else if (CacheHelpers.isRefreshTokenEntity(value)) {
|
|
93
|
+
inMemoryCache.refreshTokens[key] = value as RefreshTokenEntity;
|
|
94
|
+
} else if (value instanceof AppMetadataEntity) {
|
|
95
|
+
inMemoryCache.appMetadata[key] = value as AppMetadataEntity;
|
|
91
96
|
} else {
|
|
92
97
|
continue;
|
|
93
98
|
}
|
|
@@ -235,7 +240,7 @@ export class NodeStorage extends CacheManager {
|
|
|
235
240
|
*/
|
|
236
241
|
getIdTokenCredential(idTokenKey: string): IdTokenEntity | null {
|
|
237
242
|
const idToken = this.getItem(idTokenKey) as IdTokenEntity;
|
|
238
|
-
if (
|
|
243
|
+
if (CacheHelpers.isIdTokenEntity(idToken)) {
|
|
239
244
|
return idToken;
|
|
240
245
|
}
|
|
241
246
|
return null;
|
|
@@ -246,7 +251,7 @@ export class NodeStorage extends CacheManager {
|
|
|
246
251
|
* @param idToken - cache value to be set of type IdTokenEntity
|
|
247
252
|
*/
|
|
248
253
|
setIdTokenCredential(idToken: IdTokenEntity): void {
|
|
249
|
-
const idTokenKey =
|
|
254
|
+
const idTokenKey = CacheHelpers.generateCredentialKey(idToken);
|
|
250
255
|
this.setItem(idTokenKey, idToken);
|
|
251
256
|
}
|
|
252
257
|
|
|
@@ -256,7 +261,7 @@ export class NodeStorage extends CacheManager {
|
|
|
256
261
|
*/
|
|
257
262
|
getAccessTokenCredential(accessTokenKey: string): AccessTokenEntity | null {
|
|
258
263
|
const accessToken = this.getItem(accessTokenKey) as AccessTokenEntity;
|
|
259
|
-
if (
|
|
264
|
+
if (CacheHelpers.isAccessTokenEntity(accessToken)) {
|
|
260
265
|
return accessToken;
|
|
261
266
|
}
|
|
262
267
|
return null;
|
|
@@ -267,7 +272,7 @@ export class NodeStorage extends CacheManager {
|
|
|
267
272
|
* @param accessToken - cache value to be set of type AccessTokenEntity
|
|
268
273
|
*/
|
|
269
274
|
setAccessTokenCredential(accessToken: AccessTokenEntity): void {
|
|
270
|
-
const accessTokenKey =
|
|
275
|
+
const accessTokenKey = CacheHelpers.generateCredentialKey(accessToken);
|
|
271
276
|
this.setItem(accessTokenKey, accessToken);
|
|
272
277
|
}
|
|
273
278
|
|
|
@@ -281,7 +286,7 @@ export class NodeStorage extends CacheManager {
|
|
|
281
286
|
const refreshToken = this.getItem(
|
|
282
287
|
refreshTokenKey
|
|
283
288
|
) as RefreshTokenEntity;
|
|
284
|
-
if (
|
|
289
|
+
if (CacheHelpers.isRefreshTokenEntity(refreshToken)) {
|
|
285
290
|
return refreshToken as RefreshTokenEntity;
|
|
286
291
|
}
|
|
287
292
|
return null;
|
|
@@ -292,7 +297,8 @@ export class NodeStorage extends CacheManager {
|
|
|
292
297
|
* @param refreshToken - cache value to be set of type RefreshTokenEntity
|
|
293
298
|
*/
|
|
294
299
|
setRefreshTokenCredential(refreshToken: RefreshTokenEntity): void {
|
|
295
|
-
const refreshTokenKey =
|
|
300
|
+
const refreshTokenKey =
|
|
301
|
+
CacheHelpers.generateCredentialKey(refreshToken);
|
|
296
302
|
this.setItem(refreshTokenKey, refreshToken);
|
|
297
303
|
}
|
|
298
304
|
|
|
@@ -510,7 +516,7 @@ export class NodeStorage extends CacheManager {
|
|
|
510
516
|
currentCacheKey: string,
|
|
511
517
|
credential: ValidCredentialType
|
|
512
518
|
): string {
|
|
513
|
-
const updatedCacheKey =
|
|
519
|
+
const updatedCacheKey = CacheHelpers.generateCredentialKey(credential);
|
|
514
520
|
|
|
515
521
|
if (currentCacheKey !== updatedCacheKey) {
|
|
516
522
|
const cacheItem = this.getItem(currentCacheKey);
|
|
@@ -15,6 +15,8 @@ import {
|
|
|
15
15
|
RefreshTokenEntity,
|
|
16
16
|
AppMetadataEntity,
|
|
17
17
|
CacheManager,
|
|
18
|
+
CredentialType,
|
|
19
|
+
AuthenticationScheme,
|
|
18
20
|
} from "@azure/msal-common";
|
|
19
21
|
import {
|
|
20
22
|
JsonCache,
|
|
@@ -82,16 +84,15 @@ export class Deserializer {
|
|
|
82
84
|
if (idTokens) {
|
|
83
85
|
Object.keys(idTokens).map(function (key) {
|
|
84
86
|
const serializedIdT = idTokens[key];
|
|
85
|
-
const
|
|
87
|
+
const idToken: IdTokenEntity = {
|
|
86
88
|
homeAccountId: serializedIdT.home_account_id,
|
|
87
89
|
environment: serializedIdT.environment,
|
|
88
|
-
credentialType:
|
|
90
|
+
credentialType:
|
|
91
|
+
serializedIdT.credential_type as CredentialType,
|
|
89
92
|
clientId: serializedIdT.client_id,
|
|
90
93
|
secret: serializedIdT.secret,
|
|
91
94
|
realm: serializedIdT.realm,
|
|
92
95
|
};
|
|
93
|
-
const idToken: IdTokenEntity = new IdTokenEntity();
|
|
94
|
-
CacheManager.toObject(idToken, mappedIdT);
|
|
95
96
|
idObjects[key] = idToken;
|
|
96
97
|
});
|
|
97
98
|
}
|
|
@@ -109,10 +110,11 @@ export class Deserializer {
|
|
|
109
110
|
if (accessTokens) {
|
|
110
111
|
Object.keys(accessTokens).map(function (key) {
|
|
111
112
|
const serializedAT = accessTokens[key];
|
|
112
|
-
const
|
|
113
|
+
const accessToken: AccessTokenEntity = {
|
|
113
114
|
homeAccountId: serializedAT.home_account_id,
|
|
114
115
|
environment: serializedAT.environment,
|
|
115
|
-
credentialType:
|
|
116
|
+
credentialType:
|
|
117
|
+
serializedAT.credential_type as CredentialType,
|
|
116
118
|
clientId: serializedAT.client_id,
|
|
117
119
|
secret: serializedAT.secret,
|
|
118
120
|
realm: serializedAT.realm,
|
|
@@ -122,13 +124,11 @@ export class Deserializer {
|
|
|
122
124
|
extendedExpiresOn: serializedAT.extended_expires_on,
|
|
123
125
|
refreshOn: serializedAT.refresh_on,
|
|
124
126
|
keyId: serializedAT.key_id,
|
|
125
|
-
tokenType: serializedAT.token_type,
|
|
127
|
+
tokenType: serializedAT.token_type as AuthenticationScheme,
|
|
126
128
|
requestedClaims: serializedAT.requestedClaims,
|
|
127
129
|
requestedClaimsHash: serializedAT.requestedClaimsHash,
|
|
128
130
|
userAssertionHash: serializedAT.userAssertionHash,
|
|
129
131
|
};
|
|
130
|
-
const accessToken: AccessTokenEntity = new AccessTokenEntity();
|
|
131
|
-
CacheManager.toObject(accessToken, mappedAT);
|
|
132
132
|
atObjects[key] = accessToken;
|
|
133
133
|
});
|
|
134
134
|
}
|
|
@@ -147,19 +147,17 @@ export class Deserializer {
|
|
|
147
147
|
if (refreshTokens) {
|
|
148
148
|
Object.keys(refreshTokens).map(function (key) {
|
|
149
149
|
const serializedRT = refreshTokens[key];
|
|
150
|
-
const
|
|
150
|
+
const refreshToken: RefreshTokenEntity = {
|
|
151
151
|
homeAccountId: serializedRT.home_account_id,
|
|
152
152
|
environment: serializedRT.environment,
|
|
153
|
-
credentialType:
|
|
153
|
+
credentialType:
|
|
154
|
+
serializedRT.credential_type as CredentialType,
|
|
154
155
|
clientId: serializedRT.client_id,
|
|
155
156
|
secret: serializedRT.secret,
|
|
156
157
|
familyId: serializedRT.family_id,
|
|
157
158
|
target: serializedRT.target,
|
|
158
159
|
realm: serializedRT.realm,
|
|
159
160
|
};
|
|
160
|
-
const refreshToken: RefreshTokenEntity =
|
|
161
|
-
new RefreshTokenEntity();
|
|
162
|
-
CacheManager.toObject(refreshToken, mappedRT);
|
|
163
161
|
rtObjects[key] = refreshToken;
|
|
164
162
|
});
|
|
165
163
|
}
|
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
StringUtils,
|
|
33
33
|
createClientAuthError,
|
|
34
34
|
ClientAuthErrorCodes,
|
|
35
|
+
buildStaticAuthorityOptions,
|
|
35
36
|
} from "@azure/msal-common";
|
|
36
37
|
import {
|
|
37
38
|
Configuration,
|
|
@@ -95,7 +96,8 @@ export abstract class ClientApplication {
|
|
|
95
96
|
this.storage = new NodeStorage(
|
|
96
97
|
this.logger,
|
|
97
98
|
this.config.auth.clientId,
|
|
98
|
-
this.cryptoProvider
|
|
99
|
+
this.cryptoProvider,
|
|
100
|
+
buildStaticAuthorityOptions(this.config.auth)
|
|
99
101
|
);
|
|
100
102
|
this.tokenCache = new TokenCache(
|
|
101
103
|
this.storage,
|
package/src/packageMetadata.ts
CHANGED