@azure/msal-browser 2.20.0 → 2.21.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 (92) hide show
  1. package/CHANGELOG.json +29 -0
  2. package/CHANGELOG.md +14 -1
  3. package/README.md +3 -3
  4. package/dist/_virtual/_tslib.js +1 -1
  5. package/dist/app/ClientApplication.js +1 -1
  6. package/dist/app/IPublicClientApplication.js +1 -1
  7. package/dist/app/PublicClientApplication.js +29 -24
  8. package/dist/app/PublicClientApplication.js.map +1 -1
  9. package/dist/cache/AsyncMemoryStorage.js +1 -1
  10. package/dist/cache/BrowserCacheManager.d.ts +5 -1
  11. package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
  12. package/dist/cache/BrowserCacheManager.js +21 -1
  13. package/dist/cache/BrowserCacheManager.js.map +1 -1
  14. package/dist/cache/BrowserStorage.js +1 -1
  15. package/dist/cache/DatabaseStorage.js +1 -1
  16. package/dist/cache/MemoryStorage.js +1 -1
  17. package/dist/cache/TokenCache.js +1 -1
  18. package/dist/config/Configuration.js +1 -1
  19. package/dist/crypto/BrowserCrypto.js +1 -1
  20. package/dist/crypto/CryptoOps.d.ts +5 -0
  21. package/dist/crypto/CryptoOps.d.ts.map +1 -1
  22. package/dist/crypto/CryptoOps.js +22 -5
  23. package/dist/crypto/CryptoOps.js.map +1 -1
  24. package/dist/crypto/GuidGenerator.js +1 -1
  25. package/dist/crypto/PkceGenerator.js +1 -1
  26. package/dist/crypto/SignedHttpRequest.js +1 -1
  27. package/dist/encode/Base64Decode.js +1 -1
  28. package/dist/encode/Base64Encode.js +1 -1
  29. package/dist/error/BrowserAuthError.js +1 -1
  30. package/dist/error/BrowserConfigurationAuthError.js +1 -1
  31. package/dist/event/EventHandler.js +1 -1
  32. package/dist/event/EventMessage.js +1 -1
  33. package/dist/event/EventType.js +1 -1
  34. package/dist/index.cjs.js +396 -258
  35. package/dist/index.cjs.js.map +1 -1
  36. package/dist/index.js +1 -1
  37. package/dist/interaction_client/BaseInteractionClient.d.ts +1 -1
  38. package/dist/interaction_client/BaseInteractionClient.d.ts.map +1 -1
  39. package/dist/interaction_client/BaseInteractionClient.js +39 -24
  40. package/dist/interaction_client/BaseInteractionClient.js.map +1 -1
  41. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.js +1 -1
  42. package/dist/interaction_client/PopupClient.d.ts.map +1 -1
  43. package/dist/interaction_client/PopupClient.js +46 -36
  44. package/dist/interaction_client/PopupClient.js.map +1 -1
  45. package/dist/interaction_client/RedirectClient.js +14 -13
  46. package/dist/interaction_client/RedirectClient.js.map +1 -1
  47. package/dist/interaction_client/SilentAuthCodeClient.js +10 -8
  48. package/dist/interaction_client/SilentAuthCodeClient.js.map +1 -1
  49. package/dist/interaction_client/SilentCacheClient.d.ts +1 -1
  50. package/dist/interaction_client/SilentCacheClient.d.ts.map +1 -1
  51. package/dist/interaction_client/SilentCacheClient.js +12 -2
  52. package/dist/interaction_client/SilentCacheClient.js.map +1 -1
  53. package/dist/interaction_client/SilentIframeClient.js +13 -11
  54. package/dist/interaction_client/SilentIframeClient.js.map +1 -1
  55. package/dist/interaction_client/SilentRefreshClient.js +10 -7
  56. package/dist/interaction_client/SilentRefreshClient.js.map +1 -1
  57. package/dist/interaction_client/StandardInteractionClient.d.ts +2 -2
  58. package/dist/interaction_client/StandardInteractionClient.d.ts.map +1 -1
  59. package/dist/interaction_client/StandardInteractionClient.js +51 -32
  60. package/dist/interaction_client/StandardInteractionClient.js.map +1 -1
  61. package/dist/interaction_handler/InteractionHandler.js +1 -1
  62. package/dist/interaction_handler/PopupHandler.js +1 -1
  63. package/dist/interaction_handler/RedirectHandler.js +1 -1
  64. package/dist/interaction_handler/SilentHandler.js +1 -1
  65. package/dist/navigation/NavigationClient.js +1 -1
  66. package/dist/network/FetchClient.js +1 -1
  67. package/dist/network/XhrClient.js +1 -1
  68. package/dist/packageMetadata.d.ts +1 -1
  69. package/dist/packageMetadata.js +2 -2
  70. package/dist/packageMetadata.js.map +1 -1
  71. package/dist/request/AuthorizationCodeRequest.d.ts +1 -1
  72. package/dist/request/AuthorizationCodeRequest.d.ts.map +1 -1
  73. package/dist/request/AuthorizationUrlRequest.d.ts +1 -1
  74. package/dist/request/AuthorizationUrlRequest.d.ts.map +1 -1
  75. package/dist/request/PopupRequest.d.ts +1 -1
  76. package/dist/request/PopupRequest.d.ts.map +1 -1
  77. package/dist/request/RedirectRequest.d.ts +1 -1
  78. package/dist/request/RedirectRequest.d.ts.map +1 -1
  79. package/dist/request/SilentRequest.d.ts +1 -1
  80. package/dist/request/SilentRequest.d.ts.map +1 -1
  81. package/dist/request/SsoSilentRequest.d.ts +1 -1
  82. package/dist/request/SsoSilentRequest.d.ts.map +1 -1
  83. package/dist/utils/BrowserConstants.js +1 -1
  84. package/dist/utils/BrowserProtocolUtils.js +1 -1
  85. package/dist/utils/BrowserStringUtils.js +1 -1
  86. package/dist/utils/BrowserUtils.js +1 -1
  87. package/dist/utils/MathUtils.js +1 -1
  88. package/dist/utils/PopupUtils.js +1 -1
  89. package/lib/msal-browser.js +396 -258
  90. package/lib/msal-browser.js.map +1 -1
  91. package/lib/msal-browser.min.js +30 -30
  92. package/package.json +2 -2
