@azure/msal-node 7.0.1 → 7.1.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 (64) hide show
  1. package/dist/cache/CacheHelpers.mjs +1 -1
  2. package/dist/cache/NodeStorage.mjs +1 -1
  3. package/dist/cache/TokenCache.mjs +1 -1
  4. package/dist/cache/distributed/DistributedCachePlugin.mjs +1 -1
  5. package/dist/cache/serializer/Deserializer.mjs +1 -1
  6. package/dist/cache/serializer/Serializer.mjs +1 -1
  7. package/dist/client/BaseClient.mjs +1 -1
  8. package/dist/client/ClientApplication.mjs +1 -1
  9. package/dist/client/ClientAssertion.mjs +1 -1
  10. package/dist/client/ClientCredentialClient.mjs +1 -1
  11. package/dist/client/ConfidentialClientApplication.mjs +29 -1
  12. package/dist/client/ConfidentialClientApplication.mjs.map +1 -1
  13. package/dist/client/DeviceCodeClient.mjs +1 -1
  14. package/dist/client/ManagedIdentityApplication.mjs +1 -1
  15. package/dist/client/ManagedIdentityClient.mjs +1 -1
  16. package/dist/client/ManagedIdentitySources/AppService.mjs +1 -1
  17. package/dist/client/ManagedIdentitySources/AzureArc.mjs +1 -1
  18. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs +1 -1
  19. package/dist/client/ManagedIdentitySources/CloudShell.mjs +1 -1
  20. package/dist/client/ManagedIdentitySources/Imds.mjs +1 -1
  21. package/dist/client/ManagedIdentitySources/MachineLearning.mjs +1 -1
  22. package/dist/client/ManagedIdentitySources/ServiceFabric.mjs +1 -1
  23. package/dist/client/OnBehalfOfClient.mjs +1 -1
  24. package/dist/client/PublicClientApplication.mjs +1 -1
  25. package/dist/client/SilentRequestCoalescer.mjs +1 -1
  26. package/dist/client/UserFederatedIdentityCredentialClient.mjs +1 -1
  27. package/dist/client/UsernamePasswordClient.mjs +1 -1
  28. package/dist/config/Configuration.mjs +1 -1
  29. package/dist/config/ManagedIdentityId.mjs +1 -1
  30. package/dist/config/ManagedIdentityRequestParameters.mjs +1 -1
  31. package/dist/crypto/CryptoProvider.mjs +1 -1
  32. package/dist/crypto/GuidGenerator.mjs +1 -1
  33. package/dist/crypto/HashUtils.mjs +1 -1
  34. package/dist/crypto/PkceGenerator.mjs +1 -1
  35. package/dist/error/ClientAuthErrorCodes.mjs +1 -1
  36. package/dist/error/ManagedIdentityError.mjs +1 -1
  37. package/dist/error/ManagedIdentityErrorCodes.mjs +1 -1
  38. package/dist/error/NodeAuthError.mjs +11 -1
  39. package/dist/error/NodeAuthError.mjs.map +1 -1
  40. package/dist/index.mjs +1 -1
  41. package/dist/internals.mjs +1 -1
  42. package/dist/network/HttpClient.mjs +1 -1
  43. package/dist/network/HttpClientWithRetries.mjs +1 -1
  44. package/dist/network/LoopbackClient.mjs +1 -1
  45. package/dist/packageMetadata.mjs +2 -2
  46. package/dist/protocol/Authorize.mjs +1 -1
  47. package/dist/retry/DefaultManagedIdentityRetryPolicy.mjs +1 -1
  48. package/dist/retry/ExponentialRetryStrategy.mjs +1 -1
  49. package/dist/retry/ImdsRetryPolicy.mjs +1 -1
  50. package/dist/retry/LinearRetryStrategy.mjs +1 -1
  51. package/dist/utils/Constants.mjs +1 -1
  52. package/dist/utils/EncodingUtils.mjs +1 -1
  53. package/dist/utils/TimeUtils.mjs +1 -1
  54. package/lib/msal-node.cjs +105 -68
  55. package/lib/msal-node.cjs.map +1 -1
  56. package/package.json +1 -1
  57. package/src/client/ConfidentialClientApplication.ts +50 -0
  58. package/src/error/NodeAuthError.ts +17 -0
  59. package/src/packageMetadata.ts +1 -1
  60. package/types/client/ConfidentialClientApplication.d.ts +11 -1
  61. package/types/client/ConfidentialClientApplication.d.ts.map +1 -1
  62. package/types/error/NodeAuthError.d.ts +8 -0
  63. package/types/error/NodeAuthError.d.ts.map +1 -1
  64. package/types/packageMetadata.d.ts +1 -1
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@azure/msal-node",
4
- "version": "7.0.1",
4
+ "version": "7.1.0",
5
5
  "author": {
6
6
  "name": "Microsoft",
7
7
  "email": "nugetaad@microsoft.com",
@@ -25,6 +25,7 @@ import {
25
25
  ClientAssertion as ClientAssertionType,
26
26
  getClientAssertion,
27
27
  AzureRegion,
28
+ AuthorizationCodePayload,
28
29
  } from "@azure/msal-common/node";
29
30
  import { IConfidentialClientApplication } from "./IConfidentialClientApplication.js";
30
31
  import { OnBehalfOfRequest } from "../request/OnBehalfOfRequest.js";
@@ -37,6 +38,9 @@ import { UserFederatedIdentityCredentialClient } from "./UserFederatedIdentityCr
37
38
  import { UserFederatedIdentityCredentialRequest } from "../request/UserFederatedIdentityCredentialRequest.js";
38
39
  import { CommonUserFederatedIdentityCredentialRequest } from "../request/CommonUserFederatedIdentityCredentialRequest.js";
39
40
  import * as NodeClientAuthErrorCodes from "../error/ClientAuthErrorCodes.js";
41
+ import { AuthorizationCodeRequest } from "../request/AuthorizationCodeRequest.js";
42
+ import { AuthorizationUrlRequest } from "../request/AuthorizationUrlRequest.js";
43
+ import { NodeAuthError } from "../error/NodeAuthError.js";
40
44
 
41
45
  /**
42
46
  * This class is to be used to acquire tokens for confidential client applications (webApp, webAPI). Confidential client applications
@@ -69,6 +73,13 @@ export class ConfidentialClientApplication
69
73
  * @param Configuration - configuration object for the MSAL ConfidentialClientApplication instance
70
74
  */
71
75
  constructor(configuration: Configuration) {
76
+ if (
77
+ "instanceAware" in configuration.auth &&
78
+ configuration.auth.instanceAware === true
79
+ ) {
80
+ throw NodeAuthError.createUnsupportedCcaInstanceAwareError();
81
+ }
82
+
72
83
  super(configuration);
73
84
 
74
85
  const clientSecretNotEmpty = !!this.config.auth.clientSecret;
@@ -132,6 +143,45 @@ export class ConfidentialClientApplication
132
143
  this.appTokenProvider = undefined;
133
144
  }
134
145
 
146
+ /**
147
+ * Creates the URL of the authorization request.
148
+ */
149
+ public async getAuthCodeUrl(
150
+ request: AuthorizationUrlRequest
151
+ ): Promise<string> {
152
+ if (
153
+ request.extraQueryParameters &&
154
+ Object.prototype.hasOwnProperty.call(
155
+ request.extraQueryParameters,
156
+ "instance_aware"
157
+ )
158
+ ) {
159
+ throw NodeAuthError.createUnsupportedCcaInstanceAwareError(
160
+ request.correlationId
161
+ );
162
+ }
163
+
164
+ return super.getAuthCodeUrl(request);
165
+ }
166
+
167
+ /**
168
+ * Acquires a token by exchanging an authorization code.
169
+ */
170
+ public async acquireTokenByCode(
171
+ request: AuthorizationCodeRequest,
172
+ authCodePayload?: AuthorizationCodePayload
173
+ ): Promise<AuthenticationResult> {
174
+ const sanitizedAuthCodePayload = authCodePayload
175
+ ? {
176
+ code: request.code,
177
+ state: authCodePayload.state,
178
+ nonce: request.nonce,
179
+ }
180
+ : undefined;
181
+
182
+ return super.acquireTokenByCode(request, sanitizedAuthCodePayload);
183
+ }
184
+
135
185
  /**
136
186
  * This extensibility point only works for the client_credential flow, i.e. acquireTokenByClientCredential and
137
187
  * is meant for Azure SDK to enhance Managed Identity support.
@@ -49,6 +49,10 @@ export const NodeAuthErrorMessage = {
49
49
  code: "redirect_uri_not_supported",
50
50
  desc: "RedirectUri is not supported in this scenario. Please remove redirectUri from the request.",
51
51
  },
52
+ unsupportedCcaInstanceAware: {
53
+ code: "unsupported_cca_instance_aware",
54
+ desc: "Instance-aware configuration is not supported by ConfidentialClientApplication.",
55
+ },
52
56
  };
53
57
 
54
58
  export class NodeAuthError extends AuthError {
@@ -176,4 +180,17 @@ export class NodeAuthError extends AuthError {
176
180
  NodeAuthErrorMessage.redirectUriNotSupported.desc
177
181
  );
178
182
  }
183
+
184
+ /**
185
+ * Creates an error thrown when instance-aware behavior is requested for a confidential client.
186
+ */
187
+ static createUnsupportedCcaInstanceAwareError(
188
+ correlationId: string = ""
189
+ ): NodeAuthError {
190
+ return new NodeAuthError(
191
+ NodeAuthErrorMessage.unsupportedCcaInstanceAware.code,
192
+ correlationId,
193
+ NodeAuthErrorMessage.unsupportedCcaInstanceAware.desc
194
+ );
195
+ }
179
196
  }
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable header/header */
2
2
  export const name = "@azure/msal-node";
