@azure/msal-browser 2.19.0 → 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 (95) hide show
  1. package/CHANGELOG.json +43 -0
  2. package/CHANGELOG.md +14 -1
  3. package/README.md +3 -1
  4. package/dist/_virtual/_tslib.js +1 -1
  5. package/dist/app/ClientApplication.d.ts +19 -0
  6. package/dist/app/ClientApplication.d.ts.map +1 -1
  7. package/dist/app/ClientApplication.js +76 -1
  8. package/dist/app/ClientApplication.js.map +1 -1
  9. package/dist/app/IPublicClientApplication.d.ts +2 -0
  10. package/dist/app/IPublicClientApplication.d.ts.map +1 -1
  11. package/dist/app/IPublicClientApplication.js +4 -1
  12. package/dist/app/IPublicClientApplication.js.map +1 -1
  13. package/dist/app/PublicClientApplication.js +1 -1
  14. package/dist/cache/AsyncMemoryStorage.d.ts +1 -1
  15. package/dist/cache/AsyncMemoryStorage.d.ts.map +1 -1
  16. package/dist/cache/AsyncMemoryStorage.js +2 -2
  17. package/dist/cache/AsyncMemoryStorage.js.map +1 -1
  18. package/dist/cache/BrowserCacheManager.js +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.js +1 -1
  23. package/dist/config/Configuration.js +1 -1
  24. package/dist/crypto/BrowserCrypto.js +1 -1
  25. package/dist/crypto/CryptoOps.js +1 -1
  26. package/dist/crypto/GuidGenerator.js +1 -1
  27. package/dist/crypto/PkceGenerator.js +1 -1
  28. package/dist/crypto/SignedHttpRequest.js +1 -1
  29. package/dist/encode/Base64Decode.js +1 -1
  30. package/dist/encode/Base64Encode.js +1 -1
  31. package/dist/error/BrowserAuthError.d.ts +8 -0
  32. package/dist/error/BrowserAuthError.d.ts.map +1 -1
  33. package/dist/error/BrowserAuthError.js +11 -1
  34. package/dist/error/BrowserAuthError.js.map +1 -1
  35. package/dist/error/BrowserConfigurationAuthError.js +1 -1
  36. package/dist/event/EventHandler.js +1 -1
  37. package/dist/event/EventMessage.js +1 -1
  38. package/dist/event/EventType.d.ts +3 -0
  39. package/dist/event/EventType.d.ts.map +1 -1
  40. package/dist/event/EventType.js +4 -1
  41. package/dist/event/EventType.js.map +1 -1
  42. package/dist/index.cjs.js +300 -77
  43. package/dist/index.cjs.js.map +1 -1
  44. package/dist/index.d.ts +1 -0
  45. package/dist/index.d.ts.map +1 -1
  46. package/dist/index.js +1 -1
  47. package/dist/interaction_client/BaseInteractionClient.js +1 -1
  48. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.d.ts +5 -0
  49. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.d.ts.map +1 -0
  50. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.js +21 -0
  51. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.js.map +1 -0
  52. package/dist/interaction_client/PopupClient.js +2 -2
  53. package/dist/interaction_client/PopupClient.js.map +1 -1
  54. package/dist/interaction_client/RedirectClient.js +2 -2
  55. package/dist/interaction_client/RedirectClient.js.map +1 -1
  56. package/dist/interaction_client/SilentAuthCodeClient.d.ts +22 -0
  57. package/dist/interaction_client/SilentAuthCodeClient.d.ts.map +1 -0
  58. package/dist/interaction_client/SilentAuthCodeClient.js +80 -0
  59. package/dist/interaction_client/SilentAuthCodeClient.js.map +1 -0
  60. package/dist/interaction_client/SilentCacheClient.js +1 -1
  61. package/dist/interaction_client/SilentIframeClient.js +2 -2
  62. package/dist/interaction_client/SilentIframeClient.js.map +1 -1
  63. package/dist/interaction_client/SilentRefreshClient.js +1 -1
  64. package/dist/interaction_client/StandardInteractionClient.js +1 -1
  65. package/dist/interaction_handler/InteractionHandler.d.ts +11 -2
  66. package/dist/interaction_handler/InteractionHandler.d.ts.map +1 -1
  67. package/dist/interaction_handler/InteractionHandler.js +36 -10
  68. package/dist/interaction_handler/InteractionHandler.js.map +1 -1
  69. package/dist/interaction_handler/PopupHandler.js +1 -1
  70. package/dist/interaction_handler/RedirectHandler.d.ts +1 -1
  71. package/dist/interaction_handler/RedirectHandler.d.ts.map +1 -1
  72. package/dist/interaction_handler/RedirectHandler.js +2 -2
  73. package/dist/interaction_handler/RedirectHandler.js.map +1 -1
  74. package/dist/interaction_handler/SilentHandler.js +1 -1
  75. package/dist/navigation/NavigationClient.js +1 -1
  76. package/dist/network/FetchClient.js +1 -1
  77. package/dist/network/XhrClient.js +1 -1
  78. package/dist/packageMetadata.d.ts +1 -1
  79. package/dist/packageMetadata.js +2 -2
  80. package/dist/packageMetadata.js.map +1 -1
  81. package/dist/request/AuthorizationCodeRequest.d.ts +8 -0
  82. package/dist/request/AuthorizationCodeRequest.d.ts.map +1 -0
  83. package/dist/utils/BrowserConstants.d.ts +1 -0
  84. package/dist/utils/BrowserConstants.d.ts.map +1 -1
  85. package/dist/utils/BrowserConstants.js +2 -1
  86. package/dist/utils/BrowserConstants.js.map +1 -1
  87. package/dist/utils/BrowserProtocolUtils.js +1 -1
  88. package/dist/utils/BrowserStringUtils.js +1 -1
  89. package/dist/utils/BrowserUtils.js +1 -1
  90. package/dist/utils/MathUtils.js +1 -1
  91. package/dist/utils/PopupUtils.js +1 -1
  92. package/lib/msal-browser.js +300 -77
  93. package/lib/msal-browser.js.map +1 -1
  94. package/lib/msal-browser.min.js +27 -27
  95. package/package.json +3 -2
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-browser v2.19.0 2021-11-02 */
1
+ /*! @azure/msal-browser v2.20.0 2021-12-07 */
2
2
  'use strict';
