@azure/msal-node 2.1.0 → 2.2.0-alpha.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.
Files changed (134) hide show
  1. package/dist/cache/ITokenCache.d.ts +15 -15
  2. package/dist/cache/NodeStorage.cjs +401 -401
  3. package/dist/cache/NodeStorage.d.ts +182 -182
  4. package/dist/cache/NodeStorage.mjs +401 -401
  5. package/dist/cache/TokenCache.cjs +265 -265
  6. package/dist/cache/TokenCache.d.ts +90 -90
  7. package/dist/cache/TokenCache.mjs +265 -265
  8. package/dist/cache/distributed/DistributedCachePlugin.cjs +26 -26
  9. package/dist/cache/distributed/DistributedCachePlugin.d.ts +10 -10
  10. package/dist/cache/distributed/DistributedCachePlugin.mjs +26 -26
  11. package/dist/cache/distributed/ICacheClient.d.ts +17 -17
  12. package/dist/cache/distributed/IPartitionManager.d.ts +28 -28
  13. package/dist/cache/serializer/Deserializer.cjs +173 -173
  14. package/dist/cache/serializer/Deserializer.d.ts +42 -42
  15. package/dist/cache/serializer/Deserializer.mjs +173 -173
  16. package/dist/cache/serializer/Serializer.cjs +134 -134
  17. package/dist/cache/serializer/Serializer.d.ts +39 -39
  18. package/dist/cache/serializer/Serializer.mjs +134 -134
  19. package/dist/cache/serializer/SerializerTypes.d.ts +101 -101
  20. package/dist/client/ClientApplication.cjs +333 -333
  21. package/dist/client/ClientApplication.cjs.map +1 -1
  22. package/dist/client/ClientApplication.d.ts +142 -142
  23. package/dist/client/ClientApplication.d.ts.map +1 -1
  24. package/dist/client/ClientApplication.mjs +334 -334
  25. package/dist/client/ClientApplication.mjs.map +1 -1
  26. package/dist/client/ClientAssertion.cjs +116 -116
  27. package/dist/client/ClientAssertion.cjs.map +1 -1
  28. package/dist/client/ClientAssertion.d.ts +46 -46
  29. package/dist/client/ClientAssertion.d.ts.map +1 -1
  30. package/dist/client/ClientAssertion.mjs +117 -117
  31. package/dist/client/ClientAssertion.mjs.map +1 -1
  32. package/dist/client/ClientCredentialClient.cjs +189 -190
  33. package/dist/client/ClientCredentialClient.cjs.map +1 -1
  34. package/dist/client/ClientCredentialClient.d.ts +33 -34
  35. package/dist/client/ClientCredentialClient.d.ts.map +1 -1
  36. package/dist/client/ClientCredentialClient.mjs +190 -191
  37. package/dist/client/ClientCredentialClient.mjs.map +1 -1
  38. package/dist/client/ConfidentialClientApplication.cjs +163 -163
  39. package/dist/client/ConfidentialClientApplication.cjs.map +1 -1
  40. package/dist/client/ConfidentialClientApplication.d.ts +58 -58
  41. package/dist/client/ConfidentialClientApplication.d.ts.map +1 -1
  42. package/dist/client/ConfidentialClientApplication.mjs +164 -164
  43. package/dist/client/ConfidentialClientApplication.mjs.map +1 -1
  44. package/dist/client/DeviceCodeClient.cjs +207 -207
  45. package/dist/client/DeviceCodeClient.cjs.map +1 -1
  46. package/dist/client/DeviceCodeClient.d.ts +53 -53
  47. package/dist/client/DeviceCodeClient.d.ts.map +1 -1
  48. package/dist/client/DeviceCodeClient.mjs +208 -208
  49. package/dist/client/DeviceCodeClient.mjs.map +1 -1
  50. package/dist/client/IConfidentialClientApplication.d.ts +39 -39
  51. package/dist/client/IPublicClientApplication.d.ts +42 -42
  52. package/dist/client/OnBehalfOfClient.cjs +202 -202
  53. package/dist/client/OnBehalfOfClient.cjs.map +1 -1
  54. package/dist/client/OnBehalfOfClient.d.ts +47 -47
  55. package/dist/client/OnBehalfOfClient.d.ts.map +1 -1
  56. package/dist/client/OnBehalfOfClient.mjs +203 -203
  57. package/dist/client/OnBehalfOfClient.mjs.map +1 -1
  58. package/dist/client/PublicClientApplication.cjs +229 -182
  59. package/dist/client/PublicClientApplication.cjs.map +1 -1
  60. package/dist/client/PublicClientApplication.d.ts +71 -65
  61. package/dist/client/PublicClientApplication.d.ts.map +1 -1
  62. package/dist/client/PublicClientApplication.mjs +231 -184
  63. package/dist/client/PublicClientApplication.mjs.map +1 -1
  64. package/dist/client/UsernamePasswordClient.cjs +95 -95
  65. package/dist/client/UsernamePasswordClient.d.ts +25 -25
  66. package/dist/client/UsernamePasswordClient.mjs +95 -95
  67. package/dist/config/Configuration.cjs +72 -72
  68. package/dist/config/Configuration.d.ts +107 -107
  69. package/dist/config/Configuration.mjs +72 -72
  70. package/dist/crypto/CryptoProvider.cjs +75 -75
  71. package/dist/crypto/CryptoProvider.d.ts +52 -52
  72. package/dist/crypto/CryptoProvider.mjs +75 -75
  73. package/dist/crypto/GuidGenerator.cjs +22 -22
  74. package/dist/crypto/GuidGenerator.d.ts +14 -14
  75. package/dist/crypto/GuidGenerator.mjs +22 -22
  76. package/dist/crypto/HashUtils.cjs +13 -13
  77. package/dist/crypto/HashUtils.d.ts +8 -8
  78. package/dist/crypto/HashUtils.mjs +13 -13
  79. package/dist/crypto/PkceGenerator.cjs +49 -49
  80. package/dist/crypto/PkceGenerator.d.ts +22 -22
  81. package/dist/crypto/PkceGenerator.mjs +49 -49
  82. package/dist/error/NodeAuthError.cjs +85 -85
  83. package/dist/error/NodeAuthError.d.ts +65 -65
  84. package/dist/error/NodeAuthError.mjs +85 -85
  85. package/dist/index.cjs +17 -1
  86. package/dist/index.cjs.map +1 -1
  87. package/dist/index.d.ts +42 -42
  88. package/dist/index.d.ts.map +1 -1
  89. package/dist/index.mjs +2 -2
  90. package/dist/internals.cjs +8 -8
  91. package/dist/internals.d.ts +6 -6
  92. package/dist/internals.mjs +8 -8
  93. package/dist/network/HttpClient.cjs +276 -276
  94. package/dist/network/HttpClient.d.ts +25 -25
  95. package/dist/network/HttpClient.mjs +276 -276
  96. package/dist/network/ILoopbackClient.d.ts +10 -10
  97. package/dist/network/LoopbackClient.cjs +75 -84
  98. package/dist/network/LoopbackClient.cjs.map +1 -1
  99. package/dist/network/LoopbackClient.d.ts +21 -21
  100. package/dist/network/LoopbackClient.d.ts.map +1 -1
  101. package/dist/network/LoopbackClient.mjs +76 -85
  102. package/dist/network/LoopbackClient.mjs.map +1 -1
  103. package/dist/packageMetadata.cjs +3 -3
  104. package/dist/packageMetadata.d.ts +2 -2
  105. package/dist/packageMetadata.mjs +3 -3
  106. package/dist/request/AuthorizationCodeRequest.d.ts +21 -21
  107. package/dist/request/AuthorizationUrlRequest.d.ts +33 -33
  108. package/dist/request/ClientCredentialRequest.d.ts +14 -14
  109. package/dist/request/DeviceCodeRequest.d.ts +15 -15
  110. package/dist/request/InteractiveRequest.d.ts +22 -22
  111. package/dist/request/OnBehalfOfRequest.d.ts +14 -14
  112. package/dist/request/RefreshTokenRequest.d.ts +17 -17
  113. package/dist/request/SignOutRequest.d.ts +5 -5
  114. package/dist/request/SilentFlowRequest.d.ts +16 -16
  115. package/dist/request/UsernamePasswordRequest.d.ts +19 -19
  116. package/dist/utils/Constants.cjs +80 -80
  117. package/dist/utils/Constants.d.ts +86 -86
  118. package/dist/utils/Constants.mjs +80 -80
  119. package/dist/utils/EncodingUtils.cjs +44 -44
  120. package/dist/utils/EncodingUtils.d.ts +26 -26
  121. package/dist/utils/EncodingUtils.mjs +44 -44
  122. package/dist/utils/NetworkUtils.cjs +38 -38
  123. package/dist/utils/NetworkUtils.d.ts +5 -5
  124. package/dist/utils/NetworkUtils.mjs +38 -38
  125. package/package.json +2 -2
  126. package/src/client/ClientApplication.ts +3 -2
  127. package/src/client/ClientAssertion.ts +7 -2
  128. package/src/client/ClientCredentialClient.ts +32 -34
  129. package/src/client/ConfidentialClientApplication.ts +11 -4
  130. package/src/client/DeviceCodeClient.ts +16 -7
  131. package/src/client/OnBehalfOfClient.ts +11 -4
  132. package/src/client/PublicClientApplication.ts +69 -13
  133. package/src/index.ts +4 -0
  134. package/src/network/LoopbackClient.ts +17 -33
