@azure/msal-browser 5.17.0 → 5.17.3
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/broker/nativeBroker/NativeStatusCodes.mjs +1 -1
- package/dist/broker/nativeBroker/PlatformAuthDOMHandler.mjs +2 -4
- package/dist/broker/nativeBroker/PlatformAuthDOMHandler.mjs.map +1 -1
- package/dist/broker/nativeBroker/PlatformAuthExtensionHandler.mjs +1 -1
- package/dist/broker/nativeBroker/PlatformAuthProvider.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/CacheHelpers.mjs +1 -1
- package/dist/cache/CacheKeys.mjs +1 -1
- package/dist/cache/CookieStorage.mjs +1 -1
- package/dist/cache/DatabaseStorage.mjs +1 -1
- package/dist/cache/EncryptedData.mjs +1 -1
- package/dist/cache/LocalStorage.mjs +1 -1
- package/dist/cache/MemoryStorage.mjs +1 -1
- package/dist/cache/SessionStorage.mjs +1 -1
- package/dist/cache/TokenCache.mjs +1 -1
- package/dist/config/Configuration.mjs +1 -1
- package/dist/controllers/NestedAppAuthController.mjs +1 -1
- package/dist/controllers/StandardController.mjs +23 -26
- package/dist/controllers/StandardController.mjs.map +1 -1
- package/dist/crypto/BrowserCrypto.mjs +61 -12
- package/dist/crypto/BrowserCrypto.mjs.map +1 -1
- package/dist/crypto/CryptoOps.mjs +6 -12
- package/dist/crypto/CryptoOps.mjs.map +1 -1
- package/dist/crypto/PkceGenerator.mjs +1 -1
- package/dist/crypto/SignedHttpRequest.mjs +1 -1
- package/dist/custom_auth/CustomAuthConstants.mjs +1 -1
- package/dist/custom_auth/CustomAuthPublicClientApplication.mjs +1 -1
- package/dist/custom_auth/controller/CustomAuthStandardController.mjs +1 -1
- package/dist/custom_auth/core/CustomAuthAuthority.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/AuthFlowErrorBase.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/AuthFlowResultBase.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/AuthFlowState.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/AuthFlowStateTypes.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/jit/error_type/AuthMethodRegistrationError.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/jit/result/AuthMethodRegistrationChallengeMethodResult.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/jit/result/AuthMethodRegistrationSubmitChallengeResult.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/jit/state/AuthMethodRegistrationCompletedState.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/jit/state/AuthMethodRegistrationFailedState.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/jit/state/AuthMethodRegistrationState.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/mfa/error_type/MfaError.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/mfa/result/MfaRequestChallengeResult.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/mfa/result/MfaSubmitChallengeResult.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/mfa/state/MfaCompletedState.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/mfa/state/MfaFailedState.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/mfa/state/MfaState.mjs +1 -1
- package/dist/custom_auth/core/error/CustomAuthApiError.mjs +1 -1
- package/dist/custom_auth/core/error/CustomAuthError.mjs +1 -1
- package/dist/custom_auth/core/error/HttpError.mjs +1 -1
- package/dist/custom_auth/core/error/HttpErrorCodes.mjs +1 -1
- package/dist/custom_auth/core/error/InvalidArgumentError.mjs +1 -1
- package/dist/custom_auth/core/error/InvalidConfigurationError.mjs +1 -1
- package/dist/custom_auth/core/error/InvalidConfigurationErrorCodes.mjs +1 -1
- package/dist/custom_auth/core/error/MethodNotImplementedError.mjs +1 -1
- package/dist/custom_auth/core/error/MsalCustomAuthError.mjs +1 -1
- package/dist/custom_auth/core/error/NoCachedAccountFoundError.mjs +1 -1
- package/dist/custom_auth/core/error/ParsedUrlError.mjs +1 -1
- package/dist/custom_auth/core/error/ParsedUrlErrorCodes.mjs +1 -1
- package/dist/custom_auth/core/error/UnexpectedError.mjs +1 -1
- package/dist/custom_auth/core/error/UnsupportedEnvironmentError.mjs +1 -1
- package/dist/custom_auth/core/error/UserAccountAttributeError.mjs +1 -1
- package/dist/custom_auth/core/error/UserAlreadySignedInError.mjs +1 -1
- package/dist/custom_auth/core/interaction_client/CustomAuthInteractionClientBase.mjs +1 -1
- package/dist/custom_auth/core/interaction_client/CustomAuthInterationClientFactory.mjs +1 -1
- package/dist/custom_auth/core/interaction_client/jit/JitClient.mjs +1 -1
- package/dist/custom_auth/core/interaction_client/jit/result/JitActionResult.mjs +1 -1
- package/dist/custom_auth/core/interaction_client/mfa/MfaClient.mjs +1 -1
- package/dist/custom_auth/core/interaction_client/mfa/result/MfaActionResult.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/BaseApiClient.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/CustomAuthApiClient.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/CustomAuthApiEndpoint.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/RegisterApiClient.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/ResetPasswordApiClient.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/SignInApiClient.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/SignupApiClient.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/types/ApiErrorCodes.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/types/ApiSuberrors.mjs +1 -1
- package/dist/custom_auth/core/network_client/http_client/FetchHttpClient.mjs +1 -1
- package/dist/custom_auth/core/network_client/http_client/IHttpClient.mjs +1 -1
- package/dist/custom_auth/core/telemetry/PublicApiId.mjs +1 -1
- package/dist/custom_auth/core/utils/ArgumentValidator.mjs +1 -1
- package/dist/custom_auth/core/utils/CustomHeaderUtils.mjs +1 -1
- package/dist/custom_auth/core/utils/UrlUtils.mjs +1 -1
- package/dist/custom_auth/get_account/auth_flow/CustomAuthAccountData.mjs +1 -1
- package/dist/custom_auth/get_account/auth_flow/error_type/GetAccountError.mjs +1 -1
- package/dist/custom_auth/get_account/auth_flow/result/GetAccessTokenResult.mjs +1 -1
- package/dist/custom_auth/get_account/auth_flow/result/GetAccountResult.mjs +1 -1
- package/dist/custom_auth/get_account/auth_flow/result/SignOutResult.mjs +1 -1
- package/dist/custom_auth/get_account/auth_flow/state/GetAccessTokenState.mjs +1 -1
- package/dist/custom_auth/get_account/auth_flow/state/GetAccountState.mjs +1 -1
- package/dist/custom_auth/get_account/auth_flow/state/SignOutState.mjs +1 -1
- package/dist/custom_auth/get_account/interaction_client/CustomAuthSilentCacheClient.mjs +1 -1
- package/dist/custom_auth/index.mjs +1 -1
- package/dist/custom_auth/operating_context/CustomAuthOperatingContext.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/error_type/ResetPasswordError.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordResendCodeResult.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordStartResult.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordSubmitCodeResult.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordSubmitPasswordResult.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordCodeRequiredState.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordCompletedState.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordFailedState.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordPasswordRequiredState.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordState.mjs +1 -1
- package/dist/custom_auth/reset_password/interaction_client/ResetPasswordClient.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/SignInScenario.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/error_type/SignInError.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/result/SignInResendCodeResult.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/result/SignInResult.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/result/SignInSubmitCodeResult.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/result/SignInSubmitPasswordResult.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/state/SignInCodeRequiredState.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/state/SignInCompletedState.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/state/SignInContinuationState.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/state/SignInFailedState.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/state/SignInPasswordRequiredState.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/state/SignInState.mjs +1 -1
- package/dist/custom_auth/sign_in/interaction_client/SignInClient.mjs +1 -1
- package/dist/custom_auth/sign_in/interaction_client/result/SignInActionResult.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/error_type/SignUpError.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/result/SignUpResendCodeResult.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/result/SignUpResult.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/result/SignUpSubmitAttributesResult.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/result/SignUpSubmitCodeResult.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/result/SignUpSubmitPasswordResult.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/state/SignUpAttributesRequiredState.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/state/SignUpCodeRequiredState.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/state/SignUpCompletedState.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/state/SignUpFailedState.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/state/SignUpPasswordRequiredState.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/state/SignUpState.mjs +1 -1
- package/dist/custom_auth/sign_up/interaction_client/SignUpClient.mjs +1 -1
- package/dist/custom_auth/sign_up/interaction_client/result/SignUpActionResult.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 +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/PlatformAuthInteractionClient.mjs +123 -59
- package/dist/interaction_client/PlatformAuthInteractionClient.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/SilentHandler.mjs +1 -1
- package/dist/log-strings-mapping.json +1201 -1201
- 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 +39 -13
- package/dist/network/FetchClient.mjs.map +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/packageMetadata.mjs +2 -2
- package/dist/popup_relay/constants.mjs +1 -1
- package/dist/popup_relay/index.mjs +1 -1
- package/dist/popup_relay/relayClient.mjs +1 -1
- package/dist/protocol/Authorize.mjs +1 -1
- package/dist/redirect_bridge/index.mjs +1 -1
- package/dist/request/RequestHelpers.mjs +1 -1
- package/dist/response/ResponseHandler.mjs +1 -1
- package/dist/telemetry/BrowserPerformanceClient.mjs +1 -1
- package/dist/telemetry/BrowserPerformanceEvents.mjs +1 -1
- package/dist/telemetry/BrowserPerformanceMeasurement.mjs +1 -1
- package/dist/telemetry/BrowserRootPerformanceEvents.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/dist/utils/Helpers.mjs +1 -1
- package/dist/utils/MsalFrameStatsUtils.mjs +1 -1
- package/lib/custom-auth-path/log-strings-mapping.json +2 -2
- package/lib/custom-auth-path/msal-custom-auth.cjs +317 -184
- package/lib/custom-auth-path/msal-custom-auth.cjs.map +1 -1
- package/lib/custom-auth-path/msal-custom-auth.js +317 -184
- package/lib/custom-auth-path/msal-custom-auth.js.map +1 -1
- package/lib/log-strings-mapping.json +2 -2
- package/lib/msal-browser.cjs +326 -187
- package/lib/msal-browser.cjs.map +1 -1
- package/lib/msal-browser.js +326 -187
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +2 -2
- package/lib/popup-relay/msal-popup-relay.cjs +2 -2
- package/lib/popup-relay/msal-popup-relay.cjs.map +1 -1
- package/lib/popup-relay/msal-popup-relay.js +2 -2
- package/lib/popup-relay/msal-popup-relay.js.map +1 -1
- package/lib/popup-relay/msal-popup-relay.min.js +1 -1
- package/lib/redirect-bridge/msal-redirect-bridge.cjs +10 -10
- package/lib/redirect-bridge/msal-redirect-bridge.cjs.map +1 -1
- package/lib/redirect-bridge/msal-redirect-bridge.js +10 -10
- package/lib/redirect-bridge/msal-redirect-bridge.js.map +1 -1
- package/lib/redirect-bridge/msal-redirect-bridge.min.js +1 -1
- package/package.json +2 -2
- package/src/broker/nativeBroker/PlatformAuthDOMHandler.ts +0 -4
- package/src/broker/nativeBroker/PlatformAuthRequest.ts +4 -7
- package/src/controllers/StandardController.ts +24 -29
- package/src/crypto/BrowserCrypto.ts +104 -9
- package/src/crypto/CryptoOps.ts +13 -12
- package/src/error/BrowserAuthErrorCodes.ts +1 -0
- package/src/interaction_client/PlatformAuthInteractionClient.ts +160 -72
- package/src/network/FetchClient.ts +62 -14
- package/src/packageMetadata.ts +1 -1
- package/types/broker/nativeBroker/PlatformAuthDOMHandler.d.ts.map +1 -1
- package/types/broker/nativeBroker/PlatformAuthRequest.d.ts +3 -6
- package/types/broker/nativeBroker/PlatformAuthRequest.d.ts.map +1 -1
- package/types/controllers/StandardController.d.ts +3 -0
- package/types/controllers/StandardController.d.ts.map +1 -1
- package/types/crypto/BrowserCrypto.d.ts +19 -5
- package/types/crypto/BrowserCrypto.d.ts.map +1 -1
- package/types/crypto/CryptoOps.d.ts.map +1 -1
- package/types/custom_auth/CustomAuthConstants.d.ts +1 -1
- package/types/error/BrowserAuthErrorCodes.d.ts +1 -0
- package/types/error/BrowserAuthErrorCodes.d.ts.map +1 -1
- package/types/interaction_client/PlatformAuthInteractionClient.d.ts +13 -3
- package/types/interaction_client/PlatformAuthInteractionClient.d.ts.map +1 -1
- package/types/network/FetchClient.d.ts.map +1 -1
- package/types/packageMetadata.d.ts +1 -1
|
@@ -25,6 +25,14 @@ const AES_GCM = "AES-GCM";
|
|
|
25
25
|
const HKDF = "HKDF";
|
|
26
26
|
// SHA-256 hashing algorithm
|
|
27
27
|
const S256_HASH_ALG = "SHA-256";
|
|
28
|
+
// JWK values used by browser-internal WebCrypto helpers.
|
|
29
|
+
const JSON_WEB_KEY_CURVE_P256 = "P-256";
|
|
30
|
+
const JSON_WEB_KEY_TYPE_EC = "EC";
|
|
31
|
+
const JSON_WEB_KEY_TYPE_RSA = "RSA";
|
|
32
|
+
const MISSING_JWK_KTY_SUBERROR = "missing_jwk_kty";
|
|
33
|
+
const UNSUPPORTED_JWK_KTY_SUBERROR = "unsupported_jwk_kty";
|
|
34
|
+
const MISSING_JWK_MEMBER_SUBERROR = "missing_jwk_member";
|
|
35
|
+
const EMPTY_JWK_MEMBER_SUBERROR = "empty_jwk_member";
|
|
28
36
|
// MOD length for PoP tokens
|
|
29
37
|
const MODULUS_LENGTH = 2048;
|
|
30
38
|
// Public Exponent
|
|
@@ -44,13 +52,27 @@ const DERIVE_KEY = "deriveKey";
|
|
|
44
52
|
// Suberror
|
|
45
53
|
const SUBTLE_SUBERROR = "crypto_subtle_undefined";
|
|
46
54
|
|
|
47
|
-
const
|
|
55
|
+
export const RSA_KEYGEN_ALGORITHM_OPTIONS: RsaHashedKeyGenParams = {
|
|
48
56
|
name: PKCS1_V15_KEYGEN_ALG,
|
|
49
57
|
hash: S256_HASH_ALG,
|
|
50
58
|
modulusLength: MODULUS_LENGTH,
|
|
51
59
|
publicExponent: PUBLIC_EXPONENT,
|
|
52
60
|
};
|
|
53
61
|
|
|
62
|
+
export const RSA_SIGN_ALGORITHM_OPTIONS: Algorithm = {
|
|
63
|
+
name: PKCS1_V15_KEYGEN_ALG,
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export const ECDSA_P256_KEYGEN_ALGORITHM_OPTIONS: EcKeyGenParams = {
|
|
67
|
+
name: "ECDSA",
|
|
68
|
+
namedCurve: JSON_WEB_KEY_CURVE_P256,
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export const ECDSA_SHA256_SIGN_ALGORITHM_OPTIONS: EcdsaParams = {
|
|
72
|
+
name: "ECDSA",
|
|
73
|
+
hash: { name: S256_HASH_ALG },
|
|
74
|
+
};
|
|
75
|
+
|
|
54
76
|
/**
|
|
55
77
|
* Check whether browser crypto is available.
|
|
56
78
|
*/
|
|
@@ -157,16 +179,18 @@ export function createNewGuid(): string {
|
|
|
157
179
|
}
|
|
158
180
|
|
|
159
181
|
/**
|
|
160
|
-
* Generates a keypair based on
|
|
182
|
+
* Generates a keypair based on the provided algorithm config.
|
|
161
183
|
* @param extractable
|
|
162
184
|
* @param usages
|
|
185
|
+
* @param algorithm
|
|
163
186
|
*/
|
|
164
187
|
export async function generateKeyPair(
|
|
165
188
|
extractable: boolean,
|
|
166
|
-
usages: Array<KeyUsage
|
|
189
|
+
usages: Array<KeyUsage>,
|
|
190
|
+
algorithm: AlgorithmIdentifier
|
|
167
191
|
): Promise<CryptoKeyPair> {
|
|
168
192
|
return window.crypto.subtle.generateKey(
|
|
169
|
-
|
|
193
|
+
algorithm,
|
|
170
194
|
extractable,
|
|
171
195
|
usages
|
|
172
196
|
) as Promise<CryptoKeyPair>;
|
|
@@ -188,32 +212,36 @@ export async function exportJwk(key: CryptoKey): Promise<JsonWebKey> {
|
|
|
188
212
|
* @param key
|
|
189
213
|
* @param extractable
|
|
190
214
|
* @param usages
|
|
215
|
+
* @param algorithm
|
|
191
216
|
*/
|
|
192
217
|
export async function importJwk(
|
|
193
218
|
key: JsonWebKey,
|
|
194
219
|
extractable: boolean,
|
|
195
|
-
usages: Array<KeyUsage
|
|
220
|
+
usages: Array<KeyUsage>,
|
|
221
|
+
algorithm: AlgorithmIdentifier
|
|
196
222
|
): Promise<CryptoKey> {
|
|
197
223
|
return window.crypto.subtle.importKey(
|
|
198
224
|
KEY_FORMAT_JWK,
|
|
199
225
|
key,
|
|
200
|
-
|
|
226
|
+
algorithm,
|
|
201
227
|
extractable,
|
|
202
228
|
usages
|
|
203
229
|
) as Promise<CryptoKey>;
|
|
204
230
|
}
|
|
205
231
|
|
|
206
232
|
/**
|
|
207
|
-
* Signs given data with given key
|
|
233
|
+
* Signs given data with given key.
|
|
208
234
|
* @param key
|
|
209
235
|
* @param data
|
|
236
|
+
* @param algorithm
|
|
210
237
|
*/
|
|
211
238
|
export async function sign(
|
|
212
239
|
key: CryptoKey,
|
|
213
|
-
data: ArrayBuffer
|
|
240
|
+
data: ArrayBuffer,
|
|
241
|
+
algorithm: AlgorithmIdentifier
|
|
214
242
|
): Promise<ArrayBuffer> {
|
|
215
243
|
return window.crypto.subtle.sign(
|
|
216
|
-
|
|
244
|
+
algorithm,
|
|
217
245
|
key,
|
|
218
246
|
data
|
|
219
247
|
) as Promise<ArrayBuffer>;
|
|
@@ -428,3 +456,70 @@ export async function hashString(plainText: string): Promise<string> {
|
|
|
428
456
|
const hashBytes = new Uint8Array(hashBuffer);
|
|
429
457
|
return urlEncodeArr(hashBytes);
|
|
430
458
|
}
|
|
459
|
+
|
|
460
|
+
const JWK_THUMBPRINT_REQUIRED_MEMBERS: Record<string, Array<string>> = {
|
|
461
|
+
[JSON_WEB_KEY_TYPE_EC]: ["crv", "kty", "x", "y"],
|
|
462
|
+
[JSON_WEB_KEY_TYPE_RSA]: ["e", "kty", "n"],
|
|
463
|
+
};
|
|
464
|
+
|
|
465
|
+
function getJwkThumbprintMembers(
|
|
466
|
+
publicJwk: JsonWebKey
|
|
467
|
+
): Record<string, string> {
|
|
468
|
+
const kty = publicJwk.kty;
|
|
469
|
+
if (typeof kty !== "string" || kty.length === 0) {
|
|
470
|
+
throw createBrowserAuthError(
|
|
471
|
+
BrowserAuthErrorCodes.invalidPublicJwk,
|
|
472
|
+
"",
|
|
473
|
+
MISSING_JWK_KTY_SUBERROR
|
|
474
|
+
);
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
const requiredMembers = JWK_THUMBPRINT_REQUIRED_MEMBERS[kty];
|
|
478
|
+
if (!requiredMembers) {
|
|
479
|
+
throw createBrowserAuthError(
|
|
480
|
+
BrowserAuthErrorCodes.invalidPublicJwk,
|
|
481
|
+
"",
|
|
482
|
+
UNSUPPORTED_JWK_KTY_SUBERROR
|
|
483
|
+
);
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
return requiredMembers.reduce((thumbprintMembers, memberName) => {
|
|
487
|
+
const memberValue = publicJwk[memberName as keyof JsonWebKey];
|
|
488
|
+
if (typeof memberValue !== "string") {
|
|
489
|
+
throw createBrowserAuthError(
|
|
490
|
+
BrowserAuthErrorCodes.invalidPublicJwk,
|
|
491
|
+
"",
|
|
492
|
+
MISSING_JWK_MEMBER_SUBERROR
|
|
493
|
+
);
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
if (memberValue.length === 0) {
|
|
497
|
+
throw createBrowserAuthError(
|
|
498
|
+
BrowserAuthErrorCodes.invalidPublicJwk,
|
|
499
|
+
"",
|
|
500
|
+
EMPTY_JWK_MEMBER_SUBERROR
|
|
501
|
+
);
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
thumbprintMembers[memberName] = memberValue;
|
|
505
|
+
return thumbprintMembers;
|
|
506
|
+
}, {} as Record<string, string>);
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* Computes an RFC 7638 JWK thumbprint for a public key.
|
|
511
|
+
* The required members for the JWK key type are serialised in lexicographic order
|
|
512
|
+
* and the SHA-256 digest is returned as a base64url string.
|
|
513
|
+
* @internal
|
|
514
|
+
*/
|
|
515
|
+
export async function computeJwkThumbprint(
|
|
516
|
+
publicJwk: JsonWebKey
|
|
517
|
+
): Promise<string> {
|
|
518
|
+
const thumbprintMembers = getJwkThumbprintMembers(publicJwk);
|
|
519
|
+
// RFC 7638 §3.3: use only required members, sorted lexicographically
|
|
520
|
+
const thumbprintJson = JSON.stringify(
|
|
521
|
+
thumbprintMembers,
|
|
522
|
+
Object.keys(thumbprintMembers).sort()
|
|
523
|
+
);
|
|
524
|
+
return hashString(thumbprintJson);
|
|
525
|
+
}
|
package/src/crypto/CryptoOps.ts
CHANGED
|
@@ -123,7 +123,8 @@ export class CryptoOps implements ICrypto {
|
|
|
123
123
|
// Generate Keypair
|
|
124
124
|
const keyPair: CryptoKeyPair = await BrowserCrypto.generateKeyPair(
|
|
125
125
|
CryptoOps.EXTRACTABLE,
|
|
126
|
-
CryptoOps.POP_KEY_USAGES
|
|
126
|
+
CryptoOps.POP_KEY_USAGES,
|
|
127
|
+
BrowserCrypto.RSA_KEYGEN_ALGORITHM_OPTIONS
|
|
127
128
|
);
|
|
128
129
|
|
|
129
130
|
// Generate Thumbprint for Public Key
|
|
@@ -131,15 +132,9 @@ export class CryptoOps implements ICrypto {
|
|
|
131
132
|
keyPair.publicKey
|
|
132
133
|
);
|
|
133
134
|
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
n: publicKeyJwk.n,
|
|
138
|
-
};
|
|
139
|
-
|
|
140
|
-
const publicJwkString: string =
|
|
141
|
-
getSortedObjectString(pubKeyThumprintObj);
|
|
142
|
-
const publicJwkHash = await this.hashString(publicJwkString);
|
|
135
|
+
const publicJwkHash = await BrowserCrypto.computeJwkThumbprint(
|
|
136
|
+
publicKeyJwk
|
|
137
|
+
);
|
|
143
138
|
|
|
144
139
|
// Generate Thumbprint for Private Key
|
|
145
140
|
const privateKeyJwk: JsonWebKey = await BrowserCrypto.exportJwk(
|
|
@@ -147,7 +142,12 @@ export class CryptoOps implements ICrypto {
|
|
|
147
142
|
);
|
|
148
143
|
// Re-import private key to make it unextractable
|
|
149
144
|
const unextractablePrivateKey: CryptoKey =
|
|
150
|
-
await BrowserCrypto.importJwk(
|
|
145
|
+
await BrowserCrypto.importJwk(
|
|
146
|
+
privateKeyJwk,
|
|
147
|
+
false,
|
|
148
|
+
["sign"],
|
|
149
|
+
BrowserCrypto.RSA_KEYGEN_ALGORITHM_OPTIONS
|
|
150
|
+
);
|
|
151
151
|
|
|
152
152
|
// Store Keypair data in keystore
|
|
153
153
|
await this.cache.setItem(
|
|
@@ -278,7 +278,8 @@ export class CryptoOps implements ICrypto {
|
|
|
278
278
|
const tokenBuffer = encoder.encode(tokenString);
|
|
279
279
|
const signatureBuffer = await BrowserCrypto.sign(
|
|
280
280
|
cachedKeyPair.privateKey,
|
|
281
|
-
tokenBuffer
|
|
281
|
+
tokenBuffer,
|
|
282
|
+
BrowserCrypto.RSA_SIGN_ALGORITHM_OPTIONS
|
|
282
283
|
);
|
|
283
284
|
const encodedSignature = urlEncodeArr(new Uint8Array(signatureBuffer));
|
|
284
285
|
|
|
@@ -42,6 +42,7 @@ export const getRequestFailed = "get_request_failed";
|
|
|
42
42
|
export const failedToParseResponse = "failed_to_parse_response";
|
|
43
43
|
export const unableToLoadToken = "unable_to_load_token";
|
|
44
44
|
export const cryptoKeyNotFound = "crypto_key_not_found";
|
|
45
|
+
export const invalidPublicJwk = "invalid_public_jwk";
|
|
45
46
|
export const authCodeRequired = "auth_code_required";
|
|
46
47
|
export const authCodeOrNativeAccountIdRequired =
|
|
47
48
|
"auth_code_or_nativeAccountId_required";
|
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
ScopeSet,
|
|
28
28
|
ServerTelemetryManager,
|
|
29
29
|
SignedHttpRequestParameters,
|
|
30
|
+
StoreInCache,
|
|
30
31
|
TimeUtils,
|
|
31
32
|
TokenClaims,
|
|
32
33
|
UrlString,
|
|
@@ -182,77 +183,119 @@ export class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
182
183
|
this.config.system.serverTelemetryEnabled
|
|
183
184
|
);
|
|
184
185
|
|
|
186
|
+
// initialize native request (statically builds the request; does not contact the broker)
|
|
187
|
+
let nativeRequest: PlatformAuthRequest;
|
|
185
188
|
try {
|
|
186
|
-
|
|
187
|
-
|
|
189
|
+
nativeRequest = await this.initializePlatformRequest(request);
|
|
190
|
+
} catch (e) {
|
|
191
|
+
/*
|
|
192
|
+
* Request initialization (e.g. PoP token generation or authority
|
|
193
|
+
* resolution) failed before the broker was contacted, so end the
|
|
194
|
+
* measurement here to avoid an orphaned sub-measurement.
|
|
195
|
+
* Broker was never engaged, so this was not a native broker outcome.
|
|
196
|
+
*/
|
|
197
|
+
nativeATMeasurement.add({
|
|
198
|
+
isNativeBroker: false,
|
|
199
|
+
});
|
|
200
|
+
nativeATMeasurement.end(
|
|
201
|
+
{
|
|
202
|
+
success: false,
|
|
203
|
+
},
|
|
204
|
+
e
|
|
205
|
+
);
|
|
206
|
+
throw e;
|
|
207
|
+
}
|
|
188
208
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
);
|
|
207
|
-
nativeATMeasurement.end({
|
|
208
|
-
success: false,
|
|
209
|
-
brokerErrorCode: "cache_request_failed",
|
|
210
|
-
});
|
|
211
|
-
throw e;
|
|
212
|
-
}
|
|
213
|
-
// continue with a native call for any and all errors
|
|
209
|
+
// check if the tokens can be retrieved from internal cache
|
|
210
|
+
try {
|
|
211
|
+
const result = await this.acquireTokensFromCache(
|
|
212
|
+
this.accountId,
|
|
213
|
+
nativeRequest
|
|
214
|
+
);
|
|
215
|
+
// Served from the native internal cache; token did not come directly from the broker
|
|
216
|
+
nativeATMeasurement.add({
|
|
217
|
+
isNativeBroker: false,
|
|
218
|
+
});
|
|
219
|
+
nativeATMeasurement.end({
|
|
220
|
+
success: true,
|
|
221
|
+
fromCache: true,
|
|
222
|
+
});
|
|
223
|
+
return result;
|
|
224
|
+
} catch (e) {
|
|
225
|
+
if (cacheLookupPolicy === CacheLookupPolicy.AccessToken) {
|
|
214
226
|
this.logger.info(
|
|
215
|
-
"MSAL internal Cache does not contain tokens,
|
|
227
|
+
"MSAL internal Cache does not contain tokens, return error as per cache policy",
|
|
216
228
|
this.correlationId
|
|
217
229
|
);
|
|
230
|
+
nativeATMeasurement.add({
|
|
231
|
+
isNativeBroker: false,
|
|
232
|
+
});
|
|
233
|
+
nativeATMeasurement.end({
|
|
234
|
+
success: false,
|
|
235
|
+
});
|
|
236
|
+
throw e;
|
|
218
237
|
}
|
|
238
|
+
// continue with a native call for any and all errors
|
|
239
|
+
this.logger.info(
|
|
240
|
+
"MSAL internal Cache does not contain tokens, proceed to make a native call",
|
|
241
|
+
this.correlationId
|
|
242
|
+
);
|
|
243
|
+
}
|
|
219
244
|
|
|
245
|
+
// dispatch the request to the broker
|
|
246
|
+
try {
|
|
220
247
|
const validatedResponse: PlatformAuthResponse =
|
|
221
248
|
await this.platformAuthProvider.sendMessage(nativeRequest);
|
|
222
249
|
|
|
223
|
-
|
|
250
|
+
const result = await this.handleNativeResponse(
|
|
224
251
|
validatedResponse,
|
|
225
252
|
nativeRequest,
|
|
226
|
-
reqTimestamp
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
return result;
|
|
236
|
-
})
|
|
237
|
-
.catch((error: AuthError) => {
|
|
238
|
-
nativeATMeasurement.end({
|
|
239
|
-
success: false,
|
|
240
|
-
errorCode: error.errorCode,
|
|
241
|
-
subErrorCode: error.subError,
|
|
242
|
-
});
|
|
243
|
-
throw error;
|
|
244
|
-
});
|
|
253
|
+
reqTimestamp,
|
|
254
|
+
request.storeInCache
|
|
255
|
+
);
|
|
256
|
+
nativeATMeasurement.end({
|
|
257
|
+
success: true,
|
|
258
|
+
requestId: result.requestId,
|
|
259
|
+
});
|
|
260
|
+
serverTelemetryManager.clearNativeBrokerErrorCode();
|
|
261
|
+
return result;
|
|
245
262
|
} catch (e) {
|
|
246
263
|
if (e instanceof NativeAuthError) {
|
|
247
264
|
serverTelemetryManager.setNativeBrokerErrorCode(e.errorCode);
|
|
248
265
|
}
|
|
249
|
-
nativeATMeasurement.end(
|
|
250
|
-
|
|
251
|
-
|
|
266
|
+
nativeATMeasurement.end(
|
|
267
|
+
{
|
|
268
|
+
success: false,
|
|
269
|
+
},
|
|
270
|
+
e
|
|
271
|
+
);
|
|
272
|
+
this.setBrokerErrorTelemetry(e);
|
|
252
273
|
throw e;
|
|
253
274
|
}
|
|
254
275
|
}
|
|
255
276
|
|
|
277
|
+
/**
|
|
278
|
+
* Records platform-broker error telemetry on the root event for the current
|
|
279
|
+
* correlationId. `isNativeBroker` is set optimistically to true because the
|
|
280
|
+
* broker was engaged; when the caller subsequently falls back to a web flow
|
|
281
|
+
* that succeeds, the root success measurement overrides it to false via
|
|
282
|
+
* `result.fromPlatformBroker`. Terminal broker errors (no fallback) retain
|
|
283
|
+
* true. `brokerErrorName`/`brokerErrorCode` are recorded when the error is an `AuthError`.
|
|
284
|
+
* @param error error thrown by the broker interaction
|
|
285
|
+
*/
|
|
286
|
+
private setBrokerErrorTelemetry(error: unknown): void {
|
|
287
|
+
if (error instanceof AuthError) {
|
|
288
|
+
this.performanceClient.addFields(
|
|
289
|
+
{
|
|
290
|
+
isNativeBroker: true,
|
|
291
|
+
brokerErrorName: error.name,
|
|
292
|
+
brokerErrorCode: error.errorCode,
|
|
293
|
+
},
|
|
294
|
+
this.correlationId
|
|
295
|
+
);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
256
299
|
/**
|
|
257
300
|
* Creates silent flow request
|
|
258
301
|
* @param request
|
|
@@ -387,13 +430,23 @@ export class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
387
430
|
);
|
|
388
431
|
serverTelemetryManager.setNativeBrokerErrorCode(e.errorCode);
|
|
389
432
|
if (isFatalNativeAuthError(e)) {
|
|
433
|
+
/*
|
|
434
|
+
* Fatal error on redirect initiate always falls back to a
|
|
435
|
+
* regular web redirect, so this request did not complete
|
|
436
|
+
* natively. Token telemetry for the eventual outcome lands
|
|
437
|
+
* in handleRedirectPromise (phase 2).
|
|
438
|
+
*/
|
|
439
|
+
this.setBrokerErrorTelemetry(e);
|
|
390
440
|
throw e;
|
|
391
441
|
}
|
|
392
442
|
}
|
|
393
443
|
}
|
|
394
444
|
this.browserStorage.setTemporaryCache(
|
|
395
445
|
TemporaryCacheKeys.NATIVE_REQUEST,
|
|
396
|
-
JSON.stringify(
|
|
446
|
+
JSON.stringify({
|
|
447
|
+
...nativeRequest,
|
|
448
|
+
storeInCache: request.storeInCache,
|
|
449
|
+
}),
|
|
397
450
|
true
|
|
398
451
|
);
|
|
399
452
|
|
|
@@ -453,7 +506,14 @@ export class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
453
506
|
return null;
|
|
454
507
|
}
|
|
455
508
|
|
|
456
|
-
|
|
509
|
+
/*
|
|
510
|
+
* storeInCache is a client-side cache directive persisted alongside the cached
|
|
511
|
+
* request (not a broker-contract parameter), so extract it here before resending.
|
|
512
|
+
*/
|
|
513
|
+
const { prompt, storeInCache, ...request } =
|
|
514
|
+
cachedRequest as PlatformAuthRequest & {
|
|
515
|
+
storeInCache?: StoreInCache;
|
|
516
|
+
};
|
|
457
517
|
if (prompt) {
|
|
458
518
|
this.logger.verbose(
|
|
459
519
|
"NativeInteractionClient - handleRedirectPromise called and prompt was included in the original request, removing prompt from cached request to prevent second interaction with native broker window.",
|
|
@@ -479,7 +539,8 @@ export class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
479
539
|
const authResult = await this.handleNativeResponse(
|
|
480
540
|
response,
|
|
481
541
|
request,
|
|
482
|
-
reqTimestamp
|
|
542
|
+
reqTimestamp,
|
|
543
|
+
storeInCache
|
|
483
544
|
);
|
|
484
545
|
|
|
485
546
|
const serverTelemetryManager = initializeServerTelemetryManager(
|
|
@@ -492,12 +553,9 @@ export class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
492
553
|
this.config.system.serverTelemetryEnabled
|
|
493
554
|
);
|
|
494
555
|
serverTelemetryManager.clearNativeBrokerErrorCode();
|
|
495
|
-
this.performanceClient?.addFields(
|
|
496
|
-
{ isNativeBroker: true },
|
|
497
|
-
this.correlationId
|
|
498
|
-
);
|
|
499
556
|
return authResult;
|
|
500
557
|
} catch (e) {
|
|
558
|
+
this.setBrokerErrorTelemetry(e);
|
|
501
559
|
throw e;
|
|
502
560
|
}
|
|
503
561
|
}
|
|
@@ -523,7 +581,8 @@ export class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
523
581
|
protected async handleNativeResponse(
|
|
524
582
|
response: PlatformAuthResponse,
|
|
525
583
|
request: PlatformAuthRequest,
|
|
526
|
-
reqTimestamp: number
|
|
584
|
+
reqTimestamp: number,
|
|
585
|
+
storeInCache?: StoreInCache
|
|
527
586
|
): Promise<AuthenticationResult> {
|
|
528
587
|
this.logger.trace(
|
|
529
588
|
"NativeInteractionClient - handleNativeResponse called.",
|
|
@@ -618,7 +677,8 @@ export class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
618
677
|
idTokenClaims,
|
|
619
678
|
result.tenantId,
|
|
620
679
|
reqTimestamp,
|
|
621
|
-
authority.getPreferredCache() // environment
|
|
680
|
+
authority.getPreferredCache(), // environment
|
|
681
|
+
storeInCache
|
|
622
682
|
);
|
|
623
683
|
|
|
624
684
|
return result;
|
|
@@ -806,7 +866,9 @@ export class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
806
866
|
correlationId: this.correlationId,
|
|
807
867
|
state: response.state,
|
|
808
868
|
fromPlatformBroker: true,
|
|
809
|
-
...(request.resource && {
|
|
869
|
+
...(request.extraParameters?.resource && {
|
|
870
|
+
resource: request.extraParameters.resource,
|
|
871
|
+
}),
|
|
810
872
|
};
|
|
811
873
|
|
|
812
874
|
return result;
|
|
@@ -851,7 +913,8 @@ export class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
851
913
|
idTokenClaims: TokenClaims,
|
|
852
914
|
tenantId: string,
|
|
853
915
|
reqTimestamp: number,
|
|
854
|
-
environment: string
|
|
916
|
+
environment: string,
|
|
917
|
+
storeInCache?: StoreInCache
|
|
855
918
|
): Promise<void> {
|
|
856
919
|
const cachedIdToken: IdTokenEntity | null =
|
|
857
920
|
CacheHelpers.createIdTokenEntity(
|
|
@@ -894,7 +957,7 @@ export class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
894
957
|
);
|
|
895
958
|
|
|
896
959
|
// save idtoken credential in configured browser storage
|
|
897
|
-
if (!!cachedIdToken &&
|
|
960
|
+
if (!!cachedIdToken && storeInCache?.idToken !== false) {
|
|
898
961
|
await this.browserStorage.setIdTokenCredential(
|
|
899
962
|
cachedIdToken,
|
|
900
963
|
this.correlationId,
|
|
@@ -912,7 +975,7 @@ export class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
912
975
|
this.correlationId,
|
|
913
976
|
AuthToken.isKmsi(idTokenClaims),
|
|
914
977
|
this.apiId,
|
|
915
|
-
|
|
978
|
+
storeInCache
|
|
916
979
|
);
|
|
917
980
|
}
|
|
918
981
|
|
|
@@ -1018,8 +1081,8 @@ export class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
1018
1081
|
? undefined
|
|
1019
1082
|
: this.config.auth.clientCapabilities;
|
|
1020
1083
|
|
|
1021
|
-
// scopes are expected to be received by the native broker as "scope" and will be added to the request below.
|
|
1022
|
-
const { scopes, claims
|
|
1084
|
+
// scopes are expected to be received by the native broker as "scope" and will be added to the request below. 'resource' is added in extraParameters for MCP scenarios.
|
|
1085
|
+
const { scopes, claims } = request;
|
|
1023
1086
|
const scopeSet = new ScopeSet(scopes || [], this.correlationId);
|
|
1024
1087
|
scopeSet.appendScopes(Constants.OIDC_DEFAULT_SCOPES);
|
|
1025
1088
|
|
|
@@ -1029,7 +1092,6 @@ export class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
1029
1092
|
);
|
|
1030
1093
|
|
|
1031
1094
|
const validatedRequest: PlatformAuthRequest = {
|
|
1032
|
-
...remainingProperties,
|
|
1033
1095
|
claims: mergedClaims,
|
|
1034
1096
|
accountId: this.accountId,
|
|
1035
1097
|
clientId: this.config.auth.clientId,
|
|
@@ -1043,13 +1105,22 @@ export class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
1043
1105
|
),
|
|
1044
1106
|
prompt: this.getPrompt(request.prompt),
|
|
1045
1107
|
correlationId: this.correlationId,
|
|
1108
|
+
isSts: false,
|
|
1046
1109
|
tokenType: request.authenticationScheme,
|
|
1047
1110
|
windowTitleSubstring: document.title,
|
|
1111
|
+
nonce: request.nonce,
|
|
1112
|
+
state: request.state,
|
|
1113
|
+
loginHint: request.loginHint,
|
|
1048
1114
|
extraParameters: {
|
|
1049
1115
|
...request.extraParameters,
|
|
1116
|
+
...(request.resource && { resource: request.resource }), // resource is set for MCP scenarios
|
|
1050
1117
|
},
|
|
1051
1118
|
extendedExpiryToken: false, // Make this configurable?
|
|
1052
1119
|
keyId: request.popKid,
|
|
1120
|
+
resourceRequestMethod: request.resourceRequestMethod,
|
|
1121
|
+
resourceRequestUri: request.resourceRequestUri,
|
|
1122
|
+
shrClaims: request.shrClaims,
|
|
1123
|
+
shrNonce: request.shrNonce,
|
|
1053
1124
|
};
|
|
1054
1125
|
|
|
1055
1126
|
// Check for PoP token requests: signPopToken should only be set to true if popKid is not set
|
|
@@ -1060,7 +1131,10 @@ export class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
1060
1131
|
);
|
|
1061
1132
|
}
|
|
1062
1133
|
|
|
1063
|
-
this.handleExtraBrokerParams(
|
|
1134
|
+
this.handleExtraBrokerParams(
|
|
1135
|
+
validatedRequest,
|
|
1136
|
+
request.embeddedClientId
|
|
1137
|
+
);
|
|
1064
1138
|
validatedRequest.extraParameters =
|
|
1065
1139
|
validatedRequest.extraParameters || {};
|
|
1066
1140
|
validatedRequest.extraParameters.telemetry =
|
|
@@ -1192,7 +1266,10 @@ export class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
1192
1266
|
* @param request {PlatformAuthRequest}
|
|
1193
1267
|
* @private
|
|
1194
1268
|
*/
|
|
1195
|
-
private handleExtraBrokerParams(
|
|
1269
|
+
private handleExtraBrokerParams(
|
|
1270
|
+
request: PlatformAuthRequest,
|
|
1271
|
+
embeddedClientId?: string
|
|
1272
|
+
): void {
|
|
1196
1273
|
const hasExtraBrokerParams =
|
|
1197
1274
|
request.extraParameters &&
|
|
1198
1275
|
request.extraParameters.hasOwnProperty(
|
|
@@ -1205,16 +1282,16 @@ export class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
1205
1282
|
AADServerParamKeys.CLIENT_ID
|
|
1206
1283
|
);
|
|
1207
1284
|
|
|
1208
|
-
if (!
|
|
1285
|
+
if (!embeddedClientId && !hasExtraBrokerParams) {
|
|
1209
1286
|
return;
|
|
1210
1287
|
}
|
|
1211
1288
|
|
|
1212
1289
|
let child_client_id: string = "";
|
|
1213
1290
|
const child_redirect_uri = request.redirectUri;
|
|
1214
1291
|
|
|
1215
|
-
if (
|
|
1292
|
+
if (embeddedClientId) {
|
|
1216
1293
|
request.redirectUri = this.config.auth.redirectUri;
|
|
1217
|
-
child_client_id =
|
|
1294
|
+
child_client_id = embeddedClientId;
|
|
1218
1295
|
} else if (request.extraParameters) {
|
|
1219
1296
|
request.redirectUri =
|
|
1220
1297
|
request.extraParameters[AADServerParamKeys.BROKER_REDIRECT_URI];
|
|
@@ -1222,7 +1299,18 @@ export class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
1222
1299
|
request.extraParameters[AADServerParamKeys.CLIENT_ID];
|
|
1223
1300
|
}
|
|
1224
1301
|
|
|
1302
|
+
const {
|
|
1303
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1304
|
+
[AADServerParamKeys.BROKER_CLIENT_ID]: _brkClientId,
|
|
1305
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1306
|
+
[AADServerParamKeys.BROKER_REDIRECT_URI]: _brkRedirectUri,
|
|
1307
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1308
|
+
[AADServerParamKeys.CLIENT_ID]: _clientId,
|
|
1309
|
+
...remainingExtraParameters
|
|
1310
|
+
} = request.extraParameters || {};
|
|
1311
|
+
|
|
1225
1312
|
request.extraParameters = {
|
|
1313
|
+
...remainingExtraParameters,
|
|
1226
1314
|
child_client_id,
|
|
1227
1315
|
child_redirect_uri,
|
|
1228
1316
|
};
|