3
- export const version = "7.0.1";
3
+ export const version = "7.1.0";
@@ -1,10 +1,12 @@
1
1
  import { ClientApplication } from "./ClientApplication.js";
2
2
  import { Configuration } from "../config/Configuration.js";
3
- import { AuthenticationResult, IAppTokenProvider } from "@azure/msal-common/node";
3
+ import { AuthenticationResult, IAppTokenProvider, AuthorizationCodePayload } from "@azure/msal-common/node";
4
4
  import { IConfidentialClientApplication } from "./IConfidentialClientApplication.js";
5
5
  import { OnBehalfOfRequest } from "../request/OnBehalfOfRequest.js";
6
6
  import { ClientCredentialRequest } from "../request/ClientCredentialRequest.js";
7
7
  import { UserFederatedIdentityCredentialRequest } from "../request/UserFederatedIdentityCredentialRequest.js";
8
+ import { AuthorizationCodeRequest } from "../request/AuthorizationCodeRequest.js";
9
+ import { AuthorizationUrlRequest } from "../request/AuthorizationUrlRequest.js";
8
10
  /**
9
11
  * This class is to be used to acquire tokens for confidential client applications (webApp, webAPI). Confidential client applications
10
12
  * will configure application secrets, client certificates/assertions as applicable
@@ -32,6 +34,14 @@ export declare class ConfidentialClientApplication extends ClientApplication imp
32
34
  * @param Configuration - configuration object for the MSAL ConfidentialClientApplication instance
33
35
  */
