@azure/msal-browser 2.18.0 → 2.22.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 (182) hide show
  1. package/CHANGELOG.json +1758 -1548
  2. package/CHANGELOG.md +553 -491
  3. package/LICENSE +21 -21
  4. package/README.md +5 -3
  5. package/dist/_virtual/_tslib.js +1 -1
  6. package/dist/app/ClientApplication.d.ts +30 -1
  7. package/dist/app/ClientApplication.d.ts.map +1 -1
  8. package/dist/app/ClientApplication.js +101 -5
  9. package/dist/app/ClientApplication.js.map +1 -1
  10. package/dist/app/IPublicClientApplication.d.ts +4 -0
  11. package/dist/app/IPublicClientApplication.d.ts.map +1 -1
  12. package/dist/app/IPublicClientApplication.js +7 -1
  13. package/dist/app/IPublicClientApplication.js.map +1 -1
  14. package/dist/app/PublicClientApplication.d.ts +2 -2
  15. package/dist/app/PublicClientApplication.d.ts.map +1 -1
  16. package/dist/app/PublicClientApplication.js +31 -24
  17. package/dist/app/PublicClientApplication.js.map +1 -1
  18. package/dist/cache/AsyncMemoryStorage.d.ts +46 -0
  19. package/dist/cache/AsyncMemoryStorage.d.ts.map +1 -0
  20. package/dist/cache/AsyncMemoryStorage.js +195 -0
  21. package/dist/cache/AsyncMemoryStorage.js.map +1 -0
  22. package/dist/cache/BrowserCacheManager.d.ts +19 -13
  23. package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
  24. package/dist/cache/BrowserCacheManager.js +31 -7
  25. package/dist/cache/BrowserCacheManager.js.map +1 -1
  26. package/dist/cache/BrowserStorage.d.ts +1 -1
  27. package/dist/cache/BrowserStorage.d.ts.map +1 -1
  28. package/dist/cache/BrowserStorage.js +1 -1
  29. package/dist/cache/BrowserStorage.js.map +1 -1
  30. package/dist/cache/DatabaseStorage.d.ts +25 -6
  31. package/dist/cache/DatabaseStorage.d.ts.map +1 -1
  32. package/dist/cache/DatabaseStorage.js +127 -81
  33. package/dist/cache/DatabaseStorage.js.map +1 -1
  34. package/dist/cache/IAsyncMemoryStorage.d.ts +28 -0
  35. package/dist/cache/IAsyncMemoryStorage.d.ts.map +1 -0
  36. package/dist/cache/IWindowStorage.d.ts +3 -3
  37. package/dist/cache/IWindowStorage.d.ts.map +1 -1
  38. package/dist/cache/MemoryStorage.d.ts +3 -3
  39. package/dist/cache/MemoryStorage.d.ts.map +1 -1
  40. package/dist/cache/MemoryStorage.js +1 -1
  41. package/dist/cache/MemoryStorage.js.map +1 -1
  42. package/dist/cache/TokenCache.d.ts.map +1 -1
  43. package/dist/cache/TokenCache.js +4 -3
  44. package/dist/cache/TokenCache.js.map +1 -1
  45. package/dist/config/Configuration.d.ts +10 -9
  46. package/dist/config/Configuration.d.ts.map +1 -1
  47. package/dist/config/Configuration.js +7 -3
  48. package/dist/config/Configuration.js.map +1 -1
  49. package/dist/crypto/BrowserCrypto.d.ts +3 -1
  50. package/dist/crypto/BrowserCrypto.d.ts.map +1 -1
  51. package/dist/crypto/BrowserCrypto.js +3 -2
  52. package/dist/crypto/BrowserCrypto.js.map +1 -1
  53. package/dist/crypto/CryptoOps.d.ts +16 -5
  54. package/dist/crypto/CryptoOps.d.ts.map +1 -1
  55. package/dist/crypto/CryptoOps.js +58 -17
  56. package/dist/crypto/CryptoOps.js.map +1 -1
  57. package/dist/crypto/GuidGenerator.js +1 -1
  58. package/dist/crypto/GuidGenerator.js.map +1 -1
  59. package/dist/crypto/PkceGenerator.js +1 -1
  60. package/dist/crypto/PkceGenerator.js.map +1 -1
  61. package/dist/crypto/SignedHttpRequest.d.ts +6 -2
  62. package/dist/crypto/SignedHttpRequest.d.ts.map +1 -1
  63. package/dist/crypto/SignedHttpRequest.js +11 -5
  64. package/dist/crypto/SignedHttpRequest.js.map +1 -1
  65. package/dist/encode/Base64Decode.js +1 -1
  66. package/dist/encode/Base64Decode.js.map +1 -1
  67. package/dist/encode/Base64Encode.js +1 -1
  68. package/dist/encode/Base64Encode.js.map +1 -1
  69. package/dist/error/BrowserAuthError.d.ts +16 -0
  70. package/dist/error/BrowserAuthError.d.ts.map +1 -1
  71. package/dist/error/BrowserAuthError.js +22 -2
  72. package/dist/error/BrowserAuthError.js.map +1 -1
  73. package/dist/error/BrowserConfigurationAuthError.js +1 -1
  74. package/dist/error/BrowserConfigurationAuthError.js.map +1 -1
  75. package/dist/event/EventHandler.js +1 -1
  76. package/dist/event/EventHandler.js.map +1 -1
  77. package/dist/event/EventMessage.js +1 -1
  78. package/dist/event/EventMessage.js.map +1 -1
  79. package/dist/event/EventType.d.ts +3 -0
  80. package/dist/event/EventType.d.ts.map +1 -1
  81. package/dist/event/EventType.js +4 -1
  82. package/dist/event/EventType.js.map +1 -1
  83. package/dist/index.cjs.js +1473 -511
  84. package/dist/index.cjs.js.map +1 -1
  85. package/dist/index.d.ts +16 -3
  86. package/dist/index.d.ts.map +1 -1
  87. package/dist/index.js +14 -3
  88. package/dist/index.js.map +1 -1
  89. package/dist/interaction_client/BaseInteractionClient.d.ts +2 -2
  90. package/dist/interaction_client/BaseInteractionClient.d.ts.map +1 -1
  91. package/dist/interaction_client/BaseInteractionClient.js +40 -17
  92. package/dist/interaction_client/BaseInteractionClient.js.map +1 -1
  93. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.d.ts +5 -0
  94. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.d.ts.map +1 -0
  95. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.js +21 -0
  96. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.js.map +1 -0
  97. package/dist/interaction_client/PopupClient.d.ts +4 -3
  98. package/dist/interaction_client/PopupClient.d.ts.map +1 -1
  99. package/dist/interaction_client/PopupClient.js +23 -21
  100. package/dist/interaction_client/PopupClient.js.map +1 -1
  101. package/dist/interaction_client/RedirectClient.d.ts +3 -3
  102. package/dist/interaction_client/RedirectClient.d.ts.map +1 -1
  103. package/dist/interaction_client/RedirectClient.js +22 -20
  104. package/dist/interaction_client/RedirectClient.js.map +1 -1
  105. package/dist/interaction_client/SilentAuthCodeClient.d.ts +22 -0
  106. package/dist/interaction_client/SilentAuthCodeClient.d.ts.map +1 -0
  107. package/dist/interaction_client/SilentAuthCodeClient.js +83 -0
  108. package/dist/interaction_client/SilentAuthCodeClient.js.map +1 -0
  109. package/dist/interaction_client/SilentCacheClient.d.ts +3 -3
  110. package/dist/interaction_client/SilentCacheClient.d.ts.map +1 -1
  111. package/dist/interaction_client/SilentCacheClient.js +15 -5
  112. package/dist/interaction_client/SilentCacheClient.js.map +1 -1
  113. package/dist/interaction_client/SilentIframeClient.d.ts +3 -3
  114. package/dist/interaction_client/SilentIframeClient.d.ts.map +1 -1
  115. package/dist/interaction_client/SilentIframeClient.js +16 -13
  116. package/dist/interaction_client/SilentIframeClient.js.map +1 -1
  117. package/dist/interaction_client/SilentRefreshClient.d.ts +2 -2
  118. package/dist/interaction_client/SilentRefreshClient.d.ts.map +1 -1
  119. package/dist/interaction_client/SilentRefreshClient.js +13 -10
  120. package/dist/interaction_client/SilentRefreshClient.js.map +1 -1
  121. package/dist/interaction_client/StandardInteractionClient.d.ts +11 -11
  122. package/dist/interaction_client/StandardInteractionClient.d.ts.map +1 -1
  123. package/dist/interaction_client/StandardInteractionClient.js +90 -57
  124. package/dist/interaction_client/StandardInteractionClient.js.map +1 -1
  125. package/dist/interaction_handler/InteractionHandler.d.ts +11 -2
  126. package/dist/interaction_handler/InteractionHandler.d.ts.map +1 -1
  127. package/dist/interaction_handler/InteractionHandler.js +36 -10
  128. package/dist/interaction_handler/InteractionHandler.js.map +1 -1
  129. package/dist/interaction_handler/PopupHandler.d.ts.map +1 -1
  130. package/dist/interaction_handler/PopupHandler.js +1 -3
  131. package/dist/interaction_handler/PopupHandler.js.map +1 -1
  132. package/dist/interaction_handler/RedirectHandler.d.ts +1 -1
  133. package/dist/interaction_handler/RedirectHandler.d.ts.map +1 -1
  134. package/dist/interaction_handler/RedirectHandler.js +2 -3
  135. package/dist/interaction_handler/RedirectHandler.js.map +1 -1
  136. package/dist/interaction_handler/SilentHandler.js +1 -1
  137. package/dist/interaction_handler/SilentHandler.js.map +1 -1
  138. package/dist/navigation/NavigationClient.js +1 -1
  139. package/dist/navigation/NavigationClient.js.map +1 -1
  140. package/dist/network/FetchClient.js +1 -1
  141. package/dist/network/FetchClient.js.map +1 -1
  142. package/dist/network/XhrClient.js +1 -1
  143. package/dist/network/XhrClient.js.map +1 -1
  144. package/dist/packageMetadata.d.ts +1 -1
  145. package/dist/packageMetadata.js +2 -2
  146. package/dist/packageMetadata.js.map +1 -1
  147. package/dist/request/AuthorizationCodeRequest.d.ts +8 -0
  148. package/dist/request/AuthorizationCodeRequest.d.ts.map +1 -0
  149. package/dist/request/AuthorizationUrlRequest.d.ts +1 -1
  150. package/dist/request/AuthorizationUrlRequest.d.ts.map +1 -1
  151. package/dist/request/EndSessionPopupRequest.d.ts +1 -0
  152. package/dist/request/EndSessionPopupRequest.d.ts.map +1 -1
  153. package/dist/request/EndSessionRequest.d.ts +1 -0
  154. package/dist/request/EndSessionRequest.d.ts.map +1 -1
  155. package/dist/request/PopupRequest.d.ts +1 -1
  156. package/dist/request/PopupRequest.d.ts.map +1 -1
  157. package/dist/request/RedirectRequest.d.ts +1 -1
  158. package/dist/request/RedirectRequest.d.ts.map +1 -1
  159. package/dist/request/SilentRequest.d.ts +1 -1
  160. package/dist/request/SilentRequest.d.ts.map +1 -1
  161. package/dist/request/SsoSilentRequest.d.ts +1 -1
  162. package/dist/request/SsoSilentRequest.d.ts.map +1 -1
  163. package/dist/utils/BrowserConstants.d.ts +6 -1
  164. package/dist/utils/BrowserConstants.d.ts.map +1 -1
  165. package/dist/utils/BrowserConstants.js +9 -3
  166. package/dist/utils/BrowserConstants.js.map +1 -1
  167. package/dist/utils/BrowserProtocolUtils.js +1 -1
  168. package/dist/utils/BrowserProtocolUtils.js.map +1 -1
  169. package/dist/utils/BrowserStringUtils.js +1 -1
  170. package/dist/utils/BrowserStringUtils.js.map +1 -1
  171. package/dist/utils/BrowserUtils.js +1 -1
  172. package/dist/utils/BrowserUtils.js.map +1 -1
  173. package/dist/utils/MathUtils.js +1 -1
  174. package/dist/utils/MathUtils.js.map +1 -1
  175. package/dist/utils/PopupUtils.d.ts +1 -2
  176. package/dist/utils/PopupUtils.d.ts.map +1 -1
  177. package/dist/utils/PopupUtils.js +3 -3
  178. package/dist/utils/PopupUtils.js.map +1 -1
  179. package/lib/msal-browser.js +1473 -511
  180. package/lib/msal-browser.js.map +1 -1
  181. package/lib/msal-browser.min.js +36 -31
  182. package/package.json +96 -94