package/CHANGELOG.json CHANGED
@@ -1,6 +1,35 @@
1
1
  {
2
2
  "name": "@azure/msal-browser",
3
3
  "entries": [
4
+ {
5
+ "date": "Tue, 04 Jan 2022 00:20:29 GMT",
6
+ "tag": "@azure/msal-browser_v2.21.0",
7
+ "version": "2.21.0",
8
+ "comments": {
9
+ "minor": [
10
+ {
11
+ "author": "hemoral@microsoft.com",
12
+ "package": "@azure/msal-browser",
13
+ "commit": "60e2cfc0e9daa3c24e994617b4ac42aef6880b74",
14
+ "comment": "Add support for requested claims in silent token acquisition #4296"
15
+ },
16
+ {
17
+ "author": "beachball",
18
+ "package": "@azure/msal-browser",
19
+ "comment": "Bump @azure/msal-common to v6.0.0",
20
+ "commit": "bd9b1af91c278926ab2e6943cf90817a7ac4957b"
21
+ }
22
+ ],
23
+ "patch": [
24
+ {
25
+ "author": "janutter@microsoft.com",
26
+ "package": "@azure/msal-browser",
27
+ "commit": "e3c66105f3bf617dc4fd06905e04b37e865c303c",
28
+ "comment": "Clear interaction status even if there is no ongoing request #4314"
29
+ }
30
+ ]
31
+ }
32
+ },
4
33
  {
5
34
  "date": "Tue, 07 Dec 2021 00:17:01 GMT",
6
35
  "tag": "@azure/msal-browser_v2.20.0",
package/CHANGELOG.md CHANGED
@@ -1,9 +1,22 @@
1
1
  # Change Log - @azure/msal-browser
2
2
 
3
- This log was last generated on Tue, 07 Dec 2021 00:17:01 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 04 Jan 2022 00:20:29 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 2.21.0
8
+
9
+ Tue, 04 Jan 2022 00:20:29 GMT
10
+
11
+ ### Minor changes
12
+
13
+ - Add support for requested claims in silent token acquisition #4296 (hemoral@microsoft.com)
14
+ - Bump @azure/msal-common to v6.0.0
15
+
16
+ ### Patches
17
+
18
+ - Clear interaction status even if there is no ongoing request #4314 (janutter@microsoft.com)
19
+
7
20
  ## 2.20.0
8
21
 
9
22
  Tue, 07 Dec 2021 00:17:01 GMT
package/README.md CHANGED
@@ -29,7 +29,7 @@
29
29
 
30
30
  The MSAL library for JavaScript enables client-side JavaScript applications to authenticate users using [Azure AD](https://docs.microsoft.com/azure/active-directory/develop/v2-overview) work and school accounts (AAD), Microsoft personal accounts (MSA) and social identity providers like Facebook, Google, LinkedIn, Microsoft accounts, etc. through [Azure AD B2C](https://docs.microsoft.com/azure/active-directory-b2c/active-directory-b2c-overview#identity-providers) service. It also enables your app to get tokens to access [Microsoft Cloud](https://www.microsoft.com/enterprise) services such as [Microsoft Graph](https://graph.microsoft.io).
31
31
 
32
- The `@azure/msal-browser` package described by the code in this folder uses the [`@azure/msal-common` package](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-common) as a dependency to enable authentication in Javascript Single-Page Applications without backend servers. This version of the library uses the OAuth 2.0 Authorization Code Flow with PKCE. To read more about this protocol, as well as the differences between implicit flow and authorization code flow, see the section [below](#implicit-flow-vs-authorization-code-flow-with-pkce). If you are looking for the version of the library that uses the implicit flow, please see the [`msal-core` library](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-core).
32
+ The `@azure/msal-browser` package described by the code in this folder uses the [`@azure/msal-common` package](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-common) as a dependency to enable authentication in JavaScript Single-Page Applications without backend servers. This version of the library uses the OAuth 2.0 Authorization Code Flow with PKCE. To read more about this protocol, as well as the differences between implicit flow and authorization code flow, see the section [below](#implicit-flow-vs-authorization-code-flow-with-pkce). If you are looking for the version of the library that uses the implicit flow, please see the [`msal-core` library](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-core).
33
33
 
34
34
  This is an improvement upon the current `msal-core` library which will utilize the authorization code flow in the browser. Most features available in the old library will be available in this one, but there are nuances to the authentication flow in both. The `@azure/msal-browser` package does NOT support the implicit flow.
35
35
 
@@ -59,7 +59,7 @@ npm install @azure/msal-browser
59
59
 
60
60
  <!-- CDN_LATEST -->
61
61
  ```html
62
- <script type="text/javascript" src="https://alcdn.msauth.net/browser/2.20.0/js/msal-browser.min.js"></script>
62
+ <script type="text/javascript" src="https://alcdn.msauth.net/browser/2.21.0/js/msal-browser.min.js"></script>
63
63
  ```
64
64
 
65
65
  See [here](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/cdn-usage.md) for more info on how to use this package from the Microsoft CDN.
@@ -103,7 +103,7 @@ Here is a complete list of samples for the MSAL.js 2.x library:
103
103
  | Sample | Description | How to Run |
104
104
  | ------ | ----------- | ---------- |
105
105
  | [TypeScript Sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-browser-samples/TypescriptTestApp2.0) | A TypeScript sample showing usage of MSAL 2.0 with the Microsoft Graph API. | `npm start` |
106
- | [Basic Auth Sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-browser-samples/VanillaJSTestApp2.0/app/default) | A vanilla Javascript sample showing basic usage of the MSAL 2.0 library (`@azure/msal-browser` package) with the Microsoft Graph API. | `npm start -- -s default` |
106
+ | [Basic Auth Sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-browser-samples/VanillaJSTestApp2.0/app/default) | A vanilla JavaScript sample showing basic usage of the MSAL 2.0 library (`@azure/msal-browser` package) with the Microsoft Graph API. | `npm start -- -s default` |
107
107
  | [Multiple Resources Sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-browser-samples/VanillaJSTestApp2.0/app/multipleResources) | A vanilla JS sample showing usage of MSAL 2.0 with authentication on page load with a redirect. | `npm start -- -s multipleResources` |
108
108
  | [On Page Load Sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-browser-samples/VanillaJSTestApp2.0/app/onPageLoad) | A vanilla JS sample showing usage of MSAL 2.0 with authentication on page load with a redirect. | `npm start -- -s onPageLoad` |
109
109
  | [ssoSilent() Sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-browser-samples/VanillaJSTestApp2.0/app/ssoSilent) | A vanilla JS sample showing usage of the ssoSilent API, allowing you to sign in a user silently if a context exists on the authentication server. | `npm start -- -s ssoSilent` |
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-browser v2.20.0 2021-12-07 */
1
+ /*! @azure/msal-browser v2.21.0 2022-01-04 */
2
2
  'use strict';
3
3
  /*! *****************************************************************************
4
4
  Copyright (c) Microsoft Corporation.
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-browser v2.20.0 2021-12-07 */
1
+ /*! @azure/msal-browser v2.21.0 2022-01-04 */
2
2
  'use strict';
3
3
  import { __awaiter, __generator } from '../_virtual/_tslib.js';
4
4
  import { CryptoOps } from '../crypto/CryptoOps.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-browser v2.20.0 2021-12-07 */
1
+ /*! @azure/msal-browser v2.21.0 2022-01-04 */
2
2
  'use strict';
3
3
  import { BrowserConfigurationAuthError } from '../error/BrowserConfigurationAuthError.js';
4
4
 
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-browser v2.20.0 2021-12-07 */
1
+ /*! @azure/msal-browser v2.21.0 2022-01-04 */
2
2
  'use strict';
3
3
  import { __extends, __awaiter, __generator } from '../_virtual/_tslib.js';
4
4
  import { DEFAULT_REQUEST, InteractionType } from '../utils/BrowserConstants.js';
@@ -93,11 +93,11 @@ var PublicClientApplication = /** @class */ (function (_super) {
93
93
  authority: request.authority || "",
94
94
  scopes: request.scopes,
95
95
  homeAccountIdentifier: account.homeAccountId,
96
+ claims: request.claims,
96
97
  authenticationScheme: request.authenticationScheme,
97
98
  resourceRequestMethod: request.resourceRequestMethod,
98
99
  resourceRequestUri: request.resourceRequestUri,
99
100
  shrClaims: request.shrClaims,
100
- sshJwk: request.sshJwk,
101
101
  sshKid: request.sshKid
102
102
  };
103
103
  silentRequestKey = JSON.stringify(thumbprint);
@@ -134,28 +134,33 @@ var PublicClientApplication = /** @class */ (function (_super) {
134
134
  var silentCacheClient, silentRequest;
135
135
  var _this = this;
136
136
  return __generator(this, function (_a) {
137
- silentCacheClient = new SilentCacheClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, request.correlationId);
138
- silentRequest = silentCacheClient.initializeSilentRequest(request, account);
139
- this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_START, InteractionType.Silent, request);
140
- return [2 /*return*/, silentCacheClient.acquireToken(silentRequest).catch(function () { return __awaiter(_this, void 0, void 0, function () {
141
- var tokenRenewalResult, tokenRenewalError_1;
142
- return __generator(this, function (_a) {
143
- switch (_a.label) {
144
- case 0:
145
- _a.trys.push([0, 2, , 3]);
146
- return [4 /*yield*/, this.acquireTokenByRefreshToken(silentRequest)];
147
- case 1:
148
- tokenRenewalResult = _a.sent();
149
- this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, InteractionType.Silent, tokenRenewalResult);
150
- return [2 /*return*/, tokenRenewalResult];
151
- case 2:
152
- tokenRenewalError_1 = _a.sent();
153
- this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, InteractionType.Silent, null, tokenRenewalError_1);
154
- throw tokenRenewalError_1;
155
- case 3: return [2 /*return*/];
156
- }
157
- });
158
- }); })];
137
+ switch (_a.label) {
138
+ case 0:
139
+ silentCacheClient = new SilentCacheClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, request.correlationId);
140
+ return [4 /*yield*/, silentCacheClient.initializeSilentRequest(request, account)];
141
+ case 1:
142
+ silentRequest = _a.sent();
143
+ this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_START, InteractionType.Silent, request);
144
+ return [2 /*return*/, silentCacheClient.acquireToken(silentRequest).catch(function () { return __awaiter(_this, void 0, void 0, function () {
145
+ var tokenRenewalResult, tokenRenewalError_1;
146
+ return __generator(this, function (_a) {
147
+ switch (_a.label) {
148
+ case 0:
149
+ _a.trys.push([0, 2, , 3]);
150
+ return [4 /*yield*/, this.acquireTokenByRefreshToken(silentRequest)];
151
+ case 1:
152
+ tokenRenewalResult = _a.sent();
153
+ this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, InteractionType.Silent, tokenRenewalResult);
154
+ return [2 /*return*/, tokenRenewalResult];
155
+ case 2:
156
+ tokenRenewalError_1 = _a.sent();
157
+ this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, InteractionType.Silent, null, tokenRenewalError_1);
158
+ throw tokenRenewalError_1;
159
+ case 3: return [2 /*return*/];
160
+ }
161
+ });
162
+ }); })];
163
+ }
159
164
  });
160
165
  });