34
36
  constructor(configuration: Configuration);
37
+ /**
38
+ * Creates the URL of the authorization request.
39
+ */
40
+ getAuthCodeUrl(request: AuthorizationUrlRequest): Promise<string>;
41
+ /**
42
+ * Acquires a token by exchanging an authorization code.
43
+ */
44
+ acquireTokenByCode(request: AuthorizationCodeRequest, authCodePayload?: AuthorizationCodePayload): Promise<AuthenticationResult>;
35
45
  /**
36
46
  * This extensibility point only works for the client_credential flow, i.e. acquireTokenByClientCredential and
37
47
  * is meant for Azure SDK to enhance Managed Identity support.
@@ -1 +1 @@
1
- {"version":3,"file":"ConfidentialClientApplication.d.ts","sourceRoot":"","sources":["../../src/client/ConfidentialClientApplication.ts"],"names":[],"mappings":"AAOA,OAAO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O,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AACrF,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAGpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAIhF,OAAO,EAAE,sCAAsC,EAAE,MAAM,sDAAsD,CAAC;AAG9G,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAClF,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAGhF;;;;GAIG;AACH,qBAAa,6BACT,SAAQ,iBACR,YAAW,8BAA8B;IAEzC,OAAO,CAAC,gBAAgB,CAAC,CAAoB;IAE7C;;;;;;;;;;;;;;;;;;OAkBG;gBACS,aAAa,EAAE,aAAa;IAuExC;;OAEG;IACU,cAAc,CACvB,OAAO,EAAE,uBAAuB,GACjC,OAAO,CAAC,MAAM,CAAC;IAgBlB;;OAEG;IACU,kBAAkB,CAC3B,OAAO,EAAE,wBAAwB,EACjC,eAAe,CAAC,EAAE,wBAAwB,GAC3C,OAAO,CAAC,oBAAoB,CAAC;IAYhC;;;;;OAKG;IACH,mBAAmB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI;IAItD;;OAEG;IACU,8BAA8B,CACvC,OAAO,EAAE,uBAAuB,GACjC,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAkHvC;;;;;;;;;;OAUG;IACU,sBAAsB,CAC/B,OAAO,EAAE,iBAAiB,GAC3B,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAoCvC;;;;;;;OAOG;IACU,6CAA6C,CACtD,OAAO,EAAE,sCAAsC,GAChD,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;CAkF1C"}
@@ -43,6 +43,10 @@ export declare const NodeAuthErrorMessage: {
43
43
  code: string;
44
44
  desc: string;
45
45
  };
46
+ unsupportedCcaInstanceAware: {
47
+ code: string;
48
+ desc: string;
49
+ };
46
50
  };
47
51
  export declare class NodeAuthError extends AuthError {
48
52
  constructor(errorCode: string, correlationId: string, errorMessage?: string);
@@ -86,5 +90,9 @@ export declare class NodeAuthError extends AuthError {
86
90
  * Creates an error thrown when redirectUri is provided in an unsupported scenario
87
91
  */