@@ -1 +1 @@
1
- {"version":3,"file":"IPublicClientApplication.js","sources":["../../src/app/IPublicClientApplication.ts"],"sourcesContent":["/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { AuthenticationResult, AccountInfo, Logger } from \"@azure/msal-common\";\r\nimport { RedirectRequest } from \"../request/RedirectRequest\";\r\nimport { PopupRequest } from \"../request/PopupRequest\";\r\nimport { SilentRequest } from \"../request/SilentRequest\";\r\nimport { SsoSilentRequest } from \"../request/SsoSilentRequest\";\r\nimport { EndSessionRequest } from \"../request/EndSessionRequest\";\r\nimport { BrowserConfigurationAuthError } from \"../error/BrowserConfigurationAuthError\";\r\nimport { WrapperSKU } from \"../utils/BrowserConstants\";\r\nimport { INavigationClient } from \"../navigation/INavigationClient\";\r\nimport { EndSessionPopupRequest } from \"../request/EndSessionPopupRequest\";\r\nimport { ITokenCache } from \"../cache/ITokenCache\";\r\n\r\nexport interface IPublicClientApplication {\r\n acquireTokenPopup(request: PopupRequest): Promise<AuthenticationResult>;\r\n acquireTokenRedirect(request: RedirectRequest): Promise<void>;\r\n acquireTokenSilent(silentRequest: SilentRequest): Promise<AuthenticationResult>;\r\n addEventCallback(callback: Function): string | null;\r\n removeEventCallback(callbackId: string): void;\r\n enableAccountStorageEvents(): void;\r\n disableAccountStorageEvents(): void;\r\n getAccountByHomeId(homeAccountId: string): AccountInfo | null;\r\n getAccountByLocalId(localId: string): AccountInfo | null;\r\n getAccountByUsername(userName: string): AccountInfo | null;\r\n getAllAccounts(): AccountInfo[];\r\n handleRedirectPromise(hash?: string): Promise<AuthenticationResult | null>;\r\n loginPopup(request?: PopupRequest): Promise<AuthenticationResult>;\r\n loginRedirect(request?: RedirectRequest): Promise<void>;\r\n logout(logoutRequest?: EndSessionRequest): Promise<void>;\r\n logoutRedirect(logoutRequest?: EndSessionRequest): Promise<void>;\r\n logoutPopup(logoutRequest?: EndSessionPopupRequest): Promise<void>;\r\n ssoSilent(request: SsoSilentRequest): Promise<AuthenticationResult>;\r\n getTokenCache(): ITokenCache;\r\n getLogger(): Logger;\r\n setLogger(logger: Logger): void;\r\n setActiveAccount(account: AccountInfo | null): void;\r\n getActiveAccount(): AccountInfo | null;\r\n initializeWrapperLibrary(sku: WrapperSKU, version: string): void;\r\n setNavigationClient(navigationClient: INavigationClient): void;\r\n}\r\n\r\nexport const stubbedPublicClientApplication: IPublicClientApplication = {\r\n acquireTokenPopup: () => {\r\n return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError());\r\n },\r\n acquireTokenRedirect: () => {\t\r\n return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError());\t\r\n },\t\r\n acquireTokenSilent: () => {\t\r\n return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError());\t\r\n },\t\r\n getAllAccounts: () => {\r\n return [];\t\r\n },\t\r\n getAccountByHomeId: () => {\r\n return null;\r\n },\r\n getAccountByUsername: () => {\t\r\n return null;\t\r\n },\t\r\n getAccountByLocalId: () => {\r\n return null;\r\n },\r\n handleRedirectPromise: () => {\t\r\n return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError());\t\r\n },\t\r\n loginPopup: () => {\t\r\n return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError());\t\r\n },\t\r\n loginRedirect: () => {\t\r\n return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError());\t\r\n },\t\r\n logout: () => {\t\r\n return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError());\t\r\n },\t\r\n logoutRedirect: () => {\t\r\n return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError());\t\r\n },\r\n logoutPopup: () => {\t\r\n return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError());\t\r\n },\r\n ssoSilent: () => {\t\r\n return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError());\t\r\n },\r\n addEventCallback: () => {\r\n return null;\r\n },\r\n removeEventCallback: () => {\r\n return;\r\n },\r\n enableAccountStorageEvents: () => {\r\n return;\r\n },\r\n disableAccountStorageEvents: () => {\r\n return;\r\n },\r\n getTokenCache: () => {\r\n throw BrowserConfigurationAuthError.createStubPcaInstanceCalledError();\r\n },\r\n getLogger: () => {\r\n throw BrowserConfigurationAuthError.createStubPcaInstanceCalledError();\r\n },\r\n setLogger: () => {\r\n return;\r\n },\r\n setActiveAccount: () => {\r\n return;\r\n },\r\n getActiveAccount: () => {\r\n return null;\r\n },\r\n initializeWrapperLibrary: () => {\r\n return;\r\n },\r\n setNavigationClient: () => {\r\n return;\r\n }\r\n};\r\n"],"names":[],"mappings":";;;;AAAA;;;;IA6Ca,8BAA8B,GAA6B;IACpE,iBAAiB,EAAE;QACf,OAAO,OAAO,CAAC,MAAM,CAAC,6BAA6B,CAAC,gCAAgC,EAAE,CAAC,CAAC;KAC3F;IACD,oBAAoB,EAAE;QAClB,OAAO,OAAO,CAAC,MAAM,CAAC,6BAA6B,CAAC,gCAAgC,EAAE,CAAC,CAAC;KAC3F;IACD,kBAAkB,EAAE;QAChB,OAAO,OAAO,CAAC,MAAM,CAAC,6BAA6B,CAAC,gCAAgC,EAAE,CAAC,CAAC;KAC3F;IACD,cAAc,EAAE;QACZ,OAAO,EAAE,CAAC;KACb;IACD,kBAAkB,EAAE;QAChB,OAAO,IAAI,CAAC;KACf;IACD,oBAAoB,EAAE;QAClB,OAAO,IAAI,CAAC;KACf;IACD,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;;"}
1
+ {"version":3,"file":"IPublicClientApplication.js","sources":["../../src/app/IPublicClientApplication.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AuthenticationResult, AccountInfo, Logger } from \"@azure/msal-common\";\nimport { RedirectRequest } from \"../request/RedirectRequest\";\nimport { PopupRequest } from \"../request/PopupRequest\";\nimport { SilentRequest } from \"../request/SilentRequest\";\nimport { SsoSilentRequest } from \"../request/SsoSilentRequest\";\nimport { EndSessionRequest } from \"../request/EndSessionRequest\";\nimport { BrowserConfigurationAuthError } from \"../error/BrowserConfigurationAuthError\";\nimport { WrapperSKU } from \"../utils/BrowserConstants\";\nimport { INavigationClient } from \"../navigation/INavigationClient\";\nimport { EndSessionPopupRequest } from \"../request/EndSessionPopupRequest\";\nimport { ITokenCache } from \"../cache/ITokenCache\";\nimport { AuthorizationCodeRequest } from \"../request/AuthorizationCodeRequest\";\nimport { BrowserConfiguration } from \"../config/Configuration\";\n\nexport interface IPublicClientApplication {\n acquireTokenPopup(request: PopupRequest): Promise<AuthenticationResult>;\n acquireTokenRedirect(request: RedirectRequest): Promise<void>;\n acquireTokenSilent(silentRequest: SilentRequest): Promise<AuthenticationResult>;\n acquireTokenByCode(request: AuthorizationCodeRequest): Promise<AuthenticationResult>;\n addEventCallback(callback: Function): string | null;\n removeEventCallback(callbackId: string): void;\n enableAccountStorageEvents(): void;\n disableAccountStorageEvents(): void;\n getAccountByHomeId(homeAccountId: string): AccountInfo | null;\n getAccountByLocalId(localId: string): AccountInfo | null;\n getAccountByUsername(userName: string): AccountInfo | null;\n getAllAccounts(): AccountInfo[];\n handleRedirectPromise(hash?: string): Promise<AuthenticationResult | null>;\n loginPopup(request?: PopupRequest): Promise<AuthenticationResult>;\n loginRedirect(request?: RedirectRequest): Promise<void>;\n logout(logoutRequest?: EndSessionRequest): Promise<void>;\n logoutRedirect(logoutRequest?: EndSessionRequest): Promise<void>;\n logoutPopup(logoutRequest?: EndSessionPopupRequest): Promise<void>;\n ssoSilent(request: SsoSilentRequest): Promise<AuthenticationResult>;\n getTokenCache(): ITokenCache;\n getLogger(): Logger;\n setLogger(logger: Logger): void;\n setActiveAccount(account: AccountInfo | null): void;\n getActiveAccount(): AccountInfo | null;\n initializeWrapperLibrary(sku: WrapperSKU, version: string): void;\n setNavigationClient(navigationClient: INavigationClient): void;\n getConfiguration(): BrowserConfiguration;\n}\n\nexport const stubbedPublicClientApplication: IPublicClientApplication = {\n acquireTokenPopup: () => {\n return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError());\n },\n acquireTokenRedirect: () => {\t\n return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError());\t\n },\t\n acquireTokenSilent: () => {\t\n return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError());\t\n },\n acquireTokenByCode: () => {\n return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError());\n },\n getAllAccounts: () => {\n return [];\t\n },\t\n getAccountByHomeId: () => {\n return null;\n },\n getAccountByUsername: () => {\t\n return null;\t\n },\t\n getAccountByLocalId: () => {\n return null;\n },\n handleRedirectPromise: () => {\t\n return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError());\t\n },\t\n loginPopup: () => {\t\n return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError());\t\n },\t\n loginRedirect: () => {\t\n return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError());\t\n },\t\n logout: () => {\t\n return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError());\t\n },\t\n logoutRedirect: () => {\t\n return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError());\t\n },\n logoutPopup: () => {\t\n return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError());\t\n },\n ssoSilent: () => {\t\n return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError());\t\n },\n addEventCallback: () => {\n return null;\n },\n removeEventCallback: () => {\n return;\n },\n enableAccountStorageEvents: () => {\n return;\n },\n disableAccountStorageEvents: () => {\n return;\n },\n getTokenCache: () => {\n throw BrowserConfigurationAuthError.createStubPcaInstanceCalledError();\n },\n getLogger: () => {\n throw BrowserConfigurationAuthError.createStubPcaInstanceCalledError();\n },\n setLogger: () => {\n return;\n },\n setActiveAccount: () => {\n return;\n },\n getActiveAccount: () => {\n return null;\n },\n initializeWrapperLibrary: () => {\n return;\n },\n setNavigationClient: () => {\n return;\n },\n getConfiguration: () => {\n throw BrowserConfigurationAuthError.createStubPcaInstanceCalledError();\n }\n};\n"],"names":[],"mappings":";;;;AAAA;;;;IAiDa,8BAA8B,GAA6B;IACpE,iBAAiB,EAAE;QACf,OAAO,OAAO,CAAC,MAAM,CAAC,6BAA6B,CAAC,gCAAgC,EAAE,CAAC,CAAC;KAC3F;IACD,oBAAoB,EAAE;QAClB,OAAO,OAAO,CAAC,MAAM,CAAC,6BAA6B,CAAC,gCAAgC,EAAE,CAAC,CAAC;KAC3F;IACD,kBAAkB,EAAE;QAChB,OAAO,OAAO,CAAC,MAAM,CAAC,6BAA6B,CAAC,gCAAgC,EAAE,CAAC,CAAC;KAC3F;IACD,kBAAkB,EAAE;QAChB,OAAO,OAAO,CAAC,MAAM,CAAC,6BAA6B,CAAC,gCAAgC,EAAE,CAAC,CAAC;KAC3F;IACD,cAAc,EAAE;QACZ,OAAO,EAAE,CAAC;KACb;IACD,kBAAkB,EAAE;QAChB,OAAO,IAAI,CAAC;KACf;IACD,oBAAoB,EAAE;QAClB,OAAO,IAAI,CAAC;KACf;IACD,mBAAmB,EAAE;QACjB,OAAO,IAAI,CAAC;KACf;IACD,qBAAqB,EAAE;QACnB,OAAO,OAAO,CAAC,MAAM,CAAC,6BAA6B,CAAC,gCAAgC,EAAE,CAAC,CAAC;KAC3F;IACD,UAAU,EAAE;QACR,OAAO,OAAO,CAAC,MAAM,CAAC,6BAA6B,CAAC,gCAAgC,EAAE,CAAC,CAAC;KAC3F;IACD,aAAa,EAAE;QACX,OAAO,OAAO,CAAC,MAAM,CAAC,6BAA6B,CAAC,gCAAgC,EAAE,CAAC,CAAC;KAC3F;IACD,MAAM,EAAE;QACJ,OAAO,OAAO,CAAC,MAAM,CAAC,6BAA6B,CAAC,gCAAgC,EAAE,CAAC,CAAC;KAC3F;IACD,cAAc,EAAE;QACZ,OAAO,OAAO,CAAC,MAAM,CAAC,6BAA6B,CAAC,gCAAgC,EAAE,CAAC,CAAC;KAC3F;IACD,WAAW,EAAE;QACT,OAAO,OAAO,CAAC,MAAM,CAAC,6BAA6B,CAAC,gCAAgC,EAAE,CAAC,CAAC;KAC3F;IACD,SAAS,EAAE;QACP,OAAO,OAAO,CAAC,MAAM,CAAC,6BAA6B,CAAC,gCAAgC,EAAE,CAAC,CAAC;KAC3F;IACD,gBAAgB,EAAE;QACd,OAAO,IAAI,CAAC;KACf;IACD,mBAAmB,EAAE;QACjB,OAAO;KACV;IACD,0BAA0B,EAAE;QACxB,OAAO;KACV;IACD,2BAA2B,EAAE;QACzB,OAAO;KACV;IACD,aAAa,EAAE;QACX,MAAM,6BAA6B,CAAC,gCAAgC,EAAE,CAAC;KAC1E;IACD,SAAS,EAAE;QACP,MAAM,6BAA6B,CAAC,gCAAgC,EAAE,CAAC;KAC1E;IACD,SAAS,EAAE;QACP,OAAO;KACV;IACD,gBAAgB,EAAE;QACd,OAAO;KACV;IACD,gBAAgB,EAAE;QACd,OAAO,IAAI,CAAC;KACf;IACD,wBAAwB,EAAE;QACtB,OAAO;KACV;IACD,mBAAmB,EAAE;QACjB,OAAO;KACV;IACD,gBAAgB,EAAE;QACd,MAAM,6BAA6B,CAAC,gCAAgC,EAAE,CAAC;KAC1E;;;;;"}
@@ -1,4 +1,4 @@
1
- import { AuthenticationResult } from "@azure/msal-common";
1
+ import { AccountInfo, AuthenticationResult } from "@azure/msal-common";
2
2
  import { Configuration } from "../config/Configuration";
