Skip to content

Commit a59f79b

Browse files
authored
Merge pull request #1751 from AzureAD/sagonzal/node-cache-merge
Update CacheManager. Update auth code sample.
2 parents 98b8609 + 99236b6 commit a59f79b

File tree

8 files changed

+218
-106
lines changed

8 files changed

+218
-106
lines changed

lib/msal-common/src/error/ClientAuthError.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ export const ClientAuthErrorMessage = {
106106
DeviceCodeExpired: {
107107
code: "device_code_expired",
108108
desc: "Device code is expired."
109+
},
110+
CachePluginError: {
111+
code: "no cache plugin set on CacheManager",
112+
desc: "ICachePlugin needs to be set before using readFromStorage or writeFromStorage"
109113
}
110114
};
111115

@@ -310,4 +314,11 @@ export class ClientAuthError extends AuthError {
310314
static createDeviceCodeExpiredError(): ClientAuthError {
311315
return new ClientAuthError(ClientAuthErrorMessage.DeviceCodeExpired.code, `${ClientAuthErrorMessage.DeviceCodeExpired.desc}`);
312316
}
317+
318+
/**
319+
* Throws error if ICachePlugin not set on CacheManager
320+
*/
321+
static createCachePluginError(): ClientAuthError {
322+
return new ClientAuthError(ClientAuthErrorMessage.CachePluginError.code, `${ClientAuthErrorMessage.CachePluginError.desc}`);
323+
}
313324
}

lib/msal-common/src/unifiedCache/utils/CacheTypes.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export type RefreshTokenCache = { [key: string]: RefreshTokenEntity };
1818
export type AppMetadataCache = { [key: string]: AppMetadataEntity };
1919

2020
export type JsonCache = {
21+
[key: string]: StringDict;
2122
Account?: StringDict;
2223
IdToken?: StringDict;
2324
AccessToken?: StringDict;

lib/msal-common/test/utils/StringConstants.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const TEST_TOKENS = {
1717
SAMPLE_JWT_PAYLOAD: "eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ",
1818
SAMPLE_JWT_SIG: "SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
1919
SAMPLE_MALFORMED_JWT: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ",
20-
CACHE_IDTOKEN: "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6Imk2bEdrM0ZaenhSY1ViMkMzbkVRN3N5SEpsWSIsImtpZCI6Imk2bEdrM0ZaenhSY1ViMkMzbkVRN3N5SEpsWSJ9.eyJvaWQiOiAib2JqZWN0MTIzNCIsICJwcmVmZXJyZWRfdXNlcm5hbWUiOiAiSm9obiBEb2UiLCAic3ViIjogInN1YiJ9.D3H6pMUtQnoJAGq6AHd"
20+
CACHE_IDTOKEN: "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6Imk2bEdrM0ZaenhSY1ViMkMzbkVRN3N5SEpsWSIsImtpZCI6Imk2bEdrM0ZaenhSY1ViMkMzbkVRN3N5SEpsWSJ9.eyJvaWQiOiAib2JqZWN0MTIzNCIsICJwcmVmZXJyZWRfdXNlcm5hbWUiOiAiSm9obiBEb2UiLCAic3ViIjogInN1YiJ9.D3H6pMUtQnoJAGq6AHd",
2121
};
2222

2323
// Test Expiration Vals
@@ -234,3 +234,4 @@ export const AUTHORIZATION_PENDING_RESPONSE = {
234234
error_uri: 'https://login.microsoftonline.com/error?code=70016'
235235
}
236236
};
237+

lib/msal-node/package-lock.json

Lines changed: 32 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)