@azure/msal-node 3.7.2 → 3.7.4

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 (69) 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/ClientApplication.mjs +1 -1
  8. package/dist/client/ClientAssertion.mjs +1 -1
  9. package/dist/client/ClientCredentialClient.mjs +1 -1
  10. package/dist/client/ConfidentialClientApplication.mjs +1 -1
  11. package/dist/client/DeviceCodeClient.mjs +1 -1
  12. package/dist/client/ManagedIdentityApplication.mjs +1 -1
  13. package/dist/client/ManagedIdentityClient.mjs +1 -1
  14. package/dist/client/ManagedIdentitySources/AppService.mjs +1 -1
  15. package/dist/client/ManagedIdentitySources/AzureArc.mjs +1 -1
  16. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs +1 -1
  17. package/dist/client/ManagedIdentitySources/CloudShell.mjs +1 -1
  18. package/dist/client/ManagedIdentitySources/Imds.mjs +1 -1
  19. package/dist/client/ManagedIdentitySources/MachineLearning.mjs +1 -1
  20. package/dist/client/ManagedIdentitySources/ServiceFabric.mjs +1 -1
  21. package/dist/client/OnBehalfOfClient.mjs +1 -1
  22. package/dist/client/PublicClientApplication.d.ts.map +1 -1
  23. package/dist/client/PublicClientApplication.mjs +18 -3
  24. package/dist/client/PublicClientApplication.mjs.map +1 -1
  25. package/dist/client/UsernamePasswordClient.mjs +1 -1
  26. package/dist/config/Configuration.mjs +1 -1
  27. package/dist/config/ManagedIdentityId.mjs +1 -1
  28. package/dist/config/ManagedIdentityRequestParameters.mjs +1 -1
  29. package/dist/crypto/CryptoProvider.mjs +1 -1
  30. package/dist/crypto/GuidGenerator.mjs +1 -1
  31. package/dist/crypto/HashUtils.mjs +1 -1
  32. package/dist/crypto/PkceGenerator.mjs +1 -1
  33. package/dist/error/ManagedIdentityError.mjs +1 -1
  34. package/dist/error/ManagedIdentityErrorCodes.mjs +1 -1
  35. package/dist/error/NodeAuthError.d.ts +8 -0
  36. package/dist/error/NodeAuthError.d.ts.map +1 -1
  37. package/dist/error/NodeAuthError.mjs +11 -1
  38. package/dist/error/NodeAuthError.mjs.map +1 -1
  39. package/dist/index.mjs +1 -1
  40. package/dist/internals.mjs +1 -1
  41. package/dist/network/HttpClient.mjs +1 -1
  42. package/dist/network/HttpClientWithRetries.mjs +1 -1
  43. package/dist/network/LoopbackClient.mjs +1 -1
  44. package/dist/packageMetadata.d.ts +1 -1
  45. package/dist/packageMetadata.mjs +2 -2
  46. package/dist/protocol/Authorize.mjs +1 -1
  47. package/dist/request/InteractiveRequest.d.ts +1 -1
  48. package/dist/request/InteractiveRequest.d.ts.map +1 -1
  49. package/dist/retry/DefaultManagedIdentityRetryPolicy.mjs +1 -1
  50. package/dist/retry/ExponentialRetryStrategy.mjs +1 -1
  51. package/dist/retry/ImdsRetryPolicy.mjs +1 -1
  52. package/dist/retry/LinearRetryStrategy.mjs +1 -1
  53. package/dist/utils/Constants.mjs +1 -1
  54. package/dist/utils/EncodingUtils.mjs +1 -1
  55. package/dist/utils/NetworkUtils.mjs +1 -1
  56. package/dist/utils/TimeUtils.mjs +1 -1
  57. package/lib/msal-node.cjs +87 -62
  58. package/lib/msal-node.cjs.map +1 -1
  59. package/lib/types/client/PublicClientApplication.d.ts.map +1 -1
  60. package/lib/types/error/NodeAuthError.d.ts +8 -0
  61. package/lib/types/error/NodeAuthError.d.ts.map +1 -1
  62. package/lib/types/packageMetadata.d.ts +1 -1
  63. package/lib/types/request/InteractiveRequest.d.ts +1 -1
  64. package/lib/types/request/InteractiveRequest.d.ts.map +1 -1
  65. package/package.json +1 -1
  66. package/src/client/PublicClientApplication.ts +19 -2
  67. package/src/error/NodeAuthError.ts +14 -0
  68. package/src/packageMetadata.ts +1 -1
  69. package/src/request/InteractiveRequest.ts +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"PublicClientApplication.d.ts","sourceRoot":"","sources":["../../../src/client/PublicClientApplication.ts"],"names":[],"mappings":"AAUA,OAAO,EACH,oBAAoB,EAUpB,WAAW,EAKd,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAGpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAGtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAK9D;;;;GAIG;AACH,qBAAa,uBACT,SAAQ,iBACR,YAAW,wBAAwB;IAEnC,OAAO,CAAC,kBAAkB,CAAC,CAAsB;IACjD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAC9B;;;;;;;;;;;;;;;;OAgBG;gBACS,aAAa,EAAE,aAAa;IAoBxC;;;;;;;;OAQG;IACU,wBAAwB,CACjC,OAAO,EAAE,iBAAiB,GAC3B,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAyCvC;;OAEG;IACG,uBAAuB,CACzB,OAAO,EAAE,kBAAkB,GAC5B,OAAO,CAAC,oBAAoB,CAAC;IAgGhC;;;;OAIG;IACG,kBAAkB,CACpB,OAAO,EAAE,iBAAiB,GAC3B,OAAO,CAAC,oBAAoB,CAAC;IA0BhC;;;;OAIG;IACG,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBrD;;;OAGG;IACG,cAAc,IAAI,OAAO,CAAC,WA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;YACW,kBAAkB;CAsCnC"}