3
3
  import { IPublicClientApplication } from "./IPublicClientApplication";
4
4
  import { RedirectRequest } from "../request/RedirectRequest";
@@ -64,6 +64,6 @@ export declare class PublicClientApplication extends ClientApplication implement
64
64
  * @param {@link (AccountInfo:type)}
65
65
  * @returns {Promise.<AuthenticationResult>} - a promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the {@link AuthResponse}
66
66
  */
67
- private acquireTokenSilentAsync;
67
+ protected acquireTokenSilentAsync(request: SilentRequest, account: AccountInfo): Promise<AuthenticationResult>;
68
68
  }
69
69
  //# sourceMappingURL=PublicClientApplication.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PublicClientApplication.d.ts","sourceRoot":"","sources":["../../src/app/PublicClientApplication.ts"],"names":[],"mappings":"AAKA,OAAO,EAAe,oBAAoB,EAAqB,MAAM,oBAAoB,CAAC;AAC1F,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAKzD;;;GAGG;AACH,qBAAa,uBAAwB,SAAQ,iBAAkB,YAAW,wBAAwB;IAG9F,OAAO,CAAC,yBAAyB,CAA6C;IAE9E;;;;;;;;;;;;;;;;;;;;OAoBG;gBACS,aAAa,EAAE,aAAa;IAMxC;;;;;;;;OAQG;IACG,aAAa,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAK7D;;;;;;OAMG;IACH,UAAU,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAKjE;;;;;OAKG;IACG,kBAAkB,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAsC/E;;;;;OAKG;YACW,uBAAuB;CAgBxC"}
