@azure/msal-node 2.15.0 → 2.16.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.d.ts +3 -3
- package/dist/cache/NodeStorage.d.ts.map +1 -1
- package/dist/cache/NodeStorage.mjs +4 -4
- package/dist/cache/NodeStorage.mjs.map +1 -1
- package/dist/cache/TokenCache.mjs +1 -1
- package/dist/cache/distributed/DistributedCachePlugin.d.ts +12 -0
- package/dist/cache/distributed/DistributedCachePlugin.d.ts.map +1 -1
- package/dist/cache/distributed/DistributedCachePlugin.mjs +13 -1
- package/dist/cache/distributed/DistributedCachePlugin.mjs.map +1 -1
- package/dist/cache/distributed/ICacheClient.d.ts +7 -3
- package/dist/cache/distributed/ICacheClient.d.ts.map +1 -1
- package/dist/cache/distributed/IPartitionManager.d.ts +5 -1
- package/dist/cache/distributed/IPartitionManager.d.ts.map +1 -1
- package/dist/cache/serializer/Deserializer.d.ts +9 -8
- package/dist/cache/serializer/Deserializer.d.ts.map +1 -1
- package/dist/cache/serializer/Deserializer.mjs +10 -9
- package/dist/cache/serializer/Deserializer.mjs.map +1 -1
- package/dist/cache/serializer/Serializer.d.ts +11 -7
- package/dist/cache/serializer/Serializer.d.ts.map +1 -1
- package/dist/cache/serializer/Serializer.mjs +12 -8
- package/dist/cache/serializer/Serializer.mjs.map +1 -1
- package/dist/client/ClientApplication.d.ts +3 -3
- package/dist/client/ClientApplication.d.ts.map +1 -1
- package/dist/client/ClientApplication.mjs +11 -10
- package/dist/client/ClientApplication.mjs.map +1 -1
- package/dist/client/ClientAssertion.mjs +1 -1
- package/dist/client/ClientCredentialClient.d.ts +5 -4
- package/dist/client/ClientCredentialClient.d.ts.map +1 -1
- package/dist/client/ClientCredentialClient.mjs +6 -5
- package/dist/client/ClientCredentialClient.mjs.map +1 -1
- package/dist/client/ConfidentialClientApplication.d.ts.map +1 -1
- package/dist/client/ConfidentialClientApplication.mjs +19 -5
- package/dist/client/ConfidentialClientApplication.mjs.map +1 -1
- package/dist/client/DeviceCodeClient.d.ts +19 -15
- package/dist/client/DeviceCodeClient.d.ts.map +1 -1
- package/dist/client/DeviceCodeClient.mjs +24 -20
- package/dist/client/DeviceCodeClient.mjs.map +1 -1
- package/dist/client/ManagedIdentityApplication.mjs +1 -1
- package/dist/client/ManagedIdentityClient.mjs +1 -1
- package/dist/client/ManagedIdentitySources/AppService.mjs +1 -1
- package/dist/client/ManagedIdentitySources/AzureArc.mjs +1 -1
- package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs +1 -1
- package/dist/client/ManagedIdentitySources/CloudShell.mjs +1 -1
- package/dist/client/ManagedIdentitySources/Imds.mjs +1 -1
- package/dist/client/ManagedIdentitySources/ServiceFabric.mjs +1 -1
- package/dist/client/OnBehalfOfClient.d.ts +9 -9
- package/dist/client/OnBehalfOfClient.d.ts.map +1 -1
- package/dist/client/OnBehalfOfClient.mjs +10 -10
- package/dist/client/OnBehalfOfClient.mjs.map +1 -1
- package/dist/client/PublicClientApplication.d.ts +3 -3
- package/dist/client/PublicClientApplication.d.ts.map +1 -1
- package/dist/client/PublicClientApplication.mjs +5 -5
- package/dist/client/PublicClientApplication.mjs.map +1 -1
- package/dist/client/UsernamePasswordClient.d.ts +5 -4
- package/dist/client/UsernamePasswordClient.d.ts.map +1 -1
- package/dist/client/UsernamePasswordClient.mjs +6 -5
- package/dist/client/UsernamePasswordClient.mjs.map +1 -1
- package/dist/config/Configuration.d.ts +4 -0
- package/dist/config/Configuration.d.ts.map +1 -1
- package/dist/config/Configuration.mjs +1 -1
- package/dist/config/Configuration.mjs.map +1 -1
- package/dist/config/ManagedIdentityId.mjs +1 -1
- package/dist/config/ManagedIdentityRequestParameters.mjs +1 -1
- package/dist/crypto/CryptoProvider.d.ts +2 -2
- package/dist/crypto/CryptoProvider.mjs +3 -3
- package/dist/crypto/GuidGenerator.mjs +1 -1
- package/dist/crypto/HashUtils.mjs +1 -1
- package/dist/crypto/PkceGenerator.mjs +1 -1
- package/dist/error/ManagedIdentityError.mjs +1 -1
- package/dist/error/ManagedIdentityErrorCodes.mjs +1 -1
- package/dist/error/NodeAuthError.mjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +1 -2
- package/dist/index.mjs.map +1 -1
- package/dist/internals.mjs +1 -1
- package/dist/network/HttpClient.mjs +1 -1
- package/dist/network/HttpClientWithRetries.mjs +1 -1
- package/dist/network/LoopbackClient.mjs +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.mjs +2 -2
- package/dist/request/ManagedIdentityRequestParams.d.ts +2 -1
- package/dist/request/ManagedIdentityRequestParams.d.ts.map +1 -1
- package/dist/request/SignOutRequest.d.ts +1 -0
- package/dist/request/SignOutRequest.d.ts.map +1 -1
- package/dist/retry/LinearRetryPolicy.mjs +1 -1
- package/dist/utils/Constants.d.ts +1 -0
- package/dist/utils/Constants.d.ts.map +1 -1
- package/dist/utils/Constants.mjs +3 -2
- package/dist/utils/Constants.mjs.map +1 -1
- package/dist/utils/EncodingUtils.mjs +1 -1
- package/dist/utils/NetworkUtils.d.ts +12 -1
- package/dist/utils/NetworkUtils.d.ts.map +1 -1
- package/dist/utils/NetworkUtils.mjs +1 -1
- package/dist/utils/NetworkUtils.mjs.map +1 -1
- package/lib/msal-node.cjs +421 -312
- package/lib/msal-node.cjs.map +1 -1
- package/lib/types/cache/NodeStorage.d.ts +3 -3
- package/lib/types/cache/NodeStorage.d.ts.map +1 -1
- package/lib/types/cache/distributed/DistributedCachePlugin.d.ts +12 -0
- package/lib/types/cache/distributed/DistributedCachePlugin.d.ts.map +1 -1
- package/lib/types/cache/distributed/ICacheClient.d.ts +7 -3
- package/lib/types/cache/distributed/ICacheClient.d.ts.map +1 -1
- package/lib/types/cache/distributed/IPartitionManager.d.ts +5 -1
- package/lib/types/cache/distributed/IPartitionManager.d.ts.map +1 -1
- package/lib/types/cache/serializer/Deserializer.d.ts +9 -8
- package/lib/types/cache/serializer/Deserializer.d.ts.map +1 -1
- package/lib/types/cache/serializer/Serializer.d.ts +11 -7
- package/lib/types/cache/serializer/Serializer.d.ts.map +1 -1
- package/lib/types/client/ClientApplication.d.ts +3 -3
- package/lib/types/client/ClientApplication.d.ts.map +1 -1
- package/lib/types/client/ClientCredentialClient.d.ts +5 -4
- package/lib/types/client/ClientCredentialClient.d.ts.map +1 -1
- package/lib/types/client/ConfidentialClientApplication.d.ts.map +1 -1
- package/lib/types/client/DeviceCodeClient.d.ts +19 -15
- package/lib/types/client/DeviceCodeClient.d.ts.map +1 -1
- package/lib/types/client/OnBehalfOfClient.d.ts +9 -9
- package/lib/types/client/OnBehalfOfClient.d.ts.map +1 -1
- package/lib/types/client/PublicClientApplication.d.ts +3 -3
- package/lib/types/client/PublicClientApplication.d.ts.map +1 -1
- package/lib/types/client/UsernamePasswordClient.d.ts +5 -4
- package/lib/types/client/UsernamePasswordClient.d.ts.map +1 -1
- package/lib/types/config/Configuration.d.ts +4 -0
- package/lib/types/config/Configuration.d.ts.map +1 -1
- package/lib/types/crypto/CryptoProvider.d.ts +2 -2
- package/lib/types/index.d.ts +1 -1
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/packageMetadata.d.ts +1 -1
- package/lib/types/request/ManagedIdentityRequestParams.d.ts +2 -1
- package/lib/types/request/ManagedIdentityRequestParams.d.ts.map +1 -1
- package/lib/types/request/SignOutRequest.d.ts +1 -0
- package/lib/types/request/SignOutRequest.d.ts.map +1 -1
- package/lib/types/utils/Constants.d.ts +1 -0
- package/lib/types/utils/Constants.d.ts.map +1 -1
- package/lib/types/utils/NetworkUtils.d.ts +12 -1
- package/lib/types/utils/NetworkUtils.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/cache/NodeStorage.ts +3 -3
- package/src/cache/distributed/DistributedCachePlugin.ts +12 -0
- package/src/cache/distributed/ICacheClient.ts +7 -3
- package/src/cache/distributed/IPartitionManager.ts +5 -1
- package/src/cache/serializer/Deserializer.ts +9 -8
- package/src/cache/serializer/Serializer.ts +11 -7
- package/src/client/ClientApplication.ts +10 -3
- package/src/client/ClientCredentialClient.ts +5 -4
- package/src/client/ConfidentialClientApplication.ts +21 -1
- package/src/client/DeviceCodeClient.ts +29 -20
- package/src/client/OnBehalfOfClient.ts +9 -9
- package/src/client/PublicClientApplication.ts +4 -3
- package/src/client/UsernamePasswordClient.ts +5 -4
- package/src/config/Configuration.ts +4 -0
- package/src/crypto/CryptoProvider.ts +2 -2
- package/src/index.ts +0 -1
- package/src/packageMetadata.ts +1 -1
- package/src/request/ManagedIdentityRequestParams.ts +2 -1
- package/src/request/SignOutRequest.ts +1 -0
- package/src/utils/Constants.ts +1 -0
- package/src/utils/NetworkUtils.ts +13 -4
package/lib/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAKA;;;GAGG;AAEH;;;GAGG;AAEH,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,CAAC;AAGrB,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,EAAE,8BAA8B,EAAE,MAAM,4CAA4C,CAAC;AAC5F,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAG/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,6BAA6B,EAAE,MAAM,2CAA2C,CAAC;AAC1F,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;A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C/B,aAAa,EAEb,WAAW,EACX,cAAc,EAEd,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,oBAAoB,EACpB,sBAAsB,EACtB,wBAAwB,EACxB,6BAA6B,EAC7B,+BAA+B,EAC/B,4BAA4B,EAC5B,iCAAiC,EACjC,mCAAmC,EACnC,WAAW,EAEX,cAAc,EACd,qBAAqB,EACrB,eAAe,EAEf,MAAM,EACN,QAAQ,EAER,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,uBAAuB,EAEvB,kBAAkB,EAClB,iBAAiB,EAEjB,iBAAiB,EACjB,0BAA0B,EAC1B,sBAAsB,EACtB,mBAAmB,EACnB,uBAAuB,GAC1B,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* ManagedIdentityRequest
|
|
3
3
|
* - claims - a stringified claims request which will be used to determine whether or not the cache should be skipped
|
|
4
4
|
* - forceRefresh - forces managed identity requests to skip the cache and make network calls if true
|
|
5
|
-
* - resource - resource requested to access the protected API. It should be of the form "
|
|
5
|
+
* - resource - resource requested to access the protected API. It should be of the form "ResourceIdUri" or "ResourceIdUri/.default". For instance https://management.azure.net or, for Microsoft Graph, https://graph.microsoft.com/.default
|
|
6
|
+
* @public
|
|
6
7
|
*/
|
|
7
8
|
export type ManagedIdentityRequestParams = {
|
|
8
9
|
claims?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ManagedIdentityRequestParams.d.ts","sourceRoot":"","sources":["../../../src/request/ManagedIdentityRequestParams.ts"],"names":[],"mappings":"AAKA
|
|
1
|
+
{"version":3,"file":"ManagedIdentityRequestParams.d.ts","sourceRoot":"","sources":["../../../src/request/ManagedIdentityRequestParams.ts"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH,MAAM,MAAM,4BAA4B,GAAG;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;CACpB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SignOutRequest.d.ts","sourceRoot":"","sources":["../../../src/request/SignOutRequest.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,MAAM,MAAM,cAAc,GAAG;IACzB,OAAO,EAAE,WAAW,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC"}
|
|
1
|
+
{"version":3,"file":"SignOutRequest.d.ts","sourceRoot":"","sources":["../../../src/request/SignOutRequest.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,cAAc;AACd,MAAM,MAAM,cAAc,GAAG;IACzB,OAAO,EAAE,WAAW,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC"}
|
|
@@ -65,6 +65,7 @@ export type ProxyStatus = (typeof ProxyStatus)[keyof typeof ProxyStatus];
|
|
|
65
65
|
* Constants used for region discovery
|
|
66
66
|
*/
|
|
67
67
|
export declare const REGION_ENVIRONMENT_VARIABLE = "REGION_NAME";
|
|
68
|
+
export declare const MSAL_FORCE_REGION = "MSAL_FORCE_REGION";
|
|
68
69
|
/**
|
|
69
70
|
* Constant used for PKCE
|
|
70
71
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Constants.d.ts","sourceRoot":"","sources":["../../../src/utils/Constants.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,yBAAyB,EAAE,MAAwB,CAAC;AACjE,eAAO,MAAM,oBAAoB,EAAE,MAAmB,CAAC;AACvD,eAAO,MAAM,8BAA8B,EAAE,MAA4B,CAAC;AAC1E,eAAO,MAAM,iCAAiC,EAAE,MAAiB,CAAC;AAClE,eAAO,MAAM,gCAAgC,EAAE,MAAsB,CAA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C;AAEF;;GAEG;AACH,eAAO,MAAM,KAAK;;;CAGjB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS;;;;;;CAOrB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,KAAK;;;;;;;CAOjB,CAAC;AACF,MAAM,MAAM,KAAK,GAAG,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,OAAO,KAAK,CAAC,CAAC;AAEvD;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;CAaxB,CAAC;AAEF,eAAO,MAAM,yBAAyB;;;CAGrC,CAAC;AAEF,eAAO,MAAM,oCAAoC,OAAO,CAAC;AAEzD,eAAO,MAAM,4BAA4B,IAAI,CAAC;AAC9C,eAAO,MAAM,4BAA4B,OAAO,CAAC;AACjD,eAAO,MAAM,8CAA8C,uCAO1D,CAAC"}
|
|
@@ -1,4 +1,15 @@
|
|
|
1
|
-
import { NetworkResponse
|
|
1
|
+
import { NetworkResponse } from "@azure/msal-common/node";
|
|
2
|
+
export type UrlToHttpRequestOptions = {
|
|
3
|
+
protocol: string;
|
|
4
|
+
hostname: string;
|
|
5
|
+
hash: string;
|
|
6
|
+
search: string;
|
|
7
|
+
pathname: string;
|
|
8
|
+
path: string;
|
|
9
|
+
href: string;
|
|
10
|
+
port?: number;
|
|
11
|
+
auth?: string;
|
|
12
|
+
};
|
|
2
13
|
export declare class NetworkUtils {
|
|
3
14
|
static getNetworkResponse<T>(headers: Record<string, string>, body: T, statusCode: number): NetworkResponse<T>;
|
|
4
15
|
static urlToHttpOptions(url: URL): UrlToHttpRequestOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NetworkUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/NetworkUtils.ts"],"names":[],"mappings":"AAKA,OAAO,
|
|
1
|
+
{"version":3,"file":"NetworkUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/NetworkUtils.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,MAAM,MAAM,uBAAuB,GAAG;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,qBAAa,YAAY;IACrB,MAAM,CAAC,kBAAkB,CAAC,CAAC,EACvB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC/B,IAAI,EAAE,CAAC,EACP,UAAU,EAAE,MAAM,GACnB,eAAe,CAAC,CAAC,CAAC;IAarB,MAAM,CAAC,gBAAgB,CAAC,GAAG,EAAE,GAAG,GAAG,uBAAuB;CAuB7D"}
|
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.16.0",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Microsoft",
|
|
7
7
|
"email": "nugetaad@microsoft.com",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"eslint-config-msal": "file:../../shared-configs/eslint-config-msal",
|
|
75
75
|
"jest": "^29.5.0",
|
|
76
76
|
"prettier": "2.8.7",
|
|
77
|
-
"rollup": "^
|
|
77
|
+
"rollup": "^4.22.4",
|
|
78
78
|
"rollup-msal": "file:../../shared-configs/rollup-msal",
|
|
79
79
|
"ts-jest": "^29.1.0",
|
|
80
80
|
"tslib": "^1.10.0",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"yargs": "^17.3.1"
|
|
83
83
|
},
|
|
84
84
|
"dependencies": {
|
|
85
|
-
"@azure/msal-common": "14.
|
|
85
|
+
"@azure/msal-common": "14.16.0",
|
|
86
86
|
"jsonwebtoken": "^9.0.0",
|
|
87
87
|
"uuid": "^8.3.0"
|
|
88
88
|
},
|
package/src/cache/NodeStorage.ts
CHANGED
|
@@ -227,7 +227,7 @@ export class NodeStorage extends CacheManager {
|
|
|
227
227
|
|
|
228
228
|
/**
|
|
229
229
|
* Reads account from cache, builds it into an account entity and returns it.
|
|
230
|
-
* @param accountKey
|
|
230
|
+
* @param accountKey - lookup key to fetch cache type AccountEntity
|
|
231
231
|
* @returns
|
|
232
232
|
*/
|
|
233
233
|
getCachedAccountEntity(accountKey: string): AccountEntity | null {
|
|
@@ -462,7 +462,7 @@ export class NodeStorage extends CacheManager {
|
|
|
462
462
|
|
|
463
463
|
/**
|
|
464
464
|
* Remove account entity from the platform cache if it's outdated
|
|
465
|
-
* @param accountKey
|
|
465
|
+
* @param accountKey - lookup key to fetch cache type AccountEntity
|
|
466
466
|
*/
|
|
467
467
|
removeOutdatedAccount(accountKey: string): void {
|
|
468
468
|
this.removeItem(accountKey);
|
|
@@ -490,7 +490,7 @@ export class NodeStorage extends CacheManager {
|
|
|
490
490
|
/**
|
|
491
491
|
* Clears all cache entries created by MSAL (except tokens).
|
|
492
492
|
*/
|
|
493
|
-
|
|
493
|
+
clear(): void {
|
|
494
494
|
this.logger.trace("Clearing cache entries created by MSAL");
|
|
495
495
|
|
|
496
496
|
// read inMemoryCache
|
|
@@ -12,6 +12,10 @@ import { TokenCache } from "../TokenCache.js";
|
|
|
12
12
|
import { IPartitionManager } from "./IPartitionManager.js";
|
|
13
13
|
import { ICacheClient } from "./ICacheClient.js";
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Cache plugin that serializes data to the cache and deserializes data from the cache
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
15
19
|
export class DistributedCachePlugin implements ICachePlugin {
|
|
16
20
|
private client: ICacheClient;
|
|
17
21
|
private partitionManager: IPartitionManager;
|
|
@@ -21,6 +25,10 @@ export class DistributedCachePlugin implements ICachePlugin {
|
|
|
21
25
|
this.partitionManager = partitionManager;
|
|
22
26
|
}
|
|
23
27
|
|
|
28
|
+
/**
|
|
29
|
+
* Deserializes the cache before accessing it
|
|
30
|
+
* @param cacheContext - TokenCacheContext
|
|
31
|
+
*/
|
|
24
32
|
public async beforeCacheAccess(
|
|
25
33
|
cacheContext: TokenCacheContext
|
|
26
34
|
): Promise<void> {
|
|
@@ -29,6 +37,10 @@ export class DistributedCachePlugin implements ICachePlugin {
|
|
|
29
37
|
cacheContext.tokenCache.deserialize(cacheData);
|
|
30
38
|
}
|
|
31
39
|
|
|
40
|
+
/**
|
|
41
|
+
* Serializes the cache after accessing it
|
|
42
|
+
* @param cacheContext - TokenCacheContext
|
|
43
|
+
*/
|
|
32
44
|
public async afterCacheAccess(
|
|
33
45
|
cacheContext: TokenCacheContext
|
|
34
46
|
): Promise<void> {
|
|
@@ -3,11 +3,15 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Interface for the cache that defines a getter and setter
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
6
10
|
export interface ICacheClient {
|
|
7
11
|
/**
|
|
8
12
|
* Retrieve the value from the cache
|
|
9
13
|
*
|
|
10
|
-
* @param key
|
|
14
|
+
* @param key - key of item in the cache
|
|
11
15
|
* @returns Promise<string>
|
|
12
16
|
*/
|
|
13
17
|
get(key: string): Promise<string>;
|
|
@@ -15,8 +19,8 @@ export interface ICacheClient {
|
|
|
15
19
|
/**
|
|
16
20
|
* Save the required value using the provided key to cache
|
|
17
21
|
*
|
|
18
|
-
* @param key
|
|
19
|
-
* @param value
|
|
22
|
+
* @param key - key of item in the cache
|
|
23
|
+
* @param value - value of item to be saved in the cache
|
|
20
24
|
* @returns Promise<string>
|
|
21
25
|
*/
|
|
22
26
|
set(key: string, value: string): Promise<string>;
|
|
@@ -5,6 +5,10 @@
|
|
|
5
5
|
|
|
6
6
|
import { AccountEntity } from "@azure/msal-common/node";
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Interface that defines getter methods to get keys used to identity data in the cache
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
8
12
|
export interface IPartitionManager {
|
|
9
13
|
/**
|
|
10
14
|
* This function should return the correct key from which to read
|
|
@@ -28,7 +32,7 @@ export interface IPartitionManager {
|
|
|
28
32
|
* this function would return the homeAccountId from
|
|
29
33
|
* the provided AccountEntity
|
|
30
34
|
*
|
|
31
|
-
* @param accountEntity
|
|
35
|
+
* @param accountEntity - AccountEntity
|
|
32
36
|
* @returns Promise<string>
|
|
33
37
|
*/
|
|
34
38
|
extractKey(accountEntity: AccountEntity): Promise<string>;
|
|
@@ -28,12 +28,13 @@ import {
|
|
|
28
28
|
} from "./SerializerTypes.js";
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
|
-
* This class deserializes cache entities read from the file into in
|
|
31
|
+
* This class deserializes cache entities read from the file into in-memory object types defined internally
|
|
32
|
+
* @internal
|
|
32
33
|
*/
|
|
33
34
|
export class Deserializer {
|
|
34
35
|
/**
|
|
35
36
|
* Parse the JSON blob in memory and deserialize the content
|
|
36
|
-
* @param cachedJson
|
|
37
|
+
* @param cachedJson - JSON blob cache
|
|
37
38
|
*/
|
|
38
39
|
static deserializeJSONBlob(jsonFile: string): JsonCache {
|
|
39
40
|
const deserializedCache = !jsonFile ? {} : JSON.parse(jsonFile);
|
|
@@ -42,7 +43,7 @@ export class Deserializer {
|
|
|
42
43
|
|
|
43
44
|
/**
|
|
44
45
|
* Deserializes accounts to AccountEntity objects
|
|
45
|
-
* @param accounts
|
|
46
|
+
* @param accounts - accounts of type SerializedAccountEntity
|
|
46
47
|
*/
|
|
47
48
|
static deserializeAccounts(
|
|
48
49
|
accounts: Record<string, SerializedAccountEntity>
|
|
@@ -79,7 +80,7 @@ export class Deserializer {
|
|
|
79
80
|
|
|
80
81
|
/**
|
|
81
82
|
* Deserializes id tokens to IdTokenEntity objects
|
|
82
|
-
* @param idTokens
|
|
83
|
+
* @param idTokens - credentials of type SerializedIdTokenEntity
|
|
83
84
|
*/
|
|
84
85
|
static deserializeIdTokens(
|
|
85
86
|
idTokens: Record<string, SerializedIdTokenEntity>
|
|
@@ -105,7 +106,7 @@ export class Deserializer {
|
|
|
105
106
|
|
|
106
107
|
/**
|
|
107
108
|
* Deserializes access tokens to AccessTokenEntity objects
|
|
108
|
-
* @param accessTokens
|
|
109
|
+
* @param accessTokens - access tokens of type SerializedAccessTokenEntity
|
|
109
110
|
*/
|
|
110
111
|
static deserializeAccessTokens(
|
|
111
112
|
accessTokens: Record<string, SerializedAccessTokenEntity>
|
|
@@ -142,7 +143,7 @@ export class Deserializer {
|
|
|
142
143
|
|
|
143
144
|
/**
|
|
144
145
|
* Deserializes refresh tokens to RefreshTokenEntity objects
|
|
145
|
-
* @param refreshTokens
|
|
146
|
+
* @param refreshTokens - refresh tokens of type SerializedRefreshTokenEntity
|
|
146
147
|
*/
|
|
147
148
|
static deserializeRefreshTokens(
|
|
148
149
|
refreshTokens: Record<string, SerializedRefreshTokenEntity>
|
|
@@ -171,7 +172,7 @@ export class Deserializer {
|
|
|
171
172
|
|
|
172
173
|
/**
|
|
173
174
|
* Deserializes appMetadata to AppMetaData objects
|
|
174
|
-
* @param appMetadata
|
|
175
|
+
* @param appMetadata - app metadata of type SerializedAppMetadataEntity
|
|
175
176
|
*/
|
|
176
177
|
static deserializeAppMetadata(
|
|
177
178
|
appMetadata: Record<string, SerializedAppMetadataEntity>
|
|
@@ -193,7 +194,7 @@ export class Deserializer {
|
|
|
193
194
|
|
|
194
195
|
/**
|
|
195
196
|
* Deserialize an inMemory Cache
|
|
196
|
-
* @param jsonCache
|
|
197
|
+
* @param jsonCache - JSON blob cache
|
|
197
198
|
*/
|
|
198
199
|
static deserializeAllCache(jsonCache: JsonCache): InMemoryCache {
|
|
199
200
|
return {
|
|
@@ -20,10 +20,14 @@ import {
|
|
|
20
20
|
SerializedAppMetadataEntity,
|
|
21
21
|
} from "./SerializerTypes.js";
|
|
22
22
|
|
|
23
|
+
/**
|
|
24
|
+
* This class serializes cache entities to be saved into in-memory object types defined internally
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
23
27
|
export class Serializer {
|
|
24
28
|
/**
|
|
25
29
|
* serialize the JSON blob
|
|
26
|
-
* @param data
|
|
30
|
+
* @param data - JSON blob cache
|
|
27
31
|
*/
|
|
28
32
|
static serializeJSONBlob(data: JsonCache): string {
|
|
29
33
|
return JSON.stringify(data);
|
|
@@ -31,7 +35,7 @@ export class Serializer {
|
|
|
31
35
|
|
|
32
36
|
/**
|
|
33
37
|
* Serialize Accounts
|
|
34
|
-
* @param accCache
|
|
38
|
+
* @param accCache - cache of accounts
|
|
35
39
|
*/
|
|
36
40
|
static serializeAccounts(
|
|
37
41
|
accCache: AccountCache
|
|
@@ -63,7 +67,7 @@ export class Serializer {
|
|
|
63
67
|
|
|
64
68
|
/**
|
|
65
69
|
* Serialize IdTokens
|
|
66
|
-
* @param idTCache
|
|
70
|
+
* @param idTCache - cache of ID tokens
|
|
67
71
|
*/
|
|
68
72
|
static serializeIdTokens(
|
|
69
73
|
idTCache: IdTokenCache
|
|
@@ -86,7 +90,7 @@ export class Serializer {
|
|
|
86
90
|
|
|
87
91
|
/**
|
|
88
92
|
* Serializes AccessTokens
|
|
89
|
-
* @param atCache
|
|
93
|
+
* @param atCache - cache of access tokens
|
|
90
94
|
*/
|
|
91
95
|
static serializeAccessTokens(
|
|
92
96
|
atCache: AccessTokenCache
|
|
@@ -119,7 +123,7 @@ export class Serializer {
|
|
|
119
123
|
|
|
120
124
|
/**
|
|
121
125
|
* Serialize refreshTokens
|
|
122
|
-
* @param rtCache
|
|
126
|
+
* @param rtCache - cache of refresh tokens
|
|
123
127
|
*/
|
|
124
128
|
static serializeRefreshTokens(
|
|
125
129
|
rtCache: RefreshTokenCache
|
|
@@ -144,7 +148,7 @@ export class Serializer {
|
|
|
144
148
|
|
|
145
149
|
/**
|
|
146
150
|
* Serialize amdtCache
|
|
147
|
-
* @param amdtCache
|
|
151
|
+
* @param amdtCache - cache of app metadata
|
|
148
152
|
*/
|
|
149
153
|
static serializeAppMetadata(
|
|
150
154
|
amdtCache: AppMetadataCache
|
|
@@ -164,7 +168,7 @@ export class Serializer {
|
|
|
164
168
|
|
|
165
169
|
/**
|
|
166
170
|
* Serialize the cache
|
|
167
|
-
* @param
|
|
171
|
+
* @param inMemCache - itemised cache read from the JSON
|
|
168
172
|
*/
|
|
169
173
|
static serializeAllCache(inMemCache: InMemoryCache): JsonCache {
|
|
170
174
|
return {
|
|
@@ -133,6 +133,7 @@ export abstract class ClientApplication {
|
|
|
133
133
|
const authClientConfig = await this.buildOauthClientConfiguration(
|
|
134
134
|
validRequest.authority,
|
|
135
135
|
validRequest.correlationId,
|
|
136
|
+
validRequest.redirectUri,
|
|
136
137
|
undefined,
|
|
137
138
|
undefined,
|
|
138
139
|
request.azureCloudOptions
|
|
@@ -180,6 +181,7 @@ export abstract class ClientApplication {
|
|
|
180
181
|
const authClientConfig = await this.buildOauthClientConfiguration(
|
|
181
182
|
validRequest.authority,
|
|
182
183
|
validRequest.correlationId,
|
|
184
|
+
validRequest.redirectUri,
|
|
183
185
|
serverTelemetryManager,
|
|
184
186
|
undefined,
|
|
185
187
|
request.azureCloudOptions
|
|
@@ -233,6 +235,7 @@ export abstract class ClientApplication {
|
|
|
233
235
|
await this.buildOauthClientConfiguration(
|
|
234
236
|
validRequest.authority,
|
|
235
237
|
validRequest.correlationId,
|
|
238
|
+
validRequest.redirectUri || "",
|
|
236
239
|
serverTelemetryManager,
|
|
237
240
|
undefined,
|
|
238
241
|
request.azureCloudOptions
|
|
@@ -281,6 +284,7 @@ export abstract class ClientApplication {
|
|
|
281
284
|
await this.buildOauthClientConfiguration(
|
|
282
285
|
validRequest.authority,
|
|
283
286
|
validRequest.correlationId,
|
|
287
|
+
validRequest.redirectUri || "",
|
|
284
288
|
serverTelemetryManager,
|
|
285
289
|
undefined,
|
|
286
290
|
request.azureCloudOptions
|
|
@@ -332,6 +336,7 @@ export abstract class ClientApplication {
|
|
|
332
336
|
await this.buildOauthClientConfiguration(
|
|
333
337
|
validRequest.authority,
|
|
334
338
|
validRequest.correlationId,
|
|
339
|
+
"",
|
|
335
340
|
serverTelemetryManager,
|
|
336
341
|
undefined,
|
|
337
342
|
request.azureCloudOptions
|
|
@@ -367,8 +372,8 @@ export abstract class ClientApplication {
|
|
|
367
372
|
* This API is provided for scenarios where you would use OAuth2.0 state parameter to mitigate against
|
|
368
373
|
* CSRF attacks.
|
|
369
374
|
* For more information about state, visit https://datatracker.ietf.org/doc/html/rfc6819#section-3.6.
|
|
370
|
-
* @param state
|
|
371
|
-
* @param cachedState
|
|
375
|
+
* @param state - Unique GUID generated by the user that is cached by the user and sent to the server during the first leg of the flow
|
|
376
|
+
* @param cachedState - This string is sent back by the server with the authorization code
|
|
372
377
|
*/
|
|
373
378
|
protected validateState(state: string, cachedState: string): void {
|
|
374
379
|
if (!state) {
|
|
@@ -403,6 +408,7 @@ export abstract class ClientApplication {
|
|
|
403
408
|
protected async buildOauthClientConfiguration(
|
|
404
409
|
authority: string,
|
|
405
410
|
requestCorrelationId: string,
|
|
411
|
+
redirectUri: string,
|
|
406
412
|
serverTelemetryManager?: ServerTelemetryManager,
|
|
407
413
|
azureRegionConfiguration?: AzureRegionConfiguration,
|
|
408
414
|
azureCloudOptions?: AzureCloudOptions
|
|
@@ -439,6 +445,7 @@ export abstract class ClientApplication {
|
|
|
439
445
|
clientId: this.config.auth.clientId,
|
|
440
446
|
authority: discoveredAuthority,
|
|
441
447
|
clientCapabilities: this.config.auth.clientCapabilities,
|
|
448
|
+
redirectUri,
|
|
442
449
|
},
|
|
443
450
|
loggerOptions: {
|
|
444
451
|
logLevel: this.config.system.loggerOptions.logLevel,
|
|
@@ -612,6 +619,6 @@ export abstract class ClientApplication {
|
|
|
612
619
|
* Clear the cache
|
|
613
620
|
*/
|
|
614
621
|
clearCache(): void {
|
|
615
|
-
|
|
622
|
+
this.storage.clear();
|
|
616
623
|
}
|
|
617
624
|
}
|
|
@@ -42,6 +42,7 @@ import {
|
|
|
42
42
|
|
|
43
43
|
/**
|
|
44
44
|
* OAuth2.0 client credential grant
|
|
45
|
+
* @public
|
|
45
46
|
*/
|
|
46
47
|
export class ClientCredentialClient extends BaseClient {
|
|
47
48
|
private readonly appTokenProvider?: IAppTokenProvider;
|
|
@@ -56,7 +57,7 @@ export class ClientCredentialClient extends BaseClient {
|
|
|
56
57
|
|
|
57
58
|
/**
|
|
58
59
|
* Public API to acquire a token with ClientCredential Flow for Confidential clients
|
|
59
|
-
* @param request
|
|
60
|
+
* @param request - CommonClientCredentialRequest provided by the developer
|
|
60
61
|
*/
|
|
61
62
|
public async acquireToken(
|
|
62
63
|
request: CommonClientCredentialRequest
|
|
@@ -232,8 +233,8 @@ export class ClientCredentialClient extends BaseClient {
|
|
|
232
233
|
|
|
233
234
|
/**
|
|
234
235
|
* Makes a network call to request the token from the service
|
|
235
|
-
* @param request
|
|
236
|
-
* @param authority
|
|
236
|
+
* @param request - CommonClientCredentialRequest provided by the developer
|
|
237
|
+
* @param authority - authority object
|
|
237
238
|
*/
|
|
238
239
|
private async executeTokenRequest(
|
|
239
240
|
request: CommonClientCredentialRequest,
|
|
@@ -330,7 +331,7 @@ export class ClientCredentialClient extends BaseClient {
|
|
|
330
331
|
|
|
331
332
|
/**
|
|
332
333
|
* generate the request to the server in the acceptable format
|
|
333
|
-
* @param request
|
|
334
|
+
* @param request - CommonClientCredentialRequest provided by the developer
|
|
334
335
|
*/
|
|
335
336
|
private async createTokenRequestBody(
|
|
336
337
|
request: CommonClientCredentialRequest
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
Constants as NodeConstants,
|
|
13
13
|
ApiId,
|
|
14
14
|
REGION_ENVIRONMENT_VARIABLE,
|
|
15
|
+
MSAL_FORCE_REGION,
|
|
15
16
|
} from "../utils/Constants.js";
|
|
16
17
|
import {
|
|
17
18
|
CommonClientCredentialRequest,
|
|
@@ -27,6 +28,7 @@ import {
|
|
|
27
28
|
ClientAuthErrorCodes,
|
|
28
29
|
ClientAssertion as ClientAssertionType,
|
|
29
30
|
getClientAssertion,
|
|
31
|
+
AzureRegion,
|
|
30
32
|
} from "@azure/msal-common/node";
|
|
31
33
|
import { IConfidentialClientApplication } from "./IConfidentialClientApplication.js";
|
|
32
34
|
import { OnBehalfOfRequest } from "../request/OnBehalfOfRequest.js";
|
|
@@ -136,8 +138,24 @@ export class ConfidentialClientApplication
|
|
|
136
138
|
);
|
|
137
139
|
}
|
|
138
140
|
|
|
141
|
+
/*
|
|
142
|
+
* if this env variable is set, and the developer provided region isn't defined and isn't "DisableMsalForceRegion",
|
|
143
|
+
* MSAL shall opt-in to ESTS-R with the value of this variable
|
|
144
|
+
*/
|
|
145
|
+
const ENV_MSAL_FORCE_REGION: AzureRegion | undefined =
|
|
146
|
+
process.env[MSAL_FORCE_REGION];
|
|
147
|
+
|
|
148
|
+
let region: AzureRegion | undefined;
|
|
149
|
+
if (validRequest.azureRegion !== "DisableMsalForceRegion") {
|
|
150
|
+
if (!validRequest.azureRegion && ENV_MSAL_FORCE_REGION) {
|
|
151
|
+
region = ENV_MSAL_FORCE_REGION;
|
|
152
|
+
} else {
|
|
153
|
+
region = validRequest.azureRegion;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
139
157
|
const azureRegionConfiguration: AzureRegionConfiguration = {
|
|
140
|
-
azureRegion:
|
|
158
|
+
azureRegion: region,
|
|
141
159
|
environmentRegion: process.env[REGION_ENVIRONMENT_VARIABLE],
|
|
142
160
|
};
|
|
143
161
|
|
|
@@ -151,6 +169,7 @@ export class ConfidentialClientApplication
|
|
|
151
169
|
await this.buildOauthClientConfiguration(
|
|
152
170
|
validRequest.authority,
|
|
153
171
|
validRequest.correlationId,
|
|
172
|
+
"",
|
|
154
173
|
serverTelemetryManager,
|
|
155
174
|
azureRegionConfiguration,
|
|
156
175
|
request.azureCloudOptions
|
|
@@ -199,6 +218,7 @@ export class ConfidentialClientApplication
|
|
|
199
218
|
const onBehalfOfConfig = await this.buildOauthClientConfiguration(
|
|
200
219
|
validRequest.authority,
|
|
201
220
|
validRequest.correlationId,
|
|
221
|
+
"",
|
|
202
222
|
undefined,
|
|
203
223
|
undefined,
|
|
204
224
|
request.azureCloudOptions
|
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* OAuth2.0 Device code client
|
|
30
|
+
* @public
|
|
30
31
|
*/
|
|
31
32
|
export class DeviceCodeClient extends BaseClient {
|
|
32
33
|
constructor(configuration: ClientConfiguration) {
|
|
@@ -36,7 +37,7 @@ export class DeviceCodeClient extends BaseClient {
|
|
|
36
37
|
/**
|
|
37
38
|
* Gets device code from device code endpoint, calls back to with device code response, and
|
|
38
39
|
* polls token endpoint to exchange device code for tokens
|
|
39
|
-
* @param request
|
|
40
|
+
* @param request - developer provided CommonDeviceCodeRequest
|
|
40
41
|
*/
|
|
41
42
|
public async acquireToken(
|
|
42
43
|
request: CommonDeviceCodeRequest
|
|
@@ -70,7 +71,7 @@ export class DeviceCodeClient extends BaseClient {
|
|
|
70
71
|
|
|
71
72
|
/**
|
|
72
73
|
* Creates device code request and executes http GET
|
|
73
|
-
* @param request
|
|
74
|
+
* @param request - developer provided CommonDeviceCodeRequest
|
|
74
75
|
*/
|
|
75
76
|
private async getDeviceCode(
|
|
76
77
|
request: CommonDeviceCodeRequest
|
|
@@ -98,15 +99,18 @@ export class DeviceCodeClient extends BaseClient {
|
|
|
98
99
|
endpoint,
|
|
99
100
|
queryString,
|
|
100
101
|
headers,
|
|
101
|
-
thumbprint
|
|
102
|
+
thumbprint,
|
|
103
|
+
request.correlationId
|
|
102
104
|
);
|
|
103
105
|
}
|
|
104
106
|
|
|
105
107
|
/**
|
|
106
108
|
* Creates query string for the device code request
|
|
107
|
-
* @param request
|
|
109
|
+
* @param request - developer provided CommonDeviceCodeRequest
|
|
108
110
|
*/
|
|
109
|
-
createExtraQueryParameters(
|
|
111
|
+
public createExtraQueryParameters(
|
|
112
|
+
request: CommonDeviceCodeRequest
|
|
113
|
+
): string {
|
|
110
114
|
const parameterBuilder = new RequestParameterBuilder();
|
|
111
115
|
|
|
112
116
|
if (request.extraQueryParameters) {
|
|
@@ -120,15 +124,18 @@ export class DeviceCodeClient extends BaseClient {
|
|
|
120
124
|
|
|
121
125
|
/**
|
|
122
126
|
* Executes POST request to device code endpoint
|
|
123
|
-
* @param deviceCodeEndpoint
|
|
124
|
-
* @param queryString
|
|
125
|
-
* @param headers
|
|
127
|
+
* @param deviceCodeEndpoint - token endpoint
|
|
128
|
+
* @param queryString - string to be used in the body of the request
|
|
129
|
+
* @param headers - headers for the request
|
|
130
|
+
* @param thumbprint - unique request thumbprint
|
|
131
|
+
* @param correlationId - correlation id to be used in the request
|
|
126
132
|
*/
|
|
127
133
|
private async executePostRequestToDeviceCodeEndpoint(
|
|
128
134
|
deviceCodeEndpoint: string,
|
|
129
135
|
queryString: string,
|
|
130
136
|
headers: Record<string, string>,
|
|
131
|
-
thumbprint: RequestThumbprint
|
|
137
|
+
thumbprint: RequestThumbprint,
|
|
138
|
+
correlationId: string
|
|
132
139
|
): Promise<DeviceCodeResponse> {
|
|
133
140
|
const {
|
|
134
141
|
body: {
|
|
@@ -139,13 +146,14 @@ export class DeviceCodeClient extends BaseClient {
|
|
|
139
146
|
interval,
|
|
140
147
|
message,
|
|
141
148
|
},
|
|
142
|
-
} = await this.
|
|
149
|
+
} = await this.sendPostRequest<ServerDeviceCodeResponse>(
|
|
143
150
|
thumbprint,
|
|
144
151
|
deviceCodeEndpoint,
|
|
145
152
|
{
|
|
146
153
|
body: queryString,
|
|
147
154
|
headers: headers,
|
|
148
|
-
}
|
|
155
|
+
},
|
|
156
|
+
correlationId
|
|
149
157
|
);
|
|
150
158
|
|
|
151
159
|
return {
|
|
@@ -160,6 +168,7 @@ export class DeviceCodeClient extends BaseClient {
|
|
|
160
168
|
|
|
161
169
|
/**
|
|
162
170
|
* Create device code endpoint query parameters and returns string
|
|
171
|
+
* @param request - developer provided CommonDeviceCodeRequest
|
|
163
172
|
*/
|
|
164
173
|
private createQueryString(request: CommonDeviceCodeRequest): string {
|
|
165
174
|
const parameterBuilder: RequestParameterBuilder =
|
|
@@ -189,9 +198,10 @@ export class DeviceCodeClient extends BaseClient {
|
|
|
189
198
|
}
|
|
190
199
|
|
|
191
200
|
/**
|
|
192
|
-
* Breaks the polling with specific conditions
|
|
193
|
-
* @param request
|
|
194
|
-
* @param
|
|
201
|
+
* Breaks the polling with specific conditions
|
|
202
|
+
* @param deviceCodeExpirationTime - expiration time for the device code request
|
|
203
|
+
* @param userSpecifiedTimeout - developer provided timeout, to be compared against deviceCodeExpirationTime
|
|
204
|
+
* @param userSpecifiedCancelFlag - boolean indicating the developer would like to cancel the request
|
|
195
205
|
*/
|
|
196
206
|
private continuePolling(
|
|
197
207
|
deviceCodeExpirationTime: number,
|
|
@@ -231,10 +241,9 @@ export class DeviceCodeClient extends BaseClient {
|
|
|
231
241
|
}
|
|
232
242
|
|
|
233
243
|
/**
|
|
234
|
-
* Creates token request with device code response and polls token endpoint at interval set by the device code
|
|
235
|
-
*
|
|
236
|
-
* @param
|
|
237
|
-
* @param deviceCodeResponse
|
|
244
|
+
* Creates token request with device code response and polls token endpoint at interval set by the device code response
|
|
245
|
+
* @param request - developer provided CommonDeviceCodeRequest
|
|
246
|
+
* @param deviceCodeResponse - DeviceCodeResponse returned by the security token service device code endpoint
|
|
238
247
|
*/
|
|
239
248
|
private async acquireTokenWithDeviceCode(
|
|
240
249
|
request: CommonDeviceCodeRequest,
|
|
@@ -326,8 +335,8 @@ export class DeviceCodeClient extends BaseClient {
|
|
|
326
335
|
|
|
327
336
|
/**
|
|
328
337
|
* Creates query parameters and converts to string.
|
|
329
|
-
* @param request
|
|
330
|
-
* @param deviceCodeResponse
|
|
338
|
+
* @param request - developer provided CommonDeviceCodeRequest
|
|
339
|
+
* @param deviceCodeResponse - DeviceCodeResponse returned by the security token service device code endpoint
|
|
331
340
|
*/
|
|
332
341
|
private createTokenRequestBody(
|
|
333
342
|
request: CommonDeviceCodeRequest,
|