@@ -35,6 +35,10 @@ export declare const NodeAuthErrorMessage: {
35
35
  code: string;
36
36
  desc: string;
37
37
  };
38
+ redirectUriNotSupported: {
39
+ code: string;
40
+ desc: string;
41
+ };
38
42
  };
39
43
  export declare class NodeAuthError extends AuthError {
40
44
  constructor(errorCode: string, errorMessage?: string);
@@ -70,5 +74,9 @@ export declare class NodeAuthError extends AuthError {
70
74
  * Creates an error thrown when client certificate was provided, but neither the SHA-1 or SHA-256 thumbprints were provided
71
75
  */
72
76
  static createThumbprintMissingError(): NodeAuthError;
77
+ /**
78
+ * Creates an error thrown when redirectUri is provided in an unsupported scenario
79
+ */
80
+ static createRedirectUriNotSupportedError(): NodeAuthError;
73
81
  }
74
82
  //# 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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiChC,CAAC;AAEF,qBAAa,aAAc,SAAQ,SAAS;gBAC5B,SAAS,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM;IAKpD;;OAEG;IACH,MAAM,CAAC,qCAAqC,IAAI,aAAa;IAO7D;;OAEG;IACH,MAAM,CAAC,kCAAkC,IAAI,aAAa;IAO1D;;OAEG;IACH,MAAM,CAAC,+BAA+B,IAAI,aAAa;IAOvD;;OAEG;IACH,MAAM,CAAC,iCAAiC,IAAI,aAAa;IAOzD;;OAEG;IACH,MAAM,CAAC,sCAAsC,IAAI,aAAa;IAO9D;;OAEG;IACH,MAAM,CAAC,gCAAgC,IAAI,aAAa;IAOxD;;OAEG;IACH,MAAM,CAAC,wBAAwB,IAAI,aAAa;IAOhD;;OAEG;IACH,MAAM,CAAC,4BAA4B,IAAI,aAAa;CAMvD"}
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqChC,CAAC;AAEF,qBAAa,aAAc,SAAQ,SAAS;gBAC5B,SAAS,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM;IAKpD;;OAEG;IACH,MAAM,CAAC,qCAAqC,IAAI,aAAa;IAO7D;;OAEG;IACH,MAAM,CAAC,kCAAkC,IAAI,aAAa;IAO1D;;OAEG;IACH,MAAM,CAAC,+BAA+B,IAAI,aAAa;IAOvD;;OAEG;IACH,MAAM,CAAC,iCAAiC,IAAI,aAAa;IAOzD;;OAEG;IACH,MAAM,CAAC,sCAAsC,IAAI,aAAa;IAO9D;;OAEG;IACH,MAAM,CAAC,gCAAgC,IAAI,aAAa;IAOxD;;OAEG;IACH,MAAM,CAAC,wBAAwB,IAAI,aAAa;IAOhD;;OAEG;IACH,MAAM,CAAC,4BAA4B,IAAI,aAAa;IAOpD;;OAEG;IACH,MAAM,CAAC,kCAAkC,IAAI,aAAa;CAM7D"}
@@ -1,3 +1,3 @@
1
1
  export declare const name = "@azure/msal-node";
2
- export declare const version = "3.7.2";
2
+ export declare const version = "3.7.4";
3
3
  //# sourceMappingURL=packageMetadata.d.ts.map
@@ -13,7 +13,7 @@ import { ILoopbackClient } from "../network/ILoopbackClient.js";
13
13
  * - loopbackClient - Custom implementation for a loopback server to listen for authorization code response.
14
14
  * @public
15
15
  */
16
- export type InteractiveRequest = Partial<Omit<CommonAuthorizationUrlRequest, "scopes" | "redirectUri" | "requestedClaimsHash" | "storeInCache">> & {
16
+ export type InteractiveRequest = Partial<Omit<CommonAuthorizationUrlRequest, "scopes" | "requestedClaimsHash" | "storeInCache">> & {
17
17
  openBrowser: (url: string) => Promise<void>;
18
18
  scopes?: Array<string>;
19
19
  successTemplate?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"InteractiveRequest.d.ts","sourceRoot":"","sources":["../../../src/request/InteractiveRequest.ts"],"names":[],"mappings":";;AAKA,OAAO,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE;;;;;;;;;;GAUG;AACH,MAAM,MAAM,kBAAkB,GAAG,OAAO,CACpC,IAAI,CACA,6BAA6B,EAC7B,QAAQ,GAAG,aAAa,GAAG,qBAAqB,GAAG,cAAc,CACpE,CACJ,GAAG;IACA,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5C,MAAM,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,eAAe,CAAC;CACpC,CAAC"}
1
+ {"version":3,"file":"InteractiveRequest.d.ts","sourceRoot":"","sources":["../../../src/request/InteractiveRequest.ts"],"names":[],"mappings":";;AAKA,OAAO,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE;;;;;;;;;;GAUG;AACH,MAAM,MAAM,kBAAkB,GAAG,OAAO,CACpC,IAAI,CACA,6BAA6B,EAC7B,QAAQ,GAAG,qBAAqB,GAAG,cAAc,CACpD,CACJ,GAAG;IACA,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5C,MAAM,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,eAAe,CAAC;CACpC,CAAC"}
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": "3.7.2",
4
+ "version": "3.7.4",
5
5
  "author": {
6
6
  "name": "Microsoft",
7
7
  "email": "nugetaad@microsoft.com",
@@ -163,7 +163,7 @@ export class PublicClientApplication
163
163
  ...remainingProperties,
164
164
  clientId: this.config.auth.clientId,
165
165
  scopes: request.scopes || OIDC_DEFAULT_SCOPES,
166
- redirectUri: `${Constants.HTTP_PROTOCOL}${Constants.LOCALHOST}`,
166
+ redirectUri: request.redirectUri || "",
167
167
  authority: request.authority || this.config.auth.authority,
168
168
  correlationId: correlationId,
169
169
  extraParameters: {
@@ -179,6 +179,15 @@ export class PublicClientApplication
179
179
  );
180
180
  }
181
181
 
182
+ if (request.redirectUri) {
183
+ // If its not a broker fallback scenario, we throw a error
184
+ if (!this.config.broker.nativeBrokerPlugin) {
185
+ throw NodeAuthError.createRedirectUriNotSupportedError();
186
+ }
187
+ // If a redirect URI is provided for a broker flow but MSAL runtime startup failed, we fall back to the browser flow and will ignore the redirect URI provided for the broker flow
188
+ request.redirectUri = "";
189
+ }
190
+
182
191
  const { verifier, challenge } =
183
192
  await this.cryptoProvider.generatePkceCodes();
184
193
 
@@ -258,7 +267,7 @@ export class PublicClientApplication
258
267
  ...request,
259
268
  clientId: this.config.auth.clientId,
260
269
  scopes: request.scopes || OIDC_DEFAULT_SCOPES,
261
- redirectUri: `${Constants.HTTP_PROTOCOL}${Constants.LOCALHOST}`,
270
+ redirectUri: request.redirectUri || "",
262
271
  authority: request.authority || this.config.auth.authority,
263
272
  correlationId: correlationId,
264
273
  extraParameters: {
@@ -271,6 +280,14 @@ export class PublicClientApplication
271
280
  return this.nativeBrokerPlugin.acquireTokenSilent(brokerRequest);
272
281
  }
273
282
 
283
+ if (request.redirectUri) {
284
+ // If its not a broker fallback scenario, we throw a error
285
+ if (!this.config.broker.nativeBrokerPlugin) {
286
+ throw NodeAuthError.createRedirectUriNotSupportedError();
287
+ }
288
+ request.redirectUri = "";
289
+ }
290
+
274
291
  return super.acquireTokenSilent(request);
275
292
  }
276
293
 
@@ -41,6 +41,10 @@ export const NodeAuthErrorMessage = {
41
41
  code: "thumbprint_missing_from_client_certificate",
42
42
  desc: "Client certificate does not contain a SHA-1 or SHA-256 thumbprint.",
43
43
  },
44
+ redirectUriNotSupported: {
45
+ code: "redirect_uri_not_supported",
46
+ desc: "RedirectUri is not supported in this scenario. Please remove redirectUri from the request.",
47
+ },
44
48
  };
