@azure/msal-browser 3.19.1 → 3.20.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.mjs +1 -1
- package/dist/app/PublicClientNext.mjs +1 -1
- package/dist/broker/nativeBroker/NativeMessageHandler.mjs +1 -1
- package/dist/broker/nativeBroker/NativeStatusCodes.mjs +1 -1
- package/dist/cache/AccountManager.mjs +1 -1
- package/dist/cache/AsyncMemoryStorage.mjs +1 -1
- package/dist/cache/BrowserCacheManager.mjs +1 -1
- package/dist/cache/BrowserStorage.mjs +1 -1
- package/dist/cache/DatabaseStorage.mjs +1 -1
- package/dist/cache/MemoryStorage.mjs +1 -1
- package/dist/cache/TokenCache.mjs +1 -1
- package/dist/config/Configuration.mjs +1 -1
- package/dist/controllers/ControllerFactory.mjs +1 -1
- package/dist/controllers/NestedAppAuthController.mjs +1 -1
- package/dist/controllers/StandardController.mjs +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 +9 -1
- package/dist/interaction_client/NativeInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/NativeInteractionClient.mjs +83 -43
- package/dist/interaction_client/NativeInteractionClient.mjs.map +1 -1
- package/dist/interaction_client/PopupClient.mjs +1 -1
- package/dist/interaction_client/RedirectClient.mjs +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.mjs +1 -1
- package/dist/interaction_client/SilentCacheClient.mjs +1 -1
- package/dist/interaction_client/SilentIframeClient.mjs +1 -1
- package/dist/interaction_client/SilentRefreshClient.mjs +1 -1
- package/dist/interaction_client/StandardInteractionClient.mjs +1 -1
- package/dist/interaction_handler/InteractionHandler.mjs +1 -1
- package/dist/interaction_handler/RedirectHandler.mjs +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/NestedAppOperatingContext.mjs +1 -1
- package/dist/operatingcontext/StandardOperatingContext.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/request/RequestHelpers.mjs +1 -1
- package/dist/response/ResponseHandler.mjs +1 -1
- 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 +206 -107
- package/lib/msal-browser.cjs.map +1 -1
- package/lib/msal-browser.js +206 -107
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +64 -64
- package/package.json +2 -2
- package/src/interaction_client/NativeInteractionClient.ts +105 -54
- package/src/packageMetadata.ts +1 -1
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "https://github.com/AzureAD/microsoft-authentication-library-for-js.git"
|
|
12
12
|
},
|
|
13
|
-
"version": "3.
|
|
13
|
+
"version": "3.20.0",
|
|
14
14
|
"description": "Microsoft Authentication Library for js",
|
|
15
15
|
"keywords": [
|
|
16
16
|
"implicit",
|
|
@@ -104,6 +104,6 @@
|
|
|
104
104
|
"typescript": "^4.9.5"
|
|
105
105
|
},
|
|
106
106
|
"dependencies": {
|
|
107
|
-
"@azure/msal-common": "14.
|
|
107
|
+
"@azure/msal-common": "14.14.0"
|
|
108
108
|
}
|
|
109
109
|
}
|
|
@@ -36,6 +36,7 @@ import {
|
|
|
36
36
|
CacheHelpers,
|
|
37
37
|
buildAccountToCache,
|
|
38
38
|
InProgressPerformanceEvent,
|
|
39
|
+
ServerTelemetryManager,
|
|
39
40
|
} from "@azure/msal-common";
|
|
40
41
|
import { BaseInteractionClient } from "./BaseInteractionClient";
|
|
41
42
|
import { BrowserConfiguration } from "../config/Configuration";
|
|
@@ -50,6 +51,7 @@ import {
|
|
|
50
51
|
ApiId,
|
|
51
52
|
TemporaryCacheKeys,
|
|
52
53
|
NativeConstants,
|
|
54
|
+
BrowserConstants,
|
|
53
55
|
} from "../utils/BrowserConstants";
|
|
54
56
|
import {
|
|
55
57
|
NativeExtensionRequestBody,
|
|
@@ -72,6 +74,7 @@ import {
|
|
|
72
74
|
import { SilentCacheClient } from "./SilentCacheClient";
|
|
73
75
|
import { AuthenticationResult } from "../response/AuthenticationResult";
|
|
74
76
|
import { base64Decode } from "../encode/Base64Decode";
|
|
77
|
+
import { version } from "../packageMetadata";
|
|
75
78
|
|
|
76
79
|
const BrokerServerParamKeys = {
|
|
77
80
|
BROKER_CLIENT_ID: "brk_client_id",
|
|
@@ -84,6 +87,8 @@ export class NativeInteractionClient extends BaseInteractionClient {
|
|
|
84
87
|
protected nativeMessageHandler: NativeMessageHandler;
|
|
85
88
|
protected silentCacheClient: SilentCacheClient;
|
|
86
89
|
protected nativeStorageManager: BrowserCacheManager;
|
|
90
|
+
protected skus: string;
|
|
91
|
+
protected serverTelemetryManager: ServerTelemetryManager;
|
|
87
92
|
|
|
88
93
|
constructor(
|
|
89
94
|
config: BrowserConfiguration,
|
|
@@ -125,6 +130,35 @@ export class NativeInteractionClient extends BaseInteractionClient {
|
|
|
125
130
|
provider,
|
|
126
131
|
correlationId
|
|
127
132
|
);
|
|
133
|
+
this.serverTelemetryManager = this.initializeServerTelemetryManager(
|
|
134
|
+
this.apiId
|
|
135
|
+
);
|
|
136
|
+
|
|
137
|
+
const extensionName =
|
|
138
|
+
this.nativeMessageHandler.getExtensionId() ===
|
|
139
|
+
NativeConstants.PREFERRED_EXTENSION_ID
|
|
140
|
+
? "chrome"
|
|
141
|
+
: this.nativeMessageHandler.getExtensionId()?.length
|
|
142
|
+
? "unknown"
|
|
143
|
+
: undefined;
|
|
144
|
+
this.skus = ServerTelemetryManager.makeExtraSkuString({
|
|
145
|
+
libraryName: BrowserConstants.MSAL_SKU,
|
|
146
|
+
libraryVersion: version,
|
|
147
|
+
extensionName: extensionName,
|
|
148
|
+
extensionVersion: this.nativeMessageHandler.getExtensionVersion(),
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Adds SKUs to request extra query parameters
|
|
154
|
+
* @param request {NativeTokenRequest}
|
|
155
|
+
* @private
|
|
156
|
+
*/
|
|
157
|
+
private addRequestSKUs(request: NativeTokenRequest) {
|
|
158
|
+
request.extraParameters = {
|
|
159
|
+
...request.extraParameters,
|
|
160
|
+
[AADServerParamKeys.X_CLIENT_EXTRA_SKU]: this.skus,
|
|
161
|
+
};
|
|
128
162
|
}
|
|
129
163
|
|
|
130
164
|
/**
|
|
@@ -147,64 +181,73 @@ export class NativeInteractionClient extends BaseInteractionClient {
|
|
|
147
181
|
);
|
|
148
182
|
const reqTimestamp = TimeUtils.nowSeconds();
|
|
149
183
|
|
|
150
|
-
// initialize native request
|
|
151
|
-
const nativeRequest = await this.initializeNativeRequest(request);
|
|
152
|
-
|
|
153
|
-
// check if the tokens can be retrieved from internal cache
|
|
154
184
|
try {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
nativeRequest
|
|
158
|
-
);
|
|
159
|
-
nativeATMeasurement.end({
|
|
160
|
-
success: true,
|
|
161
|
-
isNativeBroker: false, // Should be true only when the result is coming directly from the broker
|
|
162
|
-
fromCache: true,
|
|
163
|
-
});
|
|
164
|
-
return result;
|
|
165
|
-
} catch (e) {
|
|
166
|
-
// continue with a native call for any and all errors
|
|
167
|
-
this.logger.info(
|
|
168
|
-
"MSAL internal Cache does not contain tokens, proceed to make a native call"
|
|
169
|
-
);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
const { ...nativeTokenRequest } = nativeRequest;
|
|
173
|
-
|
|
174
|
-
// fall back to native calls
|
|
175
|
-
const messageBody: NativeExtensionRequestBody = {
|
|
176
|
-
method: NativeExtensionMethod.GetToken,
|
|
177
|
-
request: nativeTokenRequest,
|
|
178
|
-
};
|
|
179
|
-
|
|
180
|
-
const response: object = await this.nativeMessageHandler.sendMessage(
|
|
181
|
-
messageBody
|
|
182
|
-
);
|
|
183
|
-
const validatedResponse: NativeResponse =
|
|
184
|
-
this.validateNativeResponse(response);
|
|
185
|
+
// initialize native request
|
|
186
|
+
const nativeRequest = await this.initializeNativeRequest(request);
|
|
185
187
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
188
|
+
// check if the tokens can be retrieved from internal cache
|
|
189
|
+
try {
|
|
190
|
+
const result = await this.acquireTokensFromCache(
|
|
191
|
+
this.accountId,
|
|
192
|
+
nativeRequest
|
|
193
|
+
);
|
|
192
194
|
nativeATMeasurement.end({
|
|
193
195
|
success: true,
|
|
194
|
-
isNativeBroker: true
|
|
195
|
-
|
|
196
|
+
isNativeBroker: false, // Should be true only when the result is coming directly from the broker
|
|
197
|
+
fromCache: true,
|
|
196
198
|
});
|
|
197
199
|
return result;
|
|
198
|
-
})
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
200
|
+
} catch (e) {
|
|
201
|
+
// continue with a native call for any and all errors
|
|
202
|
+
this.logger.info(
|
|
203
|
+
"MSAL internal Cache does not contain tokens, proceed to make a native call"
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
const { ...nativeTokenRequest } = nativeRequest;
|
|
208
|
+
|
|
209
|
+
// fall back to native calls
|
|
210
|
+
const messageBody: NativeExtensionRequestBody = {
|
|
211
|
+
method: NativeExtensionMethod.GetToken,
|
|
212
|
+
request: nativeTokenRequest,
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
const response: object =
|
|
216
|
+
await this.nativeMessageHandler.sendMessage(messageBody);
|
|
217
|
+
const validatedResponse: NativeResponse =
|
|
218
|
+
this.validateNativeResponse(response);
|
|
219
|
+
|
|
220
|
+
return await this.handleNativeResponse(
|
|
221
|
+
validatedResponse,
|
|
222
|
+
nativeRequest,
|
|
223
|
+
reqTimestamp
|
|
224
|
+
)
|
|
225
|
+
.then((result: AuthenticationResult) => {
|
|
226
|
+
nativeATMeasurement.end({
|
|
227
|
+
success: true,
|
|
228
|
+
isNativeBroker: true,
|
|
229
|
+
requestId: result.requestId,
|
|
230
|
+
});
|
|
231
|
+
this.serverTelemetryManager.clearNativeBrokerErrorCode();
|
|
232
|
+
return result;
|
|
233
|
+
})
|
|
234
|
+
.catch((error: AuthError) => {
|
|
235
|
+
nativeATMeasurement.end({
|
|
236
|
+
success: false,
|
|
237
|
+
errorCode: error.errorCode,
|
|
238
|
+
subErrorCode: error.subError,
|
|
239
|
+
isNativeBroker: true,
|
|
240
|
+
});
|
|
241
|
+
throw error;
|
|
205
242
|
});
|
|
206
|
-
|
|
207
|
-
|
|
243
|
+
} catch (e) {
|
|
244
|
+
if (e instanceof NativeAuthError) {
|
|
245
|
+
this.serverTelemetryManager.setNativeBrokerErrorCode(
|
|
246
|
+
e.errorCode
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
throw e;
|
|
250
|
+
}
|
|
208
251
|
}
|
|
209
252
|
|
|
210
253
|
/**
|
|
@@ -307,8 +350,13 @@ export class NativeInteractionClient extends BaseInteractionClient {
|
|
|
307
350
|
this.validateNativeResponse(response);
|
|
308
351
|
} catch (e) {
|
|
309
352
|
// Only throw fatal errors here to allow application to fallback to regular redirect. Otherwise proceed and the error will be thrown in handleRedirectPromise
|
|
310
|
-
if (e instanceof NativeAuthError
|
|
311
|
-
|
|
353
|
+
if (e instanceof NativeAuthError) {
|
|
354
|
+
this.serverTelemetryManager.setNativeBrokerErrorCode(
|
|
355
|
+
e.errorCode
|
|
356
|
+
);
|
|
357
|
+
if (isFatalNativeAuthError(e)) {
|
|
358
|
+
throw e;
|
|
359
|
+
}
|
|
312
360
|
}
|
|
313
361
|
}
|
|
314
362
|
this.browserStorage.setTemporaryCache(
|
|
@@ -399,7 +447,9 @@ export class NativeInteractionClient extends BaseInteractionClient {
|
|
|
399
447
|
reqTimestamp
|
|
400
448
|
);
|
|
401
449
|
this.browserStorage.setInteractionInProgress(false);
|
|
402
|
-
|
|
450
|
+
const res = await result;
|
|
451
|
+
this.serverTelemetryManager.clearNativeBrokerErrorCode();
|
|
452
|
+
return res;
|
|
403
453
|
} catch (e) {
|
|
404
454
|
this.browserStorage.setInteractionInProgress(false);
|
|
405
455
|
throw e;
|
|
@@ -980,6 +1030,7 @@ export class NativeInteractionClient extends BaseInteractionClient {
|
|
|
980
1030
|
// SPAs require whole string to be passed to broker
|
|
981
1031
|
validatedRequest.reqCnf = reqCnfData;
|
|
982
1032
|
}
|
|
1033
|
+
this.addRequestSKUs(validatedRequest);
|
|
983
1034
|
|
|
984
1035
|
return validatedRequest;
|
|
985
1036
|
}
|
package/src/packageMetadata.ts
CHANGED