3
3
  (function (global, factory) {
4
4
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
@@ -107,7 +107,7 @@
107
107
  return ar;
108
108
  }
109
109
 
110
- /*! @azure/msal-common v5.1.0 2021-11-02 */
110
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
111
111
  /*! *****************************************************************************
112
112
  Copyright (c) Microsoft Corporation.
113
113
 
@@ -194,7 +194,7 @@
194
194
  return r;
195
195
  }
196
196
 
197
- /*! @azure/msal-common v5.1.0 2021-11-02 */
197
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
198
198
 
199
199
  /*
200
200
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -331,6 +331,7 @@
331
331
  AADServerParamKeys["ON_BEHALF_OF"] = "on_behalf_of";
332
332
  AADServerParamKeys["FOCI"] = "foci";
333
333
  AADServerParamKeys["CCS_HEADER"] = "X-AnchorMailbox";
334
+ AADServerParamKeys["RETURN_SPA_CODE"] = "return_spa_code";
334
335
  })(AADServerParamKeys || (AADServerParamKeys = {}));
335
336
  /**
336
337
  * Claims request keys
@@ -555,7 +556,7 @@
555
556
  CacheOutcome["REFRESH_CACHED_ACCESS_TOKEN"] = "4";
556
557
  })(CacheOutcome || (CacheOutcome = {}));
557
558
 
558
- /*! @azure/msal-common v5.1.0 2021-11-02 */
559
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
559
560
 
560
561
  /*
561
562
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -599,7 +600,7 @@
599
600
  return AuthError;
600
601
  }(Error));
601
602
 
602
- /*! @azure/msal-common v5.1.0 2021-11-02 */
603
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
603
604
 
604
605
  /*
605
606
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -665,7 +666,7 @@
665
666
  }
666
667
  };
667
668
 
668
- /*! @azure/msal-common v5.1.0 2021-11-02 */
669
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
669
670
 
670
671
  /*
671
672
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1127,7 +1128,7 @@
1127
1128
  return ClientAuthError;
1128
1129
  }(AuthError));
1129
1130
 
1130
- /*! @azure/msal-common v5.1.0 2021-11-02 */
1131
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
1131
1132
 
1132
1133
  /*
1133
1134
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1252,7 +1253,7 @@
1252
1253
  return StringUtils;
1253
1254
  }());
1254
1255
 
1255
- /*! @azure/msal-common v5.1.0 2021-11-02 */
1256
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
1256
1257
 
1257
1258
  /*
1258
1259
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1432,12 +1433,12 @@
1432
1433
  return Logger;
1433
1434
  }());
1434
1435
 
1435
- /*! @azure/msal-common v5.1.0 2021-11-02 */
1436
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
1436
1437
  /* eslint-disable header/header */
1437
1438
  var name$1 = "@azure/msal-common";
1438
- var version$1 = "5.1.0";
1439
+ var version$1 = "5.2.0";
1439
1440
 
1440
- /*! @azure/msal-common v5.1.0 2021-11-02 */
1441
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
1441
1442
 
1442
1443
  /*
1443
1444
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1581,7 +1582,7 @@
1581
1582
  return CredentialEntity;
1582
1583
  }());
1583
1584
 
1584
- /*! @azure/msal-common v5.1.0 2021-11-02 */
1585
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
1585
1586
 
1586
1587
  /*
1587
1588
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1826,7 +1827,7 @@
1826
1827
  return ClientConfigurationError;
1827
1828
  }(ClientAuthError));
1828
1829
 
1829
- /*! @azure/msal-common v5.1.0 2021-11-02 */
1830
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
1830
1831
 
1831
1832
  /*
1832
1833
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2010,7 +2011,7 @@
2010
2011
  return ScopeSet;
2011
2012
  }());
2012
2013
 
2013
- /*! @azure/msal-common v5.1.0 2021-11-02 */
2014
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
2014
2015
 
2015
2016
  /*
2016
2017
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2048,7 +2049,7 @@
2048
2049
  };
2049
2050
  }
2050
2051
 
2051
- /*! @azure/msal-common v5.1.0 2021-11-02 */
2052
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
2052
2053
  /*
2053
2054
  * Copyright (c) Microsoft Corporation. All rights reserved.
2054
2055
  * Licensed under the MIT License.
@@ -2062,7 +2063,7 @@
2062
2063
  AuthorityType[AuthorityType["Adfs"] = 1] = "Adfs";
2063
2064
  })(AuthorityType || (AuthorityType = {}));
2064
2065
 
2065
- /*! @azure/msal-common v5.1.0 2021-11-02 */
2066
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
2066
2067
 
2067
2068
  /*
2068
2069
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2296,7 +2297,7 @@
2296
2297
  return AccountEntity;
2297
2298
  }());
2298
2299
 
2299
- /*! @azure/msal-common v5.1.0 2021-11-02 */
2300
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
2300
2301
 
2301
2302
  /*
2302
2303
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2334,7 +2335,7 @@
2334
2335
  return AuthToken;
2335
2336
  }());
2336
2337
 
2337
- /*! @azure/msal-common v5.1.0 2021-11-02 */
2338
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
2338
2339
 
2339
2340
  /*
2340
2341
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3166,7 +3167,7 @@
3166
3167
  return DefaultStorageClass;
3167
3168
  }(CacheManager));
3168
3169
 
3169
- /*! @azure/msal-common v5.1.0 2021-11-02 */
3170
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
3170
3171
 
3171
3172
  /*
3172
3173
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3248,7 +3249,7 @@
3248
3249
  return __assign({ clientCapabilities: [] }, authOptions);
3249
3250
  }
3250
3251
 
3251
- /*! @azure/msal-common v5.1.0 2021-11-02 */
3252
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
3252
3253
 
3253
3254
  /*
3254
3255
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3268,7 +3269,7 @@
3268
3269
  return ServerError;
3269
3270
  }(AuthError));
3270
3271
 
3271
- /*! @azure/msal-common v5.1.0 2021-11-02 */
3272
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
3272
3273
 
3273
3274
  /*
3274
3275
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3364,7 +3365,7 @@
3364
3365
  return ThrottlingUtils;
3365
3366
  }());
3366
3367
 
3367
- /*! @azure/msal-common v5.1.0 2021-11-02 */
3368
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
3368
3369
 
3369
3370
  /*
3370
3371
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3413,7 +3414,7 @@
3413
3414
  return NetworkManager;
3414
3415
  }());
3415
3416
 
3416
- /*! @azure/msal-common v5.1.0 2021-11-02 */
3417
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
3417
3418
  /*
3418
3419
  * Copyright (c) Microsoft Corporation. All rights reserved.
3419
3420
  * Licensed under the MIT License.
@@ -3424,7 +3425,7 @@
3424
3425
  CcsCredentialType["UPN"] = "UPN";
3425
3426
  })(CcsCredentialType || (CcsCredentialType = {}));
3426
3427
 
3427
- /*! @azure/msal-common v5.1.0 2021-11-02 */
3428
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
3428
3429
 
3429
3430
  /*
3430
3431
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3513,7 +3514,7 @@
3513
3514
  return BaseClient;
3514
3515
  }());
3515
3516
 
3516
- /*! @azure/msal-common v5.1.0 2021-11-02 */
3517
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
3517
3518
 
3518
3519
  /*
3519
3520
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3599,7 +3600,7 @@
3599
3600
  return RequestValidator;
3600
3601
  }());
3601
3602
 
3602
- /*! @azure/msal-common v5.1.0 2021-11-02 */
3603
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
3603
3604
 
3604
3605
  /*
3605
3606
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3939,7 +3940,7 @@
3939
3940
  return RequestParameterBuilder;
3940
3941
  }());
3941
3942
 
3942
- /*! @azure/msal-common v5.1.0 2021-11-02 */
3943
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
3943
3944
 
3944
3945
  /*
3945
3946
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4004,7 +4005,7 @@
4004
4005
  return IdTokenEntity;
4005
4006
  }(CredentialEntity));
4006
4007
 
4007
- /*! @azure/msal-common v5.1.0 2021-11-02 */
4008
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
4008
4009
  /*
4009
4010
  * Copyright (c) Microsoft Corporation. All rights reserved.
4010
4011
  * Licensed under the MIT License.
@@ -4054,7 +4055,7 @@
4054
4055
  return TimeUtils;
4055
4056
  }());
4056
4057
 
4057
- /*! @azure/msal-common v5.1.0 2021-11-02 */
4058
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
4058
4059
 
4059
4060
  /*
4060
4061
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4161,7 +4162,7 @@
4161
4162
  return AccessTokenEntity;
4162
4163
  }(CredentialEntity));
4163
4164
 
4164
- /*! @azure/msal-common v5.1.0 2021-11-02 */
4165
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
4165
4166
 
4166
4167
  /*
4167
4168
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4228,7 +4229,7 @@
4228
4229
  return RefreshTokenEntity;
4229
4230
  }(CredentialEntity));
4230
4231
 
4231
- /*! @azure/msal-common v5.1.0 2021-11-02 */
4232
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
4232
4233
 
4233
4234
  /*
4234
4235
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4292,7 +4293,7 @@
4292
4293
  return InteractionRequiredAuthError;
4293
4294
  }(AuthError));
4294
4295
 
4295
- /*! @azure/msal-common v5.1.0 2021-11-02 */
4296
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
4296
4297
  /*
4297
4298
  * Copyright (c) Microsoft Corporation. All rights reserved.
4298
4299
  * Licensed under the MIT License.
@@ -4308,7 +4309,7 @@
4308
4309
  return CacheRecord;
4309
4310
  }());
4310
4311
 
4311
- /*! @azure/msal-common v5.1.0 2021-11-02 */
4312
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
4312
4313
 
4313
4314
  /*
4314
4315
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4379,7 +4380,7 @@
4379
4380
  return ProtocolUtils;
4380
4381
  }());
4381
4382
 
4382
- /*! @azure/msal-common v5.1.0 2021-11-02 */
4383
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
4383
4384
 
4384
4385
  /*
4385
4386
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4580,7 +4581,7 @@
4580
4581
  return UrlString;
4581
4582
  }());
4582
4583
 
4583
- /*! @azure/msal-common v5.1.0 2021-11-02 */
4584
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
4584
4585
 
4585
4586
  /*
4586
4587
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4655,7 +4656,7 @@
4655
4656
  return PopTokenGenerator;
4656
4657
  }());
4657
4658
 
4658
- /*! @azure/msal-common v5.1.0 2021-11-02 */
4659
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
4659
4660
 
4660
4661
  /*
4661
4662
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4725,7 +4726,7 @@
4725
4726
  return AppMetadataEntity;
4726
4727
  }());
4727
4728
 
4728
- /*! @azure/msal-common v5.1.0 2021-11-02 */
4729
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
4729
4730
  /*
4730
4731
  * Copyright (c) Microsoft Corporation. All rights reserved.
4731
4732
  * Licensed under the MIT License.
@@ -4761,7 +4762,7 @@
4761
4762
  return TokenCacheContext;
4762
4763
  }());
4763
4764
 
4764
- /*! @azure/msal-common v5.1.0 2021-11-02 */
4765
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
4765
4766
 
4766
4767
  /*
4767
4768
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4881,7 +4882,7 @@
4881
4882
  _a.sent();
4882
4883
  _a.label = 7;
4883
4884
  case 7: return [7 /*endfinally*/];