161
166
  };
@@ -1 +1 @@
1
- {"version":3,"file":"PublicClientApplication.js","sources":["../../src/app/PublicClientApplication.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AccountInfo, AuthenticationResult, RequestThumbprint } from \"@azure/msal-common\";\nimport { Configuration } from \"../config/Configuration\";\nimport { DEFAULT_REQUEST, InteractionType } from \"../utils/BrowserConstants\";\nimport { IPublicClientApplication } from \"./IPublicClientApplication\";\nimport { RedirectRequest } from \"../request/RedirectRequest\";\nimport { PopupRequest } from \"../request/PopupRequest\";\nimport { ClientApplication } from \"./ClientApplication\";\nimport { SilentRequest } from \"../request/SilentRequest\";\nimport { EventType } from \"../event/EventType\";\nimport { BrowserAuthError } from \"../error/BrowserAuthError\";\nimport { SilentCacheClient } from \"../interaction_client/SilentCacheClient\";\n\n/**\n * The PublicClientApplication class is the object exposed by the library to perform authentication and authorization functions in Single Page Applications\n * to obtain JWT tokens as described in the OAuth 2.0 Authorization Code Flow with PKCE specification.\n */\nexport class PublicClientApplication extends ClientApplication implements IPublicClientApplication {\n\n // Active requests\n private activeSilentTokenRequests: Map<string, Promise<AuthenticationResult>>;\n\n /**\n * @constructor\n * Constructor for the PublicClientApplication used to instantiate the PublicClientApplication object\n *\n * Important attributes in the Configuration object for auth are:\n * - clientID: the application ID of your application. You can obtain one by registering your application with our Application registration portal : https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredAppsPreview\n * - authority: the authority URL for your application.\n * - redirect_uri: the uri of your application registered in the portal.\n *\n * In Azure AD, authority is a URL indicating the Azure active directory that MSAL uses to obtain tokens.\n * It is of the form https://login.microsoftonline.com/{Enter_the_Tenant_Info_Here}\n * If your application supports Accounts in one organizational directory, replace \"Enter_the_Tenant_Info_Here\" value with the Tenant Id or Tenant name (for example, contoso.microsoft.com).\n * If your application supports Accounts in any organizational directory, replace \"Enter_the_Tenant_Info_Here\" value with organizations.\n * If your application supports Accounts in any organizational directory and personal Microsoft accounts, replace \"Enter_the_Tenant_Info_Here\" value with common.\n * To restrict support to Personal Microsoft accounts only, replace \"Enter_the_Tenant_Info_Here\" value with consumers.\n *\n * In Azure B2C, authority is of the form https://{instance}/tfp/{tenant}/{policyName}/\n * Full B2C functionality will be available in this library in future versions.\n *\n * @param configuration object for the MSAL PublicClientApplication instance\n */\n constructor(configuration: Configuration) {\n super(configuration);\n\n this.activeSilentTokenRequests = new Map();\n }\n\n /**\n * Use when initiating the login process by redirecting the user's browser to the authorization endpoint. This function redirects the page, so\n * any code that follows this function will not execute.\n *\n * IMPORTANT: It is NOT recommended to have code that is dependent on the resolution of the Promise. This function will navigate away from the current\n * browser window. It currently returns a Promise in order to reflect the asynchronous nature of the code running in this function.\n *\n * @param request\n */\n async loginRedirect(request?: RedirectRequest): Promise<void> {\n this.logger.verbose(\"loginRedirect called\");\n return this.acquireTokenRedirect(request || DEFAULT_REQUEST);\n }\n\n /**\n * Use when initiating the login process via opening a popup window in the user's browser\n *\n * @param request\n *\n * @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.\n */\n loginPopup(request?: PopupRequest): Promise<AuthenticationResult> {\n this.logger.verbose(\"loginPopup called\");\n return this.acquireTokenPopup(request || DEFAULT_REQUEST);\n }\n\n /**\n * Silently acquire an access token for a given set of scopes. Returns currently processing promise if parallel requests are made.\n *\n * @param {@link (SilentRequest:type)}\n * @returns {Promise.<AuthenticationResult>} - a promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the {@link AuthResponse} object\n */\n async acquireTokenSilent(request: SilentRequest): Promise<AuthenticationResult> {\n this.preflightBrowserEnvironmentCheck(InteractionType.Silent);\n this.logger.verbose(\"acquireTokenSilent called\", request.correlationId);\n const account = request.account || this.getActiveAccount();\n if (!account) {\n throw BrowserAuthError.createNoAccountError();\n }\n const thumbprint: RequestThumbprint = {\n clientId: this.config.auth.clientId,\n authority: request.authority || \"\",\n scopes: request.scopes,\n homeAccountIdentifier: account.homeAccountId,\n authenticationScheme: request.authenticationScheme,\n resourceRequestMethod: request.resourceRequestMethod,\n resourceRequestUri: request.resourceRequestUri,\n shrClaims: request.shrClaims,\n sshJwk: request.sshJwk,\n sshKid: request.sshKid\n };\n const silentRequestKey = JSON.stringify(thumbprint);\n const cachedResponse = this.activeSilentTokenRequests.get(silentRequestKey);\n if (typeof cachedResponse === \"undefined\") {\n this.logger.verbose(\"acquireTokenSilent called for the first time, storing active request\", request.correlationId);\n const response = this.acquireTokenSilentAsync(request, account)\n .then((result) => {\n this.activeSilentTokenRequests.delete(silentRequestKey);\n return result;\n })\n .catch((error) => {\n this.activeSilentTokenRequests.delete(silentRequestKey);\n throw error;\n });\n this.activeSilentTokenRequests.set(silentRequestKey, response);\n return response;\n } else {\n this.logger.verbose(\"acquireTokenSilent has been called previously, returning the result from the first call\", request.correlationId);\n return cachedResponse;\n }\n }\n\n /**\n * Silently acquire an access token for a given set of scopes. Will use cached token if available, otherwise will attempt to acquire a new token from the network via refresh token.\n * @param {@link (SilentRequest:type)}\n * @param {@link (AccountInfo:type)}\n * @returns {Promise.<AuthenticationResult>} - a promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the {@link AuthResponse} \n */\n private async acquireTokenSilentAsync(request: SilentRequest, account: AccountInfo): Promise<AuthenticationResult>{\n const silentCacheClient = new SilentCacheClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, request.correlationId);\n const silentRequest = silentCacheClient.initializeSilentRequest(request, account);\n this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_START, InteractionType.Silent, request);\n\n return silentCacheClient.acquireToken(silentRequest).catch(async () => {\n try {\n const tokenRenewalResult = await this.acquireTokenByRefreshToken(silentRequest);\n this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, InteractionType.Silent, tokenRenewalResult);\n return tokenRenewalResult;\n } catch (tokenRenewalError) {\n this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, InteractionType.Silent, null, tokenRenewalError);\n throw tokenRenewalError;\n }\n });\n }\n}\n"],"names":[],"mappings":";;;;;;;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I,CAAC,YAAY,EAAE,IAAI,CAAC,gBAAgB,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;gBAC9K,aAAa,GAAG,iBAAiB,CAAC,uBAAuB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;gBAClF,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,SAAS,CAAC,mBAAmB,EAAE,eAAe,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBAE5F,sBAAO,iBAAiB,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC,KAAK,CAAC;;;;;;oCAExB,qBAAM,IAAI,CAAC,0BAA0B,CAAC,aAAa,CAAC,EAAA;;oCAAzE,kBAAkB,GAAG,SAAoD;oCAC/E,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,SAAS,CAAC,qBAAqB,EAAE,eAAe,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;oCACzG,sBAAO,kBAAkB,EAAC;;;oCAE1B,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,SAAS,CAAC,qBAAqB,EAAE,eAAe,CAAC,MAAM,EAAE,IAAI,EAAE,mBAAiB,CAAC,CAAC;oCAC9G,MAAM,mBAAiB,CAAC;;;;yBAE/B,CAAC,EAAC;;;KACN;IACL,8BAAC;AAAD,CA9HA,CAA6C,iBAAiB;;;;"}
1
+ {"version":3,"file":"PublicClientApplication.js","sources":["../../src/app/PublicClientApplication.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AccountInfo, AuthenticationResult, RequestThumbprint } from \"@azure/msal-common\";\nimport { Configuration } from \"../config/Configuration\";\nimport { DEFAULT_REQUEST, InteractionType } from \"../utils/BrowserConstants\";\nimport { IPublicClientApplication } from \"./IPublicClientApplication\";\nimport { RedirectRequest } from \"../request/RedirectRequest\";\nimport { PopupRequest } from \"../request/PopupRequest\";\nimport { ClientApplication } from \"./ClientApplication\";\nimport { SilentRequest } from \"../request/SilentRequest\";\nimport { EventType } from \"../event/EventType\";\nimport { BrowserAuthError } from \"../error/BrowserAuthError\";\nimport { SilentCacheClient } from \"../interaction_client/SilentCacheClient\";\n\n/**\n * The PublicClientApplication class is the object exposed by the library to perform authentication and authorization functions in Single Page Applications\n * to obtain JWT tokens as described in the OAuth 2.0 Authorization Code Flow with PKCE specification.\n */\nexport class PublicClientApplication extends ClientApplication implements IPublicClientApplication {\n\n // Active requests\n private activeSilentTokenRequests: Map<string, Promise<AuthenticationResult>>;\n\n /**\n * @constructor\n * Constructor for the PublicClientApplication used to instantiate the PublicClientApplication object\n *\n * Important attributes in the Configuration object for auth are:\n * - clientID: the application ID of your application. You can obtain one by registering your application with our Application registration portal : https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredAppsPreview\n * - authority: the authority URL for your application.\n * - redirect_uri: the uri of your application registered in the portal.\n *\n * In Azure AD, authority is a URL indicating the Azure active directory that MSAL uses to obtain tokens.\n * It is of the form https://login.microsoftonline.com/{Enter_the_Tenant_Info_Here}\n * If your application supports Accounts in one organizational directory, replace \"Enter_the_Tenant_Info_Here\" value with the Tenant Id or Tenant name (for example, contoso.microsoft.com).\n * If your application supports Accounts in any organizational directory, replace \"Enter_the_Tenant_Info_Here\" value with organizations.\n * If your application supports Accounts in any organizational directory and personal Microsoft accounts, replace \"Enter_the_Tenant_Info_Here\" value with common.\n * To restrict support to Personal Microsoft accounts only, replace \"Enter_the_Tenant_Info_Here\" value with consumers.\n *\n * In Azure B2C, authority is of the form https://{instance}/tfp/{tenant}/{policyName}/\n * Full B2C functionality will be available in this library in future versions.\n *\n * @param configuration object for the MSAL PublicClientApplication instance\n */\n constructor(configuration: Configuration) {\n super(configuration);\n\n this.activeSilentTokenRequests = new Map();\n }\n\n /**\n * Use when initiating the login process by redirecting the user's browser to the authorization endpoint. This function redirects the page, so\n * any code that follows this function will not execute.\n *\n * IMPORTANT: It is NOT recommended to have code that is dependent on the resolution of the Promise. This function will navigate away from the current\n * browser window. It currently returns a Promise in order to reflect the asynchronous nature of the code running in this function.\n *\n * @param request\n */\n async loginRedirect(request?: RedirectRequest): Promise<void> {\n this.logger.verbose(\"loginRedirect called\");\n return this.acquireTokenRedirect(request || DEFAULT_REQUEST);\n }\n\n /**\n * Use when initiating the login process via opening a popup window in the user's browser\n *\n * @param request\n *\n * @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.\n */\n loginPopup(request?: PopupRequest): Promise<AuthenticationResult> {\n this.logger.verbose(\"loginPopup called\");\n return this.acquireTokenPopup(request || DEFAULT_REQUEST);\n }\n\n /**\n * Silently acquire an access token for a given set of scopes. Returns currently processing promise if parallel requests are made.\n *\n * @param {@link (SilentRequest:type)}\n * @returns {Promise.<AuthenticationResult>} - a promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the {@link AuthResponse} object\n */\n async acquireTokenSilent(request: SilentRequest): Promise<AuthenticationResult> {\n this.preflightBrowserEnvironmentCheck(InteractionType.Silent);\n this.logger.verbose(\"acquireTokenSilent called\", request.correlationId);\n const account = request.account || this.getActiveAccount();\n if (!account) {\n throw BrowserAuthError.createNoAccountError();\n }\n const thumbprint: RequestThumbprint = {\n clientId: this.config.auth.clientId,\n authority: request.authority || \"\",\n scopes: request.scopes,\n homeAccountIdentifier: account.homeAccountId,\n claims: request.claims,\n authenticationScheme: request.authenticationScheme,\n resourceRequestMethod: request.resourceRequestMethod,\n resourceRequestUri: request.resourceRequestUri,\n shrClaims: request.shrClaims,\n sshKid: request.sshKid\n };\n const silentRequestKey = JSON.stringify(thumbprint);\n const cachedResponse = this.activeSilentTokenRequests.get(silentRequestKey);\n if (typeof cachedResponse === \"undefined\") {\n this.logger.verbose(\"acquireTokenSilent called for the first time, storing active request\", request.correlationId);\n const response = this.acquireTokenSilentAsync(request, account)\n .then((result) => {\n this.activeSilentTokenRequests.delete(silentRequestKey);\n return result;\n })\n .catch((error) => {\n this.activeSilentTokenRequests.delete(silentRequestKey);\n throw error;\n });\n this.activeSilentTokenRequests.set(silentRequestKey, response);\n return response;\n } else {\n this.logger.verbose(\"acquireTokenSilent has been called previously, returning the result from the first call\", request.correlationId);\n return cachedResponse;\n }\n }\n\n /**\n * Silently acquire an access token for a given set of scopes. Will use cached token if available, otherwise will attempt to acquire a new token from the network via refresh token.\n * @param {@link (SilentRequest:type)}\n * @param {@link (AccountInfo:type)}\n * @returns {Promise.<AuthenticationResult>} - a promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the {@link AuthResponse} \n */\n private async acquireTokenSilentAsync(request: SilentRequest, account: AccountInfo): Promise<AuthenticationResult>{\n const silentCacheClient = new SilentCacheClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, request.correlationId);\n const silentRequest = await silentCacheClient.initializeSilentRequest(request, account);\n this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_START, InteractionType.Silent, request);\n\n return silentCacheClient.acquireToken(silentRequest).catch(async () => {\n try {\n const tokenRenewalResult = await this.acquireTokenByRefreshToken(silentRequest);\n this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, InteractionType.Silent, tokenRenewalResult);\n return tokenRenewalResult;\n } catch (tokenRenewalError) {\n this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, InteractionType.Silent, null, tokenRenewalError);\n throw tokenRenewalError;\n }\n });\n }\n}\n"],"names":[],"mappings":";;;;;;;;;AAAA;;;;AAiBA;;;;;IAI6C,2CAAiB;;;;;;;;;;;;;;;;;;;;;;IA0B1D,iCAAY,aAA4B;QAAxC,YACI,kBAAM,aAAa,CAAC,SAGvB;QADG,KAAI,CAAC,yBAAyB,GAAG,IAAI,GAAG,EAAE,CAAC;;KAC9C;;;;;;;;;;IAWK,+CAAa,GAAnB,UAAoB,OAAyB;;;gBACzC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC;gBAC5C,sBAAO,IAAI,CAAC,oBAAoB,CAAC,OAAO,IAAI,eAAe,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AAC;;;;;;4CAExB,qBAAM,IAAI,CAAC,0BAA0B,CAAC,aAAa,CAAC,EAAA;;4CAAzE,kBAAkB,GAAG,SAAoD;4CAC/E,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,SAAS,CAAC,qBAAqB,EAAE,eAAe,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;4CACzG,sBAAO,kBAAkB,EAAC;;;4CAE1B,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,SAAS,CAAC,qBAAqB,EAAE,eAAe,CAAC,MAAM,EAAE,IAAI,EAAE,mBAAiB,CAAC,CAAC;4CAC9G,MAAM,mBAAiB,CAAC;;;;iCAE/B,CAAC,EAAC;;;;KACN;IACL,8BAAC;AAAD,CA9HA,CAA6C,iBAAiB;;;;"}
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-browser v2.20.0 2021-12-07 */
1
+ /*! @azure/msal-browser v2.21.0 2022-01-04 */
2
2
  'use strict';
