@azure/msal-browser 2.21.0 → 2.23.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.
Files changed (147) hide show
  1. package/README.md +1 -1
  2. package/dist/_virtual/_tslib.js +1 -1
  3. package/dist/app/ClientApplication.d.ts +31 -2
  4. package/dist/app/ClientApplication.d.ts.map +1 -1
  5. package/dist/app/ClientApplication.js +152 -36
  6. package/dist/app/ClientApplication.js.map +1 -1
  7. package/dist/app/IPublicClientApplication.d.ts +3 -1
  8. package/dist/app/IPublicClientApplication.d.ts.map +1 -1
  9. package/dist/app/IPublicClientApplication.js +7 -1
  10. package/dist/app/IPublicClientApplication.js.map +1 -1
  11. package/dist/app/PublicClientApplication.d.ts +2 -2
  12. package/dist/app/PublicClientApplication.d.ts.map +1 -1
  13. package/dist/app/PublicClientApplication.js +51 -15
  14. package/dist/app/PublicClientApplication.js.map +1 -1
  15. package/dist/cache/AsyncMemoryStorage.d.ts +3 -2
  16. package/dist/cache/AsyncMemoryStorage.d.ts.map +1 -1
  17. package/dist/cache/AsyncMemoryStorage.js +17 -6
  18. package/dist/cache/AsyncMemoryStorage.js.map +1 -1
  19. package/dist/cache/BrowserCacheManager.d.ts +14 -12
  20. package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
  21. package/dist/cache/BrowserCacheManager.js +16 -12
  22. package/dist/cache/BrowserCacheManager.js.map +1 -1
  23. package/dist/cache/BrowserStorage.js +1 -1
  24. package/dist/cache/DatabaseStorage.d.ts +5 -0
  25. package/dist/cache/DatabaseStorage.d.ts.map +1 -1
  26. package/dist/cache/DatabaseStorage.js +65 -13
  27. package/dist/cache/DatabaseStorage.js.map +1 -1
  28. package/dist/cache/MemoryStorage.js +1 -1
  29. package/dist/cache/TokenCache.d.ts.map +1 -1
  30. package/dist/cache/TokenCache.js +4 -3
  31. package/dist/cache/TokenCache.js.map +1 -1
  32. package/dist/config/Configuration.d.ts +23 -10
  33. package/dist/config/Configuration.d.ts.map +1 -1
  34. package/dist/config/Configuration.js +21 -10
  35. package/dist/config/Configuration.js.map +1 -1
  36. package/dist/crypto/BrowserCrypto.d.ts.map +1 -1
  37. package/dist/crypto/BrowserCrypto.js +7 -6
  38. package/dist/crypto/BrowserCrypto.js.map +1 -1
  39. package/dist/crypto/CryptoOps.d.ts +12 -3
  40. package/dist/crypto/CryptoOps.d.ts.map +1 -1
  41. package/dist/crypto/CryptoOps.js +71 -36
  42. package/dist/crypto/CryptoOps.js.map +1 -1
  43. package/dist/crypto/GuidGenerator.d.ts +3 -2
  44. package/dist/crypto/GuidGenerator.d.ts.map +1 -1
  45. package/dist/crypto/GuidGenerator.js +4 -3
  46. package/dist/crypto/GuidGenerator.js.map +1 -1
  47. package/dist/crypto/PkceGenerator.js +1 -1
  48. package/dist/crypto/SignedHttpRequest.js +1 -1
  49. package/dist/encode/Base64Decode.d.ts.map +1 -1
  50. package/dist/encode/Base64Decode.js +3 -2
  51. package/dist/encode/Base64Decode.js.map +1 -1
  52. package/dist/encode/Base64Encode.d.ts.map +1 -1
  53. package/dist/encode/Base64Encode.js +5 -4
  54. package/dist/encode/Base64Encode.js.map +1 -1
  55. package/dist/error/BrowserAuthError.js +1 -1
  56. package/dist/error/BrowserConfigurationAuthError.js +1 -1
  57. package/dist/event/EventHandler.js +1 -1
  58. package/dist/event/EventMessage.js +1 -1
  59. package/dist/event/EventType.js +1 -1
  60. package/dist/index.cjs.js +1380 -436
  61. package/dist/index.cjs.js.map +1 -1
  62. package/dist/index.d.ts +15 -2
  63. package/dist/index.d.ts.map +1 -1
  64. package/dist/index.js +15 -3
  65. package/dist/index.js.map +1 -1
  66. package/dist/interaction_client/BaseInteractionClient.d.ts +4 -3
  67. package/dist/interaction_client/BaseInteractionClient.d.ts.map +1 -1
  68. package/dist/interaction_client/BaseInteractionClient.js +14 -14
  69. package/dist/interaction_client/BaseInteractionClient.js.map +1 -1
  70. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.js +1 -1
  71. package/dist/interaction_client/PopupClient.d.ts +4 -3
  72. package/dist/interaction_client/PopupClient.d.ts.map +1 -1
  73. package/dist/interaction_client/PopupClient.js +52 -60
  74. package/dist/interaction_client/PopupClient.js.map +1 -1
  75. package/dist/interaction_client/RedirectClient.d.ts +3 -3
  76. package/dist/interaction_client/RedirectClient.d.ts.map +1 -1
  77. package/dist/interaction_client/RedirectClient.js +22 -10
  78. package/dist/interaction_client/RedirectClient.js.map +1 -1
  79. package/dist/interaction_client/SilentAuthCodeClient.d.ts +2 -2
  80. package/dist/interaction_client/SilentAuthCodeClient.d.ts.map +1 -1
  81. package/dist/interaction_client/SilentAuthCodeClient.js +5 -4
  82. package/dist/interaction_client/SilentAuthCodeClient.js.map +1 -1
  83. package/dist/interaction_client/SilentCacheClient.d.ts +2 -2
  84. package/dist/interaction_client/SilentCacheClient.d.ts.map +1 -1
  85. package/dist/interaction_client/SilentCacheClient.js +14 -6
  86. package/dist/interaction_client/SilentCacheClient.js.map +1 -1
  87. package/dist/interaction_client/SilentIframeClient.d.ts +4 -4
  88. package/dist/interaction_client/SilentIframeClient.d.ts.map +1 -1
  89. package/dist/interaction_client/SilentIframeClient.js +22 -7
  90. package/dist/interaction_client/SilentIframeClient.js.map +1 -1
  91. package/dist/interaction_client/SilentRefreshClient.d.ts +2 -2
  92. package/dist/interaction_client/SilentRefreshClient.d.ts.map +1 -1
  93. package/dist/interaction_client/SilentRefreshClient.js +19 -7
  94. package/dist/interaction_client/SilentRefreshClient.js.map +1 -1
  95. package/dist/interaction_client/StandardInteractionClient.d.ts +11 -11
  96. package/dist/interaction_client/StandardInteractionClient.d.ts.map +1 -1
  97. package/dist/interaction_client/StandardInteractionClient.js +84 -56
  98. package/dist/interaction_client/StandardInteractionClient.js.map +1 -1
  99. package/dist/interaction_handler/InteractionHandler.js +1 -1
  100. package/dist/interaction_handler/PopupHandler.d.ts.map +1 -1
  101. package/dist/interaction_handler/PopupHandler.js +1 -3
  102. package/dist/interaction_handler/PopupHandler.js.map +1 -1
  103. package/dist/interaction_handler/RedirectHandler.d.ts.map +1 -1
  104. package/dist/interaction_handler/RedirectHandler.js +1 -2
  105. package/dist/interaction_handler/RedirectHandler.js.map +1 -1
  106. package/dist/interaction_handler/SilentHandler.js +1 -1
  107. package/dist/navigation/NavigationClient.js +1 -1
  108. package/dist/network/FetchClient.d.ts.map +1 -1
  109. package/dist/network/FetchClient.js +3 -2
  110. package/dist/network/FetchClient.js.map +1 -1
  111. package/dist/network/XhrClient.js +1 -1
  112. package/dist/packageMetadata.d.ts +1 -1
  113. package/dist/packageMetadata.js +2 -2
  114. package/dist/packageMetadata.js.map +1 -1
  115. package/dist/request/EndSessionPopupRequest.d.ts +1 -0
  116. package/dist/request/EndSessionPopupRequest.d.ts.map +1 -1
  117. package/dist/request/EndSessionRequest.d.ts +1 -0
  118. package/dist/request/EndSessionRequest.d.ts.map +1 -1
  119. package/dist/telemetry/BrowserPerformanceClient.d.ts +19 -0
  120. package/dist/telemetry/BrowserPerformanceClient.d.ts.map +1 -0
  121. package/dist/telemetry/BrowserPerformanceClient.js +52 -0
  122. package/dist/telemetry/BrowserPerformanceClient.js.map +1 -0
  123. package/dist/telemetry/BrowserPerformanceMeasurement.d.ts +13 -0
  124. package/dist/telemetry/BrowserPerformanceMeasurement.d.ts.map +1 -0
  125. package/dist/telemetry/BrowserPerformanceMeasurement.js +66 -0
  126. package/dist/telemetry/BrowserPerformanceMeasurement.js.map +1 -0
  127. package/dist/utils/BrowserConstants.d.ts +2 -1
  128. package/dist/utils/BrowserConstants.d.ts.map +1 -1
  129. package/dist/utils/BrowserConstants.js +2 -1
  130. package/dist/utils/BrowserConstants.js.map +1 -1
  131. package/dist/utils/BrowserProtocolUtils.js +1 -1
  132. package/dist/utils/BrowserStringUtils.d.ts.map +1 -1
  133. package/dist/utils/BrowserStringUtils.js +4 -2
  134. package/dist/utils/BrowserStringUtils.js.map +1 -1
  135. package/dist/utils/BrowserUtils.js +2 -2
  136. package/dist/utils/BrowserUtils.js.map +1 -1
  137. package/dist/utils/MathUtils.js +1 -1
  138. package/dist/utils/PopupUtils.d.ts +1 -2
  139. package/dist/utils/PopupUtils.d.ts.map +1 -1
  140. package/dist/utils/PopupUtils.js +3 -3
  141. package/dist/utils/PopupUtils.js.map +1 -1
  142. package/lib/msal-browser.js +1380 -436
  143. package/lib/msal-browser.js.map +1 -1
  144. package/lib/msal-browser.min.js +41 -31
  145. package/package.json +2 -2
  146. package/CHANGELOG.json +0 -1685
  147. package/CHANGELOG.md +0 -536
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-browser v2.21.0 2022-01-04 */
1
+ /*! @azure/msal-browser v2.23.0 2022-04-04 */
2
2
  'use strict';
3
3
  import { __awaiter, __generator } from '../_virtual/_tslib.js';
4
4
  import { BrowserAuthError } from '../error/BrowserAuthError.js';
@@ -42,6 +42,17 @@ var DatabaseStorage = /** @class */ (function () {
42
42
  });
43
43
  });
44
44
  };
