@azure/msal-browser 2.21.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 (112) hide show
  1. package/CHANGELOG.json +73 -0
  2. package/CHANGELOG.md +18 -1
  3. package/README.md +1 -1
  4. package/dist/_virtual/_tslib.js +1 -1
  5. package/dist/app/ClientApplication.d.ts +7 -1
  6. package/dist/app/ClientApplication.d.ts.map +1 -1
  7. package/dist/app/ClientApplication.js +18 -3
  8. package/dist/app/ClientApplication.js.map +1 -1
  9. package/dist/app/IPublicClientApplication.js +1 -1
  10. package/dist/app/PublicClientApplication.d.ts +2 -2
  11. package/dist/app/PublicClientApplication.d.ts.map +1 -1
  12. package/dist/app/PublicClientApplication.js +1 -1
  13. package/dist/app/PublicClientApplication.js.map +1 -1
  14. package/dist/cache/AsyncMemoryStorage.js +1 -1
  15. package/dist/cache/BrowserCacheManager.d.ts +14 -12
  16. package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
  17. package/dist/cache/BrowserCacheManager.js +11 -7
  18. package/dist/cache/BrowserCacheManager.js.map +1 -1
  19. package/dist/cache/BrowserStorage.js +1 -1
  20. package/dist/cache/DatabaseStorage.js +1 -1
  21. package/dist/cache/MemoryStorage.js +1 -1
  22. package/dist/cache/TokenCache.d.ts.map +1 -1
  23. package/dist/cache/TokenCache.js +4 -3
  24. package/dist/cache/TokenCache.js.map +1 -1
  25. package/dist/config/Configuration.d.ts +10 -9
  26. package/dist/config/Configuration.d.ts.map +1 -1
  27. package/dist/config/Configuration.js +7 -3
  28. package/dist/config/Configuration.js.map +1 -1
  29. package/dist/crypto/BrowserCrypto.js +1 -1
  30. package/dist/crypto/CryptoOps.js +1 -1
  31. package/dist/crypto/GuidGenerator.js +1 -1
  32. package/dist/crypto/PkceGenerator.js +1 -1
  33. package/dist/crypto/SignedHttpRequest.js +1 -1
  34. package/dist/encode/Base64Decode.js +1 -1
  35. package/dist/encode/Base64Encode.js +1 -1
  36. package/dist/error/BrowserAuthError.js +1 -1
  37. package/dist/error/BrowserConfigurationAuthError.js +1 -1
  38. package/dist/event/EventHandler.js +1 -1
  39. package/dist/event/EventMessage.js +1 -1
  40. package/dist/event/EventType.js +1 -1
  41. package/dist/index.cjs.js +355 -234
  42. package/dist/index.cjs.js.map +1 -1
  43. package/dist/index.d.ts +14 -2
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/index.js +14 -3
  46. package/dist/index.js.map +1 -1
  47. package/dist/interaction_client/BaseInteractionClient.d.ts +1 -1
  48. package/dist/interaction_client/BaseInteractionClient.d.ts.map +1 -1
  49. package/dist/interaction_client/BaseInteractionClient.js +1 -1
  50. package/dist/interaction_client/BaseInteractionClient.js.map +1 -1
  51. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.js +1 -1
  52. package/dist/interaction_client/PopupClient.d.ts +4 -3
  53. package/dist/interaction_client/PopupClient.d.ts.map +1 -1
  54. package/dist/interaction_client/PopupClient.js +52 -60
  55. package/dist/interaction_client/PopupClient.js.map +1 -1
  56. package/dist/interaction_client/RedirectClient.d.ts +3 -3
  57. package/dist/interaction_client/RedirectClient.d.ts.map +1 -1
  58. package/dist/interaction_client/RedirectClient.js +9 -8
  59. package/dist/interaction_client/RedirectClient.js.map +1 -1
  60. package/dist/interaction_client/SilentAuthCodeClient.d.ts.map +1 -1
  61. package/dist/interaction_client/SilentAuthCodeClient.js +2 -1
  62. package/dist/interaction_client/SilentAuthCodeClient.js.map +1 -1
  63. package/dist/interaction_client/SilentCacheClient.d.ts +2 -2
  64. package/dist/interaction_client/SilentCacheClient.d.ts.map +1 -1
  65. package/dist/interaction_client/SilentCacheClient.js +4 -4
  66. package/dist/interaction_client/SilentCacheClient.js.map +1 -1
  67. package/dist/interaction_client/SilentIframeClient.d.ts +3 -3
  68. package/dist/interaction_client/SilentIframeClient.d.ts.map +1 -1
  69. package/dist/interaction_client/SilentIframeClient.js +3 -2
  70. package/dist/interaction_client/SilentIframeClient.js.map +1 -1
  71. package/dist/interaction_client/SilentRefreshClient.d.ts +2 -2
  72. package/dist/interaction_client/SilentRefreshClient.d.ts.map +1 -1
  73. package/dist/interaction_client/SilentRefreshClient.js +4 -4
  74. package/dist/interaction_client/SilentRefreshClient.js.map +1 -1
  75. package/dist/interaction_client/StandardInteractionClient.d.ts +10 -10
  76. package/dist/interaction_client/StandardInteractionClient.d.ts.map +1 -1
  77. package/dist/interaction_client/StandardInteractionClient.js +58 -44
  78. package/dist/interaction_client/StandardInteractionClient.js.map +1 -1
  79. package/dist/interaction_handler/InteractionHandler.js +1 -1
  80. package/dist/interaction_handler/PopupHandler.d.ts.map +1 -1
  81. package/dist/interaction_handler/PopupHandler.js +1 -3
  82. package/dist/interaction_handler/PopupHandler.js.map +1 -1
  83. package/dist/interaction_handler/RedirectHandler.d.ts.map +1 -1
  84. package/dist/interaction_handler/RedirectHandler.js +1 -2
  85. package/dist/interaction_handler/RedirectHandler.js.map +1 -1
  86. package/dist/interaction_handler/SilentHandler.js +1 -1
  87. package/dist/navigation/NavigationClient.js +1 -1
  88. package/dist/network/FetchClient.js +1 -1
  89. package/dist/network/XhrClient.js +1 -1
  90. package/dist/packageMetadata.d.ts +1 -1
  91. package/dist/packageMetadata.js +2 -2
  92. package/dist/packageMetadata.js.map +1 -1
  93. package/dist/request/EndSessionPopupRequest.d.ts +1 -0
  94. package/dist/request/EndSessionPopupRequest.d.ts.map +1 -1
  95. package/dist/request/EndSessionRequest.d.ts +1 -0
  96. package/dist/request/EndSessionRequest.d.ts.map +1 -1
  97. package/dist/utils/BrowserConstants.d.ts +2 -1
  98. package/dist/utils/BrowserConstants.d.ts.map +1 -1
  99. package/dist/utils/BrowserConstants.js +2 -1
  100. package/dist/utils/BrowserConstants.js.map +1 -1
  101. package/dist/utils/BrowserProtocolUtils.js +1 -1
  102. package/dist/utils/BrowserStringUtils.js +1 -1
  103. package/dist/utils/BrowserUtils.js +1 -1
  104. package/dist/utils/MathUtils.js +1 -1
  105. package/dist/utils/PopupUtils.d.ts +1 -2
  106. package/dist/utils/PopupUtils.d.ts.map +1 -1
  107. package/dist/utils/PopupUtils.js +3 -3
  108. package/dist/utils/PopupUtils.js.map +1 -1
  109. package/lib/msal-browser.js +355 -234
  110. package/lib/msal-browser.js.map +1 -1
  111. package/lib/msal-browser.min.js +35 -30
  112. package/package.json +2 -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, BrowserConfiguration } from "./config/Configuration";
6
+ export { Configuration, BrowserAuthOptions, CacheOptions, BrowserSystemOptions, BrowserConfiguration, DEFAULT_IFRAME_TIMEOUT_MS } 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";
@@ -21,9 +21,21 @@ export { EndSessionPopupRequest } from "./request/EndSessionPopupRequest";
21
21
  export { AuthorizationUrlRequest } from "./request/AuthorizationUrlRequest";
22
22
  export { AuthorizationCodeRequest } from "./request/AuthorizationCodeRequest";
23
23
  export { LoadTokenOptions } from "./cache/TokenCache";
24
+ export { BrowserCacheManager } from "./cache/BrowserCacheManager";
25
+ export { StandardInteractionClient } from "./interaction_client/StandardInteractionClient";
26
+ export { RedirectClient } from "./interaction_client/RedirectClient";
27
+ export { PopupClient } from "./interaction_client/PopupClient";
28
+ export { SilentIframeClient } from "./interaction_client/SilentIframeClient";
29
+ export { SilentCacheClient } from "./interaction_client/SilentCacheClient";
30
+ export { SilentRefreshClient } from "./interaction_client/SilentRefreshClient";
31
+ export { RedirectHandler } from "./interaction_handler/RedirectHandler";
24
32
  export { EventMessage, EventPayload, EventError, EventCallbackFunction, EventMessageUtils, PopupEvent } from "./event/EventMessage";
25
33
  export { EventType } from "./event/EventType";
34
+ export { EventHandler } from "./event/EventHandler";
26
35
  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";
36
+ export { BrowserStateObject } from "./utils/BrowserProtocolUtils";
37
+ export { BrowserConstants, TemporaryCacheKeys } from "./utils/BrowserConstants";
38
+ export { PopupUtils } from "./utils/PopupUtils";
39
+ export { AuthenticationScheme, AccountInfo, AccountEntity, AuthenticationResult, AuthError, AuthErrorMessage, ClientAuthError, ClientAuthErrorMessage, ClientConfigurationError, ClientConfigurationErrorMessage, InteractionRequiredAuthError, InteractionRequiredAuthErrorMessage, ServerError, INetworkModule, NetworkResponse, NetworkRequestOptions, ILoggerCallback, Logger, LogLevel, ProtocolMode, ExternalTokenResponse, StringUtils, UrlString, AzureCloudInstance, AzureCloudOptions, AuthenticationHeaderParser, OIDC_DEFAULT_SCOPES } from "@azure/msal-common";
28
40
  export { version } from "./packageMetadata";
29
41
  //# 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,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACrI,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,UAAU,EAAE,KAA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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,EAET,kBAAkB,EAClB,iBAAiB,EACjB,0BAA0B,EAC1B,mBAAmB,EACtB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC"}
package/dist/index.js CHANGED
@@ -1,15 +1,26 @@
1
- /*! @azure/msal-browser v2.21.0 2022-01-04 */
1
+ /*! @azure/msal-browser v2.22.0 2022-02-08 */
2
2
  'use strict';
3
3
  export { PublicClientApplication } from './app/PublicClientApplication.js';
4
- export { ApiId, BrowserCacheLocation, InteractionStatus, InteractionType, WrapperSKU } from './utils/BrowserConstants.js';
4
+ export { DEFAULT_IFRAME_TIMEOUT_MS } from './config/Configuration.js';
5
+ export { ApiId, BrowserCacheLocation, BrowserConstants, InteractionStatus, InteractionType, TemporaryCacheKeys, WrapperSKU } from './utils/BrowserConstants.js';
5
6
  export { BrowserUtils } from './utils/BrowserUtils.js';
6
7
  export { BrowserAuthError, BrowserAuthErrorMessage } from './error/BrowserAuthError.js';
7
8
  export { BrowserConfigurationAuthError, BrowserConfigurationAuthErrorMessage } from './error/BrowserConfigurationAuthError.js';
8
9
  export { stubbedPublicClientApplication } from './app/IPublicClientApplication.js';
9
10
  export { NavigationClient } from './navigation/NavigationClient.js';
11
+ export { BrowserCacheManager } from './cache/BrowserCacheManager.js';
12
+ export { StandardInteractionClient } from './interaction_client/StandardInteractionClient.js';
13
+ export { RedirectClient } from './interaction_client/RedirectClient.js';
14
+ export { PopupClient } from './interaction_client/PopupClient.js';
15
+ export { SilentIframeClient } from './interaction_client/SilentIframeClient.js';
16
+ export { SilentCacheClient } from './interaction_client/SilentCacheClient.js';
17
+ export { SilentRefreshClient } from './interaction_client/SilentRefreshClient.js';
18
+ export { RedirectHandler } from './interaction_handler/RedirectHandler.js';
10
19
  export { EventMessageUtils } from './event/EventMessage.js';
11
20
  export { EventType } from './event/EventType.js';
21
+ export { EventHandler } from './event/EventHandler.js';
12
22
  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';
23
+ export { PopupUtils } from './utils/PopupUtils.js';
24
+ export { AccountEntity, AuthError, AuthErrorMessage, AuthenticationHeaderParser, AuthenticationScheme, AzureCloudInstance, ClientAuthError, ClientAuthErrorMessage, ClientConfigurationError, ClientConfigurationErrorMessage, InteractionRequiredAuthError, InteractionRequiredAuthErrorMessage, LogLevel, Logger, OIDC_DEFAULT_SCOPES, ProtocolMode, ServerError, StringUtils, UrlString } from '@azure/msal-common';
14
25
  export { version } from './packageMetadata.js';
15
26
  //# 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":";;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -30,7 +30,7 @@ export declare abstract class BaseInteractionClient {
30
30
  * @returns Redirect URL
31
31
  *
32
32
  */
33
- protected getRedirectUri(requestRedirectUri?: string): string;
33
+ getRedirectUri(requestRedirectUri?: string): string;
34
34
  /**
35
35
  *
36
36
  * @param apiId
@@ -1 +1 @@
1
- {"version":3,"file":"Base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,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;cACa,qBAAqB,CAAC,OAAO,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC;IAqClG;;;;;;OAMG;IACH,cAAc,CAAC,kBAAkB,CAAC,EAAE,MAAM,GAAG,MAAM;IAMnD;;;;;OAKG;IACH,SAAS,CAAC,gCAAgC,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,OAAO,GAAG,sBAAsB;CAa5G"}
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-browser v2.21.0 2022-01-04 */
1
+ /*! @azure/msal-browser v2.22.0 2022-02-08 */
2
2
  'use strict';
3
3
  import { __awaiter, __generator, __assign, __spread } from '../_virtual/_tslib.js';
4
4
  import { AccountEntity, AuthenticationScheme, ClientConfigurationError, StringUtils, UrlString, ServerTelemetryManager } from '@azure/msal-common';
@@ -1 +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, StringUtils } 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 async initializeBaseRequest(request: Partial<BaseAuthRequest>): Promise<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 // Set requested claims hash if claims were requested\n if (request.claims && !StringUtils.isEmpty(request.claims)) {\n request.requestedClaimsHash = await this.browserCrypto.hashString(request.claims);\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,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;KACtF;IAMe,kDAAkB,GAAlC,UAAmC,OAA2B;;;;;6BACtD,OAAO,EAAP,wBAAO;wBACP,IAAI,aAAa,CAAC,kBAAkB,CAAC,OAAO,EAAE,IAAI,CAAC,cAAc,CAAC,gBAAgB,EAAE,EAAE,KAAK,CAAC,EAAE;4BAC1F,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,gCAAgC,CAAC,CAAC;4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ACjC,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;;;;"}
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, StringUtils } 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 async initializeBaseRequest(request: Partial<BaseAuthRequest>): Promise<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 // Set requested claims hash if claims were requested\n if (request.claims && !StringUtils.isEmpty(request.claims)) {\n request.requestedClaimsHash = await this.browserCrypto.hashString(request.claims);\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 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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C,IAAM,WAAW,GAAG,kBAAkB,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,IAAI,YAAY,CAAC,aAAa,EAAE,CAAC;QACvG,OAAO,SAAS,CAAC,cAAc,CAAC,WAAW,EAAE,YAAY,CAAC,aAAa,EAAE,CAAC,CAAC;KAC9E;;;;;;;IAQS,gEAAgC,GAA1C,UAA2C,KAAa,EAAE,YAAsB;QAC5E,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,yCAAyC,CAAC,CAAC;QAC/D,IAAM,gBAAgB,GAA2B;YAC7C,QAAQ,EAAE,IAAI,CAAC,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;;;;"}
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-browser v2.21.0 2022-01-04 */
1
+ /*! @azure/msal-browser v2.22.0 2022-02-08 */
2
2
  'use strict';
3
3
  import { __extends } from '../_virtual/_tslib.js';
4
4
  import { AuthorizationCodeClient } from '@azure/msal-common';
@@ -1,5 +1,6 @@
1
- import { AuthenticationResult } from "@azure/msal-common";
1
+ import { AuthenticationResult, CommonEndSessionRequest } from "@azure/msal-common";
2
2
  import { StandardInteractionClient } from "./StandardInteractionClient";
3
+ import { PopupWindowAttributes } from "../utils/PopupUtils";
3
4
  import { EndSessionPopupRequest } from "../request/EndSessionPopupRequest";
4
5
  import { PopupRequest } from "../request/PopupRequest";
5
6
  export declare class PopupClient extends StandardInteractionClient {
@@ -22,7 +23,7 @@ export declare class PopupClient extends StandardInteractionClient {
22
23
  *
23
24
  * @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.
24
25
  */
25
- private acquireTokenPopupAsync;
26
+ protected acquireTokenPopupAsync(request: PopupRequest, popupName: string, popupWindowAttributes: PopupWindowAttributes, popup?: Window | null): Promise<AuthenticationResult>;
26
27
  /**
27
28
  *
28
29
  * @param validRequest
@@ -32,6 +33,6 @@ export declare class PopupClient extends StandardInteractionClient {
32
33
  * @param mainWindowRedirectUri
33
34
  * @param popupWindowAttributes
34
35
  */
35
- private logoutPopupAsync;
36
+ protected logoutPopupAsync(validRequest: CommonEndSessionRequest, popupName: string, popupWindowAttributes: PopupWindowAttributes, requestAuthority?: string, popup?: Window | null, mainWindowRedirectUri?: string): Promise<void>;
36
37
  }
37
38
  //# sourceMappingURL=PopupClient.d.ts.map
@@ -1 +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;IACG,YAAY,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAsBxE;;;OAGG;IACH,MAAM,CAAC,aAAa,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IA2B7D;;;;;;;;OAQG;YACW,sBAAsB;IAsDpC;;;;;;;;OAQG;YACW,gBAAgB;CAqEjC"}
1
+ {"version":3,"file":"PopupClient.d.ts","sourceRoot":"","sources":["../../src/interaction_client/PopupClient.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,oBAAoB,EAA4E,uBAAuB,EAA6C,MAAM,oBAAoB,CAAC;AACxM,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAc,MAAM,qBAAqB,CAAC;AAIxE,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;IAqBlE;;;OAGG;IACH,MAAM,CAAC,aAAa,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IA2B7D;;;;;;;;OAQG;cACa,sBAAsB,CAAC,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,KAAK,CAAC,EAAE,MAAM,GAAC,IAAI,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAwDlL;;;;;;;;OAQG;cACa,gBAAgB,CAAC,YAAY,EAAE,uBAAuB,EAAE,SAAS,EAAE,MAAM,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,gBAAgB,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAC,IAAI,EAAE,qBAAqB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAmE1O"}
@@ -1,7 +1,7 @@
1
- /*! @azure/msal-browser v2.21.0 2022-01-04 */
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
- import { AuthError, ThrottlingUtils, UrlString } from '@azure/msal-common';
4
+ import { OIDC_DEFAULT_SCOPES, AuthError, ThrottlingUtils, UrlString } from '@azure/msal-common';
5
5
  import { StandardInteractionClient } from './StandardInteractionClient.js';
6
6
  import { PopupUtils } from '../utils/PopupUtils.js';
7
7
  import { EventType } from '../event/EventType.js';
@@ -23,36 +23,25 @@ var PopupClient = /** @class */ (function (_super) {
23
23
  * @param request
24
24
  */
25
25
  PopupClient.prototype.acquireToken = function (request) {
26
- return __awaiter(this, void 0, void 0, function () {
27
- var validRequest, popupName, popupWindowAttributes, popup, e_1;
28
- return __generator(this, function (_a) {
29
- switch (_a.label) {
30
- case 0:
31
- _a.trys.push([0, 2, , 3]);
32
- return [4 /*yield*/, this.preflightInteractiveRequest(request, InteractionType.Popup)];
33
- case 1:
34
- validRequest = _a.sent();
35
- popupName = PopupUtils.generatePopupName(this.config.auth.clientId, validRequest);
36
- popupWindowAttributes = request.popupWindowAttributes || {};
37
- // asyncPopups flag is true. Acquires token without first opening popup. Popup will be opened later asynchronously.
38
- if (this.config.system.asyncPopups) {
39
- this.logger.verbose("asyncPopups set to true, acquiring token");
40
- // Passes on popup position and dimensions if in request
41
- return [2 /*return*/, this.acquireTokenPopupAsync(validRequest, popupName, popupWindowAttributes)];
42
- }
43
- else {
44
- // asyncPopups flag is set to false. Opens popup before acquiring token.
45
- this.logger.verbose("asyncPopup set to false, opening popup before acquiring token");
46
- popup = PopupUtils.openSizedPopup("about:blank", popupName, popupWindowAttributes, this.logger);
47
- return [2 /*return*/, this.acquireTokenPopupAsync(validRequest, popupName, popupWindowAttributes, popup)];
48
- }
49
- case 2:
50
- e_1 = _a.sent();
51
- return [2 /*return*/, Promise.reject(e_1)];
52
- case 3: return [2 /*return*/];
53
- }
54
- });
55
- });
26
+ try {
27
+ var popupName = PopupUtils.generatePopupName(this.config.auth.clientId, request.scopes || OIDC_DEFAULT_SCOPES, request.authority || this.config.auth.authority, this.correlationId);
28
+ var popupWindowAttributes = request.popupWindowAttributes || {};
29
+ // asyncPopups flag is true. Acquires token without first opening popup. Popup will be opened later asynchronously.
30
+ if (this.config.system.asyncPopups) {
31
+ this.logger.verbose("asyncPopups set to true, acquiring token");
32
+ // Passes on popup position and dimensions if in request
33
+ return this.acquireTokenPopupAsync(request, popupName, popupWindowAttributes);
34
+ }
35
+ else {
36
+ // asyncPopups flag is set to false. Opens popup before acquiring token.
37
+ this.logger.verbose("asyncPopup set to false, opening popup before acquiring token");
38
+ var popup = PopupUtils.openSizedPopup("about:blank", popupName, popupWindowAttributes, this.logger);
39
+ return this.acquireTokenPopupAsync(request, popupName, popupWindowAttributes, popup);
40
+ }
41
+ }
42
+ catch (e) {
43
+ return Promise.reject(e);
44
+ }
56
45
  };
57
46
  /**
58
47
  * Clears local cache for the current user then opens a popup window prompting the user to sign-out of the server
@@ -93,26 +82,30 @@ var PopupClient = /** @class */ (function (_super) {
93
82
  *
94
83
  * @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.
95
84
  */
96
- PopupClient.prototype.acquireTokenPopupAsync = function (validRequest, popupName, popupWindowAttributes, popup) {
85
+ PopupClient.prototype.acquireTokenPopupAsync = function (request, popupName, popupWindowAttributes, popup) {
97
86
  return __awaiter(this, void 0, void 0, function () {
98
- var serverTelemetryManager, authCodeRequest, authClient, navigateUrl, interactionHandler, popupParameters, popupWindow, hash, state, result, e_2;
87
+ var serverTelemetryManager, validRequest, authCodeRequest, authClient, navigateUrl, interactionHandler, popupParameters, popupWindow, hash, state, result, e_1;
99
88
  return __generator(this, function (_a) {
100
89
  switch (_a.label) {
101
90
  case 0:
102
91
  this.logger.verbose("acquireTokenPopupAsync called");
103
92
  serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenPopup);
104
- _a.label = 1;
93
+ return [4 /*yield*/, this.initializeAuthorizationRequest(request, InteractionType.Popup)];
105
94
  case 1:
106
- _a.trys.push([1, 7, , 8]);
107
- return [4 /*yield*/, this.initializeAuthorizationCodeRequest(validRequest)];
95
+ validRequest = _a.sent();
96
+ this.browserStorage.updateCacheEntries(validRequest.state, validRequest.nonce, validRequest.authority, validRequest.loginHint || "", validRequest.account || null);
97
+ _a.label = 2;
108
98
  case 2:
109
- authCodeRequest = _a.sent();
110
- return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, validRequest.authority)];
99
+ _a.trys.push([2, 8, , 9]);
100
+ return [4 /*yield*/, this.initializeAuthorizationCodeRequest(validRequest)];
111
101
  case 3:
102
+ authCodeRequest = _a.sent();
103
+ return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, validRequest.authority, validRequest.azureCloudOptions)];
104
+ case 4:
112
105
  authClient = _a.sent();
113
106
  this.logger.verbose("Auth code client created");
114
107
  return [4 /*yield*/, authClient.getAuthCodeUrl(validRequest)];
115
- case 4:
108
+ case 5:
116
109
  navigateUrl = _a.sent();
117
110
  interactionHandler = new PopupHandler(authClient, this.browserStorage, authCodeRequest, this.logger);
118
111
  popupParameters = {
@@ -123,28 +116,28 @@ var PopupClient = /** @class */ (function (_super) {
123
116
  popupWindow = interactionHandler.initiateAuthRequest(navigateUrl, popupParameters);
124
117
  this.eventHandler.emitEvent(EventType.POPUP_OPENED, InteractionType.Popup, { popupWindow: popupWindow }, null);
125
118
  return [4 /*yield*/, interactionHandler.monitorPopupForHash(popupWindow)];
126
- case 5:
119
+ case 6:
127
120
  hash = _a.sent();
128
121
  state = this.validateAndExtractStateFromHash(hash, InteractionType.Popup, validRequest.correlationId);
129
122
  // Remove throttle if it exists
130
123
  ThrottlingUtils.removeThrottle(this.browserStorage, this.config.auth.clientId, authCodeRequest);
131
124
  return [4 /*yield*/, interactionHandler.handleCodeResponseFromHash(hash, state, authClient.authority, this.networkClient)];
132
- case 6:
125
+ case 7:
133
126
  result = _a.sent();
134
127
  return [2 /*return*/, result];
135
- case 7:
136
- e_2 = _a.sent();
128
+ case 8:
129
+ e_1 = _a.sent();
137
130
  if (popup) {
138
131
  // Close the synchronous popup if an error is thrown before the window unload event is registered
139
132
  popup.close();
140
133
  }
141
- if (e_2 instanceof AuthError) {
142
- e_2.setCorrelationId(this.correlationId);
134
+ if (e_1 instanceof AuthError) {
135
+ e_1.setCorrelationId(this.correlationId);
143
136
  }
144
- serverTelemetryManager.cacheFailedRequest(e_2);
137
+ serverTelemetryManager.cacheFailedRequest(e_1);
145
138
  this.browserStorage.cleanRequestByState(validRequest.state);
146
- throw e_2;
147
- case 8: return [2 /*return*/];
139
+ throw e_1;
140
+ case 9: return [2 /*return*/];
148
141
  }
149
142
  });
150
143
  });
@@ -160,7 +153,7 @@ var PopupClient = /** @class */ (function (_super) {
160
153
  */
161
154
  PopupClient.prototype.logoutPopupAsync = function (validRequest, popupName, popupWindowAttributes, requestAuthority, popup, mainWindowRedirectUri) {
162
155
  return __awaiter(this, void 0, void 0, function () {
163
- var serverTelemetryManager, authClient, logoutUri, popupUtils, popupWindow, e_3, navigationOptions, absoluteUrl, e_4;
156
+ var serverTelemetryManager, authClient, logoutUri, popupUtils, popupWindow, e_2, navigationOptions, absoluteUrl, e_3;
164
157
  return __generator(this, function (_a) {
165
158
  switch (_a.label) {
166
159
  case 0:
@@ -175,7 +168,6 @@ var PopupClient = /** @class */ (function (_super) {
175
168
  case 2:
176
169
  // Clear cache on logout
177
170
  _a.sent();
178
- this.browserStorage.setInteractionInProgress(true);
179
171
  return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, requestAuthority)];
180
172
  case 3:
181
173
  authClient = _a.sent();
@@ -196,8 +188,8 @@ var PopupClient = /** @class */ (function (_super) {
196
188
  this.logger.verbose("Popup successfully redirected to postLogoutRedirectUri");
197
189
  return [3 /*break*/, 7];
198
190
  case 6:
199
- e_3 = _a.sent();
200
- this.logger.verbose("Error occurred while monitoring popup for same origin. Session on server may remain active. Error: " + e_3);
191
+ e_2 = _a.sent();
192
+ this.logger.verbose("Error occurred while monitoring popup for same origin. Session on server may remain active. Error: " + e_2);
201
193
  return [3 /*break*/, 7];
202
194
  case 7:
203
195
  popupUtils.cleanPopup(popupWindow);
@@ -209,7 +201,7 @@ var PopupClient = /** @class */ (function (_super) {
209
201
  };
210
202
  absoluteUrl = UrlString.getAbsoluteUrl(mainWindowRedirectUri, BrowserUtils.getCurrentUri());
211
203
  this.logger.verbose("Redirecting main window to url specified in the request");
212
- this.logger.verbosePii("Redirecing main window to: " + absoluteUrl);
204
+ this.logger.verbosePii("Redirecting main window to: " + absoluteUrl);
213
205
  this.navigationClient.navigateInternal(absoluteUrl, navigationOptions);
214
206
  }
215
207
  else {
@@ -217,19 +209,19 @@ var PopupClient = /** @class */ (function (_super) {
217
209
  }
218
210
  return [3 /*break*/, 9];
219
211
  case 8:
220
- e_4 = _a.sent();
212
+ e_3 = _a.sent();
221
213
  if (popup) {
222
214
  // Close the synchronous popup if an error is thrown before the window unload event is registered
223
215
  popup.close();
224
216
  }
225
- if (e_4 instanceof AuthError) {
226
- e_4.setCorrelationId(this.correlationId);
217
+ if (e_3 instanceof AuthError) {
218
+ e_3.setCorrelationId(this.correlationId);
227
219
  }
228
220
  this.browserStorage.setInteractionInProgress(false);
229
- this.eventHandler.emitEvent(EventType.LOGOUT_FAILURE, InteractionType.Popup, null, e_4);
221
+ this.eventHandler.emitEvent(EventType.LOGOUT_FAILURE, InteractionType.Popup, null, e_3);
230
222
  this.eventHandler.emitEvent(EventType.LOGOUT_END, InteractionType.Popup);
231
- serverTelemetryManager.cacheFailedRequest(e_4);
232
- throw e_4;
223
+ serverTelemetryManager.cacheFailedRequest(e_3);
224
+ throw e_3;
233
225
  case 9:
234
226
  this.eventHandler.emitEvent(EventType.LOGOUT_END, InteractionType.Popup);
235
227
  return [2 /*return*/];
@@ -1 +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 async acquireToken(request: PopupRequest): Promise<AuthenticationResult> {\n try {\n const validRequest = await 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;;;;;IAlMS,kCAAY,GAAlB,UAAmB,OAAqB;;;;;;;wBAEX,qBAAM,IAAI,CAAC,2BAA2B,CAAC,OAAO,EAAE,eAAe,CAAC,KAAK,CAAC,EAAA;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AAC,CAAC;yBAC1C;wBAED,IAAI,CAAC,cAAc,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC;wBACpD,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,SAAS,CAAC,cAAc,EAAE,eAAe,CAAC,KAAK,EAAE,IAAI,EAAE,GAAC,CAAC,CAAC;wBACtF,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,SAAS,CAAC,UAAU,EAAE,eAAe,CAAC,KAAK,CAAC,CAAC;wBACzE,sBAAsB,CAAC,kBAAkB,CAAC,GAAC,CAAC,CAAC;wBAC7C,MAAM,GAAC,CAAC;;wBAGZ,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,SAAS,CAAC,UAAU,EAAE,eAAe,CAAC,KAAK,CAAC,CAAC;;;;;KAC5E;IACL,kBAAC;AAAD,CAvMA,CAAiC,yBAAyB;;;;"}
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, OIDC_DEFAULT_SCOPES } from \"@azure/msal-common\";\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 popupName = PopupUtils.generatePopupName(this.config.auth.clientId, request.scopes || OIDC_DEFAULT_SCOPES, request.authority || this.config.auth.authority, this.correlationId);\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(request, 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(request, 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 protected async acquireTokenPopupAsync(request: PopupRequest, popupName: string, popupWindowAttributes: PopupWindowAttributes, popup?: Window|null): Promise<AuthenticationResult> {\n this.logger.verbose(\"acquireTokenPopupAsync called\");\n const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenPopup);\n const validRequest = await this.initializeAuthorizationRequest(request, InteractionType.Popup);\n this.browserStorage.updateCacheEntries(validRequest.state, validRequest.nonce, validRequest.authority, validRequest.loginHint || \"\", validRequest.account || null);\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, validRequest.azureCloudOptions);\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 protected 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 // 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(`Redirecting main window to: ${absoluteUrl}`);\n this.navigationClient.navigateInternal(absoluteUrl, navigationOptions);\n } else {\n this.logger.verbose(\"No main window navigation requested\");\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;;;;;IAgBiC,+BAAyB;IAA1D;;KAsMC;;;;;IAjMG,kCAAY,GAAZ,UAAa,OAAqB;QAC9B,IAAI;YACA,IAAM,SAAS,GAAG,UAAU,CAAC,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,MAAM,IAAI,mBAAmB,EAAE,OAAO,CAAC,SAAS,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;YACtL,IAAM,qBAAqB,GAAG,OAAO,CAAC,qBAAqB,IAAI,EAAE,CAAC;;YAGlE,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE;gBAChC,IAAI,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IAAI,CAAC,aAAa,CAAC,CAAC;yBAC1C;wBAED,IAAI,CAAC,cAAc,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC;wBACpD,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,SAAS,CAAC,cAAc,EAAE,eAAe,CAAC,KAAK,EAAE,IAAI,EAAE,GAAC,CAAC,CAAC;wBACtF,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,SAAS,CAAC,UAAU,EAAE,eAAe,CAAC,KAAK,CAAC,CAAC;wBACzE,sBAAsB,CAAC,kBAAkB,CAAC,GAAC,CAAC,CAAC;wBAC7C,MAAM,GAAC,CAAC;;wBAGZ,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,SAAS,CAAC,UAAU,EAAE,eAAe,CAAC,KAAK,CAAC,CAAC;;;;;KAC5E;IACL,kBAAC;AAAD,CAtMA,CAAiC,yBAAyB;;;;"}
@@ -1,4 +1,4 @@
1
- import { AuthenticationResult } from "@azure/msal-common";
1
+ import { AuthenticationResult, ServerTelemetryManager } from "@azure/msal-common";
2
2
  import { StandardInteractionClient } from "./StandardInteractionClient";
3
3
  import { EndSessionRequest } from "../request/EndSessionRequest";
4
4
  import { RedirectRequest } from "../request/RedirectRequest";
@@ -20,13 +20,13 @@ export declare class RedirectClient extends StandardInteractionClient {
20
20
  * Returns null if interactionType in the state value is not "redirect" or the hash does not contain known properties
21
21
  * @param hash
22
22
  */
23
- private getRedirectResponseHash;
23
+ protected getRedirectResponseHash(hash: string): string | null;
24
24
  /**
25
25
  * Checks if hash exists and handles in window.
26
26
  * @param hash
27
27
  * @param state
28
28
  */
29
- private handleHash;
29
+ protected handleHash(hash: string, state: string, serverTelemetryManager: ServerTelemetryManager): Promise<AuthenticationResult>;
30
30
  /**
31
31
  * Use to log out the current user, and redirect the user to the postLogoutRedirectUri.
32
32
  * Default behaviour is to redirect the user to `window.location.href`.
@@ -1 +1 @@
1
- {"version":3,"file":"RedirectClient.d.ts","sourceRoot":"","sources":["../../src/interaction_client/RedirectClient.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,oBAAoB,EAAyG,MAAM,oBAAoB,CAAC;AACjK,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAKxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAIjE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE7D,qBAAa,cAAe,SAAQ,yBAAyB;IACzD;;;OAGG;IACG,YAAY,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAsC3D;;;;;OAKG;IACG,qBAAqB,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IA6FhF;;;;OAIG;IACH,OAAO,CAAC,uBAAuB;IAgB/B;;;;OAIG;YACW,UAAU;IAgBxB;;;;OAIG;IACG,MAAM,CAAC,aAAa,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAmD9D;;;OAGG;IACH,SAAS,CAAC,oBAAoB,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM;CAIpE"}
1
+ {"version":3,"file":"RedirectClient.d.ts","sourceRoot":"","sources":["../../src/interaction_client/RedirectClient.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,oBAAoB,EAAiF,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AACjK,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAIxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAIjE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE7D,qBAAa,cAAe,SAAQ,yBAAyB;IACzD;;;OAGG;IACG,YAAY,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAuC3D;;;;;OAKG;IACG,qBAAqB,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IA4FhF;;;;OAIG;IACH,SAAS,CAAC,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAkB9D;;;;OAIG;cACa,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,sBAAsB,EAAE,sBAAsB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAgBtI;;;;OAIG;IACG,MAAM,CAAC,aAAa,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAmD9D;;;OAGG;IACH,SAAS,CAAC,oBAAoB,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM;CAIpE"}
@@ -1,9 +1,9 @@
1
- /*! @azure/msal-browser v2.21.0 2022-01-04 */
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
- import { AuthError, UrlString } from '@azure/msal-common';
4
+ import { UrlString, AuthError } from '@azure/msal-common';
5
5
  import { StandardInteractionClient } from './StandardInteractionClient.js';
6
- import { ApiId, InteractionType, TemporaryCacheKeys } from '../utils/BrowserConstants.js';
6
+ import { TemporaryCacheKeys, ApiId, InteractionType } from '../utils/BrowserConstants.js';
7
7
  import { RedirectHandler } from '../interaction_handler/RedirectHandler.js';
8
8
  import { BrowserUtils } from '../utils/BrowserUtils.js';
9
9
  import { EventType } from '../event/EventType.js';
@@ -27,9 +27,10 @@ var RedirectClient = /** @class */ (function (_super) {
27
27
  var validRequest, serverTelemetryManager, authCodeRequest, authClient, interactionHandler, navigateUrl, redirectStartPage, e_1;
28
28
  return __generator(this, function (_a) {
29
29
  switch (_a.label) {
30
- case 0: return [4 /*yield*/, this.preflightInteractiveRequest(request, InteractionType.Redirect)];
30
+ case 0: return [4 /*yield*/, this.initializeAuthorizationRequest(request, InteractionType.Redirect)];
31
31
  case 1:
32
32
  validRequest = _a.sent();
33
+ this.browserStorage.updateCacheEntries(validRequest.state, validRequest.nonce, validRequest.authority, validRequest.loginHint || "", validRequest.account || null);
33
34
  serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenRedirect);
34
35
  _a.label = 2;
35
36
  case 2:
@@ -37,7 +38,7 @@ var RedirectClient = /** @class */ (function (_super) {
37
38
  return [4 /*yield*/, this.initializeAuthorizationCodeRequest(validRequest)];
38
39
  case 3:
39
40
  authCodeRequest = _a.sent();
40
- return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, validRequest.authority)];
41
+ return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, validRequest.authority, validRequest.azureCloudOptions)];
41
42
  case 4:
42
43
  authClient = _a.sent();
43
44
  this.logger.verbose("Auth code client created");
@@ -99,7 +100,6 @@ var RedirectClient = /** @class */ (function (_super) {
99
100
  state = void 0;
100
101
  try {
101
102
  state = this.validateAndExtractStateFromHash(responseHash, InteractionType.Redirect);
102
- BrowserUtils.clearHash(window);
103
103
  this.logger.verbose("State extracted from hash");
104
104
  }
105
105
  catch (e) {
@@ -183,12 +183,13 @@ var RedirectClient = /** @class */ (function (_super) {
183
183
  this.logger.verbose("getRedirectResponseHash called");
184
184
  // Get current location hash from window or cache.
185
185
  var isResponseHash = UrlString.hashContainsKnownProperties(hash);
186
- var cachedHash = this.browserStorage.getTemporaryCache(TemporaryCacheKeys.URL_HASH, true);
187
- this.browserStorage.removeItem(this.browserStorage.generateCacheKey(TemporaryCacheKeys.URL_HASH));
188
186
  if (isResponseHash) {
187
+ BrowserUtils.clearHash(window);
189
188
  this.logger.verbose("Hash contains known properties, returning response hash");
190
189
  return hash;
191
190
  }
191
+ var cachedHash = this.browserStorage.getTemporaryCache(TemporaryCacheKeys.URL_HASH, true);
192
+ this.browserStorage.removeItem(this.browserStorage.generateCacheKey(TemporaryCacheKeys.URL_HASH));
192
193
  this.logger.verbose("Hash does not contain known properties, returning cached hash");
193
194
  return cachedHash;
194
195
  };