3
3
  import { __awaiter, __generator } from '../_virtual/_tslib.js';
4
4
  import { BrowserAuthError, BrowserAuthErrorMessage } from '../error/BrowserAuthError.js';
@@ -1,4 +1,4 @@
1
- import { CommonAuthorizationCodeRequest, ICrypto, AccountEntity, IdTokenEntity, AccessTokenEntity, RefreshTokenEntity, AppMetadataEntity, CacheManager, ServerTelemetryEntity, ThrottlingEntity, Logger, AuthorityMetadataEntity, AccountInfo } from "@azure/msal-common";
1
+ import { CommonAuthorizationCodeRequest, ICrypto, AccountEntity, IdTokenEntity, AccessTokenEntity, RefreshTokenEntity, AppMetadataEntity, CacheManager, ServerTelemetryEntity, ThrottlingEntity, Logger, AuthorityMetadataEntity, AccountInfo, ValidCredentialType } from "@azure/msal-common";
2
2
  import { CacheOptions } from "../config/Configuration";
3
3
  import { InteractionType } from "../utils/BrowserConstants";
4
4
  /**
@@ -288,6 +288,10 @@ export declare class BrowserCacheManager extends CacheManager {
288
288
  * Returns username retrieved from ADAL or MSAL v1 idToken
289
289
  */