88
92
  static createRedirectUriNotSupportedError(correlationId?: string): NodeAuthError;
93
+ /**
94
+ * Creates an error thrown when instance-aware behavior is requested for a confidential client.
95
+ */
96
+ static createUnsupportedCcaInstanceAwareError(correlationId?: string): NodeAuthError;
89
97
  }
90
98
  //# sourceMappingURL=NodeAuthError.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"NodeAuthError.d.ts","sourceRoot":"","sources":["../../src/error/NodeAuthError.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD;;GAEG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyChC,CAAC;AAEF,qBAAa,aAAc,SAAQ,SAAS;gBAEpC,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,MAAM,EACrB,YAAY,CAAC,EAAE,MAAM;IAMzB;;OAEG;IACH,MAAM,CAAC,qCAAqC,IAAI,aAAa;IAQ7D;;OAEG;IACH,MAAM,CAAC,kCAAkC,IAAI,aAAa;IAQ1D;;OAEG;IACH,MAAM,CAAC,+BAA+B,CAClC,aAAa,GAAE,MAAW,GAC3B,aAAa;IAQhB;;OAEG;IACH,MAAM,CAAC,iCAAiC,IAAI,aAAa;IAQzD;;OAEG;IACH,MAAM,CAAC,sCAAsC,IAAI,aAAa;IAQ9D;;OAEG;IACH,MAAM,CAAC,gCAAgC,CACnC,aAAa,GAAE,MAAW,GAC3B,aAAa;IAQhB;;OAEG;IACH,MAAM,CAAC,kDAAkD,IAAI,aAAa;IAQ1E;;OAEG;IACH,MAAM,CAAC,wBAAwB,CAAC,aAAa,GAAE,MAAW,GAAG,aAAa;IAQ1E;;OAEG;IACH,MAAM,CAAC,4BAA4B,IAAI,aAAa;IAQpD;;OAEG;IACH,MAAM,CAAC,kCAAkC,CACrC,aAAa,GAAE,MAAW,GAC3B,aAAa;CAOnB"}
1
+ {"version":3,"file":"NodeAuthError.d.ts","sourceRoot":"","sources":["../../src/error/NodeAuthError.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD;;GAEG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6ChC,CAAC;AAEF,qBAAa,aAAc,SAAQ,SAAS;gBAEpC,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,MAAM,EACrB,YAAY,CAAC,EAAE,MAAM;IAMzB;;OAEG;IACH,MAAM,CAAC,qCAAqC,IAAI,aAAa;IAQ7D;;OAEG;IACH,MAAM,CAAC,kCAAkC,IAAI,aAAa;IAQ1D;;OAEG;IACH,MAAM,CAAC,+BAA+B,CAClC,aAAa,GAAE,MAAW,GAC3B,aAAa;IAQhB;;OAEG;IACH,MAAM,CAAC,iCAAiC,IAAI,aAAa;IAQzD;;OAEG;IACH,MAAM,CAAC,sCAAsC,IAAI,aAAa;IAQ9D;;OAEG;IACH,MAAM,CAAC,gCAAgC,CACnC,aAAa,GAAE,MAAW,GAC3B,aAAa;IAQhB;;OAEG;IACH,MAAM,CAAC,kDAAkD,IAAI,aAAa;IAQ1E;;OAEG;IACH,MAAM,CAAC,wBAAwB,CAAC,aAAa,GAAE,MAAW,GAAG,aAAa;IAQ1E;;OAEG;IACH,MAAM,CAAC,4BAA4B,IAAI,aAAa;IAQpD;;OAEG;IACH,MAAM,CAAC,kCAAkC,CACrC,aAAa,GAAE,MAAW,GAC3B,aAAa;IAQhB;;OAEG;IACH,MAAM,CAAC,sCAAsC,CACzC,aAAa,GAAE,MAAW,GAC3B,aAAa;CAOnB"}
@@ -1,3 +1,3 @@
1
1
  export declare const name = "@azure/msal-node";
2
- export declare const version = "7.0.1";
2
+ export declare const version = "7.1.0";
3
3
  //# sourceMappingURL=packageMetadata.d.ts.map