@azure/msal-node 1.5.0 → 1.6.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/CHANGELOG.json CHANGED
@@ -1,6 +1,53 @@
1
1
  {
2
2
  "name": "@azure/msal-node",
3
3
  "entries": [
4
+ {
5
+ "date": "Tue, 08 Feb 2022 00:41:06 GMT",
6
+ "tag": "@azure/msal-node_v1.6.0",
7
+ "version": "1.6.0",
8
+ "comments": {
9
+ "none": [
10
+ {
11
+ "author": "bmahal@microsoft.com",
12
+ "package": "@azure/msal-node",
13
+ "commit": "b81793d59e29261ecaef3e4fc3493e0c1ddde68e",
14
+ "comment": "Node testing overhaul #4433"
15
+ },
16
+ {
17
+ "author": "thomas.norling@microsoft.com",
18
+ "package": "@azure/msal-node",
19
+ "commit": "19f76b1d9cd2b0f1a4a7e4765c8ee9e7e17f3d59",
20
+ "comment": "Test changes #4383"
21
+ }
22
+ ],
23
+ "minor": [
24
+ {
25
+ "author": "kamausamuel11@gmail.com",
26
+ "package": "@azure/msal-node",
27
+ "commit": "abddbfb626260bfaa49a357090884c01828e2216",
28
+ "comment": "feat: add the redis distributed cache layer"
29
+ },
30
+ {
31
+ "author": "sameera.gajjarapu@microsoft.com",
32
+ "package": "@azure/msal-node",
33
+ "commit": "d576b7d35f8f24e53946c72bc78c0401a8d2dc86",
34
+ "comment": "Add AzureCloudInstance to JS libraries"
35
+ },
36
+ {
37
+ "author": "sameera.gajjarapu@microsoft.com",
38
+ "package": "@azure/msal-node",
39
+ "commit": "a6fda9fd4ff40a90d173ecbd1281d8dd02eb4d58",
40
+ "comment": "Support proxy in msal-node(#4447)"
41
+ },
42
+ {
43
+ "author": "beachball",
44
+ "package": "@azure/msal-node",
45
+ "comment": "Bump @azure/msal-common to v6.1.0",
46
+ "commit": "639253acbc825e1f19ca712bc72dce8da149e3e8"
47
+ }
48
+ ]
49
+ }
50
+ },
4
51
  {
5
52
  "date": "Tue, 04 Jan 2022 00:20:29 GMT",
6
53
  "tag": "@azure/msal-node_v1.5.0",
package/CHANGELOG.md CHANGED
@@ -1,9 +1,20 @@
1
1
  # Change Log - @azure/msal-node
2
2
 
3
- This log was last generated on Tue, 04 Jan 2022 00:20:29 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 08 Feb 2022 00:41:06 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 1.6.0
8
+
9
+ Tue, 08 Feb 2022 00:41:06 GMT
10
+
11
+ ### Minor changes
12
+
13
+ - feat: add the redis distributed cache layer (kamausamuel11@gmail.com)
14
+ - Add AzureCloudInstance to JS libraries (sameera.gajjarapu@microsoft.com)
15
+ - Support proxy in msal-node(#4447) (sameera.gajjarapu@microsoft.com)
16
+ - Bump @azure/msal-common to v6.1.0
17
+
7
18
  ## 1.5.0
8
19
 
9
20
  Tue, 04 Jan 2022 00:20:29 GMT
@@ -0,0 +1,11 @@
1
+ import { ICachePlugin, TokenCacheContext } from "@azure/msal-common";
2
+ import { IPartitionManager } from "./IPartitionManager";
3
+ import { ICacheClient } from "./ICacheClient";
4
+ export declare class DistributedCachePlugin implements ICachePlugin {
5
+ private client;
6
+ private partitionManager;
7
+ constructor(client: ICacheClient, partitionManager: IPartitionManager);
8
+ beforeCacheAccess(cacheContext: TokenCacheContext): Promise<void>;
9
+ afterCacheAccess(cacheContext: TokenCacheContext): Promise<void>;
10
+ }
11
+ //# sourceMappingURL=DistributedCachePlugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DistributedCachePlugin.d.ts","sourceRoot":"","sources":["../../src/cache/distributed/DistributedCachePlugin.ts"],"names":[],"mappings":"AAKA,OAAO,EAAiB,YAAY,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEpF,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,qBAAa,sBAAuB,YAAW,YAAY;IACvD,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,gBAAgB,CAAoB;gBAEhC,MAAM,EAAE,YAAY,EAAE,gBAAgB,EAAE,iBAAiB;IAKxD,iBAAiB,CAAC,YAAY,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAMjE,gBAAgB,CAAC,YAAY,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;CAahF"}
@@ -0,0 +1,18 @@
1
+ export interface ICacheClient {
2
+ /**
3
+ * Retrieve the value from the cache
4
+ *
5
+ * @param key string
6
+ * @returns Promise<string>
7
+ */
8
+ get(key: string): Promise<string>;
9
+ /**
10
+ * Save the required value using the provided key to cache
11
+ *
12
+ * @param key string
13
+ * @param value string
14
+ * @returns Promise<string>
15
+ */
16
+ set(key: string, value: string): Promise<string>;
17
+ }
18
+ //# sourceMappingURL=ICacheClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ICacheClient.d.ts","sourceRoot":"","sources":["../../src/cache/distributed/ICacheClient.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,YAAY;IACzB;;;;;OAKG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IAEjC;;;;;;OAMG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;CACnD"}
@@ -0,0 +1,33 @@
1
+ import { AccountEntity } from "@azure/msal-common";
2
+ export interface IPartitionManager {
3
+ /**
4
+ * This function should return the correct key from which to read
5
+ * the specific user's information from cache.
6
+ *
7
+ * Example: Your application may be partitioning the user's cache
8
+ * information for each user using the homeAccountId and thus
9
+ * this function would return the homeAccountId for
10
+ * the user in question
11
+ *
12
+ * Visit the [RedisTestApp](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-node-samples/RedisTestApp) to see it in action.
13
+ *
14
+ * @returns Promise<string>
15
+ */
16
+ getKey(): Promise<string>;
17
+ /**
18
+ * This function should return the correct key being used to save each
19
+ * user's cache information to cache - given an AccountEntity
20
+ *
21
+ * Example: Your application may be partitioning the user's cache
22
+ * information for each user using the homeAccountId thus
23
+ * this function would return the homeAccountId from
24
+ * the provided AccountEntity
25
+ *
26
+ * Visit the [RedisTestApp](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-node-samples/RedisTestApp) to see it in action.
27
+ *
28
+ * @param accountEntity: AccountEntity
29
+ * @returns Promise<string>
30
+ */
31
+ extractKey(accountEntity: AccountEntity): Promise<string>;
32
+ }
33
+ //# sourceMappingURL=IPartitionManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IPartitionManager.d.ts","sourceRoot":"","sources":["../../src/cache/distributed/IPartitionManager.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,MAAM,WAAW,iBAAiB;IAC9B;;;;;;;;;;;;OAYG;IACH,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,CAAA;IAEzB;;;;;;;;;;;;;OAaG;IACH,UAAU,CAAC,aAAa,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;CAC5D"}
@@ -1,4 +1,4 @@
1
- import { ClientConfiguration, AuthenticationResult, BaseAuthRequest, Logger, ServerTelemetryManager, AzureRegionConfiguration } from "@azure/msal-common";
1
+ import { ClientConfiguration, AuthenticationResult, BaseAuthRequest, Logger, ServerTelemetryManager, AzureRegionConfiguration, AzureCloudOptions } from "@azure/msal-common";
2
2
  import { Configuration, NodeConfiguration } from "../config/Configuration";
3
3
  import { NodeStorage } from "../cache/NodeStorage";
4
4
  import { TokenCache } from "../cache/TokenCache";
@@ -104,7 +104,7 @@ export declare abstract class ClientApplication {
104
104
  * @param authority - user passed authority in configuration
105
105
  * @param serverTelemetryManager - initializes servertelemetry if passed
106
106
  */
107
- protected buildOauthClientConfiguration(authority: string, requestCorrelationId?: string, serverTelemetryManager?: ServerTelemetryManager, azureRegionConfiguration?: AzureRegionConfiguration): Promise<ClientConfiguration>;
107
+ protected buildOauthClientConfiguration(authority: string, requestCorrelationId?: string, serverTelemetryManager?: ServerTelemetryManager, azureRegionConfiguration?: AzureRegionConfiguration, azureCloudOptions?: AzureCloudOptions): Promise<ClientConfiguration>;
108
108
  private getClientAssertion;
109
109
  /**
110
110
  * Generates a request with the default scopes & generates a correlationId.
@@ -1 +1 @@
1
- {"version":3,"file":"ClientApplication.d.ts","sourceRoot":"","sources":["../src/client/ClientApplication.ts"],"names":[],"mappings":"AAKA,OAAO,EAEH,mBAAmB,EAEnB,oBAAoB,EAGpB,eAAe,EAEf,MAAM,EACN,sBAAsB,EAYtB,wBAAwB,EAE3B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAyB,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAElG,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAE7E;;;GAGG;AACH,8BAAsB,iBAAiB;IAEnC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAiB;IAChD,OAAO,CAAC,UAAU,CAAa;IAE/B;;OAEG;IACH,SAAS,CAAC,OAAO,EAAE,WAAW,CAAC;IAC/B;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC;IACzB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ConfidentialClientApplication.d.ts","sourceRoot":"","sources":["../src/client/ConfidentialClientApplication.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAGxD,OAAO,EAKH,oBAAoB,EAKvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAE7E;;;;GAIG;AACH,qBAAa,6BAA8B,SAAQ,iBAAkB,YAAW,8BAA8B;IAE1G;;;;;;;;;;;;;;;;;;OAkBG;gBACS,aAAa,EAAE,aAAa;IAKxC;;OAEG;IACU,8BAA8B,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IA8BnH;;;;;;;;;;OAUG;IACU,sBAAsB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAsBrG,OAAO,CAAC,mBAAmB;CAkC9B"}
1
+ {"version":3,"file":"ConfidentialClientApplication.d.ts","sourceRoot":"","sources":["../src/client/ConfidentialClientApplication.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAGxD,OAAO,EAKH,oBAAoB,EAKvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAE7E;;;;GAIG;AACH,qBAAa,6BAA8B,SAAQ,iBAAkB,YAAW,8BAA8B;IAE1G;;;;;;;;;;;;;;;;;;OAkBG;gBACS,aAAa,EAAE,aAAa;IAKxC;;OAEG;IACU,8BAA8B,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IA+BnH;;;;;;;;;;OAUG;IACU,sBAAsB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAyBrG,OAAO,CAAC,mBAAmB;CAkC9B"}
@@ -1 +1 @@
1
- {"version":3,"file":"PublicClientApplication.d.ts","sourceRoot":"","sources":["../src/client/PublicClientApplication.ts"],"names":[],"mappings":"AAMA,OAAO,EAEH,oBAAoB,EAGvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE;;;;GAIG;AACH,qBAAa,uBAAwB,SAAQ,iBAAkB,YAAW,wBAAwB;IAC9F;;;;;;;;;;;;;;;;OAgBG;gBACS,aAAa,EAAE,aAAa;IAIxC;;;;;;;;OAQG;IACU,wBAAwB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;CAqB1G"}
1
+ {"version":3,"file":"PublicClientApplication.d.ts","sourceRoot":"","sources":["../src/client/PublicClientApplication.ts"],"names":[],"mappings":"AAMA,OAAO,EAEH,oBAAoB,EAGvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE;;;;GAIG;AACH,qBAAa,uBAAwB,SAAQ,iBAAkB,YAAW,wBAAwB;IAC9F;;;;;;;;;;;;;;;;OAgBG;gBACS,aAAa,EAAE,aAAa;IAIxC;;;;;;;;OAQG;IACU,wBAAwB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;CAuB1G"}
@@ -1,4 +1,4 @@
1
- import { LoggerOptions, INetworkModule, ProtocolMode, ICachePlugin } from "@azure/msal-common";
1
+ import { LoggerOptions, INetworkModule, ProtocolMode, ICachePlugin, AzureCloudOptions } from "@azure/msal-common";
2
2
  /**
3
3
  * - clientId - Client id of the application.
4
4
  * - authority - Url of the authority. If no value is set, defaults to https://login.microsoftonline.com/common.
@@ -24,6 +24,7 @@ export declare type NodeAuthOptions = {
24
24
  authorityMetadata?: string;
25
25
  clientCapabilities?: Array<string>;
26
26
  protocolMode?: ProtocolMode;
27
+ azureCloudOptions?: AzureCloudOptions;
27
28
  };
28
29
  /**
29
30
  * Use this to configure the below cache configuration options:
@@ -44,6 +45,7 @@ export declare type CacheOptions = {
44
45
  export declare type NodeSystemOptions = {
45
46
  loggerOptions?: LoggerOptions;
46
47
  networkClient?: INetworkModule;
48
+ proxyUrl?: string;
47
49
  };
48
50
  /**
49
51
  * Use the configuration object to configure MSAL and initialize the client application object
@@ -1 +1 @@
1
- {"version":3,"file":"Configuration.d.ts","sourceRoot":"","sources":["../src/config/Configuration.ts"],"names":[],"mappings":"AAKA,OAAO,EACH,aAAa,EACb,cAAc,EAEd,YAAY,EACZ,YAAY,EACf,MAAM,oBAAoB,CAAC;AAG5B;;;;;;;;;GASG;AACH,oBAAY,eAAe,GAAG;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAC,MAAM,CAA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B,CAAC,EAClC,IAAI,EACJ,KAAK,EACL,MAAM,GACT,EAAE,aAAa,GAAG,iBAAiB,CAOnC"}
package/dist/index.d.ts CHANGED
@@ -5,6 +5,8 @@
5
5
  export { IPublicClientApplication } from "./client/IPublicClientApplication";
6
6
  export { IConfidentialClientApplication } from "./client/IConfidentialClientApplication";
7
7
  export { ITokenCache } from "./cache/ITokenCache";
8
+ export { ICacheClient } from "./cache/distributed/ICacheClient";
9
+ export { IPartitionManager } from "./cache/distributed/IPartitionManager";
8
10
  export { PublicClientApplication } from "./client/PublicClientApplication";
9
11
  export { ConfidentialClientApplication } from "./client/ConfidentialClientApplication";
10
12
  export { ClientApplication } from "./client/ClientApplication";
@@ -13,6 +15,7 @@ export { ClientAssertion } from "./client/ClientAssertion";
13
15
  export { TokenCache } from "./cache/TokenCache";
14
16
  export { NodeStorage } from "./cache/NodeStorage";
15
17
  export { CacheKVStore, JsonCache, InMemoryCache, SerializedAccountEntity, SerializedIdTokenEntity, SerializedAccessTokenEntity, SerializedAppMetadataEntity, SerializedRefreshTokenEntity } from "./cache/serializer/SerializerTypes";
18
+ export { DistributedCachePlugin } from "./cache/distributed/DistributedCachePlugin";
16
19
  export { CryptoProvider } from "./crypto/CryptoProvider";
17
20
  export type { AuthorizationCodeRequest } from "./request/AuthorizationCodeRequest";
18
21
  export type { AuthorizationUrlRequest } from "./request/AuthorizationUrlRequest";
@@ -22,6 +25,6 @@ export type { OnBehalfOfRequest } from "./request/OnBehalfOfRequest";
22
25
  export type { UsernamePasswordRequest } from "./request/UsernamePasswordRequest";
23
26
  export type { RefreshTokenRequest } from "./request/RefreshTokenRequest";
24
27
  export type { SilentFlowRequest } from "./request/SilentFlowRequest";
25
- export { PromptValue, ResponseMode, AuthenticationResult, AccountInfo, ValidCacheType, AuthError, AuthErrorMessage, ClientAuthError, ClientAuthErrorMessage, ClientConfigurationError, ClientConfigurationErrorMessage, InteractionRequiredAuthError, InteractionRequiredAuthErrorMessage, ServerError, INetworkModule, NetworkRequestOptions, NetworkResponse, Logger, LogLevel, ProtocolMode, ICachePlugin, TokenCacheContext, ISerializableTokenCache } from "@azure/msal-common";
28
+ export { PromptValue, ResponseMode, AuthenticationResult, AccountInfo, ValidCacheType, AuthError, AuthErrorMessage, ClientAuthError, ClientAuthErrorMessage, ClientConfigurationError, ClientConfigurationErrorMessage, InteractionRequiredAuthError, InteractionRequiredAuthErrorMessage, ServerError, INetworkModule, NetworkRequestOptions, NetworkResponse, Logger, LogLevel, ProtocolMode, ICachePlugin, TokenCacheContext, ISerializableTokenCache, AzureCloudInstance, AzureCloudOptions } from "@azure/msal-common";
26
29
  export { version } from "./packageMetadata";
27
30
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAKA;;;GAGG;AAGH,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,8BAA8B,EAAE,MAAM,yCAAyC,CAAC;AACzF,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGlD,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,eAAe,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAChI,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAG3D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,2BAA2B,EAAE,2BAA2B,EAAE,4BAA4B,EAAE,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,EACxB,+BAA+B,EAC/B,4BAA4B,EAC5B,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,EACpB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC"}
@@ -6,6 +6,7 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
6
6
 
7
7
  var msalCommon = require('@azure/msal-common');
8
8
  var axios = _interopDefault(require('axios'));
9
+ var createHttpsProxyAgent = _interopDefault(require('https-proxy-agent'));
9
10
  var uuid = require('uuid');
10
11
  var crypto = _interopDefault(require('crypto'));
11
12
  var jsonwebtoken = require('jsonwebtoken');
@@ -118,6 +119,13 @@ class HttpClient {
118
119
  /* istanbul ignore next */
119
120
  validateStatus: () => true
120
121
  };
122
+
123
+ if (options && options.proxyUrl) {
124
+ // for axios, this has to be disabled
125
+ request.proxy = false;
126
+ request.httpsAgent = createHttpsProxyAgent(options.proxyUrl);
127
+ }
128
+
121
129
  const response = await axios(request);
122
130
  return {
123
131
  headers: response.headers,
@@ -147,6 +155,13 @@ class HttpClient {
147
155
  /* istanbul ignore next */
148
156
  validateStatus: () => true
149
157
  };
158
+
159
+ if (options && options.proxyUrl) {
160
+ // for axios, this has to be disabled
161
+ request.proxy = false;
162
+ request.httpsAgent = createHttpsProxyAgent(options.proxyUrl);
163
+ }
164
+
150
165
  const response = await axios(request);
151
166
  return {
152
167
  headers: response.headers,
@@ -189,7 +204,11 @@ const DEFAULT_AUTH_OPTIONS = {
189
204
  cloudDiscoveryMetadata: "",
190
205
  authorityMetadata: "",
191
206
  clientCapabilities: [],
192
- protocolMode: msalCommon.ProtocolMode.AAD
207
+ protocolMode: msalCommon.ProtocolMode.AAD,
208
+ azureCloudOptions: {
209
+ azureCloudInstance: msalCommon.AzureCloudInstance.None,
210
+ tenant: ""
211
+ }
193
212
  };
194
213
  const DEFAULT_CACHE_OPTIONS = {};
195
214
  const DEFAULT_LOGGER_OPTIONS = {
@@ -200,7 +219,8 @@ const DEFAULT_LOGGER_OPTIONS = {
200
219
  };
201
220
  const DEFAULT_SYSTEM_OPTIONS = {
202
221
  loggerOptions: DEFAULT_LOGGER_OPTIONS,
203
- networkClient: /*#__PURE__*/NetworkUtils.getNetworkClient()
222
+ networkClient: /*#__PURE__*/NetworkUtils.getNetworkClient(),
223
+ proxyUrl: ""
204
224
  };
205
225
  /**
206
226
  * Sets the default options when not explicitly configured from app developer
@@ -1553,7 +1573,7 @@ class TokenCache {
1553
1573
 
1554
1574
  /* eslint-disable header/header */
1555
1575
  const name = "@azure/msal-node";
1556
- const version = "1.5.0";
1576
+ const version = "1.6.0";
1557
1577
 
1558
1578
  /*
1559
1579
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1593,7 +1613,7 @@ class ClientApplication {
1593
1613
  responseMode: request.responseMode || msalCommon.ResponseMode.QUERY,
1594
1614
  authenticationScheme: msalCommon.AuthenticationScheme.BEARER
1595
1615
  };
1596
- const authClientConfig = await this.buildOauthClientConfiguration(validRequest.authority, validRequest.correlationId);
1616
+ const authClientConfig = await this.buildOauthClientConfiguration(validRequest.authority, validRequest.correlationId, undefined, undefined, request.azureCloudOptions);
1597
1617
  const authorizationCodeClient = new msalCommon.AuthorizationCodeClient(authClientConfig);
1598
1618
  this.logger.verbose("Auth code client created", validRequest.correlationId);
1599
1619
  return authorizationCodeClient.getAuthCodeUrl(validRequest);
@@ -1617,7 +1637,7 @@ class ClientApplication {
1617
1637
  const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenByCode, validRequest.correlationId);
1618
1638
 
1619
1639
  try {
1620
- const authClientConfig = await this.buildOauthClientConfiguration(validRequest.authority, validRequest.correlationId, serverTelemetryManager);
1640
+ const authClientConfig = await this.buildOauthClientConfiguration(validRequest.authority, validRequest.correlationId, serverTelemetryManager, undefined, request.azureCloudOptions);
1621
1641
  const authorizationCodeClient = new msalCommon.AuthorizationCodeClient(authClientConfig);
1622
1642
  this.logger.verbose("Auth code client created", validRequest.correlationId);
1623
1643
  return authorizationCodeClient.acquireToken(validRequest);
@@ -1648,7 +1668,7 @@ class ClientApplication {
1648
1668
  const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenByRefreshToken, validRequest.correlationId);
1649
1669
 
1650
1670
  try {
1651
- const refreshTokenClientConfig = await this.buildOauthClientConfiguration(validRequest.authority, validRequest.correlationId, serverTelemetryManager);
1671
+ const refreshTokenClientConfig = await this.buildOauthClientConfiguration(validRequest.authority, validRequest.correlationId, serverTelemetryManager, undefined, request.azureCloudOptions);
1652
1672
  const refreshTokenClient = new msalCommon.RefreshTokenClient(refreshTokenClientConfig);
1653
1673
  this.logger.verbose("Refresh token client created", validRequest.correlationId);
1654
1674
  return refreshTokenClient.acquireToken(validRequest);
@@ -1679,7 +1699,7 @@ class ClientApplication {
1679
1699
  const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenSilent, validRequest.correlationId, validRequest.forceRefresh);
1680
1700
 
1681
1701
  try {
1682
- const silentFlowClientConfig = await this.buildOauthClientConfiguration(validRequest.authority, validRequest.correlationId, serverTelemetryManager);
1702
+ const silentFlowClientConfig = await this.buildOauthClientConfiguration(validRequest.authority, validRequest.correlationId, serverTelemetryManager, undefined, request.azureCloudOptions);
1683
1703
  const silentFlowClient = new msalCommon.SilentFlowClient(silentFlowClientConfig);
1684
1704
  this.logger.verbose("Silent flow client created", validRequest.correlationId);
1685
1705
  return silentFlowClient.acquireToken(validRequest);
@@ -1712,7 +1732,7 @@ class ClientApplication {
1712
1732
  const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenByUsernamePassword, validRequest.correlationId);
1713
1733
 
1714
1734
  try {
1715
- const usernamePasswordClientConfig = await this.buildOauthClientConfiguration(validRequest.authority, validRequest.correlationId, serverTelemetryManager);
1735
+ const usernamePasswordClientConfig = await this.buildOauthClientConfiguration(validRequest.authority, validRequest.correlationId, serverTelemetryManager, undefined, request.azureCloudOptions);
1716
1736
  const usernamePasswordClient = new msalCommon.UsernamePasswordClient(usernamePasswordClientConfig);
1717
1737
  this.logger.verbose("Username password client created", validRequest.correlationId);
1718
1738
  return usernamePasswordClient.acquireToken(validRequest);
@@ -1758,11 +1778,13 @@ class ClientApplication {
1758
1778
  */
1759
1779
 
1760
1780
 
1761
- async buildOauthClientConfiguration(authority, requestCorrelationId, serverTelemetryManager, azureRegionConfiguration) {
1762
- this.logger.verbose("buildOauthClientConfiguration called", requestCorrelationId); // using null assertion operator as we ensure that all config values have default values in buildConfiguration()
1781
+ async buildOauthClientConfiguration(authority, requestCorrelationId, serverTelemetryManager, azureRegionConfiguration, azureCloudOptions) {
1782
+ this.logger.verbose("buildOauthClientConfiguration called", requestCorrelationId); // precedence - azureCloudInstance + tenant >> authority and request >> config
1783
+
1784
+ const userAzureCloudOptions = azureCloudOptions ? azureCloudOptions : this.config.auth.azureCloudOptions; // using null assertion operator as we ensure that all config values have default values in buildConfiguration()
1763
1785
 
1764
1786
  this.logger.verbose(`building oauth client configuration with the authority: ${authority}`, requestCorrelationId);
1765
- const discoveredAuthority = await this.createAuthority(authority, azureRegionConfiguration, requestCorrelationId);
1787
+ const discoveredAuthority = await this.createAuthority(authority, azureRegionConfiguration, requestCorrelationId, userAzureCloudOptions);
1766
1788
  serverTelemetryManager == null ? void 0 : serverTelemetryManager.updateRegionDiscoveryMetadata(discoveredAuthority.regionDiscoveryMetadata);
1767
1789
  return {
1768
1790
  authOptions: {
@@ -1770,6 +1792,9 @@ class ClientApplication {
1770
1792
  authority: discoveredAuthority,
1771
1793
  clientCapabilities: this.config.auth.clientCapabilities
1772
1794
  },
1795
+ systemOptions: {
1796
+ proxyUrl: this.config.system.proxyUrl
1797
+ },
1773
1798
  loggerOptions: {
1774
1799
  logLevel: this.config.system.loggerOptions.logLevel,
1775
1800
  loggerCallback: this.config.system.loggerOptions.loggerCallback,
@@ -1845,8 +1870,10 @@ class ClientApplication {
1845
1870
  */
1846
1871
 
1847
1872
 
1848
- async createAuthority(authorityString, azureRegionConfiguration, requestCorrelationId) {
1849
- this.logger.verbose("createAuthority called", requestCorrelationId);
1873
+ async createAuthority(authorityString, azureRegionConfiguration, requestCorrelationId, azureCloudOptions) {
1874
+ this.logger.verbose("createAuthority called", requestCorrelationId); // build authority string based on auth params - azureCloudInstance is prioritized if provided
1875
+
1876
+ const authorityUrl = msalCommon.Authority.generateAuthority(authorityString, azureCloudOptions);
1850
1877
  const authorityOptions = {
1851
1878
  protocolMode: this.config.auth.protocolMode,
1852
1879
  knownAuthorities: this.config.auth.knownAuthorities,
@@ -1854,7 +1881,7 @@ class ClientApplication {
1854
1881
  authorityMetadata: this.config.auth.authorityMetadata,
1855
1882
  azureRegionConfiguration
1856
1883
  };
1857
- return await msalCommon.AuthorityFactory.createDiscoveredInstance(authorityString, this.config.system.networkClient, this.storage, authorityOptions);
1884
+ return await msalCommon.AuthorityFactory.createDiscoveredInstance(authorityUrl, this.config.system.networkClient, this.storage, authorityOptions);
1858
1885
  }
1859
1886
 
1860
1887
  }
@@ -1907,7 +1934,7 @@ class PublicClientApplication extends ClientApplication {
1907
1934
  const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenByDeviceCode, validRequest.correlationId);
1908
1935
 
1909
1936
  try {
1910
- const deviceCodeConfig = await this.buildOauthClientConfiguration(validRequest.authority, validRequest.correlationId, serverTelemetryManager);
1937
+ const deviceCodeConfig = await this.buildOauthClientConfiguration(validRequest.authority, validRequest.correlationId, serverTelemetryManager, undefined, request.azureCloudOptions);
1911
1938
  const deviceCodeClient = new msalCommon.DeviceCodeClient(deviceCodeConfig);
1912
1939
  this.logger.verbose("Device code client created", validRequest.correlationId);
1913
1940
  return deviceCodeClient.acquireToken(validRequest);
@@ -2111,7 +2138,7 @@ class ConfidentialClientApplication extends ClientApplication {
2111
2138
  const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenByClientCredential, validRequest.correlationId, validRequest.skipCache);
2112
2139
 
2113
2140
  try {
2114
- const clientCredentialConfig = await this.buildOauthClientConfiguration(validRequest.authority, validRequest.correlationId, serverTelemetryManager, azureRegionConfiguration);
2141
+ const clientCredentialConfig = await this.buildOauthClientConfiguration(validRequest.authority, validRequest.correlationId, serverTelemetryManager, azureRegionConfiguration, request.azureCloudOptions);
2115
2142
  const clientCredentialClient = new msalCommon.ClientCredentialClient(clientCredentialConfig);
2116
2143
  this.logger.verbose("Client credential client created", validRequest.correlationId);
2117
2144
  return clientCredentialClient.acquireToken(validRequest);
@@ -2144,7 +2171,7 @@ class ConfidentialClientApplication extends ClientApplication {
2144
2171
  };
2145
2172
 
2146
2173
  try {
2147
- const clientCredentialConfig = await this.buildOauthClientConfiguration(validRequest.authority, validRequest.correlationId);
2174
+ const clientCredentialConfig = await this.buildOauthClientConfiguration(validRequest.authority, validRequest.correlationId, undefined, undefined, request.azureCloudOptions);
2148
2175
  const oboClient = new msalCommon.OnBehalfOfClient(clientCredentialConfig);
2149
2176
  this.logger.verbose("On behalf of client created", validRequest.correlationId);
2150
2177
  return oboClient.acquireToken(validRequest);
@@ -2191,6 +2218,37 @@ class ConfidentialClientApplication extends ClientApplication {
2191
2218
 
2192
2219
  }
2193
2220
 
2221
+ /*
2222
+ * Copyright (c) Microsoft Corporation. All rights reserved.
2223
+ * Licensed under the MIT License.
2224
+ */
2225
+ class DistributedCachePlugin {
2226
+ constructor(client, partitionManager) {
2227
+ this.client = client;
2228
+ this.partitionManager = partitionManager;
2229
+ }
2230
+
2231
+ async beforeCacheAccess(cacheContext) {
2232
+ const partitionKey = await this.partitionManager.getKey();
2233
+ const cacheData = await this.client.get(partitionKey);
2234
+ cacheContext.tokenCache.deserialize(cacheData);
2235
+ }
2236
+
2237
+ async afterCacheAccess(cacheContext) {
2238
+ if (cacheContext.cacheHasChanged) {
2239
+ const kvStore = cacheContext.tokenCache.getKVStore();
2240
+ const accountEntities = Object.values(kvStore).filter(value => msalCommon.AccountEntity.isAccountEntity(value));
2241
+
2242
+ if (accountEntities.length > 0) {
2243
+ const accountEntity = accountEntities[0];
2244
+ const partitionKey = await this.partitionManager.extractKey(accountEntity);
2245
+ await this.client.set(partitionKey, cacheContext.tokenCache.serialize());
2246
+ }
2247
+ }
2248
+ }
2249
+
2250
+ }
2251
+
2194
2252
  Object.defineProperty(exports, 'AuthError', {
2195
2253
  enumerable: true,
2196
2254
  get: function () {
@@ -2203,6 +2261,12 @@ Object.defineProperty(exports, 'AuthErrorMessage', {
2203
2261
  return msalCommon.AuthErrorMessage;
2204
2262
  }
2205
2263
  });
2264
+ Object.defineProperty(exports, 'AzureCloudInstance', {
2265
+ enumerable: true,
2266
+ get: function () {
2267
+ return msalCommon.AzureCloudInstance;
2268
+ }
2269
+ });
2206
2270
  Object.defineProperty(exports, 'ClientAuthError', {
2207
2271
  enumerable: true,
2208
2272
  get: function () {
@@ -2285,6 +2349,7 @@ exports.ClientApplication = ClientApplication;
2285
2349
  exports.ClientAssertion = ClientAssertion;
2286
2350
  exports.ConfidentialClientApplication = ConfidentialClientApplication;
2287
2351
  exports.CryptoProvider = CryptoProvider;
2352
+ exports.DistributedCachePlugin = DistributedCachePlugin;
2288
2353
  exports.NodeStorage = NodeStorage;
2289
2354
  exports.PublicClientApplication = PublicClientApplication;
2290
2355
  exports.TokenCache = TokenCache;