@azure/msal-browser 3.16.0 → 3.17.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/NativeRequest.d.ts +1 -0
- package/dist/broker/nativeBroker/NativeRequest.d.ts.map +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.d.ts +11 -0
- package/dist/crypto/CryptoOps.d.ts.map +1 -1
- package/dist/crypto/CryptoOps.mjs +16 -1
- package/dist/crypto/CryptoOps.mjs.map +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.d.ts +5 -0
- package/dist/error/BrowserAuthError.d.ts.map +1 -1
- package/dist/error/BrowserAuthError.mjs +7 -2
- package/dist/error/BrowserAuthError.mjs.map +1 -1
- package/dist/error/BrowserAuthErrorCodes.d.ts +1 -0
- package/dist/error/BrowserAuthErrorCodes.d.ts.map +1 -1
- package/dist/error/BrowserAuthErrorCodes.mjs +3 -2
- package/dist/error/BrowserAuthErrorCodes.mjs.map +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 +30 -12
- 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 +160 -88
- package/lib/msal-browser.cjs.map +1 -1
- package/lib/msal-browser.js +160 -88
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +60 -60
- package/package.json +2 -2
- package/src/broker/nativeBroker/NativeRequest.ts +1 -0
- package/src/crypto/CryptoOps.ts +17 -0
- package/src/error/BrowserAuthError.ts +8 -0
- package/src/error/BrowserAuthErrorCodes.ts +1 -0
- package/src/interaction_client/NativeInteractionClient.ts +47 -16
- 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.17.0",
|
|
14
14
|
"description": "Microsoft Authentication Library for js",
|
|
15
15
|
"keywords": [
|
|
16
16
|
"implicit",
|
|
@@ -103,6 +103,6 @@
|
|
|
103
103
|
"typescript": "^4.9.5"
|
|
104
104
|
},
|
|
105
105
|
"dependencies": {
|
|
106
|
-
"@azure/msal-common": "14.
|
|
106
|
+
"@azure/msal-common": "14.12.0"
|
|
107
107
|
}
|
|
108
108
|
}
|
|
@@ -31,6 +31,7 @@ export type NativeTokenRequest = {
|
|
|
31
31
|
extendedExpiryToken?: boolean;
|
|
32
32
|
extraParameters?: StringDict;
|
|
33
33
|
storeInCache?: StoreInCache; // Object of booleans indicating whether to store tokens in the cache or not (default is true)
|
|
34
|
+
signPopToken?: boolean; // Set to true only if token request deos not contain a PoP keyId
|
|
34
35
|
};
|
|
35
36
|
|
|
36
37
|
/**
|
package/src/crypto/CryptoOps.ts
CHANGED
|
@@ -78,6 +78,23 @@ export class CryptoOps implements ICrypto {
|
|
|
78
78
|
return base64Decode(input);
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
+
/**
|
|
82
|
+
* Encodes input string to base64 URL safe string.
|
|
83
|
+
* @param input
|
|
84
|
+
*/
|
|
85
|
+
base64UrlEncode(input: string): string {
|
|
86
|
+
return urlEncode(input);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Stringifies and base64Url encodes input public key
|
|
91
|
+
* @param inputKid
|
|
92
|
+
* @returns Base64Url encoded public key
|
|
93
|
+
*/
|
|
94
|
+
encodeKid(inputKid: string): string {
|
|
95
|
+
return this.base64UrlEncode(JSON.stringify({ kid: inputKid }));
|
|
96
|
+
}
|
|
97
|
+
|
|
81
98
|
/**
|
|
82
99
|
* Generates a keypair, stores it and returns a thumbprint
|
|
83
100
|
* @param request
|
|
@@ -90,6 +90,8 @@ export const BrowserAuthErrorMessages = {
|
|
|
90
90
|
"The provided prompt is not supported by the native platform. This request should be routed to the web based flow.",
|
|
91
91
|
[BrowserAuthErrorCodes.invalidBase64String]:
|
|
92
92
|
"Invalid base64 encoded string.",
|
|
93
|
+
[BrowserAuthErrorCodes.invalidPopTokenRequest]:
|
|
94
|
+
"Invalid PoP token request. The request should not have both a popKid value and signPopToken set to true.",
|
|
93
95
|
};
|
|
94
96
|
|
|
95
97
|
/**
|
|
@@ -333,6 +335,12 @@ export const BrowserAuthErrorMessage = {
|
|
|
333
335
|
BrowserAuthErrorCodes.invalidBase64String
|
|
334
336
|
],
|
|
335
337
|
},
|
|
338
|
+
invalidPopTokenRequest: {
|
|
339
|
+
code: BrowserAuthErrorCodes.invalidPopTokenRequest,
|
|
340
|
+
desc: BrowserAuthErrorMessages[
|
|
341
|
+
BrowserAuthErrorCodes.invalidPopTokenRequest
|
|
342
|
+
],
|
|
343
|
+
},
|
|
336
344
|
};
|
|
337
345
|
|
|
338
346
|
/**
|
|
@@ -55,3 +55,4 @@ export const uninitializedPublicClientApplication =
|
|
|
55
55
|
"uninitialized_public_client_application";
|
|
56
56
|
export const nativePromptNotSupported = "native_prompt_not_supported";
|
|
57
57
|
export const invalidBase64String = "invalid_base64_string";
|
|
58
|
+
export const invalidPopTokenRequest = "invalid_pop_token_request";
|
|
@@ -170,10 +170,12 @@ export class NativeInteractionClient extends BaseInteractionClient {
|
|
|
170
170
|
);
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
+
const { ...nativeTokenRequest } = nativeRequest;
|
|
174
|
+
|
|
173
175
|
// fall back to native calls
|
|
174
176
|
const messageBody: NativeExtensionRequestBody = {
|
|
175
177
|
method: NativeExtensionMethod.GetToken,
|
|
176
|
-
request:
|
|
178
|
+
request: nativeTokenRequest,
|
|
177
179
|
};
|
|
178
180
|
|
|
179
181
|
const response: object = await this.nativeMessageHandler.sendMessage(
|
|
@@ -289,9 +291,11 @@ export class NativeInteractionClient extends BaseInteractionClient {
|
|
|
289
291
|
);
|
|
290
292
|
const nativeRequest = await this.initializeNativeRequest(request);
|
|
291
293
|
|
|
294
|
+
const { ...nativeTokenRequest } = nativeRequest;
|
|
295
|
+
|
|
292
296
|
const messageBody: NativeExtensionRequestBody = {
|
|
293
297
|
method: NativeExtensionMethod.GetToken,
|
|
294
|
-
request:
|
|
298
|
+
request: nativeTokenRequest,
|
|
295
299
|
};
|
|
296
300
|
|
|
297
301
|
try {
|
|
@@ -481,7 +485,7 @@ export class NativeInteractionClient extends BaseInteractionClient {
|
|
|
481
485
|
request,
|
|
482
486
|
homeAccountIdentifier,
|
|
483
487
|
idTokenClaims,
|
|
484
|
-
|
|
488
|
+
response.access_token,
|
|
485
489
|
result.tenantId,
|
|
486
490
|
reqTimestamp
|
|
487
491
|
);
|
|
@@ -535,7 +539,10 @@ export class NativeInteractionClient extends BaseInteractionClient {
|
|
|
535
539
|
response: NativeResponse,
|
|
536
540
|
request: NativeTokenRequest
|
|
537
541
|
): Promise<string> {
|
|
538
|
-
if (
|
|
542
|
+
if (
|
|
543
|
+
request.tokenType === AuthenticationScheme.POP &&
|
|
544
|
+
request.signPopToken
|
|
545
|
+
) {
|
|
539
546
|
/**
|
|
540
547
|
* This code prioritizes SHR returned from the native layer. In case of error/SHR not calculated from WAM and the AT
|
|
541
548
|
* is still received, SHR is calculated locally
|
|
@@ -725,7 +732,11 @@ export class NativeInteractionClient extends BaseInteractionClient {
|
|
|
725
732
|
responseScopes.printScopes(),
|
|
726
733
|
tokenExpirationSeconds,
|
|
727
734
|
0,
|
|
728
|
-
base64Decode
|
|
735
|
+
base64Decode,
|
|
736
|
+
undefined,
|
|
737
|
+
request.tokenType as AuthenticationScheme,
|
|
738
|
+
undefined,
|
|
739
|
+
request.keyId
|
|
729
740
|
);
|
|
730
741
|
|
|
731
742
|
const nativeCacheRecord = new CacheRecord(
|
|
@@ -917,8 +928,16 @@ export class NativeInteractionClient extends BaseInteractionClient {
|
|
|
917
928
|
...request.tokenQueryParameters,
|
|
918
929
|
},
|
|
919
930
|
extendedExpiryToken: false, // Make this configurable?
|
|
931
|
+
keyId: request.popKid,
|
|
920
932
|
};
|
|
921
933
|
|
|
934
|
+
// Check for PoP token requests: signPopToken should only be set to true if popKid is not set
|
|
935
|
+
if (validatedRequest.signPopToken && !!request.popKid) {
|
|
936
|
+
throw createBrowserAuthError(
|
|
937
|
+
BrowserAuthErrorCodes.invalidPopTokenRequest
|
|
938
|
+
);
|
|
939
|
+
}
|
|
940
|
+
|
|
922
941
|
this.handleExtraBrokerParams(validatedRequest);
|
|
923
942
|
validatedRequest.extraParameters =
|
|
924
943
|
validatedRequest.extraParameters || {};
|
|
@@ -935,17 +954,29 @@ export class NativeInteractionClient extends BaseInteractionClient {
|
|
|
935
954
|
};
|
|
936
955
|
|
|
937
956
|
const popTokenGenerator = new PopTokenGenerator(this.browserCrypto);
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
957
|
+
|
|
958
|
+
// generate reqCnf if not provided in the request
|
|
959
|
+
let reqCnfData;
|
|
960
|
+
if (!validatedRequest.keyId) {
|
|
961
|
+
const generatedReqCnfData = await invokeAsync(
|
|
962
|
+
popTokenGenerator.generateCnf.bind(popTokenGenerator),
|
|
963
|
+
PerformanceEvents.PopTokenGenerateCnf,
|
|
964
|
+
this.logger,
|
|
965
|
+
this.performanceClient,
|
|
966
|
+
request.correlationId
|
|
967
|
+
)(shrParameters, this.logger);
|
|
968
|
+
reqCnfData = generatedReqCnfData.reqCnfString;
|
|
969
|
+
validatedRequest.keyId = generatedReqCnfData.kid;
|
|
970
|
+
validatedRequest.signPopToken = true;
|
|
971
|
+
} else {
|
|
972
|
+
reqCnfData = this.browserCrypto.base64UrlEncode(
|
|
973
|
+
JSON.stringify({ kid: validatedRequest.keyId })
|
|
974
|
+
);
|
|
975
|
+
validatedRequest.signPopToken = false;
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
// SPAs require whole string to be passed to broker
|
|
979
|
+
validatedRequest.reqCnf = reqCnfData;
|
|
949
980
|
}
|
|
950
981
|
|
|
951
982
|
return validatedRequest;
|
package/src/packageMetadata.ts
CHANGED