@azure/msal-common
Advanced tools
Comparing version 14.13.0 to 14.13.1
@@ -51,4 +51,12 @@ import { TokenClaims } from "./TokenClaims"; | ||
export declare function tenantIdMatchesHomeTenant(tenantId?: string, homeAccountId?: string): boolean; | ||
export declare function buildTenantProfileFromIdTokenClaims(homeAccountId: string, idTokenClaims: TokenClaims): TenantProfile; | ||
/** | ||
* Build tenant profile | ||
* @param homeAccountId - Home account identifier for this account object | ||
* @param localAccountId - Local account identifer for this account object | ||
* @param tenantId - Full tenant or organizational id that this account belongs to | ||
* @param idTokenClaims - Claims from the ID token | ||
* @returns | ||
*/ | ||
export declare function buildTenantProfile(homeAccountId: string, localAccountId: string, tenantId: string, idTokenClaims?: TokenClaims): TenantProfile; | ||
/** | ||
* Replaces account info that varies by tenant profile sourced from the ID token claims passed in with the tenant-specific account info | ||
@@ -55,0 +63,0 @@ * @param baseAccountInfo |
@@ -173,3 +173,2 @@ import { AccountFilter, CredentialFilter, ValidCredentialType, AppMetadataFilter, AppMetadataCache, TokenKeys } from "./utils/CacheTypes"; | ||
private buildTenantProfiles; | ||
private getAccountInfoForTenantProfiles; | ||
private getTenantedAccountInfoByFilter; | ||
@@ -176,0 +175,0 @@ private getTenantProfilesFromAccountEntity; |
@@ -19,3 +19,3 @@ /** | ||
export { ClientConfiguration } from "./config/ClientConfiguration"; | ||
export { AccountInfo, ActiveAccountFilters, TenantProfile, updateAccountTenantProfileData, tenantIdMatchesHomeTenant, buildTenantProfileFromIdTokenClaims, } from "./account/AccountInfo"; | ||
export { AccountInfo, ActiveAccountFilters, TenantProfile, updateAccountTenantProfileData, tenantIdMatchesHomeTenant, buildTenantProfile, } from "./account/AccountInfo"; | ||
export { AuthToken }; | ||
@@ -22,0 +22,0 @@ export { TokenClaims, getTenantIdFromIdTokenClaims, } from "./account/TokenClaims"; |
export declare const name = "@azure/msal-common"; | ||
export declare const version = "14.13.0"; | ||
export declare const version = "14.13.1"; | ||
//# sourceMappingURL=packageMetadata.d.ts.map |
@@ -13,3 +13,3 @@ { | ||
}, | ||
"version": "14.13.0", | ||
"version": "14.13.1", | ||
"description": "Microsoft Authentication Library for js", | ||
@@ -16,0 +16,0 @@ "keywords": [ |
@@ -78,22 +78,40 @@ /* | ||
export function buildTenantProfileFromIdTokenClaims( | ||
/** | ||
* Build tenant profile | ||
* @param homeAccountId - Home account identifier for this account object | ||
* @param localAccountId - Local account identifer for this account object | ||
* @param tenantId - Full tenant or organizational id that this account belongs to | ||
* @param idTokenClaims - Claims from the ID token | ||
* @returns | ||
*/ | ||
export function buildTenantProfile( | ||
homeAccountId: string, | ||
idTokenClaims: TokenClaims | ||
localAccountId: string, | ||
tenantId: string, | ||
idTokenClaims?: TokenClaims | ||
): TenantProfile { | ||
const { oid, sub, tid, name, tfp, acr } = idTokenClaims; | ||
if (idTokenClaims) { | ||
const { oid, sub, tid, name, tfp, acr } = idTokenClaims; | ||
/** | ||
* Since there is no way to determine if the authority is AAD or B2C, we exhaust all the possible claims that can serve as tenant ID with the following precedence: | ||
* tid - TenantID claim that identifies the tenant that issued the token in AAD. Expected in all AAD ID tokens, not present in B2C ID Tokens. | ||
* tfp - Trust Framework Policy claim that identifies the policy that was used to authenticate the user. Functions as tenant for B2C scenarios. | ||
* acr - Authentication Context Class Reference claim used only with older B2C policies. Fallback in case tfp is not present, but likely won't be present anyway. | ||
*/ | ||
const tenantId = tid || tfp || acr || ""; | ||
/** | ||
* Since there is no way to determine if the authority is AAD or B2C, we exhaust all the possible claims that can serve as tenant ID with the following precedence: | ||
* tid - TenantID claim that identifies the tenant that issued the token in AAD. Expected in all AAD ID tokens, not present in B2C ID Tokens. | ||
* tfp - Trust Framework Policy claim that identifies the policy that was used to authenticate the user. Functions as tenant for B2C scenarios. | ||
* acr - Authentication Context Class Reference claim used only with older B2C policies. Fallback in case tfp is not present, but likely won't be present anyway. | ||
*/ | ||
const tenantId = tid || tfp || acr || ""; | ||
return { | ||
tenantId: tenantId, | ||
localAccountId: oid || sub || "", | ||
name: name, | ||
isHomeTenant: tenantIdMatchesHomeTenant(tenantId, homeAccountId), | ||
}; | ||
return { | ||
tenantId: tenantId, | ||
localAccountId: oid || sub || "", | ||
name: name, | ||
isHomeTenant: tenantIdMatchesHomeTenant(tenantId, homeAccountId), | ||
}; | ||
} else { | ||
return { | ||
tenantId, | ||
localAccountId, | ||
isHomeTenant: tenantIdMatchesHomeTenant(tenantId, homeAccountId), | ||
}; | ||
} | ||
} | ||
@@ -126,4 +144,6 @@ | ||
const { isHomeTenant, ...claimsSourcedTenantProfile } = | ||
buildTenantProfileFromIdTokenClaims( | ||
buildTenantProfile( | ||
baseAccountInfo.homeAccountId, | ||
baseAccountInfo.localAccountId, | ||
baseAccountInfo.tenantId, | ||
idTokenClaims | ||
@@ -130,0 +150,0 @@ ); |
@@ -13,3 +13,3 @@ /* | ||
TenantProfile, | ||
buildTenantProfileFromIdTokenClaims, | ||
buildTenantProfile, | ||
} from "../../account/AccountInfo"; | ||
@@ -218,11 +218,9 @@ import { | ||
} else { | ||
const tenantProfiles = []; | ||
if (accountDetails.idTokenClaims) { | ||
const tenantProfile = buildTenantProfileFromIdTokenClaims( | ||
accountDetails.homeAccountId, | ||
accountDetails.idTokenClaims | ||
); | ||
tenantProfiles.push(tenantProfile); | ||
} | ||
account.tenantProfiles = tenantProfiles; | ||
const tenantProfile = buildTenantProfile( | ||
accountDetails.homeAccountId, | ||
account.localAccountId, | ||
account.realm, | ||
accountDetails.idTokenClaims | ||
); | ||
account.tenantProfiles = [tenantProfile]; | ||
} | ||
@@ -229,0 +227,0 @@ |
@@ -44,3 +44,3 @@ /* | ||
tenantIdMatchesHomeTenant, | ||
buildTenantProfileFromIdTokenClaims, | ||
buildTenantProfile, | ||
} from "./account/AccountInfo"; | ||
@@ -47,0 +47,0 @@ export { AuthToken }; |
/* eslint-disable header/header */ | ||
export const name = "@azure/msal-common"; | ||
export const version = "14.13.0"; | ||
export const version = "14.13.1"; |
@@ -51,3 +51,3 @@ /* | ||
AccountInfo, | ||
buildTenantProfileFromIdTokenClaims, | ||
buildTenantProfile, | ||
updateAccountTenantProfileData, | ||
@@ -748,12 +748,13 @@ } from "../account/AccountInfo"; | ||
const tenantProfiles = baseAccount.tenantProfiles || []; | ||
const tenantId = claimsTenantId || baseAccount.realm; | ||
if ( | ||
claimsTenantId && | ||
idTokenClaims && | ||
tenantId && | ||
!tenantProfiles.find((tenantProfile) => { | ||
return tenantProfile.tenantId === claimsTenantId; | ||
return tenantProfile.tenantId === tenantId; | ||
}) | ||
) { | ||
const newTenantProfile = buildTenantProfileFromIdTokenClaims( | ||
const newTenantProfile = buildTenantProfile( | ||
homeAccountId, | ||
baseAccount.localAccountId, | ||
tenantId, | ||
idTokenClaims | ||
@@ -760,0 +761,0 @@ ); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2111858
38465