@azure/msal-node 2.2.0-alpha.0 → 2.3.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/ITokenCache.d.ts +15 -15
- package/dist/cache/NodeStorage.cjs +401 -401
- package/dist/cache/NodeStorage.cjs.map +1 -1
- package/dist/cache/NodeStorage.d.ts +182 -182
- package/dist/cache/NodeStorage.d.ts.map +1 -1
- package/dist/cache/NodeStorage.mjs +401 -401
- package/dist/cache/NodeStorage.mjs.map +1 -1
- package/dist/cache/TokenCache.cjs +265 -265
- package/dist/cache/TokenCache.d.ts +90 -90
- package/dist/cache/TokenCache.mjs +265 -265
- package/dist/cache/distributed/DistributedCachePlugin.cjs +26 -26
- package/dist/cache/distributed/DistributedCachePlugin.d.ts +10 -10
- package/dist/cache/distributed/DistributedCachePlugin.mjs +26 -26
- package/dist/cache/distributed/ICacheClient.d.ts +17 -17
- package/dist/cache/distributed/IPartitionManager.d.ts +28 -28
- package/dist/cache/serializer/Deserializer.cjs +173 -173
- package/dist/cache/serializer/Deserializer.d.ts +42 -42
- package/dist/cache/serializer/Deserializer.mjs +173 -173
- package/dist/cache/serializer/Serializer.cjs +134 -134
- package/dist/cache/serializer/Serializer.d.ts +39 -39
- package/dist/cache/serializer/Serializer.mjs +134 -134
- package/dist/cache/serializer/SerializerTypes.d.ts +101 -101
- package/dist/client/ClientApplication.cjs +333 -333
- package/dist/client/ClientApplication.cjs.map +1 -1
- package/dist/client/ClientApplication.d.ts +142 -142
- package/dist/client/ClientApplication.d.ts.map +1 -1
- package/dist/client/ClientApplication.mjs +334 -334
- package/dist/client/ClientApplication.mjs.map +1 -1
- package/dist/client/ClientAssertion.cjs +116 -116
- package/dist/client/ClientAssertion.d.ts +46 -46
- package/dist/client/ClientAssertion.mjs +116 -116
- package/dist/client/ClientCredentialClient.cjs +189 -189
- package/dist/client/ClientCredentialClient.d.ts +33 -33
- package/dist/client/ClientCredentialClient.mjs +189 -189
- package/dist/client/ConfidentialClientApplication.cjs +163 -163
- package/dist/client/ConfidentialClientApplication.d.ts +58 -58
- package/dist/client/ConfidentialClientApplication.mjs +163 -163
- package/dist/client/DeviceCodeClient.cjs +207 -207
- package/dist/client/DeviceCodeClient.d.ts +53 -53
- package/dist/client/DeviceCodeClient.mjs +207 -207
- package/dist/client/IConfidentialClientApplication.d.ts +39 -39
- package/dist/client/IPublicClientApplication.d.ts +42 -42
- package/dist/client/OnBehalfOfClient.cjs +202 -202
- package/dist/client/OnBehalfOfClient.d.ts +47 -47
- package/dist/client/OnBehalfOfClient.mjs +202 -202
- package/dist/client/PublicClientApplication.cjs +229 -229
- package/dist/client/PublicClientApplication.d.ts +71 -71
- package/dist/client/PublicClientApplication.mjs +229 -229
- package/dist/client/UsernamePasswordClient.cjs +95 -95
- package/dist/client/UsernamePasswordClient.d.ts +25 -25
- package/dist/client/UsernamePasswordClient.mjs +95 -95
- package/dist/config/Configuration.cjs +72 -72
- package/dist/config/Configuration.d.ts +107 -107
- package/dist/config/Configuration.mjs +72 -72
- package/dist/crypto/CryptoProvider.cjs +75 -75
- package/dist/crypto/CryptoProvider.d.ts +52 -52
- package/dist/crypto/CryptoProvider.mjs +75 -75
- package/dist/crypto/GuidGenerator.cjs +22 -22
- package/dist/crypto/GuidGenerator.d.ts +14 -14
- package/dist/crypto/GuidGenerator.mjs +22 -22
- package/dist/crypto/HashUtils.cjs +13 -13
- package/dist/crypto/HashUtils.d.ts +8 -8
- package/dist/crypto/HashUtils.mjs +13 -13
- package/dist/crypto/PkceGenerator.cjs +49 -49
- package/dist/crypto/PkceGenerator.d.ts +22 -22
- package/dist/crypto/PkceGenerator.mjs +49 -49
- package/dist/error/NodeAuthError.cjs +85 -85
- package/dist/error/NodeAuthError.d.ts +65 -65
- package/dist/error/NodeAuthError.mjs +85 -85
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +42 -42
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/internals.cjs +8 -8
- package/dist/internals.d.ts +6 -6
- package/dist/internals.mjs +8 -8
- package/dist/network/HttpClient.cjs +276 -276
- package/dist/network/HttpClient.d.ts +25 -25
- package/dist/network/HttpClient.mjs +276 -276
- package/dist/network/ILoopbackClient.d.ts +10 -10
- package/dist/network/LoopbackClient.cjs +76 -75
- package/dist/network/LoopbackClient.cjs.map +1 -1
- package/dist/network/LoopbackClient.d.ts +21 -21
- package/dist/network/LoopbackClient.d.ts.map +1 -1
- package/dist/network/LoopbackClient.mjs +76 -75
- package/dist/network/LoopbackClient.mjs.map +1 -1
- package/dist/packageMetadata.cjs +4 -4
- package/dist/packageMetadata.d.ts +2 -2
- package/dist/packageMetadata.mjs +4 -4
- package/dist/request/AuthorizationCodeRequest.d.ts +21 -21
- package/dist/request/AuthorizationUrlRequest.d.ts +33 -33
- package/dist/request/ClientCredentialRequest.d.ts +14 -14
- package/dist/request/DeviceCodeRequest.d.ts +15 -15
- package/dist/request/InteractiveRequest.d.ts +22 -22
- package/dist/request/OnBehalfOfRequest.d.ts +14 -14
- package/dist/request/RefreshTokenRequest.d.ts +17 -17
- package/dist/request/SignOutRequest.d.ts +5 -5
- package/dist/request/SilentFlowRequest.d.ts +16 -16
- package/dist/request/UsernamePasswordRequest.d.ts +19 -19
- package/dist/utils/Constants.cjs +80 -80
- package/dist/utils/Constants.d.ts +86 -86
- package/dist/utils/Constants.mjs +80 -80
- package/dist/utils/EncodingUtils.cjs +44 -44
- package/dist/utils/EncodingUtils.d.ts +26 -26
- package/dist/utils/EncodingUtils.mjs +44 -44
- package/dist/utils/NetworkUtils.cjs +38 -38
- package/dist/utils/NetworkUtils.d.ts +5 -5
- package/dist/utils/NetworkUtils.mjs +38 -38
- package/package.json +2 -2
- package/src/cache/NodeStorage.ts +8 -2
- package/src/client/ClientApplication.ts +3 -1
- package/src/index.ts +1 -0
- package/src/network/LoopbackClient.ts +1 -0
- package/src/packageMetadata.ts +1 -1
|
@@ -1,108 +1,108 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
import { LoggerOptions, INetworkModule, ProtocolMode, ICachePlugin, AzureCloudOptions, ApplicationTelemetry, INativeBrokerPlugin } from "@azure/msal-common";
|
|
4
|
-
import http from "http";
|
|
5
|
-
import https from "https";
|
|
6
|
-
/**
|
|
7
|
-
* - clientId - Client id of the application.
|
|
8
|
-
* - authority - Url of the authority. If no value is set, defaults to https://login.microsoftonline.com/common.
|
|
9
|
-
* - knownAuthorities - Needed for Azure B2C and ADFS. All authorities that will be used in the client application. Only the host of the authority should be passed in.
|
|
10
|
-
* - clientSecret - Secret string that the application uses when requesting a token. Only used in confidential client applications. Can be created in the Azure app registration portal.
|
|
11
|
-
* - clientAssertion - Assertion string that the application uses when requesting a token. Only used in confidential client applications. Assertion should be of type urn:ietf:params:oauth:client-assertion-type:jwt-bearer.
|
|
12
|
-
* - clientCertificate - Certificate that the application uses when requesting a token. Only used in confidential client applications. Requires hex encoded X.509 SHA-1 thumbprint of the certificiate, and the PEM encoded private key (string should contain -----BEGIN PRIVATE KEY----- ... -----END PRIVATE KEY----- )
|
|
13
|
-
* - protocolMode - Enum that represents the protocol that msal follows. Used for configuring proper endpoints.
|
|
14
|
-
* - skipAuthorityMetadataCache - A flag to choose whether to use or not use the local metadata cache during authority initialization. Defaults to false.
|
|
15
|
-
* @public
|
|
16
|
-
*/
|
|
17
|
-
export type NodeAuthOptions = {
|
|
18
|
-
clientId: string;
|
|
19
|
-
authority?: string;
|
|
20
|
-
clientSecret?: string;
|
|
21
|
-
clientAssertion?: string;
|
|
22
|
-
clientCertificate?: {
|
|
23
|
-
thumbprint: string;
|
|
24
|
-
privateKey: string;
|
|
25
|
-
x5c?: string;
|
|
26
|
-
};
|
|
27
|
-
knownAuthorities?: Array<string>;
|
|
28
|
-
cloudDiscoveryMetadata?: string;
|
|
29
|
-
authorityMetadata?: string;
|
|
30
|
-
clientCapabilities?: Array<string>;
|
|
31
|
-
protocolMode?: ProtocolMode;
|
|
32
|
-
azureCloudOptions?: AzureCloudOptions;
|
|
33
|
-
skipAuthorityMetadataCache?: boolean;
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
* Use this to configure the below cache configuration options:
|
|
37
|
-
*
|
|
38
|
-
* - cachePlugin - Plugin for reading and writing token cache to disk.
|
|
39
|
-
* @public
|
|
40
|
-
*/
|
|
41
|
-
export type CacheOptions = {
|
|
42
|
-
cachePlugin?: ICachePlugin;
|
|
43
|
-
claimsBasedCachingEnabled?: boolean;
|
|
44
|
-
};
|
|
45
|
-
/**
|
|
46
|
-
* Use this to configure the below broker options:
|
|
47
|
-
* - nativeBrokerPlugin - Native broker implementation (should be imported from msal-node-extensions)
|
|
48
|
-
*
|
|
49
|
-
* Note: These options are only available for PublicClientApplications using the Authorization Code Flow
|
|
50
|
-
* @public
|
|
51
|
-
*/
|
|
52
|
-
export type BrokerOptions = {
|
|
53
|
-
nativeBrokerPlugin?: INativeBrokerPlugin;
|
|
54
|
-
};
|
|
55
|
-
/**
|
|
56
|
-
* Type for configuring logger and http client options
|
|
57
|
-
*
|
|
58
|
-
* - logger - Used to initialize the Logger object; TODO: Expand on logger details or link to the documentation on logger
|
|
59
|
-
* - networkClient - Http client used for all http get and post calls. Defaults to using MSAL's default http client.
|
|
60
|
-
* @public
|
|
61
|
-
*/
|
|
62
|
-
export type NodeSystemOptions = {
|
|
63
|
-
loggerOptions?: LoggerOptions;
|
|
64
|
-
networkClient?: INetworkModule;
|
|
65
|
-
proxyUrl?: string;
|
|
66
|
-
customAgentOptions?: http.AgentOptions | https.AgentOptions;
|
|
67
|
-
};
|
|
68
|
-
export type NodeTelemetryOptions = {
|
|
69
|
-
application?: ApplicationTelemetry;
|
|
70
|
-
};
|
|
71
|
-
/**
|
|
72
|
-
* Use the configuration object to configure MSAL and initialize the client application object
|
|
73
|
-
*
|
|
74
|
-
* - auth: this is where you configure auth elements like clientID, authority used for authenticating against the Microsoft Identity Platform
|
|
75
|
-
* - broker: this is where you configure broker options
|
|
76
|
-
* - cache: this is where you configure cache location
|
|
77
|
-
* - system: this is where you can configure the network client, logger
|
|
78
|
-
* - telemetry: this is where you can configure telemetry options
|
|
79
|
-
* @public
|
|
80
|
-
*/
|
|
81
|
-
export type Configuration = {
|
|
82
|
-
auth: NodeAuthOptions;
|
|
83
|
-
broker?: BrokerOptions;
|
|
84
|
-
cache?: CacheOptions;
|
|
85
|
-
system?: NodeSystemOptions;
|
|
86
|
-
telemetry?: NodeTelemetryOptions;
|
|
87
|
-
};
|
|
88
|
-
/** @internal */
|
|
89
|
-
export type NodeConfiguration = {
|
|
90
|
-
auth: Required<NodeAuthOptions>;
|
|
91
|
-
broker: BrokerOptions;
|
|
92
|
-
cache: CacheOptions;
|
|
93
|
-
system: Required<NodeSystemOptions>;
|
|
94
|
-
telemetry: Required<NodeTelemetryOptions>;
|
|
95
|
-
};
|
|
96
|
-
/**
|
|
97
|
-
* Sets the default options when not explicitly configured from app developer
|
|
98
|
-
*
|
|
99
|
-
* @param auth - Authentication options
|
|
100
|
-
* @param cache - Cache options
|
|
101
|
-
* @param system - System options
|
|
102
|
-
* @param telemetry - Telemetry options
|
|
103
|
-
*
|
|
104
|
-
* @returns Configuration
|
|
105
|
-
* @internal
|
|
106
|
-
*/
|
|
107
|
-
export declare function buildAppConfiguration({ auth, broker, cache, system, telemetry, }: Configuration): NodeConfiguration;
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import { LoggerOptions, INetworkModule, ProtocolMode, ICachePlugin, AzureCloudOptions, ApplicationTelemetry, INativeBrokerPlugin } from "@azure/msal-common";
|
|
4
|
+
import http from "http";
|
|
5
|
+
import https from "https";
|
|
6
|
+
/**
|
|
7
|
+
* - clientId - Client id of the application.
|
|
8
|
+
* - authority - Url of the authority. If no value is set, defaults to https://login.microsoftonline.com/common.
|
|
9
|
+
* - knownAuthorities - Needed for Azure B2C and ADFS. All authorities that will be used in the client application. Only the host of the authority should be passed in.
|
|
10
|
+
* - clientSecret - Secret string that the application uses when requesting a token. Only used in confidential client applications. Can be created in the Azure app registration portal.
|
|
11
|
+
* - clientAssertion - Assertion string that the application uses when requesting a token. Only used in confidential client applications. Assertion should be of type urn:ietf:params:oauth:client-assertion-type:jwt-bearer.
|
|
12
|
+
* - clientCertificate - Certificate that the application uses when requesting a token. Only used in confidential client applications. Requires hex encoded X.509 SHA-1 thumbprint of the certificiate, and the PEM encoded private key (string should contain -----BEGIN PRIVATE KEY----- ... -----END PRIVATE KEY----- )
|
|
13
|
+
* - protocolMode - Enum that represents the protocol that msal follows. Used for configuring proper endpoints.
|
|
14
|
+
* - skipAuthorityMetadataCache - A flag to choose whether to use or not use the local metadata cache during authority initialization. Defaults to false.
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
export type NodeAuthOptions = {
|
|
18
|
+
clientId: string;
|
|
19
|
+
authority?: string;
|
|
20
|
+
clientSecret?: string;
|
|
21
|
+
clientAssertion?: string;
|
|
22
|
+
clientCertificate?: {
|
|
23
|
+
thumbprint: string;
|
|
24
|
+
privateKey: string;
|
|
25
|
+
x5c?: string;
|
|
26
|
+
};
|
|
27
|
+
knownAuthorities?: Array<string>;
|
|
28
|
+
cloudDiscoveryMetadata?: string;
|
|
29
|
+
authorityMetadata?: string;
|
|
30
|
+
clientCapabilities?: Array<string>;
|
|
31
|
+
protocolMode?: ProtocolMode;
|
|
32
|
+
azureCloudOptions?: AzureCloudOptions;
|
|
33
|
+
skipAuthorityMetadataCache?: boolean;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Use this to configure the below cache configuration options:
|
|
37
|
+
*
|
|
38
|
+
* - cachePlugin - Plugin for reading and writing token cache to disk.
|
|
39
|
+
* @public
|
|
40
|
+
*/
|
|
41
|
+
export type CacheOptions = {
|
|
42
|
+
cachePlugin?: ICachePlugin;
|
|
43
|
+
claimsBasedCachingEnabled?: boolean;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Use this to configure the below broker options:
|
|
47
|
+
* - nativeBrokerPlugin - Native broker implementation (should be imported from msal-node-extensions)
|
|
48
|
+
*
|
|
49
|
+
* Note: These options are only available for PublicClientApplications using the Authorization Code Flow
|
|
50
|
+
* @public
|
|
51
|
+
*/
|
|
52
|
+
export type BrokerOptions = {
|
|
53
|
+
nativeBrokerPlugin?: INativeBrokerPlugin;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Type for configuring logger and http client options
|
|
57
|
+
*
|
|
58
|
+
* - logger - Used to initialize the Logger object; TODO: Expand on logger details or link to the documentation on logger
|
|
59
|
+
* - networkClient - Http client used for all http get and post calls. Defaults to using MSAL's default http client.
|
|
60
|
+
* @public
|
|
61
|
+
*/
|
|
62
|
+
export type NodeSystemOptions = {
|
|
63
|
+
loggerOptions?: LoggerOptions;
|
|
64
|
+
networkClient?: INetworkModule;
|
|
65
|
+
proxyUrl?: string;
|
|
66
|
+
customAgentOptions?: http.AgentOptions | https.AgentOptions;
|
|
67
|
+
};
|
|
68
|
+
export type NodeTelemetryOptions = {
|
|
69
|
+
application?: ApplicationTelemetry;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Use the configuration object to configure MSAL and initialize the client application object
|
|
73
|
+
*
|
|
74
|
+
* - auth: this is where you configure auth elements like clientID, authority used for authenticating against the Microsoft Identity Platform
|
|
75
|
+
* - broker: this is where you configure broker options
|
|
76
|
+
* - cache: this is where you configure cache location
|
|
77
|
+
* - system: this is where you can configure the network client, logger
|
|
78
|
+
* - telemetry: this is where you can configure telemetry options
|
|
79
|
+
* @public
|
|
80
|
+
*/
|
|
81
|
+
export type Configuration = {
|
|
82
|
+
auth: NodeAuthOptions;
|
|
83
|
+
broker?: BrokerOptions;
|
|
84
|
+
cache?: CacheOptions;
|
|
85
|
+
system?: NodeSystemOptions;
|
|
86
|
+
telemetry?: NodeTelemetryOptions;
|
|
87
|
+
};
|
|
88
|
+
/** @internal */
|
|
89
|
+
export type NodeConfiguration = {
|
|
90
|
+
auth: Required<NodeAuthOptions>;
|
|
91
|
+
broker: BrokerOptions;
|
|
92
|
+
cache: CacheOptions;
|
|
93
|
+
system: Required<NodeSystemOptions>;
|
|
94
|
+
telemetry: Required<NodeTelemetryOptions>;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Sets the default options when not explicitly configured from app developer
|
|
98
|
+
*
|
|
99
|
+
* @param auth - Authentication options
|
|
100
|
+
* @param cache - Cache options
|
|
101
|
+
* @param system - System options
|
|
102
|
+
* @param telemetry - Telemetry options
|
|
103
|
+
*
|
|
104
|
+
* @returns Configuration
|
|
105
|
+
* @internal
|
|
106
|
+
*/
|
|
107
|
+
export declare function buildAppConfiguration({ auth, broker, cache, system, telemetry, }: Configuration): NodeConfiguration;
|
|
108
108
|
//# sourceMappingURL=Configuration.d.ts.map
|
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
/*! @azure/msal-node v2.
|
|
1
|
+
/*! @azure/msal-node v2.3.0 2023-10-20 */
|
|
2
2
|
'use strict';
|
|
3
3
|
import { Constants, ProtocolMode, AzureCloudInstance, LogLevel } from '@azure/msal-common';
|
|
4
4
|
import { HttpClient } from '../network/HttpClient.mjs';
|
|
5
5
|
|
|
6
|
-
/*
|
|
7
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
8
|
-
* Licensed under the MIT License.
|
|
9
|
-
*/
|
|
10
|
-
const DEFAULT_AUTH_OPTIONS = {
|
|
11
|
-
clientId: Constants.EMPTY_STRING,
|
|
12
|
-
authority: Constants.DEFAULT_AUTHORITY,
|
|
13
|
-
clientSecret: Constants.EMPTY_STRING,
|
|
14
|
-
clientAssertion: Constants.EMPTY_STRING,
|
|
15
|
-
clientCertificate: {
|
|
16
|
-
thumbprint: Constants.EMPTY_STRING,
|
|
17
|
-
privateKey: Constants.EMPTY_STRING,
|
|
18
|
-
x5c: Constants.EMPTY_STRING,
|
|
19
|
-
},
|
|
20
|
-
knownAuthorities: [],
|
|
21
|
-
cloudDiscoveryMetadata: Constants.EMPTY_STRING,
|
|
22
|
-
authorityMetadata: Constants.EMPTY_STRING,
|
|
23
|
-
clientCapabilities: [],
|
|
24
|
-
protocolMode: ProtocolMode.AAD,
|
|
25
|
-
azureCloudOptions: {
|
|
26
|
-
azureCloudInstance: AzureCloudInstance.None,
|
|
27
|
-
tenant: Constants.EMPTY_STRING,
|
|
28
|
-
},
|
|
29
|
-
skipAuthorityMetadataCache: false,
|
|
30
|
-
};
|
|
31
|
-
const DEFAULT_CACHE_OPTIONS = {
|
|
32
|
-
claimsBasedCachingEnabled: false,
|
|
33
|
-
};
|
|
34
|
-
const DEFAULT_LOGGER_OPTIONS = {
|
|
35
|
-
loggerCallback: () => {
|
|
36
|
-
// allow users to not set logger call back
|
|
37
|
-
},
|
|
38
|
-
piiLoggingEnabled: false,
|
|
39
|
-
logLevel: LogLevel.Info,
|
|
40
|
-
};
|
|
41
|
-
const DEFAULT_SYSTEM_OPTIONS = {
|
|
42
|
-
loggerOptions: DEFAULT_LOGGER_OPTIONS,
|
|
43
|
-
networkClient: new HttpClient(),
|
|
44
|
-
proxyUrl: Constants.EMPTY_STRING,
|
|
45
|
-
customAgentOptions: {},
|
|
46
|
-
};
|
|
47
|
-
const DEFAULT_TELEMETRY_OPTIONS = {
|
|
48
|
-
application: {
|
|
49
|
-
appName: Constants.EMPTY_STRING,
|
|
50
|
-
appVersion: Constants.EMPTY_STRING,
|
|
51
|
-
},
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* Sets the default options when not explicitly configured from app developer
|
|
55
|
-
*
|
|
56
|
-
* @param auth - Authentication options
|
|
57
|
-
* @param cache - Cache options
|
|
58
|
-
* @param system - System options
|
|
59
|
-
* @param telemetry - Telemetry options
|
|
60
|
-
*
|
|
61
|
-
* @returns Configuration
|
|
62
|
-
* @internal
|
|
63
|
-
*/
|
|
64
|
-
function buildAppConfiguration({ auth, broker, cache, system, telemetry, }) {
|
|
65
|
-
const systemOptions = {
|
|
66
|
-
...DEFAULT_SYSTEM_OPTIONS,
|
|
67
|
-
networkClient: new HttpClient(system?.proxyUrl, system?.customAgentOptions),
|
|
68
|
-
loggerOptions: system?.loggerOptions || DEFAULT_LOGGER_OPTIONS,
|
|
69
|
-
};
|
|
70
|
-
return {
|
|
71
|
-
auth: { ...DEFAULT_AUTH_OPTIONS, ...auth },
|
|
72
|
-
broker: { ...broker },
|
|
73
|
-
cache: { ...DEFAULT_CACHE_OPTIONS, ...cache },
|
|
74
|
-
system: { ...systemOptions, ...system },
|
|
75
|
-
telemetry: { ...DEFAULT_TELEMETRY_OPTIONS, ...telemetry },
|
|
76
|
-
};
|
|
6
|
+
/*
|
|
7
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
8
|
+
* Licensed under the MIT License.
|
|
9
|
+
*/
|
|
10
|
+
const DEFAULT_AUTH_OPTIONS = {
|
|
11
|
+
clientId: Constants.EMPTY_STRING,
|
|
12
|
+
authority: Constants.DEFAULT_AUTHORITY,
|
|
13
|
+
clientSecret: Constants.EMPTY_STRING,
|
|
14
|
+
clientAssertion: Constants.EMPTY_STRING,
|
|
15
|
+
clientCertificate: {
|
|
16
|
+
thumbprint: Constants.EMPTY_STRING,
|
|
17
|
+
privateKey: Constants.EMPTY_STRING,
|
|
18
|
+
x5c: Constants.EMPTY_STRING,
|
|
19
|
+
},
|
|
20
|
+
knownAuthorities: [],
|
|
21
|
+
cloudDiscoveryMetadata: Constants.EMPTY_STRING,
|
|
22
|
+
authorityMetadata: Constants.EMPTY_STRING,
|
|
23
|
+
clientCapabilities: [],
|
|
24
|
+
protocolMode: ProtocolMode.AAD,
|
|
25
|
+
azureCloudOptions: {
|
|
26
|
+
azureCloudInstance: AzureCloudInstance.None,
|
|
27
|
+
tenant: Constants.EMPTY_STRING,
|
|
28
|
+
},
|
|
29
|
+
skipAuthorityMetadataCache: false,
|
|
30
|
+
};
|
|
31
|
+
const DEFAULT_CACHE_OPTIONS = {
|
|
32
|
+
claimsBasedCachingEnabled: false,
|
|
33
|
+
};
|
|
34
|
+
const DEFAULT_LOGGER_OPTIONS = {
|
|
35
|
+
loggerCallback: () => {
|
|
36
|
+
// allow users to not set logger call back
|
|
37
|
+
},
|
|
38
|
+
piiLoggingEnabled: false,
|
|
39
|
+
logLevel: LogLevel.Info,
|
|
40
|
+
};
|
|
41
|
+
const DEFAULT_SYSTEM_OPTIONS = {
|
|
42
|
+
loggerOptions: DEFAULT_LOGGER_OPTIONS,
|
|
43
|
+
networkClient: new HttpClient(),
|
|
44
|
+
proxyUrl: Constants.EMPTY_STRING,
|
|
45
|
+
customAgentOptions: {},
|
|
46
|
+
};
|
|
47
|
+
const DEFAULT_TELEMETRY_OPTIONS = {
|
|
48
|
+
application: {
|
|
49
|
+
appName: Constants.EMPTY_STRING,
|
|
50
|
+
appVersion: Constants.EMPTY_STRING,
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Sets the default options when not explicitly configured from app developer
|
|
55
|
+
*
|
|
56
|
+
* @param auth - Authentication options
|
|
57
|
+
* @param cache - Cache options
|
|
58
|
+
* @param system - System options
|
|
59
|
+
* @param telemetry - Telemetry options
|
|
60
|
+
*
|
|
61
|
+
* @returns Configuration
|
|
62
|
+
* @internal
|
|
63
|
+
*/
|
|
64
|
+
function buildAppConfiguration({ auth, broker, cache, system, telemetry, }) {
|
|
65
|
+
const systemOptions = {
|
|
66
|
+
...DEFAULT_SYSTEM_OPTIONS,
|
|
67
|
+
networkClient: new HttpClient(system?.proxyUrl, system?.customAgentOptions),
|
|
68
|
+
loggerOptions: system?.loggerOptions || DEFAULT_LOGGER_OPTIONS,
|
|
69
|
+
};
|
|
70
|
+
return {
|
|
71
|
+
auth: { ...DEFAULT_AUTH_OPTIONS, ...auth },
|
|
72
|
+
broker: { ...broker },
|
|
73
|
+
cache: { ...DEFAULT_CACHE_OPTIONS, ...cache },
|
|
74
|
+
system: { ...systemOptions, ...system },
|
|
75
|
+
telemetry: { ...DEFAULT_TELEMETRY_OPTIONS, ...telemetry },
|
|
76
|
+
};
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
export { buildAppConfiguration };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @azure/msal-node v2.
|
|
1
|
+
/*! @azure/msal-node v2.3.0 2023-10-20 */
|
|
2
2
|
'use strict';
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -7,80 +7,80 @@ var EncodingUtils = require('../utils/EncodingUtils.cjs');
|
|
|
7
7
|
var PkceGenerator = require('./PkceGenerator.cjs');
|
|
8
8
|
var HashUtils = require('./HashUtils.cjs');
|
|
9
9
|
|
|
10
|
-
/*
|
|
11
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12
|
-
* Licensed under the MIT License.
|
|
13
|
-
*/
|
|
14
|
-
/**
|
|
15
|
-
* This class implements MSAL node's crypto interface, which allows it to perform base64 encoding and decoding, generating cryptographically random GUIDs and
|
|
16
|
-
* implementing Proof Key for Code Exchange specs for the OAuth Authorization Code Flow using PKCE (rfc here: https://tools.ietf.org/html/rfc7636).
|
|
17
|
-
* @public
|
|
18
|
-
*/
|
|
19
|
-
class CryptoProvider {
|
|
20
|
-
constructor() {
|
|
21
|
-
// Browser crypto needs to be validated first before any other classes can be set.
|
|
22
|
-
this.pkceGenerator = new PkceGenerator.PkceGenerator();
|
|
23
|
-
this.guidGenerator = new GuidGenerator.GuidGenerator();
|
|
24
|
-
this.hashUtils = new HashUtils.HashUtils();
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Creates a new random GUID - used to populate state and nonce.
|
|
28
|
-
* @returns string (GUID)
|
|
29
|
-
*/
|
|
30
|
-
createNewGuid() {
|
|
31
|
-
return this.guidGenerator.generateGuid();
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Encodes input string to base64.
|
|
35
|
-
* @param input - string to be encoded
|
|
36
|
-
*/
|
|
37
|
-
base64Encode(input) {
|
|
38
|
-
return EncodingUtils.EncodingUtils.base64Encode(input);
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Decodes input string from base64.
|
|
42
|
-
* @param input - string to be decoded
|
|
43
|
-
*/
|
|
44
|
-
base64Decode(input) {
|
|
45
|
-
return EncodingUtils.EncodingUtils.base64Decode(input);
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Generates PKCE codes used in Authorization Code Flow.
|
|
49
|
-
*/
|
|
50
|
-
generatePkceCodes() {
|
|
51
|
-
return this.pkceGenerator.generatePkceCodes();
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Generates a keypair, stores it and returns a thumbprint - not yet implemented for node
|
|
55
|
-
*/
|
|
56
|
-
getPublicKeyThumbprint() {
|
|
57
|
-
throw new Error("Method not implemented.");
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Removes cryptographic keypair from key store matching the keyId passed in
|
|
61
|
-
* @param kid
|
|
62
|
-
*/
|
|
63
|
-
removeTokenBindingKey() {
|
|
64
|
-
throw new Error("Method not implemented.");
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Removes all cryptographic keys from Keystore
|
|
68
|
-
*/
|
|
69
|
-
clearKeystore() {
|
|
70
|
-
throw new Error("Method not implemented.");
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Signs the given object as a jwt payload with private key retrieved by given kid - currently not implemented for node
|
|
74
|
-
*/
|
|
75
|
-
signJwt() {
|
|
76
|
-
throw new Error("Method not implemented.");
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Returns the SHA-256 hash of an input string
|
|
80
|
-
*/
|
|
81
|
-
async hashString(plainText) {
|
|
82
|
-
return EncodingUtils.EncodingUtils.base64EncodeUrl(this.hashUtils.sha256(plainText).toString("base64"), "base64");
|
|
83
|
-
}
|
|
10
|
+
/*
|
|
11
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12
|
+
* Licensed under the MIT License.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* This class implements MSAL node's crypto interface, which allows it to perform base64 encoding and decoding, generating cryptographically random GUIDs and
|
|
16
|
+
* implementing Proof Key for Code Exchange specs for the OAuth Authorization Code Flow using PKCE (rfc here: https://tools.ietf.org/html/rfc7636).
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
class CryptoProvider {
|
|
20
|
+
constructor() {
|
|
21
|
+
// Browser crypto needs to be validated first before any other classes can be set.
|
|
22
|
+
this.pkceGenerator = new PkceGenerator.PkceGenerator();
|
|
23
|
+
this.guidGenerator = new GuidGenerator.GuidGenerator();
|
|
24
|
+
this.hashUtils = new HashUtils.HashUtils();
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Creates a new random GUID - used to populate state and nonce.
|
|
28
|
+
* @returns string (GUID)
|
|
29
|
+
*/
|
|
30
|
+
createNewGuid() {
|
|
31
|
+
return this.guidGenerator.generateGuid();
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Encodes input string to base64.
|
|
35
|
+
* @param input - string to be encoded
|
|
36
|
+
*/
|
|
37
|
+
base64Encode(input) {
|
|
38
|
+
return EncodingUtils.EncodingUtils.base64Encode(input);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Decodes input string from base64.
|
|
42
|
+
* @param input - string to be decoded
|
|
43
|
+
*/
|
|
44
|
+
base64Decode(input) {
|
|
45
|
+
return EncodingUtils.EncodingUtils.base64Decode(input);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Generates PKCE codes used in Authorization Code Flow.
|
|
49
|
+
*/
|
|
50
|
+
generatePkceCodes() {
|
|
51
|
+
return this.pkceGenerator.generatePkceCodes();
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Generates a keypair, stores it and returns a thumbprint - not yet implemented for node
|
|
55
|
+
*/
|
|
56
|
+
getPublicKeyThumbprint() {
|
|
57
|
+
throw new Error("Method not implemented.");
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Removes cryptographic keypair from key store matching the keyId passed in
|
|
61
|
+
* @param kid
|
|
62
|
+
*/
|
|
63
|
+
removeTokenBindingKey() {
|
|
64
|
+
throw new Error("Method not implemented.");
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Removes all cryptographic keys from Keystore
|
|
68
|
+
*/
|
|
69
|
+
clearKeystore() {
|
|
70
|
+
throw new Error("Method not implemented.");
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Signs the given object as a jwt payload with private key retrieved by given kid - currently not implemented for node
|
|
74
|
+
*/
|
|
75
|
+
signJwt() {
|
|
76
|
+
throw new Error("Method not implemented.");
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Returns the SHA-256 hash of an input string
|
|
80
|
+
*/
|
|
81
|
+
async hashString(plainText) {
|
|
82
|
+
return EncodingUtils.EncodingUtils.base64EncodeUrl(this.hashUtils.sha256(plainText).toString("base64"), "base64");
|
|
83
|
+
}
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
exports.CryptoProvider = CryptoProvider;
|
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
import { ICrypto, PkceCodes } from "@azure/msal-common";
|
|
2
|
-
/**
|
|
3
|
-
* This class implements MSAL node's crypto interface, which allows it to perform base64 encoding and decoding, generating cryptographically random GUIDs and
|
|
4
|
-
* implementing Proof Key for Code Exchange specs for the OAuth Authorization Code Flow using PKCE (rfc here: https://tools.ietf.org/html/rfc7636).
|
|
5
|
-
* @public
|
|
6
|
-
*/
|
|
7
|
-
export declare class CryptoProvider implements ICrypto {
|
|
8
|
-
private pkceGenerator;
|
|
9
|
-
private guidGenerator;
|
|
10
|
-
private hashUtils;
|
|
11
|
-
constructor();
|
|
12
|
-
/**
|
|
13
|
-
* Creates a new random GUID - used to populate state and nonce.
|
|
14
|
-
* @returns string (GUID)
|
|
15
|
-
*/
|
|
16
|
-
createNewGuid(): string;
|
|
17
|
-
/**
|
|
18
|
-
* Encodes input string to base64.
|
|
19
|
-
* @param input - string to be encoded
|
|
20
|
-
*/
|
|
21
|
-
base64Encode(input: string): string;
|
|
22
|
-
/**
|
|
23
|
-
* Decodes input string from base64.
|
|
24
|
-
* @param input - string to be decoded
|
|
25
|
-
*/
|
|
26
|
-
base64Decode(input: string): string;
|
|
27
|
-
/**
|
|
28
|
-
* Generates PKCE codes used in Authorization Code Flow.
|
|
29
|
-
*/
|
|
30
|
-
generatePkceCodes(): Promise<PkceCodes>;
|
|
31
|
-
/**
|
|
32
|
-
* Generates a keypair, stores it and returns a thumbprint - not yet implemented for node
|
|
33
|
-
*/
|
|
34
|
-
getPublicKeyThumbprint(): Promise<string>;
|
|
35
|
-
/**
|
|
36
|
-
* Removes cryptographic keypair from key store matching the keyId passed in
|
|
37
|
-
* @param kid
|
|
38
|
-
*/
|
|
39
|
-
removeTokenBindingKey(): Promise<boolean>;
|
|
40
|
-
/**
|
|
41
|
-
* Removes all cryptographic keys from Keystore
|
|
42
|
-
*/
|
|
43
|
-
clearKeystore(): Promise<boolean>;
|
|
44
|
-
/**
|
|
45
|
-
* Signs the given object as a jwt payload with private key retrieved by given kid - currently not implemented for node
|
|
46
|
-
*/
|
|
47
|
-
signJwt(): Promise<string>;
|
|
48
|
-
/**
|
|
49
|
-
* Returns the SHA-256 hash of an input string
|
|
50
|
-
*/
|
|
51
|
-
hashString(plainText: string): Promise<string>;
|
|
52
|
-
}
|
|
1
|
+
import { ICrypto, PkceCodes } from "@azure/msal-common";
|
|
2
|
+
/**
|
|
3
|
+
* This class implements MSAL node's crypto interface, which allows it to perform base64 encoding and decoding, generating cryptographically random GUIDs and
|
|
4
|
+
* implementing Proof Key for Code Exchange specs for the OAuth Authorization Code Flow using PKCE (rfc here: https://tools.ietf.org/html/rfc7636).
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export declare class CryptoProvider implements ICrypto {
|
|
8
|
+
private pkceGenerator;
|
|
9
|
+
private guidGenerator;
|
|
10
|
+
private hashUtils;
|
|
11
|
+
constructor();
|
|
12
|
+
/**
|
|
13
|
+
* Creates a new random GUID - used to populate state and nonce.
|
|
14
|
+
* @returns string (GUID)
|
|
15
|
+
*/
|
|
16
|
+
createNewGuid(): string;
|
|
17
|
+
/**
|
|
18
|
+
* Encodes input string to base64.
|
|
19
|
+
* @param input - string to be encoded
|
|
20
|
+
*/
|
|
21
|
+
base64Encode(input: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Decodes input string from base64.
|
|
24
|
+
* @param input - string to be decoded
|
|
25
|
+
*/
|
|
26
|
+
base64Decode(input: string): string;
|
|
27
|
+
/**
|
|
28
|
+
* Generates PKCE codes used in Authorization Code Flow.
|
|
29
|
+
*/
|
|
30
|
+
generatePkceCodes(): Promise<PkceCodes>;
|
|
31
|
+
/**
|
|
32
|
+
* Generates a keypair, stores it and returns a thumbprint - not yet implemented for node
|
|
33
|
+
*/
|
|
34
|
+
getPublicKeyThumbprint(): Promise<string>;
|
|
35
|
+
/**
|
|
36
|
+
* Removes cryptographic keypair from key store matching the keyId passed in
|
|
37
|
+
* @param kid
|
|
38
|
+
*/
|
|
39
|
+
removeTokenBindingKey(): Promise<boolean>;
|
|
40
|
+
/**
|
|
41
|
+
* Removes all cryptographic keys from Keystore
|
|
42
|
+
*/
|
|
43
|
+
clearKeystore(): Promise<boolean>;
|
|
44
|
+
/**
|
|
45
|
+
* Signs the given object as a jwt payload with private key retrieved by given kid - currently not implemented for node
|
|
46
|
+
*/
|
|
47
|
+
signJwt(): Promise<string>;
|
|
48
|
+
/**
|
|
49
|
+
* Returns the SHA-256 hash of an input string
|
|
50
|
+
*/
|
|
51
|
+
hashString(plainText: string): Promise<string>;
|
|
52
|
+
}
|
|
53
53
|
//# sourceMappingURL=CryptoProvider.d.ts.map
|