@azure/msal-common 14.13.0 → 14.14.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/account/AccountInfo.d.ts +9 -1
- package/dist/account/AccountInfo.d.ts.map +1 -1
- package/dist/account/AccountInfo.mjs +35 -18
- package/dist/account/AccountInfo.mjs.map +1 -1
- package/dist/account/AuthToken.mjs +1 -1
- package/dist/account/CcsCredential.mjs +1 -1
- package/dist/account/ClientInfo.mjs +1 -1
- package/dist/account/TokenClaims.mjs +1 -1
- package/dist/authority/Authority.mjs +1 -1
- package/dist/authority/AuthorityFactory.mjs +1 -1
- package/dist/authority/AuthorityMetadata.mjs +1 -1
- package/dist/authority/AuthorityOptions.mjs +1 -1
- package/dist/authority/AuthorityType.mjs +1 -1
- package/dist/authority/CloudInstanceDiscoveryErrorResponse.mjs +1 -1
- package/dist/authority/CloudInstanceDiscoveryResponse.mjs +1 -1
- package/dist/authority/OpenIdConfigResponse.mjs +1 -1
- package/dist/authority/ProtocolMode.mjs +1 -1
- package/dist/authority/RegionDiscovery.mjs +1 -1
- package/dist/cache/CacheManager.d.ts +0 -1
- package/dist/cache/CacheManager.d.ts.map +1 -1
- package/dist/cache/CacheManager.mjs +2 -5
- package/dist/cache/CacheManager.mjs.map +1 -1
- package/dist/cache/entities/AccountEntity.d.ts.map +1 -1
- package/dist/cache/entities/AccountEntity.mjs +4 -8
- package/dist/cache/entities/AccountEntity.mjs.map +1 -1
- package/dist/cache/entities/ServerTelemetryEntity.d.ts +1 -0
- package/dist/cache/entities/ServerTelemetryEntity.d.ts.map +1 -1
- package/dist/cache/persistence/TokenCacheContext.mjs +1 -1
- package/dist/cache/utils/CacheHelpers.mjs +1 -1
- package/dist/client/AuthorizationCodeClient.mjs +1 -1
- package/dist/client/BaseClient.mjs +1 -1
- package/dist/client/RefreshTokenClient.mjs +1 -1
- package/dist/client/SilentFlowClient.mjs +1 -1
- package/dist/config/ClientConfiguration.mjs +1 -1
- package/dist/constants/AADServerParamKeys.d.ts +1 -0
- package/dist/constants/AADServerParamKeys.d.ts.map +1 -1
- package/dist/constants/AADServerParamKeys.mjs +3 -2
- package/dist/constants/AADServerParamKeys.mjs.map +1 -1
- package/dist/crypto/ICrypto.mjs +1 -1
- package/dist/crypto/JoseHeader.mjs +1 -1
- package/dist/crypto/PopTokenGenerator.mjs +1 -1
- package/dist/error/AuthError.mjs +1 -1
- package/dist/error/AuthErrorCodes.mjs +1 -1
- package/dist/error/CacheError.mjs +1 -1
- package/dist/error/CacheErrorCodes.mjs +1 -1
- package/dist/error/ClientAuthError.mjs +1 -1
- package/dist/error/ClientAuthErrorCodes.mjs +1 -1
- package/dist/error/ClientConfigurationError.mjs +1 -1
- package/dist/error/ClientConfigurationErrorCodes.mjs +1 -1
- package/dist/error/InteractionRequiredAuthError.mjs +1 -1
- package/dist/error/InteractionRequiredAuthErrorCodes.mjs +1 -1
- package/dist/error/JoseHeaderError.mjs +1 -1
- package/dist/error/JoseHeaderErrorCodes.mjs +1 -1
- package/dist/error/ServerError.mjs +1 -1
- package/dist/index.cjs +105 -34
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/logger/Logger.mjs +1 -1
- package/dist/network/INetworkModule.mjs +1 -1
- package/dist/network/NetworkManager.mjs +1 -1
- package/dist/network/ThrottlingUtils.mjs +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.mjs +2 -2
- package/dist/request/AuthenticationHeaderParser.mjs +1 -1
- package/dist/request/RequestParameterBuilder.mjs +1 -1
- package/dist/request/RequestValidator.mjs +1 -1
- package/dist/request/ScopeSet.mjs +1 -1
- package/dist/response/ResponseHandler.d.ts.map +1 -1
- package/dist/response/ResponseHandler.mjs +6 -6
- package/dist/response/ResponseHandler.mjs.map +1 -1
- package/dist/telemetry/performance/PerformanceClient.mjs +1 -1
- package/dist/telemetry/performance/PerformanceEvent.mjs +1 -1
- package/dist/telemetry/performance/StubPerformanceClient.mjs +1 -1
- package/dist/telemetry/server/ServerTelemetryManager.d.ts +12 -0
- package/dist/telemetry/server/ServerTelemetryManager.d.ts.map +1 -1
- package/dist/telemetry/server/ServerTelemetryManager.mjs +61 -2
- package/dist/telemetry/server/ServerTelemetryManager.mjs.map +1 -1
- package/dist/url/UrlString.mjs +1 -1
- package/dist/utils/ClientAssertionUtils.mjs +1 -1
- package/dist/utils/Constants.mjs +1 -1
- package/dist/utils/FunctionWrappers.mjs +1 -1
- package/dist/utils/ProtocolUtils.mjs +1 -1
- package/dist/utils/StringUtils.mjs +1 -1
- package/dist/utils/TimeUtils.mjs +1 -1
- package/dist/utils/UrlUtils.mjs +1 -1
- package/package.json +1 -1
- package/src/account/AccountInfo.ts +37 -17
- package/src/cache/CacheManager.ts +2 -12
- package/src/cache/entities/AccountEntity.ts +8 -10
- package/src/cache/entities/ServerTelemetryEntity.ts +1 -0
- package/src/constants/AADServerParamKeys.ts +1 -0
- package/src/index.ts +1 -1
- package/src/packageMetadata.ts +1 -1
- package/src/response/ResponseHandler.ts +7 -6
- package/src/telemetry/server/ServerTelemetryManager.ts +95 -1
|
@@ -10,7 +10,7 @@ import { ClientInfo, buildClientInfo } from "../../account/ClientInfo";
|
|
|
10
10
|
import {
|
|
11
11
|
AccountInfo,
|
|
12
12
|
TenantProfile,
|
|
13
|
-
|
|
13
|
+
buildTenantProfile,
|
|
14
14
|
} from "../../account/AccountInfo";
|
|
15
15
|
import {
|
|
16
16
|
createClientAuthError,
|
|
@@ -214,15 +214,13 @@ export class AccountEntity {
|
|
|
214
214
|
if (accountDetails.tenantProfiles) {
|
|
215
215
|
account.tenantProfiles = accountDetails.tenantProfiles;
|
|
216
216
|
} else {
|
|
217
|
-
const
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
}
|
|
225
|
-
account.tenantProfiles = tenantProfiles;
|
|
217
|
+
const tenantProfile = buildTenantProfile(
|
|
218
|
+
accountDetails.homeAccountId,
|
|
219
|
+
account.localAccountId,
|
|
220
|
+
account.realm,
|
|
221
|
+
accountDetails.idTokenClaims
|
|
222
|
+
);
|
|
223
|
+
account.tenantProfiles = [tenantProfile];
|
|
226
224
|
}
|
|
227
225
|
|
|
228
226
|
return account;
|
package/src/index.ts
CHANGED
package/src/packageMetadata.ts
CHANGED
|
@@ -48,7 +48,7 @@ import {
|
|
|
48
48
|
} from "../account/TokenClaims";
|
|
49
49
|
import {
|
|
50
50
|
AccountInfo,
|
|
51
|
-
|
|
51
|
+
buildTenantProfile,
|
|
52
52
|
updateAccountTenantProfileData,
|
|
53
53
|
} from "../account/AccountInfo";
|
|
54
54
|
import * as CacheHelpers from "../cache/utils/CacheHelpers";
|
|
@@ -744,16 +744,17 @@ export function buildAccountToCache(
|
|
|
744
744
|
);
|
|
745
745
|
|
|
746
746
|
const tenantProfiles = baseAccount.tenantProfiles || [];
|
|
747
|
-
|
|
747
|
+
const tenantId = claimsTenantId || baseAccount.realm;
|
|
748
748
|
if (
|
|
749
|
-
|
|
750
|
-
idTokenClaims &&
|
|
749
|
+
tenantId &&
|
|
751
750
|
!tenantProfiles.find((tenantProfile) => {
|
|
752
|
-
return tenantProfile.tenantId ===
|
|
751
|
+
return tenantProfile.tenantId === tenantId;
|
|
753
752
|
})
|
|
754
753
|
) {
|
|
755
|
-
const newTenantProfile =
|
|
754
|
+
const newTenantProfile = buildTenantProfile(
|
|
756
755
|
homeAccountId,
|
|
756
|
+
baseAccount.localAccountId,
|
|
757
|
+
tenantId,
|
|
757
758
|
idTokenClaims
|
|
758
759
|
);
|
|
759
760
|
tenantProfiles.push(newTenantProfile);
|
|
@@ -17,6 +17,69 @@ import { ServerTelemetryRequest } from "./ServerTelemetryRequest";
|
|
|
17
17
|
import { ServerTelemetryEntity } from "../../cache/entities/ServerTelemetryEntity";
|
|
18
18
|
import { RegionDiscoveryMetadata } from "../../authority/RegionDiscoveryMetadata";
|
|
19
19
|
|
|
20
|
+
const skuGroupSeparator = ",";
|
|
21
|
+
const skuValueSeparator = "|";
|
|
22
|
+
|
|
23
|
+
type SkuParams = {
|
|
24
|
+
libraryName?: string;
|
|
25
|
+
libraryVersion?: string;
|
|
26
|
+
extensionName?: string;
|
|
27
|
+
extensionVersion?: string;
|
|
28
|
+
skus?: string;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
function makeExtraSkuString(params: SkuParams): string {
|
|
32
|
+
const {
|
|
33
|
+
skus,
|
|
34
|
+
libraryName,
|
|
35
|
+
libraryVersion,
|
|
36
|
+
extensionName,
|
|
37
|
+
extensionVersion,
|
|
38
|
+
} = params;
|
|
39
|
+
const skuMap: Map<number, (string | undefined)[]> = new Map([
|
|
40
|
+
[0, [libraryName, libraryVersion]],
|
|
41
|
+
[2, [extensionName, extensionVersion]],
|
|
42
|
+
]);
|
|
43
|
+
let skuArr: string[] = [];
|
|
44
|
+
|
|
45
|
+
if (skus?.length) {
|
|
46
|
+
skuArr = skus.split(skuGroupSeparator);
|
|
47
|
+
|
|
48
|
+
// Ignore invalid input sku param
|
|
49
|
+
if (skuArr.length < 4) {
|
|
50
|
+
return skus;
|
|
51
|
+
}
|
|
52
|
+
} else {
|
|
53
|
+
skuArr = Array.from({ length: 4 }, () => skuValueSeparator);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
skuMap.forEach((value, key) => {
|
|
57
|
+
if (value.length === 2 && value[0]?.length && value[1]?.length) {
|
|
58
|
+
setSku({
|
|
59
|
+
skuArr,
|
|
60
|
+
index: key,
|
|
61
|
+
skuName: value[0],
|
|
62
|
+
skuVersion: value[1],
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
return skuArr.join(skuGroupSeparator);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function setSku(params: {
|
|
71
|
+
skuArr: string[];
|
|
72
|
+
index: number;
|
|
73
|
+
skuName: string;
|
|
74
|
+
skuVersion: string;
|
|
75
|
+
}): void {
|
|
76
|
+
const { skuArr, index, skuName, skuVersion } = params;
|
|
77
|
+
if (index >= skuArr.length) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
skuArr[index] = [skuName, skuVersion].join(skuValueSeparator);
|
|
81
|
+
}
|
|
82
|
+
|
|
20
83
|
/** @internal */
|
|
21
84
|
export class ServerTelemetryManager {
|
|
22
85
|
private cacheManager: CacheManager;
|
|
@@ -51,7 +114,12 @@ export class ServerTelemetryManager {
|
|
|
51
114
|
*/
|
|
52
115
|
generateCurrentRequestHeaderValue(): string {
|
|
53
116
|
const request = `${this.apiId}${SERVER_TELEM_CONSTANTS.VALUE_SEPARATOR}${this.cacheOutcome}`;
|
|
54
|
-
const
|
|
117
|
+
const platformFieldsArr = [this.wrapperSKU, this.wrapperVer];
|
|
118
|
+
const nativeBrokerErrorCode = this.getNativeBrokerErrorCode();
|
|
119
|
+
if (nativeBrokerErrorCode?.length) {
|
|
120
|
+
platformFieldsArr.push(`broker_error=${nativeBrokerErrorCode}`);
|
|
121
|
+
}
|
|
122
|
+
const platformFields = platformFieldsArr.join(
|
|
55
123
|
SERVER_TELEM_CONSTANTS.VALUE_SEPARATOR
|
|
56
124
|
);
|
|
57
125
|
const regionDiscoveryFields = this.getRegionDiscoveryFields();
|
|
@@ -277,4 +345,30 @@ export class ServerTelemetryManager {
|
|
|
277
345
|
setCacheOutcome(cacheOutcome: CacheOutcome): void {
|
|
278
346
|
this.cacheOutcome = cacheOutcome;
|
|
279
347
|
}
|
|
348
|
+
|
|
349
|
+
setNativeBrokerErrorCode(errorCode: string): void {
|
|
350
|
+
const lastRequests = this.getLastRequests();
|
|
351
|
+
lastRequests.nativeBrokerErrorCode = errorCode;
|
|
352
|
+
this.cacheManager.setServerTelemetry(
|
|
353
|
+
this.telemetryCacheKey,
|
|
354
|
+
lastRequests
|
|
355
|
+
);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
getNativeBrokerErrorCode(): string | undefined {
|
|
359
|
+
return this.getLastRequests().nativeBrokerErrorCode;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
clearNativeBrokerErrorCode(): void {
|
|
363
|
+
const lastRequests = this.getLastRequests();
|
|
364
|
+
delete lastRequests.nativeBrokerErrorCode;
|
|
365
|
+
this.cacheManager.setServerTelemetry(
|
|
366
|
+
this.telemetryCacheKey,
|
|
367
|
+
lastRequests
|
|
368
|
+
);
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
static makeExtraSkuString(params: SkuParams): string {
|
|
372
|
+
return makeExtraSkuString(params);
|
|
373
|
+
}
|
|
280
374
|
}
|