@azure/msal-node 1.15.0 → 1.17.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 -1
- package/dist/cache/NodeStorage.d.ts.map +1 -1
- package/dist/cache/distributed/IPartitionManager.d.ts +0 -4
- package/dist/cache/distributed/IPartitionManager.d.ts.map +1 -1
- package/dist/client/IPublicClientApplication.d.ts +6 -1
- package/dist/client/IPublicClientApplication.d.ts.map +1 -1
- package/dist/client/PublicClientApplication.d.ts +22 -2
- package/dist/client/PublicClientApplication.d.ts.map +1 -1
- package/dist/config/Configuration.d.ts +16 -2
- package/dist/config/Configuration.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/msal-node.cjs.development.js +139 -15
- package/dist/msal-node.cjs.development.js.map +1 -1
- package/dist/msal-node.cjs.production.min.js +1 -1
- package/dist/msal-node.cjs.production.min.js.map +1 -1
- package/dist/msal-node.esm.js +139 -15
- package/dist/msal-node.esm.js.map +1 -1
- package/dist/network/ILoopbackClient.d.ts +11 -0
- package/dist/network/ILoopbackClient.d.ts.map +1 -0
- package/dist/network/LoopbackClient.d.ts +2 -1
- package/dist/network/LoopbackClient.d.ts.map +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/request/InteractiveRequest.d.ts +15 -0
- package/dist/request/InteractiveRequest.d.ts.map +1 -1
- package/dist/request/SignOutRequest.d.ts +6 -0
- package/dist/request/SignOutRequest.d.ts.map +1 -0
- package/dist/utils/NetworkUtils.d.ts +2 -1
- package/dist/utils/NetworkUtils.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AccountEntity, IdTokenEntity, AccessTokenEntity, RefreshTokenEntity, AppMetadataEntity, ServerTelemetryEntity, ThrottlingEntity, CacheManager, Logger, ValidCacheType, ICrypto, AuthorityMetadataEntity, ValidCredentialType } from "@azure/msal-common";
|
|
1
|
+
import { TokenKeys, AccountEntity, IdTokenEntity, AccessTokenEntity, RefreshTokenEntity, AppMetadataEntity, ServerTelemetryEntity, ThrottlingEntity, CacheManager, Logger, ValidCacheType, ICrypto, AuthorityMetadataEntity, ValidCredentialType } from "@azure/msal-common";
|
|
2
2
|
import { InMemoryCache, JsonCache, CacheKVStore } from "./serializer/SerializerTypes";
|
|
3
3
|
/**
|
|
4
4
|
* This class implements Storage for node, reading cache from user specified storage location or an extension library
|
|
@@ -57,6 +57,8 @@ export declare class NodeStorage extends CacheManager {
|
|
|
57
57
|
* @param value - value of the cache entry
|
|
58
58
|
*/
|
|
59
59
|
setItem(key: string, value: ValidCacheType): void;
|
|
60
|
+
getAccountKeys(): string[];
|
|
61
|
+
getTokenKeys(): TokenKeys;
|
|
60
62
|
/**
|
|
61
63
|
* fetch the account entity
|
|
62
64
|
* @param accountKey - lookup key to fetch cache type AccountEntity
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeStorage.d.ts","sourceRoot":"","sources":["../src/cache/NodeStorage.ts"],"names":[],"mappings":"AAKA,OAAO,
|
|
1
|
+
{"version":3,"file":"NodeStorage.d.ts","sourceRoot":"","sources":["../src/cache/NodeStorage.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EACd,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,gBAAgB,EAChB,YAAY,EACZ,MAAM,EACN,cAAc,EACd,OAAO,EACP,uBAAuB,EACvB,mBAAmB,EACtB,MAAM,oBAAoB,CAAC;AAI5B,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAEtF;;;GAGG;AACH,qBAAa,WAAY,SAAQ,YAAY;IAEzC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,KAAK,CAAoB;IACjC,OAAO,CAAC,cAAc,CAAuB;gBAEjC,MAAM,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EAAE,mBAAmB,GAAG,MAAM;CAiB7F"}
|
|
@@ -9,8 +9,6 @@ export interface IPartitionManager {
|
|
|
9
9
|
* this function would return the homeAccountId for
|
|
10
10
|
* the user in question
|
|
11
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
12
|
* @returns Promise<string>
|
|
15
13
|
*/
|
|
16
14
|
getKey(): Promise<string>;
|
|
@@ -23,8 +21,6 @@ export interface IPartitionManager {
|
|
|
23
21
|
* this function would return the homeAccountId from
|
|
24
22
|
* the provided AccountEntity
|
|
25
23
|
*
|
|
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
24
|
* @param accountEntity: AccountEntity
|
|
29
25
|
* @returns Promise<string>
|
|
30
26
|
*/
|
|
@@ -1 +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
|
|
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;;;;;;;;;;OAUG;IACH,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,CAAA;IAEzB;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,aAAa,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;CAC5D"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AuthenticationResult, Logger } from "@azure/msal-common";
|
|
1
|
+
import { AccountInfo, AuthenticationResult, Logger } from "@azure/msal-common";
|
|
2
2
|
import { AuthorizationCodeRequest } from "../request/AuthorizationCodeRequest";
|
|
3
3
|
import { AuthorizationUrlRequest } from "../request/AuthorizationUrlRequest";
|
|
4
4
|
import { DeviceCodeRequest } from "../request/DeviceCodeRequest";
|
|
@@ -7,6 +7,7 @@ import { SilentFlowRequest } from "../request/SilentFlowRequest";
|
|
|
7
7
|
import { UsernamePasswordRequest } from "../request/UsernamePasswordRequest";
|
|
8
8
|
import { TokenCache } from "../cache/TokenCache";
|
|
9
9
|
import { InteractiveRequest } from "../request/InteractiveRequest";
|
|
10
|
+
import { SignOutRequest } from "../request/SignOutRequest";
|
|
10
11
|
/**
|
|
11
12
|
* Interface for the PublicClientApplication class defining the public API signatures
|
|
12
13
|
* @public
|
|
@@ -34,5 +35,9 @@ export interface IPublicClientApplication {
|
|
|
34
35
|
setLogger(logger: Logger): void;
|
|
35
36
|
/** Clear the cache */
|
|
36
37
|
clearCache(): void;
|
|
38
|
+
/** Gets all cached accounts */
|
|
39
|
+
getAllAccounts(): Promise<AccountInfo[]>;
|
|
40
|
+
/** Removes cache artifacts associated with the given account */
|
|
41
|
+
signOut(request: SignOutRequest): Promise<void>;
|
|
37
42
|
}
|
|
38
43
|
//# sourceMappingURL=IPublicClientApplication.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IPublicClientApplication.d.ts","sourceRoot":"","sources":["../src/client/IPublicClientApplication.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"IPublicClientApplication.d.ts","sourceRoot":"","sources":["../src/client/IPublicClientApplication.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC/E,OAAO,EAAE,wBAAwB,EAA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U,CAAC;IAE5B,kCAAkC;IAClC,SAAS,IAAI,MAAM,CAAC;IAEpB,gGAAgG;IAChG,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAEhC,sBAAsB;IACtB,UAAU,IAAI,IAAI,CAAC;IAEnB,+BAA+B;IAC/B,cAAc,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;IAEzC,gEAAgE;IAChE,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACnD"}
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import { AuthenticationResult } from "@azure/msal-common";
|
|
1
|
+
import { AuthenticationResult, AccountInfo } from "@azure/msal-common";
|
|
2
2
|
import { Configuration } from "../config/Configuration";
|
|
3
3
|
import { ClientApplication } from "./ClientApplication";
|
|
4
4
|
import { IPublicClientApplication } from "./IPublicClientApplication";
|
|
5
5
|
import { DeviceCodeRequest } from "../request/DeviceCodeRequest";
|
|
6
6
|
import { InteractiveRequest } from "../request/InteractiveRequest";
|
|
7
|
+
import { SilentFlowRequest } from "../request/SilentFlowRequest";
|
|
8
|
+
import { SignOutRequest } from "../request/SignOutRequest";
|
|
7
9
|
/**
|
|
8
10
|
* This class is to be used to acquire tokens for public client applications (desktop, mobile). Public client applications
|
|
9
11
|
* are not trusted to safely store application secrets, and therefore can only request tokens in the name of an user.
|
|
10
12
|
* @public
|
|
11
13
|
*/
|
|
12
14
|
export declare class PublicClientApplication extends ClientApplication implements IPublicClientApplication {
|
|
15
|
+
private nativeBrokerPlugin?;
|
|
13
16
|
/**
|
|
14
17
|
* Important attributes in the Configuration object for auth are:
|
|
15
18
|
* - clientID: the application ID of your application. You can obtain one by registering your application with our Application registration portal.
|
|
@@ -39,8 +42,25 @@ export declare class PublicClientApplication extends ClientApplication implement
|
|
|
39
42
|
*/
|
|
40
43
|
acquireTokenByDeviceCode(request: DeviceCodeRequest): Promise<AuthenticationResult | null>;
|
|
41
44
|
/**
|
|
42
|
-
* Acquires a token by requesting an
|
|
45
|
+
* Acquires a token interactively via the browser by requesting an authorization code then exchanging it for a token.
|
|
43
46
|
*/
|
|
44
47
|
acquireTokenInteractive(request: InteractiveRequest): Promise<AuthenticationResult>;
|
|
48
|
+
/**
|
|
49
|
+
* Returns a token retrieved either from the cache or by exchanging the refresh token for a fresh access token. If brokering is enabled the token request will be serviced by the broker.
|
|
50
|
+
* @param request
|
|
51
|
+
* @returns
|
|
52
|
+
*/
|
|
53
|
+
acquireTokenSilent(request: SilentFlowRequest): Promise<AuthenticationResult | null>;
|
|
54
|
+
/**
|
|
55
|
+
* Removes cache artifacts associated with the given account
|
|
56
|
+
* @param request
|
|
57
|
+
* @returns
|
|
58
|
+
*/
|
|
59
|
+
signOut(request: SignOutRequest): Promise<void>;
|
|
60
|
+
/**
|
|
61
|
+
* Returns all cached accounts for this application. If brokering is enabled this request will be serviced by the broker.
|
|
62
|
+
* @returns
|
|
63
|
+
*/
|
|
64
|
+
getAllAccounts(): Promise<AccountInfo[]>;
|
|
45
65
|
}
|
|
46
66
|
//# sourceMappingURL=PublicClientApplication.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PublicClientApplication.d.ts","sourceRoot":"","sources":["../src/client/PublicClientApplication.ts"],"names":[],"mappings":"AAMA,OAAO,EAEH,oBAAoB,
|
|
1
|
+
{"version":3,"file":"PublicClientApplication.d.ts","sourceRoot":"","sources":["../src/client/PublicClientApplication.ts"],"names":[],"mappings":"AAMA,OAAO,EAEH,oBAAoB,EAUpB,WAAW,EAEd,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;AAGjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAGnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAG3D;;;;GAIG;AACH,qBAAa,uBAAwB,SAAQ,iBAAkB,YAAW,wBAAwB;IAC9F,OAAO,CAAC,kBAAkB,CAAC,CAAsB;IACjD;;;;;;;;;;;;;;;;OAgBG;gBACS,aAAa,EAAE,aAAa;IAYxC;;;;;;;;OAQG;IACU,wBAAwB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAwBvG;;OAEG;IACG,uBAAuB,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IA6DzF;;;;OAIG;IACG,kBAAkB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAsB1F;;;;OAIG;IACG,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAarD;;;OAGG;IACG,cAAc,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;CAQjD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { LoggerOptions, INetworkModule, ProtocolMode, ICachePlugin, AzureCloudOptions, ApplicationTelemetry } from "@azure/msal-common";
|
|
2
|
+
import { LoggerOptions, INetworkModule, ProtocolMode, ICachePlugin, AzureCloudOptions, ApplicationTelemetry, INativeBrokerPlugin } from "@azure/msal-common";
|
|
3
3
|
import { AgentOptions as httpAgentOptions } from "http";
|
|
4
4
|
import { AgentOptions as httpsAgentOptions } from "https";
|
|
5
5
|
/**
|
|
@@ -40,6 +40,16 @@ export declare type NodeAuthOptions = {
|
|
|
40
40
|
export declare type CacheOptions = {
|
|
41
41
|
cachePlugin?: ICachePlugin;
|
|
42
42
|
};
|
|
43
|
+
/**
|
|
44
|
+
* Use this to configure the below broker options:
|
|
45
|
+
* - nativeBrokerPlugin - Native broker implementation (should be imported from msal-node-extensions)
|
|
46
|
+
*
|
|
47
|
+
* Note: These options are only available for PublicClientApplications using the Authorization Code Flow
|
|
48
|
+
* @public
|
|
49
|
+
*/
|
|
50
|
+
export declare type BrokerOptions = {
|
|
51
|
+
nativeBrokerPlugin?: INativeBrokerPlugin;
|
|
52
|
+
};
|
|
43
53
|
/**
|
|
44
54
|
* Type for configuring logger and http client options
|
|
45
55
|
*
|
|
@@ -60,18 +70,22 @@ export declare type NodeTelemetryOptions = {
|
|
|
60
70
|
* Use the configuration object to configure MSAL and initialize the client application object
|
|
61
71
|
*
|
|
62
72
|
* - auth: this is where you configure auth elements like clientID, authority used for authenticating against the Microsoft Identity Platform
|
|
73
|
+
* - broker: this is where you configure broker options
|
|
63
74
|
* - cache: this is where you configure cache location
|
|
64
75
|
* - system: this is where you can configure the network client, logger
|
|
76
|
+
* - telemetry: this is where you can configure telemetry options
|
|
65
77
|
* @public
|
|
66
78
|
*/
|
|
67
79
|
export declare type Configuration = {
|
|
68
80
|
auth: NodeAuthOptions;
|
|
81
|
+
broker?: BrokerOptions;
|
|
69
82
|
cache?: CacheOptions;
|
|
70
83
|
system?: NodeSystemOptions;
|
|
71
84
|
telemetry?: NodeTelemetryOptions;
|
|
72
85
|
};
|
|
73
86
|
export declare type NodeConfiguration = {
|
|
74
87
|
auth: Required<NodeAuthOptions>;
|
|
88
|
+
broker: BrokerOptions;
|
|
75
89
|
cache: CacheOptions;
|
|
76
90
|
system: Required<NodeSystemOptions>;
|
|
77
91
|
telemetry: Required<NodeTelemetryOptions>;
|
|
@@ -87,5 +101,5 @@ export declare type NodeConfiguration = {
|
|
|
87
101
|
* @returns Configuration
|
|
88
102
|
* @public
|
|
89
103
|
*/
|
|
90
|
-
export declare function buildAppConfiguration({ auth, cache, system, telemetry }: Configuration): NodeConfiguration;
|
|
104
|
+
export declare function buildAppConfiguration({ auth, broker, cache, system, telemetry }: Configuration): NodeConfiguration;
|
|
91
105
|
//# sourceMappingURL=Configuration.d.ts.map
|
|
@@ -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,EAGZ,iBAAiB,EACjB,oBAAoB,
|
|
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,EAGZ,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,EACtB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,MAAM,CAAC;AACxD,OAAO,EAAE,YAAY,IAAI,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE1D;;;;;;;;;;GAUG;AACH,oBAAY,eAAe,GAAG;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iBAAiB,CAAC,EAAE;QAChB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;QACnB,GAAG,CAAC,EAAE,MAAM,CAAA;KACf,CAAC;IACF,gBAAgB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACjC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kBAAkB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACnC,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,0BAA0B,CAAC,EAAE,OAAO,CAAC;CACxC,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
7
|
export { ITokenCache } from "./cache/ITokenCache";
|
|
8
8
|
export { ICacheClient } from "./cache/distributed/ICacheClient";
|
|
9
9
|
export { IPartitionManager } from "./cache/distributed/IPartitionManager";
|
|
10
|
+
export { ILoopbackClient } from "./network/ILoopbackClient";
|
|
10
11
|
export { PublicClientApplication } from "./client/PublicClientApplication";
|
|
11
12
|
export { ConfidentialClientApplication } from "./client/ConfidentialClientApplication";
|
|
12
13
|
export { ClientApplication } from "./client/ClientApplication";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;
|
|
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;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAG5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAE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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,EACzB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -118,6 +118,29 @@ class NetworkUtils {
|
|
|
118
118
|
status: statusCode
|
|
119
119
|
};
|
|
120
120
|
}
|
|
121
|
+
/*
|
|
122
|
+
* Utility function that converts a URL object into an ordinary options object as expected by the
|
|
123
|
+
* http.request and https.request APIs.
|
|
124
|
+
* https://github.com/nodejs/node/blob/main/lib/internal/url.js#L1090
|
|
125
|
+
*/
|
|
126
|
+
static urlToHttpOptions(url) {
|
|
127
|
+
const options = {
|
|
128
|
+
protocol: url.protocol,
|
|
129
|
+
hostname: url.hostname && url.hostname.startsWith("[") ? url.hostname.slice(1, -1) : url.hostname,
|
|
130
|
+
hash: url.hash,
|
|
131
|
+
search: url.search,
|
|
132
|
+
pathname: url.pathname,
|
|
133
|
+
path: `${url.pathname || ""}${url.search || ""}`,
|
|
134
|
+
href: url.href
|
|
135
|
+
};
|
|
136
|
+
if (url.port !== "") {
|
|
137
|
+
options.port = Number(url.port);
|
|
138
|
+
}
|
|
139
|
+
if (url.username || url.password) {
|
|
140
|
+
options.auth = `${decodeURIComponent(url.username)}:${decodeURIComponent(url.password)}`;
|
|
141
|
+
}
|
|
142
|
+
return options;
|
|
143
|
+
}
|
|
121
144
|
}
|
|
122
145
|
|
|
123
146
|
/*
|
|
@@ -157,11 +180,11 @@ class HttpClient {
|
|
|
157
180
|
}
|
|
158
181
|
}
|
|
159
182
|
}
|
|
160
|
-
const networkRequestViaProxy = (
|
|
161
|
-
const
|
|
183
|
+
const networkRequestViaProxy = (destinationUrlString, proxyUrlString, httpMethod, options, agentOptions, timeout) => {
|
|
184
|
+
const destinationUrl = new URL(destinationUrlString);
|
|
162
185
|
const proxyUrl = new URL(proxyUrlString);
|
|
163
|
-
const destinationUrl = new URL(url);
|
|
164
186
|
// "method: connect" must be used to establish a connection to the proxy
|
|
187
|
+
const headers = (options == null ? void 0 : options.headers) || {};
|
|
165
188
|
const tunnelRequestOptions = {
|
|
166
189
|
host: proxyUrl.hostname,
|
|
167
190
|
port: proxyUrl.port,
|
|
@@ -272,13 +295,15 @@ const networkRequestViaProxy = (url, proxyUrlString, httpMethod, options, agentO
|
|
|
272
295
|
});
|
|
273
296
|
});
|
|
274
297
|
};
|
|
275
|
-
const networkRequestViaHttps = (
|
|
298
|
+
const networkRequestViaHttps = (urlString, httpMethod, options, agentOptions, timeout) => {
|
|
276
299
|
const isPostRequest = httpMethod === HttpMethod.POST;
|
|
277
300
|
const body = (options == null ? void 0 : options.body) || "";
|
|
278
|
-
const
|
|
301
|
+
const url = new URL(urlString);
|
|
302
|
+
const headers = (options == null ? void 0 : options.headers) || {};
|
|
279
303
|
const customOptions = {
|
|
280
304
|
method: httpMethod,
|
|
281
|
-
headers:
|
|
305
|
+
headers: headers,
|
|
306
|
+
...NetworkUtils.urlToHttpOptions(url)
|
|
282
307
|
};
|
|
283
308
|
if (timeout) {
|
|
284
309
|
customOptions.timeout = timeout;
|
|
@@ -294,7 +319,7 @@ const networkRequestViaHttps = (url, httpMethod, options, agentOptions, timeout)
|
|
|
294
319
|
};
|
|
295
320
|
}
|
|
296
321
|
return new Promise((resolve, reject) => {
|
|
297
|
-
const request = https.request(
|
|
322
|
+
const request = https.request(customOptions);
|
|
298
323
|
if (timeout) {
|
|
299
324
|
request.on("timeout", () => {
|
|
300
325
|
request.destroy();
|
|
@@ -430,6 +455,7 @@ const DEFAULT_TELEMETRY_OPTIONS = {
|
|
|
430
455
|
*/
|
|
431
456
|
function buildAppConfiguration({
|
|
432
457
|
auth,
|
|
458
|
+
broker,
|
|
433
459
|
cache,
|
|
434
460
|
system,
|
|
435
461
|
telemetry
|
|
@@ -444,6 +470,9 @@ function buildAppConfiguration({
|
|
|
444
470
|
...DEFAULT_AUTH_OPTIONS,
|
|
445
471
|
...auth
|
|
446
472
|
},
|
|
473
|
+
broker: {
|
|
474
|
+
...broker
|
|
475
|
+
},
|
|
447
476
|
cache: {
|
|
448
477
|
...DEFAULT_CACHE_OPTIONS,
|
|
449
478
|
...cache
|
|
@@ -976,7 +1005,7 @@ class Serializer {
|
|
|
976
1005
|
*/
|
|
977
1006
|
class NodeStorage extends msalCommon.CacheManager {
|
|
978
1007
|
constructor(logger, clientId, cryptoImpl) {
|
|
979
|
-
super(clientId, cryptoImpl);
|
|
1008
|
+
super(clientId, cryptoImpl, logger);
|
|
980
1009
|
this.cache = {};
|
|
981
1010
|
this.changeEmitters = [];
|
|
982
1011
|
this.logger = logger;
|
|
@@ -1101,6 +1130,20 @@ class NodeStorage extends msalCommon.CacheManager {
|
|
|
1101
1130
|
// write to cache
|
|
1102
1131
|
this.setCache(cache);
|
|
1103
1132
|
}
|
|
1133
|
+
getAccountKeys() {
|
|
1134
|
+
const inMemoryCache = this.getInMemoryCache();
|
|
1135
|
+
const accountKeys = Object.keys(inMemoryCache.accounts);
|
|
1136
|
+
return accountKeys;
|
|
1137
|
+
}
|
|
1138
|
+
getTokenKeys() {
|
|
1139
|
+
const inMemoryCache = this.getInMemoryCache();
|
|
1140
|
+
const tokenKeys = {
|
|
1141
|
+
idToken: Object.keys(inMemoryCache.idTokens),
|
|
1142
|
+
accessToken: Object.keys(inMemoryCache.accessTokens),
|
|
1143
|
+
refreshToken: Object.keys(inMemoryCache.refreshTokens)
|
|
1144
|
+
};
|
|
1145
|
+
return tokenKeys;
|
|
1146
|
+
}
|
|
1104
1147
|
/**
|
|
1105
1148
|
* fetch the account entity
|
|
1106
1149
|
* @param accountKey - lookup key to fetch cache type AccountEntity
|
|
@@ -1593,7 +1636,7 @@ class TokenCache {
|
|
|
1593
1636
|
|
|
1594
1637
|
/* eslint-disable header/header */
|
|
1595
1638
|
const name = "@azure/msal-node";
|
|
1596
|
-
const version = "1.
|
|
1639
|
+
const version = "1.17.0";
|
|
1597
1640
|
|
|
1598
1641
|
/*
|
|
1599
1642
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2107,6 +2150,14 @@ class PublicClientApplication extends ClientApplication {
|
|
|
2107
2150
|
*/
|
|
2108
2151
|
constructor(configuration) {
|
|
2109
2152
|
super(configuration);
|
|
2153
|
+
if (this.config.broker.nativeBrokerPlugin) {
|
|
2154
|
+
if (this.config.broker.nativeBrokerPlugin.isBrokerAvailable) {
|
|
2155
|
+
this.nativeBrokerPlugin = this.config.broker.nativeBrokerPlugin;
|
|
2156
|
+
this.nativeBrokerPlugin.setLogger(this.config.system.loggerOptions);
|
|
2157
|
+
} else {
|
|
2158
|
+
this.logger.warning("NativeBroker implementation was provided but the broker is unavailable.");
|
|
2159
|
+
}
|
|
2160
|
+
}
|
|
2110
2161
|
}
|
|
2111
2162
|
/**
|
|
2112
2163
|
* Acquires a token from the authority using OAuth2.0 device code flow.
|
|
@@ -2135,24 +2186,46 @@ class PublicClientApplication extends ClientApplication {
|
|
|
2135
2186
|
}
|
|
2136
2187
|
}
|
|
2137
2188
|
/**
|
|
2138
|
-
* Acquires a token by requesting an
|
|
2189
|
+
* Acquires a token interactively via the browser by requesting an authorization code then exchanging it for a token.
|
|
2139
2190
|
*/
|
|
2140
2191
|
async acquireTokenInteractive(request) {
|
|
2141
|
-
const
|
|
2142
|
-
|
|
2143
|
-
challenge
|
|
2144
|
-
} = await this.cryptoProvider.generatePkceCodes();
|
|
2192
|
+
const correlationId = request.correlationId || this.cryptoProvider.createNewGuid();
|
|
2193
|
+
this.logger.trace("acquireTokenInteractive called", correlationId);
|
|
2145
2194
|
const {
|
|
2146
2195
|
openBrowser,
|
|
2147
2196
|
successTemplate,
|
|
2148
2197
|
errorTemplate,
|
|
2198
|
+
windowHandle,
|
|
2199
|
+
loopbackClient: customLoopbackClient,
|
|
2149
2200
|
...remainingProperties
|
|
2150
2201
|
} = request;
|
|
2151
|
-
|
|
2202
|
+
if (this.nativeBrokerPlugin) {
|
|
2203
|
+
var _remainingProperties$;
|
|
2204
|
+
const brokerRequest = {
|
|
2205
|
+
...remainingProperties,
|
|
2206
|
+
clientId: this.config.auth.clientId,
|
|
2207
|
+
scopes: request.scopes || msalCommon.OIDC_DEFAULT_SCOPES,
|
|
2208
|
+
redirectUri: `${Constants.HTTP_PROTOCOL}${Constants.LOCALHOST}`,
|
|
2209
|
+
authority: request.authority || this.config.auth.authority,
|
|
2210
|
+
correlationId: correlationId,
|
|
2211
|
+
extraParameters: {
|
|
2212
|
+
...remainingProperties.extraQueryParameters,
|
|
2213
|
+
...remainingProperties.tokenQueryParameters
|
|
2214
|
+
},
|
|
2215
|
+
accountId: (_remainingProperties$ = remainingProperties.account) == null ? void 0 : _remainingProperties$.nativeAccountId
|
|
2216
|
+
};
|
|
2217
|
+
return this.nativeBrokerPlugin.acquireTokenInteractive(brokerRequest, windowHandle);
|
|
2218
|
+
}
|
|
2219
|
+
const {
|
|
2220
|
+
verifier,
|
|
2221
|
+
challenge
|
|
2222
|
+
} = await this.cryptoProvider.generatePkceCodes();
|
|
2223
|
+
const loopbackClient = customLoopbackClient || new LoopbackClient();
|
|
2152
2224
|
const authCodeListener = loopbackClient.listenForAuthCode(successTemplate, errorTemplate);
|
|
2153
2225
|
const redirectUri = loopbackClient.getRedirectUri();
|
|
2154
2226
|
const validRequest = {
|
|
2155
2227
|
...remainingProperties,
|
|
2228
|
+
correlationId: correlationId,
|
|
2156
2229
|
scopes: request.scopes || msalCommon.OIDC_DEFAULT_SCOPES,
|
|
2157
2230
|
redirectUri: redirectUri,
|
|
2158
2231
|
responseMode: msalCommon.ResponseMode.QUERY,
|
|
@@ -2178,6 +2251,57 @@ class PublicClientApplication extends ClientApplication {
|
|
|
2178
2251
|
};
|
|
2179
2252
|
return this.acquireTokenByCode(tokenRequest);
|
|
2180
2253
|
}
|
|
2254
|
+
/**
|
|
2255
|
+
* Returns a token retrieved either from the cache or by exchanging the refresh token for a fresh access token. If brokering is enabled the token request will be serviced by the broker.
|
|
2256
|
+
* @param request
|
|
2257
|
+
* @returns
|
|
2258
|
+
*/
|
|
2259
|
+
async acquireTokenSilent(request) {
|
|
2260
|
+
const correlationId = request.correlationId || this.cryptoProvider.createNewGuid();
|
|
2261
|
+
this.logger.trace("acquireTokenSilent called", correlationId);
|
|
2262
|
+
if (this.nativeBrokerPlugin) {
|
|
2263
|
+
const brokerRequest = {
|
|
2264
|
+
...request,
|
|
2265
|
+
clientId: this.config.auth.clientId,
|
|
2266
|
+
scopes: request.scopes || msalCommon.OIDC_DEFAULT_SCOPES,
|
|
2267
|
+
redirectUri: `${Constants.HTTP_PROTOCOL}${Constants.LOCALHOST}`,
|
|
2268
|
+
authority: request.authority || this.config.auth.authority,
|
|
2269
|
+
correlationId: correlationId,
|
|
2270
|
+
extraParameters: request.tokenQueryParameters,
|
|
2271
|
+
accountId: request.account.nativeAccountId,
|
|
2272
|
+
forceRefresh: request.forceRefresh || false
|
|
2273
|
+
};
|
|
2274
|
+
return this.nativeBrokerPlugin.acquireTokenSilent(brokerRequest);
|
|
2275
|
+
}
|
|
2276
|
+
return super.acquireTokenSilent(request);
|
|
2277
|
+
}
|
|
2278
|
+
/**
|
|
2279
|
+
* Removes cache artifacts associated with the given account
|
|
2280
|
+
* @param request
|
|
2281
|
+
* @returns
|
|
2282
|
+
*/
|
|
2283
|
+
async signOut(request) {
|
|
2284
|
+
if (this.nativeBrokerPlugin && request.account.nativeAccountId) {
|
|
2285
|
+
const signoutRequest = {
|
|
2286
|
+
clientId: this.config.auth.clientId,
|
|
2287
|
+
accountId: request.account.nativeAccountId,
|
|
2288
|
+
correlationId: request.correlationId || this.cryptoProvider.createNewGuid()
|
|
2289
|
+
};
|
|
2290
|
+
await this.nativeBrokerPlugin.signOut(signoutRequest);
|
|
2291
|
+
}
|
|
2292
|
+
await this.getTokenCache().removeAccount(request.account);
|
|
2293
|
+
}
|
|
2294
|
+
/**
|
|
2295
|
+
* Returns all cached accounts for this application. If brokering is enabled this request will be serviced by the broker.
|
|
2296
|
+
* @returns
|
|
2297
|
+
*/
|
|
2298
|
+
async getAllAccounts() {
|
|
2299
|
+
if (this.nativeBrokerPlugin) {
|
|
2300
|
+
const correlationId = this.cryptoProvider.createNewGuid();
|
|
2301
|
+
return this.nativeBrokerPlugin.getAllAccounts(this.config.auth.clientId, correlationId);
|
|
2302
|
+
}
|
|
2303
|
+
return this.getTokenCache().getAllAccounts();
|
|
2304
|
+
}
|
|
2181
2305
|
}
|
|
2182
2306
|
|
|
2183
2307
|
/*
|