290
290
  getLegacyLoginHint(): string | null;
291
+ /**
292
+ * Updates a credential's cache key if the current cache key is outdated
293
+ */
294
+ updateCredentialCacheKey(currentCacheKey: string, credential: ValidCredentialType): string;
291
295
  }
292
296
  export declare const DEFAULT_BROWSER_CACHE_MANAGER: (clientId: string, logger: Logger) => BrowserCacheManager;
293
297
  //# sourceMappingURL=BrowserCacheManager.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BrowserCacheManager.d.ts","sourceRoot":"","sources":["../../src/cache/BrowserCacheManager.ts"],"names":[],"mappings":"AAKA,OAAO,EAA+C,8BAA8B,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,YAAY,EAAE,qBAAqB,EAAE,gBAAgB,EAAiB,MAAM,EAAE,uBAAuB,EAAiC,WAAW,EAA6C,MAAM,oBAAoB,CAAC;AAChZ,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,OAAO,EAAwB,eAAe,EAAyC,MAAM,2BAA2B,CAAC;AAMzH;;;;GAIG;AACH,qBAAa,mBAAoB,SAAQ,YAAY;IAGjD,OAAO,CAAC,WAAW,CAAyB;IAE5C,OAAO,CAAC,cAAc,CAAyB;IAE/C,OAAO,CAAC,eAAe,CAAwB;IAE/C,OAAO,CAAC,qBAAqB,CAAyB;IAEtD,OAAO,CAAC,MAAM,CAAS;IAGvB,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAuB;gBAElD,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,CAAC,YAAY,CAAC,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM;IAatG;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAmB3B;;;OAGG;IACH,OAAO,CAAC,0BAA0B;IAiBlC;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAiB3B;;;;;OAKG;IACH,OAAO,CAAC,iBAAiB;IAMzB;;;OAGG;IACH,OAAO,CAAC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AAC,EAAE,OAAO,GAAG,OAAO;IAUzD,wBAAwB,IAAI,MAAM,GAAG,IAAI;IAKzC,wBAAwB,CAAC,UAAU,EAAE,OAAO,GAAG,IAAI;IAYnD;;OAEG;IACH,kBAAkB,IAAI,MAAM,GAAG,IAAI;IAkCnC;;OAEG;IACH,wBAAwB,CAAC,eAAe,EAAE,MAAM,EAAE,UAAU,EAAE,mBAAmB,GAAG,MAAM;CAiB7F;AAED,eAAO,MAAM,6BAA6B,aAAc,MAAM,UAAU,MAAM,KAAG,mBAOhF,CAAC"}
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-browser v2.20.0 2021-12-07 */
1
+ /*! @azure/msal-browser v2.21.0 2022-01-04 */
2
2
  'use strict';