4884
- case 8: return [2 /*return*/, ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, idTokenObj, requestStateObj)];
4885
+ case 8: return [2 /*return*/, ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, idTokenObj, requestStateObj, serverTokenResponse.spa_code)];
4885
4886
  }
4886
4887
  });
4887
4888
  });
@@ -4967,7 +4968,7 @@
4967
4968
  * @param fromTokenCache
4968
4969
  * @param stateString
4969
4970
  */
4970
- ResponseHandler.generateAuthenticationResult = function (cryptoObj, authority, cacheRecord, fromTokenCache, request, idTokenObj, requestState) {
4971
+ ResponseHandler.generateAuthenticationResult = function (cryptoObj, authority, cacheRecord, fromTokenCache, request, idTokenObj, requestState, code) {
4971
4972
  var _a, _b, _c;
4972
4973
  return __awaiter(this, void 0, void 0, function () {
4973
4974
  var accessToken, responseScopes, expiresOn, extExpiresOn, familyId, popTokenGenerator, uid, tid;
@@ -5016,7 +5017,8 @@
5016
5017
  tokenType: ((_a = cacheRecord.accessToken) === null || _a === void 0 ? void 0 : _a.tokenType) || Constants.EMPTY_STRING,
5017
5018
  state: requestState ? requestState.userRequestState : Constants.EMPTY_STRING,
5018
5019
  cloudGraphHostName: ((_b = cacheRecord.account) === null || _b === void 0 ? void 0 : _b.cloudGraphHostName) || Constants.EMPTY_STRING,
5019
- msGraphHost: ((_c = cacheRecord.account) === null || _c === void 0 ? void 0 : _c.msGraphHost) || Constants.EMPTY_STRING
5020
+ msGraphHost: ((_c = cacheRecord.account) === null || _c === void 0 ? void 0 : _c.msGraphHost) || Constants.EMPTY_STRING,
5021
+ code: code
5020
5022
  }];
5021
5023
  }
5022
5024
  });
