Skip to content

Commit 7b5d5d2

Browse files
jo-arroyotnorling
andauthored
Deprecate cache options (#7707)
This PR adds deprecation notices to cache options in v4. These cache config options will be removed in MSAL v5 (PR #7697) --------- Co-authored-by: Thomas Norling <[email protected]>
1 parent 3d49fa1 commit 7b5d5d2

File tree

9 files changed

+34
-5
lines changed

9 files changed

+34
-5
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "patch",
3+
"comment": "Deprecate cache options #7707",
4+
"packageName": "@azure/msal-browser",
5+
"email": "[email protected]",
6+
"dependentChangeType": "none"
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "patch",
3+
"comment": "Deprecate cache options #7707",
4+
"packageName": "@azure/msal-common",
5+
"email": "[email protected]",
6+
"dependentChangeType": "none"
7+
}

lib/msal-angular/docs/configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ import { PublicClientApplication, InteractionType, BrowserCacheLocation } from "
5858
},
5959
cache: {
6060
cacheLocation: BrowserCacheLocation.LocalStorage,
61-
storeAuthStateInCookie: true, // set to true for IE 11
61+
storeAuthStateInCookie: true, // Deprecated, will be removed in the next major version
6262
},
6363
system: {
6464
loggerOptions: {

lib/msal-angular/docs/initialization.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import { PublicClientApplication, InteractionType, BrowserCacheLocation } from "
3131
},
3232
cache: {
3333
cacheLocation : BrowserCacheLocation.LocalStorage,
34-
storeAuthStateInCookie: true, // set to true for IE 11
34+
storeAuthStateInCookie: true, // Deprecated, will be removed in future version
3535
},
3636
system: {
3737
loggerOptions: {
@@ -115,7 +115,7 @@ import { PublicClientApplication, InteractionType, BrowserCacheLocation } from "
115115
},
116116
cache: {
117117
cacheLocation : BrowserCacheLocation.LocalStorage,
118-
storeAuthStateInCookie: true, // set to true for IE 11
118+
storeAuthStateInCookie: true, // Deprecated, will be removed in future version
119119
},
120120
system: {
121121
loggerOptions: {

lib/msal-browser/apiReview/msal-browser.api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1786,7 +1786,7 @@ export type WrapperSKU = (typeof WrapperSKU)[keyof typeof WrapperSKU];
17861786
// src/cache/LocalStorage.ts:296:8 - (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen
17871787
// src/cache/LocalStorage.ts:354:8 - (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen
17881788
// src/cache/LocalStorage.ts:385:8 - (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen
1789-
// src/config/Configuration.ts:252:5 - (ae-forgotten-export) The symbol "InternalAuthOptions" needs to be exported by the entry point index.d.ts
1789+
// src/config/Configuration.ts:256:5 - (ae-forgotten-export) The symbol "InternalAuthOptions" needs to be exported by the entry point index.d.ts
17901790
// src/event/EventHandler.ts:113:8 - (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen
17911791
// src/event/EventHandler.ts:139:8 - (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen
17921792
// src/index.ts:8:12 - (tsdoc-characters-after-block-tag) The token "@azure" looks like a TSDoc tag but contains an invalid character "/"; if it is not a tag, use a backslash to escape the "@"

lib/msal-browser/docs/caching.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ To faciliate efficient token acquisition while maintaining a good UX, MSAL cache
7171
> :bulb: The authorization code is only stored in memory and will be discarded after redeeming it for tokens.
7272
7373
## Warning :warning:
74+
75+
**NOTE: `temporaryCacheLocation` is deprecated will be removed in the next major version.**
76+
7477
Overriding `temporaryCacheLocation` should be done with caution. Specifically when choosing `localStorage`. Interaction in more than one tab/window will not be supported and you may receive `interaction_in_progress` errors unexpectedly. This is an escape hatch, not a fully supported feature.
7578

7679
When using MSAL.js with the default configuration in a scenario where the user is redirected after successful authentication in a new window or tab, the OAuth 2.0 Authorization Code with PKCE flow will be interrupted. In this case, the original window or tab where the authentication state (code verifier and challenge) are stored, will be lost, and the authentication flow will fail.

lib/msal-browser/docs/configuration.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,11 @@ const msalInstance = new PublicClientApplication(msalConfig);
9797
| Option | Description | Format | Default Value |
9898
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | --------------------------------------------------- |
9999
| `cacheLocation` | Location of token cache in browser. | String value that must be one of the following: `"sessionStorage"`, `"localStorage"`, `"memoryStorage"` | `sessionStorage` |
100+
101+
**Note: The following cache config options are deprecated and will be removed in the next major version**
102+
103+
| Option | Description | Format | Default Value |
104+
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | --------------------------------------------------- |
100105
| `temporaryCacheLocation` | Location of temporary cache in browser. This option should only be changed for specific edge cases. Please refer to [caching](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/caching.md#cached-artifacts) for more. | String value that must be one of the following: `"sessionStorage"`, `"localStorage"`, `"memoryStorage"` | `sessionStorage` |
101106
| `storeAuthStateInCookie` | If true, stores cache items in cookies as well as browser cache. Should be set to true for use cases using IE. | boolean | `false` |
102107
| `secureCookies` | If true and `storeAuthStateInCookies` is also enabled, MSAL adds the `Secure` flag to the browser cookie so it can only be sent over HTTPS. | boolean | `false` |

lib/msal-browser/src/config/Configuration.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,23 +134,27 @@ export type CacheOptions = {
134134
cacheLocation?: BrowserCacheLocation | string;
135135
/**
136136
* Used to specify the temporaryCacheLocation user wants to set. Valid values are "localStorage", "sessionStorage" and "memoryStorage".
137+
* @deprecated This option is deprecated and will be removed in the next major version.
137138
*/
138139
temporaryCacheLocation?: BrowserCacheLocation | string;
139140
/**
140141
* If set, MSAL stores the auth request state required for validation of the auth flows in the browser cookies. By default this flag is set to false.
142+
* @deprecated This option is deprecated and will be removed in the next major version.
141143
*/
142144
storeAuthStateInCookie?: boolean;
143145
/**
144146
* If set, MSAL sets the "Secure" flag on cookies so they can only be sent over HTTPS. By default this flag is set to true.
145-
* @deprecated This option will be removed in a future major version and all cookies set will include the Secure attribute.
147+
* @deprecated This option will be removed in the next major version and all cookies set will include the Secure attribute.
146148
*/
147149
secureCookies?: boolean;
148150
/**
149151
* If set, MSAL will attempt to migrate cache entries from older versions on initialization. By default this flag is set to true if cacheLocation is localStorage, otherwise false.
152+
* @deprecated This option is deprecated and will be removed in the next major version.
150153
*/
151154
cacheMigrationEnabled?: boolean;
152155
/**
153156
* Flag that determines whether access tokens are stored based on requested claims
157+
* @deprecated This option is deprecated and will be removed in the next major version.
154158
*/
155159
claimsBasedCachingEnabled?: boolean;
156160
};

lib/msal-common/src/config/ClientConfiguration.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ export type LoggerOptions = {
131131
* - claimsBasedCachingEnabled - Sets whether tokens should be cached based on the claims hash. Default is false.
132132
*/
133133
export type CacheOptions = {
134+
/**
135+
* @deprecated claimsBasedCachingEnabled is deprecated and will be removed in the next major version.
136+
*/
134137
claimsBasedCachingEnabled?: boolean;
135138
};
136139

0 commit comments

Comments
 (0)