@azure/msal-browser 2.22.1 → 2.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/_virtual/_tslib.js +1 -1
- package/dist/app/ClientApplication.d.ts +24 -1
- package/dist/app/ClientApplication.d.ts.map +1 -1
- package/dist/app/ClientApplication.js +137 -36
- package/dist/app/ClientApplication.js.map +1 -1
- package/dist/app/IPublicClientApplication.d.ts +3 -1
- package/dist/app/IPublicClientApplication.d.ts.map +1 -1
- package/dist/app/IPublicClientApplication.js +7 -1
- package/dist/app/IPublicClientApplication.js.map +1 -1
- package/dist/app/PublicClientApplication.d.ts.map +1 -1
- package/dist/app/PublicClientApplication.js +51 -15
- package/dist/app/PublicClientApplication.js.map +1 -1
- package/dist/cache/AsyncMemoryStorage.d.ts +3 -2
- package/dist/cache/AsyncMemoryStorage.d.ts.map +1 -1
- package/dist/cache/AsyncMemoryStorage.js +17 -6
- package/dist/cache/AsyncMemoryStorage.js.map +1 -1
- package/dist/cache/BrowserCacheManager.js +7 -7
- package/dist/cache/BrowserCacheManager.js.map +1 -1
- package/dist/cache/BrowserStorage.js +1 -1
- package/dist/cache/DatabaseStorage.d.ts +5 -0
- package/dist/cache/DatabaseStorage.d.ts.map +1 -1
- package/dist/cache/DatabaseStorage.js +65 -13
- package/dist/cache/DatabaseStorage.js.map +1 -1
- package/dist/cache/MemoryStorage.js +1 -1
- package/dist/cache/TokenCache.js +1 -1
- package/dist/config/Configuration.d.ts +14 -2
- package/dist/config/Configuration.d.ts.map +1 -1
- package/dist/config/Configuration.js +16 -9
- package/dist/config/Configuration.js.map +1 -1
- package/dist/crypto/BrowserCrypto.d.ts.map +1 -1
- package/dist/crypto/BrowserCrypto.js +7 -6
- package/dist/crypto/BrowserCrypto.js.map +1 -1
- package/dist/crypto/CryptoOps.d.ts +12 -3
- package/dist/crypto/CryptoOps.d.ts.map +1 -1
- package/dist/crypto/CryptoOps.js +71 -36
- package/dist/crypto/CryptoOps.js.map +1 -1
- package/dist/crypto/GuidGenerator.d.ts +3 -2
- package/dist/crypto/GuidGenerator.d.ts.map +1 -1
- package/dist/crypto/GuidGenerator.js +4 -3
- package/dist/crypto/GuidGenerator.js.map +1 -1
- package/dist/crypto/PkceGenerator.js +1 -1
- package/dist/crypto/SignedHttpRequest.js +1 -1
- package/dist/encode/Base64Decode.d.ts.map +1 -1
- package/dist/encode/Base64Decode.js +3 -2
- package/dist/encode/Base64Decode.js.map +1 -1
- package/dist/encode/Base64Encode.d.ts.map +1 -1
- package/dist/encode/Base64Encode.js +5 -4
- package/dist/encode/Base64Encode.js.map +1 -1
- package/dist/error/BrowserAuthError.js +1 -1
- package/dist/error/BrowserConfigurationAuthError.js +1 -1
- package/dist/event/EventHandler.js +1 -1
- package/dist/event/EventMessage.js +1 -1
- package/dist/event/EventType.js +1 -1
- package/dist/index.cjs.js +1071 -258
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/interaction_client/BaseInteractionClient.d.ts +3 -2
- package/dist/interaction_client/BaseInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/BaseInteractionClient.js +4 -3
- package/dist/interaction_client/BaseInteractionClient.js.map +1 -1
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.js +1 -1
- package/dist/interaction_client/PopupClient.d.ts.map +1 -1
- package/dist/interaction_client/PopupClient.js +3 -3
- package/dist/interaction_client/PopupClient.js.map +1 -1
- package/dist/interaction_client/RedirectClient.d.ts.map +1 -1
- package/dist/interaction_client/RedirectClient.js +4 -4
- package/dist/interaction_client/RedirectClient.js.map +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.d.ts +2 -2
- package/dist/interaction_client/SilentAuthCodeClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.js +5 -5
- package/dist/interaction_client/SilentAuthCodeClient.js.map +1 -1
- package/dist/interaction_client/SilentCacheClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentCacheClient.js +11 -3
- package/dist/interaction_client/SilentCacheClient.js.map +1 -1
- package/dist/interaction_client/SilentIframeClient.d.ts +2 -2
- package/dist/interaction_client/SilentIframeClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentIframeClient.js +21 -7
- package/dist/interaction_client/SilentIframeClient.js.map +1 -1
- package/dist/interaction_client/SilentRefreshClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentRefreshClient.js +16 -4
- package/dist/interaction_client/SilentRefreshClient.js.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.d.ts +2 -2
- package/dist/interaction_client/StandardInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.js +30 -16
- package/dist/interaction_client/StandardInteractionClient.js.map +1 -1
- package/dist/interaction_handler/InteractionHandler.js +1 -1
- package/dist/interaction_handler/PopupHandler.js +1 -1
- package/dist/interaction_handler/RedirectHandler.js +1 -1
- package/dist/interaction_handler/SilentHandler.js +1 -1
- package/dist/navigation/NavigationClient.js +1 -1
- package/dist/network/FetchClient.d.ts.map +1 -1
- package/dist/network/FetchClient.js +3 -2
- package/dist/network/FetchClient.js.map +1 -1
- package/dist/network/XhrClient.js +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.js +2 -2
- package/dist/packageMetadata.js.map +1 -1
- package/dist/telemetry/BrowserPerformanceClient.d.ts +19 -0
- package/dist/telemetry/BrowserPerformanceClient.d.ts.map +1 -0
- package/dist/telemetry/BrowserPerformanceClient.js +52 -0
- package/dist/telemetry/BrowserPerformanceClient.js.map +1 -0
- package/dist/telemetry/BrowserPerformanceMeasurement.d.ts +13 -0
- package/dist/telemetry/BrowserPerformanceMeasurement.d.ts.map +1 -0
- package/dist/telemetry/BrowserPerformanceMeasurement.js +66 -0
- package/dist/telemetry/BrowserPerformanceMeasurement.js.map +1 -0
- package/dist/utils/BrowserConstants.js +1 -1
- package/dist/utils/BrowserProtocolUtils.js +1 -1
- package/dist/utils/BrowserStringUtils.d.ts.map +1 -1
- package/dist/utils/BrowserStringUtils.js +4 -2
- package/dist/utils/BrowserStringUtils.js.map +1 -1
- package/dist/utils/BrowserUtils.js +2 -2
- package/dist/utils/BrowserUtils.js.map +1 -1
- package/dist/utils/MathUtils.js +1 -1
- package/dist/utils/PopupUtils.js +1 -1
- package/lib/msal-browser.js +1071 -258
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +41 -36
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -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.
|
|
62
|
+
<script type="text/javascript" src="https://alcdn.msauth.net/browser/2.23.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.
|
package/dist/_virtual/_tslib.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AccountInfo, INetworkModule, AuthenticationResult, Logger, CommonSilentFlowRequest, ICrypto } from "@azure/msal-common";
|
|
1
|
+
import { AccountInfo, INetworkModule, AuthenticationResult, Logger, CommonSilentFlowRequest, ICrypto, PerformanceCallbackFunction, IPerformanceClient, BaseAuthRequest } from "@azure/msal-common";
|
|
2
2
|
import { BrowserCacheManager } from "../cache/BrowserCacheManager";
|
|
3
3
|
import { BrowserConfiguration, Configuration } from "../config/Configuration";
|
|
4
4
|
import { InteractionType, WrapperSKU } from "../utils/BrowserConstants";
|
|
@@ -24,6 +24,7 @@ export declare abstract class ClientApplication {
|
|
|
24
24
|
protected eventHandler: EventHandler;
|
|
25
25
|
protected redirectResponse: Map<string, Promise<AuthenticationResult | null>>;
|
|
26
26
|
private hybridAuthCodeResponses;
|
|
27
|
+
protected performanceClient: IPerformanceClient;
|
|
27
28
|
/**
|
|
28
29
|
* @constructor
|
|
29
30
|
* Constructor for the PublicClientApplication used to instantiate the PublicClientApplication object
|
|
@@ -196,6 +197,20 @@ export declare abstract class ClientApplication {
|
|
|
196
197
|
* @param callbackId
|
|
197
198
|
*/
|
|
198
199
|
removeEventCallback(callbackId: string): void;
|
|
200
|
+
/**
|
|
201
|
+
* Registers a callback to receive performance events.
|
|
202
|
+
*
|
|
203
|
+
* @param {PerformanceCallbackFunction} callback
|
|
204
|
+
* @returns {string}
|
|
205
|
+
*/
|
|
206
|
+
addPerformanceCallback(callback: PerformanceCallbackFunction): string;
|
|
207
|
+
/**
|
|
208
|
+
* Removes a callback registered with addPerformanceCallback.
|
|
209
|
+
*
|
|
210
|
+
* @param {string} callbackId
|
|
211
|
+
* @returns {boolean}
|
|
212
|
+
*/
|
|
213
|
+
removePerformanceCallback(callbackId: string): boolean;
|
|
199
214
|
/**
|
|
200
215
|
* Adds event listener that emits an event when a user account is added or removed from localstorage in a different browser tab or window
|
|
201
216
|
*/
|
|
@@ -232,5 +247,13 @@ export declare abstract class ClientApplication {
|
|
|
232
247
|
* Returns the configuration object
|
|
233
248
|
*/
|
|
234
249
|
getConfiguration(): BrowserConfiguration;
|
|
250
|
+
/**
|
|
251
|
+
* Generates a correlation id for a request if none is provided.
|
|
252
|
+
*
|
|
253
|
+
* @protected
|
|
254
|
+
* @param {?Partial<BaseAuthRequest>} [request]
|
|
255
|
+
* @returns {string}
|
|
256
|
+
*/
|
|
257
|
+
protected getRequestCorrelationId(request?: Partial<BaseAuthRequest>): string;
|
|
235
258
|
}
|
|
236
259
|
//# sourceMappingURL=ClientApplication.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClientApplication.d.ts","sourceRoot":"","sources":["../../src/app/ClientApplication.ts"],"names":[],"mappings":"AAMA,OAAO,EAA0D,WAAW,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CAAC,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAKhE;;;OAGG;IACH,mBAAmB,CAAC,gBAAgB,EAAE,iBAAiB,GAAG,IAAI;IAI9D;;OAEG;IACH,gBAAgB,IAAI,oBAAoB;IAIxC;;;;;;OAMG;IACH,SAAS,CAAC,uBAAuB,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,MAAM;CAiBhF"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/*! @azure/msal-browser v2.
|
|
1
|
+
/*! @azure/msal-browser v2.23.0 2022-04-04 */
|
|
2
2
|
'use strict';
|
|
3
|
-
import { __awaiter, __generator } from '../_virtual/_tslib.js';
|
|
3
|
+
import { __awaiter, __generator, __assign } from '../_virtual/_tslib.js';
|
|
4
4
|
import { CryptoOps } from '../crypto/CryptoOps.js';
|
|
5
|
-
import { StringUtils, Logger,
|
|
5
|
+
import { Constants, PerformanceEvents, StringUtils, Logger, StubPerformanceClient, DEFAULT_CRYPTO_IMPLEMENTATION, ServerError, InteractionRequiredAuthError } from '@azure/msal-common';
|
|
6
6
|
import { BrowserCacheManager, DEFAULT_BROWSER_CACHE_MANAGER } from '../cache/BrowserCacheManager.js';
|
|
7
7
|
import { buildConfiguration } from '../config/Configuration.js';
|
|
8
8
|
import { InteractionType, TemporaryCacheKeys, ApiId, BrowserCacheLocation, BrowserConstants } from '../utils/BrowserConstants.js';
|
|
@@ -18,6 +18,7 @@ import { SilentRefreshClient } from '../interaction_client/SilentRefreshClient.j
|
|
|
18
18
|
import { TokenCache } from '../cache/TokenCache.js';
|
|
19
19
|
import { SilentAuthCodeClient } from '../interaction_client/SilentAuthCodeClient.js';
|
|
20
20
|
import { BrowserAuthError } from '../error/BrowserAuthError.js';
|
|
21
|
+
import { BrowserPerformanceClient } from '../telemetry/BrowserPerformanceClient.js';
|
|
21
22
|
|
|
22
23
|
/*
|
|
23
24
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -64,8 +65,12 @@ var ClientApplication = /** @class */ (function () {
|
|
|
64
65
|
this.redirectResponse = new Map();
|
|
65
66
|
// Initial hybrid spa map
|
|
66
67
|
this.hybridAuthCodeResponses = new Map();
|
|
68
|
+
// Initialize performance client
|
|
69
|
+
this.performanceClient = this.isBrowserEnvironment ?
|
|
70
|
+
new BrowserPerformanceClient(this.config.auth.clientId, this.config.auth.authority, this.logger, name, version, this.config.telemetry.application) :
|
|
71
|
+
new StubPerformanceClient(this.config.auth.clientId, this.config.auth.authority, this.logger, name, version, this.config.telemetry.application);
|
|
67
72
|
// Initialize the crypto class.
|
|
68
|
-
this.browserCrypto = this.isBrowserEnvironment ? new CryptoOps(this.logger) : DEFAULT_CRYPTO_IMPLEMENTATION;
|
|
73
|
+
this.browserCrypto = this.isBrowserEnvironment ? new CryptoOps(this.logger, this.performanceClient) : DEFAULT_CRYPTO_IMPLEMENTATION;
|
|
69
74
|
this.eventHandler = new EventHandler(this.logger, this.browserCrypto);
|
|
70
75
|
// Initialize the browser storage class.
|
|
71
76
|
this.browserStorage = this.isBrowserEnvironment ?
|
|
@@ -95,8 +100,8 @@ var ClientApplication = /** @class */ (function () {
|
|
|
95
100
|
if (typeof response === "undefined") {
|
|
96
101
|
this.eventHandler.emitEvent(EventType.HANDLE_REDIRECT_START, InteractionType.Redirect);
|
|
97
102
|
this.logger.verbose("handleRedirectPromise has been called for the first time, storing the promise");
|
|
98
|
-
correlationId = this.browserStorage.getTemporaryCache(TemporaryCacheKeys.CORRELATION_ID, true) ||
|
|
99
|
-
redirectClient = new RedirectClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, correlationId);
|
|
103
|
+
correlationId = this.browserStorage.getTemporaryCache(TemporaryCacheKeys.CORRELATION_ID, true) || Constants.EMPTY_STRING;
|
|
104
|
+
redirectClient = new RedirectClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, correlationId);
|
|
100
105
|
response = redirectClient.handleRedirectPromise(hash)
|
|
101
106
|
.then(function (result) {
|
|
102
107
|
if (result) {
|
|
@@ -148,11 +153,11 @@ var ClientApplication = /** @class */ (function () {
|
|
|
148
153
|
*/
|
|
149
154
|
ClientApplication.prototype.acquireTokenRedirect = function (request) {
|
|
150
155
|
return __awaiter(this, void 0, void 0, function () {
|
|
151
|
-
var isLoggedIn, redirectClient;
|
|
156
|
+
var correlationId, isLoggedIn, redirectClient;
|
|
152
157
|
var _this = this;
|
|
153
158
|
return __generator(this, function (_a) {
|
|
154
|
-
|
|
155
|
-
this.logger.verbose("acquireTokenRedirect called");
|
|
159
|
+
correlationId = this.getRequestCorrelationId(request);
|
|
160
|
+
this.logger.verbose("acquireTokenRedirect called", correlationId);
|
|
156
161
|
this.preflightBrowserEnvironmentCheck(InteractionType.Redirect);
|
|
157
162
|
isLoggedIn = this.getAllAccounts().length > 0;
|
|
158
163
|
if (isLoggedIn) {
|
|
@@ -161,8 +166,8 @@ var ClientApplication = /** @class */ (function () {
|
|
|
161
166
|
else {
|
|
162
167
|
this.eventHandler.emitEvent(EventType.LOGIN_START, InteractionType.Redirect, request);
|
|
163
168
|
}
|
|
164
|
-
redirectClient = new RedirectClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient,
|
|
165
|
-
return [2 /*return*/, redirectClient.acquireToken(request).catch(function (e) {
|
|
169
|
+
redirectClient = new RedirectClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, correlationId);
|
|
170
|
+
return [2 /*return*/, redirectClient.acquireToken(__assign(__assign({}, request), { correlationId: correlationId })).catch(function (e) {
|
|
166
171
|
// If logged in, emit acquire token events
|
|
167
172
|
if (isLoggedIn) {
|
|
168
173
|
_this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, InteractionType.Redirect, null, e);
|
|
@@ -186,8 +191,9 @@ var ClientApplication = /** @class */ (function () {
|
|
|
186
191
|
*/
|
|
187
192
|
ClientApplication.prototype.acquireTokenPopup = function (request) {
|
|
188
193
|
var _this = this;
|
|
194
|
+
var correlationId = this.getRequestCorrelationId(request);
|
|
189
195
|
try {
|
|
190
|
-
this.logger.verbose("acquireTokenPopup called",
|
|
196
|
+
this.logger.verbose("acquireTokenPopup called", correlationId);
|
|
191
197
|
this.preflightBrowserEnvironmentCheck(InteractionType.Popup);
|
|
192
198
|
}
|
|
193
199
|
catch (e) {
|
|
@@ -202,8 +208,8 @@ var ClientApplication = /** @class */ (function () {
|
|
|
202
208
|
else {
|
|
203
209
|
this.eventHandler.emitEvent(EventType.LOGIN_START, InteractionType.Popup, request);
|
|
204
210
|
}
|
|
205
|
-
var popupClient = new PopupClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient,
|
|
206
|
-
return popupClient.acquireToken(request).then(function (result) {
|
|
211
|
+
var popupClient = new PopupClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, correlationId);
|
|
212
|
+
return popupClient.acquireToken(__assign(__assign({}, request), { correlationId: correlationId })).then(function (result) {
|
|
207
213
|
// If logged in, emit acquire token events
|
|
208
214
|
var isLoggingIn = loggedInAccounts.length < _this.getAllAccounts().length;
|
|
209
215
|
if (isLoggingIn) {
|
|
@@ -243,25 +249,35 @@ var ClientApplication = /** @class */ (function () {
|
|
|
243
249
|
*/
|
|
244
250
|
ClientApplication.prototype.ssoSilent = function (request) {
|
|
245
251
|
return __awaiter(this, void 0, void 0, function () {
|
|
246
|
-
var silentIframeClient, silentTokenResult, e_1;
|
|
252
|
+
var correlationId, ssoSilentMeasurement, silentIframeClient, silentTokenResult, e_1;
|
|
247
253
|
return __generator(this, function (_a) {
|
|
248
254
|
switch (_a.label) {
|
|
249
255
|
case 0:
|
|
256
|
+
correlationId = this.getRequestCorrelationId(request);
|
|
250
257
|
this.preflightBrowserEnvironmentCheck(InteractionType.Silent);
|
|
251
|
-
this.
|
|
258
|
+
ssoSilentMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.SsoSilent, correlationId);
|
|
259
|
+
this.logger.verbose("ssoSilent called", correlationId);
|
|
252
260
|
this.eventHandler.emitEvent(EventType.SSO_SILENT_START, InteractionType.Silent, request);
|
|
253
261
|
_a.label = 1;
|
|
254
262
|
case 1:
|
|
255
263
|
_a.trys.push([1, 3, , 4]);
|
|
256
|
-
silentIframeClient = new SilentIframeClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.ssoSilent,
|
|
257
|
-
return [4 /*yield*/, silentIframeClient.acquireToken(request)];
|
|
264
|
+
silentIframeClient = new SilentIframeClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.ssoSilent, this.performanceClient, correlationId);
|
|
265
|
+
return [4 /*yield*/, silentIframeClient.acquireToken(__assign(__assign({}, request), { correlationId: correlationId }))];
|
|
258
266
|
case 2:
|
|
259
267
|
silentTokenResult = _a.sent();
|
|
260
268
|
this.eventHandler.emitEvent(EventType.SSO_SILENT_SUCCESS, InteractionType.Silent, silentTokenResult);
|
|
269
|
+
ssoSilentMeasurement.endMeasurement({
|
|
270
|
+
success: true
|
|
271
|
+
});
|
|
272
|
+
ssoSilentMeasurement.flushMeasurement();
|
|
261
273
|
return [2 /*return*/, silentTokenResult];
|
|
262
274
|
case 3:
|
|
263
275
|
e_1 = _a.sent();
|
|
264
276
|
this.eventHandler.emitEvent(EventType.SSO_SILENT_FAILURE, InteractionType.Silent, null, e_1);
|
|
277
|
+
ssoSilentMeasurement.endMeasurement({
|
|
278
|
+
success: false
|
|
279
|
+
});
|
|
280
|
+
ssoSilentMeasurement.flushMeasurement();
|
|
265
281
|
throw e_1;
|
|
266
282
|
case 4: return [2 /*return*/];
|
|
267
283
|
}
|
|
@@ -280,38 +296,56 @@ var ClientApplication = /** @class */ (function () {
|
|
|
280
296
|
*/
|
|
281
297
|
ClientApplication.prototype.acquireTokenByCode = function (request) {
|
|
282
298
|
return __awaiter(this, void 0, void 0, function () {
|
|
283
|
-
var response;
|
|
299
|
+
var correlationId, atbcMeasurement, response;
|
|
284
300
|
var _this = this;
|
|
285
301
|
return __generator(this, function (_a) {
|
|
302
|
+
correlationId = this.getRequestCorrelationId(request);
|
|
286
303
|
this.preflightBrowserEnvironmentCheck(InteractionType.Silent);
|
|
287
|
-
this.logger.trace("acquireTokenByCode called",
|
|
304
|
+
this.logger.trace("acquireTokenByCode called", correlationId);
|
|
288
305
|
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_BY_CODE_START, InteractionType.Silent, request);
|
|
306
|
+
atbcMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.AcquireTokenByCode, request.correlationId);
|
|
289
307
|
try {
|
|
290
308
|
if (!request.code) {
|
|
291
309
|
throw BrowserAuthError.createAuthCodeRequiredError();
|
|
292
310
|
}
|
|
293
311
|
response = this.hybridAuthCodeResponses.get(request.code);
|
|
294
312
|
if (!response) {
|
|
295
|
-
this.logger.verbose("Initiating new acquireTokenByCode request",
|
|
296
|
-
response = this.acquireTokenByCodeAsync(request)
|
|
313
|
+
this.logger.verbose("Initiating new acquireTokenByCode request", correlationId);
|
|
314
|
+
response = this.acquireTokenByCodeAsync(__assign(__assign({}, request), { correlationId: correlationId }))
|
|
297
315
|
.then(function (result) {
|
|
298
316
|
_this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_BY_CODE_SUCCESS, InteractionType.Silent, result);
|
|
299
317
|
_this.hybridAuthCodeResponses.delete(request.code);
|
|
318
|
+
atbcMeasurement.endMeasurement({
|
|
319
|
+
success: true
|
|
320
|
+
});
|
|
321
|
+
atbcMeasurement.flushMeasurement();
|
|
300
322
|
return result;
|
|
301
323
|
})
|
|
302
324
|
.catch(function (error) {
|
|
303
325
|
_this.hybridAuthCodeResponses.delete(request.code);
|
|
326
|
+
_this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_BY_CODE_FAILURE, InteractionType.Silent, null, error);
|
|
327
|
+
atbcMeasurement.endMeasurement({
|
|
328
|
+
success: false
|
|
329
|
+
});
|
|
330
|
+
atbcMeasurement.flushMeasurement();
|
|
304
331
|
throw error;
|
|
305
332
|
});
|
|
306
333
|
this.hybridAuthCodeResponses.set(request.code, response);
|
|
307
334
|
}
|
|
308
335
|
else {
|
|
309
336
|
this.logger.verbose("Existing acquireTokenByCode request found", request.correlationId);
|
|
337
|
+
atbcMeasurement.endMeasurement({
|
|
338
|
+
success: true
|
|
339
|
+
});
|
|
340
|
+
atbcMeasurement.discardMeasurement();
|
|
310
341
|
}
|
|
311
342
|
return [2 /*return*/, response];
|
|
312
343
|
}
|
|
313
344
|
catch (e) {
|
|
314
345
|
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_BY_CODE_FAILURE, InteractionType.Silent, null, e);
|
|
346
|
+
atbcMeasurement.endMeasurement({
|
|
347
|
+
success: false
|
|
348
|
+
});
|
|
315
349
|
throw e;
|
|
316
350
|
}
|
|
317
351
|
return [2 /*return*/];
|
|
@@ -330,7 +364,7 @@ var ClientApplication = /** @class */ (function () {
|
|
|
330
364
|
switch (_a.label) {
|
|
331
365
|
case 0:
|
|
332
366
|
this.logger.trace("acquireTokenByCodeAsync called", request.correlationId);
|
|
333
|
-
silentAuthCodeClient = new SilentAuthCodeClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.acquireTokenByCode, request.correlationId);
|
|
367
|
+
silentAuthCodeClient = new SilentAuthCodeClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.acquireTokenByCode, this.performanceClient, request.correlationId);
|
|
334
368
|
return [4 /*yield*/, silentAuthCodeClient.acquireToken(request)];
|
|
335
369
|
case 1:
|
|
336
370
|
silentTokenResult = _a.sent();
|
|
@@ -352,22 +386,47 @@ var ClientApplication = /** @class */ (function () {
|
|
|
352
386
|
*/
|
|
353
387
|
ClientApplication.prototype.acquireTokenByRefreshToken = function (request) {
|
|
354
388
|
return __awaiter(this, void 0, void 0, function () {
|
|
355
|
-
var silentRefreshClient;
|
|
389
|
+
var atbrtMeasurement, silentRefreshClient;
|
|
356
390
|
var _this = this;
|
|
357
391
|
return __generator(this, function (_a) {
|
|
358
|
-
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_NETWORK_START, InteractionType.Silent, request);
|
|
359
392
|
// block the reload if it occurred inside a hidden iframe
|
|
360
393
|
BrowserUtils.blockReloadInHiddenIframes();
|
|
361
|
-
|
|
362
|
-
|
|
394
|
+
atbrtMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.AcquireTokenByRefreshToken, request.correlationId);
|
|
395
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_NETWORK_START, InteractionType.Silent, request);
|
|
396
|
+
silentRefreshClient = new SilentRefreshClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, request.correlationId);
|
|
397
|
+
return [2 /*return*/, silentRefreshClient.acquireToken(request)
|
|
398
|
+
.then(function (result) {
|
|
399
|
+
atbrtMeasurement.endMeasurement({
|
|
400
|
+
success: true,
|
|
401
|
+
fromCache: result.fromCache
|
|
402
|
+
});
|
|
403
|
+
return result;
|
|
404
|
+
})
|
|
405
|
+
.catch(function (e) {
|
|
363
406
|
var isServerError = e instanceof ServerError;
|
|
364
407
|
var isInteractionRequiredError = e instanceof InteractionRequiredAuthError;
|
|
365
408
|
var isInvalidGrantError = (e.errorCode === BrowserConstants.INVALID_GRANT_ERROR);
|
|
366
409
|
if (isServerError && isInvalidGrantError && !isInteractionRequiredError) {
|
|
367
410
|
_this.logger.verbose("Refresh token expired or invalid, attempting acquire token by iframe", request.correlationId);
|
|
368
|
-
var silentIframeClient = new SilentIframeClient(_this.config, _this.browserStorage, _this.browserCrypto, _this.logger, _this.eventHandler, _this.navigationClient, ApiId.acquireTokenSilent_authCode, request.correlationId);
|
|
369
|
-
return silentIframeClient.acquireToken(request)
|
|
411
|
+
var silentIframeClient = new SilentIframeClient(_this.config, _this.browserStorage, _this.browserCrypto, _this.logger, _this.eventHandler, _this.navigationClient, ApiId.acquireTokenSilent_authCode, _this.performanceClient, request.correlationId);
|
|
412
|
+
return silentIframeClient.acquireToken(request)
|
|
413
|
+
.then(function (result) {
|
|
414
|
+
atbrtMeasurement.endMeasurement({
|
|
415
|
+
success: true,
|
|
416
|
+
fromCache: result.fromCache
|
|
417
|
+
});
|
|
418
|
+
return result;
|
|
419
|
+
})
|
|
420
|
+
.catch(function (error) {
|
|
421
|
+
atbrtMeasurement.endMeasurement({
|
|
422
|
+
success: false
|
|
423
|
+
});
|
|
424
|
+
throw error;
|
|
425
|
+
});
|
|
370
426
|
}
|
|
427
|
+
atbrtMeasurement.endMeasurement({
|
|
428
|
+
success: false
|
|
429
|
+
});
|
|
371
430
|
throw e;
|
|
372
431
|
})];
|
|
373
432
|
});
|
|
@@ -382,9 +441,11 @@ var ClientApplication = /** @class */ (function () {
|
|
|
382
441
|
*/
|
|
383
442
|
ClientApplication.prototype.logout = function (logoutRequest) {
|
|
384
443
|
return __awaiter(this, void 0, void 0, function () {
|
|
444
|
+
var correlationId;
|
|
385
445
|
return __generator(this, function (_a) {
|
|
386
|
-
this.
|
|
387
|
-
|
|
446
|
+
correlationId = this.getRequestCorrelationId(logoutRequest);
|
|
447
|
+
this.logger.warning("logout API is deprecated and will be removed in msal-browser v3.0.0. Use logoutRedirect instead.", correlationId);
|
|
448
|
+
return [2 /*return*/, this.logoutRedirect(__assign({ correlationId: correlationId }, logoutRequest))];
|
|
388
449
|
});
|
|
389
450
|
});
|
|
390
451
|
};
|
|
@@ -395,11 +456,12 @@ var ClientApplication = /** @class */ (function () {
|
|
|
395
456
|
*/
|
|
396
457
|
ClientApplication.prototype.logoutRedirect = function (logoutRequest) {
|
|
397
458
|
return __awaiter(this, void 0, void 0, function () {
|
|
398
|
-
var redirectClient;
|
|
459
|
+
var correlationId, redirectClient;
|
|
399
460
|
return __generator(this, function (_a) {
|
|
461
|
+
correlationId = this.getRequestCorrelationId(logoutRequest);
|
|
400
462
|
this.preflightBrowserEnvironmentCheck(InteractionType.Redirect);
|
|
401
|
-
redirectClient = new RedirectClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient,
|
|
402
|
-
return [2 /*return*/, redirectClient.logout(logoutRequest)];
|
|
463
|
+
redirectClient = new RedirectClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, correlationId);
|
|
464
|
+
return [2 /*return*/, redirectClient.logout(__assign({ correlationId: correlationId }, logoutRequest))];
|
|
403
465
|
});
|
|
404
466
|
});
|
|
405
467
|
};
|
|
@@ -409,9 +471,10 @@ var ClientApplication = /** @class */ (function () {
|
|
|
409
471
|
*/
|
|
410
472
|
ClientApplication.prototype.logoutPopup = function (logoutRequest) {
|
|
411
473
|
try {
|
|
474
|
+
var correlationId = this.getRequestCorrelationId(logoutRequest);
|
|
412
475
|
this.preflightBrowserEnvironmentCheck(InteractionType.Popup);
|
|
413
|
-
var popupClient = new PopupClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient,
|
|
414
|
-
return popupClient.logout(logoutRequest);
|
|
476
|
+
var popupClient = new PopupClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, correlationId);
|
|
477
|
+
return popupClient.logout(__assign({ correlationId: correlationId }, logoutRequest));
|
|
415
478
|
}
|
|
416
479
|
catch (e) {
|
|
417
480
|
// Since this function is syncronous we need to reject
|
|
@@ -553,6 +616,24 @@ var ClientApplication = /** @class */ (function () {
|
|
|
553
616
|
ClientApplication.prototype.removeEventCallback = function (callbackId) {
|
|
554
617
|
this.eventHandler.removeEventCallback(callbackId);
|
|
555
618
|
};
|
|
619
|
+
/**
|
|
620
|
+
* Registers a callback to receive performance events.
|
|
621
|
+
*
|
|
622
|
+
* @param {PerformanceCallbackFunction} callback
|
|
623
|
+
* @returns {string}
|
|
624
|
+
*/
|
|
625
|
+
ClientApplication.prototype.addPerformanceCallback = function (callback) {
|
|
626
|
+
return this.performanceClient.addPerformanceCallback(callback);
|
|
627
|
+
};
|
|
628
|
+
/**
|
|
629
|
+
* Removes a callback registered with addPerformanceCallback.
|
|
630
|
+
*
|
|
631
|
+
* @param {string} callbackId
|
|
632
|
+
* @returns {boolean}
|
|
633
|
+
*/
|
|
634
|
+
ClientApplication.prototype.removePerformanceCallback = function (callbackId) {
|
|
635
|
+
return this.performanceClient.removePerformanceCallback(callbackId);
|
|
636
|
+
};
|
|
556
637
|
/**
|
|
557
638
|
* Adds event listener that emits an event when a user account is added or removed from localstorage in a different browser tab or window
|
|
558
639
|
*/
|
|
@@ -606,6 +687,26 @@ var ClientApplication = /** @class */ (function () {
|
|
|
606
687
|
ClientApplication.prototype.getConfiguration = function () {
|
|
607
688
|
return this.config;
|
|
608
689
|
};
|
|
690
|
+
/**
|
|
691
|
+
* Generates a correlation id for a request if none is provided.
|
|
692
|
+
*
|
|
693
|
+
* @protected
|
|
694
|
+
* @param {?Partial<BaseAuthRequest>} [request]
|
|
695
|
+
* @returns {string}
|
|
696
|
+
*/
|
|
697
|
+
ClientApplication.prototype.getRequestCorrelationId = function (request) {
|
|
698
|
+
if (request === null || request === void 0 ? void 0 : request.correlationId) {
|
|
699
|
+
return request.correlationId;
|
|
700
|
+
}
|
|
701
|
+
if (this.isBrowserEnvironment) {
|
|
702
|
+
return this.browserCrypto.createNewGuid();
|
|
703
|
+
}
|
|
704
|
+
/*
|
|
705
|
+
* Included for fallback for non-browser environments,
|
|
706
|
+
* and to ensure this method always returns a string.
|
|
707
|
+
*/
|
|
708
|
+
return Constants.EMPTY_STRING;
|
|
709
|
+
};
|
|
609
710
|
return ClientApplication;
|
|
610
711
|
}());
|
|
611
712
|
|