@@ -1,26 +1,26 @@
1
- import { AuthenticationResult, BaseClient, ClientConfiguration, CommonUsernamePasswordRequest } from "@azure/msal-common";
2
- /**
3
- * Oauth2.0 Password grant client
4
- * Note: We are only supporting public clients for password grant and for purely testing purposes
5
- */
6
- export declare class UsernamePasswordClient extends BaseClient {
7
- constructor(configuration: ClientConfiguration);
8
- /**
9
- * API to acquire a token by passing the username and password to the service in exchage of credentials
10
- * password_grant
11
- * @param request
12
- */
13
- acquireToken(request: CommonUsernamePasswordRequest): Promise<AuthenticationResult | null>;
14
- /**
15
- * Executes POST request to token endpoint
16
- * @param authority
17
- * @param request
18
- */
19
- private executeTokenRequest;
20
- /**
21
- * Generates a map for all the params to be sent to the service
22
- * @param request
23
- */
24
- private createTokenRequestBody;
25
- }
1
+ import { AuthenticationResult, BaseClient, ClientConfiguration, CommonUsernamePasswordRequest } from "@azure/msal-common";
2
+ /**
3
+ * Oauth2.0 Password grant client
4
+ * Note: We are only supporting public clients for password grant and for purely testing purposes
5
+ */
6
+ export declare class UsernamePasswordClient extends BaseClient {
7
+ constructor(configuration: ClientConfiguration);
8
+ /**
9
+ * API to acquire a token by passing the username and password to the service in exchage of credentials
10
+ * password_grant
11
+ * @param request
12
+ */
13
+ acquireToken(request: CommonUsernamePasswordRequest): Promise<AuthenticationResult | null>;
14
+ /**
15
+ * Executes POST request to token endpoint
16
+ * @param authority
17
+ * @param request
18
+ */
19
+ private executeTokenRequest;
20
+ /**
21
+ * Generates a map for all the params to be sent to the service
22
+ * @param request
23
+ */
24
+ private createTokenRequestBody;
25
+ }
26
26
  //# sourceMappingURL=UsernamePasswordClient.d.ts.map