@@ -5025,7 +5027,7 @@
5025
5027
  return ResponseHandler;
5026
5028
  }());
5027
5029
 
5028
- /*! @azure/msal-common v5.1.0 2021-11-02 */
5030
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
5029
5031
 
5030
5032
  /*
5031
5033
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5037,7 +5039,10 @@
5037
5039
  var AuthorizationCodeClient = /** @class */ (function (_super) {
5038
5040
  __extends(AuthorizationCodeClient, _super);
5039
5041
  function AuthorizationCodeClient(configuration) {
5040
- return _super.call(this, configuration) || this;
5042
+ var _this = _super.call(this, configuration) || this;
5043
+ // Flag to indicate if client is for hybrid spa auth code redemption
5044
+ _this.includeRedirectUri = true;
5045
+ return _this;
5041
5046
  }
5042
5047
  /**
5043
5048
  * Creates the URL of the authorization request letting the user input credentials and consent to the
@@ -5186,13 +5191,24 @@
5186
5191
  AuthorizationCodeClient.prototype.createTokenRequestBody = function (request) {
5187
5192
  return __awaiter(this, void 0, void 0, function () {
5188
5193
  var parameterBuilder, clientAssertion, popTokenGenerator, cnfString, correlationId, ccsCred, clientInfo, clientInfo;
5189
- return __generator(this, function (_a) {
5190
- switch (_a.label) {
5194
+ var _a;
5195
+ return __generator(this, function (_b) {
5196
+ switch (_b.label) {
5191
5197
  case 0:
5192
5198
  parameterBuilder = new RequestParameterBuilder();
5193
5199
  parameterBuilder.addClientId(this.config.authOptions.clientId);
5194
- // validate the redirectUri (to be a non null value)
5195
- parameterBuilder.addRedirectUri(request.redirectUri);
5200
+ /*
5201
+ * For hybrid spa flow, there will be a code but no verifier
5202
+ * In this scenario, don't include redirect uri as auth code will not be bound to redirect URI
5203
+ */
5204
+ if (!this.includeRedirectUri) {
5205
+ // Just validate
5206
+ RequestValidator.validateRedirectUri(request.redirectUri);
5207
+ }
5208
+ else {
5209
+ // Validate and include redirect uri
5210
+ parameterBuilder.addRedirectUri(request.redirectUri);
5211
+ }
5196
5212
  // Add scope array, parameter builder will add default scopes and dedupe
5197
5213
  parameterBuilder.addScopes(request.scopes);
5198
5214
  // add code: user set, not validated
@@ -5221,7 +5237,7 @@
5221
5237
  popTokenGenerator = new PopTokenGenerator(this.cryptoUtils);
5222
5238
  return [4 /*yield*/, popTokenGenerator.generateCnf(request)];
5223
5239
  case 1:
5224
- cnfString = _a.sent();
5240
+ cnfString = _b.sent();
5225
5241
  parameterBuilder.addPopToken(cnfString);
5226
5242
  return [3 /*break*/, 3];
5227
5243
  case 2:
@@ -5233,7 +5249,7 @@
5233
5249
  throw ClientConfigurationError.createMissingSshJwkError();
5234
5250
  }
5235
5251
  }
5236
- _a.label = 3;
5252
+ _b.label = 3;
5237
5253
  case 3:
5238
5254
  correlationId = request.correlationId || this.config.cryptoInterface.createNewGuid();
5239
5255
  parameterBuilder.addCorrelationId(correlationId);
@@ -5273,6 +5289,15 @@
5273
5289
  break;
5274
5290
  }
5275
5291
  }
5292
+ if (request.tokenBodyParameters) {
5293
+ parameterBuilder.addExtraQueryParameters(request.tokenBodyParameters);
5294
+ }
5295
+ // Add hybrid spa parameters if not already provided
5296
+ if (request.enableSpaAuthorizationCode && (!request.tokenBodyParameters || !request.tokenBodyParameters[AADServerParamKeys.RETURN_SPA_CODE])) {
5297
+ parameterBuilder.addExtraQueryParameters((_a = {},
5298
+ _a[AADServerParamKeys.RETURN_SPA_CODE] = "1",
5299
+ _a));
5300
+ }
5276
5301
  return [2 /*return*/, parameterBuilder.createQueryString()];