45
+ /**
46
+ * Closes the connection to IndexedDB database when all pending transactions
47
+ * complete.
48
+ */
49
+ DatabaseStorage.prototype.closeConnection = function () {
50
+ var db = this.db;
51
+ if (db && this.dbOpen) {
52
+ db.close();
53
+ this.dbOpen = false;
54
+ }
55
+ };
45
56
  /**
46
57
  * Opens database if it's not already open
47
58
  */
@@ -80,9 +91,13 @@ var DatabaseStorage = /** @class */ (function () {
80
91
  var dbGet = objectStore.get(key);
81
92
  dbGet.addEventListener("success", function (e) {
82
93
  var event = e;
94
+ _this.closeConnection();
83
95
  resolve(event.target.result);
84
96
  });
85
- dbGet.addEventListener("error", function (e) { return reject(e); });
97
+ dbGet.addEventListener("error", function (e) {
98
+ _this.closeConnection();
99
+ reject(e);
100
+ });
86
101
  })];
87
102
  }
88
103
  });
@@ -109,8 +124,14 @@ var DatabaseStorage = /** @class */ (function () {
109
124
  var transaction = _this.db.transaction([_this.tableName], "readwrite");
110
125
  var objectStore = transaction.objectStore(_this.tableName);
111
126
  var dbPut = objectStore.put(payload, key);
112
- dbPut.addEventListener("success", function () { return resolve(); });
113
- dbPut.addEventListener("error", function (e) { return reject(e); });
127
+ dbPut.addEventListener("success", function () {
128
+ _this.closeConnection();
129
+ resolve();
130
+ });
131
+ dbPut.addEventListener("error", function (e) {
132
+ _this.closeConnection();
133
+ reject(e);
134
+ });
114
135
  })];
115
136
  }
116
137
  });
@@ -135,8 +156,14 @@ var DatabaseStorage = /** @class */ (function () {
135
156
  var transaction = _this.db.transaction([_this.tableName], "readwrite");
136
157
  var objectStore = transaction.objectStore(_this.tableName);
137
158
  var dbDelete = objectStore.delete(key);
138
- dbDelete.addEventListener("success", function () { return resolve(); });
139
- dbDelete.addEventListener("error", function (e) { return reject(e); });
159
+ dbDelete.addEventListener("success", function () {
160
+ _this.closeConnection();
161
+ resolve();
162
+ });
163
+ dbDelete.addEventListener("error", function (e) {
164
+ _this.closeConnection();
165
+ reject(e);
166
+ });
140
167
  })];
141
168
  }
142
169
  });
@@ -162,9 +189,13 @@ var DatabaseStorage = /** @class */ (function () {
162
189
  var dbGetKeys = objectStore.getAllKeys();
163
190
  dbGetKeys.addEventListener("success", function (e) {
164
191
  var event = e;
192
+ _this.closeConnection();
165
193
  resolve(event.target.result);
166
194
  });
167
- dbGetKeys.addEventListener("error", function (e) { return reject(e); });
195
+ dbGetKeys.addEventListener("error", function (e) {
196
+ _this.closeConnection();
197
+ reject(e);
198
+ });
168
199
  })];
169
200
  }
170
201
  });
@@ -191,9 +222,13 @@ var DatabaseStorage = /** @class */ (function () {
191
222
  var dbContainsKey = objectStore.count(key);
192
223
  dbContainsKey.addEventListener("success", function (e) {
193
224
  var event = e;
225
+ _this.closeConnection();
194
226
  resolve(event.target.result === 1);
195
227
  });
196
- dbContainsKey.addEventListener("error", function (e) { return reject(e); });
228
+ dbContainsKey.addEventListener("error", function (e) {
229
+ _this.closeConnection();
230
+ reject(e);
231
+ });
197
232
  })];
198
233
  }
199
234
  });