@@ -1,101 +1,101 @@
1
- /*! @azure/msal-node v2.1.0 2023-09-05 */
1
+ /*! @azure/msal-node v2.2.0-alpha.0 2023-09-20 */
2
2
  'use strict';
3
3
  import { BaseClient, TimeUtils, ResponseHandler, UrlString, CcsCredentialType, RequestParameterBuilder, GrantType, StringUtils } from '@azure/msal-common';
4
4
 
5
- /*
6
- * Copyright (c) Microsoft Corporation. All rights reserved.
7
- * Licensed under the MIT License.
8
- */
9
- /**
10
- * Oauth2.0 Password grant client
11
- * Note: We are only supporting public clients for password grant and for purely testing purposes
12
- */
13
- class UsernamePasswordClient extends BaseClient {
14
- constructor(configuration) {
15
- super(configuration);
16
- }
17
- /**
18
- * API to acquire a token by passing the username and password to the service in exchage of credentials
19
- * password_grant
20
- * @param request
21
- */
22
- async acquireToken(request) {
23
- this.logger.info("in acquireToken call in username-password client");
24
- const reqTimestamp = TimeUtils.nowSeconds();
25
- const response = await this.executeTokenRequest(this.authority, request);
26
- const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.config.serializableCache, this.config.persistencePlugin);
27
- // Validate response. This function throws a server error if an error is returned by the server.
28
- responseHandler.validateTokenResponse(response.body);
29
- const tokenResponse = responseHandler.handleServerTokenResponse(response.body, this.authority, reqTimestamp, request);
30
- return tokenResponse;
31
- }
32
- /**
33
- * Executes POST request to token endpoint
34
- * @param authority
35
- * @param request
36
- */
37
- async executeTokenRequest(authority, request) {
38
- const queryParametersString = this.createTokenQueryParameters(request);
39
- const endpoint = UrlString.appendQueryString(authority.tokenEndpoint, queryParametersString);
40
- const requestBody = this.createTokenRequestBody(request);
41
- const headers = this.createTokenRequestHeaders({
42
- credential: request.username,
43
- type: CcsCredentialType.UPN,
44
- });
45
- const thumbprint = {
46
- clientId: this.config.authOptions.clientId,
47
- authority: authority.canonicalAuthority,
48
- scopes: request.scopes,
49
- claims: request.claims,
50
- authenticationScheme: request.authenticationScheme,
51
- resourceRequestMethod: request.resourceRequestMethod,
52
- resourceRequestUri: request.resourceRequestUri,
53
- shrClaims: request.shrClaims,
54
- sshKid: request.sshKid,
55
- };
56
- return this.executePostToTokenEndpoint(endpoint, requestBody, headers, thumbprint, request.correlationId);
57
- }
58
- /**
59
- * Generates a map for all the params to be sent to the service
60
- * @param request
61
- */
62
- createTokenRequestBody(request) {
63
- const parameterBuilder = new RequestParameterBuilder();
64
- parameterBuilder.addClientId(this.config.authOptions.clientId);
65
- parameterBuilder.addUsername(request.username);
66
- parameterBuilder.addPassword(request.password);
67
- parameterBuilder.addScopes(request.scopes);
68
- parameterBuilder.addResponseTypeForTokenAndIdToken();
69
- parameterBuilder.addGrantType(GrantType.RESOURCE_OWNER_PASSWORD_GRANT);
70
- parameterBuilder.addClientInfo();
71
- parameterBuilder.addLibraryInfo(this.config.libraryInfo);
72
- parameterBuilder.addApplicationTelemetry(this.config.telemetry.application);
73
- parameterBuilder.addThrottling();
74
- if (this.serverTelemetryManager) {
75
- parameterBuilder.addServerTelemetry(this.serverTelemetryManager);
76
- }
77
- const correlationId = request.correlationId ||
78
- this.config.cryptoInterface.createNewGuid();
79
- parameterBuilder.addCorrelationId(correlationId);
80
- if (this.config.clientCredentials.clientSecret) {
81
- parameterBuilder.addClientSecret(this.config.clientCredentials.clientSecret);
82
- }
83
- if (this.config.clientCredentials.clientAssertion) {
84
- const clientAssertion = this.config.clientCredentials.clientAssertion;
85
- parameterBuilder.addClientAssertion(clientAssertion.assertion);
86
- parameterBuilder.addClientAssertionType(clientAssertion.assertionType);
87
- }
88
- if (!StringUtils.isEmptyObj(request.claims) ||
89
- (this.config.authOptions.clientCapabilities &&
90
- this.config.authOptions.clientCapabilities.length > 0)) {
91
- parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);
92
- }
93
- if (this.config.systemOptions.preventCorsPreflight &&
94
- request.username) {
95
- parameterBuilder.addCcsUpn(request.username);
96
- }
97
- return parameterBuilder.createQueryString();
98
- }
5
+ /*
6
+ * Copyright (c) Microsoft Corporation. All rights reserved.
7
+ * Licensed under the MIT License.
8
+ */
9
+ /**
10
+ * Oauth2.0 Password grant client
11
+ * Note: We are only supporting public clients for password grant and for purely testing purposes
12
+ */
13
+ class UsernamePasswordClient extends BaseClient {
14
+ constructor(configuration) {
15
+ super(configuration);
16
+ }
17
+ /**
18
+ * API to acquire a token by passing the username and password to the service in exchage of credentials
19
+ * password_grant
20
+ * @param request
21
+ */
22
+ async acquireToken(request) {
23
+ this.logger.info("in acquireToken call in username-password client");
24
+ const reqTimestamp = TimeUtils.nowSeconds();
25
+ const response = await this.executeTokenRequest(this.authority, request);
26
+ const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.config.serializableCache, this.config.persistencePlugin);
27
+ // Validate response. This function throws a server error if an error is returned by the server.
28
+ responseHandler.validateTokenResponse(response.body);
29
+ const tokenResponse = responseHandler.handleServerTokenResponse(response.body, this.authority, reqTimestamp, request);
30
+ return tokenResponse;
31
+ }
32
+ /**
33
+ * Executes POST request to token endpoint
34
+ * @param authority
35
+ * @param request
36
+ */
37
+ async executeTokenRequest(authority, request) {
38
+ const queryParametersString = this.createTokenQueryParameters(request);
39
+ const endpoint = UrlString.appendQueryString(authority.tokenEndpoint, queryParametersString);
40
+ const requestBody = this.createTokenRequestBody(request);
41
+ const headers = this.createTokenRequestHeaders({
42
+ credential: request.username,
43
+ type: CcsCredentialType.UPN,
44
+ });
45
+ const thumbprint = {
46
+ clientId: this.config.authOptions.clientId,
47
+ authority: authority.canonicalAuthority,
48
+ scopes: request.scopes,
49
+ claims: request.claims,
50
+ authenticationScheme: request.authenticationScheme,
51
+ resourceRequestMethod: request.resourceRequestMethod,
52
+ resourceRequestUri: request.resourceRequestUri,
53
+ shrClaims: request.shrClaims,
54
+ sshKid: request.sshKid,
55
+ };
56
+ return this.executePostToTokenEndpoint(endpoint, requestBody, headers, thumbprint, request.correlationId);
57
+ }
58
+ /**
59
+ * Generates a map for all the params to be sent to the service
60
+ * @param request
61
+ */
62
+ createTokenRequestBody(request) {
63
+ const parameterBuilder = new RequestParameterBuilder();
64
+ parameterBuilder.addClientId(this.config.authOptions.clientId);
65
+ parameterBuilder.addUsername(request.username);
66
+ parameterBuilder.addPassword(request.password);
67
+ parameterBuilder.addScopes(request.scopes);
68
+ parameterBuilder.addResponseTypeForTokenAndIdToken();
69
+ parameterBuilder.addGrantType(GrantType.RESOURCE_OWNER_PASSWORD_GRANT);
70
+ parameterBuilder.addClientInfo();
71
+ parameterBuilder.addLibraryInfo(this.config.libraryInfo);
72
+ parameterBuilder.addApplicationTelemetry(this.config.telemetry.application);
73
+ parameterBuilder.addThrottling();
74
+ if (this.serverTelemetryManager) {
75
+ parameterBuilder.addServerTelemetry(this.serverTelemetryManager);
76
+ }
77
+ const correlationId = request.correlationId ||
78
+ this.config.cryptoInterface.createNewGuid();
79
+ parameterBuilder.addCorrelationId(correlationId);
80
+ if (this.config.clientCredentials.clientSecret) {
81
+ parameterBuilder.addClientSecret(this.config.clientCredentials.clientSecret);
82
+ }
83
+ if (this.config.clientCredentials.clientAssertion) {
84
+ const clientAssertion = this.config.clientCredentials.clientAssertion;
85
+ parameterBuilder.addClientAssertion(clientAssertion.assertion);
86
+ parameterBuilder.addClientAssertionType(clientAssertion.assertionType);
87
+ }
88
+ if (!StringUtils.isEmptyObj(request.claims) ||
89
+ (this.config.authOptions.clientCapabilities &&
90
+ this.config.authOptions.clientCapabilities.length > 0)) {
91
+ parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);
92
+ }
93
+ if (this.config.systemOptions.preventCorsPreflight &&
94
+ request.username) {
95
+ parameterBuilder.addCcsUpn(request.username);
96
+ }
97
+ return parameterBuilder.createQueryString();
98
+ }
99
99
  }