5277
5302
  }
5278
5303
  });
@@ -5410,7 +5435,7 @@
5410
5435
  return AuthorizationCodeClient;
5411
5436
  }(BaseClient));
5412
5437
 
5413
- /*! @azure/msal-common v5.1.0 2021-11-02 */
5438
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
5414
5439
 
5415
5440
  /*
5416
5441
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5621,7 +5646,7 @@
5621
5646
  return RefreshTokenClient;
5622
5647
  }(BaseClient));
5623
5648
 
5624
- /*! @azure/msal-common v5.1.0 2021-11-02 */
5649
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
5625
5650
 
5626
5651
  /*
5627
5652
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5744,7 +5769,7 @@
5744
5769
  return SilentFlowClient;
5745
5770
  }(BaseClient));
5746
5771
 
5747
- /*! @azure/msal-common v5.1.0 2021-11-02 */
5772
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
5748
5773
  /*
5749
5774
  * Copyright (c) Microsoft Corporation. All rights reserved.
5750
5775
  * Licensed under the MIT License.
@@ -5755,7 +5780,7 @@
5755
5780
  response.hasOwnProperty("issuer"));
5756
5781
  }
5757
5782
 
5758
- /*! @azure/msal-common v5.1.0 2021-11-02 */
5783
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
5759
5784
  /*
5760
5785
  * Copyright (c) Microsoft Corporation. All rights reserved.
5761
5786
  * Licensed under the MIT License.
@@ -5769,7 +5794,7 @@
5769
5794
  ProtocolMode["OIDC"] = "OIDC";
5770
5795
  })(exports.ProtocolMode || (exports.ProtocolMode = {}));
5771
5796
 
5772
- /*! @azure/msal-common v5.1.0 2021-11-02 */
5797
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
5773
5798
 
5774
5799
  /*
5775
5800
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5844,7 +5869,7 @@
5844
5869
  return AuthorityMetadataEntity;
5845
5870
  }());
5846
5871
 
5847
- /*! @azure/msal-common v5.1.0 2021-11-02 */
5872
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
5848
5873
  /*
5849
5874
  * Copyright (c) Microsoft Corporation. All rights reserved.
5850
5875
  * Licensed under the MIT License.
@@ -5854,7 +5879,7 @@
5854
5879
  response.hasOwnProperty("metadata"));
5855
5880
  }
5856
5881
 
5857
- /*! @azure/msal-common v5.1.0 2021-11-02 */
5882
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
5858
5883
 
5859
5884
  /*
5860
5885
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5968,7 +5993,7 @@
5968
5993
  return RegionDiscovery;
5969
5994
  }());
5970
5995
 
5971
- /*! @azure/msal-common v5.1.0 2021-11-02 */
5996
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
5972
5997
 
5973
5998
  /*
5974
5999
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6534,7 +6559,7 @@
6534
6559
  return Authority;
6535
6560
  }());
6536
6561
 
6537
- /*! @azure/msal-common v5.1.0 2021-11-02 */
6562
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
6538
6563
 
6539
6564
  /*
6540
6565
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6595,7 +6620,7 @@
6595
6620
  return AuthorityFactory;
6596
6621
  }());
6597
6622
 
6598
- /*! @azure/msal-common v5.1.0 2021-11-02 */
6623
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
6599
6624
 
6600
6625
  /*
6601
6626
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6626,7 +6651,7 @@
6626
6651
  return ServerTelemetryEntity;
6627
6652
  }());
6628
6653
 
6629
- /*! @azure/msal-common v5.1.0 2021-11-02 */
6654
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
6630
6655
 
6631
6656
  /*
6632
6657
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6654,7 +6679,7 @@
6654
6679
  return ThrottlingEntity;
6655
6680
  }());
6656
6681
 
6657
- /*! @azure/msal-common v5.1.0 2021-11-02 */
6682
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
6658
6683
 
6659
6684
  /*
6660
6685
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6671,7 +6696,7 @@
6671
6696
  }
6672
6697
  };
6673
6698
 
6674
- /*! @azure/msal-common v5.1.0 2021-11-02 */
6699
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
6675
6700
 
6676
6701
  /*
6677
6702
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6730,7 +6755,7 @@
6730
6755
  return AuthenticationHeaderParser;
6731
6756
  }());
6732
6757
 
6733
- /*! @azure/msal-common v5.1.0 2021-11-02 */
6758
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
6734
6759
 
6735
6760
  /*
6736
6761
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6983,6 +7008,7 @@
6983
7008
  ApiId[ApiId["ssoSilent"] = 863] = "ssoSilent";
6984
7009
  ApiId[ApiId["acquireTokenSilent_authCode"] = 864] = "acquireTokenSilent_authCode";
6985
7010
  ApiId[ApiId["handleRedirectPromise"] = 865] = "handleRedirectPromise";
7011
+ ApiId[ApiId["acquireTokenByCode"] = 866] = "acquireTokenByCode";
6986
7012
  ApiId[ApiId["acquireTokenSilent_silentFlow"] = 61] = "acquireTokenSilent_silentFlow";
6987
7013
  ApiId[ApiId["logout"] = 961] = "logout";
6988
7014
  ApiId[ApiId["logoutPopup"] = 962] = "logoutPopup";
@@ -7573,6 +7599,10 @@
7573
7599
  code: "crypto_key_not_found",
7574
7600
  desc: "Cryptographic Key or Keypair not found in browser storage."
7575
7601
  },
7602
+ authCodeRequired: {
7603
+ code: "auth_code_required",
7604
+ desc: "An authorization code must be provided (as the `code` property on the request) to this flow."
7605
+ },
7576
7606
  databaseUnavailable: {
7577
7607
  code: "database_unavailable",
7578
7608
  desc: "IndexedDB, which is required for persistent cryptographic key storage, is unavailable. This may be caused by browser privacy features which block persistent storage in third-party contexts."
@@ -7809,6 +7839,12 @@
7809
7839
  BrowserAuthError.createSigningKeyNotFoundInStorageError = function (keyId) {
7810
7840
  return new BrowserAuthError(BrowserAuthErrorMessage.signingKeyNotFoundInStorage.code, BrowserAuthErrorMessage.signingKeyNotFoundInStorage.desc + " | No match found for KeyId: " + keyId);
7811
7841
  };
7842
+ /**
7843
+ * Create an error when an authorization code is required but not provided
7844
+ */
7845
+ BrowserAuthError.createAuthCodeRequiredError = function () {
7846
+ return new BrowserAuthError(BrowserAuthErrorMessage.authCodeRequired.code, BrowserAuthErrorMessage.authCodeRequired.desc);
7847
+ };
7812
7848
  /**
7813
7849
  * Create an error when IndexedDB is unavailable
7814
7850
  */
