-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update current account and active account behavior in NAA apps (#7390)
NAA apps do not expect to have multiple accounts, and the account is supplied by the host application with `accountContext`. This PR allows for the `accountContext` to reflect in memory and adds checks to make sure `account` is always mapped with the host's in the NAA app. This PR also fixes the missing support for forceRefresh and default cache policy in NAA flows. (merged #7406) --------- Co-authored-by: baljesingh <[email protected]>
- Loading branch information
1 parent
6fd7c87
commit 5680416
Showing
9 changed files
with
125 additions
and
31 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
change/@azure-msal-browser-50774907-a2a9-4497-871f-174eec7529d5.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"type": "patch", | ||
"comment": "Add support for forceRefresh and set default cache policy in NAA flows", | ||
"packageName": "@azure/msal-browser", | ||
"email": "[email protected]", | ||
"dependentChangeType": "patch" | ||
} |
7 changes: 7 additions & 0 deletions
7
change/@azure-msal-browser-baf43a42-f2af-4533-a0ad-e293c625d745.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"type": "patch", | ||
"comment": "Update current account and active account behavior in NAA apps", | ||
"packageName": "@azure/msal-browser", | ||
"email": "[email protected]", | ||
"dependentChangeType": "patch" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,7 +72,6 @@ As of `@azure/[email protected]`, all login hint values can be used to search f | |
- `username` account property | ||
- `upn` ID token claim | ||
|
||
|
||
> Note: All attributes above can be passed into the account filter as the `loginHint` property. The account filter will also accept the `username` attribute as `username`, and will yield a more performant search. | ||
#### Using `login_hint` claim | ||
|
@@ -158,6 +157,10 @@ function getAccessToken() { | |
|
||
Note: As of version 2.16.0 the active account is stored in the cache location configured on your `PublicClientApplication` instance. If you are using a previous version the active account is stored in-memory and thus must be reset on every page load. | ||
|
||
### Nested App Authentication | ||
|
||
For NAA applications, we consider `setActiveAccount()` and `getActiveAccount()` as NO-OP APIs. Though we allow users to set and get active accounts, they are actively ignored since the NAA application is always expected to have _one_ account and the account is supplied by the host application with `accountContext`. In the future when multiple accounts are supported across the hubs, we expect this to change. | ||
|
||
## Notes | ||
|
||
- The current msal-browser default [sample](../../../samples/msal-browser-samples/VanillaJSTestApp2.0) has a working single account scenario. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,10 +81,14 @@ export const SILENT_TOKEN_RESPONSE: AuthResult = { | |
export const NAA_APP_CONSTANTS = { | ||
homeAccountId: | ||
"2995ae49-d9dd-409d-8d62-ba969ce58a81.51178b70-16cc-41b5-bef1-ae1808139065", | ||
altHomeAccountId: | ||
"c691463b-b280-4755-8fd1-486f6e9c6f53.73541b02-bd0d-4c53-ad05-b0cf19ab7d40", | ||
localAccountId: "2995ae49-d9dd-409d-8d62-ba969ce58a81", | ||
altLocalAccountId: "c691463b-b280-4755-8fd1-486f6e9c6f53", | ||
environment: "login.microsoftonline.com", | ||
tenantId: "51178b70-16cc-41b5-bef1-ae1808139065", | ||
username: "[email protected]", | ||
altUsername: "sampleacccounto.onmicrosoft.com", | ||
idTokenClaims: { | ||
ver: "2.0", | ||
iss: "https://login.microsoftonline.com/3338040d-6c67-4c5b-b112-36a304b66dad/v2.0", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters