@azure/msal-browser 2.16.1 → 2.20.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 (163) hide show
  1. package/CHANGELOG.json +283 -0
  2. package/{changelog.md → CHANGELOG.md} +73 -1
  3. package/README.md +12 -4
  4. package/dist/_virtual/_tslib.js +1 -1
  5. package/dist/app/ClientApplication.d.ts +35 -137
  6. package/dist/app/ClientApplication.d.ts.map +1 -1
  7. package/dist/app/ClientApplication.js +178 -883
  8. package/dist/app/ClientApplication.js.map +1 -1
  9. package/dist/app/IPublicClientApplication.d.ts +8 -0
  10. package/dist/app/IPublicClientApplication.d.ts.map +1 -1
  11. package/dist/app/IPublicClientApplication.js +16 -1
  12. package/dist/app/IPublicClientApplication.js.map +1 -1
  13. package/dist/app/PublicClientApplication.d.ts.map +1 -1
  14. package/dist/app/PublicClientApplication.js +35 -41
  15. package/dist/app/PublicClientApplication.js.map +1 -1
  16. package/dist/cache/AsyncMemoryStorage.d.ts +46 -0
  17. package/dist/cache/AsyncMemoryStorage.d.ts.map +1 -0
  18. package/dist/cache/AsyncMemoryStorage.js +195 -0
  19. package/dist/cache/AsyncMemoryStorage.js.map +1 -0
  20. package/dist/cache/BrowserCacheManager.d.ts +19 -2
  21. package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
  22. package/dist/cache/BrowserCacheManager.js +104 -15
  23. package/dist/cache/BrowserCacheManager.js.map +1 -1
  24. package/dist/cache/BrowserStorage.d.ts +1 -1
  25. package/dist/cache/BrowserStorage.d.ts.map +1 -1
  26. package/dist/cache/BrowserStorage.js +1 -1
  27. package/dist/cache/BrowserStorage.js.map +1 -1
  28. package/dist/cache/DatabaseStorage.d.ts +29 -4
  29. package/dist/cache/DatabaseStorage.d.ts.map +1 -1
  30. package/dist/cache/DatabaseStorage.js +151 -45
  31. package/dist/cache/DatabaseStorage.js.map +1 -1
  32. package/dist/cache/IAsyncMemoryStorage.d.ts +28 -0
  33. package/dist/cache/IAsyncMemoryStorage.d.ts.map +1 -0
  34. package/dist/cache/ITokenCache.d.ts +8 -0
  35. package/dist/cache/ITokenCache.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 +48 -0
  43. package/dist/cache/TokenCache.d.ts.map +1 -0
  44. package/dist/cache/TokenCache.js +124 -0
  45. package/dist/cache/TokenCache.js.map +1 -0
  46. package/dist/config/Configuration.js +1 -1
  47. package/dist/crypto/BrowserCrypto.d.ts +3 -1
  48. package/dist/crypto/BrowserCrypto.d.ts.map +1 -1
  49. package/dist/crypto/BrowserCrypto.js +3 -2
  50. package/dist/crypto/BrowserCrypto.js.map +1 -1
  51. package/dist/crypto/CryptoOps.d.ts +21 -6
  52. package/dist/crypto/CryptoOps.d.ts.map +1 -1
  53. package/dist/crypto/CryptoOps.js +67 -15
  54. package/dist/crypto/CryptoOps.js.map +1 -1
  55. package/dist/crypto/GuidGenerator.js +1 -1
  56. package/dist/crypto/PkceGenerator.js +1 -1
  57. package/dist/crypto/SignedHttpRequest.d.ts +31 -0
  58. package/dist/crypto/SignedHttpRequest.d.ts.map +1 -0
  59. package/dist/crypto/SignedHttpRequest.js +70 -0
  60. package/dist/crypto/SignedHttpRequest.js.map +1 -0
  61. package/dist/encode/Base64Decode.js +1 -1
  62. package/dist/encode/Base64Encode.js +1 -1
  63. package/dist/error/BrowserAuthError.d.ts +36 -4
  64. package/dist/error/BrowserAuthError.d.ts.map +1 -1
  65. package/dist/error/BrowserAuthError.js +51 -11
  66. package/dist/error/BrowserAuthError.js.map +1 -1
  67. package/dist/error/BrowserConfigurationAuthError.js +1 -1
  68. package/dist/event/EventHandler.d.ts +13 -0
  69. package/dist/event/EventHandler.d.ts.map +1 -1
  70. package/dist/event/EventHandler.js +66 -1
  71. package/dist/event/EventHandler.js.map +1 -1
  72. package/dist/event/EventMessage.d.ts +4 -3
  73. package/dist/event/EventMessage.d.ts.map +1 -1
  74. package/dist/event/EventMessage.js +24 -5
  75. package/dist/event/EventMessage.js.map +1 -1
  76. package/dist/event/EventType.d.ts +5 -0
  77. package/dist/event/EventType.d.ts.map +1 -1
  78. package/dist/event/EventType.js +6 -1
  79. package/dist/event/EventType.js.map +1 -1
  80. package/dist/index.cjs.js +4678 -2996
  81. package/dist/index.cjs.js.map +1 -1
  82. package/dist/index.d.ts +6 -2
  83. package/dist/index.d.ts.map +1 -1
  84. package/dist/index.js +4 -2
  85. package/dist/index.js.map +1 -1
  86. package/dist/interaction_client/BaseInteractionClient.d.ts +42 -0
  87. package/dist/interaction_client/BaseInteractionClient.d.ts.map +1 -0
  88. package/dist/interaction_client/BaseInteractionClient.js +131 -0
  89. package/dist/interaction_client/BaseInteractionClient.js.map +1 -0
  90. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.d.ts +5 -0
  91. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.d.ts.map +1 -0
  92. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.js +21 -0
  93. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.js.map +1 -0
  94. package/dist/interaction_client/PopupClient.d.ts +37 -0
  95. package/dist/interaction_client/PopupClient.d.ts.map +1 -0
  96. package/dist/interaction_client/PopupClient.js +234 -0
  97. package/dist/interaction_client/PopupClient.js.map +1 -0
  98. package/dist/interaction_client/RedirectClient.d.ts +42 -0
  99. package/dist/interaction_client/RedirectClient.d.ts.map +1 -0
  100. package/dist/interaction_client/RedirectClient.js +301 -0
  101. package/dist/interaction_client/RedirectClient.js.map +1 -0
  102. package/dist/interaction_client/SilentAuthCodeClient.d.ts +22 -0
  103. package/dist/interaction_client/SilentAuthCodeClient.d.ts.map +1 -0
  104. package/dist/interaction_client/SilentAuthCodeClient.js +80 -0
  105. package/dist/interaction_client/SilentAuthCodeClient.js.map +1 -0
  106. package/dist/interaction_client/SilentCacheClient.d.ts +22 -0
  107. package/dist/interaction_client/SilentCacheClient.d.ts.map +1 -0
  108. package/dist/interaction_client/SilentCacheClient.js +85 -0
  109. package/dist/interaction_client/SilentCacheClient.js.map +1 -0
  110. package/dist/interaction_client/SilentIframeClient.d.ts +29 -0
  111. package/dist/interaction_client/SilentIframeClient.d.ts.map +1 -0
  112. package/dist/interaction_client/SilentIframeClient.js +107 -0
  113. package/dist/interaction_client/SilentIframeClient.js.map +1 -0
  114. package/dist/interaction_client/SilentRefreshClient.d.ts +20 -0
  115. package/dist/interaction_client/SilentRefreshClient.d.ts.map +1 -0
  116. package/dist/interaction_client/SilentRefreshClient.js +76 -0
  117. package/dist/interaction_client/SilentRefreshClient.js.map +1 -0
  118. package/dist/interaction_client/StandardInteractionClient.d.ts +66 -0
  119. package/dist/interaction_client/StandardInteractionClient.d.ts.map +1 -0
  120. package/dist/interaction_client/StandardInteractionClient.js +249 -0
  121. package/dist/interaction_client/StandardInteractionClient.js.map +1 -0
  122. package/dist/interaction_handler/InteractionHandler.d.ts +11 -2
  123. package/dist/interaction_handler/InteractionHandler.d.ts.map +1 -1
  124. package/dist/interaction_handler/InteractionHandler.js +36 -10
  125. package/dist/interaction_handler/InteractionHandler.js.map +1 -1
  126. package/dist/interaction_handler/PopupHandler.d.ts +2 -0
  127. package/dist/interaction_handler/PopupHandler.d.ts.map +1 -1
  128. package/dist/interaction_handler/PopupHandler.js +3 -4
  129. package/dist/interaction_handler/PopupHandler.js.map +1 -1
  130. package/dist/interaction_handler/RedirectHandler.d.ts +1 -1
  131. package/dist/interaction_handler/RedirectHandler.d.ts.map +1 -1
  132. package/dist/interaction_handler/RedirectHandler.js +7 -6
  133. package/dist/interaction_handler/RedirectHandler.js.map +1 -1
  134. package/dist/interaction_handler/SilentHandler.js +1 -1
  135. package/dist/navigation/NavigationClient.js +1 -1
  136. package/dist/network/FetchClient.js +1 -1
  137. package/dist/network/XhrClient.js +1 -1
  138. package/dist/packageMetadata.d.ts +1 -1
  139. package/dist/packageMetadata.js +2 -2
  140. package/dist/packageMetadata.js.map +1 -1
  141. package/dist/request/AuthorizationCodeRequest.d.ts +8 -0
  142. package/dist/request/AuthorizationCodeRequest.d.ts.map +1 -0
  143. package/dist/request/EndSessionPopupRequest.d.ts +3 -0
  144. package/dist/request/EndSessionPopupRequest.d.ts.map +1 -1
  145. package/dist/request/PopupRequest.d.ts +3 -0
  146. package/dist/request/PopupRequest.d.ts.map +1 -1
  147. package/dist/request/RedirectRequest.d.ts.map +1 -1
  148. package/dist/utils/BrowserConstants.d.ts +13 -1
  149. package/dist/utils/BrowserConstants.d.ts.map +1 -1
  150. package/dist/utils/BrowserConstants.js +17 -3
  151. package/dist/utils/BrowserConstants.js.map +1 -1
  152. package/dist/utils/BrowserProtocolUtils.js +1 -1
  153. package/dist/utils/BrowserStringUtils.js +1 -1
  154. package/dist/utils/BrowserUtils.js +1 -1
  155. package/dist/utils/MathUtils.js +1 -1
  156. package/dist/utils/PopupUtils.d.ts +26 -2
  157. package/dist/utils/PopupUtils.d.ts.map +1 -1
  158. package/dist/utils/PopupUtils.js +42 -15
  159. package/dist/utils/PopupUtils.js.map +1 -1
  160. package/lib/msal-browser.js +4678 -2996
  161. package/lib/msal-browser.js.map +1 -1
  162. package/lib/msal-browser.min.js +32 -32
  163. package/package.json +9 -2
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  * @module @azure/msal-browser
4
4
  */
5
5
  export { PublicClientApplication } from "./app/PublicClientApplication";
6
- export { Configuration, BrowserAuthOptions, CacheOptions, BrowserSystemOptions } from "./config/Configuration";
6
+ export { Configuration, BrowserAuthOptions, CacheOptions, BrowserSystemOptions, BrowserConfiguration } from "./config/Configuration";
7
7
  export { InteractionType, InteractionStatus, BrowserCacheLocation, WrapperSKU, ApiId } from "./utils/BrowserConstants";
8
8
  export { BrowserUtils } from "./utils/BrowserUtils";
9
9
  export { BrowserAuthError, BrowserAuthErrorMessage } from "./error/BrowserAuthError";
@@ -19,7 +19,11 @@ export { SsoSilentRequest } from "./request/SsoSilentRequest";
19
19
  export { EndSessionRequest } from "./request/EndSessionRequest";
20
20
  export { EndSessionPopupRequest } from "./request/EndSessionPopupRequest";
21
21
  export { AuthorizationUrlRequest } from "./request/AuthorizationUrlRequest";
22
+ export { AuthorizationCodeRequest } from "./request/AuthorizationCodeRequest";
23
+ export { LoadTokenOptions } from "./cache/TokenCache";
22
24
  export { EventMessage, EventPayload, EventError, EventCallbackFunction, EventMessageUtils, PopupEvent } from "./event/EventMessage";
23
25
  export { EventType } from "./event/EventType";
24
- export { AuthenticationScheme, AccountInfo, AccountEntity, AuthenticationResult, InteractionRequiredAuthError, AuthError, AuthErrorMessage, INetworkModule, NetworkResponse, NetworkRequestOptions, ILoggerCallback, Logger, LogLevel, ProtocolMode, StringUtils, UrlString } from "@azure/msal-common";
26
+ export { SignedHttpRequest, SignedHttpRequestOptions } from "./crypto/SignedHttpRequest";
27
+ export { AuthenticationScheme, AccountInfo, AccountEntity, AuthenticationResult, AuthError, AuthErrorMessage, ClientAuthError, ClientAuthErrorMessage, ClientConfigurationError, ClientConfigurationErrorMessage, InteractionRequiredAuthError, InteractionRequiredAuthErrorMessage, ServerError, INetworkModule, NetworkResponse, NetworkRequestOptions, ILoggerCallback, Logger, LogLevel, ProtocolMode, ExternalTokenResponse, StringUtils, UrlString, AuthenticationHeaderParser } from "@azure/msal-common";
28
+ export { version } from "./packageMetadata";
25
29
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA;;;GAGG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,wBAAw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AAM,oCAAoC,CAAC;AAE9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACpI,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,OAAO,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAGzF,OAAO,EACH,oBAAoB,EAEpB,WAAW,EACX,aAAa,EAEb,oBAAoB,EAEpB,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,sBAAsB,EACtB,wBAAwB,EACxB,+BAA+B,EAC/B,4BAA4B,EAC5B,mCAAmC,EACnC,WAAW,EAEX,cAAc,EACd,eAAe,EACf,qBAAqB,EAErB,eAAe,EACf,MAAM,EACN,QAAQ,EAER,YAAY,EAEZ,qBAAqB,EAErB,WAAW,EACX,SAAS,EACT,0BAA0B,EAC7B,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-browser v2.16.1 2021-08-02 */
1
+ /*! @azure/msal-browser v2.20.0 2021-12-07 */
2
2
  'use strict';
3
3
  export { PublicClientApplication } from './app/PublicClientApplication.js';
4
4
  export { ApiId, BrowserCacheLocation, InteractionStatus, InteractionType, WrapperSKU } from './utils/BrowserConstants.js';
@@ -9,5 +9,7 @@ export { stubbedPublicClientApplication } from './app/IPublicClientApplication.j
9
9
  export { NavigationClient } from './navigation/NavigationClient.js';
10
10
  export { EventMessageUtils } from './event/EventMessage.js';
11
11
  export { EventType } from './event/EventType.js';
12
- export { AccountEntity, AuthError, AuthErrorMessage, AuthenticationScheme, InteractionRequiredAuthError, LogLevel, Logger, ProtocolMode, StringUtils, UrlString } from '@azure/msal-common';
12
+ export { SignedHttpRequest } from './crypto/SignedHttpRequest.js';
13
+ export { AccountEntity, AuthError, AuthErrorMessage, AuthenticationHeaderParser, AuthenticationScheme, ClientAuthError, ClientAuthErrorMessage, ClientConfigurationError, ClientConfigurationErrorMessage, InteractionRequiredAuthError, InteractionRequiredAuthErrorMessage, LogLevel, Logger, ProtocolMode, ServerError, StringUtils, UrlString } from '@azure/msal-common';
14
+ export { version } from './packageMetadata.js';
13
15
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
@@ -0,0 +1,42 @@
1
+ import { ICrypto, INetworkModule, Logger, AuthenticationResult, AccountInfo, BaseAuthRequest, ServerTelemetryManager } from "@azure/msal-common";
2
+ import { BrowserConfiguration } from "../config/Configuration";
3
+ import { BrowserCacheManager } from "../cache/BrowserCacheManager";
4
+ import { EventHandler } from "../event/EventHandler";
5
+ import { EndSessionRequest } from "../request/EndSessionRequest";
6
+ import { RedirectRequest } from "../request/RedirectRequest";
7
+ import { PopupRequest } from "../request/PopupRequest";
8
+ import { SsoSilentRequest } from "../request/SsoSilentRequest";
9
+ export declare abstract class BaseInteractionClient {
10
+ protected config: BrowserConfiguration;
11
+ protected browserStorage: BrowserCacheManager;
12
+ protected browserCrypto: ICrypto;
13
+ protected networkClient: INetworkModule;
14
+ protected logger: Logger;
15
+ protected eventHandler: EventHandler;
16
+ protected correlationId: string;
17
+ constructor(config: BrowserConfiguration, storageImpl: BrowserCacheManager, browserCrypto: ICrypto, logger: Logger, eventHandler: EventHandler, correlationId?: string);
18
+ abstract acquireToken(request: RedirectRequest | PopupRequest | SsoSilentRequest): Promise<AuthenticationResult | void>;
19
+ abstract logout(request: EndSessionRequest): Promise<void>;
20
+ protected clearCacheOnLogout(account?: AccountInfo | null): Promise<void>;
21
+ /**
22
+ * Initializer function for all request APIs
23
+ * @param request
24
+ */
25
+ protected initializeBaseRequest(request: Partial<BaseAuthRequest>): BaseAuthRequest;
26
+ /**
27
+ *
28
+ * Use to get the redirect uri configured in MSAL or null.
29
+ * @param requestRedirectUri
30
+ * @returns Redirect URL
31
+ *
32
+ */
33
+ protected getRedirectUri(requestRedirectUri?: string): string;
34
+ /**
35
+ *
36
+ * @param apiId
37
+ * @param correlationId
38
+ * @param forceRefresh
39
+ */
40
+ protected initializeServerTelemetryManager(apiId: number, forceRefresh?: boolean): ServerTelemetryManager;
41
+ }
42
+ //# sourceMappingURL=BaseInteractionClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseInteractionClient.d.ts","sourceRoot":"","sources":["../../src/interaction_client/BaseInteractionClient.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,oBAAoB,EAAE,WAAW,EAAiB,eAAe,EAAmC,sBAAsB,EAAoD,MAAM,oBAAoB,CAAC;AACnP,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAK/D,8BAAsB,qBAAqB;IAEvC,SAAS,CAAC,MAAM,EAAE,oBAAoB,CAAC;IACvC,SAAS,CAAC,cAAc,EAAE,mBAAmB,CAAC;IAC9C,SAAS,CAAC,aAAa,EAAE,OAAO,CAAC;IACjC,SAAS,CAAC,aAAa,EAAE,cAAc,CAAC;IACxC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,YAAY,EAAE,YAAY,CAAC;IACrC,SAAS,CAAC,aAAa,EAAE,MAAM,CAAC;gBAEpB,MAAM,EAAE,oBAAoB,EAAE,WAAW,EAAE,mBAAmB,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,CAAC,EAAE,MAAM;IAUtK,QAAQ,CAAC,YAAY,CAAC,OAAO,EAAE,eAAe,GAAC,YAAY,GAAC,gBAAgB,GAAG,OAAO,CAAC,oBAAoB,GAAC,IAAI,CAAC;IAEjH,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;cAE1C,kBAAkB,CAAC,OAAO,CAAC,EAAE,WAAW,GAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IA0B9E;;;OAGG;IACH,SAAS,CAAC,qBAAqB,CAAC,OAAO,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe;IAgCnF;;;;;;OAMG;IACH,SAAS,CAAC,cAAc,CAAC,kBAAkB,CAAC,EAAE,MAAM,GAAG,MAAM;IAM7D;;;;;OAKG;IACH,SAAS,CAAC,gCAAgC,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,OAAO,GAAG,sBAAsB;CAa5G"}
@@ -0,0 +1,131 @@
1
+ /*! @azure/msal-browser v2.20.0 2021-12-07 */
2
+ 'use strict';
3
+ import { __awaiter, __generator, __spread, __assign } from '../_virtual/_tslib.js';
4
+ import { AccountEntity, AuthenticationScheme, ClientConfigurationError, UrlString, ServerTelemetryManager } from '@azure/msal-common';
5
+ import { version } from '../packageMetadata.js';
6
+ import { BrowserConstants } from '../utils/BrowserConstants.js';
7
+ import { BrowserUtils } from '../utils/BrowserUtils.js';
8
+
9
+ /*
10
+ * Copyright (c) Microsoft Corporation. All rights reserved.
11
+ * Licensed under the MIT License.
12
+ */
13
+ var BaseInteractionClient = /** @class */ (function () {
14
+ function BaseInteractionClient(config, storageImpl, browserCrypto, logger, eventHandler, correlationId) {
15
+ this.config = config;
16
+ this.browserStorage = storageImpl;
17
+ this.browserCrypto = browserCrypto;
18
+ this.networkClient = this.config.system.networkClient;
19
+ this.eventHandler = eventHandler;
20
+ this.correlationId = correlationId || this.browserCrypto.createNewGuid();
21
+ this.logger = logger.clone(BrowserConstants.MSAL_SKU, version, this.correlationId);
22
+ }
23
+ BaseInteractionClient.prototype.clearCacheOnLogout = function (account) {
24
+ return __awaiter(this, void 0, void 0, function () {
25
+ return __generator(this, function (_a) {
26
+ switch (_a.label) {
27
+ case 0:
28
+ if (!account) return [3 /*break*/, 5];
29
+ if (AccountEntity.accountInfoIsEqual(account, this.browserStorage.getActiveAccount(), false)) {
30
+ this.logger.verbose("Setting active account to null");
31
+ this.browserStorage.setActiveAccount(null);
32
+ }
33
+ _a.label = 1;
34
+ case 1:
35
+ _a.trys.push([1, 3, , 4]);
36
+ return [4 /*yield*/, this.browserStorage.removeAccount(AccountEntity.generateAccountCacheKey(account))];
37
+ case 2:
38
+ _a.sent();
39
+ this.logger.verbose("Cleared cache items belonging to the account provided in the logout request.");
40
+ return [3 /*break*/, 4];
41
+ case 3:
42
+ _a.sent();
43
+ this.logger.error("Account provided in logout request was not found. Local cache unchanged.");
44
+ return [3 /*break*/, 4];
45
+ case 4: return [3 /*break*/, 9];
46
+ case 5:
47
+ _a.trys.push([5, 8, , 9]);
48
+ // Clear all accounts and tokens
49
+ return [4 /*yield*/, this.browserStorage.clear()];
50
+ case 6:
51
+ // Clear all accounts and tokens
52
+ _a.sent();
53
+ // Clear any stray keys from IndexedDB
54
+ return [4 /*yield*/, this.browserCrypto.clearKeystore()];
55
+ case 7:
56
+ // Clear any stray keys from IndexedDB
57
+ _a.sent();
58
+ this.logger.verbose("No account provided in logout request, clearing all cache items.");
59
+ return [3 /*break*/, 9];
60
+ case 8:
61
+ _a.sent();
62
+ this.logger.error("Attempted to clear all MSAL cache items and failed. Local cache unchanged.");
63
+ return [3 /*break*/, 9];
64
+ case 9: return [2 /*return*/];
65
+ }
66
+ });
67
+ });
68
+ };
69
+ /**
70
+ * Initializer function for all request APIs
71
+ * @param request
72
+ */
73
+ BaseInteractionClient.prototype.initializeBaseRequest = function (request) {
74
+ this.logger.verbose("Initializing BaseAuthRequest");
75
+ var authority = request.authority || this.config.auth.authority;
76
+ var scopes = __spread(((request && request.scopes) || []));
77
+ // Set authenticationScheme to BEARER if not explicitly set in the request
78
+ if (!request.authenticationScheme) {
79
+ request.authenticationScheme = AuthenticationScheme.BEARER;
80
+ this.logger.verbose("Authentication Scheme wasn't explicitly set in request, defaulting to \"Bearer\" request");
81
+ }
82
+ else {
83
+ if (request.authenticationScheme === AuthenticationScheme.SSH) {
84
+ if (!request.sshJwk) {
85
+ throw ClientConfigurationError.createMissingSshJwkError();
86
+ }
87
+ if (!request.sshKid) {
88
+ throw ClientConfigurationError.createMissingSshKidError();
89
+ }
90
+ }
91
+ this.logger.verbose("Authentication Scheme set to \"" + request.authenticationScheme + "\" as configured in Auth request");
92
+ }
93
+ var validatedRequest = __assign(__assign({}, request), { correlationId: this.correlationId, authority: authority,
94
+ scopes: scopes });
95
+ return validatedRequest;
96
+ };
97
+ /**
98
+ *
99
+ * Use to get the redirect uri configured in MSAL or null.
100
+ * @param requestRedirectUri
101
+ * @returns Redirect URL
102
+ *
103
+ */
104
+ BaseInteractionClient.prototype.getRedirectUri = function (requestRedirectUri) {
105
+ this.logger.verbose("getRedirectUri called");
106
+ var redirectUri = requestRedirectUri || this.config.auth.redirectUri || BrowserUtils.getCurrentUri();
107
+ return UrlString.getAbsoluteUrl(redirectUri, BrowserUtils.getCurrentUri());
108
+ };
109
+ /**
110
+ *
111
+ * @param apiId
112
+ * @param correlationId
113
+ * @param forceRefresh
114
+ */
115
+ BaseInteractionClient.prototype.initializeServerTelemetryManager = function (apiId, forceRefresh) {
116
+ this.logger.verbose("initializeServerTelemetryManager called");
117
+ var telemetryPayload = {
118
+ clientId: this.config.auth.clientId,
119
+ correlationId: this.correlationId,
120
+ apiId: apiId,
121
+ forceRefresh: forceRefresh || false,
122
+ wrapperSKU: this.browserStorage.getWrapperMetadata()[0],
123
+ wrapperVer: this.browserStorage.getWrapperMetadata()[1]
124
+ };
125
+ return new ServerTelemetryManager(telemetryPayload, this.browserStorage);
126
+ };
127
+ return BaseInteractionClient;
128
+ }());
129
+
130
+ export { BaseInteractionClient };
131
+ //# sourceMappingURL=BaseInteractionClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseInteractionClient.js","sources":["../../src/interaction_client/BaseInteractionClient.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ICrypto, INetworkModule, Logger, AuthenticationResult, AccountInfo, AccountEntity, BaseAuthRequest, AuthenticationScheme, UrlString, ServerTelemetryManager, ServerTelemetryRequest, ClientConfigurationError } from \"@azure/msal-common\";\nimport { BrowserConfiguration } from \"../config/Configuration\";\nimport { BrowserCacheManager } from \"../cache/BrowserCacheManager\";\nimport { EventHandler } from \"../event/EventHandler\";\nimport { EndSessionRequest } from \"../request/EndSessionRequest\";\nimport { RedirectRequest } from \"../request/RedirectRequest\";\nimport { PopupRequest } from \"../request/PopupRequest\";\nimport { SsoSilentRequest } from \"../request/SsoSilentRequest\";\nimport { version } from \"../packageMetadata\";\nimport { BrowserConstants } from \"../utils/BrowserConstants\";\nimport { BrowserUtils } from \"../utils/BrowserUtils\";\n\nexport abstract class BaseInteractionClient {\n\n protected config: BrowserConfiguration;\n protected browserStorage: BrowserCacheManager;\n protected browserCrypto: ICrypto;\n protected networkClient: INetworkModule;\n protected logger: Logger;\n protected eventHandler: EventHandler;\n protected correlationId: string;\n\n constructor(config: BrowserConfiguration, storageImpl: BrowserCacheManager, browserCrypto: ICrypto, logger: Logger, eventHandler: EventHandler, correlationId?: string) {\n this.config = config;\n this.browserStorage = storageImpl;\n this.browserCrypto = browserCrypto;\n this.networkClient = this.config.system.networkClient;\n this.eventHandler = eventHandler;\n this.correlationId = correlationId || this.browserCrypto.createNewGuid();\n this.logger = logger.clone(BrowserConstants.MSAL_SKU, version, this.correlationId);\n }\n\n abstract acquireToken(request: RedirectRequest|PopupRequest|SsoSilentRequest): Promise<AuthenticationResult|void>;\n\n abstract logout(request: EndSessionRequest): Promise<void>;\n\n protected async clearCacheOnLogout(account?: AccountInfo| null): Promise<void> {\n if (account) {\n if (AccountEntity.accountInfoIsEqual(account, this.browserStorage.getActiveAccount(), false)) {\n this.logger.verbose(\"Setting active account to null\");\n this.browserStorage.setActiveAccount(null);\n }\n // Clear given account.\n try {\n await this.browserStorage.removeAccount(AccountEntity.generateAccountCacheKey(account));\n this.logger.verbose(\"Cleared cache items belonging to the account provided in the logout request.\");\n } catch (error) {\n this.logger.error(\"Account provided in logout request was not found. Local cache unchanged.\");\n }\n } else {\n try {\n // Clear all accounts and tokens\n await this.browserStorage.clear();\n // Clear any stray keys from IndexedDB\n await this.browserCrypto.clearKeystore();\n this.logger.verbose(\"No account provided in logout request, clearing all cache items.\");\n } catch(e) {\n this.logger.error(\"Attempted to clear all MSAL cache items and failed. Local cache unchanged.\");\n }\n }\n }\n\n /**\n * Initializer function for all request APIs\n * @param request\n */\n protected initializeBaseRequest(request: Partial<BaseAuthRequest>): BaseAuthRequest {\n this.logger.verbose(\"Initializing BaseAuthRequest\");\n const authority = request.authority || this.config.auth.authority;\n\n const scopes = [...((request && request.scopes) || [])];\n\n // Set authenticationScheme to BEARER if not explicitly set in the request\n if (!request.authenticationScheme) {\n request.authenticationScheme = AuthenticationScheme.BEARER;\n this.logger.verbose(\"Authentication Scheme wasn't explicitly set in request, defaulting to \\\"Bearer\\\" request\");\n } else {\n if (request.authenticationScheme === AuthenticationScheme.SSH) {\n if (!request.sshJwk) {\n throw ClientConfigurationError.createMissingSshJwkError();\n }\n if(!request.sshKid) {\n throw ClientConfigurationError.createMissingSshKidError();\n }\n }\n this.logger.verbose(`Authentication Scheme set to \"${request.authenticationScheme}\" as configured in Auth request`);\n }\n\n const validatedRequest: BaseAuthRequest = {\n ...request,\n correlationId: this.correlationId,\n authority,\n scopes\n };\n\n return validatedRequest;\n }\n\n /**\n *\n * Use to get the redirect uri configured in MSAL or null.\n * @param requestRedirectUri\n * @returns Redirect URL\n *\n */\n protected getRedirectUri(requestRedirectUri?: string): string {\n this.logger.verbose(\"getRedirectUri called\");\n const redirectUri = requestRedirectUri || this.config.auth.redirectUri || BrowserUtils.getCurrentUri();\n return UrlString.getAbsoluteUrl(redirectUri, BrowserUtils.getCurrentUri());\n }\n\n /**\n *\n * @param apiId\n * @param correlationId\n * @param forceRefresh\n */\n protected initializeServerTelemetryManager(apiId: number, forceRefresh?: boolean): ServerTelemetryManager {\n this.logger.verbose(\"initializeServerTelemetryManager called\");\n const telemetryPayload: ServerTelemetryRequest = {\n clientId: this.config.auth.clientId,\n correlationId: this.correlationId,\n apiId: apiId,\n forceRefresh: forceRefresh || false,\n wrapperSKU: this.browserStorage.getWrapperMetadata()[0],\n wrapperVer: this.browserStorage.getWrapperMetadata()[1]\n };\n\n return new ServerTelemetryManager(telemetryPayload, this.browserStorage);\n }\n}\n"],"names":[],"mappings":";;;;;;;;AAAA;;;;;IA2BI,+BAAY,MAA4B,EAAE,WAAgC,EAAE,aAAsB,EAAE,MAAc,EAAE,YAA0B,EAAE,aAAsB;QAClK,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,cAAc,GAAG,WAAW,CAAC;QAClC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC;QACtD,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,aAAa,GAAG,aAAa,IAAI,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,CAAC;QACzE,IAAI,CAAC,MAAM,GAAG,MAA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MAAM,CAAC,IAAI,CAAC,QAAQ;YACnC,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,KAAK,EAAE,KAAK;YACZ,YAAY,EAAE,YAAY,IAAI,KAAK;YACnC,UAAU,EAAE,IAAI,CAAC,cAAc,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC;YACvD,UAAU,EAAE,IAAI,CAAC,cAAc,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC;SAC1D,CAAC;QAEF,OAAO,IAAI,sBAAsB,CAAC,gBAAgB,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;KAC5E;IACL,4BAAC;AAAD,CAAC;;;;"}
@@ -0,0 +1,5 @@
1
+ import { AuthorizationCodeClient, ClientConfiguration } from "@azure/msal-common";
2
+ export declare class HybridSpaAuthorizationCodeClient extends AuthorizationCodeClient {
3
+ constructor(config: ClientConfiguration);
4
+ }
5
+ //# sourceMappingURL=HybridSpaAuthorizationCodeClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HybridSpaAuthorizationCodeClient.d.ts","sourceRoot":"","sources":["../../src/interaction_client/HybridSpaAuthorizationCodeClient.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAElF,qBAAa,gCAAiC,SAAQ,uBAAuB;gBAC7D,MAAM,EAAE,mBAAmB;CAI1C"}
@@ -0,0 +1,21 @@
1
+ /*! @azure/msal-browser v2.20.0 2021-12-07 */
2
+ 'use strict';
3
+ import { __extends } from '../_virtual/_tslib.js';
4
+ import { AuthorizationCodeClient } from '@azure/msal-common';
5
+
6
+ /*
7
+ * Copyright (c) Microsoft Corporation. All rights reserved.
8
+ * Licensed under the MIT License.
9
+ */
10
+ var HybridSpaAuthorizationCodeClient = /** @class */ (function (_super) {
11
+ __extends(HybridSpaAuthorizationCodeClient, _super);
12
+ function HybridSpaAuthorizationCodeClient(config) {
13
+ var _this = _super.call(this, config) || this;
14
+ _this.includeRedirectUri = false;
15
+ return _this;
16
+ }
17
+ return HybridSpaAuthorizationCodeClient;
18
+ }(AuthorizationCodeClient));
19
+
20
+ export { HybridSpaAuthorizationCodeClient };
21
+ //# sourceMappingURL=HybridSpaAuthorizationCodeClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HybridSpaAuthorizationCodeClient.js","sources":["../../src/interaction_client/HybridSpaAuthorizationCodeClient.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AuthorizationCodeClient, ClientConfiguration } from \"@azure/msal-common\";\n\nexport class HybridSpaAuthorizationCodeClient extends AuthorizationCodeClient {\n constructor(config: ClientConfiguration) {\n super(config);\n this.includeRedirectUri = false;\n }\n}\n"],"names":[],"mappings":";;;;;AAAA;;;;;IAOsD,oDAAuB;IACzE,0CAAY,MAA2B;QAAvC,YACI,kBAAM,MAAM,CAAC,SAEhB;QADG,KAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC;;KACnC;IACL,uCAAC;AAAD,CALA,CAAsD,uBAAuB;;;;"}
@@ -0,0 +1,37 @@
1
+ import { AuthenticationResult } from "@azure/msal-common";
2
+ import { StandardInteractionClient } from "./StandardInteractionClient";
3
+ import { EndSessionPopupRequest } from "../request/EndSessionPopupRequest";
4
+ import { PopupRequest } from "../request/PopupRequest";
5
+ export declare class PopupClient extends StandardInteractionClient {
6
+ /**
7
+ * Acquires tokens by opening a popup window to the /authorize endpoint of the authority
8
+ * @param request
9
+ */
10
+ acquireToken(request: PopupRequest): Promise<AuthenticationResult>;
11
+ /**
12
+ * Clears local cache for the current user then opens a popup window prompting the user to sign-out of the server
13
+ * @param logoutRequest
14
+ */
15
+ logout(logoutRequest?: EndSessionPopupRequest): Promise<void>;
16
+ /**
17
+ * Helper which obtains an access_token for your API via opening a popup window in the user's browser
18
+ * @param validRequest
19
+ * @param popupName
20
+ * @param popup
21
+ * @param popupWindowAttributes
22
+ *
23
+ * @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.
24
+ */
25
+ private acquireTokenPopupAsync;
26
+ /**
27
+ *
28
+ * @param validRequest
29
+ * @param popupName
30
+ * @param requestAuthority
31
+ * @param popup
32
+ * @param mainWindowRedirectUri
33
+ * @param popupWindowAttributes
34
+ */
35
+ private logoutPopupAsync;
36
+ }
37
+ //# sourceMappingURL=PopupClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PopupClient.d.ts","sourceRoot":"","sources":["../../src/interaction_client/PopupClient.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,oBAAoB,EAA2H,MAAM,oBAAoB,CAAC;AAEnL,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAKxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAG3E,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,qBAAa,WAAY,SAAQ,yBAAyB;IACtD;;;OAGG;IACH,YAAY,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAsBlE;;;OAGG;IACH,MAAM,CAAC,aAAa,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IA2B7D;;;;;;;;OAQG;YACW,sBAAsB;IAsDpC;;;;;;;;OAQG;YACW,gBAAgB;CAqEjC"}
@@ -0,0 +1,234 @@
1
+ /*! @azure/msal-browser v2.20.0 2021-12-07 */
2
+ 'use strict';
3
+ import { __extends, __awaiter, __generator } from '../_virtual/_tslib.js';
4
+ import { AuthError, ThrottlingUtils, UrlString } from '@azure/msal-common';
5
+ import { StandardInteractionClient } from './StandardInteractionClient.js';
6
+ import { PopupUtils } from '../utils/PopupUtils.js';
7
+ import { EventType } from '../event/EventType.js';
8
+ import { InteractionType, ApiId } from '../utils/BrowserConstants.js';
9
+ import { PopupHandler } from '../interaction_handler/PopupHandler.js';
10
+ import { BrowserUtils } from '../utils/BrowserUtils.js';
11
+
12
+ /*
13
+ * Copyright (c) Microsoft Corporation. All rights reserved.
14
+ * Licensed under the MIT License.
15
+ */
16
+ var PopupClient = /** @class */ (function (_super) {
17
+ __extends(PopupClient, _super);
18
+ function PopupClient() {
19
+ return _super !== null && _super.apply(this, arguments) || this;
20
+ }
21
+ /**
22
+ * Acquires tokens by opening a popup window to the /authorize endpoint of the authority
23
+ * @param request
24
+ */
25
+ PopupClient.prototype.acquireToken = function (request) {
26
+ try {
27
+ var validRequest = this.preflightInteractiveRequest(request, InteractionType.Popup);
28
+ var popupName = PopupUtils.generatePopupName(this.config.auth.clientId, validRequest);
29
+ var popupWindowAttributes = request.popupWindowAttributes || {};
30
+ // asyncPopups flag is true. Acquires token without first opening popup. Popup will be opened later asynchronously.
31
+ if (this.config.system.asyncPopups) {
32
+ this.logger.verbose("asyncPopups set to true, acquiring token");
33
+ // Passes on popup position and dimensions if in request
34
+ return this.acquireTokenPopupAsync(validRequest, popupName, popupWindowAttributes);
35
+ }
36
+ else {
37
+ // asyncPopups flag is set to false. Opens popup before acquiring token.
38
+ this.logger.verbose("asyncPopup set to false, opening popup before acquiring token");
39
+ var popup = PopupUtils.openSizedPopup("about:blank", popupName, popupWindowAttributes, this.logger);
40
+ return this.acquireTokenPopupAsync(validRequest, popupName, popupWindowAttributes, popup);
41
+ }
42
+ }
43
+ catch (e) {
44
+ return Promise.reject(e);
45
+ }
46
+ };
47
+ /**
48
+ * Clears local cache for the current user then opens a popup window prompting the user to sign-out of the server
49
+ * @param logoutRequest
50
+ */
51
+ PopupClient.prototype.logout = function (logoutRequest) {
52
+ try {
53
+ this.logger.verbose("logoutPopup called");
54
+ var validLogoutRequest = this.initializeLogoutRequest(logoutRequest);
55
+ var popupName = PopupUtils.generateLogoutPopupName(this.config.auth.clientId, validLogoutRequest);
56
+ var authority = logoutRequest && logoutRequest.authority;
57
+ var mainWindowRedirectUri = logoutRequest && logoutRequest.mainWindowRedirectUri;
58
+ var popupWindowAttributes = (logoutRequest === null || logoutRequest === void 0 ? void 0 : logoutRequest.popupWindowAttributes) || {};
59
+ // asyncPopups flag is true. Acquires token without first opening popup. Popup will be opened later asynchronously.
60
+ if (this.config.system.asyncPopups) {
61
+ this.logger.verbose("asyncPopups set to true");
62
+ // Passes on popup position and dimensions if in request
63
+ return this.logoutPopupAsync(validLogoutRequest, popupName, popupWindowAttributes, authority, undefined, mainWindowRedirectUri);
64
+ }
65
+ else {
66
+ // asyncPopups flag is set to false. Opens popup before logging out.
67
+ this.logger.verbose("asyncPopup set to false, opening popup");
68
+ var popup = PopupUtils.openSizedPopup("about:blank", popupName, popupWindowAttributes, this.logger);
69
+ return this.logoutPopupAsync(validLogoutRequest, popupName, popupWindowAttributes, authority, popup, mainWindowRedirectUri);
70
+ }
71
+ }
72
+ catch (e) {
73
+ // Since this function is synchronous we need to reject
74
+ return Promise.reject(e);
75
+ }
76
+ };
77
+ /**
78
+ * Helper which obtains an access_token for your API via opening a popup window in the user's browser
79
+ * @param validRequest
80
+ * @param popupName
81
+ * @param popup
82
+ * @param popupWindowAttributes
83
+ *
84
+ * @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.
85
+ */
86
+ PopupClient.prototype.acquireTokenPopupAsync = function (validRequest, popupName, popupWindowAttributes, popup) {
87
+ return __awaiter(this, void 0, void 0, function () {
88
+ var serverTelemetryManager, authCodeRequest, authClient, navigateUrl, interactionHandler, popupParameters, popupWindow, hash, state, result, e_1;
89
+ return __generator(this, function (_a) {
90
+ switch (_a.label) {
91
+ case 0:
92
+ this.logger.verbose("acquireTokenPopupAsync called");
93
+ serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenPopup);
94
+ _a.label = 1;
95
+ case 1:
96
+ _a.trys.push([1, 7, , 8]);
97
+ return [4 /*yield*/, this.initializeAuthorizationCodeRequest(validRequest)];
98
+ case 2:
99
+ authCodeRequest = _a.sent();
100
+ return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, validRequest.authority)];
101
+ case 3:
102
+ authClient = _a.sent();
103
+ this.logger.verbose("Auth code client created");
104
+ return [4 /*yield*/, authClient.getAuthCodeUrl(validRequest)];
105
+ case 4:
106
+ navigateUrl = _a.sent();
107
+ interactionHandler = new PopupHandler(authClient, this.browserStorage, authCodeRequest, this.logger);
108
+ popupParameters = {
109
+ popup: popup,
110
+ popupName: popupName,
111
+ popupWindowAttributes: popupWindowAttributes
112
+ };
113
+ popupWindow = interactionHandler.initiateAuthRequest(navigateUrl, popupParameters);
114
+ this.eventHandler.emitEvent(EventType.POPUP_OPENED, InteractionType.Popup, { popupWindow: popupWindow }, null);
115
+ return [4 /*yield*/, interactionHandler.monitorPopupForHash(popupWindow)];
116
+ case 5:
117
+ hash = _a.sent();
118
+ state = this.validateAndExtractStateFromHash(hash, InteractionType.Popup, validRequest.correlationId);
119
+ // Remove throttle if it exists
120
+ ThrottlingUtils.removeThrottle(this.browserStorage, this.config.auth.clientId, authCodeRequest);
121
+ return [4 /*yield*/, interactionHandler.handleCodeResponseFromHash(hash, state, authClient.authority, this.networkClient)];
122
+ case 6:
123
+ result = _a.sent();
124
+ return [2 /*return*/, result];
125
+ case 7:
126
+ e_1 = _a.sent();
127
+ if (popup) {
128
+ // Close the synchronous popup if an error is thrown before the window unload event is registered
129
+ popup.close();
130
+ }
131
+ if (e_1 instanceof AuthError) {
132
+ e_1.setCorrelationId(this.correlationId);
133
+ }
134
+ serverTelemetryManager.cacheFailedRequest(e_1);
135
+ this.browserStorage.cleanRequestByState(validRequest.state);
136
+ throw e_1;
137
+ case 8: return [2 /*return*/];
138
+ }
139
+ });
140
+ });
141
+ };
142
+ /**
143
+ *
144
+ * @param validRequest
145
+ * @param popupName
146
+ * @param requestAuthority
147
+ * @param popup
148
+ * @param mainWindowRedirectUri
149
+ * @param popupWindowAttributes
150
+ */
151
+ PopupClient.prototype.logoutPopupAsync = function (validRequest, popupName, popupWindowAttributes, requestAuthority, popup, mainWindowRedirectUri) {
152
+ return __awaiter(this, void 0, void 0, function () {
153
+ var serverTelemetryManager, authClient, logoutUri, popupUtils, popupWindow, e_2, navigationOptions, absoluteUrl, e_3;
154
+ return __generator(this, function (_a) {
155
+ switch (_a.label) {
156
+ case 0:
157
+ this.logger.verbose("logoutPopupAsync called");
158
+ this.eventHandler.emitEvent(EventType.LOGOUT_START, InteractionType.Popup, validRequest);
159
+ serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.logoutPopup);
160
+ _a.label = 1;
161
+ case 1:
162
+ _a.trys.push([1, 8, , 9]);
163
+ // Clear cache on logout
164
+ return [4 /*yield*/, this.clearCacheOnLogout(validRequest.account)];
165
+ case 2:
166
+ // Clear cache on logout
167
+ _a.sent();
168
+ this.browserStorage.setInteractionInProgress(true);
169
+ return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, requestAuthority)];
170
+ case 3:
171
+ authClient = _a.sent();
172
+ this.logger.verbose("Auth code client created");
173
+ logoutUri = authClient.getLogoutUri(validRequest);
174
+ this.eventHandler.emitEvent(EventType.LOGOUT_SUCCESS, InteractionType.Popup, validRequest);
175
+ popupUtils = new PopupUtils(this.browserStorage, this.logger);
176
+ popupWindow = popupUtils.openPopup(logoutUri, { popupName: popupName, popupWindowAttributes: popupWindowAttributes, popup: popup });
177
+ this.eventHandler.emitEvent(EventType.POPUP_OPENED, InteractionType.Popup, { popupWindow: popupWindow }, null);
178
+ _a.label = 4;
179
+ case 4:
180
+ _a.trys.push([4, 6, , 7]);
181
+ // Don't care if this throws an error (User Cancelled)
182
+ return [4 /*yield*/, popupUtils.monitorPopupForSameOrigin(popupWindow)];
183
+ case 5:
184
+ // Don't care if this throws an error (User Cancelled)
185
+ _a.sent();
186
+ this.logger.verbose("Popup successfully redirected to postLogoutRedirectUri");
187
+ return [3 /*break*/, 7];
188
+ case 6:
189
+ e_2 = _a.sent();
190
+ this.logger.verbose("Error occurred while monitoring popup for same origin. Session on server may remain active. Error: " + e_2);
191
+ return [3 /*break*/, 7];
192
+ case 7:
193
+ popupUtils.cleanPopup(popupWindow);
194
+ if (mainWindowRedirectUri) {
195
+ navigationOptions = {
196
+ apiId: ApiId.logoutPopup,
197
+ timeout: this.config.system.redirectNavigationTimeout,
198
+ noHistory: false
199
+ };
200
+ absoluteUrl = UrlString.getAbsoluteUrl(mainWindowRedirectUri, BrowserUtils.getCurrentUri());
201
+ this.logger.verbose("Redirecting main window to url specified in the request");
202
+ this.logger.verbosePii("Redirecing main window to: " + absoluteUrl);
203
+ this.navigationClient.navigateInternal(absoluteUrl, navigationOptions);
204
+ }
205
+ else {
206
+ this.logger.verbose("No main window navigation requested");
207
+ }
208
+ return [3 /*break*/, 9];
209
+ case 8:
210
+ e_3 = _a.sent();
211
+ if (popup) {
212
+ // Close the synchronous popup if an error is thrown before the window unload event is registered
213
+ popup.close();
214
+ }
215
+ if (e_3 instanceof AuthError) {
216
+ e_3.setCorrelationId(this.correlationId);
217
+ }
218
+ this.browserStorage.setInteractionInProgress(false);
219
+ this.eventHandler.emitEvent(EventType.LOGOUT_FAILURE, InteractionType.Popup, null, e_3);
220
+ this.eventHandler.emitEvent(EventType.LOGOUT_END, InteractionType.Popup);
221
+ serverTelemetryManager.cacheFailedRequest(e_3);
222
+ throw e_3;
223
+ case 9:
224
+ this.eventHandler.emitEvent(EventType.LOGOUT_END, InteractionType.Popup);
225
+ return [2 /*return*/];
226
+ }
227
+ });
228
+ });
229
+ };
230
+ return PopupClient;
231
+ }(StandardInteractionClient));
232
+
233
+ export { PopupClient };
234
+ //# sourceMappingURL=PopupClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PopupClient.js","sources":["../../src/interaction_client/PopupClient.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AuthenticationResult, CommonAuthorizationCodeRequest, AuthorizationCodeClient, ThrottlingUtils, CommonEndSessionRequest, UrlString, AuthError } from \"@azure/msal-common\";\nimport { AuthorizationUrlRequest } from \"../request/AuthorizationUrlRequest\";\nimport { StandardInteractionClient } from \"./StandardInteractionClient\";\nimport { PopupWindowAttributes, PopupUtils } from \"../utils/PopupUtils\";\nimport { EventType } from \"../event/EventType\";\nimport { InteractionType, ApiId } from \"../utils/BrowserConstants\";\nimport { PopupHandler, PopupParams } from \"../interaction_handler/PopupHandler\";\nimport { EndSessionPopupRequest } from \"../request/EndSessionPopupRequest\";\nimport { NavigationOptions } from \"../navigation/NavigationOptions\";\nimport { BrowserUtils } from \"../utils/BrowserUtils\";\nimport { PopupRequest } from \"../request/PopupRequest\";\n\nexport class PopupClient extends StandardInteractionClient {\n /**\n * Acquires tokens by opening a popup window to the /authorize endpoint of the authority\n * @param request \n */\n acquireToken(request: PopupRequest): Promise<AuthenticationResult> {\n try {\n const validRequest = this.preflightInteractiveRequest(request, InteractionType.Popup);\n const popupName = PopupUtils.generatePopupName(this.config.auth.clientId, validRequest);\n const popupWindowAttributes = request.popupWindowAttributes || {};\n\n // asyncPopups flag is true. Acquires token without first opening popup. Popup will be opened later asynchronously.\n if (this.config.system.asyncPopups) {\n this.logger.verbose(\"asyncPopups set to true, acquiring token\");\n // Passes on popup position and dimensions if in request\n return this.acquireTokenPopupAsync(validRequest, popupName, popupWindowAttributes);\n } else {\n // asyncPopups flag is set to false. Opens popup before acquiring token.\n this.logger.verbose(\"asyncPopup set to false, opening popup before acquiring token\");\n const popup = PopupUtils.openSizedPopup(\"about:blank\", popupName, popupWindowAttributes, this.logger);\n return this.acquireTokenPopupAsync(validRequest, popupName, popupWindowAttributes, popup);\n }\n } catch (e) {\n return Promise.reject(e);\n }\n }\n\n /**\n * Clears local cache for the current user then opens a popup window prompting the user to sign-out of the server\n * @param logoutRequest \n */\n logout(logoutRequest?: EndSessionPopupRequest): Promise<void> {\n try {\n this.logger.verbose(\"logoutPopup called\");\n const validLogoutRequest = this.initializeLogoutRequest(logoutRequest);\n\n const popupName = PopupUtils.generateLogoutPopupName(this.config.auth.clientId, validLogoutRequest);\n const authority = logoutRequest && logoutRequest.authority;\n const mainWindowRedirectUri = logoutRequest && logoutRequest.mainWindowRedirectUri;\n const popupWindowAttributes = logoutRequest?.popupWindowAttributes || {};\n\n // asyncPopups flag is true. Acquires token without first opening popup. Popup will be opened later asynchronously.\n if (this.config.system.asyncPopups) {\n this.logger.verbose(\"asyncPopups set to true\");\n // Passes on popup position and dimensions if in request\n return this.logoutPopupAsync(validLogoutRequest, popupName, popupWindowAttributes, authority, undefined, mainWindowRedirectUri);\n } else {\n // asyncPopups flag is set to false. Opens popup before logging out.\n this.logger.verbose(\"asyncPopup set to false, opening popup\");\n const popup = PopupUtils.openSizedPopup(\"about:blank\", popupName, popupWindowAttributes, this.logger);\n return this.logoutPopupAsync(validLogoutRequest, popupName, popupWindowAttributes, authority, popup, mainWindowRedirectUri);\n }\n } catch (e) {\n // Since this function is synchronous we need to reject\n return Promise.reject(e);\n }\n }\n\n /**\n * Helper which obtains an access_token for your API via opening a popup window in the user's browser\n * @param validRequest\n * @param popupName\n * @param popup\n * @param popupWindowAttributes\n *\n * @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.\n */\n private async acquireTokenPopupAsync(validRequest: AuthorizationUrlRequest, popupName: string, popupWindowAttributes: PopupWindowAttributes, popup?: Window|null): Promise<AuthenticationResult> {\n this.logger.verbose(\"acquireTokenPopupAsync called\");\n const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenPopup);\n\n try {\n // Create auth code request and generate PKCE params\n const authCodeRequest: CommonAuthorizationCodeRequest = await this.initializeAuthorizationCodeRequest(validRequest);\n\n // Initialize the client\n const authClient: AuthorizationCodeClient = await this.createAuthCodeClient(serverTelemetryManager, validRequest.authority);\n this.logger.verbose(\"Auth code client created\");\n\n // Create acquire token url.\n const navigateUrl = await authClient.getAuthCodeUrl(validRequest);\n\n // Create popup interaction handler.\n const interactionHandler = new PopupHandler(authClient, this.browserStorage, authCodeRequest, this.logger);\n\n // Show the UI once the url has been created. Get the window handle for the popup.\n const popupParameters: PopupParams = {\n popup,\n popupName,\n popupWindowAttributes\n };\n const popupWindow: Window = interactionHandler.initiateAuthRequest(navigateUrl, popupParameters);\n this.eventHandler.emitEvent(EventType.POPUP_OPENED, InteractionType.Popup, {popupWindow}, null);\n\n // Monitor the window for the hash. Return the string value and close the popup when the hash is received. Default timeout is 60 seconds.\n const hash = await interactionHandler.monitorPopupForHash(popupWindow);\n const state = this.validateAndExtractStateFromHash(hash, InteractionType.Popup, validRequest.correlationId);\n\n // Remove throttle if it exists\n ThrottlingUtils.removeThrottle(this.browserStorage, this.config.auth.clientId, authCodeRequest);\n\n // Handle response from hash string.\n const result = await interactionHandler.handleCodeResponseFromHash(hash, state, authClient.authority, this.networkClient);\n\n return result;\n } catch (e) { \n if (popup) {\n // Close the synchronous popup if an error is thrown before the window unload event is registered\n popup.close();\n }\n\n if (e instanceof AuthError) {\n e.setCorrelationId(this.correlationId);\n }\n\n serverTelemetryManager.cacheFailedRequest(e);\n this.browserStorage.cleanRequestByState(validRequest.state);\n throw e;\n }\n }\n\n /**\n * \n * @param validRequest \n * @param popupName \n * @param requestAuthority\n * @param popup \n * @param mainWindowRedirectUri \n * @param popupWindowAttributes \n */\n private async logoutPopupAsync(validRequest: CommonEndSessionRequest, popupName: string, popupWindowAttributes: PopupWindowAttributes, requestAuthority?: string, popup?: Window|null, mainWindowRedirectUri?: string): Promise<void> {\n this.logger.verbose(\"logoutPopupAsync called\");\n this.eventHandler.emitEvent(EventType.LOGOUT_START, InteractionType.Popup, validRequest);\n\n const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.logoutPopup);\n \n try {\n // Clear cache on logout\n await this.clearCacheOnLogout(validRequest.account);\n\n this.browserStorage.setInteractionInProgress(true);\n // Initialize the client\n const authClient = await this.createAuthCodeClient(serverTelemetryManager, requestAuthority);\n this.logger.verbose(\"Auth code client created\");\n\n // Create logout string and navigate user window to logout.\n const logoutUri: string = authClient.getLogoutUri(validRequest);\n\n this.eventHandler.emitEvent(EventType.LOGOUT_SUCCESS, InteractionType.Popup, validRequest);\n\n const popupUtils = new PopupUtils(this.browserStorage, this.logger);\n // Open the popup window to requestUrl.\n const popupWindow = popupUtils.openPopup(logoutUri, {popupName, popupWindowAttributes, popup});\n this.eventHandler.emitEvent(EventType.POPUP_OPENED, InteractionType.Popup, {popupWindow}, null);\n\n try {\n // Don't care if this throws an error (User Cancelled)\n await popupUtils.monitorPopupForSameOrigin(popupWindow);\n this.logger.verbose(\"Popup successfully redirected to postLogoutRedirectUri\");\n } catch (e) {\n this.logger.verbose(`Error occurred while monitoring popup for same origin. Session on server may remain active. Error: ${e}`);\n }\n\n popupUtils.cleanPopup(popupWindow);\n\n if (mainWindowRedirectUri) {\n const navigationOptions: NavigationOptions = {\n apiId: ApiId.logoutPopup,\n timeout: this.config.system.redirectNavigationTimeout,\n noHistory: false\n };\n const absoluteUrl = UrlString.getAbsoluteUrl(mainWindowRedirectUri, BrowserUtils.getCurrentUri());\n\n this.logger.verbose(\"Redirecting main window to url specified in the request\");\n this.logger.verbosePii(`Redirecing main window to: ${absoluteUrl}`);\n this.navigationClient.navigateInternal(absoluteUrl, navigationOptions);\n } else {\n this.logger.verbose(\"No main window navigation requested\");\n }\n\n } catch (e) {\n if (popup) {\n // Close the synchronous popup if an error is thrown before the window unload event is registered\n popup.close();\n }\n\n if (e instanceof AuthError) {\n e.setCorrelationId(this.correlationId);\n }\n \n this.browserStorage.setInteractionInProgress(false);\n this.eventHandler.emitEvent(EventType.LOGOUT_FAILURE, InteractionType.Popup, null, e);\n this.eventHandler.emitEvent(EventType.LOGOUT_END, InteractionType.Popup);\n serverTelemetryManager.cacheFailedRequest(e);\n throw e;\n }\n\n this.eventHandler.emitEvent(EventType.LOGOUT_END, InteractionType.Popup);\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAAA;;;;;IAiBiC,+BAAyB;IAA1D;;KAuMC;;;;;IAlMG,kCAAY,GAAZ,UAAa,OAAqB;QAC9B,IAAI;YACA,IAAM,YAAY,GAAG,IAAI,CAAC,2BAA2B,CAAC,OAAO,EAAE,eA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