1
+ {"version":3,"file":"PublicClientApplication.d.ts","sourceRoot":"","sources":["../../src/app/PublicClientApplication.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAqB,MAAM,oBAAoB,CAAC;AAC1F,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAKzD;;;GAGG;AACH,qBAAa,uBAAwB,SAAQ,iBAAkB,YAAW,wBAAwB;IAG9F,OAAO,CAAC,yBAAyB,CAA6C;IAE9E;;;;;;;;;;;;;;;;;;;;OAoBG;gBACS,aAAa,EAAE,aAAa;IAMxC;;;;;;;;OAQG;IACG,aAAa,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAK7D;;;;;;OAMG;IACH,UAAU,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAKjE;;;;;OAKG;IACG,kBAAkB,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAwC/E;;;;;OAKG;cACa,uBAAuB,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,oBAAoB,CAAC;CAgBvH"}
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-browser v2.18.0 2021-10-05 */
1
+ /*! @azure/msal-browser v2.22.0 2022-02-08 */
2
2
  'use strict';
3
3
  import { __extends, __awaiter, __generator } from '../_virtual/_tslib.js';
4
4
  import { DEFAULT_REQUEST, InteractionType } from '../utils/BrowserConstants.js';
@@ -93,10 +93,12 @@ var PublicClientApplication = /** @class */ (function (_super) {
93
93
  authority: request.authority || "",
94
94
  scopes: request.scopes,
95
95
  homeAccountIdentifier: account.homeAccountId,
96
+ claims: request.claims,
96
97
  authenticationScheme: request.authenticationScheme,
97
98
  resourceRequestMethod: request.resourceRequestMethod,
98
99
  resourceRequestUri: request.resourceRequestUri,
99
- shrClaims: request.shrClaims
100
+ shrClaims: request.shrClaims,
101
+ sshKid: request.sshKid
100
102
  };
101
103
  silentRequestKey = JSON.stringify(thumbprint);
102
104
  cachedResponse = this.activeSilentTokenRequests.get(silentRequestKey);
@@ -132,28 +134,33 @@ var PublicClientApplication = /** @class */ (function (_super) {
132
134
  var silentCacheClient, silentRequest;
133
135
  var _this = this;
134
136
  return __generator(this, function (_a) {
135
- silentCacheClient = new SilentCacheClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient);
136
- silentRequest = silentCacheClient.initializeSilentRequest(request, account);
137
- this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_START, InteractionType.Silent, request);
138
- return [2 /*return*/, silentCacheClient.acquireToken(silentRequest).catch(function () { return __awaiter(_this, void 0, void 0, function () {
139
- var tokenRenewalResult, tokenRenewalError_1;
140
- return __generator(this, function (_a) {
141
- switch (_a.label) {
142
- case 0:
143
- _a.trys.push([0, 2, , 3]);
144
- return [4 /*yield*/, this.acquireTokenByRefreshToken(silentRequest)];
145
- case 1:
146
- tokenRenewalResult = _a.sent();
147
- this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, InteractionType.Silent, tokenRenewalResult);
148
- return [2 /*return*/, tokenRenewalResult];
149
- case 2:
150
- tokenRenewalError_1 = _a.sent();
151
- this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, InteractionType.Silent, null, tokenRenewalError_1);
152
- throw tokenRenewalError_1;
153
- case 3: return [2 /*return*/];
154
- }
155
- });
156
- }); })];
137
+ switch (_a.label) {
138
+ case 0:
139
+ silentCacheClient = new SilentCacheClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, request.correlationId);
140
+ return [4 /*yield*/, silentCacheClient.initializeSilentRequest(request, account)];
141
+ case 1:
142
+ silentRequest = _a.sent();
143
+ this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_START, InteractionType.Silent, request);
144
+ return [2 /*return*/, silentCacheClient.acquireToken(silentRequest).catch(function () { return __awaiter(_this, void 0, void 0, function () {
145
+ var tokenRenewalResult, tokenRenewalError_1;
146
+ return __generator(this, function (_a) {
147
+ switch (_a.label) {
148
+ case 0:
149
+ _a.trys.push([0, 2, , 3]);
150
+ return [4 /*yield*/, this.acquireTokenByRefreshToken(silentRequest)];
151
+ case 1:
152
+ tokenRenewalResult = _a.sent();
153
+ this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, InteractionType.Silent, tokenRenewalResult);
154
+ return [2 /*return*/, tokenRenewalResult];
155
+ case 2:
156
+ tokenRenewalError_1 = _a.sent();
157
+ this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, InteractionType.Silent, null, tokenRenewalError_1);
158
+ throw tokenRenewalError_1;
159
+ case 3: return [2 /*return*/];
160
+ }
161
+ });
162
+ }); })];
163
+ }
157
164
  });
158
165
  });
159
166
  };
@@ -1 +1 @@
1
- {"version":3,"file":"PublicClientApplication.js","sources":["../../src/app/PublicClientApplication.ts"],"sourcesContent":["/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { AccountInfo, AuthenticationResult, RequestThumbprint } from \"@azure/msal-common\";\r\nimport { Configuration } from \"../config/Configuration\";\r\nimport { DEFAULT_REQUEST, InteractionType } from \"../utils/BrowserConstants\";\r\nimport { IPublicClientApplication } from \"./IPublicClientApplication\";\r\nimport { RedirectRequest } from \"../request/RedirectRequest\";\r\nimport { PopupRequest } from \"../request/PopupRequest\";\r\nimport { ClientApplication } from \"./ClientApplication\";\r\nimport { SilentRequest } from \"../request/SilentRequest\";\r\nimport { EventType } from \"../event/EventType\";\r\nimport { BrowserAuthError } from \"../error/BrowserAuthError\";\r\nimport { SilentCacheClient } from \"../interaction_client/SilentCacheClient\";\r\n\r\n/**\r\n * The PublicClientApplication class is the object exposed by the library to perform authentication and authorization functions in Single Page Applications\r\n * to obtain JWT tokens as described in the OAuth 2.0 Authorization Code Flow with PKCE specification.\r\n */\r\nexport class PublicClientApplication extends ClientApplication implements IPublicClientApplication {\r\n\r\n // Active requests\r\n private activeSilentTokenRequests: Map<string, Promise<AuthenticationResult>>;\r\n\r\n /**\r\n * @constructor\r\n * Constructor for the PublicClientApplication used to instantiate the PublicClientApplication object\r\n *\r\n * Important attributes in the Configuration object for auth are:\r\n * - clientID: the application ID of your application. You can obtain one by registering your application with our Application registration portal : https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredAppsPreview\r\n * - authority: the authority URL for your application.\r\n * - redirect_uri: the uri of your application registered in the portal.\r\n *\r\n * In Azure AD, authority is a URL indicating the Azure active directory that MSAL uses to obtain tokens.\r\n * It is of the form https://login.microsoftonline.com/{Enter_the_Tenant_Info_Here}\r\n * If your application supports Accounts in one organizational directory, replace \"Enter_the_Tenant_Info_Here\" value with the Tenant Id or Tenant name (for example, contoso.microsoft.com).\r\n * If your application supports Accounts in any organizational directory, replace \"Enter_the_Tenant_Info_Here\" value with organizations.\r\n * If your application supports Accounts in any organizational directory and personal Microsoft accounts, replace \"Enter_the_Tenant_Info_Here\" value with common.\r\n * To restrict support to Personal Microsoft accounts only, replace \"Enter_the_Tenant_Info_Here\" value with consumers.\r\n *\r\n * In Azure B2C, authority is of the form https://{instance}/tfp/{tenant}/{policyName}/\r\n * Full B2C functionality will be available in this library in future versions.\r\n *\r\n * @param configuration object for the MSAL PublicClientApplication instance\r\n */\r\n constructor(configuration: Configuration) {\r\n super(configuration);\r\n\r\n this.activeSilentTokenRequests = new Map();\r\n }\r\n\r\n /**\r\n * Use when initiating the login process by redirecting the user's browser to the authorization endpoint. This function redirects the page, so\r\n * any code that follows this function will not execute.\r\n *\r\n * IMPORTANT: It is NOT recommended to have code that is dependent on the resolution of the Promise. This function will navigate away from the current\r\n * browser window. It currently returns a Promise in order to reflect the asynchronous nature of the code running in this function.\r\n *\r\n * @param request\r\n */\r\n async loginRedirect(request?: RedirectRequest): Promise<void> {\r\n this.logger.verbose(\"loginRedirect called\");\r\n return this.acquireTokenRedirect(request || DEFAULT_REQUEST);\r\n }\r\n\r\n /**\r\n * Use when initiating the login process via opening a popup window in the user's browser\r\n *\r\n * @param request\r\n *\r\n * @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.\r\n */\r\n loginPopup(request?: PopupRequest): Promise<AuthenticationResult> {\r\n this.logger.verbose(\"loginPopup called\");\r\n return this.acquireTokenPopup(request || DEFAULT_REQUEST);\r\n }\r\n\r\n /**\r\n * Silently acquire an access token for a given set of scopes. Returns currently processing promise if parallel requests are made.\r\n *\r\n * @param {@link (SilentRequest:type)}\r\n * @returns {Promise.<AuthenticationResult>} - a promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the {@link AuthResponse} object\r\n */\r\n async acquireTokenSilent(request: SilentRequest): Promise<AuthenticationResult> {\r\n this.preflightBrowserEnvironmentCheck(InteractionType.Silent);\r\n this.logger.verbose(\"acquireTokenSilent called\", request.correlationId);\r\n const account = request.account || this.getActiveAccount();\r\n if (!account) {\r\n throw BrowserAuthError.createNoAccountError();\r\n }\r\n const thumbprint: RequestThumbprint = {\r\n clientId: this.config.auth.clientId,\r\n authority: request.authority || \"\",\r\n scopes: request.scopes,\r\n homeAccountIdentifier: account.homeAccountId,\r\n authenticationScheme: request.authenticationScheme,\r\n resourceRequestMethod: request.resourceRequestMethod,\r\n resourceRequestUri: request.resourceRequestUri,\r\n shrClaims: request.shrClaims\r\n };\r\n const silentRequestKey = JSON.stringify(thumbprint);\r\n const cachedResponse = this.activeSilentTokenRequests.get(silentRequestKey);\r\n if (typeof cachedResponse === \"undefined\") {\r\n this.logger.verbose(\"acquireTokenSilent called for the first time, storing active request\", request.correlationId);\r\n const response = this.acquireTokenSilentAsync(request, account)\r\n .then((result) => {\r\n this.activeSilentTokenRequests.delete(silentRequestKey);\r\n return result;\r\n })\r\n .catch((error) => {\r\n this.activeSilentTokenRequests.delete(silentRequestKey);\r\n throw error;\r\n });\r\n this.activeSilentTokenRequests.set(silentRequestKey, response);\r\n return response;\r\n } else {\r\n this.logger.verbose(\"acquireTokenSilent has been called previously, returning the result from the first call\", request.correlationId);\r\n return cachedResponse;\r\n }\r\n }\r\n\r\n /**\r\n * Silently acquire an access token for a given set of scopes. Will use cached token if available, otherwise will attempt to acquire a new token from the network via refresh token.\r\n * @param {@link (SilentRequest:type)}\r\n * @param {@link (AccountInfo:type)}\r\n * @returns {Promise.<AuthenticationResult>} - a promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the {@link AuthResponse} \r\n */\r\n private async acquireTokenSilentAsync(request: SilentRequest, account: AccountInfo): Promise<AuthenticationResult>{\r\n const silentCacheClient = new SilentCacheClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient);\r\n const silentRequest = silentCacheClient.initializeSilentRequest(request, account);\r\n this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_START, InteractionType.Silent, request);\r\n\r\n return silentCacheClient.acquireToken(silentRequest).catch(async () => {\r\n try {\r\n const tokenRenewalResult = await this.acquireTokenByRefreshToken(silentRequest);\r\n this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, InteractionType.Silent, tokenRenewalResult);\r\n return tokenRenewalResult;\r\n } catch (tokenRenewalError) {\r\n this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, InteractionType.Silent, null, tokenRenewalError);\r\n throw tokenRenewalError;\r\n }\r\n });\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;;;;;;AA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B,CAAC,uBAAuB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;gBAClF,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,SAAS,CAAC,mBAAmB,EAAE,eAAe,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBAE5F,sBAAO,iBAAiB,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC,KAAK,CAAC;;;;;;oCAExB,qBAAM,IAAI,CAAC,0BAA0B,CAAC,aAAa,CAAC,EAAA;;oCAAzE,kBAAkB,GAAG,SAAoD;oCAC/E,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,SAAS,CAAC,qBAAqB,EAAE,eAAe,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;oCACzG,sBAAO,kBAAkB,EAAC;;;oCAE1B,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,SAAS,CAAC,qBAAqB,EAAE,eAAe,CAAC,MAAM,EAAE,IAAI,EAAE,mBAAiB,CAAC,CAAC;oCAC9G,MAAM,mBAAiB,CAAC;;;;yBAE/B,CAAC,EAAC;;;KACN;IACL,8BAAC;AAAD,CA5HA,CAA6C,iBAAiB;;;;"}
1
+ {"version":3,"file":"PublicClientApplication.js","sources":["../../src/app/PublicClientApplication.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AccountInfo, AuthenticationResult, RequestThumbprint } from \"@azure/msal-common\";\nimport { Configuration } from \"../config/Configuration\";\nimport { DEFAULT_REQUEST, InteractionType } from \"../utils/BrowserConstants\";\nimport { IPublicClientApplication } from \"./IPublicClientApplication\";\nimport { RedirectRequest } from \"../request/RedirectRequest\";\nimport { PopupRequest } from \"../request/PopupRequest\";\nimport { ClientApplication } from \"./ClientApplication\";\nimport { SilentRequest } from \"../request/SilentRequest\";\nimport { EventType } from \"../event/EventType\";\nimport { BrowserAuthError } from \"../error/BrowserAuthError\";\nimport { SilentCacheClient } from \"../interaction_client/SilentCacheClient\";\n\n/**\n * The PublicClientApplication class is the object exposed by the library to perform authentication and authorization functions in Single Page Applications\n * to obtain JWT tokens as described in the OAuth 2.0 Authorization Code Flow with PKCE specification.\n */\nexport class PublicClientApplication extends ClientApplication implements IPublicClientApplication {\n\n // Active requests\n private activeSilentTokenRequests: Map<string, Promise<AuthenticationResult>>;\n\n /**\n * @constructor\n * Constructor for the PublicClientApplication used to instantiate the PublicClientApplication object\n *\n * Important attributes in the Configuration object for auth are:\n * - clientID: the application ID of your application. You can obtain one by registering your application with our Application registration portal : https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredAppsPreview\n * - authority: the authority URL for your application.\n * - redirect_uri: the uri of your application registered in the portal.\n *\n * In Azure AD, authority is a URL indicating the Azure active directory that MSAL uses to obtain tokens.\n * It is of the form https://login.microsoftonline.com/{Enter_the_Tenant_Info_Here}\n * If your application supports Accounts in one organizational directory, replace \"Enter_the_Tenant_Info_Here\" value with the Tenant Id or Tenant name (for example, contoso.microsoft.com).\n * If your application supports Accounts in any organizational directory, replace \"Enter_the_Tenant_Info_Here\" value with organizations.\n * If your application supports Accounts in any organizational directory and personal Microsoft accounts, replace \"Enter_the_Tenant_Info_Here\" value with common.\n * To restrict support to Personal Microsoft accounts only, replace \"Enter_the_Tenant_Info_Here\" value with consumers.\n *\n * In Azure B2C, authority is of the form https://{instance}/tfp/{tenant}/{policyName}/\n * Full B2C functionality will be available in this library in future versions.\n *\n * @param configuration object for the MSAL PublicClientApplication instance\n */\n constructor(configuration: Configuration) {\n super(configuration);\n\n this.activeSilentTokenRequests = new Map();\n }\n\n /**\n * Use when initiating the login process by redirecting the user's browser to the authorization endpoint. This function redirects the page, so\n * any code that follows this function will not execute.\n *\n * IMPORTANT: It is NOT recommended to have code that is dependent on the resolution of the Promise. This function will navigate away from the current\n * browser window. It currently returns a Promise in order to reflect the asynchronous nature of the code running in this function.\n *\n * @param request\n */\n async loginRedirect(request?: RedirectRequest): Promise<void> {\n this.logger.verbose(\"loginRedirect called\");\n return this.acquireTokenRedirect(request || DEFAULT_REQUEST);\n }\n\n /**\n * Use when initiating the login process via opening a popup window in the user's browser\n *\n * @param request\n *\n * @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.\n */\n loginPopup(request?: PopupRequest): Promise<AuthenticationResult> {\n this.logger.verbose(\"loginPopup called\");\n return this.acquireTokenPopup(request || DEFAULT_REQUEST);\n }\n\n /**\n * Silently acquire an access token for a given set of scopes. Returns currently processing promise if parallel requests are made.\n *\n * @param {@link (SilentRequest:type)}\n * @returns {Promise.<AuthenticationResult>} - a promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the {@link AuthResponse} object\n */\n async acquireTokenSilent(request: SilentRequest): Promise<AuthenticationResult> {\n this.preflightBrowserEnvironmentCheck(InteractionType.Silent);\n this.logger.verbose(\"acquireTokenSilent called\", request.correlationId);\n const account = request.account || this.getActiveAccount();\n if (!account) {\n throw BrowserAuthError.createNoAccountError();\n }\n const thumbprint: RequestThumbprint = {\n clientId: this.config.auth.clientId,\n authority: request.authority || \"\",\n scopes: request.scopes,\n homeAccountIdentifier: account.homeAccountId,\n claims: request.claims,\n authenticationScheme: request.authenticationScheme,\n resourceRequestMethod: request.resourceRequestMethod,\n resourceRequestUri: request.resourceRequestUri,\n shrClaims: request.shrClaims,\n sshKid: request.sshKid\n };\n const silentRequestKey = JSON.stringify(thumbprint);\n const cachedResponse = this.activeSilentTokenRequests.get(silentRequestKey);\n if (typeof cachedResponse === \"undefined\") {\n this.logger.verbose(\"acquireTokenSilent called for the first time, storing active request\", request.correlationId);\n const response = this.acquireTokenSilentAsync(request, account)\n .then((result) => {\n this.activeSilentTokenRequests.delete(silentRequestKey);\n return result;\n })\n .catch((error) => {\n this.activeSilentTokenRequests.delete(silentRequestKey);\n throw error;\n });\n this.activeSilentTokenRequests.set(silentRequestKey, response);\n return response;\n } else {\n this.logger.verbose(\"acquireTokenSilent has been called previously, returning the result from the first call\", request.correlationId);\n return cachedResponse;\n }\n }\n\n /**\n * Silently acquire an access token for a given set of scopes. Will use cached token if available, otherwise will attempt to acquire a new token from the network via refresh token.\n * @param {@link (SilentRequest:type)}\n * @param {@link (AccountInfo:type)}\n * @returns {Promise.<AuthenticationResult>} - a promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the {@link AuthResponse} \n */\n protected async acquireTokenSilentAsync(request: SilentRequest, account: AccountInfo): Promise<AuthenticationResult>{\n const silentCacheClient = new SilentCacheClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, request.correlationId);\n const silentRequest = await silentCacheClient.initializeSilentRequest(request, account);\n this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_START, InteractionType.Silent, request);\n\n return silentCacheClient.acquireToken(silentRequest).catch(async () => {\n try {\n const tokenRenewalResult = await this.acquireTokenByRefreshToken(silentRequest);\n this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, InteractionType.Silent, tokenRenewalResult);\n return tokenRenewalResult;\n } catch (tokenRenewalError) {\n this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, InteractionType.Silent, null, tokenRenewalError);\n throw tokenRenewalError;\n }\n });\n }\n}\n"],"names":[],"mappings":";;;;;;;;;AAAA;;;;AAiBA;;;;;IAI6C,2CAAiB;;;;;;;;;;;;;;;;;;;;;;IA0B1D,iCAAY,aAA4B;QAAxC,YACI,kBAAM,aAAa,CAAC,SAGvB;QADG,KAAI,CAAC,yBAAyB,GAAG,IAAI,GAAG,EAAE,CAAC;;KAC9C;;;;;;;;;;IAWK,+CAAa,GAAnB,UAAoB,OAAyB;;;gBACzC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC;gBAC5C,sBAAO,IAAI,CAAC,oBAAoB,CAAC,OAAO,IAAI,eAAe,CAAC,EAAC;;;KAChE;;;;;;;;IASD,4CAAU,GAAV,UAAW,OAAsB;QAC7B,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC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;4CAC/E,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,SAAS,CAAC,qBAAqB,EAAE,eAAe,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;4CACzG,sBAAO,kBAAkB,EAAC;;;4CAE1B,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,SAAS,CAAC,qBAAqB,EAAE,eAAe,CAAC,MAAM,EAAE,IAAI,EAAE,mBAAiB,CAAC,CAAC;4CAC9G,MAAM,mBAAiB,CAAC;;;;iCAE/B,CAAC,EAAC;;;;KACN;IACL,8BAAC;AAAD,CA9HA,CAA6C,iBAAiB;;;;"}
@@ -0,0 +1,46 @@
1
+ import { Logger } from "@azure/msal-common";
2
+ import { IAsyncStorage } from "./IAsyncMemoryStorage";
3
+ /**
4
+ * This class allows MSAL to store artifacts asynchronously using the DatabaseStorage IndexedDB wrapper,
5
+ * backed up with the more volatile MemoryStorage object for cases in which IndexedDB may be unavailable.
6
+ */
7
+ export declare class AsyncMemoryStorage<T> implements IAsyncStorage<T> {
8
+ private inMemoryCache;
9
+ private indexedDBCache;
10
+ private logger;
11
+ constructor(logger: Logger);
12
+ private handleDatabaseAccessError;
13
+ /**
14
+ * Get the item matching the given key. Tries in-memory cache first, then in the asynchronous
15
+ * storage object if item isn't found in-memory.
16
+ * @param key
17
+ */
18
+ getItem(key: string): Promise<T | null>;
19
+ /**
20
+ * Sets the item in the in-memory cache and then tries to set it in the asynchronous
21
+ * storage object with the given key.
22
+ * @param key
23
+ * @param value
24
+ */
25
+ setItem(key: string, value: T): Promise<void>;
26
+ /**
27
+ * Removes the item matching the key from the in-memory cache, then tries to remove it from the asynchronous storage object.
28
+ * @param key
29
+ */
30
+ removeItem(key: string): Promise<void>;
31
+ /**
32
+ * Get all the keys from the in-memory cache as an iterable array of strings. If no keys are found, query the keys in the
33
+ * asynchronous storage object.
34
+ */
35
+ getKeys(): Promise<string[]>;
36
+ /**
37
+ * Returns true or false if the given key is present in the cache.
38
+ * @param key
39
+ */
40
+ containsKey(key: string): Promise<boolean>;
41
+ /**
42
+ * Clears in-memory Map and tries to delete the IndexedDB database.
43
+ */
44
+ clear(): Promise<void>;
45
+ }
46
+ //# sourceMappingURL=AsyncMemoryStorage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AsyncMemoryStorage.d.ts","sourceRoot":"","sources":["../../src/cache/AsyncMemoryStorage.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAG5C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAGtD;;;GAGG;AACH,qBAAa,kBAAkB,CAAC,CAAC,CAAE,YAAW,aAAa,CAAC,CAAC,CAAC;IAC1D,OAAO,CAAC,aAAa,CAAmB;IACxC,OAAO,CAAC,cAAc,CAAqB;IAC3C,OAAO,CAAC,MAAM,CAAS;gBAEX,MAAM,EAAE,MAAM;IAM1B,OAAO,CAAC,yBAAyB;IAKjC;;;;OAIG;IACG,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAa7C;;;;;OAKG;IACG,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IASnD;;;OAGG;IACG,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAS5C;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAalC;;;OAGG;IACG,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAahD;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAQ/B"}
@@ -0,0 +1,195 @@
1
+ /*! @azure/msal-browser v2.22.0 2022-02-08 */
2
+ 'use strict';
3
+ import { __awaiter, __generator } from '../_virtual/_tslib.js';
4
+ import { BrowserAuthError, BrowserAuthErrorMessage } from '../error/BrowserAuthError.js';
5
+ import { DatabaseStorage } from './DatabaseStorage.js';
6
+ import { MemoryStorage } from './MemoryStorage.js';
7
+
8
+ /*
9
+ * Copyright (c) Microsoft Corporation. All rights reserved.
10
+ * Licensed under the MIT License.
11
+ */
12
+ /**
13
+ * This class allows MSAL to store artifacts asynchronously using the DatabaseStorage IndexedDB wrapper,
14
+ * backed up with the more volatile MemoryStorage object for cases in which IndexedDB may be unavailable.
15
+ */
16
+ var AsyncMemoryStorage = /** @class */ (function () {
17
+ function AsyncMemoryStorage(logger) {
18
+ this.inMemoryCache = new MemoryStorage();
19
+ this.indexedDBCache = new DatabaseStorage();
20
+ this.logger = logger;
21
+ }
22
+ AsyncMemoryStorage.prototype.handleDatabaseAccessError = function (error) {
23
+ if (error instanceof BrowserAuthError && error.errorCode === BrowserAuthErrorMessage.databaseUnavailable.code) {
24
+ this.logger.error("Could not access persistent storage. This may be caused by browser privacy features which block persistent storage in third-party contexts.");
25
+ }
26
+ };
27
+ /**
28
+ * Get the item matching the given key. Tries in-memory cache first, then in the asynchronous
29
+ * storage object if item isn't found in-memory.
30
+ * @param key
31
+ */
32
+ AsyncMemoryStorage.prototype.getItem = function (key) {
33
+ return __awaiter(this, void 0, void 0, function () {
34
+ var item, e_1;
35
+ return __generator(this, function (_a) {
36
+ switch (_a.label) {
37
+ case 0:
38
+ item = this.inMemoryCache.getItem(key);
39
+ if (!!item) return [3 /*break*/, 4];
40
+ _a.label = 1;
41
+ case 1:
42
+ _a.trys.push([1, 3, , 4]);
43
+ this.logger.verbose("Queried item not found in in-memory cache, now querying persistent storage.");
44
+ return [4 /*yield*/, this.indexedDBCache.getItem(key)];
45
+ case 2: return [2 /*return*/, _a.sent()];
46
+ case 3:
47
+ e_1 = _a.sent();
48
+ this.handleDatabaseAccessError(e_1);
49
+ return [3 /*break*/, 4];
50
+ case 4: return [2 /*return*/, item];
51
+ }
52
+ });
53
+ });
54
+ };
55
+ /**
56
+ * Sets the item in the in-memory cache and then tries to set it in the asynchronous
57
+ * storage object with the given key.
58
+ * @param key
59
+ * @param value
60
+ */
61
+ AsyncMemoryStorage.prototype.setItem = function (key, value) {
62
+ return __awaiter(this, void 0, void 0, function () {
63
+ var e_2;
64
+ return __generator(this, function (_a) {
65
+ switch (_a.label) {
66
+ case 0:
67
+ this.inMemoryCache.setItem(key, value);
68
+ _a.label = 1;
69
+ case 1:
70
+ _a.trys.push([1, 3, , 4]);
71
+ return [4 /*yield*/, this.indexedDBCache.setItem(key, value)];
72
+ case 2:
73
+ _a.sent();
74
+ return [3 /*break*/, 4];
75
+ case 3:
76
+ e_2 = _a.sent();
77
+ this.handleDatabaseAccessError(e_2);
78
+ return [3 /*break*/, 4];
79
+ case 4: return [2 /*return*/];
80
+ }
81
+ });
82
+ });
83
+ };
84
+ /**
85
+ * Removes the item matching the key from the in-memory cache, then tries to remove it from the asynchronous storage object.
86
+ * @param key
87
+ */
88
+ AsyncMemoryStorage.prototype.removeItem = function (key) {
89
+ return __awaiter(this, void 0, void 0, function () {
90
+ var e_3;
91
+ return __generator(this, function (_a) {
92
+ switch (_a.label) {
93
+ case 0:
94
+ this.inMemoryCache.removeItem(key);
95
+ _a.label = 1;
96
+ case 1:
97
+ _a.trys.push([1, 3, , 4]);
98
+ return [4 /*yield*/, this.indexedDBCache.removeItem(key)];
99
+ case 2:
100
+ _a.sent();
101
+ return [3 /*break*/, 4];
102
+ case 3:
103
+ e_3 = _a.sent();
104
+ this.handleDatabaseAccessError(e_3);
105
+ return [3 /*break*/, 4];
106
+ case 4: return [2 /*return*/];
107
+ }
108
+ });
109
+ });
110
+ };
111
+ /**
112
+ * Get all the keys from the in-memory cache as an iterable array of strings. If no keys are found, query the keys in the
113
+ * asynchronous storage object.
114
+ */
115
+ AsyncMemoryStorage.prototype.getKeys = function () {
116
+ return __awaiter(this, void 0, void 0, function () {
117
+ var cacheKeys, e_4;
118
+ return __generator(this, function (_a) {
119
+ switch (_a.label) {
120
+ case 0:
121
+ cacheKeys = this.inMemoryCache.getKeys();
122
+ if (!(cacheKeys.length === 0)) return [3 /*break*/, 4];
123
+ _a.label = 1;
124
+ case 1:
125
+ _a.trys.push([1, 3, , 4]);
126
+ this.logger.verbose("In-memory cache is empty, now querying persistent storage.");
127
+ return [4 /*yield*/, this.indexedDBCache.getKeys()];
128
+ case 2: return [2 /*return*/, _a.sent()];
129
+ case 3:
130
+ e_4 = _a.sent();
131
+ this.handleDatabaseAccessError(e_4);
132
+ return [3 /*break*/, 4];
133
+ case 4: return [2 /*return*/, cacheKeys];
134
+ }
135
+ });
136
+ });
137
+ };
138
+ /**
139
+ * Returns true or false if the given key is present in the cache.
140
+ * @param key
141
+ */
142
+ AsyncMemoryStorage.prototype.containsKey = function (key) {
143
+ return __awaiter(this, void 0, void 0, function () {
144
+ var containsKey, e_5;
145
+ return __generator(this, function (_a) {
146
+ switch (_a.label) {
147
+ case 0:
148
+ containsKey = this.inMemoryCache.containsKey(key);
149
+ if (!!containsKey) return [3 /*break*/, 4];
150
+ _a.label = 1;
151
+ case 1:
152
+ _a.trys.push([1, 3, , 4]);
153
+ this.logger.verbose("Key not found in in-memory cache, now querying persistent storage.");
154
+ return [4 /*yield*/, this.indexedDBCache.containsKey(key)];
155
+ case 2: return [2 /*return*/, _a.sent()];
156
+ case 3:
157
+ e_5 = _a.sent();
158
+ this.handleDatabaseAccessError(e_5);
159
+ return [3 /*break*/, 4];
160
+ case 4: return [2 /*return*/, containsKey];
161
+ }
162
+ });
163
+ });
164
+ };
165
+ /**
166
+ * Clears in-memory Map and tries to delete the IndexedDB database.
167
+ */
168
+ AsyncMemoryStorage.prototype.clear = function () {
169
+ return __awaiter(this, void 0, void 0, function () {
170
+ var e_6;
171
+ return __generator(this, function (_a) {
172
+ switch (_a.label) {
173
+ case 0:
174
+ this.inMemoryCache.clear();
175
+ _a.label = 1;
176
+ case 1:
177
+ _a.trys.push([1, 3, , 4]);
178
+ return [4 /*yield*/, this.indexedDBCache.deleteDatabase()];
179
+ case 2:
180
+ _a.sent();
181
+ return [3 /*break*/, 4];
182
+ case 3:
183
+ e_6 = _a.sent();
184
+ this.handleDatabaseAccessError(e_6);
185
+ return [3 /*break*/, 4];
186
+ case 4: return [2 /*return*/];
187
+ }
188
+ });
189
+ });
190
+ };
191
+ return AsyncMemoryStorage;
192
+ }());
193
+
194
+ export { AsyncMemoryStorage };
195
+ //# sourceMappingURL=AsyncMemoryStorage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AsyncMemoryStorage.js","sources":["../../src/cache/AsyncMemoryStorage.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { Logger } from \"@azure/msal-common\";\nimport { BrowserAuthError, BrowserAuthErrorMessage } from \"../error/BrowserAuthError\";\nimport { DatabaseStorage } from \"./DatabaseStorage\";\nimport { IAsyncStorage } from \"./IAsyncMemoryStorage\";\nimport { MemoryStorage } from \"./MemoryStorage\";\n\n/**\n * This class allows MSAL to store artifacts asynchronously using the DatabaseStorage IndexedDB wrapper,\n * backed up with the more volatile MemoryStorage object for cases in which IndexedDB may be unavailable.\n */\nexport class AsyncMemoryStorage<T> implements IAsyncStorage<T> {\n private inMemoryCache: MemoryStorage<T>;\n private indexedDBCache: DatabaseStorage<T>;\n private logger: Logger;\n\n constructor(logger: Logger) {\n this.inMemoryCache = new MemoryStorage<T>();\n this.indexedDBCache = new DatabaseStorage<T>();\n this.logger = logger;\n }\n\n private handleDatabaseAccessError(error: unknown): void {\n if (error instanceof BrowserAuthError && error.errorCode === BrowserAuthErrorMessage.databaseUnavailable.code) {\n this.logger.error(\"Could not access persistent storage. This may be caused by browser privacy features which block persistent storage in third-party contexts.\");\n }\n }\n /**\n * Get the item matching the given key. Tries in-memory cache first, then in the asynchronous\n * storage object if item isn't found in-memory.\n * @param key \n */\n async getItem(key: string): Promise<T | null> {\n const item = this.inMemoryCache.getItem(key);\n if(!item) {\n try {\n this.logger.verbose(\"Queried item not found in in-memory cache, now querying persistent storage.\");\n return await this.indexedDBCache.getItem(key);\n } catch (e) {\n this.handleDatabaseAccessError(e);\n }\n }\n return item;\n }\n\n /**\n * Sets the item in the in-memory cache and then tries to set it in the asynchronous\n * storage object with the given key.\n * @param key \n * @param value \n */\n async setItem(key: string, value: T): Promise<void> {\n this.inMemoryCache.setItem(key, value);\n try {\n await this.indexedDBCache.setItem(key, value);\n } catch (e) {\n this.handleDatabaseAccessError(e);\n }\n }\n\n /**\n * Removes the item matching the key from the in-memory cache, then tries to remove it from the asynchronous storage object.\n * @param key \n */\n async removeItem(key: string): Promise<void> {\n this.inMemoryCache.removeItem(key);\n try {\n await this.indexedDBCache.removeItem(key);\n } catch (e) {\n this.handleDatabaseAccessError(e);\n }\n }\n\n /**\n * Get all the keys from the in-memory cache as an iterable array of strings. If no keys are found, query the keys in the \n * asynchronous storage object.\n */\n async getKeys(): Promise<string[]> {\n const cacheKeys = this.inMemoryCache.getKeys();\n if (cacheKeys.length === 0) {\n try {\n this.logger.verbose(\"In-memory cache is empty, now querying persistent storage.\");\n return await this.indexedDBCache.getKeys();\n } catch (e) {\n this.handleDatabaseAccessError(e);\n }\n }\n return cacheKeys;\n }\n\n /**\n * Returns true or false if the given key is present in the cache.\n * @param key \n */\n async containsKey(key: string): Promise<boolean> {\n const containsKey = this.inMemoryCache.containsKey(key);\n if(!containsKey) {\n try {\n this.logger.verbose(\"Key not found in in-memory cache, now querying persistent storage.\");\n return await this.indexedDBCache.containsKey(key);\n } catch (e) {\n this.handleDatabaseAccessError(e);\n }\n }\n return containsKey;\n }\n\n /**\n * Clears in-memory Map and tries to delete the IndexedDB database.\n */\n async clear(): Promise<void> {\n this.inMemoryCache.clear();\n try {\n await this.indexedDBCache.deleteDatabase();\n } catch (e) {\n this.handleDatabaseAccessError(e);\n }\n }\n}\n"],"names":[],"mappings":";;;;;;;AAAA;;;;AAWA;;;;;IASI,4BAAY,MAAc;QACtB,IAAI,CAAC,aAAa,GAAG,IAAI,aAAa,EAAK,CAAC;QAC5C,IAAI,C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MetadataEntity, CacheManager, ServerTelemetryEntity, ThrottlingEntity, Logger, AuthorityMetadataEntity, AccountInfo } from "@azure/msal-common";
1
+ import { CommonAuthorizationCodeRequest, ICrypto, AccountEntity, IdTokenEntity, AccessTokenEntity, RefreshTokenEntity, AppMetadataEntity, CacheManager, ServerTelemetryEntity, ThrottlingEntity, Logger, AuthorityMetadataEntity, AccountInfo, ValidCredentialType } from "@azure/msal-common";
2
2
  import { CacheOptions } from "../config/Configuration";
3
- import { InteractionType } from "../utils/BrowserConstants";
3
+ import { BrowserCacheLocation, InteractionType } from "../utils/BrowserConstants";
4
+ import { MemoryStorage } from "./MemoryStorage";
5
+ import { IWindowStorage } from "./IWindowStorage";
4
6
  /**
5
7
  * This class implements the cache storage interface for MSAL through browser local or session storage.
6
8
  * Cookies are only used if storeAuthStateInCookie is true, and are only used for
7
9
  * parameters such as state and nonce, generally.
8
10
  */
9
11
  export declare class BrowserCacheManager extends CacheManager {
10
- private cacheConfig;
11
- private browserStorage;
12
- private internalStorage;
13
- private temporaryCacheStorage;
14
- private logger;
15
- private readonly COOKIE_LIFE_MULTIPLIER;
12
+ protected cacheConfig: Required<CacheOptions>;
13
+ protected browserStorage: IWindowStorage<string>;
14
+ protected internalStorage: MemoryStorage<string>;
15
+ protected temporaryCacheStorage: IWindowStorage<string>;
16
+ protected logger: Logger;
17
+ protected readonly COOKIE_LIFE_MULTIPLIER: number;
16
18
  constructor(clientId: string, cacheConfig: Required<CacheOptions>, cryptoImpl: ICrypto, logger: Logger);
17
19
  /**
18
20
  * Returns a window storage class implementing the IWindowStorage interface that corresponds to the configured cacheLocation.
19
21
  * @param cacheLocation
20
22
  */
21
- private setupBrowserStorage;
23
+ protected setupBrowserStorage(cacheLocation: BrowserCacheLocation | string): IWindowStorage<string>;
22
24
  /**
23
25
  *
24
26
  * @param cacheLocation
25
27
  */
26
- private setupTemporaryCacheStorage;
28
+ protected setupTemporaryCacheStorage(cacheLocation: BrowserCacheLocation | string): IWindowStorage<string>;
27
29
  /**
28
30
  * Migrate all old cache entries to new schema. No rollback supported.
29
31
  * @param storeAuthStateInCookie
30
32
  */
31
- private migrateCacheEntries;
33
+ protected migrateCacheEntries(): void;
32
34
  /**
33
35
  * Utility function to help with migration.
34
36
  * @param newKey
35
37
  * @param value
36
38
  * @param storeAuthStateInCookie
37
39
  */
38
- private migrateCacheEntry;
40
+ protected migrateCacheEntry(newKey: string, value: string | null): void;
39
41
  /**
40
42
  * Parses passed value as JSON object, JSON.parse() will throw an error.
41
43
  * @param input
42
44
  */
43
- private validateAndParseJson;
45
+ protected validateAndParseJson(jsonValue: string): object | null;
44
46
  /**
45
47
  * fetches the entry from the browser storage based off the key
46
48
  * @param key
@@ -288,6 +290,10 @@ export declare class BrowserCacheManager extends CacheManager {
288
290
  * Returns username retrieved from ADAL or MSAL v1 idToken
289
291
  */
290
292
  getLegacyLoginHint(): string | null;
293
+ /**
294
+ * Updates a credential's cache key if the current cache key is outdated
295
+ */
296
+ updateCredentialCacheKey(currentCacheKey: string, credential: ValidCredentialType): string;
291
297
  }
292
298
  export declare const DEFAULT_BROWSER_CACHE_MANAGER: (clientId: string, logger: Logger) => BrowserCacheManager;
293
299
  //# sourceMappingURL=BrowserCacheManager.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BrowserCacheManager.d.ts","sourceRoot":"","sources":["../../src/cache/BrowserCacheManager.ts"],"names":[],"mappings":"AAKA,OAAO,EAA+C,8BAA8B,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,YAAY,EAAE,qBAAqB,EAAE,gBAAgB,EAAiB,MAAM,EAAE,uBAAuB,EAAiC,WAAW,EAA6C,MAAM,oBAAoB,CAAC;AAChZ,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,OAAO,EAAwB,eAAe,EAAyC,MAAM,2BAA2B,CAAC;AAMzH;;;;GAIG;AACH,qBAAa,mBAAoB,SAAQ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AEG;IACH,wBAAwB,CAAC,eAAe,EAAE,MAAM,EAAE,UAAU,EAAE,mBAAmB,GAAG,MAAM;CAiB7F;AAED,eAAO,MAAM,6BAA6B,aAAc,MAAM,UAAU,MAAM,KAAG,mBAOhF,CAAC"}
@@ -1,7 +1,7 @@
1
- /*! @azure/msal-browser v2.18.0 2021-10-05 */
1
+ /*! @azure/msal-browser v2.22.0 2022-02-08 */
2
2
  'use strict';
3
3
  import { __extends, __spread, __awaiter, __generator } from '../_virtual/_tslib.js';
4
- import { DEFAULT_CRYPTO_IMPLEMENTATION, AccountEntity, CacheManager, IdTokenEntity, AccessTokenEntity, RefreshTokenEntity, AppMetadataEntity, ServerTelemetryEntity, AuthorityMetadataEntity, PersistentCacheKeys, ThrottlingEntity, Constants, StringUtils, ProtocolUtils, CcsCredentialType, IdToken } from '@azure/msal-common';
4
+ import { AccountEntity, CacheManager, IdTokenEntity, AccessTokenEntity, RefreshTokenEntity, AppMetadataEntity, ServerTelemetryEntity, AuthorityMetadataEntity, PersistentCacheKeys, ThrottlingEntity, StringUtils, Constants, ProtocolUtils, CcsCredentialType, IdToken, DEFAULT_CRYPTO_IMPLEMENTATION } from '@azure/msal-common';
5
5
  import { BrowserAuthError } from '../error/BrowserAuthError.js';
6
6
  import { BrowserCacheLocation, InMemoryCacheKeys, TemporaryCacheKeys } from '../utils/BrowserConstants.js';
7
7
  import { BrowserStorage } from './BrowserStorage.js';
@@ -759,6 +759,7 @@ var BrowserCacheManager = /** @class */ (function (_super) {
759
759
  }
760
760
  });