100
100
 
101
101
  export { UsernamePasswordClient };
@@ -1,81 +1,81 @@
1
- /*! @azure/msal-node v2.1.0 2023-09-05 */
1
+ /*! @azure/msal-node v2.2.0-alpha.0 2023-09-20 */
2
2
  'use strict';
3
3
  'use strict';
4
4
 
5
5
  var msalCommon = require('@azure/msal-common');
6
6
  var HttpClient = require('../network/HttpClient.cjs');
7
7
 
8
- /*
9
- * Copyright (c) Microsoft Corporation. All rights reserved.
10
- * Licensed under the MIT License.
11
- */
12
- const DEFAULT_AUTH_OPTIONS = {
13
- clientId: msalCommon.Constants.EMPTY_STRING,
14
- authority: msalCommon.Constants.DEFAULT_AUTHORITY,
15
- clientSecret: msalCommon.Constants.EMPTY_STRING,
16
- clientAssertion: msalCommon.Constants.EMPTY_STRING,
17
- clientCertificate: {
18
- thumbprint: msalCommon.Constants.EMPTY_STRING,
19
- privateKey: msalCommon.Constants.EMPTY_STRING,
20
- x5c: msalCommon.Constants.EMPTY_STRING,
21
- },
22
- knownAuthorities: [],
23
- cloudDiscoveryMetadata: msalCommon.Constants.EMPTY_STRING,
24
- authorityMetadata: msalCommon.Constants.EMPTY_STRING,
25
- clientCapabilities: [],
26
- protocolMode: msalCommon.ProtocolMode.AAD,
27
- azureCloudOptions: {
28
- azureCloudInstance: msalCommon.AzureCloudInstance.None,
29
- tenant: msalCommon.Constants.EMPTY_STRING,
30
- },
31
- skipAuthorityMetadataCache: false,
32
- };
33
- const DEFAULT_CACHE_OPTIONS = {
34
- claimsBasedCachingEnabled: false,
35
- };
36
- const DEFAULT_LOGGER_OPTIONS = {
37
- loggerCallback: () => {
38
- // allow users to not set logger call back
39
- },
40
- piiLoggingEnabled: false,
41
- logLevel: msalCommon.LogLevel.Info,
42
- };
43
- const DEFAULT_SYSTEM_OPTIONS = {
44
- loggerOptions: DEFAULT_LOGGER_OPTIONS,
45
- networkClient: new HttpClient.HttpClient(),
46
- proxyUrl: msalCommon.Constants.EMPTY_STRING,
47
- customAgentOptions: {},
48
- };
49
- const DEFAULT_TELEMETRY_OPTIONS = {
50
- application: {
51
- appName: msalCommon.Constants.EMPTY_STRING,
52
- appVersion: msalCommon.Constants.EMPTY_STRING,
53
- },
54
- };
55
- /**
56
- * Sets the default options when not explicitly configured from app developer
57
- *
58
- * @param auth - Authentication options
59
- * @param cache - Cache options
60
- * @param system - System options
61
- * @param telemetry - Telemetry options
62
- *
63
- * @returns Configuration
64
- * @internal
65
- */
66
- function buildAppConfiguration({ auth, broker, cache, system, telemetry, }) {
67
- const systemOptions = {
68
- ...DEFAULT_SYSTEM_OPTIONS,
69
- networkClient: new HttpClient.HttpClient(system?.proxyUrl, system?.customAgentOptions),
70
- loggerOptions: system?.loggerOptions || DEFAULT_LOGGER_OPTIONS,
71
- };
72
- return {
73
- auth: { ...DEFAULT_AUTH_OPTIONS, ...auth },
74
- broker: { ...broker },
75
- cache: { ...DEFAULT_CACHE_OPTIONS, ...cache },
76
- system: { ...systemOptions, ...system },
77
- telemetry: { ...DEFAULT_TELEMETRY_OPTIONS, ...telemetry },
78
- };
8
+ /*
9
+ * Copyright (c) Microsoft Corporation. All rights reserved.
10
+ * Licensed under the MIT License.
11
+ */
12
+ const DEFAULT_AUTH_OPTIONS = {
13
+ clientId: msalCommon.Constants.EMPTY_STRING,
14
+ authority: msalCommon.Constants.DEFAULT_AUTHORITY,
15
+ clientSecret: msalCommon.Constants.EMPTY_STRING,
16
+ clientAssertion: msalCommon.Constants.EMPTY_STRING,
17
+ clientCertificate: {
18
+ thumbprint: msalCommon.Constants.EMPTY_STRING,
19
+ privateKey: msalCommon.Constants.EMPTY_STRING,
20
+ x5c: msalCommon.Constants.EMPTY_STRING,
21
+ },
22
+ knownAuthorities: [],
23
+ cloudDiscoveryMetadata: msalCommon.Constants.EMPTY_STRING,
24
+ authorityMetadata: msalCommon.Constants.EMPTY_STRING,
25
+ clientCapabilities: [],
26
+ protocolMode: msalCommon.ProtocolMode.AAD,
27
+ azureCloudOptions: {
28
+ azureCloudInstance: msalCommon.AzureCloudInstance.None,
29
+ tenant: msalCommon.Constants.EMPTY_STRING,
30
+ },
31
+ skipAuthorityMetadataCache: false,
32
+ };
33
+ const DEFAULT_CACHE_OPTIONS = {
34
+ claimsBasedCachingEnabled: false,
35
+ };
36
+ const DEFAULT_LOGGER_OPTIONS = {
37
+ loggerCallback: () => {
38
+ // allow users to not set logger call back
39
+ },
40
+ piiLoggingEnabled: false,
41
+ logLevel: msalCommon.LogLevel.Info,
42
+ };
43
+ const DEFAULT_SYSTEM_OPTIONS = {
44
+ loggerOptions: DEFAULT_LOGGER_OPTIONS,
45
+ networkClient: new HttpClient.HttpClient(),
46
+ proxyUrl: msalCommon.Constants.EMPTY_STRING,
47
+ customAgentOptions: {},
48
+ };
49
+ const DEFAULT_TELEMETRY_OPTIONS = {
50
+ application: {
51
+ appName: msalCommon.Constants.EMPTY_STRING,
52
+ appVersion: msalCommon.Constants.EMPTY_STRING,
53
+ },
54
+ };
55
+ /**
56
+ * Sets the default options when not explicitly configured from app developer
57
+ *
58
+ * @param auth - Authentication options
59
+ * @param cache - Cache options
60
+ * @param system - System options
61
+ * @param telemetry - Telemetry options
62
+ *
63
+ * @returns Configuration
64
+ * @internal
65
+ */
66
+ function buildAppConfiguration({ auth, broker, cache, system, telemetry, }) {
67
+ const systemOptions = {
68
+ ...DEFAULT_SYSTEM_OPTIONS,
69
+ networkClient: new HttpClient.HttpClient(system?.proxyUrl, system?.customAgentOptions),
70
+ loggerOptions: system?.loggerOptions || DEFAULT_LOGGER_OPTIONS,
71
+ };
72
+ return {
73
+ auth: { ...DEFAULT_AUTH_OPTIONS, ...auth },
74
+ broker: { ...broker },
75
+ cache: { ...DEFAULT_CACHE_OPTIONS, ...cache },
76
+ system: { ...systemOptions, ...system },
77
+ telemetry: { ...DEFAULT_TELEMETRY_OPTIONS, ...telemetry },
78
+ };
79
79
  }
80
80
 
81
81
  exports.buildAppConfiguration = buildAppConfiguration;
@@ -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