45
49
 
46
50
  export class NodeAuthError extends AuthError {
@@ -128,4 +132,14 @@ export class NodeAuthError extends AuthError {
128
132
  NodeAuthErrorMessage.thumbprintMissing.desc
129
133
  );
130
134
  }
135
+
136
+ /**
137
+ * Creates an error thrown when redirectUri is provided in an unsupported scenario
138
+ */
139
+ static createRedirectUriNotSupportedError(): NodeAuthError {
140
+ return new NodeAuthError(
141
+ NodeAuthErrorMessage.redirectUriNotSupported.code,
142
+ NodeAuthErrorMessage.redirectUriNotSupported.desc
143
+ );
144
+ }
131
145
  }
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable header/header */
2
2
  export const name = "@azure/msal-node";
3
- export const version = "3.7.2";
3
+ export const version = "3.7.4";
@@ -20,7 +20,7 @@ import { ILoopbackClient } from "../network/ILoopbackClient.js";
20
20
  export type InteractiveRequest = Partial<
21
21
  Omit<
22
22
  CommonAuthorizationUrlRequest,
23
- "scopes" | "redirectUri" | "requestedClaimsHash" | "storeInCache"
23
+ "scopes" | "requestedClaimsHash" | "storeInCache"
24
24
  >
25
25
  > & {
26
26
  openBrowser: (url: string) => Promise<void>;