761
761
  this.clearMsalCookies();
762
+ this.setInteractionInProgress(false);
762
763
  };
763
764
  BrowserCacheManager.prototype.cacheCodeRequest = function (authCodeRequest, browserCrypto) {
764
765
  this.logger.trace("BrowserCacheManager.cacheCodeRequest called");
@@ -805,14 +806,18 @@ var BrowserCacheManager = /** @class */ (function (_super) {
805
806
  return this.getTemporaryCache(key, false);
806
807
  };
807
808
  BrowserCacheManager.prototype.setInteractionInProgress = function (inProgress) {
808
- var clientId = this.getInteractionInProgress();
809
809
  // Ensure we don't overwrite interaction in progress for a different clientId
810
810
  var key = Constants.CACHE_PREFIX + "." + TemporaryCacheKeys.INTERACTION_STATUS_KEY;
811
- if (inProgress && !clientId) {
812
- // No interaction is in progress
813
- this.setTemporaryCache(key, this.clientId, false);
811
+ if (inProgress) {
812
+ if (this.getInteractionInProgress()) {
813
+ throw BrowserAuthError.createInteractionInProgressError();
814
+ }
815
+ else {
816
+ // No interaction is in progress
817
+ this.setTemporaryCache(key, this.clientId, false);
818
+ }
814
819
  }
815
- else if (!inProgress && clientId === this.clientId) {
820
+ else if (!inProgress && this.getInteractionInProgress() === this.clientId) {
816
821
  this.removeItem(key);
817
822
  }
818
823
  };
@@ -849,6 +854,25 @@ var BrowserCacheManager = /** @class */ (function (_super) {
849
854
  }
850
855
  return null;
851
856
  };
857
+ /**
858
+ * Updates a credential's cache key if the current cache key is outdated
859
+ */
860
+ BrowserCacheManager.prototype.updateCredentialCacheKey = function (currentCacheKey, credential) {
861
+ var updatedCacheKey = credential.generateCredentialKey();
862
+ if (currentCacheKey !== updatedCacheKey) {
863
+ var cacheItem = this.getItem(currentCacheKey);
864
+ if (cacheItem) {
865
+ this.removeItem(currentCacheKey);
866
+ this.setItem(updatedCacheKey, cacheItem);
867
+ this.logger.verbose("Updated an outdated " + credential.credentialType + " cache key");
868
+ return updatedCacheKey;
869
+ }
870
+ else {
871
+ this.logger.error("Attempted to update an outdated " + credential.credentialType + " cache key but no item matching the outdated key was found in storage");
872
+ }
873
+ }
874
+ return currentCacheKey;
875
+ };
852
876
  return BrowserCacheManager;
853
877
  }(CacheManager));
854
878
  var DEFAULT_BROWSER_CACHE_MANAGER = function (clientId, logger) {