@azure/msal-browser 3.3.0 → 3.4.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/dist/app/IPublicClientApplication.mjs +1 -1
- package/dist/app/PublicClientApplication.d.ts.map +1 -1
- package/dist/app/PublicClientApplication.mjs +3 -4
- package/dist/app/PublicClientApplication.mjs.map +1 -1
- package/dist/app/PublicClientNext.d.ts.map +1 -1
- package/dist/app/PublicClientNext.mjs +4 -6
- package/dist/app/PublicClientNext.mjs.map +1 -1
- package/dist/broker/nativeBroker/NativeMessageHandler.mjs +1 -1
- package/dist/broker/nativeBroker/NativeStatusCodes.mjs +1 -1
- package/dist/cache/AsyncMemoryStorage.mjs +1 -1
- package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
- package/dist/cache/BrowserCacheManager.mjs +20 -20
- package/dist/cache/BrowserCacheManager.mjs.map +1 -1
- package/dist/cache/BrowserStorage.mjs +1 -1
- package/dist/cache/CryptoKeyStore.mjs +1 -1
- package/dist/cache/DatabaseStorage.mjs +1 -1
- package/dist/cache/MemoryStorage.mjs +1 -1
- package/dist/cache/TokenCache.d.ts.map +1 -1
- package/dist/cache/TokenCache.mjs +5 -5
- package/dist/cache/TokenCache.mjs.map +1 -1
- package/dist/config/Configuration.mjs +1 -1
- package/dist/controllers/ControllerFactory.d.ts +2 -8
- package/dist/controllers/ControllerFactory.d.ts.map +1 -1
- package/dist/controllers/ControllerFactory.mjs +21 -38
- package/dist/controllers/ControllerFactory.mjs.map +1 -1
- package/dist/controllers/IController.d.ts +1 -2
- package/dist/controllers/IController.d.ts.map +1 -1
- package/dist/controllers/NestedAppAuthController.mjs +1 -1
- package/dist/controllers/StandardController.d.ts +4 -4
- package/dist/controllers/StandardController.d.ts.map +1 -1
- package/dist/controllers/StandardController.mjs +29 -31
- package/dist/controllers/StandardController.mjs.map +1 -1
- package/dist/controllers/UnknownOperatingContextController.mjs +1 -1
- package/dist/crypto/BrowserCrypto.mjs +1 -1
- package/dist/crypto/CryptoOps.mjs +1 -1
- package/dist/crypto/PkceGenerator.mjs +1 -1
- package/dist/crypto/SignedHttpRequest.mjs +1 -1
- package/dist/encode/Base64Decode.mjs +1 -1
- package/dist/encode/Base64Encode.mjs +1 -1
- package/dist/error/BrowserAuthError.mjs +1 -1
- package/dist/error/BrowserAuthErrorCodes.mjs +1 -1
- package/dist/error/BrowserConfigurationAuthError.mjs +1 -1
- package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +1 -1
- package/dist/error/NativeAuthError.mjs +1 -1
- package/dist/error/NativeAuthErrorCodes.mjs +1 -1
- package/dist/error/NestedAppAuthError.mjs +1 -1
- package/dist/event/EventHandler.mjs +1 -1
- package/dist/event/EventMessage.mjs +1 -1
- package/dist/event/EventType.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/interaction_client/BaseInteractionClient.mjs +1 -1
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
- package/dist/interaction_client/NativeInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/NativeInteractionClient.mjs +4 -4
- package/dist/interaction_client/NativeInteractionClient.mjs.map +1 -1
- package/dist/interaction_client/PopupClient.d.ts +1 -2
- package/dist/interaction_client/PopupClient.d.ts.map +1 -1
- package/dist/interaction_client/PopupClient.mjs +9 -22
- package/dist/interaction_client/PopupClient.mjs.map +1 -1
- package/dist/interaction_client/RedirectClient.d.ts.map +1 -1
- package/dist/interaction_client/RedirectClient.mjs +11 -19
- package/dist/interaction_client/RedirectClient.mjs.map +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.mjs +3 -5
- package/dist/interaction_client/SilentAuthCodeClient.mjs.map +1 -1
- package/dist/interaction_client/SilentCacheClient.mjs +1 -1
- package/dist/interaction_client/SilentIframeClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentIframeClient.mjs +4 -9
- package/dist/interaction_client/SilentIframeClient.mjs.map +1 -1
- package/dist/interaction_client/SilentRefreshClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentRefreshClient.mjs +2 -12
- package/dist/interaction_client/SilentRefreshClient.mjs.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.mjs +1 -1
- package/dist/interaction_handler/InteractionHandler.d.ts +6 -13
- package/dist/interaction_handler/InteractionHandler.d.ts.map +1 -1
- package/dist/interaction_handler/InteractionHandler.mjs +29 -56
- package/dist/interaction_handler/InteractionHandler.mjs.map +1 -1
- package/dist/interaction_handler/RedirectHandler.d.ts +14 -7
- package/dist/interaction_handler/RedirectHandler.d.ts.map +1 -1
- package/dist/interaction_handler/RedirectHandler.mjs +28 -9
- package/dist/interaction_handler/RedirectHandler.mjs.map +1 -1
- package/dist/interaction_handler/SilentHandler.mjs +1 -1
- package/dist/naa/BridgeError.mjs +1 -1
- package/dist/naa/BridgeProxy.mjs +1 -1
- package/dist/naa/BridgeStatusCode.mjs +1 -1
- package/dist/naa/mapping/NestedAppAuthAdapter.mjs +1 -1
- package/dist/navigation/NavigationClient.mjs +1 -1
- package/dist/network/FetchClient.mjs +1 -1
- package/dist/operatingcontext/BaseOperatingContext.mjs +1 -1
- package/dist/operatingcontext/StandardOperatingContext.mjs +1 -1
- package/dist/operatingcontext/TeamsAppOperatingContext.mjs +1 -1
- package/dist/operatingcontext/UnknownOperatingContext.mjs +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.mjs +2 -2
- package/dist/telemetry/BrowserPerformanceClient.mjs +1 -1
- package/dist/telemetry/BrowserPerformanceMeasurement.mjs +1 -1
- package/dist/utils/BrowserConstants.mjs +1 -1
- package/dist/utils/BrowserProtocolUtils.mjs +1 -1
- package/dist/utils/BrowserUtils.mjs +1 -1
- package/lib/msal-browser.cjs +18564 -61
- package/lib/msal-browser.cjs.map +1 -1
- package/lib/msal-browser.js +2828 -3394
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +67 -66
- package/package.json +2 -2
- package/src/app/PublicClientApplication.ts +4 -3
- package/src/app/PublicClientNext.ts +7 -5
- package/src/cache/BrowserCacheManager.ts +22 -40
- package/src/cache/TokenCache.ts +5 -4
- package/src/controllers/ControllerFactory.ts +30 -49
- package/src/controllers/IController.ts +0 -6
- package/src/controllers/StandardController.ts +42 -46
- package/src/interaction_client/NativeInteractionClient.ts +4 -3
- package/src/interaction_client/PopupClient.ts +39 -60
- package/src/interaction_client/RedirectClient.ts +41 -46
- package/src/interaction_client/SilentAuthCodeClient.ts +1 -12
- package/src/interaction_client/SilentIframeClient.ts +2 -18
- package/src/interaction_client/SilentRefreshClient.ts +5 -19
- package/src/interaction_handler/InteractionHandler.ts +34 -104
- package/src/interaction_handler/RedirectHandler.ts +48 -22
- package/src/packageMetadata.ts +1 -1
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
ICrypto,
|
|
21
21
|
ProtocolMode,
|
|
22
22
|
ServerResponseType,
|
|
23
|
+
invokeAsync,
|
|
23
24
|
} from "@azure/msal-common";
|
|
24
25
|
import { StandardInteractionClient } from "./StandardInteractionClient";
|
|
25
26
|
import { EventType } from "../event/EventType";
|
|
@@ -42,15 +43,12 @@ import { INavigationClient } from "../navigation/INavigationClient";
|
|
|
42
43
|
import { EventHandler } from "../event/EventHandler";
|
|
43
44
|
import { BrowserCacheManager } from "../cache/BrowserCacheManager";
|
|
44
45
|
import { BrowserConfiguration } from "../config/Configuration";
|
|
45
|
-
import {
|
|
46
|
-
InteractionHandler,
|
|
47
|
-
InteractionParams,
|
|
48
|
-
} from "../interaction_handler/InteractionHandler";
|
|
46
|
+
import { InteractionHandler } from "../interaction_handler/InteractionHandler";
|
|
49
47
|
import { PopupWindowAttributes } from "../request/PopupWindowAttributes";
|
|
50
48
|
import { EventError } from "../event/EventMessage";
|
|
51
49
|
import { AuthenticationResult } from "../response/AuthenticationResult";
|
|
52
50
|
|
|
53
|
-
export type PopupParams =
|
|
51
|
+
export type PopupParams = {
|
|
54
52
|
popup?: Window | null;
|
|
55
53
|
popupName: string;
|
|
56
54
|
popupWindowAttributes: PopupWindowAttributes;
|
|
@@ -203,44 +201,39 @@ export class PopupClient extends StandardInteractionClient {
|
|
|
203
201
|
ApiId.acquireTokenPopup
|
|
204
202
|
);
|
|
205
203
|
|
|
206
|
-
|
|
204
|
+
const validRequest = await invokeAsync(
|
|
205
|
+
this.initializeAuthorizationRequest.bind(this),
|
|
207
206
|
PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest,
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
);
|
|
207
|
+
this.logger,
|
|
208
|
+
this.performanceClient,
|
|
209
|
+
this.correlationId
|
|
210
|
+
)(request, InteractionType.Popup);
|
|
211
|
+
|
|
214
212
|
BrowserUtils.preconnect(validRequest.authority);
|
|
215
|
-
this.browserStorage.updateCacheEntries(
|
|
216
|
-
validRequest.state,
|
|
217
|
-
validRequest.nonce,
|
|
218
|
-
validRequest.authority,
|
|
219
|
-
validRequest.loginHint || Constants.EMPTY_STRING,
|
|
220
|
-
validRequest.account || null
|
|
221
|
-
);
|
|
222
213
|
|
|
223
214
|
try {
|
|
224
215
|
// Create auth code request and generate PKCE params
|
|
225
|
-
this.performanceClient.setPreQueueTime(
|
|
226
|
-
PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest,
|
|
227
|
-
request.correlationId
|
|
228
|
-
);
|
|
229
216
|
const authCodeRequest: CommonAuthorizationCodeRequest =
|
|
230
|
-
await
|
|
217
|
+
await invokeAsync(
|
|
218
|
+
this.initializeAuthorizationCodeRequest.bind(this),
|
|
219
|
+
PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest,
|
|
220
|
+
this.logger,
|
|
221
|
+
this.performanceClient,
|
|
222
|
+
this.correlationId
|
|
223
|
+
)(validRequest);
|
|
231
224
|
|
|
232
225
|
// Initialize the client
|
|
233
|
-
|
|
226
|
+
const authClient: AuthorizationCodeClient = await invokeAsync(
|
|
227
|
+
this.createAuthCodeClient.bind(this),
|
|
234
228
|
PerformanceEvents.StandardInteractionClientCreateAuthCodeClient,
|
|
235
|
-
|
|
229
|
+
this.logger,
|
|
230
|
+
this.performanceClient,
|
|
231
|
+
this.correlationId
|
|
232
|
+
)(
|
|
233
|
+
serverTelemetryManager,
|
|
234
|
+
validRequest.authority,
|
|
235
|
+
validRequest.azureCloudOptions
|
|
236
236
|
);
|
|
237
|
-
const authClient: AuthorizationCodeClient =
|
|
238
|
-
await this.createAuthCodeClient(
|
|
239
|
-
serverTelemetryManager,
|
|
240
|
-
validRequest.authority,
|
|
241
|
-
validRequest.azureCloudOptions
|
|
242
|
-
);
|
|
243
|
-
this.logger.verbose("Auth code client created");
|
|
244
237
|
|
|
245
238
|
const isNativeBroker = NativeMessageHandler.isNativeAvailable(
|
|
246
239
|
this.config,
|
|
@@ -295,11 +288,6 @@ export class PopupClient extends StandardInteractionClient {
|
|
|
295
288
|
// Deserialize hash fragment response parameters.
|
|
296
289
|
const serverParams: ServerAuthorizationCodeResponse =
|
|
297
290
|
UrlString.getDeserializedHash(hash);
|
|
298
|
-
const state = this.validateAndExtractStateFromHash(
|
|
299
|
-
serverParams,
|
|
300
|
-
InteractionType.Popup,
|
|
301
|
-
validRequest.correlationId
|
|
302
|
-
);
|
|
303
291
|
// Remove throttle if it exists
|
|
304
292
|
ThrottlingUtils.removeThrottle(
|
|
305
293
|
this.browserStorage,
|
|
@@ -340,25 +328,19 @@ export class PopupClient extends StandardInteractionClient {
|
|
|
340
328
|
);
|
|
341
329
|
const { userRequestState } = ProtocolUtils.parseRequestState(
|
|
342
330
|
this.browserCrypto,
|
|
343
|
-
state
|
|
331
|
+
validRequest.state
|
|
344
332
|
);
|
|
345
|
-
return nativeInteractionClient
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
})
|
|
351
|
-
.finally(() => {
|
|
352
|
-
this.browserStorage.cleanRequestByState(state);
|
|
353
|
-
});
|
|
333
|
+
return nativeInteractionClient.acquireToken({
|
|
334
|
+
...validRequest,
|
|
335
|
+
state: userRequestState,
|
|
336
|
+
prompt: undefined, // Server should handle the prompt, ideally native broker can do this part silently
|
|
337
|
+
});
|
|
354
338
|
}
|
|
355
339
|
|
|
356
340
|
// Handle response from hash string.
|
|
357
341
|
const result = await interactionHandler.handleCodeResponseFromHash(
|
|
358
342
|
hash,
|
|
359
|
-
|
|
360
|
-
authClient.authority,
|
|
361
|
-
this.networkClient
|
|
343
|
+
validRequest
|
|
362
344
|
);
|
|
363
345
|
|
|
364
346
|
return result;
|
|
@@ -372,7 +354,6 @@ export class PopupClient extends StandardInteractionClient {
|
|
|
372
354
|
(e as AuthError).setCorrelationId(this.correlationId);
|
|
373
355
|
serverTelemetryManager.cacheFailedRequest(e);
|
|
374
356
|
}
|
|
375
|
-
this.browserStorage.cleanRequestByState(validRequest.state);
|
|
376
357
|
throw e;
|
|
377
358
|
}
|
|
378
359
|
}
|
|
@@ -410,15 +391,13 @@ export class PopupClient extends StandardInteractionClient {
|
|
|
410
391
|
await this.clearCacheOnLogout(validRequest.account);
|
|
411
392
|
|
|
412
393
|
// Initialize the client
|
|
413
|
-
|
|
394
|
+
const authClient = await invokeAsync(
|
|
395
|
+
this.createAuthCodeClient.bind(this),
|
|
414
396
|
PerformanceEvents.StandardInteractionClientCreateAuthCodeClient,
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
requestAuthority
|
|
420
|
-
);
|
|
421
|
-
this.logger.verbose("Auth code client created");
|
|
397
|
+
this.logger,
|
|
398
|
+
this.performanceClient,
|
|
399
|
+
this.correlationId
|
|
400
|
+
)(serverTelemetryManager, requestAuthority);
|
|
422
401
|
|
|
423
402
|
try {
|
|
424
403
|
authClient.authority.endSessionEndpoint;
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
IPerformanceClient,
|
|
19
19
|
PerformanceEvents,
|
|
20
20
|
ProtocolMode,
|
|
21
|
+
invokeAsync,
|
|
21
22
|
} from "@azure/msal-common";
|
|
22
23
|
import { StandardInteractionClient } from "./StandardInteractionClient";
|
|
23
24
|
import {
|
|
@@ -78,19 +79,19 @@ export class RedirectClient extends StandardInteractionClient {
|
|
|
78
79
|
* @param request
|
|
79
80
|
*/
|
|
80
81
|
async acquireToken(request: RedirectRequest): Promise<void> {
|
|
81
|
-
|
|
82
|
+
const validRequest = await invokeAsync(
|
|
83
|
+
this.initializeAuthorizationRequest.bind(this),
|
|
82
84
|
PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
);
|
|
85
|
+
this.logger,
|
|
86
|
+
this.performanceClient,
|
|
87
|
+
this.correlationId
|
|
88
|
+
)(request, InteractionType.Redirect);
|
|
89
|
+
|
|
89
90
|
this.browserStorage.updateCacheEntries(
|
|
90
91
|
validRequest.state,
|
|
91
92
|
validRequest.nonce,
|
|
92
93
|
validRequest.authority,
|
|
93
|
-
validRequest.loginHint ||
|
|
94
|
+
validRequest.loginHint || "",
|
|
94
95
|
validRequest.account || null
|
|
95
96
|
);
|
|
96
97
|
const serverTelemetryManager = this.initializeServerTelemetryManager(
|
|
@@ -113,25 +114,27 @@ export class RedirectClient extends StandardInteractionClient {
|
|
|
113
114
|
|
|
114
115
|
try {
|
|
115
116
|
// Create auth code request and generate PKCE params
|
|
116
|
-
this.performanceClient.setPreQueueTime(
|
|
117
|
-
PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest,
|
|
118
|
-
request.correlationId
|
|
119
|
-
);
|
|
120
117
|
const authCodeRequest: CommonAuthorizationCodeRequest =
|
|
121
|
-
await
|
|
118
|
+
await invokeAsync(
|
|
119
|
+
this.initializeAuthorizationCodeRequest.bind(this),
|
|
120
|
+
PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest,
|
|
121
|
+
this.logger,
|
|
122
|
+
this.performanceClient,
|
|
123
|
+
this.correlationId
|
|
124
|
+
)(validRequest);
|
|
122
125
|
|
|
123
126
|
// Initialize the client
|
|
124
|
-
|
|
127
|
+
const authClient: AuthorizationCodeClient = await invokeAsync(
|
|
128
|
+
this.createAuthCodeClient.bind(this),
|
|
125
129
|
PerformanceEvents.StandardInteractionClientCreateAuthCodeClient,
|
|
126
|
-
|
|
130
|
+
this.logger,
|
|
131
|
+
this.performanceClient,
|
|
132
|
+
this.correlationId
|
|
133
|
+
)(
|
|
134
|
+
serverTelemetryManager,
|
|
135
|
+
validRequest.authority,
|
|
136
|
+
validRequest.azureCloudOptions
|
|
127
137
|
);
|
|
128
|
-
const authClient: AuthorizationCodeClient =
|
|
129
|
-
await this.createAuthCodeClient(
|
|
130
|
-
serverTelemetryManager,
|
|
131
|
-
validRequest.authority,
|
|
132
|
-
validRequest.azureCloudOptions
|
|
133
|
-
);
|
|
134
|
-
this.logger.verbose("Auth code client created");
|
|
135
138
|
|
|
136
139
|
// Create redirect interaction handler.
|
|
137
140
|
const interactionHandler = new RedirectHandler(
|
|
@@ -139,7 +142,6 @@ export class RedirectClient extends StandardInteractionClient {
|
|
|
139
142
|
this.browserStorage,
|
|
140
143
|
authCodeRequest,
|
|
141
144
|
this.logger,
|
|
142
|
-
this.browserCrypto,
|
|
143
145
|
this.performanceClient
|
|
144
146
|
);
|
|
145
147
|
|
|
@@ -444,15 +446,15 @@ export class RedirectClient extends StandardInteractionClient {
|
|
|
444
446
|
BrowserAuthErrorCodes.noCachedAuthorityError
|
|
445
447
|
);
|
|
446
448
|
}
|
|
447
|
-
|
|
449
|
+
|
|
450
|
+
const authClient = await invokeAsync(
|
|
451
|
+
this.createAuthCodeClient.bind(this),
|
|
448
452
|
PerformanceEvents.StandardInteractionClientCreateAuthCodeClient,
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
);
|
|
455
|
-
this.logger.verbose("Auth code client created");
|
|
453
|
+
this.logger,
|
|
454
|
+
this.performanceClient,
|
|
455
|
+
this.correlationId
|
|
456
|
+
)(serverTelemetryManager, currentAuthority);
|
|
457
|
+
|
|
456
458
|
ThrottlingUtils.removeThrottle(
|
|
457
459
|
this.browserStorage,
|
|
458
460
|
this.config.auth.clientId,
|
|
@@ -463,15 +465,9 @@ export class RedirectClient extends StandardInteractionClient {
|
|
|
463
465
|
this.browserStorage,
|
|
464
466
|
cachedRequest,
|
|
465
467
|
this.logger,
|
|
466
|
-
this.browserCrypto,
|
|
467
468
|
this.performanceClient
|
|
468
469
|
);
|
|
469
|
-
return await interactionHandler.handleCodeResponseFromHash(
|
|
470
|
-
hash,
|
|
471
|
-
state,
|
|
472
|
-
authClient.authority,
|
|
473
|
-
this.networkClient
|
|
474
|
-
);
|
|
470
|
+
return await interactionHandler.handleCodeResponseFromHash(hash, state);
|
|
475
471
|
}
|
|
476
472
|
|
|
477
473
|
/**
|
|
@@ -501,15 +497,14 @@ export class RedirectClient extends StandardInteractionClient {
|
|
|
501
497
|
timeout: this.config.system.redirectNavigationTimeout,
|
|
502
498
|
noHistory: false,
|
|
503
499
|
};
|
|
504
|
-
|
|
500
|
+
|
|
501
|
+
const authClient = await invokeAsync(
|
|
502
|
+
this.createAuthCodeClient.bind(this),
|
|
505
503
|
PerformanceEvents.StandardInteractionClientCreateAuthCodeClient,
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
logoutRequest && logoutRequest.authority
|
|
511
|
-
);
|
|
512
|
-
this.logger.verbose("Auth code client created");
|
|
504
|
+
this.logger,
|
|
505
|
+
this.performanceClient,
|
|
506
|
+
this.correlationId
|
|
507
|
+
)(serverTelemetryManager, logoutRequest && logoutRequest.authority);
|
|
513
508
|
|
|
514
509
|
if (authClient.authority.protocolMode === ProtocolMode.OIDC) {
|
|
515
510
|
try {
|
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
Logger,
|
|
9
9
|
CommonAuthorizationCodeRequest,
|
|
10
10
|
AuthError,
|
|
11
|
-
Constants,
|
|
12
11
|
IPerformanceClient,
|
|
13
12
|
PerformanceEvents,
|
|
14
13
|
invokeAsync,
|
|
@@ -81,13 +80,6 @@ export class SilentAuthCodeClient extends StandardInteractionClient {
|
|
|
81
80
|
this.performanceClient,
|
|
82
81
|
request.correlationId
|
|
83
82
|
)(request, InteractionType.Silent);
|
|
84
|
-
this.browserStorage.updateCacheEntries(
|
|
85
|
-
silentRequest.state,
|
|
86
|
-
silentRequest.nonce,
|
|
87
|
-
silentRequest.authority,
|
|
88
|
-
silentRequest.loginHint || Constants.EMPTY_STRING,
|
|
89
|
-
silentRequest.account || null
|
|
90
|
-
);
|
|
91
83
|
|
|
92
84
|
const serverTelemetryManager = this.initializeServerTelemetryManager(
|
|
93
85
|
this.apiId
|
|
@@ -137,9 +129,7 @@ export class SilentAuthCodeClient extends StandardInteractionClient {
|
|
|
137
129
|
cloud_graph_host_name: request.cloudGraphHostName,
|
|
138
130
|
cloud_instance_host_name: request.cloudInstanceHostName,
|
|
139
131
|
},
|
|
140
|
-
silentRequest
|
|
141
|
-
authClient.authority,
|
|
142
|
-
this.networkClient,
|
|
132
|
+
silentRequest,
|
|
143
133
|
false
|
|
144
134
|
);
|
|
145
135
|
} catch (e) {
|
|
@@ -147,7 +137,6 @@ export class SilentAuthCodeClient extends StandardInteractionClient {
|
|
|
147
137
|
(e as AuthError).setCorrelationId(this.correlationId);
|
|
148
138
|
serverTelemetryManager.cacheFailedRequest(e);
|
|
149
139
|
}
|
|
150
|
-
this.browserStorage.cleanRequestByState(silentRequest.state);
|
|
151
140
|
throw e;
|
|
152
141
|
}
|
|
153
142
|
}
|
|
@@ -10,7 +10,6 @@ import {
|
|
|
10
10
|
CommonAuthorizationCodeRequest,
|
|
11
11
|
AuthorizationCodeClient,
|
|
12
12
|
AuthError,
|
|
13
|
-
Constants,
|
|
14
13
|
UrlString,
|
|
15
14
|
ServerAuthorizationCodeResponse,
|
|
16
15
|
ProtocolUtils,
|
|
@@ -120,13 +119,6 @@ export class SilentIframeClient extends StandardInteractionClient {
|
|
|
120
119
|
InteractionType.Silent
|
|
121
120
|
);
|
|
122
121
|
BrowserUtils.preconnect(silentRequest.authority);
|
|
123
|
-
this.browserStorage.updateCacheEntries(
|
|
124
|
-
silentRequest.state,
|
|
125
|
-
silentRequest.nonce,
|
|
126
|
-
silentRequest.authority,
|
|
127
|
-
silentRequest.loginHint || Constants.EMPTY_STRING,
|
|
128
|
-
silentRequest.account || null
|
|
129
|
-
);
|
|
130
122
|
|
|
131
123
|
const serverTelemetryManager = this.initializeServerTelemetryManager(
|
|
132
124
|
this.apiId
|
|
@@ -158,7 +150,6 @@ export class SilentIframeClient extends StandardInteractionClient {
|
|
|
158
150
|
(e as AuthError).setCorrelationId(this.correlationId);
|
|
159
151
|
serverTelemetryManager.cacheFailedRequest(e);
|
|
160
152
|
}
|
|
161
|
-
this.browserStorage.cleanRequestByState(silentRequest.state);
|
|
162
153
|
throw e;
|
|
163
154
|
}
|
|
164
155
|
}
|
|
@@ -273,11 +264,6 @@ export class SilentIframeClient extends StandardInteractionClient {
|
|
|
273
264
|
// Deserialize hash fragment response parameters.
|
|
274
265
|
const serverParams: ServerAuthorizationCodeResponse =
|
|
275
266
|
UrlString.getDeserializedHash(hash);
|
|
276
|
-
const state = this.validateAndExtractStateFromHash(
|
|
277
|
-
serverParams,
|
|
278
|
-
InteractionType.Silent,
|
|
279
|
-
correlationId
|
|
280
|
-
);
|
|
281
267
|
|
|
282
268
|
if (serverParams.accountId) {
|
|
283
269
|
this.logger.verbose(
|
|
@@ -304,7 +290,7 @@ export class SilentIframeClient extends StandardInteractionClient {
|
|
|
304
290
|
);
|
|
305
291
|
const { userRequestState } = ProtocolUtils.parseRequestState(
|
|
306
292
|
this.browserCrypto,
|
|
307
|
-
state
|
|
293
|
+
silentRequest.state
|
|
308
294
|
);
|
|
309
295
|
return invokeAsync(
|
|
310
296
|
nativeInteractionClient.acquireToken.bind(
|
|
@@ -318,8 +304,6 @@ export class SilentIframeClient extends StandardInteractionClient {
|
|
|
318
304
|
...silentRequest,
|
|
319
305
|
state: userRequestState,
|
|
320
306
|
prompt: silentRequest.prompt || PromptValue.NONE,
|
|
321
|
-
}).finally(() => {
|
|
322
|
-
this.browserStorage.cleanRequestByState(state);
|
|
323
307
|
});
|
|
324
308
|
}
|
|
325
309
|
|
|
@@ -332,6 +316,6 @@ export class SilentIframeClient extends StandardInteractionClient {
|
|
|
332
316
|
this.logger,
|
|
333
317
|
this.performanceClient,
|
|
334
318
|
correlationId
|
|
335
|
-
)(hash,
|
|
319
|
+
)(hash, silentRequest);
|
|
336
320
|
}
|
|
337
321
|
}
|
|
@@ -53,7 +53,6 @@ export class SilentRefreshClient extends StandardInteractionClient {
|
|
|
53
53
|
silentRequest.authority,
|
|
54
54
|
silentRequest.azureCloudOptions
|
|
55
55
|
);
|
|
56
|
-
this.logger.verbose("Refresh token client created");
|
|
57
56
|
// Send request to renew token. Auth module will throw errors if token cannot be renewed.
|
|
58
57
|
return invokeAsync(
|
|
59
58
|
refreshTokenClient.acquireTokenByRefreshToken.bind(
|
|
@@ -63,24 +62,11 @@ export class SilentRefreshClient extends StandardInteractionClient {
|
|
|
63
62
|
this.logger,
|
|
64
63
|
this.performanceClient,
|
|
65
64
|
request.correlationId
|
|
66
|
-
)(silentRequest)
|
|
67
|
-
|
|
68
|
-
.
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
fromCache: result.fromCache,
|
|
72
|
-
requestId: result.requestId,
|
|
73
|
-
},
|
|
74
|
-
request.correlationId
|
|
75
|
-
);
|
|
76
|
-
|
|
77
|
-
return result;
|
|
78
|
-
})
|
|
79
|
-
.catch((e: AuthError) => {
|
|
80
|
-
(e as AuthError).setCorrelationId(this.correlationId);
|
|
81
|
-
serverTelemetryManager.cacheFailedRequest(e);
|
|
82
|
-
throw e;
|
|
83
|
-
});
|
|
65
|
+
)(silentRequest).catch((e: AuthError) => {
|
|
66
|
+
(e as AuthError).setCorrelationId(this.correlationId);
|
|
67
|
+
serverTelemetryManager.cacheFailedRequest(e);
|
|
68
|
+
throw e;
|
|
69
|
+
}) as Promise<AuthenticationResult>;
|
|
84
70
|
}
|
|
85
71
|
|
|
86
72
|
/**
|