@@ -10297,7 +10333,7 @@
10297
10333
 
10298
10334
  /* eslint-disable header/header */
10299
10335
  var name = "@azure/msal-browser";
10300
- var version = "2.19.0";
10336
+ var version = "2.20.0";
10301
10337
 
10302
10338
  /*
10303
10339
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -10317,6 +10353,9 @@
10317
10353
  EventType["SSO_SILENT_START"] = "msal:ssoSilentStart";
10318
10354
  EventType["SSO_SILENT_SUCCESS"] = "msal:ssoSilentSuccess";
10319
10355
  EventType["SSO_SILENT_FAILURE"] = "msal:ssoSilentFailure";
10356
+ EventType["ACQUIRE_TOKEN_BY_CODE_START"] = "msal:acquireTokenByCodeStart";
10357
+ EventType["ACQUIRE_TOKEN_BY_CODE_SUCCESS"] = "msal:acquireTokenByCodeSuccess";
10358
+ EventType["ACQUIRE_TOKEN_BY_CODE_FAILURE"] = "msal:acquireTokenByCodeFailure";
10320
10359
  EventType["HANDLE_REDIRECT_START"] = "msal:handleRedirectStart";
10321
10360
  EventType["HANDLE_REDIRECT_END"] = "msal:handleRedirectEnd";
10322
10361
  EventType["POPUP_OPENED"] = "msal:popupOpened";
@@ -10998,23 +11037,46 @@
10998
11037
  * Function to handle response parameters from hash.
10999
11038
  * @param locationHash
11000
11039
  */
11001
- InteractionHandler.prototype.handleCodeResponse = function (locationHash, state, authority, networkModule) {
11040
+ InteractionHandler.prototype.handleCodeResponseFromHash = function (locationHash, state, authority, networkModule) {
11002
11041
  return __awaiter$1(this, void 0, void 0, function () {
11003
- var stateKey, requestState, authCodeResponse, nonceKey, cachedNonce, cachedCcsCred, tokenResponse;
11042
+ var stateKey, requestState, authCodeResponse;
11043
+ return __generator$1(this, function (_a) {
11044
+ this.browserRequestLogger.verbose("InteractionHandler.handleCodeResponse called");
11045
+ // Check that location hash isn't empty.
11046
+ if (StringUtils.isEmpty(locationHash)) {
11047
+ throw BrowserAuthError.createEmptyHashError(locationHash);
11048
+ }
11049
+ stateKey = this.browserStorage.generateStateKey(state);
11050
+ requestState = this.browserStorage.getTemporaryCache(stateKey);
11051
+ if (!requestState) {
11052
+ throw ClientAuthError.createStateNotFoundError("Cached State");
11053
+ }
11054
+ authCodeResponse = this.authModule.handleFragmentResponse(locationHash, requestState);
11055
+ return [2 /*return*/, this.handleCodeResponseFromServer(authCodeResponse, state, authority, networkModule)];
11056
+ });
11057
+ });
11058
+ };
11059
+ /**
11060
+ * Process auth code response from AAD
11061
+ * @param authCodeResponse
11062
+ * @param state
11063
+ * @param authority
11064
+ * @param networkModule
11065
+ * @returns
11066
+ */
11067
+ InteractionHandler.prototype.handleCodeResponseFromServer = function (authCodeResponse, state, authority, networkModule, validateNonce) {
11068
+ if (validateNonce === void 0) { validateNonce = true; }
11069
+ return __awaiter$1(this, void 0, void 0, function () {
11070
+ var stateKey, requestState, nonceKey, cachedNonce, cachedCcsCred, tokenResponse;
11004
11071
  return __generator$1(this, function (_a) {
11005
11072
  switch (_a.label) {
11006
11073
  case 0:
11007
- this.browserRequestLogger.verbose("InteractionHandler.handleCodeResponse called");
11008
- // Check that location hash isn't empty.
11009
- if (StringUtils.isEmpty(locationHash)) {
11010
- throw BrowserAuthError.createEmptyHashError(locationHash);
11011
- }
11074
+ this.browserRequestLogger.trace("InteractionHandler.handleCodeResponseFromServer called");
11012
11075
  stateKey = this.browserStorage.generateStateKey(state);
11013
11076
  requestState = this.browserStorage.getTemporaryCache(stateKey);
11014
11077
  if (!requestState) {
11015
11078
  throw ClientAuthError.createStateNotFoundError("Cached State");
11016
11079
  }
11017
- authCodeResponse = this.authModule.handleFragmentResponse(locationHash, requestState);
11018
11080
  nonceKey = this.browserStorage.generateNonceKey(requestState);
11019
11081
  cachedNonce = this.browserStorage.getTemporaryCache(nonceKey);
11020
11082
  // Assign code to request
@@ -11025,7 +11087,10 @@
11025
11087
  _a.sent();
11026
11088
  _a.label = 2;
11027
11089
  case 2:
11028
- authCodeResponse.nonce = cachedNonce || undefined;
11090
+ // Nonce validation not needed when redirect not involved (e.g. hybrid spa, renewing token via rt)
11091
+ if (validateNonce) {
11092
+ authCodeResponse.nonce = cachedNonce || undefined;
11093
+ }
11029
11094
  authCodeResponse.state = requestState;
11030
11095
  // Add CCS parameters if available
11031
11096
  if (authCodeResponse.client_info) {
@@ -11257,7 +11322,7 @@
11257
11322
  state = this.validateAndExtractStateFromHash(hash, exports.InteractionType.Popup, validRequest.correlationId);
11258
11323
  // Remove throttle if it exists
11259
11324
  ThrottlingUtils.removeThrottle(this.browserStorage, this.config.auth.clientId, authCodeRequest);
11260
- return [4 /*yield*/, interactionHandler.handleCodeResponse(hash, state, authClient.authority, this.networkClient)];
11325
+ return [4 /*yield*/, interactionHandler.handleCodeResponseFromHash(hash, state, authClient.authority, this.networkClient)];
11261
11326
  case 6:
11262
11327
  result = _a.sent();
11263
11328
  return [2 /*return*/, result];
@@ -11441,7 +11506,7 @@
11441
11506
  * Handle authorization code response in the window.
11442
11507
  * @param hash
11443
11508
  */
11444
- RedirectHandler.prototype.handleCodeResponse = function (locationHash, state, authority, networkModule, clientId) {
11509
+ RedirectHandler.prototype.handleCodeResponseFromHash = function (locationHash, state, authority, networkModule, clientId) {
11445
11510
  return __awaiter$1(this, void 0, void 0, function () {
11446
11511
  var stateKey, requestState, authCodeResponse, nonceKey, cachedNonce, cachedCcsCred, tokenResponse;
11447
11512
  return __generator$1(this, function (_a) {
@@ -11702,7 +11767,7 @@
11702
11767
  authClient = _a.sent();
11703
11768
  this.logger.verbose("Auth code client created");
11704
11769
  interactionHandler = new RedirectHandler(authClient, this.browserStorage, cachedRequest, this.logger, this.browserCrypto);
11705
- return [4 /*yield*/, interactionHandler.handleCodeResponse(hash, state, authClient.authority, this.networkClient, this.config.auth.clientId)];
11770
+ return [4 /*yield*/, interactionHandler.handleCodeResponseFromHash(hash, state, authClient.authority, this.networkClient, this.config.auth.clientId)];
11706
11771
  case 2: return [2 /*return*/, _a.sent()];
11707
11772
  }
11708
11773
  });
@@ -12026,7 +12091,7 @@
12026
12091
  hash = _a.sent();
12027
12092
  state = this.validateAndExtractStateFromHash(hash, exports.InteractionType.Silent, authCodeRequest.correlationId);
12028
12093
  // Handle response from hash string
12029
- return [2 /*return*/, silentHandler.handleCodeResponse(hash, state, authClient.authority, this.networkClient)];
12094
+ return [2 /*return*/, silentHandler.handleCodeResponseFromHash(hash, state, authClient.authority, this.networkClient)];
12030
12095
  }
12031
12096
  });
12032
12097
  });
@@ -12217,6 +12282,88 @@
12217
12282
  return TokenCache;
12218
12283
  }());
12219
12284
 
12285
+ /*
12286
+ * Copyright (c) Microsoft Corporation. All rights reserved.
12287
+ * Licensed under the MIT License.
12288
+ */
12289
+ var HybridSpaAuthorizationCodeClient = /** @class */ (function (_super) {
12290
+ __extends$1(HybridSpaAuthorizationCodeClient, _super);
12291
+ function HybridSpaAuthorizationCodeClient(config) {
12292
+ var _this = _super.call(this, config) || this;
12293
+ _this.includeRedirectUri = false;
12294
+ return _this;
12295
+ }
12296
+ return HybridSpaAuthorizationCodeClient;
12297
+ }(AuthorizationCodeClient));
12298
+
12299
+ /*
12300
+ * Copyright (c) Microsoft Corporation. All rights reserved.
12301
+ * Licensed under the MIT License.
12302
+ */
12303
+ var SilentAuthCodeClient = /** @class */ (function (_super) {
12304
+ __extends$1(SilentAuthCodeClient, _super);
12305
+ function SilentAuthCodeClient(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, apiId, correlationId) {
12306
+ var _this = _super.call(this, config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, correlationId) || this;
12307
+ _this.apiId = apiId;
12308
+ return _this;
12309
+ }
12310
+ /**
12311
+ * Acquires a token silently by redeeming an authorization code against the /token endpoint
12312
+ * @param request
12313
+ */
12314
+ SilentAuthCodeClient.prototype.acquireToken = function (request) {
12315
+ return __awaiter$1(this, void 0, void 0, function () {
12316
+ var silentRequest, serverTelemetryManager, authCodeRequest, clientConfig, authClient, silentHandler, e_1;
12317
+ return __generator$1(this, function (_a) {
12318
+ switch (_a.label) {
12319
+ case 0:
12320
+ this.logger.trace("SilentAuthCodeClient.acquireToken called");
12321
+ // Auth code payload is required
12322
+ if (!request.code) {
12323
+ throw BrowserAuthError.createAuthCodeRequiredError();
12324
+ }
12325
+ silentRequest = this.initializeAuthorizationRequest(request, exports.InteractionType.Silent);
12326
+ serverTelemetryManager = this.initializeServerTelemetryManager(this.apiId);
12327
+ _a.label = 1;
12328
+ case 1:
12329
+ _a.trys.push([1, 3, , 4]);
12330
+ authCodeRequest = __assign$1(__assign$1({}, silentRequest), { code: request.code });
12331
+ return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, silentRequest.authority)];
12332
+ case 2:
12333
+ clientConfig = _a.sent();
12334
+ authClient = new HybridSpaAuthorizationCodeClient(clientConfig);
12335
+ this.logger.verbose("Auth code client created");
12336
+ silentHandler = new SilentHandler(authClient, this.browserStorage, authCodeRequest, this.logger, this.config.system.navigateFrameWait);
12337
+ // Handle auth code parameters from request
12338
+ return [2 /*return*/, silentHandler.handleCodeResponseFromServer({
12339
+ code: request.code,
12340
+ msgraph_host: request.msGraphHost,
12341
+ cloud_graph_host_name: request.cloudGraphHostName,
12342
+ cloud_instance_host_name: request.cloudInstanceHostName
12343
+ }, silentRequest.state, authClient.authority, this.networkClient, false)];
12344
+ case 3:
12345
+ e_1 = _a.sent();
12346
+ if (e_1 instanceof AuthError) {
12347
+ e_1.setCorrelationId(this.correlationId);
12348
+ }
12349
+ serverTelemetryManager.cacheFailedRequest(e_1);
12350
+ this.browserStorage.cleanRequestByState(silentRequest.state);
12351
+ throw e_1;
12352
+ case 4: return [2 /*return*/];
12353
+ }
12354
+ });
12355
+ });
12356
+ };
12357
+ /**
12358
+ * Currently Unsupported
12359
+ */
12360
+ SilentAuthCodeClient.prototype.logout = function () {
12361
+ // Synchronous so we must reject
12362
+ return Promise.reject(BrowserAuthError.createSilentLogoutUnsupportedError());
12363
+ };
12364
+ return SilentAuthCodeClient;
12365
+ }(StandardInteractionClient));
12366
+
12220
12367
  /*
12221
12368
  * Copyright (c) Microsoft Corporation. All rights reserved.
12222
12369
  * Licensed under the MIT License.
@@ -12260,6 +12407,8 @@
12260
12407
  this.navigationClient = this.config.system.navigationClient;
12261
12408
  // Initialize redirectResponse Map
12262
12409
  this.redirectResponse = new Map();
12410
+ // Initial hybrid spa map
12411
+ this.hybridAuthCodeResponses = new Map();
12263
12412
  // Initialize the crypto class.
12264
12413
  this.browserCrypto = this.isBrowserEnvironment ? new CryptoOps(this.logger) : DEFAULT_CRYPTO_IMPLEMENTATION;
12265
12414
  this.eventHandler = new EventHandler(this.logger, this.browserCrypto);
@@ -12464,6 +12613,77 @@
12464
12613
  });
12465
12614
  });
12466
12615
  };
12616
+ /**
12617
+ * This function redeems an authorization code (passed as code) from the eSTS token endpoint.
12618
+ * This authorization code should be acquired server-side using a confidential client to acquire a spa_code.
12619
+ * This API is not indended for normal authorization code acquisition and redemption.
12620
+ *
12621
+ * Redemption of this authorization code will not require PKCE, as it was acquired by a confidential client.
12622
+ *
12623
+ * @param request {@link AuthorizationCodeRequest}
12624
+ * @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.
12625
+ */
12626
+ ClientApplication.prototype.acquireTokenByCode = function (request) {
12627
+ return __awaiter$1(this, void 0, void 0, function () {
12628
+ var response;
12629
+ var _this = this;
12630
+ return __generator$1(this, function (_a) {
12631
+ this.preflightBrowserEnvironmentCheck(exports.InteractionType.Silent);
12632
+ this.logger.trace("acquireTokenByCode called", request.correlationId);
12633
+ this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_BY_CODE_START, exports.InteractionType.Silent, request);
12634
+ try {
12635
+ if (!request.code) {
12636
+ throw BrowserAuthError.createAuthCodeRequiredError();
12637
+ }
12638
+ response = this.hybridAuthCodeResponses.get(request.code);
12639
+ if (!response) {
12640
+ this.logger.verbose("Initiating new acquireTokenByCode request", request.correlationId);
12641
+ response = this.acquireTokenByCodeAsync(request)
12642
+ .then(function (result) {
12643
+ _this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_BY_CODE_SUCCESS, exports.InteractionType.Silent, result);
12644
+ _this.hybridAuthCodeResponses.delete(request.code);
12645
+ return result;
12646
+ })
12647
+ .catch(function (error) {
12648
+ _this.hybridAuthCodeResponses.delete(request.code);
12649
+ throw error;
12650
+ });
12651
+ this.hybridAuthCodeResponses.set(request.code, response);
12652
+ }
12653
+ else {
12654
+ this.logger.verbose("Existing acquireTokenByCode request found", request.correlationId);
12655
+ }
12656
+ return [2 /*return*/, response];
12657
+ }
12658
+ catch (e) {
12659
+ this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_BY_CODE_FAILURE, exports.InteractionType.Silent, null, e);
12660
+ throw e;
12661
+ }
12662
+ return [2 /*return*/];
12663
+ });
12664
+ });
12665
+ };
12666
+ /**
12667
+ * Creates a SilentAuthCodeClient to redeem an authorization code.
12668
+ * @param request
12669
+ * @returns Result of the operation to redeem the authorization code
12670
+ */
12671
+ ClientApplication.prototype.acquireTokenByCodeAsync = function (request) {
12672
+ return __awaiter$1(this, void 0, void 0, function () {
12673
+ var silentAuthCodeClient, silentTokenResult;
12674
+ return __generator$1(this, function (_a) {
12675
+ switch (_a.label) {
12676
+ case 0:
12677
+ this.logger.trace("acquireTokenByCodeAsync called", request.correlationId);
12678
+ silentAuthCodeClient = new SilentAuthCodeClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, exports.ApiId.acquireTokenByCode, request.correlationId);
12679
+ return [4 /*yield*/, silentAuthCodeClient.acquireToken(request)];
12680
+ case 1:
12681
+ silentTokenResult = _a.sent();
12682
+ return [2 /*return*/, silentTokenResult];
12683
+ }
12684
+ });
12685
+ });
12686
+ };
12467
12687
  /**
12468
12688
  * Use this function to obtain a token before every call to the API / resource provider
12469
12689
  *
@@ -12962,6 +13182,9 @@
12962
13182
  acquireTokenSilent: function () {
12963
13183
  return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError());
12964
13184
  },
13185
+ acquireTokenByCode: function () {
13186
+ return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError());
13187
+ },
12965
13188
  getAllAccounts: function () {
12966
13189
  return [];
12967
13190
  },