3
3
  import { __extends, __spread, __awaiter, __generator } from '../_virtual/_tslib.js';
4
4
  import { DEFAULT_CRYPTO_IMPLEMENTATION, AccountEntity, CacheManager, IdTokenEntity, AccessTokenEntity, RefreshTokenEntity, AppMetadataEntity, ServerTelemetryEntity, AuthorityMetadataEntity, PersistentCacheKeys, ThrottlingEntity, Constants, StringUtils, ProtocolUtils, CcsCredentialType, IdToken } from '@azure/msal-common';
@@ -759,6 +759,7 @@ var BrowserCacheManager = /** @class */ (function (_super) {
759
759
  }
760
760
  });
761
761
  this.clearMsalCookies();
762
+ this.setInteractionInProgress(false);
762
763
  };
763
764
  BrowserCacheManager.prototype.cacheCodeRequest = function (authCodeRequest, browserCrypto) {
764
765
  this.logger.trace("BrowserCacheManager.cacheCodeRequest called");
@@ -849,6 +850,25 @@ var BrowserCacheManager = /** @class */ (function (_super) {
849
850
  }
850
851
  return null;
851
852
  };
853
+ /**
854
+ * Updates a credential's cache key if the current cache key is outdated
855
+ */
856
+ BrowserCacheManager.prototype.updateCredentialCacheKey = function (currentCacheKey, credential) {
857
+ var updatedCacheKey = credential.generateCredentialKey();
858
+ if (currentCacheKey !== updatedCacheKey) {
859
+ var cacheItem = this.getItem(currentCacheKey);
860
+ if (cacheItem) {
861
+ this.removeItem(currentCacheKey);
862
+ this.setItem(updatedCacheKey, cacheItem);
863
+ this.logger.verbose("Updated an outdated " + credential.credentialType + " cache key");
864
+ return updatedCacheKey;
865
+ }
866
+ else {
867
+ this.logger.error("Attempted to update an outdated " + credential.credentialType + " cache key but no item matching the outdated key was found in storage");
868
+ }
869
+ }
870
+ return currentCacheKey;
871
+ };
852
872
  return BrowserCacheManager;
853
873
  }(CacheManager));
854
874
  var DEFAULT_BROWSER_CACHE_MANAGER = function (clientId, logger) {