@@ -206,12 +241,29 @@ var DatabaseStorage = /** @class */ (function () {
206
241
  */
207
242
  DatabaseStorage.prototype.deleteDatabase = function () {
208
243
  return __awaiter(this, void 0, void 0, function () {
244
+ var existingDatabases, database;
209
245
  return __generator(this, function (_a) {
210
- return [2 /*return*/, new Promise(function (resolve, reject) {
211
- var deleteDbRequest = window.indexedDB.deleteDatabase(DB_NAME);
212
- deleteDbRequest.addEventListener("success", function () { return resolve(true); });
213
- deleteDbRequest.addEventListener("error", function () { return reject(false); });
214
- })];
246
+ switch (_a.label) {
247
+ case 0:
248
+ // Check if database being deleted exists
249
+ if (this.db && this.dbOpen) {
250
+ this.closeConnection();
251
+ }
252
+ return [4 /*yield*/, window.indexedDB.databases()];
253
+ case 1:
254
+ existingDatabases = _a.sent();
255
+ database = existingDatabases.find(function (database) { return database.name === DB_NAME; });
256
+ // If database exists, delete it
257
+ if (database) {
258
+ return [2 /*return*/, new Promise(function (resolve, reject) {
259
+ var deleteDbRequest = window.indexedDB.deleteDatabase(DB_NAME);
260
+ deleteDbRequest.addEventListener("success", function () { return resolve(true); });
261
+ deleteDbRequest.addEventListener("error", function () { return reject(false); });
262
+ })];
263
+ }
264
+ // Database doesn't exist, return true
265
+ return [2 /*return*/, true];
266
+ }
215
267
  });
216
268
  });
217
269
  };
@@ -1 +1 @@
1
- {"version":3,"file":"DatabaseStorage.js","sources":["../../src/cache/DatabaseStorage.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { BrowserAuthError } from \"../error/BrowserAuthError\";\nimport { DB_NAME, DB_TABLE_NAME, DB_VERSION } from \"../utils/BrowserConstants\";\nimport { IAsyncStorage } from \"./IAsyncMemoryStorage\";\n\ninterface IDBOpenDBRequestEvent extends Event {\n target: IDBOpenDBRequest & EventTarget;\n}\n\ninterface IDBOpenOnUpgradeNeededEvent extends IDBVersionChangeEvent {\n target: IDBOpenDBRequest & EventTarget;\n}\n\ninterface IDBRequestEvent extends Event {\n target: IDBRequest & EventTarget;\n}\n\n/**\n * Storage wrapper for IndexedDB storage in browsers: https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API\n */\nexport class DatabaseStorage<T> implements IAsyncStorage<T> {\n private db: IDBDatabase|undefined;\n private dbName: string;\n private tableName: string;\n private version: number;\n private dbOpen: boolean;\n\n constructor() {\n this.dbName = DB_NAME;\n this.version = DB_VERSION;\n this.tableName = DB_TABLE_NAME;\n this.dbOpen = false;\n }\n\n /**\n * Opens IndexedDB instance.\n */\n async open(): Promise<void> {\n return new Promise((resolve, reject) => {\n const openDB = window.indexedDB.open(this.dbName, this.version);\n openDB.addEventListener(\"upgradeneeded\", (e: IDBVersionChangeEvent) => {\n const event = e as IDBOpenOnUpgradeNeededEvent;\n event.target.result.createObjectStore(this.tableName);\n });\n openDB.addEventListener(\"success\", (e: Event) => {\n const event = e as IDBOpenDBRequestEvent;\n this.db = event.target.result;\n this.dbOpen = true;\n resolve();\n });\n openDB.addEventListener(\"error\", () => reject(BrowserAuthError.createDatabaseUnavailableError()));\n });\n }\n\n /**\n * Opens database if it's not already open\n */\n private async validateDbIsOpen(): Promise<void> {\n if (!this.dbOpen) {\n return await this.open();\n }\n }\n\n /**\n * Retrieves item from IndexedDB instance.\n * @param key \n */\n async getItem(key: string): Promise<T | null> {\n await this.validateDbIsOpen();\n\n return new Promise<T>((resolve, reject) => {\n // TODO: Add timeouts?\n if (!this.db) {\n return reject(BrowserAuthError.createDatabaseNotOpenError());\n }\n const transaction = this.db.transaction([this.tableName], \"readonly\");\n const objectStore = transaction.objectStore(this.tableName);\n const dbGet = objectStore.get(key);\n dbGet.addEventListener(\"success\", (e: Event) => {\n const event = e as IDBRequestEvent;\n resolve(event.target.result);\n });\n dbGet.addEventListener(\"error\", (e) => reject(e));\n });\n }\n\n /**\n * Adds item to IndexedDB under given key\n * @param key \n * @param payload \n */\n async setItem(key: string, payload: T): Promise<void> {\n await this.validateDbIsOpen();\n\n return new Promise<void>((resolve: Function, reject: Function) => {\n // TODO: Add timeouts?\n if (!this.db) {\n return reject(BrowserAuthError.createDatabaseNotOpenError());\n }\n const transaction = this.db.transaction([this.tableName], \"readwrite\");\n\n const objectStore = transaction.objectStore(this.tableName);\n\n const dbPut = objectStore.put(payload, key);\n\n dbPut.addEventListener(\"success\", () => resolve());\n dbPut.addEventListener(\"error\", (e) => reject(e));\n });\n }\n\n /**\n * Removes item from IndexedDB under given key\n * @param key\n */\n async removeItem(key: string): Promise<void> {\n await this.validateDbIsOpen();\n\n return new Promise<void>((resolve: Function, reject: Function) => {\n if (!this.db) {\n return reject(BrowserAuthError.createDatabaseNotOpenError());\n }\n const transaction = this.db.transaction([this.tableName], \"readwrite\");\n const objectStore = transaction.objectStore(this.tableName);\n const dbDelete = objectStore.delete(key);\n dbDelete.addEventListener(\"success\", () => resolve());\n dbDelete.addEventListener(\"error\", (e) => reject(e));\n });\n }\n\n /**\n * Get all the keys from the storage object as an iterable array of strings.\n */\n async getKeys(): Promise<string[]> {\n await this.validateDbIsOpen();\n\n return new Promise<string[]>((resolve: Function, reject: Function) => {\n if (!this.db) {\n return reject(BrowserAuthError.createDatabaseNotOpenError());\n }\n\n const transaction = this.db.transaction([this.tableName], \"readonly\");\n const objectStore = transaction.objectStore(this.tableName);\n const dbGetKeys = objectStore.getAllKeys();\n dbGetKeys.addEventListener(\"success\", (e: Event) => {\n const event = e as IDBRequestEvent;\n resolve(event.target.result);\n });\n dbGetKeys.addEventListener(\"error\", (e: Event) => reject(e));\n });\n }\n\n /**\n * \n * Checks whether there is an object under the search key in the object store\n */\n async containsKey(key: string): Promise<boolean> {\n await this.validateDbIsOpen();\n\n return new Promise<boolean>((resolve: Function, reject: Function) => {\n if (!this.db) {\n return reject(BrowserAuthError.createDatabaseNotOpenError());\n }\n const transaction = this.db.transaction([this.tableName], \"readonly\");\n const objectStore = transaction.objectStore(this.tableName);\n const dbContainsKey = objectStore.count(key);\n dbContainsKey.addEventListener(\"success\", (e: Event) => {\n const event = e as IDBRequestEvent;\n resolve(event.target.result === 1);\n });\n dbContainsKey.addEventListener(\"error\", (e: Event) => reject(e));\n });\n }\n\n /**\n * Deletes the MSAL database. The database is deleted rather than cleared to make it possible\n * for client applications to downgrade to a previous MSAL version without worrying about forward compatibility issues\n * with IndexedDB database versions.\n */\n async deleteDatabase(): Promise<boolean> {\n return new Promise<boolean>((resolve: Function, reject: Function) => {\n const deleteDbRequest = window.indexedDB.deleteDatabase(DB_NAME);\n deleteDbRequest.addEventListener(\"success\", () => resolve(true));\n deleteDbRequest.addEventListener(\"error\", () => reject(false));\n });\n }\n}\n"],"names":[],"mappings":";;;;;;AAAA;;;;AAqBA;;;;IAUI;QACI,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC;QAC1B,IAAI,CAAC,SAAS,GAAG,aAAa,CAAC;QAC/B,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;KACvB;;;;IAKK,8BAAI,GAAV;;;;gBACI,sBAAO,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;wBAC/B,IAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,KAAI,CAAC,MAAM,EAAE,KAAI,CAAC,OAAO,CAAC,CAAC;wBAChE,MAAM,CAAC,gBAAgB,CAAC,eAAe,EAAE,UAAC,CAAwB;4BAC9D,IAAM,KAAK,GAAG,CAAgC,CAAC;4BAC/C,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,KAAI,CAAC,SAAS,CAAC,CAAC;yBACzD,CAAC,CAAC;wBACH,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,UAAC,CAAQ;4BACxC,IAAM,KAAK,GAAG,CAA0B,CAAC;4BACzC,KAAI,CAAC,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC;4BAC9B,KAAI,CAAC,MAAM,GAAG,IAAI,CAAC;4BACnB,OAAO,EAAE,CAAC;yBACb,CAAC,CAAC;wBACH,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAG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sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { BrowserAuthError } from \"../error/BrowserAuthError\";\nimport { DB_NAME, DB_TABLE_NAME, DB_VERSION } from \"../utils/BrowserConstants\";\nimport { IAsyncStorage } from \"./IAsyncMemoryStorage\";\n\ninterface IDBOpenDBRequestEvent extends Event {\n target: IDBOpenDBRequest & EventTarget;\n}\n\ninterface IDBOpenOnUpgradeNeededEvent extends IDBVersionChangeEvent {\n target: IDBOpenDBRequest & EventTarget;\n}\n\ninterface IDBRequestEvent extends Event {\n target: IDBRequest & EventTarget;\n}\n\ninterface IDBDatabaseInfo {\n name?: string;\n version?: number;\n}\n\n/**\n * Storage wrapper for IndexedDB storage in browsers: https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API\n */\nexport class DatabaseStorage<T> implements IAsyncStorage<T> {\n private db: IDBDatabase|undefined;\n private dbName: string;\n private tableName: string;\n private version: number;\n private dbOpen: boolean;\n\n constructor() {\n this.dbName = DB_NAME;\n this.version = DB_VERSION;\n this.tableName = DB_TABLE_NAME;\n this.dbOpen = false;\n }\n\n /**\n * Opens IndexedDB instance.\n */\n async open(): Promise<void> {\n return new Promise((resolve, reject) => {\n const openDB = window.indexedDB.open(this.dbName, this.version);\n openDB.addEventListener(\"upgradeneeded\", (e: IDBVersionChangeEvent) => {\n const event = e as IDBOpenOnUpgradeNeededEvent;\n event.target.result.createObjectStore(this.tableName);\n });\n openDB.addEventListener(\"success\", (e: Event) => {\n const event = e as IDBOpenDBRequestEvent;\n this.db = event.target.result;\n this.dbOpen = true;\n resolve();\n });\n openDB.addEventListener(\"error\", () => reject(BrowserAuthError.createDatabaseUnavailableError()));\n });\n }\n\n /**\n * Closes the connection to IndexedDB database when all pending transactions\n * complete.\n */\n closeConnection(): void {\n const db = this.db;\n if (db && this.dbOpen) {\n db.close();\n this.dbOpen = false;\n }\n }\n\n /**\n * Opens database if it's not already open\n */\n private async validateDbIsOpen(): Promise<void> {\n if (!this.dbOpen) {\n return await this.open();\n }\n }\n\n /**\n * Retrieves item from IndexedDB instance.\n * @param key \n */\n async getItem(key: string): Promise<T | null> {\n await this.validateDbIsOpen();\n return new Promise<T>((resolve, reject) => {\n // TODO: Add timeouts?\n if (!this.db) {\n return reject(BrowserAuthError.createDatabaseNotOpenError());\n }\n const transaction = this.db.transaction([this.tableName], \"readonly\");\n const objectStore = transaction.objectStore(this.tableName);\n const dbGet = objectStore.get(key);\n \n dbGet.addEventListener(\"success\", (e: Event) => {\n const event = e as IDBRequestEvent;\n this.closeConnection();\n resolve(event.target.result);\n });\n\n dbGet.addEventListener(\"error\", (e: Event) => {\n this.closeConnection();\n reject(e);\n });\n });\n }\n\n /**\n * Adds item to IndexedDB under given key\n * @param key \n * @param payload \n */\n async setItem(key: string, payload: T): Promise<void> {\n await this.validateDbIsOpen();\n return new Promise<void>((resolve: Function, reject: Function) => {\n // TODO: Add timeouts?\n if (!this.db) {\n return reject(BrowserAuthError.createDatabaseNotOpenError());\n }\n const transaction = this.db.transaction([this.tableName], \"readwrite\");\n\n const objectStore = transaction.objectStore(this.tableName);\n\n const dbPut = objectStore.put(payload, key);\n\n dbPut.addEventListener(\"success\", () => {\n this.closeConnection();\n resolve();\n });\n\n dbPut.addEventListener(\"error\", (e) => {\n this.closeConnection();\n reject(e);\n });\n });\n }\n\n /**\n * Removes item from IndexedDB under given key\n * @param key\n */\n async removeItem(key: string): Promise<void> {\n await this.validateDbIsOpen();\n return new Promise<void>((resolve: Function, reject: Function) => {\n if (!this.db) {\n return reject(BrowserAuthError.createDatabaseNotOpenError());\n }\n\n const transaction = this.db.transaction([this.tableName], \"readwrite\");\n const objectStore = transaction.objectStore(this.tableName);\n const dbDelete = objectStore.delete(key);\n\n dbDelete.addEventListener(\"success\", () => {\n this.closeConnection();\n resolve();\n });\n\n dbDelete.addEventListener(\"error\", (e) => {\n this.closeConnection();\n reject(e);\n });\n });\n }\n\n /**\n * Get all the keys from the storage object as an iterable array of strings.\n */\n async getKeys(): Promise<string[]> {\n await this.validateDbIsOpen();\n return new Promise<string[]>((resolve: Function, reject: Function) => {\n if (!this.db) {\n return reject(BrowserAuthError.createDatabaseNotOpenError());\n }\n\n const transaction = this.db.transaction([this.tableName], \"readonly\");\n const objectStore = transaction.objectStore(this.tableName);\n const dbGetKeys = objectStore.getAllKeys();\n\n dbGetKeys.addEventListener(\"success\", (e: Event) => {\n const event = e as IDBRequestEvent;\n this.closeConnection();\n resolve(event.target.result);\n });\n\n dbGetKeys.addEventListener(\"error\", (e: Event) => {\n this.closeConnection();\n reject(e);\n });\n });\n }\n\n /**\n * \n * Checks whether there is an object under the search key in the object store\n */\n async containsKey(key: string): Promise<boolean> {\n await this.validateDbIsOpen();\n\n return new Promise<boolean>((resolve: Function, reject: Function) => {\n if (!this.db) {\n return reject(BrowserAuthError.createDatabaseNotOpenError());\n }\n\n const transaction = this.db.transaction([this.tableName], \"readonly\");\n const objectStore = transaction.objectStore(this.tableName);\n const dbContainsKey = objectStore.count(key);\n\n dbContainsKey.addEventListener(\"success\", (e: Event) => {\n const event = e as IDBRequestEvent;\n this.closeConnection();\n resolve(event.target.result === 1);\n });\n\n dbContainsKey.addEventListener(\"error\", (e: Event) => {\n this.closeConnection();\n reject(e);\n });\n });\n }\n\n /**\n * Deletes the MSAL database. The database is deleted rather than cleared to make it possible\n * for client applications to downgrade to a previous MSAL version without worrying about forward compatibility issues\n * with IndexedDB database versions.\n */\n async deleteDatabase(): Promise<boolean> {\n // Check if database being deleted exists\n\n if (this.db && this.dbOpen) {\n this.closeConnection();\n }\n \n // @ts-ignore\n const existingDatabases = await window.indexedDB.databases();\n const database = existingDatabases.find((database: IDBDatabaseInfo) => database.name === DB_NAME );\n\n // If database exists, delete it\n if (database) {\n return new Promise<boolean>((resolve: Function, reject: Function) => {\n const deleteDbRequest = window.indexedDB.deleteDatabase(DB_NAME);\n deleteDbRequest.addEventListener(\"success\", () => resolve(true));\n deleteDbRequest.addEventListener(\"error\", () =>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qBAAM,MAAM,CAAC,SAAS,CAAC,SAAS,EAAE,EAAA;;wBAAtD,iBAAiB,GAAG,SAAkC;wBACtD,QAAQ,GAAG,iBAAiB,CAAC,IAAI,CAAC,UAAC,QAAyB,IAAK,OAAA,QAAQ,CAAC,IAAI,KAAK,OAAO,GAAA,CAAE,CAAC;;wBAGnG,IAAI,QAAQ,EAAE;4BACV,sBAAO,IAAI,OAAO,CAAU,UAAC,OAAiB,EAAE,MAAgB;oCAC5D,IAAM,eAAe,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;oCACjE,eAAe,CAAC,gBAAgB,CAAC,SAAS,EAAE,cAAM,OAAA,OAAO,CAAC,IAAI,CAAC,GAAA,CAAC,CAAC;oCACjE,eAAe,CAAC,gBAAgB,CAAC,OAAO,EAAE,cAAM,OAAA,MAAM,CAAC,KAAK,CAAC,GAAA,CAAC,CAAC;iCAClE,CAAC,EAAC;yBACN;;wBAGD,sBAAO,IAAI,EAAC;;;;KACf;IACL,sBAAC;AAAD,CAAC;;;;"}
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-browser v2.21.0 2022-01-04 */
1
+ /*! @azure/msal-browser v2.23.0 2022-04-04 */
2
2
  'use strict';
3
3
  /*
4
4
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1 +1 @@
1
- {"version":3,"file":"TokenCache.d.ts","sourceRoot":"","sources":["../../src/cache/TokenCache.ts"],"names":[],"mappings":"AAKA,OAAO,EAAqB,OAAO,EAAiB,MAAM,EAAyC,qBAAqB,EAA4B,MAAM,oBAAoB,CAAC;AAC/K,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,oBAAY,gBAAgB,GAAG;IAC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C;IAEvC,OAAO,CAAC,OAAO,CAAsB;IAErC,OAAO,CAAC,MAAM,CAAS;IAEvB,OAAO,CAAC,SAAS,CAAU;gBAEf,aAAa,EAAE,oBAAoB,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO;IAUjH;;;;;OAKG;IACH,kBAAkB,CAAC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,qBAAqB,EAAE,OAAO,EAAE,gBAAgB,GAAG,IAAI;IAsC5G;;;;;;;OAOG;IACH,OAAO,CAAC,WAAW;IAiBnB;;;;;;;;;OASG;IACH,OAAO,CAAC,eAAe;CA4B1B"}
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-browser v2.21.0 2022-01-04 */
1
+ /*! @azure/msal-browser v2.23.0 2022-04-04 */
2
2
  'use strict';
3
3
  import { Authority, IdTokenEntity, AuthToken, AccountEntity, ScopeSet, AccessTokenEntity } from '@azure/msal-common';
4
4
  import { BrowserAuthError } from '../error/BrowserAuthError.js';
@@ -35,13 +35,14 @@ var TokenCache = /** @class */ (function () {
35
35
  this.loadAccessToken(request, response, request.account.homeAccountId, request.account.environment, request.account.tenantId, options);
36
36
  }
37
37
  else if (request.authority) {
38
+ var authorityUrl = Authority.generateAuthority(request.authority, request.azureCloudOptions);
38
39
  var authorityOptions = {
39
40
  protocolMode: this.config.auth.protocolMode,
40
41
  knownAuthorities: this.config.auth.knownAuthorities,
41
42
  cloudDiscoveryMetadata: this.config.auth.cloudDiscoveryMetadata,
42
- authorityMetadata: this.config.auth.authorityMetadata
43
+ authorityMetadata: this.config.auth.authorityMetadata,
43
44
  };
44
- var authority = new Authority(request.authority, this.config.system.networkClient, this.storage, authorityOptions);
45
+ var authority = new Authority(authorityUrl, this.config.system.networkClient, this.storage, authorityOptions);
45
46
  // "clientInfo" from options takes precedence over "clientInfo" in response
46
47
  if (options.clientInfo) {
47
48
  this.logger.trace("TokenCache - homeAccountId from options");
@@ -1 +1 @@
1
- {"version":3,"file":"TokenCache.js","sources":["../../src/cache/TokenCache.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AccessTokenEntity, ICrypto, IdTokenEntity, Logger, ScopeSet, Authority, AuthorityOptions, ExternalTokenResponse, AccountEntity, AuthToken } from \"@azure/msal-common\";\nimport { BrowserConfiguration } from \"../config/Configuration\";\nimport { SilentRequest } from \"../request/SilentRequest\";\nimport { BrowserCacheManager } from \"./BrowserCacheManager\";\nimport { ITokenCache } from \"./ITokenCache\";\nimport { BrowserAuthError } from \"../error/BrowserAuthError\";\n\nexport type LoadTokenOptions = {\n clientInfo?: string,\n extendedExpiresOn?: number\n};\n\n/**\n * Token cache manager\n */\nexport class TokenCache implements ITokenCache {\n // Flag to indicate if in browser environment\n public isBrowserEnvironment: boolean;\n // Input configuration by developer/user\n protected config: BrowserConfiguration;\n // Browser cache storage\n private storage: BrowserCacheManager;\n // Logger\n private logger: Logger;\n // Crypto class\n private cryptoObj: ICrypto;\n\n constructor(configuration: BrowserConfiguration, storage: BrowserCacheManager, logger: Logger, cryptoObj: ICrypto) {\n this.isBrowserEnvironment = typeof window !== \"undefined\";\n this.config = configuration;\n this.storage = storage;\n this.logger = logger;\n this.cryptoObj = cryptoObj;\n }\n \n // Move getAllAccounts here and cache utility APIs\n\n /**\n * API to load tokens to msal-browser cache. \n * @param request \n * @param response\n * @param options\n */\n loadExternalTokens(request: SilentRequest, response: ExternalTokenResponse, options: LoadTokenOptions): void {\n this.logger.info(\"TokenCache - loadExternalTokens called\");\n\n if (!response.id_token) {\n throw BrowserAuthError.createUnableToLoadTokenError(\"Please ensure server response includes id token.\");\n }\n\n if (request.account) {\n this.loadIdToken(response.id_token, request.account.homeAccountId, request.account.environment, request.account.tenantId, options);\n this.loadAccessToken(request, response, request.account.homeAccountId, request.account.environment, request.account.tenantId, options);\n } else if (request.authority) {\n\n const authorityOptions: AuthorityOptions = {\n protocolMode: this.config.auth.protocolMode,\n knownAuthorities: this.config.auth.knownAuthorities,\n cloudDiscoveryMetadata: this.config.auth.cloudDiscoveryMetadata,\n authorityMetadata: this.config.auth.authorityMetadata\n };\n const authority = new Authority(request.authority, this.config.system.networkClient, this.storage, authorityOptions);\n\n // \"clientInfo\" from options takes precedence over \"clientInfo\" in response\n if (options.clientInfo) {\n this.logger.trace(\"TokenCache - homeAccountId from options\");\n this.loadIdToken(response.id_token, options.clientInfo, authority.hostnameAndPort, authority.tenant, options);\n this.loadAccessToken(request, response, options.clientInfo, authority.hostnameAndPort, authority.tenant, options);\n } else if (response.client_info) {\n this.logger.trace(\"TokenCache - homeAccountId from response\");\n this.loadIdToken(response.id_token, response.client_info, authority.hostnameAndPort, authority.tenant, options);\n this.loadAccessToken(request, response, response.client_info, authority.hostnameAndPort, authority.tenant, options);\n } else {\n throw BrowserAuthError.createUnableToLoadTokenError(\"Please provide clientInfo in the response or options.\");\n }\n } else {\n throw BrowserAuthError.createUnableToLoadTokenError(\"Please provide a request with an account or a request with authority.\");\n }\n }\n\n /**\n * Helper function to load id tokens to msal-browser cache\n * @param idToken \n * @param homeAccountId \n * @param environment \n * @param tenantId \n * @param options \n */\n private loadIdToken(idToken: string, homeAccountId: string, environment: string, tenantId: string, options: LoadTokenOptions): void {\n\n const idTokenEntity = IdTokenEntity.createIdTokenEntity(homeAccountId, environment, idToken, this.config.auth.clientId, tenantId);\n const idAuthToken = new AuthToken(idToken, this.cryptoObj);\n const accountEntity = options.clientInfo ?\n AccountEntity.createAccount(options.clientInfo, homeAccountId, idAuthToken, undefined, undefined, undefined, undefined, environment) :\n AccountEntity.createGenericAccount(homeAccountId, idAuthToken, undefined, undefined, undefined, undefined, environment);\n\n if (this.isBrowserEnvironment) {\n this.logger.verbose(\"TokenCache - loading id token\");\n this.storage.setAccount(accountEntity);\n this.storage.setIdTokenCredential(idTokenEntity);\n } else {\n throw BrowserAuthError.createUnableToLoadTokenError(\"loadExternalTokens is designed to work in browser environments only.\");\n }\n }\n\n /**\n * Helper function to load access tokens to msal-browser cache\n * @param request \n * @param response \n * @param options \n * @param homeAccountId \n * @param environment \n * @param tenantId \n * @returns \n */\n private loadAccessToken(request: SilentRequest, response: ExternalTokenResponse, homeAccountId: string, environment: string, tenantId: string, options: LoadTokenOptions): void {\n\n if (!response.access_token) {\n this.logger.verbose(\"TokenCache - No access token provided for caching\");\n return;\n }\n\n if (!response.expires_in) {\n throw BrowserAuthError.createUnableToLoadTokenError(\"Please ensure server response includes expires_in value.\");\n }\n\n if (!options.extendedExpiresOn) {\n throw BrowserAuthError.createUnableToLoadTokenError(\"Please provide an extendedExpiresOn value in the options.\");\n }\n \n const scopes = new ScopeSet(request.scopes).printScopes();\n const expiresOn = response.expires_in;\n const extendedExpiresOn = options.extendedExpiresOn;\n\n const accessTokenEntity = AccessTokenEntity.createAccessTokenEntity(homeAccountId, environment, response.access_token, this.config.auth.clientId, tenantId, scopes, expiresOn, extendedExpiresOn, this.cryptoObj);\n\n if (this.isBrowserEnvironment) {\n this.logger.verbose(\"TokenCache - loading access token\");\n this.storage.setAccessTokenCredential(accessTokenEntity);\n } else {\n throw BrowserAuthError.createUnableToLoadTokenError(\"loadExternalTokens is designed to work in browser environments only.\");\n }\n }\n}\n"],"names":[],"mappings":";;;;;AAAA;;;;AAiBA;;;;IAeI,oBAAY,aAAmC,EAAE,OAA4B,EAAE,MAAc,EAAE,SAAkB;QAC7G,IAAI,CAAC,oBAAoB,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC;QAC1D,IAAI,CAAC,MAAM,GAAG,aAAa,CAAC;QAC5B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;KAC9B;;;;;;;;IAUD,uCAAkB,GAAlB,UAAmB,OAAsB,EAAE,QAA+B,EAAE,OAAyB;QACjG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,wCAAw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,CAAC,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,iBAAiB,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QAElN,IAAI,IAAI,CAAC,oBAAoB,EAAE;YAC3B,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,mCAAmC,CAAC,CAAC;YACzD,IAAI,CAAC,OAAO,CAAC,wBAAwB,CAAC,iBAAiB,CAAC,CAAC;SAC5D;aAAM;YACH,MAAM,gBAAgB,CAAC,4BAA4B,CAAC,sEAAsE,CAAC,CAAC;SAC/H;KACJ;IACL,iBAAC;AAAD,CAAC;;;;"}
1
+ {"version":3,"file":"TokenCache.js","sources":["../../src/cache/TokenCache.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AccessTokenEntity, ICrypto, IdTokenEntity, Logger, ScopeSet, Authority, AuthorityOptions, ExternalTokenResponse, AccountEntity, AuthToken } from \"@azure/msal-common\";\nimport { BrowserConfiguration } from \"../config/Configuration\";\nimport { SilentRequest } from \"../request/SilentRequest\";\nimport { BrowserCacheManager } from \"./BrowserCacheManager\";\nimport { ITokenCache } from \"./ITokenCache\";\nimport { BrowserAuthError } from \"../error/BrowserAuthError\";\n\nexport type LoadTokenOptions = {\n clientInfo?: string,\n extendedExpiresOn?: number\n};\n\n/**\n * Token cache manager\n */\nexport class TokenCache implements ITokenCache {\n // Flag to indicate if in browser environment\n public isBrowserEnvironment: boolean;\n // Input configuration by developer/user\n protected config: BrowserConfiguration;\n // Browser cache storage\n private storage: BrowserCacheManager;\n // Logger\n private logger: Logger;\n // Crypto class\n private cryptoObj: ICrypto;\n\n constructor(configuration: BrowserConfiguration, storage: BrowserCacheManager, logger: Logger, cryptoObj: ICrypto) {\n this.isBrowserEnvironment = typeof window !== \"undefined\";\n this.config = configuration;\n this.storage = storage;\n this.logger = logger;\n this.cryptoObj = cryptoObj;\n }\n\n // Move getAllAccounts here and cache utility APIs\n\n /**\n * API to load tokens to msal-browser cache.\n * @param request\n * @param response\n * @param options\n */\n loadExternalTokens(request: SilentRequest, response: ExternalTokenResponse, options: LoadTokenOptions): void {\n this.logger.info(\"TokenCache - loadExternalTokens called\");\n\n if (!response.id_token) {\n throw BrowserAuthError.createUnableToLoadTokenError(\"Please ensure server response includes id token.\");\n }\n\n if (request.account) {\n this.loadIdToken(response.id_token, request.account.homeAccountId, request.account.environment, request.account.tenantId, options);\n this.loadAccessToken(request, response, request.account.homeAccountId, request.account.environment, request.account.tenantId, options);\n } else if (request.authority) {\n\n const authorityUrl = Authority.generateAuthority(request.authority, request.azureCloudOptions);\n const authorityOptions: AuthorityOptions = {\n protocolMode: this.config.auth.protocolMode,\n knownAuthorities: this.config.auth.knownAuthorities,\n cloudDiscoveryMetadata: this.config.auth.cloudDiscoveryMetadata,\n authorityMetadata: this.config.auth.authorityMetadata,\n };\n const authority = new Authority(authorityUrl, this.config.system.networkClient, this.storage, authorityOptions);\n\n // \"clientInfo\" from options takes precedence over \"clientInfo\" in response\n if (options.clientInfo) {\n this.logger.trace(\"TokenCache - homeAccountId from options\");\n this.loadIdToken(response.id_token, options.clientInfo, authority.hostnameAndPort, authority.tenant, options);\n this.loadAccessToken(request, response, options.clientInfo, authority.hostnameAndPort, authority.tenant, options);\n } else if (response.client_info) {\n this.logger.trace(\"TokenCache - homeAccountId from response\");\n this.loadIdToken(response.id_token, response.client_info, authority.hostnameAndPort, authority.tenant, options);\n this.loadAccessToken(request, response, response.client_info, authority.hostnameAndPort, authority.tenant, options);\n } else {\n throw BrowserAuthError.createUnableToLoadTokenError(\"Please provide clientInfo in the response or options.\");\n }\n } else {\n throw BrowserAuthError.createUnableToLoadTokenError(\"Please provide a request with an account or a request with authority.\");\n }\n }\n\n /**\n * Helper function to load id tokens to msal-browser cache\n * @param idToken\n * @param homeAccountId\n * @param environment\n * @param tenantId\n * @param options\n */\n private loadIdToken(idToken: string, homeAccountId: string, environment: string, tenantId: string, options: LoadTokenOptions): void {\n\n const idTokenEntity = IdTokenEntity.createIdTokenEntity(homeAccountId, environment, idToken, this.config.auth.clientId, tenantId);\n const idAuthToken = new AuthToken(idToken, this.cryptoObj);\n const accountEntity = options.clientInfo ?\n AccountEntity.createAccount(options.clientInfo, homeAccountId, idAuthToken, undefined, undefined, undefined, undefined, environment) :\n AccountEntity.createGenericAccount(homeAccountId, idAuthToken, undefined, undefined, undefined, undefined, environment);\n\n if (this.isBrowserEnvironment) {\n this.logger.verbose(\"TokenCache - loading id token\");\n this.storage.setAccount(accountEntity);\n this.storage.setIdTokenCredential(idTokenEntity);\n } else {\n throw BrowserAuthError.createUnableToLoadTokenError(\"loadExternalTokens is designed to work in browser environments only.\");\n }\n }\n\n /**\n * Helper function to load access tokens to msal-browser cache\n * @param request\n * @param response\n * @param options\n * @param homeAccountId\n * @param environment\n * @param tenantId\n * @returns\n */\n private loadAccessToken(request: SilentRequest, response: ExternalTokenResponse, homeAccountId: string, environment: string, tenantId: string, options: LoadTokenOptions): void {\n\n if (!response.access_token) {\n this.logger.verbose(\"TokenCache - No access token provided for caching\");\n return;\n }\n\n if (!response.expires_in) {\n throw BrowserAuthError.createUnableToLoadTokenError(\"Please ensure server response includes expires_in value.\");\n }\n\n if (!options.extendedExpiresOn) {\n throw BrowserAuthError.createUnableToLoadTokenError(\"Please provide an extendedExpiresOn value in the options.\");\n }\n\n const scopes = new ScopeSet(request.scopes).printScopes();\n const expiresOn = response.expires_in;\n const extendedExpiresOn = options.extendedExpiresOn;\n\n const accessTokenEntity = AccessTokenEntity.createAccessTokenEntity(homeAccountId, environment, response.access_token, this.config.auth.clientId, tenantId, scopes, expiresOn, extendedExpiresOn, this.cryptoObj);\n\n if (this.isBrowserEnvironment) {\n this.logger.verbose(\"TokenCache - loading access token\");\n this.storage.setAccessTokenCredential(accessTokenEntity);\n } else {\n throw BrowserAuthError.createUnableToLoadTokenError(\"loadExternalTokens is designed to work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;YACxB,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,mDAAmD,CAAC,CAAC;YACzE,OAAO;SACV;QAED,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE;YACtB,MAAM,gBAAgB,CAAC,4BAA4B,CAAC,0DAA0D,CAAC,CAAC;SACnH;QAED,IAAI,CAAC,OAAO,CAAC,iBAAiB,EAAE;YAC5B,MAAM,gBAAgB,CAAC,4BAA4B,CAAC,2DAA2D,CAAC,CAAC;SACpH;QAED,IAAM,MAAM,GAAG,IAAI,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC;QAC1D,IAAM,SAAS,GAAG,QAAQ,CAAC,UAAU,CAAC;QACtC,IAAM,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;QAEpD,IAAM,iBAAiB,GAAG,iBAAiB,CAAC,uBAAuB,CAAC,aAAa,EAAE,WAAW,EAAE,QAAQ,CAAC,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,iBAAiB,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QAElN,IAAI,IAAI,CAAC,oBAAoB,EAAE;YAC3B,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,mCAAmC,CAAC,CAAC;YACzD,IAAI,CAAC,OAAO,CAAC,wBAAwB,CAAC,iBAAiB,CAAC,CAAC;SAC5D;aAAM;YACH,MAAM,gBAAgB,CAAC,4BAA4B,CAAC,sEAAsE,CAAC,CAAC;SAC/H;KACJ;IACL,iBAAC;AAAD,CAAC;;;;"}
@@ -1,4 +1,4 @@
1
- import { SystemOptions, LoggerOptions, INetworkModule, ProtocolMode } from "@azure/msal-common";
1
+ import { SystemOptions, LoggerOptions, INetworkModule, ProtocolMode, AzureCloudOptions, ApplicationTelemetry } from "@azure/msal-common";
2
2
  import { BrowserCacheLocation } from "../utils/BrowserConstants";
3
3
  import { INavigationClient } from "../navigation/INavigationClient";
4
4
  export declare const DEFAULT_POPUP_TIMEOUT_MS = 60000;
@@ -11,11 +11,11 @@ export declare const DEFAULT_REDIRECT_TIMEOUT_MS = 30000;
11
11
  * - authority - You can configure a specific authority, defaults to " " or "https://login.microsoftonline.com/common"
12
12
  * - knownAuthorities - An array of URIs that are known to be valid. Used in B2C scenarios.
13
13
  * - cloudDiscoveryMetadata - A string containing the cloud discovery response. Used in AAD scenarios.
14
- * - redirectUri - The redirect URI where authentication responses can be received by your application. It must exactly match one of the redirect URIs registered in the Azure portal.
15
- * - postLogoutRedirectUri - The redirect URI where the window navigates after a successful logout.
16
- * - navigateToLoginRequestUrl - Boolean indicating whether to navigate to the original request URL after the auth server navigates to the redirect URL.
17
- * - clientCapabilities - Array of capabilities which will be added to the claims.access_token.xms_cc request property on every network request.
18
- * - protocolMode - Enum that represents the protocol that msal follows. Used for configuring proper endpoints.
14
+ * - redirectUri - The redirect URI where authentication responses can be received by your application. It must exactly match one of the redirect URIs registered in the Azure portal.
15
+ * - postLogoutRedirectUri - The redirect URI where the window navigates after a successful logout.
16
+ * - navigateToLoginRequestUrl - Boolean indicating whether to navigate to the original request URL after the auth server navigates to the redirect URL.
17
+ * - clientCapabilities - Array of capabilities which will be added to the claims.access_token.xms_cc request property on every network request.
18
+ * - protocolMode - Enum that represents the protocol that msal follows. Used for configuring proper endpoints.
19
19
  */
20
20
  export declare type BrowserAuthOptions = {
21
21
  clientId: string;
@@ -28,13 +28,14 @@ export declare type BrowserAuthOptions = {
28
28
  navigateToLoginRequestUrl?: boolean;
29
29
  clientCapabilities?: Array<string>;
30
30
  protocolMode?: ProtocolMode;
31
+ azureCloudOptions?: AzureCloudOptions;
31
32
  };
32
33
  /**
33
34
  * Use this to configure the below cache configuration options:
34
35
  *
35
- * - cacheLocation - Used to specify the cacheLocation user wants to set. Valid values are "localStorage" and "sessionStorage"
36
- * - storeAuthStateInCookie - 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.
37
- * - secureCookies - If set, MSAL sets the "Secure" flag on cookies so they can only be sent over HTTPS. By default this flag is set to false.
36
+ * - cacheLocation - Used to specify the cacheLocation user wants to set. Valid values are "localStorage" and "sessionStorage"
37
+ * - storeAuthStateInCookie - 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.
38
+ * - secureCookies - If set, MSAL sets the "Secure" flag on cookies so they can only be sent over HTTPS. By default this flag is set to false.
38
39
  */
39
40
  export declare type CacheOptions = {
40
41
  cacheLocation?: BrowserCacheLocation | string;
@@ -67,6 +68,15 @@ export declare type BrowserSystemOptions = SystemOptions & {
67
68
  asyncPopups?: boolean;
68
69
  allowRedirectInIframe?: boolean;
69
70
  };
71
+ /**
72
+ * Telemetry Options
73
+ * - application: Telemetry information sent on request
74
+ * - appName: Unique string name of an application
75
+ * - appVersion: Version of the application using MSAL
76
+ */
77
+ export declare type BrowserTelemetryOptions = {
78
+ application?: ApplicationTelemetry;
79
+ };
70
80
  /**
71
81
  * Use the configuration object to configure MSAL and initialize the UserAgentApplication.
72
82
  *
@@ -74,16 +84,19 @@ export declare type BrowserSystemOptions = SystemOptions & {
74
84
  * - auth: this is where you configure auth elements like clientID, authority used for authenticating against the Microsoft Identity Platform
75
85
  * - cache: this is where you configure cache location and whether to store cache in cookies
76
86
  * - system: this is where you can configure the network client, logger, token renewal offset
87
+ * - telemetry: this is where you can configure telemetry data and options
77
88
  */
78
89
  export declare type Configuration = {
79
90
  auth: BrowserAuthOptions;
80
91
  cache?: CacheOptions;
81
92
  system?: BrowserSystemOptions;
93
+ telemetry?: BrowserTelemetryOptions;
82
94
  };
83
95
  export declare type BrowserConfiguration = {
84
96
  auth: Required<BrowserAuthOptions>;
85
97
  cache: Required<CacheOptions>;
86
98
  system: Required<BrowserSystemOptions>;
99
+ telemetry: Required<BrowserTelemetryOptions>;
87
100
  };
88
101
  /**
89
102
  * MSAL function that sets the default options when not explicitly configured from app developer
@@ -94,5 +107,5 @@ export declare type BrowserConfiguration = {
94
107
  *
95
108
  * @returns Configuration object
96
109
  */
97
- export declare function buildConfiguration({ auth: userInputAuth, cache: userInputCache, system: userInputSystem }: Configuration, isBrowserEnvironment: boolean): BrowserConfiguration;
110
+ export declare function buildConfiguration({ auth: userInputAuth, cache: userInputCache, system: userInputSystem, telemetry: userInputTelemetry }: Configuration, isBrowserEnvironment: boolean): BrowserConfiguration;
98
111
  //# sourceMappingURL=Configuration.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Configuration.d.ts","sourceRoot":"","sources":["../../src/config/Configuration.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAqC,YAAY,EAAkC,MAAM,oBAAoB,CAAC;AAEnK,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAIpE,eAAO,MAAM,wBAAwB,QAAQ,CAAC;AAC9C,eAAO,MAAM,yBAAyB,OAAO,CAAC;AAC9C,eAAO,MAAM,2BAA2B,QAAQ,CAAC;AAEjD;;;;;;;;;;;;GAYG;AACH,oBAAY,kBAAkB,GAAG;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACjC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qBAAqB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,kBAAkB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACnC,YAAY,CAAC,EAAE,YAAY,CAAC;CAC/B,CAAC;AAEF;;;;;;GAMG;AACH,oBAAY,YAAY,GAAG;IACvB,aAAa,CAA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,CAAC,EAAE,MAAM,CAAC;IAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACnC,CAAC;AAEF;;;;;GAKG;AACH,oBAAY,uBAAuB,GAAG;IAClC,WAAW,CAAC,EAAE,oBAAoB,CAAC;CACtC,CAAC;AAEF;;;;;;;;GAQG;AACH,oBAAY,aAAa,GAAG;IACxB,IAAI,EAAE,kBAAkB,CAAC;IACzB,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,SAAS,CAAC,EAAE,uBAAuB,CAAA;CACtC,CAAC;AAEF,oBAAY,oBAAoB,GAAG;IAC/B,IAAI,EAAE,QAAQ,CAAC,kBAAkB,CAAC,CAAC;IACnC,KAAK,EAAE,QAAQ,CAAC,YAAY,CAAC,CAAC;IAC9B,MAAM,EAAE,QAAQ,CAAC,oBAAoB,CAAC,CAAC;IACvC,SAAS,EAAE,QAAQ,CAAC,uBAAuB,CAAC,CAAA;CAC/C,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,eAAe,EAAE,SAAS,EAAE,kBAAkB,EAAE,EAAE,aAAa,EAAE,oBAAoB,EAAE,OAAO,GAAG,oBAAoB,CAiE7M"}
@@ -1,7 +1,7 @@
1
- /*! @azure/msal-browser v2.21.0 2022-01-04 */
1
+ /*! @azure/msal-browser v2.23.0 2022-04-04 */
2
2
  'use strict';
3
3
  import { __assign } from '../_virtual/_tslib.js';
4
- import { DEFAULT_SYSTEM_OPTIONS, StubbedNetworkModule, Constants, ProtocolMode, LogLevel } from '@azure/msal-common';
4
+ import { DEFAULT_SYSTEM_OPTIONS, StubbedNetworkModule, Constants, ProtocolMode, AzureCloudInstance, LogLevel } from '@azure/msal-common';
5
5
  import { BrowserUtils } from '../utils/BrowserUtils.js';
6
6
  import { BrowserCacheLocation } from '../utils/BrowserConstants.js';
7
7
  import { NavigationClient } from '../navigation/NavigationClient.js';
@@ -24,19 +24,23 @@ var DEFAULT_REDIRECT_TIMEOUT_MS = 30000;
24
24
  * @returns Configuration object
25
25
  */
26
26
  function buildConfiguration(_a, isBrowserEnvironment) {
27
- var userInputAuth = _a.auth, userInputCache = _a.cache, userInputSystem = _a.system;
27
+ var userInputAuth = _a.auth, userInputCache = _a.cache, userInputSystem = _a.system, userInputTelemetry = _a.telemetry;
28
28
  // Default auth options for browser
29
29
  var DEFAULT_AUTH_OPTIONS = {
30
- clientId: "",
30
+ clientId: Constants.EMPTY_STRING,
31
31
  authority: "" + Constants.DEFAULT_AUTHORITY,
32
32
  knownAuthorities: [],
33
- cloudDiscoveryMetadata: "",
34
- authorityMetadata: "",
35
- redirectUri: "",
36
- postLogoutRedirectUri: "",
33
+ cloudDiscoveryMetadata: Constants.EMPTY_STRING,
34
+ authorityMetadata: Constants.EMPTY_STRING,
35
+ redirectUri: Constants.EMPTY_STRING,
36
+ postLogoutRedirectUri: Constants.EMPTY_STRING,
37
37
  navigateToLoginRequestUrl: true,
38
38
  clientCapabilities: [],
39
- protocolMode: ProtocolMode.AAD
39
+ protocolMode: ProtocolMode.AAD,
40
+ azureCloudOptions: {
41
+ azureCloudInstance: AzureCloudInstance.None,
42
+ tenant: Constants.EMPTY_STRING
43
+ },
40
44
  };
41
45
  // Default cache options for browser
42
46
  var DEFAULT_CACHE_OPTIONS = {
@@ -55,10 +59,17 @@ function buildConfiguration(_a, isBrowserEnvironment) {
55
59
  var DEFAULT_BROWSER_SYSTEM_OPTIONS = __assign(__assign({}, DEFAULT_SYSTEM_OPTIONS), { loggerOptions: DEFAULT_LOGGER_OPTIONS, networkClient: isBrowserEnvironment ? BrowserUtils.getBrowserNetworkClient() : StubbedNetworkModule, navigationClient: new NavigationClient(), loadFrameTimeout: 0,
56
60
  // If loadFrameTimeout is provided, use that as default.
57
61
  windowHashTimeout: (userInputSystem && userInputSystem.loadFrameTimeout) || DEFAULT_POPUP_TIMEOUT_MS, iframeHashTimeout: (userInputSystem && userInputSystem.loadFrameTimeout) || DEFAULT_IFRAME_TIMEOUT_MS, navigateFrameWait: isBrowserEnvironment && BrowserUtils.detectIEOrEdge() ? 500 : 0, redirectNavigationTimeout: DEFAULT_REDIRECT_TIMEOUT_MS, asyncPopups: false, allowRedirectInIframe: false });
62
+ var DEFAULT_TELEMETRY_OPTIONS = {
63
+ application: {
64
+ appName: Constants.EMPTY_STRING,
65
+ appVersion: Constants.EMPTY_STRING
66
+ }
67
+ };
58
68
  var overlayedConfig = {
59
69
  auth: __assign(__assign({}, DEFAULT_AUTH_OPTIONS), userInputAuth),
60
70
  cache: __assign(__assign({}, DEFAULT_CACHE_OPTIONS), userInputCache),
61
- system: __assign(__assign({}, DEFAULT_BROWSER_SYSTEM_OPTIONS), userInputSystem)
71
+ system: __assign(__assign({}, DEFAULT_BROWSER_SYSTEM_OPTIONS), userInputSystem),
72
+ telemetry: __assign(__assign({}, DEFAULT_TELEMETRY_OPTIONS), userInputTelemetry)
62
73
  };
63
74
  return overlayedConfig;
64
75
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Configuration.js","sources":["../../src/config/Configuration.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { SystemOptions, LoggerOptions, INetworkModule, DEFAULT_SYSTEM_OPTIONS, Constants, ProtocolMode, LogLevel, StubbedNetworkModule } from \"@azure/msal-common\";\nimport { BrowserUtils } from \"../utils/BrowserUtils\";\nimport { BrowserCacheLocation } from \"../utils/BrowserConstants\";\nimport { INavigationClient } from \"../navigation/INavigationClient\";\nimport { NavigationClient } from \"../navigation/NavigationClient\";\n\n// Default timeout for popup windows and iframes in milliseconds\nexport const DEFAULT_POPUP_TIMEOUT_MS = 60000;\nexport const DEFAULT_IFRAME_TIMEOUT_MS = 6000;\nexport const DEFAULT_REDIRECT_TIMEOUT_MS = 30000;\n\n/**\n * Use this to configure the auth options in the Configuration object\n *\n * - clientId - Client ID of your app registered with our Application registration portal : https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredAppsPreview in Microsoft Identity Platform\n * - authority - You can configure a specific authority, defaults to \" \" or \"https://login.microsoftonline.com/common\"\n * - knownAuthorities - An array of URIs that are known to be valid. Used in B2C scenarios.\n * - cloudDiscoveryMetadata - A string containing the cloud discovery response. Used in AAD scenarios.\n * - redirectUri - The redirect URI where authentication responses can be received by your application. It must exactly match one of the redirect URIs registered in the Azure portal.\n * - postLogoutRedirectUri - The redirect URI where the window navigates after a successful logout.\n * - navigateToLoginRequestUrl - Boolean indicating whether to navigate to the original request URL after the auth server navigates to the redirect URL.\n * - clientCapabilities - Array of capabilities which will be added to the claims.access_token.xms_cc request property on every network request.\n * - protocolMode - Enum that represents the protocol that msal follows. Used for configuring proper endpoints.\n */\nexport type BrowserAuthOptions = {\n clientId: string;\n authority?: string;\n knownAuthorities?: Array<string>;\n cloudDiscoveryMetadata?: string;\n authorityMetadata?: string;\n redirectUri?: string;\n postLogoutRedirectUri?: string | null;\n navigateToLoginRequestUrl?: boolean;\n clientCapabilities?: Array<string>;\n protocolMode?: ProtocolMode;\n};\n\n/**\n * Use this to configure the below cache configuration options:\n *\n * - cacheLocation - Used to specify the cacheLocation user wants to set. Valid values are \"localStorage\" and \"sessionStorage\"\n * - storeAuthStateInCookie - 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.\n * - secureCookies - If set, MSAL sets the \"Secure\" flag on cookies so they can only be sent over HTTPS. By default this flag is set to false.\n */\nexport type CacheOptions = {\n cacheLocation?: BrowserCacheLocation | string;\n storeAuthStateInCookie?: boolean;\n secureCookies?: boolean;\n};\n\n/**\n * Library Specific Options\n *\n * - tokenRenewalOffsetSeconds - Sets the window of offset needed to renew the token before expiry\n * - loggerOptions - Used to initialize the Logger object (See ClientConfiguration.ts)\n * - networkClient - Network interface implementation\n * - windowHashTimeout - Sets the timeout for waiting for a response hash in a popup. Will take precedence over loadFrameTimeout if both are set.\n * - iframeHashTimeout - Sets the timeout for waiting for a response hash in an iframe. Will take precedence over loadFrameTimeout if both are set.\n * - loadFrameTimeout - Sets the timeout for waiting for a response hash in an iframe or popup\n * - navigateFrameWait - Maximum time the library should wait for a frame to load\n * - redirectNavigationTimeout - Time to wait for redirection to occur before resolving promise\n * - asyncPopups - Sets whether popups are opened asynchronously. By default, this flag is set to false. When set to false, blank popups are opened before anything else happens. When set to true, popups are opened when making the network request.\n * - allowRedirectInIframe - Flag to enable redirect opertaions when the app is rendered in an iframe (to support scenarios such as embedded B2C login).\n */\nexport type BrowserSystemOptions = SystemOptions & {\n loggerOptions?: LoggerOptions;\n networkClient?: INetworkModule;\n navigationClient?: INavigationClient;\n windowHashTimeout?: number;\n iframeHashTimeout?: number;\n loadFrameTimeout?: number;\n navigateFrameWait?: number;\n redirectNavigationTimeout?: number;\n asyncPopups?: boolean;\n allowRedirectInIframe?: boolean;\n};\n\n/**\n * Use the configuration object to configure MSAL and initialize the UserAgentApplication.\n *\n * This object allows you to configure important elements of MSAL functionality:\n * - auth: this is where you configure auth elements like clientID, authority used for authenticating against the Microsoft Identity Platform\n * - cache: this is where you configure cache location and whether to store cache in cookies\n * - system: this is where you can configure the network client, logger, token renewal offset\n */\nexport type Configuration = {\n auth: BrowserAuthOptions,\n cache?: CacheOptions,\n system?: BrowserSystemOptions\n};\n\nexport type BrowserConfiguration = {\n auth: Required<BrowserAuthOptions>,\n cache: Required<CacheOptions>,\n system: Required<BrowserSystemOptions>\n};\n\n/**\n * MSAL function that sets the default options when not explicitly configured from app developer\n *\n * @param auth\n * @param cache\n * @param system\n *\n * @returns Configuration object\n */\nexport function buildConfiguration({ auth: userInputAuth, cache: userInputCache, system: userInputSystem }: Configuration, isBrowserEnvironment: boolean): BrowserConfiguration {\n\n // Default auth options for browser\n const DEFAULT_AUTH_OPTIONS: Required<BrowserAuthOptions> = {\n clientId: \"\",\n authority: `${Constants.DEFAULT_AUTHORITY}`,\n knownAuthorities: [],\n cloudDiscoveryMetadata: \"\",\n authorityMetadata: \"\",\n redirectUri: \"\",\n postLogoutRedirectUri: \"\",\n navigateToLoginRequestUrl: true,\n clientCapabilities: [],\n protocolMode: ProtocolMode.AAD\n };\n\n // Default cache options for browser\n const DEFAULT_CACHE_OPTIONS: Required<CacheOptions> = {\n cacheLocation: BrowserCacheLocation.SessionStorage,\n storeAuthStateInCookie: false,\n secureCookies: false\n };\n\n // Default logger options for browser\n const DEFAULT_LOGGER_OPTIONS: LoggerOptions = {\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n loggerCallback: (): void => {},\n logLevel: LogLevel.Info,\n piiLoggingEnabled: false\n };\n\n // Default system options for browser\n const DEFAULT_BROWSER_SYSTEM_OPTIONS: Required<BrowserSystemOptions> = {\n ...DEFAULT_SYSTEM_OPTIONS,\n loggerOptions: DEFAULT_LOGGER_OPTIONS,\n networkClient: isBrowserEnvironment ? BrowserUtils.getBrowserNetworkClient() : StubbedNetworkModule,\n navigationClient: new NavigationClient(),\n loadFrameTimeout: 0,\n // If loadFrameTimeout is provided, use that as default.\n windowHashTimeout: (userInputSystem && userInputSystem.loadFrameTimeout) || DEFAULT_POPUP_TIMEOUT_MS,\n iframeHashTimeout: (userInputSystem && userInputSystem.loadFrameTimeout) || DEFAULT_IFRAME_TIMEOUT_MS,\n navigateFrameWait: isBrowserEnvironment && BrowserUtils.detectIEOrEdge() ? 500 : 0,\n redirectNavigationTimeout: DEFAULT_REDIRECT_TIMEOUT_MS,\n asyncPopups: false,\n allowRedirectInIframe: false\n };\n\n const overlayedConfig: BrowserConfiguration = {\n auth: { ...DEFAULT_AUTH_OPTIONS, ...userInputAuth },\n cache: { ...DEFAULT_CACHE_OPTIONS, ...userInputCache },\n system: { ...DEFAULT_BROWSER_SYSTEM_OPTIONS, ...userInputSystem }\n };\n return overlayedConfig;\n}\n"],"names":[],"mappings":";;;;;;;;AAAA;;;;AAWA;IACa,wBAAwB,GAAG,MAAM;IACjC,yBAAyB,GAAG,KAAK;IACjC,2BAA2B,GAAG,MAAM;AAwFjD;;;;;;;;;SASgB,kBAAkB,CAAC,EAAsF,EAAE,oBAA6B;QAA7G,aAAa,UAAA,EAAS,cAAc,WAAA,EAAU,eAAe,YAAA;;IAGpG,IAAM,oBAAoB,GAAiC;QACvD,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,KAAG,SAAS,CAAC,iBAAmB;QAC3C,gBAAgB,EAAE,EAAE;QACpB,sBAAsB,EAAE,EAAE;QAC1B,iBAAiB,EAAE,EAAE;QACrB,WAAW,EAAE,EAAE;QACf,qBAAqB,EAAE,EAAE;QACzB,yBAAyB,EAAE,IAAI;QAC/B,kBAAkB,EAAE,EAAE;QACtB,YAAY,EAAE,YAAY,CAAC,GAAG;KACjC,CAAC;;IAGF,IAAM,qBAAqB,GAA2B;QAClD,aAAa,EAAE,oBAAoB,CAAC,cAAc;QAClD,sBAAsB,EAAE,KAAK;QAC7B,aAAa,EAAE,KAAK;KACvB,CAAC;;IAGF,IAAM,sBAAsB,GAAkB;;QAE1C,cAAc,EAAE,eAAc;QAC9B,QAAQ,EAAE,QAAQ,CAAC,IAAI;QACvB,iBAAiB,EAAE,KAAK;KAC3B,CAAC;;IAGF,IAAM,8BAA8B,yBAC7B,sBAAsB,KACzB,aAAa,EAAE,sBAAsB,EACrC,aAAa,EAAE,oBAAoB,GAAG,YAAY,CAAC,uBAAuB,EAAE,GAAG,oBAAoB,EACnG,gBAAgB,EAAE,IAAI,gBAAgB,EAAE,EACxC,gBAAgB,EAAE,CAAC;;QAEnB,iBAAiB,EAAE,CAAC,eAAe,IAAI,eAAe,CAAC,gBAAgB,KAAK,wBAAwB,EACpG,iBAAiB,EAAE,CAAC,eAAe,IAAI,eAAe,CAAC,gBAAgB,KAAK,yBAAyB,EACrG,iBAAiB,EAAE,oBAAoB,IAAI,YAAY,CAAC,cAAc,EAAE,GAAG,GAAG,GAAG,CAAC,EAClF,yBAAyB,EAAE,2BAA2B,EACtD,WAAW,EAAE,KAAK,EAClB,qBAAqB,EAAE,KAAK,GAC/B,CAAC;IAEF,IAAM,eAAe,GAAyB;QAC1C,IAAI,wBAAO,oBAAoB,GAAK,aAAa,CAAE;QACnD,KAAK,wBAAO,qBAAqB,GAAK,cAAc,CAAE;QACtD,MAAM,wBAAO,8BAA8B,GAAK,eAAe,CAAE;KACpE,CAAC;IACF,OAAO,eAAe,CAAC;AAC3B;;;;"}
1
+ {"version":3,"file":"Configuration.js","sources":["../../src/config/Configuration.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { SystemOptions, LoggerOptions, INetworkModule, DEFAULT_SYSTEM_OPTIONS, Constants, ProtocolMode, LogLevel, StubbedNetworkModule, AzureCloudInstance, AzureCloudOptions, ApplicationTelemetry } from \"@azure/msal-common\";\nimport { BrowserUtils } from \"../utils/BrowserUtils\";\nimport { BrowserCacheLocation } from \"../utils/BrowserConstants\";\nimport { INavigationClient } from \"../navigation/INavigationClient\";\nimport { NavigationClient } from \"../navigation/NavigationClient\";\n\n// Default timeout for popup windows and iframes in milliseconds\nexport const DEFAULT_POPUP_TIMEOUT_MS = 60000;\nexport const DEFAULT_IFRAME_TIMEOUT_MS = 6000;\nexport const DEFAULT_REDIRECT_TIMEOUT_MS = 30000;\n\n/**\n * Use this to configure the auth options in the Configuration object\n *\n * - clientId - Client ID of your app registered with our Application registration portal : https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredAppsPreview in Microsoft Identity Platform\n * - authority - You can configure a specific authority, defaults to \" \" or \"https://login.microsoftonline.com/common\"\n * - knownAuthorities - An array of URIs that are known to be valid. Used in B2C scenarios.\n * - cloudDiscoveryMetadata - A string containing the cloud discovery response. Used in AAD scenarios.\n * - redirectUri - The redirect URI where authentication responses can be received by your application. It must exactly match one of the redirect URIs registered in the Azure portal.\n * - postLogoutRedirectUri - The redirect URI where the window navigates after a successful logout.\n * - navigateToLoginRequestUrl - Boolean indicating whether to navigate to the original request URL after the auth server navigates to the redirect URL.\n * - clientCapabilities - Array of capabilities which will be added to the claims.access_token.xms_cc request property on every network request.\n * - protocolMode - Enum that represents the protocol that msal follows. Used for configuring proper endpoints.\n */\nexport type BrowserAuthOptions = {\n clientId: string;\n authority?: string;\n knownAuthorities?: Array<string>;\n cloudDiscoveryMetadata?: string;\n authorityMetadata?: string;\n redirectUri?: string;\n postLogoutRedirectUri?: string | null;\n navigateToLoginRequestUrl?: boolean;\n clientCapabilities?: Array<string>;\n protocolMode?: ProtocolMode;\n azureCloudOptions?: AzureCloudOptions;\n};\n\n/**\n * Use this to configure the below cache configuration options:\n *\n * - cacheLocation - Used to specify the cacheLocation user wants to set. Valid values are \"localStorage\" and \"sessionStorage\"\n * - storeAuthStateInCookie - 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.\n * - secureCookies - If set, MSAL sets the \"Secure\" flag on cookies so they can only be sent over HTTPS. By default this flag is set to false.\n */\nexport type CacheOptions = {\n cacheLocation?: BrowserCacheLocation | string;\n storeAuthStateInCookie?: boolean;\n secureCookies?: boolean;\n};\n\n/**\n * Library Specific Options\n *\n * - tokenRenewalOffsetSeconds - Sets the window of offset needed to renew the token before expiry\n * - loggerOptions - Used to initialize the Logger object (See ClientConfiguration.ts)\n * - networkClient - Network interface implementation\n * - windowHashTimeout - Sets the timeout for waiting for a response hash in a popup. Will take precedence over loadFrameTimeout if both are set.\n * - iframeHashTimeout - Sets the timeout for waiting for a response hash in an iframe. Will take precedence over loadFrameTimeout if both are set.\n * - loadFrameTimeout - Sets the timeout for waiting for a response hash in an iframe or popup\n * - navigateFrameWait - Maximum time the library should wait for a frame to load\n * - redirectNavigationTimeout - Time to wait for redirection to occur before resolving promise\n * - asyncPopups - Sets whether popups are opened asynchronously. By default, this flag is set to false. When set to false, blank popups are opened before anything else happens. When set to true, popups are opened when making the network request.\n * - allowRedirectInIframe - Flag to enable redirect opertaions when the app is rendered in an iframe (to support scenarios such as embedded B2C login).\n */\nexport type BrowserSystemOptions = SystemOptions & {\n loggerOptions?: LoggerOptions;\n networkClient?: INetworkModule;\n navigationClient?: INavigationClient;\n windowHashTimeout?: number;\n iframeHashTimeout?: number;\n loadFrameTimeout?: number;\n navigateFrameWait?: number;\n redirectNavigationTimeout?: number;\n asyncPopups?: boolean;\n allowRedirectInIframe?: boolean;\n};\n\n/**\n * Telemetry Options\n * - application: Telemetry information sent on request\n * - appName: Unique string name of an application\n * - appVersion: Version of the application using MSAL\n */\nexport type BrowserTelemetryOptions = {\n application?: ApplicationTelemetry;\n};\n\n/**\n * Use the configuration object to configure MSAL and initialize the UserAgentApplication.\n *\n * This object allows you to configure important elements of MSAL functionality:\n * - auth: this is where you configure auth elements like clientID, authority used for authenticating against the Microsoft Identity Platform\n * - cache: this is where you configure cache location and whether to store cache in cookies\n * - system: this is where you can configure the network client, logger, token renewal offset\n * - telemetry: this is where you can configure telemetry data and options\n */\nexport type Configuration = {\n auth: BrowserAuthOptions,\n cache?: CacheOptions,\n system?: BrowserSystemOptions,\n telemetry?: BrowserTelemetryOptions\n};\n\nexport type BrowserConfiguration = {\n auth: Required<BrowserAuthOptions>,\n cache: Required<CacheOptions>,\n system: Required<BrowserSystemOptions>,\n telemetry: Required<BrowserTelemetryOptions>\n};\n\n/**\n * MSAL function that sets the default options when not explicitly configured from app developer\n *\n * @param auth\n * @param cache\n * @param system\n *\n * @returns Configuration object\n */\nexport function buildConfiguration({ auth: userInputAuth, cache: userInputCache, system: userInputSystem, telemetry: userInputTelemetry }: Configuration, isBrowserEnvironment: boolean): BrowserConfiguration {\n\n // Default auth options for browser\n const DEFAULT_AUTH_OPTIONS: Required<BrowserAuthOptions> = {\n clientId: Constants.EMPTY_STRING,\n authority: `${Constants.DEFAULT_AUTHORITY}`,\n knownAuthorities: [],\n cloudDiscoveryMetadata: Constants.EMPTY_STRING,\n authorityMetadata: Constants.EMPTY_STRING,\n redirectUri: Constants.EMPTY_STRING,\n postLogoutRedirectUri: Constants.EMPTY_STRING,\n navigateToLoginRequestUrl: true,\n clientCapabilities: [],\n protocolMode: ProtocolMode.AAD,\n azureCloudOptions: {\n azureCloudInstance: AzureCloudInstance.None,\n tenant: Constants.EMPTY_STRING\n },\n };\n\n // Default cache options for browser\n const DEFAULT_CACHE_OPTIONS: Required<CacheOptions> = {\n cacheLocation: BrowserCacheLocation.SessionStorage,\n storeAuthStateInCookie: false,\n secureCookies: false\n };\n\n // Default logger options for browser\n const DEFAULT_LOGGER_OPTIONS: LoggerOptions = {\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n loggerCallback: (): void => {},\n logLevel: LogLevel.Info,\n piiLoggingEnabled: false\n };\n\n // Default system options for browser\n const DEFAULT_BROWSER_SYSTEM_OPTIONS: Required<BrowserSystemOptions> = {\n ...DEFAULT_SYSTEM_OPTIONS,\n loggerOptions: DEFAULT_LOGGER_OPTIONS,\n networkClient: isBrowserEnvironment ? BrowserUtils.getBrowserNetworkClient() : StubbedNetworkModule,\n navigationClient: new NavigationClient(),\n loadFrameTimeout: 0,\n // If loadFrameTimeout is provided, use that as default.\n windowHashTimeout: (userInputSystem && userInputSystem.loadFrameTimeout) || DEFAULT_POPUP_TIMEOUT_MS,\n iframeHashTimeout: (userInputSystem && userInputSystem.loadFrameTimeout) || DEFAULT_IFRAME_TIMEOUT_MS,\n navigateFrameWait: isBrowserEnvironment && BrowserUtils.detectIEOrEdge() ? 500 : 0,\n redirectNavigationTimeout: DEFAULT_REDIRECT_TIMEOUT_MS,\n asyncPopups: false,\n allowRedirectInIframe: false\n };\n\n const DEFAULT_TELEMETRY_OPTIONS: Required<BrowserTelemetryOptions> = {\n application: {\n appName: Constants.EMPTY_STRING,\n appVersion: Constants.EMPTY_STRING\n }\n };\n\n const overlayedConfig: BrowserConfiguration = {\n auth: { ...DEFAULT_AUTH_OPTIONS, ...userInputAuth },\n cache: { ...DEFAULT_CACHE_OPTIONS, ...userInputCache },\n system: { ...DEFAULT_BROWSER_SYSTEM_OPTIONS, ...userInputSystem },\n telemetry: { ...DEFAULT_TELEMETRY_OPTIONS, ...userInputTelemetry }\n };\n return overlayedConfig;\n}\n"],"names":[],"mappings":";;;;;;;;AAAA;;;;AAWA;IACa,wBAAwB,GAAG,MAAM;IACjC,yBAAyB,GAAG,KAAK;IACjC,2BAA2B,GAAG,MAAM;AAsGjD;;;;;;;;;SASgB,kBAAkB,CAAC,EAAqH,EAAE,oBAA6B;QAA5I,aAAa,UAAA,EAAS,cAAc,WAAA,EAAU,eAAe,YAAA,EAAa,kBAAkB,eAAA;;IAGnI,IAAM,oBAAoB,GAAiC;QACvD,QAAQ,EAAE,SAAS,CAAC,YAAY;QAChC,SAAS,EAAE,KAAG,SAAS,CAAC,iBAAmB;QAC3C,gBAAgB,EAAE,EAAE;QACpB,sBAAsB,EAAE,SAAS,CAAC,YAAY;QAC9C,iBAAiB,EAAE,SAAS,CAAC,YAAY;QACzC,WAAW,EAAE,SAAS,CAAC,YAAY;QACnC,qBAAqB,EAAE,SAAS,CAAC,YAAY;QAC7C,yBAAyB,EAAE,IAAI;QAC/B,kBAAkB,EAAE,EAAE;QACtB,YAAY,EAAE,YAAY,CAAC,GAAG;QAC9B,iBAAiB,EAAE;YACf,kBAAkB,EAAE,kBAAkB,CAAC,IAAI;YAC3C,MAAM,EAAE,SAAS,CAAC,YAAY;SACjC;KACJ,CAAC;;IAGF,IAAM,qBAAqB,GAA2B;QAClD,aAAa,EAAE,oBAAoB,CAAC,cAAc;QAClD,sBAAsB,EAAE,KAAK;QAC7B,aAAa,EAAE,KAAK;KACvB,CAAC;;IAGF,IAAM,sBAAsB,GAAkB;;QAE1C,cA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CAAC,uBAAuB,CAAwB;IACvD,OAAO,CAAC,MAAM,CAAS;gBAEX,MAAM,EAAE,MAAM;IAe1B;;;OAGG;IACG,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAM5D;;;OAGG;IACH,eAAe,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI;IAQ7C;;;;OAIG;IACG,eAAe,CAAC,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC;IAQ5F;;;;OAIG;IACG,SAAS,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC;IAIpD;;;;;;OAMG;IACG,SAAS,CAAC,GAAG,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC;IASnG;;;;OAIG;IACG,IAAI,CAAC,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IAMnE;;OAEG;IACH,OAAO,CAAC,YAAY;IAIpB;;OAEG;IACH,OAAO,CAAC,WAAW;IAInB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAIxB;;;;OAIG;YACW,qBAAqB;IAInC;;;;OAIG;YACW,iBAAiB;IAY/B;;;;OAIG;YACW,mBAAmB;IAajC;;;;OAIG;YACW,iBAAiB;IA0B/B;;;;;;OAMG;YACW,iBAAiB;IAa/B;;;;OAIG;YACW,YAAY;IAa1B;;;OAGG;IACH,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,UAAU,GAAG,MAAM;CAG/C"}
@@ -1,9 +1,10 @@
1
- /*! @azure/msal-browser v2.21.0 2022-01-04 */
1
+ /*! @azure/msal-browser v2.23.0 2022-04-04 */
2
2
  'use strict';
3
3
  import { __awaiter, __generator } from '../_virtual/_tslib.js';
4
4
  import { BrowserStringUtils } from '../utils/BrowserStringUtils.js';
5
5
  import { BrowserAuthError } from '../error/BrowserAuthError.js';
6
6
  import { KEY_FORMAT_JWK } from '../utils/BrowserConstants.js';
7
+ import { Constants } from '@azure/msal-common';
7
8
 
8
9
  /*
9
10
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -204,11 +205,11 @@ var BrowserCrypto = /** @class */ (function () {
204
205
  msExportKey.addEventListener("complete", function (e) {
205
206
  var resultBuffer = e.target.result;
206
207
  var resultString = BrowserStringUtils.utf8ArrToString(new Uint8Array(resultBuffer))
207
- .replace(/\r/g, "")
208
- .replace(/\n/g, "")
209
- .replace(/\t/g, "")
210
- .split(" ").join("")
211
- .replace("\u0000", "");
208
+ .replace(/\r/g, Constants.EMPTY_STRING)
209
+ .replace(/\n/g, Constants.EMPTY_STRING)
210
+ .replace(/\t/g, Constants.EMPTY_STRING)
211
+ .split(" ").join(Constants.EMPTY_STRING)
212
+ .replace("\u0000", Constants.EMPTY_STRING);
212
213
  try {
213
214
  resolve(JSON.parse(resultString));
214
215
  }