@azure/msal-browser 3.7.0 → 3.7.2-alpha.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/AsyncMemoryStorage.mjs +1 -1
- package/dist/cache/BrowserCacheManager.mjs +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 +3 -2
- package/dist/cache/TokenCache.mjs.map +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.d.ts.map +1 -1
- package/dist/controllers/StandardController.mjs +9 -3
- package/dist/controllers/StandardController.mjs.map +1 -1
- package/dist/controllers/UnknownOperatingContextController.mjs +1 -1
- package/dist/crypto/BrowserCrypto.d.ts +6 -3
- package/dist/crypto/BrowserCrypto.d.ts.map +1 -1
- package/dist/crypto/BrowserCrypto.mjs +54 -5
- package/dist/crypto/BrowserCrypto.mjs.map +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.d.ts +5 -4
- package/dist/interaction_client/BaseInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/BaseInteractionClient.mjs +18 -23
- package/dist/interaction_client/BaseInteractionClient.mjs.map +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 +3 -2
- package/dist/interaction_client/NativeInteractionClient.mjs.map +1 -1
- package/dist/interaction_client/PopupClient.d.ts.map +1 -1
- package/dist/interaction_client/PopupClient.mjs +4 -3
- 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 +4 -3
- 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 +2 -2
- package/dist/interaction_client/SilentAuthCodeClient.mjs.map +1 -1
- package/dist/interaction_client/SilentCacheClient.d.ts +1 -1
- package/dist/interaction_client/SilentCacheClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentCacheClient.mjs +5 -5
- package/dist/interaction_client/SilentCacheClient.mjs.map +1 -1
- package/dist/interaction_client/SilentIframeClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentIframeClient.mjs +2 -2
- package/dist/interaction_client/SilentIframeClient.mjs.map +1 -1
- package/dist/interaction_client/SilentRefreshClient.d.ts +2 -2
- package/dist/interaction_client/SilentRefreshClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentRefreshClient.mjs +5 -5
- package/dist/interaction_client/SilentRefreshClient.mjs.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.d.ts +3 -9
- package/dist/interaction_client/StandardInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.mjs +6 -29
- package/dist/interaction_client/StandardInteractionClient.mjs.map +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/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.d.ts.map +1 -1
- package/dist/packageMetadata.mjs +2 -2
- package/dist/request/SilentRequest.d.ts +1 -0
- package/dist/request/SilentRequest.d.ts.map +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 +261 -712
- package/lib/msal-browser.cjs.map +1 -1
- package/lib/msal-browser.js +261 -712
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +67 -66
- package/package.json +4 -4
- package/src/cache/TokenCache.ts +3 -1
- package/src/controllers/StandardController.ts +8 -2
- package/src/crypto/BrowserCrypto.ts +57 -4
- package/src/interaction_client/BaseInteractionClient.ts +41 -44
- package/src/interaction_client/NativeInteractionClient.ts +6 -1
- package/src/interaction_client/PopupClient.ts +8 -2
- package/src/interaction_client/RedirectClient.ts +8 -2
- package/src/interaction_client/SilentAuthCodeClient.ts +6 -1
- package/src/interaction_client/SilentCacheClient.ts +6 -4
- package/src/interaction_client/SilentIframeClient.ts +2 -1
- package/src/interaction_client/SilentRefreshClient.ts +7 -4
- package/src/interaction_client/StandardInteractionClient.ts +11 -57
- package/src/packageMetadata.ts +1 -1
- package/src/request/SilentRequest.ts +1 -0
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.7.0",
|
|
13
|
+
"version": "3.7.2-alpha.0",
|
|
14
14
|
"description": "Microsoft Authentication Library for js",
|
|
15
15
|
"keywords": [
|
|
16
16
|
"implicit",
|
|
@@ -85,11 +85,11 @@
|
|
|
85
85
|
"@types/node": "^20.3.1",
|
|
86
86
|
"@types/sinon": "^7.5.0",
|
|
87
87
|
"dotenv": "^8.2.0",
|
|
88
|
-
"eslint-config-msal": "
|
|
89
|
-
"msal-test-utils": "^0.0.1",
|
|
88
|
+
"eslint-config-msal": "file:../../shared-configs/eslint-config-msal",
|
|
90
89
|
"fake-indexeddb": "^3.1.3",
|
|
91
90
|
"jest": "^29.5.0",
|
|
92
91
|
"jest-environment-jsdom": "^29.5.0",
|
|
92
|
+
"msal-test-utils": "file:../../shared-test-utils",
|
|
93
93
|
"prettier": "2.8.7",
|
|
94
94
|
"rimraf": "^3.0.0",
|
|
95
95
|
"rollup": "^3.14.0",
|
|
@@ -101,6 +101,6 @@
|
|
|
101
101
|
"typescript": "^4.9.5"
|
|
102
102
|
},
|
|
103
103
|
"dependencies": {
|
|
104
|
-
"@azure/msal-common": "14.6.0"
|
|
104
|
+
"@azure/msal-common": "14.6.2-alpha.0"
|
|
105
105
|
}
|
|
106
106
|
}
|
package/src/cache/TokenCache.ts
CHANGED
|
@@ -31,6 +31,7 @@ import {
|
|
|
31
31
|
} from "../error/BrowserAuthError";
|
|
32
32
|
import { AuthenticationResult } from "../response/AuthenticationResult";
|
|
33
33
|
import { base64Decode } from "../encode/Base64Decode";
|
|
34
|
+
import * as BrowserCrypto from "../crypto/BrowserCrypto";
|
|
34
35
|
|
|
35
36
|
export type LoadTokenOptions = {
|
|
36
37
|
clientInfo?: string;
|
|
@@ -142,7 +143,8 @@ export class TokenCache implements ITokenCache {
|
|
|
142
143
|
this.config.system.networkClient,
|
|
143
144
|
this.storage,
|
|
144
145
|
authorityOptions,
|
|
145
|
-
this.logger
|
|
146
|
+
this.logger,
|
|
147
|
+
request.correlationId || BrowserCrypto.createNewGuid()
|
|
146
148
|
);
|
|
147
149
|
|
|
148
150
|
// "clientInfo" from options takes precedence over "clientInfo" in response
|
|
@@ -1950,7 +1950,10 @@ export class StandardController implements IController {
|
|
|
1950
1950
|
throw error;
|
|
1951
1951
|
});
|
|
1952
1952
|
this.activeSilentTokenRequests.set(silentRequestKey, response);
|
|
1953
|
-
return
|
|
1953
|
+
return {
|
|
1954
|
+
...(await response),
|
|
1955
|
+
state: request.state,
|
|
1956
|
+
};
|
|
1954
1957
|
} else {
|
|
1955
1958
|
this.logger.verbose(
|
|
1956
1959
|
"acquireTokenSilent has been called previously, returning the result from the first call",
|
|
@@ -1958,7 +1961,10 @@ export class StandardController implements IController {
|
|
|
1958
1961
|
);
|
|
1959
1962
|
// Discard measurements for memoized calls, as they are usually only a couple of ms and will artificially deflate metrics
|
|
1960
1963
|
atsMeasurement.discard();
|
|
1961
|
-
return
|
|
1964
|
+
return {
|
|
1965
|
+
...(await cachedResponse),
|
|
1966
|
+
state: request.state,
|
|
1967
|
+
};
|
|
1962
1968
|
}
|
|
1963
1969
|
}
|
|
1964
1970
|
|
|
@@ -30,6 +30,10 @@ const S256_HASH_ALG = "SHA-256";
|
|
|
30
30
|
const MODULUS_LENGTH = 2048;
|
|
31
31
|
// Public Exponent
|
|
32
32
|
const PUBLIC_EXPONENT: Uint8Array = new Uint8Array([0x01, 0x00, 0x01]);
|
|
33
|
+
// UUID hex digits
|
|
34
|
+
const UUID_CHARS = "0123456789abcdef";
|
|
35
|
+
// Array to store UINT32 random value
|
|
36
|
+
const UINT32_ARR = new Uint32Array(1);
|
|
33
37
|
|
|
34
38
|
const keygenAlgorithmOptions: RsaHashedKeyGenParams = {
|
|
35
39
|
name: PKCS1_V15_KEYGEN_ALG,
|
|
@@ -52,7 +56,9 @@ export function validateCryptoAvailable(logger: Logger): void {
|
|
|
52
56
|
|
|
53
57
|
/**
|
|
54
58
|
* Returns a sha-256 hash of the given dataString as an ArrayBuffer.
|
|
55
|
-
* @param dataString
|
|
59
|
+
* @param dataString {string} data string
|
|
60
|
+
* @param performanceClient {?IPerformanceClient}
|
|
61
|
+
* @param correlationId {?string} correlation id
|
|
56
62
|
*/
|
|
57
63
|
export async function sha256Digest(
|
|
58
64
|
dataString: string,
|
|
@@ -80,11 +86,58 @@ export function getRandomValues(dataBuffer: Uint8Array): Uint8Array {
|
|
|
80
86
|
}
|
|
81
87
|
|
|
82
88
|
/**
|
|
83
|
-
*
|
|
84
|
-
* @returns
|
|
89
|
+
* Returns random Uint32 value.
|
|
90
|
+
* @returns {number}
|
|
91
|
+
*/
|
|
92
|
+
function getRandomUint32(): number {
|
|
93
|
+
window.crypto.getRandomValues(UINT32_ARR);
|
|
94
|
+
return UINT32_ARR[0];
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Creates a UUID v7 from the current timestamp.
|
|
99
|
+
* Implementation relies on the system clock to guarantee increasing order of generated identifiers.
|
|
100
|
+
* @returns {number}
|
|
85
101
|
*/
|
|
86
102
|
export function createNewGuid(): string {
|
|
87
|
-
|
|
103
|
+
const currentTimestamp = Date.now();
|
|
104
|
+
const baseRand = getRandomUint32() * 0x400 + (getRandomUint32() & 0x3ff);
|
|
105
|
+
|
|
106
|
+
// Result byte array
|
|
107
|
+
const bytes = new Uint8Array(16);
|
|
108
|
+
// A 12-bit `rand_a` field value
|
|
109
|
+
const randA = Math.trunc(baseRand / 2 ** 30);
|
|
110
|
+
// The higher 30 bits of 62-bit `rand_b` field value
|
|
111
|
+
const randBHi = baseRand & (2 ** 30 - 1);
|
|
112
|
+
// The lower 32 bits of 62-bit `rand_b` field value
|
|
113
|
+
const randBLo = getRandomUint32();
|
|
114
|
+
|
|
115
|
+
bytes[0] = currentTimestamp / 2 ** 40;
|
|
116
|
+
bytes[1] = currentTimestamp / 2 ** 32;
|
|
117
|
+
bytes[2] = currentTimestamp / 2 ** 24;
|
|
118
|
+
bytes[3] = currentTimestamp / 2 ** 16;
|
|
119
|
+
bytes[4] = currentTimestamp / 2 ** 8;
|
|
120
|
+
bytes[5] = currentTimestamp;
|
|
121
|
+
bytes[6] = 0x70 | (randA >>> 8);
|
|
122
|
+
bytes[7] = randA;
|
|
123
|
+
bytes[8] = 0x80 | (randBHi >>> 24);
|
|
124
|
+
bytes[9] = randBHi >>> 16;
|
|
125
|
+
bytes[10] = randBHi >>> 8;
|
|
126
|
+
bytes[11] = randBHi;
|
|
127
|
+
bytes[12] = randBLo >>> 24;
|
|
128
|
+
bytes[13] = randBLo >>> 16;
|
|
129
|
+
bytes[14] = randBLo >>> 8;
|
|
130
|
+
bytes[15] = randBLo;
|
|
131
|
+
|
|
132
|
+
let text = "";
|
|
133
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
134
|
+
text += UUID_CHARS.charAt(bytes[i] >>> 4);
|
|
135
|
+
text += UUID_CHARS.charAt(bytes[i] & 0xf);
|
|
136
|
+
if (i === 3 || i === 5 || i === 7 || i === 9) {
|
|
137
|
+
text += "-";
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return text;
|
|
88
141
|
}
|
|
89
142
|
|
|
90
143
|
/**
|
|
@@ -22,6 +22,8 @@ import {
|
|
|
22
22
|
IPerformanceClient,
|
|
23
23
|
PerformanceEvents,
|
|
24
24
|
StringUtils,
|
|
25
|
+
AzureCloudOptions,
|
|
26
|
+
invokeAsync,
|
|
25
27
|
} from "@azure/msal-common";
|
|
26
28
|
import { BrowserConfiguration } from "../config/Configuration";
|
|
27
29
|
import { BrowserCacheManager } from "../cache/BrowserCacheManager";
|
|
@@ -136,8 +138,7 @@ export abstract class BaseInteractionClient {
|
|
|
136
138
|
* @param request
|
|
137
139
|
*/
|
|
138
140
|
protected async initializeBaseRequest(
|
|
139
|
-
request: Partial<BaseAuthRequest
|
|
140
|
-
account?: AccountInfo
|
|
141
|
+
request: Partial<BaseAuthRequest>
|
|
141
142
|
): Promise<BaseAuthRequest> {
|
|
142
143
|
this.performanceClient.addQueueMeasurement(
|
|
143
144
|
PerformanceEvents.InitializeBaseRequest,
|
|
@@ -145,10 +146,6 @@ export abstract class BaseInteractionClient {
|
|
|
145
146
|
);
|
|
146
147
|
const authority = request.authority || this.config.auth.authority;
|
|
147
148
|
|
|
148
|
-
if (account) {
|
|
149
|
-
await this.validateRequestAuthority(authority, account);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
149
|
const scopes = [...((request && request.scopes) || [])];
|
|
153
150
|
|
|
154
151
|
const validatedRequest: BaseAuthRequest = {
|
|
@@ -218,25 +215,6 @@ export abstract class BaseInteractionClient {
|
|
|
218
215
|
);
|
|
219
216
|
}
|
|
220
217
|
|
|
221
|
-
/*
|
|
222
|
-
* If authority provided in the request does not match environment/authority specified
|
|
223
|
-
* in the account or MSAL config, we throw an error.
|
|
224
|
-
*/
|
|
225
|
-
async validateRequestAuthority(
|
|
226
|
-
authority: string,
|
|
227
|
-
account: AccountInfo
|
|
228
|
-
): Promise<void> {
|
|
229
|
-
const discoveredAuthority = await this.getDiscoveredAuthority(
|
|
230
|
-
authority
|
|
231
|
-
);
|
|
232
|
-
|
|
233
|
-
if (!discoveredAuthority.isAlias(account.environment)) {
|
|
234
|
-
throw createClientConfigurationError(
|
|
235
|
-
ClientConfigurationErrorCodes.authorityMismatch
|
|
236
|
-
);
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
|
|
240
218
|
/**
|
|
241
219
|
*
|
|
242
220
|
* @param apiId
|
|
@@ -266,41 +244,60 @@ export abstract class BaseInteractionClient {
|
|
|
266
244
|
/**
|
|
267
245
|
* Used to get a discovered version of the default authority.
|
|
268
246
|
* @param requestAuthority
|
|
247
|
+
* @param requestAzureCloudOptions
|
|
248
|
+
* @param account
|
|
269
249
|
*/
|
|
270
250
|
protected async getDiscoveredAuthority(
|
|
271
|
-
requestAuthority?: string
|
|
251
|
+
requestAuthority?: string,
|
|
252
|
+
requestAzureCloudOptions?: AzureCloudOptions,
|
|
253
|
+
account?: AccountInfo
|
|
272
254
|
): Promise<Authority> {
|
|
273
|
-
this.
|
|
255
|
+
this.performanceClient.addQueueMeasurement(
|
|
256
|
+
PerformanceEvents.StandardInteractionClientGetDiscoveredAuthority,
|
|
257
|
+
this.correlationId
|
|
258
|
+
);
|
|
274
259
|
const authorityOptions: AuthorityOptions = {
|
|
275
260
|
protocolMode: this.config.auth.protocolMode,
|
|
276
261
|
OIDCOptions: this.config.auth.OIDCOptions,
|
|
277
262
|
knownAuthorities: this.config.auth.knownAuthorities,
|
|
278
263
|
cloudDiscoveryMetadata: this.config.auth.cloudDiscoveryMetadata,
|
|
279
264
|
authorityMetadata: this.config.auth.authorityMetadata,
|
|
265
|
+
skipAuthorityMetadataCache:
|
|
266
|
+
this.config.auth.skipAuthorityMetadataCache,
|
|
280
267
|
};
|
|
281
268
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
return AuthorityFactory.createDiscoveredInstance(
|
|
287
|
-
requestAuthority,
|
|
288
|
-
this.config.system.networkClient,
|
|
289
|
-
this.browserStorage,
|
|
290
|
-
authorityOptions,
|
|
291
|
-
this.logger
|
|
292
|
-
);
|
|
293
|
-
}
|
|
269
|
+
// build authority string based on auth params, precedence - azureCloudInstance + tenant >> authority
|
|
270
|
+
const userAuthority = requestAuthority
|
|
271
|
+
? requestAuthority
|
|
272
|
+
: this.config.auth.authority;
|
|
294
273
|
|
|
295
|
-
|
|
296
|
-
|
|
274
|
+
// fall back to the authority from config
|
|
275
|
+
const builtAuthority = Authority.generateAuthority(
|
|
276
|
+
userAuthority,
|
|
277
|
+
requestAzureCloudOptions || this.config.auth.azureCloudOptions
|
|
297
278
|
);
|
|
298
|
-
|
|
299
|
-
|
|
279
|
+
const discoveredAuthority = await invokeAsync(
|
|
280
|
+
AuthorityFactory.createDiscoveredInstance,
|
|
281
|
+
PerformanceEvents.AuthorityFactoryCreateDiscoveredInstance,
|
|
282
|
+
this.logger,
|
|
283
|
+
this.performanceClient,
|
|
284
|
+
this.correlationId
|
|
285
|
+
)(
|
|
286
|
+
builtAuthority,
|
|
300
287
|
this.config.system.networkClient,
|
|
301
288
|
this.browserStorage,
|
|
302
289
|
authorityOptions,
|
|
303
|
-
this.logger
|
|
290
|
+
this.logger,
|
|
291
|
+
this.correlationId,
|
|
292
|
+
this.performanceClient
|
|
304
293
|
);
|
|
294
|
+
|
|
295
|
+
if (account && !discoveredAuthority.isAlias(account.environment)) {
|
|
296
|
+
throw createClientConfigurationError(
|
|
297
|
+
ClientConfigurationErrorCodes.authorityMismatch
|
|
298
|
+
);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
return discoveredAuthority;
|
|
305
302
|
}
|
|
306
303
|
}
|
|
@@ -809,7 +809,12 @@ export class NativeInteractionClient extends BaseInteractionClient {
|
|
|
809
809
|
const authority = request.authority || this.config.auth.authority;
|
|
810
810
|
|
|
811
811
|
if (request.account) {
|
|
812
|
-
|
|
812
|
+
// validate authority
|
|
813
|
+
await this.getDiscoveredAuthority(
|
|
814
|
+
authority,
|
|
815
|
+
request.azureCloudOptions,
|
|
816
|
+
request.account
|
|
817
|
+
);
|
|
813
818
|
}
|
|
814
819
|
|
|
815
820
|
const canonicalAuthority = new UrlString(authority);
|
|
@@ -232,7 +232,8 @@ export class PopupClient extends StandardInteractionClient {
|
|
|
232
232
|
)(
|
|
233
233
|
serverTelemetryManager,
|
|
234
234
|
validRequest.authority,
|
|
235
|
-
validRequest.azureCloudOptions
|
|
235
|
+
validRequest.azureCloudOptions,
|
|
236
|
+
validRequest.account
|
|
236
237
|
);
|
|
237
238
|
|
|
238
239
|
const isNativeBroker = NativeMessageHandler.isNativeAvailable(
|
|
@@ -406,7 +407,12 @@ export class PopupClient extends StandardInteractionClient {
|
|
|
406
407
|
this.logger,
|
|
407
408
|
this.performanceClient,
|
|
408
409
|
this.correlationId
|
|
409
|
-
)(
|
|
410
|
+
)(
|
|
411
|
+
serverTelemetryManager,
|
|
412
|
+
requestAuthority,
|
|
413
|
+
undefined, // AzureCloudOptions
|
|
414
|
+
validRequest.account || undefined
|
|
415
|
+
);
|
|
410
416
|
|
|
411
417
|
try {
|
|
412
418
|
authClient.authority.endSessionEndpoint;
|
|
@@ -136,7 +136,8 @@ export class RedirectClient extends StandardInteractionClient {
|
|
|
136
136
|
)(
|
|
137
137
|
serverTelemetryManager,
|
|
138
138
|
validRequest.authority,
|
|
139
|
-
validRequest.azureCloudOptions
|
|
139
|
+
validRequest.azureCloudOptions,
|
|
140
|
+
validRequest.account
|
|
140
141
|
);
|
|
141
142
|
|
|
142
143
|
// Create redirect interaction handler.
|
|
@@ -520,7 +521,12 @@ export class RedirectClient extends StandardInteractionClient {
|
|
|
520
521
|
this.logger,
|
|
521
522
|
this.performanceClient,
|
|
522
523
|
this.correlationId
|
|
523
|
-
)(
|
|
524
|
+
)(
|
|
525
|
+
serverTelemetryManager,
|
|
526
|
+
logoutRequest && logoutRequest.authority,
|
|
527
|
+
undefined, // AzureCloudOptions
|
|
528
|
+
(logoutRequest && logoutRequest.account) || undefined
|
|
529
|
+
);
|
|
524
530
|
|
|
525
531
|
if (authClient.authority.protocolMode === ProtocolMode.OIDC) {
|
|
526
532
|
try {
|
|
@@ -99,7 +99,12 @@ export class SilentAuthCodeClient extends StandardInteractionClient {
|
|
|
99
99
|
this.logger,
|
|
100
100
|
this.performanceClient,
|
|
101
101
|
request.correlationId
|
|
102
|
-
)(
|
|
102
|
+
)(
|
|
103
|
+
serverTelemetryManager,
|
|
104
|
+
silentRequest.authority,
|
|
105
|
+
silentRequest.azureCloudOptions,
|
|
106
|
+
silentRequest.account
|
|
107
|
+
);
|
|
103
108
|
const authClient: HybridSpaAuthorizationCodeClient =
|
|
104
109
|
new HybridSpaAuthorizationCodeClient(clientConfig);
|
|
105
110
|
this.logger.verbose("Auth code client created");
|
|
@@ -42,7 +42,8 @@ export class SilentCacheClient extends StandardInteractionClient {
|
|
|
42
42
|
const silentAuthClient = await this.createSilentFlowClient(
|
|
43
43
|
serverTelemetryManager,
|
|
44
44
|
silentRequest.authority,
|
|
45
|
-
silentRequest.azureCloudOptions
|
|
45
|
+
silentRequest.azureCloudOptions,
|
|
46
|
+
silentRequest.account
|
|
46
47
|
);
|
|
47
48
|
this.logger.verbose("Silent auth client created");
|
|
48
49
|
|
|
@@ -94,7 +95,8 @@ export class SilentCacheClient extends StandardInteractionClient {
|
|
|
94
95
|
protected async createSilentFlowClient(
|
|
95
96
|
serverTelemetryManager: ServerTelemetryManager,
|
|
96
97
|
authorityUrl?: string,
|
|
97
|
-
azureCloudOptions?: AzureCloudOptions
|
|
98
|
+
azureCloudOptions?: AzureCloudOptions,
|
|
99
|
+
account?: AccountInfo
|
|
98
100
|
): Promise<SilentFlowClient> {
|
|
99
101
|
// Create auth module.
|
|
100
102
|
const clientConfig = await invokeAsync(
|
|
@@ -103,7 +105,7 @@ export class SilentCacheClient extends StandardInteractionClient {
|
|
|
103
105
|
this.logger,
|
|
104
106
|
this.performanceClient,
|
|
105
107
|
this.correlationId
|
|
106
|
-
)(serverTelemetryManager, authorityUrl, azureCloudOptions);
|
|
108
|
+
)(serverTelemetryManager, authorityUrl, azureCloudOptions, account);
|
|
107
109
|
return new SilentFlowClient(clientConfig, this.performanceClient);
|
|
108
110
|
}
|
|
109
111
|
|
|
@@ -122,7 +124,7 @@ export class SilentCacheClient extends StandardInteractionClient {
|
|
|
122
124
|
this.logger,
|
|
123
125
|
this.performanceClient,
|
|
124
126
|
this.correlationId
|
|
125
|
-
)(request
|
|
127
|
+
)(request);
|
|
126
128
|
return {
|
|
127
129
|
...request,
|
|
128
130
|
...baseRequest,
|
|
@@ -135,7 +135,8 @@ export class SilentIframeClient extends StandardInteractionClient {
|
|
|
135
135
|
)(
|
|
136
136
|
serverTelemetryManager,
|
|
137
137
|
silentRequest.authority,
|
|
138
|
-
silentRequest.azureCloudOptions
|
|
138
|
+
silentRequest.azureCloudOptions,
|
|
139
|
+
silentRequest.account
|
|
139
140
|
);
|
|
140
141
|
|
|
141
142
|
return await invokeAsync(
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
AzureCloudOptions,
|
|
13
13
|
PerformanceEvents,
|
|
14
14
|
invokeAsync,
|
|
15
|
+
AccountInfo,
|
|
15
16
|
} from "@azure/msal-common";
|
|
16
17
|
import { ApiId } from "../utils/BrowserConstants";
|
|
17
18
|
import {
|
|
@@ -39,7 +40,7 @@ export class SilentRefreshClient extends StandardInteractionClient {
|
|
|
39
40
|
this.logger,
|
|
40
41
|
this.performanceClient,
|
|
41
42
|
request.correlationId
|
|
42
|
-
)(request
|
|
43
|
+
)(request);
|
|
43
44
|
const silentRequest: CommonSilentFlowRequest = {
|
|
44
45
|
...request,
|
|
45
46
|
...baseRequest,
|
|
@@ -59,7 +60,8 @@ export class SilentRefreshClient extends StandardInteractionClient {
|
|
|
59
60
|
const refreshTokenClient = await this.createRefreshTokenClient(
|
|
60
61
|
serverTelemetryManager,
|
|
61
62
|
silentRequest.authority,
|
|
62
|
-
silentRequest.azureCloudOptions
|
|
63
|
+
silentRequest.azureCloudOptions,
|
|
64
|
+
silentRequest.account
|
|
63
65
|
);
|
|
64
66
|
// Send request to renew token. Auth module will throw errors if token cannot be renewed.
|
|
65
67
|
return invokeAsync(
|
|
@@ -97,7 +99,8 @@ export class SilentRefreshClient extends StandardInteractionClient {
|
|
|
97
99
|
protected async createRefreshTokenClient(
|
|
98
100
|
serverTelemetryManager: ServerTelemetryManager,
|
|
99
101
|
authorityUrl?: string,
|
|
100
|
-
azureCloudOptions?: AzureCloudOptions
|
|
102
|
+
azureCloudOptions?: AzureCloudOptions,
|
|
103
|
+
account?: AccountInfo
|
|
101
104
|
): Promise<RefreshTokenClient> {
|
|
102
105
|
// Create auth module.
|
|
103
106
|
const clientConfig = await invokeAsync(
|
|
@@ -106,7 +109,7 @@ export class SilentRefreshClient extends StandardInteractionClient {
|
|
|
106
109
|
this.logger,
|
|
107
110
|
this.performanceClient,
|
|
108
111
|
this.correlationId
|
|
109
|
-
)(serverTelemetryManager, authorityUrl, azureCloudOptions);
|
|
112
|
+
)(serverTelemetryManager, authorityUrl, azureCloudOptions, account);
|
|
110
113
|
return new RefreshTokenClient(clientConfig, this.performanceClient);
|
|
111
114
|
}
|
|
112
115
|
}
|
|
@@ -9,9 +9,6 @@ import {
|
|
|
9
9
|
Constants,
|
|
10
10
|
AuthorizationCodeClient,
|
|
11
11
|
ClientConfiguration,
|
|
12
|
-
AuthorityOptions,
|
|
13
|
-
Authority,
|
|
14
|
-
AuthorityFactory,
|
|
15
12
|
UrlString,
|
|
16
13
|
CommonEndSessionRequest,
|
|
17
14
|
ProtocolUtils,
|
|
@@ -207,7 +204,8 @@ export abstract class StandardInteractionClient extends BaseInteractionClient {
|
|
|
207
204
|
protected async createAuthCodeClient(
|
|
208
205
|
serverTelemetryManager: ServerTelemetryManager,
|
|
209
206
|
authorityUrl?: string,
|
|
210
|
-
requestAzureCloudOptions?: AzureCloudOptions
|
|
207
|
+
requestAzureCloudOptions?: AzureCloudOptions,
|
|
208
|
+
account?: AccountInfo
|
|
211
209
|
): Promise<AuthorizationCodeClient> {
|
|
212
210
|
this.performanceClient.addQueueMeasurement(
|
|
213
211
|
PerformanceEvents.StandardInteractionClientCreateAuthCodeClient,
|
|
@@ -220,7 +218,12 @@ export abstract class StandardInteractionClient extends BaseInteractionClient {
|
|
|
220
218
|
this.logger,
|
|
221
219
|
this.performanceClient,
|
|
222
220
|
this.correlationId
|
|
223
|
-
)(
|
|
221
|
+
)(
|
|
222
|
+
serverTelemetryManager,
|
|
223
|
+
authorityUrl,
|
|
224
|
+
requestAzureCloudOptions,
|
|
225
|
+
account
|
|
226
|
+
);
|
|
224
227
|
return new AuthorizationCodeClient(
|
|
225
228
|
clientConfig,
|
|
226
229
|
this.performanceClient
|
|
@@ -236,7 +239,8 @@ export abstract class StandardInteractionClient extends BaseInteractionClient {
|
|
|
236
239
|
protected async getClientConfiguration(
|
|
237
240
|
serverTelemetryManager: ServerTelemetryManager,
|
|
238
241
|
requestAuthority?: string,
|
|
239
|
-
requestAzureCloudOptions?: AzureCloudOptions
|
|
242
|
+
requestAzureCloudOptions?: AzureCloudOptions,
|
|
243
|
+
account?: AccountInfo
|
|
240
244
|
): Promise<ClientConfiguration> {
|
|
241
245
|
this.performanceClient.addQueueMeasurement(
|
|
242
246
|
PerformanceEvents.StandardInteractionClientGetClientConfiguration,
|
|
@@ -248,7 +252,7 @@ export abstract class StandardInteractionClient extends BaseInteractionClient {
|
|
|
248
252
|
this.logger,
|
|
249
253
|
this.performanceClient,
|
|
250
254
|
this.correlationId
|
|
251
|
-
)(requestAuthority, requestAzureCloudOptions);
|
|
255
|
+
)(requestAuthority, requestAzureCloudOptions, account);
|
|
252
256
|
const logger = this.config.system.loggerOptions;
|
|
253
257
|
|
|
254
258
|
return {
|
|
@@ -286,56 +290,6 @@ export abstract class StandardInteractionClient extends BaseInteractionClient {
|
|
|
286
290
|
};
|
|
287
291
|
}
|
|
288
292
|
|
|
289
|
-
/**
|
|
290
|
-
* Used to get a discovered version of the default authority.
|
|
291
|
-
* @param requestAuthority
|
|
292
|
-
* @param requestCorrelationId
|
|
293
|
-
*/
|
|
294
|
-
protected async getDiscoveredAuthority(
|
|
295
|
-
requestAuthority?: string,
|
|
296
|
-
requestAzureCloudOptions?: AzureCloudOptions
|
|
297
|
-
): Promise<Authority> {
|
|
298
|
-
this.performanceClient.addQueueMeasurement(
|
|
299
|
-
PerformanceEvents.StandardInteractionClientGetDiscoveredAuthority,
|
|
300
|
-
this.correlationId
|
|
301
|
-
);
|
|
302
|
-
const authorityOptions: AuthorityOptions = {
|
|
303
|
-
protocolMode: this.config.auth.protocolMode,
|
|
304
|
-
OIDCOptions: this.config.auth.OIDCOptions,
|
|
305
|
-
knownAuthorities: this.config.auth.knownAuthorities,
|
|
306
|
-
cloudDiscoveryMetadata: this.config.auth.cloudDiscoveryMetadata,
|
|
307
|
-
authorityMetadata: this.config.auth.authorityMetadata,
|
|
308
|
-
skipAuthorityMetadataCache:
|
|
309
|
-
this.config.auth.skipAuthorityMetadataCache,
|
|
310
|
-
};
|
|
311
|
-
|
|
312
|
-
// build authority string based on auth params, precedence - azureCloudInstance + tenant >> authority
|
|
313
|
-
const userAuthority = requestAuthority
|
|
314
|
-
? requestAuthority
|
|
315
|
-
: this.config.auth.authority;
|
|
316
|
-
|
|
317
|
-
// fall back to the authority from config
|
|
318
|
-
const builtAuthority = Authority.generateAuthority(
|
|
319
|
-
userAuthority,
|
|
320
|
-
requestAzureCloudOptions || this.config.auth.azureCloudOptions
|
|
321
|
-
);
|
|
322
|
-
return invokeAsync(
|
|
323
|
-
AuthorityFactory.createDiscoveredInstance.bind(AuthorityFactory),
|
|
324
|
-
PerformanceEvents.AuthorityFactoryCreateDiscoveredInstance,
|
|
325
|
-
this.logger,
|
|
326
|
-
this.performanceClient,
|
|
327
|
-
this.correlationId
|
|
328
|
-
)(
|
|
329
|
-
builtAuthority,
|
|
330
|
-
this.config.system.networkClient,
|
|
331
|
-
this.browserStorage,
|
|
332
|
-
authorityOptions,
|
|
333
|
-
this.logger,
|
|
334
|
-
this.performanceClient,
|
|
335
|
-
this.correlationId
|
|
336
|
-
);
|
|
337
|
-
}
|
|
338
|
-
|
|
339
293
|
/**
|
|
340
294
|
* Helper to initialize required request parameters for interactive APIs and ssoSilent()
|
|
341
295
|
* @param request
|
package/src/packageMetadata.ts
CHANGED