@azure/msal-common 5.1.0 → 5.2.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 (79) hide show
  1. package/CHANGELOG.json +31 -0
  2. package/CHANGELOG.md +13 -1
  3. package/dist/_virtual/_tslib.js +1 -1
  4. package/dist/account/AuthToken.js +1 -1
  5. package/dist/account/CcsCredential.js +1 -1
  6. package/dist/account/ClientInfo.js +1 -1
  7. package/dist/authority/Authority.js +1 -1
  8. package/dist/authority/AuthorityFactory.js +1 -1
  9. package/dist/authority/AuthorityType.js +1 -1
  10. package/dist/authority/CloudInstanceDiscoveryResponse.js +1 -1
  11. package/dist/authority/OpenIdConfigResponse.js +1 -1
  12. package/dist/authority/ProtocolMode.js +1 -1
  13. package/dist/authority/RegionDiscovery.js +1 -1
  14. package/dist/cache/CacheManager.js +1 -1
  15. package/dist/cache/entities/AccessTokenEntity.js +1 -1
  16. package/dist/cache/entities/AccountEntity.js +1 -1
  17. package/dist/cache/entities/AppMetadataEntity.js +1 -1
  18. package/dist/cache/entities/AuthorityMetadataEntity.js +1 -1
  19. package/dist/cache/entities/CacheRecord.js +1 -1
  20. package/dist/cache/entities/CredentialEntity.js +1 -1
  21. package/dist/cache/entities/IdTokenEntity.js +1 -1
  22. package/dist/cache/entities/RefreshTokenEntity.js +1 -1
  23. package/dist/cache/entities/ServerTelemetryEntity.js +1 -1
  24. package/dist/cache/entities/ThrottlingEntity.js +1 -1
  25. package/dist/cache/persistence/TokenCacheContext.js +1 -1
  26. package/dist/client/AuthorizationCodeClient.d.ts +1 -0
  27. package/dist/client/AuthorizationCodeClient.d.ts.map +1 -1
  28. package/dist/client/AuthorizationCodeClient.js +33 -9
  29. package/dist/client/AuthorizationCodeClient.js.map +1 -1
  30. package/dist/client/BaseClient.js +1 -1
  31. package/dist/client/ClientCredentialClient.js +1 -1
  32. package/dist/client/DeviceCodeClient.js +1 -1
  33. package/dist/client/OnBehalfOfClient.js +1 -1
  34. package/dist/client/RefreshTokenClient.js +1 -1
  35. package/dist/client/SilentFlowClient.js +1 -1
  36. package/dist/client/UsernamePasswordClient.js +1 -1
  37. package/dist/config/ClientConfiguration.js +1 -1
  38. package/dist/crypto/ICrypto.js +1 -1
  39. package/dist/crypto/PopTokenGenerator.js +1 -1
  40. package/dist/error/AuthError.js +1 -1
  41. package/dist/error/ClientAuthError.js +1 -1
  42. package/dist/error/ClientConfigurationError.js +1 -1
  43. package/dist/error/InteractionRequiredAuthError.js +1 -1
  44. package/dist/error/ServerError.js +1 -1
  45. package/dist/index.cjs.js +37 -12
  46. package/dist/index.cjs.js.map +1 -1
  47. package/dist/index.js +1 -1
  48. package/dist/logger/Logger.js +1 -1
  49. package/dist/network/INetworkModule.js +1 -1
  50. package/dist/network/NetworkManager.js +1 -1
  51. package/dist/network/ThrottlingUtils.js +1 -1
  52. package/dist/packageMetadata.d.ts +1 -1
  53. package/dist/packageMetadata.js +2 -2
  54. package/dist/packageMetadata.js.map +1 -1
  55. package/dist/request/AuthenticationHeaderParser.js +2 -2
  56. package/dist/request/AuthenticationHeaderParser.js.map +1 -1
  57. package/dist/request/CommonAuthorizationCodeRequest.d.ts +3 -0
  58. package/dist/request/CommonAuthorizationCodeRequest.d.ts.map +1 -1
  59. package/dist/request/RequestParameterBuilder.js +1 -1
  60. package/dist/request/RequestValidator.js +1 -1
  61. package/dist/request/ScopeSet.js +1 -1
  62. package/dist/response/AuthenticationResult.d.ts +1 -0
  63. package/dist/response/AuthenticationResult.d.ts.map +1 -1
  64. package/dist/response/ResponseHandler.d.ts +1 -1
  65. package/dist/response/ResponseHandler.d.ts.map +1 -1
  66. package/dist/response/ResponseHandler.js +5 -4
  67. package/dist/response/ResponseHandler.js.map +1 -1
  68. package/dist/response/ServerAuthorizationTokenResponse.d.ts +1 -0
  69. package/dist/response/ServerAuthorizationTokenResponse.d.ts.map +1 -1
  70. package/dist/telemetry/server/ServerTelemetryManager.js +1 -1
  71. package/dist/url/UrlString.js +1 -1
  72. package/dist/utils/Constants.d.ts +2 -1
  73. package/dist/utils/Constants.d.ts.map +1 -1
  74. package/dist/utils/Constants.js +2 -1
  75. package/dist/utils/Constants.js.map +1 -1
  76. package/dist/utils/ProtocolUtils.js +1 -1
  77. package/dist/utils/StringUtils.js +1 -1
  78. package/dist/utils/TimeUtils.js +1 -1
  79. package/package.json +1 -1
package/CHANGELOG.json CHANGED
@@ -1,6 +1,37 @@
1
1
  {
2
2
  "name": "@azure/msal-common",
3
3
  "entries": [
4
+ {
5
+ "date": "Tue, 07 Dec 2021 00:17:01 GMT",
6
+ "tag": "@azure/msal-common_v5.2.0",
7
+ "version": "5.2.0",
8
+ "comments": {
9
+ "none": [
10
+ {
11
+ "author": "thomas.norling@microsoft.com",
12
+ "package": "@azure/msal-common",
13
+ "commit": "02dbd9172368bfc69e4a47f01a3ada0b96345c81",
14
+ "comment": "Package.json updates"
15
+ }
16
+ ],
17
+ "patch": [
18
+ {
19
+ "author": "hemoral@microsoft.com",
20
+ "package": "@azure/msal-common",
21
+ "commit": "e983e25ba899bb437a135ec50ad6c77023c72e5b",
22
+ "comment": "Fix circular dependencies in AuthenticationHeaderParser and AsyncMemoryStorage #4235"
23
+ }
24
+ ],
25
+ "minor": [
26
+ {
27
+ "author": "janutter@microsoft.com",
28
+ "package": "@azure/msal-common",
29
+ "commit": "4741b6c3a6a3dd58feefde93c095c05e1eca5e03",
30
+ "comment": "Add APIs needed for hybrid spa flow #3978"
31
+ }
32
+ ]
33
+ }
34
+ },
4
35
  {
5
36
  "date": "Mon, 01 Nov 2021 23:53:21 GMT",
6
37
  "tag": "@azure/msal-common_v5.1.0",
package/CHANGELOG.md CHANGED
@@ -1,9 +1,21 @@
1
1
  # Change Log - @azure/msal-common
2
2
 
3
- This log was last generated on Mon, 01 Nov 2021 23:53:21 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 07 Dec 2021 00:17:01 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 5.2.0
8
+
9
+ Tue, 07 Dec 2021 00:17:01 GMT
10
+
11
+ ### Minor changes
12
+
13
+ - Add APIs needed for hybrid spa flow #3978 (janutter@microsoft.com)
14
+
15
+ ### Patches
16
+
17
+ - Fix circular dependencies in AuthenticationHeaderParser and AsyncMemoryStorage #4235 (hemoral@microsoft.com)
18
+
7
19
  ## 5.1.0
8
20
 
9
21
  Mon, 01 Nov 2021 23:53:21 GMT
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v5.1.0 2021-11-02 */
1
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
2
2
  'use strict';
3
3
  /*! *****************************************************************************
4
4
  Copyright (c) Microsoft Corporation.
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v5.1.0 2021-11-02 */
1
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
2
2
  'use strict';
3
3
  import { ClientAuthError } from '../error/ClientAuthError.js';
4
4
  import { StringUtils } from '../utils/StringUtils.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v5.1.0 2021-11-02 */
1
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
2
2
  'use strict';
3
3
  /*
4
4
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v5.1.0 2021-11-02 */
1
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
2
2
  'use strict';
3
3
  import { ClientAuthError } from '../error/ClientAuthError.js';
4
4
  import { StringUtils } from '../utils/StringUtils.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v5.1.0 2021-11-02 */
1
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
2
2
  'use strict';
3
3
  import { __awaiter, __generator, __assign } from '../_virtual/_tslib.js';
4
4
  import { AuthorityType } from './AuthorityType.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v5.1.0 2021-11-02 */
1
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
2
2
  'use strict';
3
3
  import { __awaiter, __generator } from '../_virtual/_tslib.js';
4
4
  import { Authority } from './Authority.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v5.1.0 2021-11-02 */
1
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
2
2
  'use strict';
3
3
  /*
4
4
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v5.1.0 2021-11-02 */
1
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
2
2
  'use strict';
3
3
  /*
4
4
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v5.1.0 2021-11-02 */
1
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
2
2
  'use strict';
3
3
  /*
4
4
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v5.1.0 2021-11-02 */
1
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
2
2
  'use strict';
3
3
  /*
4
4
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v5.1.0 2021-11-02 */
1
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
2
2
  'use strict';
3
3
  import { __awaiter, __generator } from '../_virtual/_tslib.js';
4
4
  import { RegionDiscoverySources, ResponseCodes, Constants } from '../utils/Constants.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v5.1.0 2021-11-02 */
1
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
2
2
  'use strict';
3
3
  import { __awaiter, __generator, __extends } from '../_virtual/_tslib.js';
4
4
  import { Constants, CredentialType, AuthenticationScheme, CacheSchemaType, THE_FAMILY_ID, APP_METADATA, AUTHORITY_METADATA_CONSTANTS } from '../utils/Constants.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v5.1.0 2021-11-02 */
1
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
2
2
  'use strict';
3
3
  import { __extends } from '../../_virtual/_tslib.js';
4
4
  import { CredentialEntity } from './CredentialEntity.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v5.1.0 2021-11-02 */
1
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
2
2
  'use strict';
3
3
  import { Separators, CacheAccountType, CacheType, Constants } from '../../utils/Constants.js';
4
4
  import { buildClientInfo } from '../../account/ClientInfo.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v5.1.0 2021-11-02 */
1
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
2
2
  'use strict';
3
3
  import { Separators, APP_METADATA } from '../../utils/Constants.js';
4
4
 
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v5.1.0 2021-11-02 */
1
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
2
2
  'use strict';
3
3
  import { AUTHORITY_METADATA_CONSTANTS } from '../../utils/Constants.js';
4
4
  import { TimeUtils } from '../../utils/TimeUtils.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v5.1.0 2021-11-02 */
1
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
2
2
  'use strict';
3
3
  /*
4
4
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v5.1.0 2021-11-02 */
1
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
2
2
  'use strict';
3
3
  import { CredentialType, CacheType, Constants, AuthenticationScheme, Separators } from '../../utils/Constants.js';
4
4
  import { ClientAuthError } from '../../error/ClientAuthError.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v5.1.0 2021-11-02 */
1
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
2
2
  'use strict';
3
3
  import { __extends } from '../../_virtual/_tslib.js';
4
4
  import { CredentialEntity } from './CredentialEntity.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v5.1.0 2021-11-02 */
1
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
2
2
  'use strict';
3
3
  import { __extends } from '../../_virtual/_tslib.js';
4
4
  import { CredentialEntity } from './CredentialEntity.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v5.1.0 2021-11-02 */
1
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
2
2
  'use strict';
3
3
  import { SERVER_TELEM_CONSTANTS } from '../../utils/Constants.js';
4
4
 
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v5.1.0 2021-11-02 */
1
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
2
2
  'use strict';
3
3
  import { ThrottlingConstants } from '../../utils/Constants.js';
4
4
 
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v5.1.0 2021-11-02 */
1
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
2
2
  'use strict';
3
3
  /*
4
4
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -9,6 +9,7 @@ import { AuthorizationCodePayload } from "../response/AuthorizationCodePayload";
9
9
  * Oauth2.0 Authorization Code client
10
10
  */
11
11
  export declare class AuthorizationCodeClient extends BaseClient {
12
+ protected includeRedirectUri: boolean;
12
13
  constructor(configuration: ClientConfiguration);
13
14
  /**
14
15
  * Creates the URL of the authorization request letting the user input credentials and consent to the
@@ -1 +1 @@
1
- {"version":3,"file":"AuthorizationCodeClient.d.ts","sourceRoot":"","sources":["../../src/client/AuthorizationCodeClient.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,6BAA6B,EAAE,MAAM,0CAA0C,CAAC;AACzF,OAAO,EAAE,8BAA8B,EAAE,MAAM,2CAA2C,CAAC;AAI3F,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAIpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAKxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAG7E,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,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E,OAAO,CAAQ;gBAEjC,aAAa,EAAE,mBAAmB;IAI9C;;;;;;;;;OASG;IACG,cAAc,CAAC,OAAO,EAAE,6BAA6B,GAAG,OAAO,CAAC,MAAM,CAAC;IAM7E;;;;OAIG;IACG,YAAY,CAAC,OAAO,EAAE,8BAA8B,EAAE,eAAe,CAAC,EAAE,wBAAwB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAuBtI;;;;OAIG;IACH,sBAAsB,CAAC,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,wBAAwB;IAuB3F;;;;OAIG;IACH,YAAY,CAAC,aAAa,EAAE,uBAAuB,GAAG,MAAM;IAW5D;;;;OAIG;YACW,mBAAmB;IAiCjC;;;OAGG;IACH,OAAO,CAAC,0BAA0B;IAUlC;;;OAGG;YACW,sBAAsB;IAmHpC;;;OAGG;IACH,OAAO,CAAC,4BAA4B;IAsGpC;;;OAGG;IACH,OAAO,CAAC,0BAA0B;IA0BlC;;;OAGG;IACH,OAAO,CAAC,iBAAiB;CAO5B"}
@@ -1,9 +1,9 @@
1
- /*! @azure/msal-common v5.1.0 2021-11-02 */
1
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
2
2
  'use strict';
3
3
  import { __extends, __awaiter, __generator, __assign, __spreadArrays } from '../_virtual/_tslib.js';
4
4
  import { BaseClient } from './BaseClient.js';
5
5
  import { RequestParameterBuilder } from '../request/RequestParameterBuilder.js';
6
- import { PromptValue, Separators, AuthenticationScheme, GrantType } from '../utils/Constants.js';
6
+ import { PromptValue, Separators, AADServerParamKeys, AuthenticationScheme, GrantType } from '../utils/Constants.js';
7
7
  import { ResponseHandler } from '../response/ResponseHandler.js';
8
8
  import { StringUtils } from '../utils/StringUtils.js';
9
9
  import { ClientAuthError } from '../error/ClientAuthError.js';
@@ -13,6 +13,7 @@ import { TimeUtils } from '../utils/TimeUtils.js';
13
13
  import { buildClientInfoFromHomeAccountId, buildClientInfo } from '../account/ClientInfo.js';
14
14
  import { CcsCredentialType } from '../account/CcsCredential.js';
15
15
  import { ClientConfigurationError } from '../error/ClientConfigurationError.js';
16
+ import { RequestValidator } from '../request/RequestValidator.js';
16
17
 
17
18
  /*
18
19
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -24,7 +25,10 @@ import { ClientConfigurationError } from '../error/ClientConfigurationError.js';
24
25
  var AuthorizationCodeClient = /** @class */ (function (_super) {
25
26
  __extends(AuthorizationCodeClient, _super);
26
27
  function AuthorizationCodeClient(configuration) {
27
- return _super.call(this, configuration) || this;
28
+ var _this = _super.call(this, configuration) || this;
29
+ // Flag to indicate if client is for hybrid spa auth code redemption
30
+ _this.includeRedirectUri = true;
31
+ return _this;
28
32
  }
29
33
  /**
30
34
  * Creates the URL of the authorization request letting the user input credentials and consent to the
@@ -173,13 +177,24 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
173
177
  AuthorizationCodeClient.prototype.createTokenRequestBody = function (request) {
174
178
  return __awaiter(this, void 0, void 0, function () {
175
179
  var parameterBuilder, clientAssertion, popTokenGenerator, cnfString, correlationId, ccsCred, clientInfo, clientInfo;
176
- return __generator(this, function (_a) {
177
- switch (_a.label) {
180
+ var _a;
181
+ return __generator(this, function (_b) {
182
+ switch (_b.label) {
178
183
  case 0:
179
184
  parameterBuilder = new RequestParameterBuilder();
180
185
  parameterBuilder.addClientId(this.config.authOptions.clientId);
181
- // validate the redirectUri (to be a non null value)
182
- parameterBuilder.addRedirectUri(request.redirectUri);
186
+ /*
187
+ * For hybrid spa flow, there will be a code but no verifier
188
+ * In this scenario, don't include redirect uri as auth code will not be bound to redirect URI
189
+ */
190
+ if (!this.includeRedirectUri) {
191
+ // Just validate
192
+ RequestValidator.validateRedirectUri(request.redirectUri);
193
+ }
194
+ else {
195
+ // Validate and include redirect uri
196
+ parameterBuilder.addRedirectUri(request.redirectUri);
197
+ }
183
198
  // Add scope array, parameter builder will add default scopes and dedupe
184
199
  parameterBuilder.addScopes(request.scopes);
185
200
  // add code: user set, not validated
@@ -208,7 +223,7 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
208
223
  popTokenGenerator = new PopTokenGenerator(this.cryptoUtils);
209
224
  return [4 /*yield*/, popTokenGenerator.generateCnf(request)];
210
225
  case 1:
211
- cnfString = _a.sent();
226
+ cnfString = _b.sent();
212
227
  parameterBuilder.addPopToken(cnfString);
213
228
  return [3 /*break*/, 3];
214
229
  case 2:
@@ -220,7 +235,7 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
220
235
  throw ClientConfigurationError.createMissingSshJwkError();
221
236
  }
222
237
  }
223
- _a.label = 3;
238
+ _b.label = 3;
224
239
  case 3:
225
240
  correlationId = request.correlationId || this.config.cryptoInterface.createNewGuid();
226
241
  parameterBuilder.addCorrelationId(correlationId);
@@ -260,6 +275,15 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
260
275
  break;
261
276
  }
262
277
  }
278
+ if (request.tokenBodyParameters) {
279
+ parameterBuilder.addExtraQueryParameters(request.tokenBodyParameters);
280
+ }
281
+ // Add hybrid spa parameters if not already provided
282
+ if (request.enableSpaAuthorizationCode && (!request.tokenBodyParameters || !request.tokenBodyParameters[AADServerParamKeys.RETURN_SPA_CODE])) {
283
+ parameterBuilder.addExtraQueryParameters((_a = {},
284
+ _a[AADServerParamKeys.RETURN_SPA_CODE] = "1",
285
+ _a));
286
+ }
263
287
  return [2 /*return*/, parameterBuilder.createQueryString()];
264
288
  }
265
289
  });
@@ -1 +1 @@
1
- {"version":3,"file":"AuthorizationCodeClient.js","sources":["../../src/client/AuthorizationCodeClient.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { BaseClient } from \"./BaseClient\";\nimport { CommonAuthorizationUrlRequest } from \"../request/CommonAuthorizationUrlRequest\";\nimport { CommonAuthorizationCodeRequest } from \"../request/CommonAuthorizationCodeRequest\";\nimport { Authority } from \"../authority/Authority\";\nimport { RequestParameterBuilder } from \"../request/RequestParameterBuilder\";\nimport { GrantType, AuthenticationScheme, PromptValue, Separators } from \"../utils/Constants\";\nimport { ClientConfiguration } from \"../config/ClientConfiguration\";\nimport { ServerAuthorizationTokenResponse } from \"../response/ServerAuthorizationTokenResponse\";\nimport { NetworkResponse } from \"../network/NetworkManager\";\nimport { ResponseHandler } from \"../response/ResponseHandler\";\nimport { AuthenticationResult } from \"../response/AuthenticationResult\";\nimport { StringUtils } from \"../utils/StringUtils\";\nimport { ClientAuthError } from \"../error/ClientAuthError\";\nimport { UrlString } from \"../url/UrlString\";\nimport { ServerAuthorizationCodeResponse } from \"../response/ServerAuthorizationCodeResponse\";\nimport { CommonEndSessionRequest } from \"../request/CommonEndSessionRequest\";\nimport { PopTokenGenerator } from \"../crypto/PopTokenGenerator\";\nimport { RequestThumbprint } from \"../network/RequestThumbprint\";\nimport { AuthorizationCodePayload } from \"../response/AuthorizationCodePayload\";\nimport { TimeUtils } from \"../utils/TimeUtils\";\nimport { TokenClaims } from \"../account/TokenClaims\";\nimport { AccountInfo } from \"../account/AccountInfo\";\nimport { buildClientInfoFromHomeAccountId, buildClientInfo } from \"../account/ClientInfo\";\nimport { CcsCredentialType, CcsCredential } from \"../account/CcsCredential\";\nimport { ClientConfigurationError } from \"../error/ClientConfigurationError\";\n\n/**\n * Oauth2.0 Authorization Code client\n */\nexport class AuthorizationCodeClient extends BaseClient {\n\n constructor(configuration: ClientConfiguration) {\n super(configuration);\n }\n\n /**\n * Creates the URL of the authorization request letting the user input credentials and consent to the\n * application. The URL target the /authorize endpoint of the authority configured in the\n * application object.\n *\n * Once the user inputs their credentials and consents, the authority will send a response to the redirect URI\n * sent in the request and should contain an authorization code, which can then be used to acquire tokens via\n * acquireToken(AuthorizationCodeRequest)\n * @param request\n */\n async getAuthCodeUrl(request: CommonAuthorizationUrlRequest): Promise<string> {\n const queryString = this.createAuthCodeUrlQueryString(request);\n\n return UrlString.appendQueryString(this.authority.authorizationEndpoint, queryString);\n }\n\n /**\n * API to acquire a token in exchange of 'authorization_code` acquired by the user in the first leg of the\n * authorization_code_grant\n * @param request\n */\n async acquireToken(request: CommonAuthorizationCodeRequest, authCodePayload?: AuthorizationCodePayload): Promise<AuthenticationResult> {\n this.logger.info(\"in acquireToken call\");\n if (!request || StringUtils.isEmpty(request.code)) {\n throw ClientAuthError.createTokenRequestCannotBeMadeError();\n }\n\n const reqTimestamp = TimeUtils.nowSeconds();\n const response = await this.executeTokenRequest(this.authority, request);\n\n const responseHandler = new ResponseHandler(\n this.config.authOptions.clientId,\n this.cacheManager,\n this.cryptoUtils,\n this.logger,\n this.config.serializableCache,\n this.config.persistencePlugin\n );\n\n // Validate response. This function throws a server error if an error is returned by the server.\n responseHandler.validateTokenResponse(response.body);\n return await responseHandler.handleServerTokenResponse(response.body, this.authority, reqTimestamp, request, authCodePayload);\n }\n\n /**\n * Handles the hash fragment response from public client code request. Returns a code response used by\n * the client to exchange for a token in acquireToken.\n * @param hashFragment\n */\n handleFragmentResponse(hashFragment: string, cachedState: string): AuthorizationCodePayload {\n // Handle responses.\n const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, null, null);\n\n // Deserialize hash fragment response parameters.\n const hashUrlString = new UrlString(hashFragment);\n // Deserialize hash fragment response parameters.\n const serverParams: ServerAuthorizationCodeResponse = UrlString.getDeserializedHash(hashUrlString.getHash());\n\n // Get code response\n responseHandler.validateServerAuthorizationCodeResponse(serverParams, cachedState, this.cryptoUtils);\n\n // throw when there is no auth code in the response\n if (!serverParams.code) {\n throw ClientAuthError.createNoAuthCodeInServerResponseError();\n }\n return {\n ...serverParams,\n // Code param is optional in ServerAuthorizationCodeResponse but required in AuthorizationCodePaylod\n code: serverParams.code\n };\n }\n\n /**\n * Used to log out the current user, and redirect the user to the postLogoutRedirectUri.\n * Default behaviour is to redirect the user to `window.location.href`.\n * @param authorityUri\n */\n getLogoutUri(logoutRequest: CommonEndSessionRequest): string {\n // Throw error if logoutRequest is null/undefined\n if (!logoutRequest) {\n throw ClientConfigurationError.createEmptyLogoutRequestError();\n }\n const queryString = this.createLogoutUrlQueryString(logoutRequest);\n\n // Construct logout URI.\n return UrlString.appendQueryString(this.authority.endSessionEndpoint, queryString);\n }\n\n /**\n * Executes POST request to token endpoint\n * @param authority\n * @param request\n */\n private async executeTokenRequest(authority: Authority, request: CommonAuthorizationCodeRequest): Promise<NetworkResponse<ServerAuthorizationTokenResponse>> {\n const thumbprint: RequestThumbprint = {\n clientId: this.config.authOptions.clientId,\n authority: authority.canonicalAuthority,\n scopes: request.scopes,\n authenticationScheme: request.authenticationScheme,\n resourceRequestMethod: request.resourceRequestMethod,\n resourceRequestUri: request.resourceRequestUri,\n shrClaims: request.shrClaims,\n sshJwk: request.sshJwk,\n sshKid: request.sshKid\n };\n\n const requestBody = await this.createTokenRequestBody(request);\n const queryParameters = this.createTokenQueryParameters(request);\n let ccsCredential: CcsCredential | undefined = undefined;\n if (request.clientInfo) {\n try {\n const clientInfo = buildClientInfo(request.clientInfo, this.cryptoUtils);\n ccsCredential = {\n credential: `${clientInfo.uid}${Separators.CLIENT_INFO_SEPARATOR}${clientInfo.utid}`,\n type: CcsCredentialType.HOME_ACCOUNT_ID\n };\n } catch (e) {\n this.logger.verbose(\"Could not parse client info for CCS Header: \" + e);\n }\n }\n const headers: Record<string, string> = this.createTokenRequestHeaders(ccsCredential || request.ccsCredential);\n const endpoint = StringUtils.isEmpty(queryParameters) ? authority.tokenEndpoint : `${authority.tokenEndpoint}?${queryParameters}`;\n\n return this.executePostToTokenEndpoint(endpoint, requestBody, headers, thumbprint);\n }\n\n /**\n * Creates query string for the /token request\n * @param request \n */\n private createTokenQueryParameters(request: CommonAuthorizationCodeRequest): string {\n const parameterBuilder = new RequestParameterBuilder();\n\n if (request.tokenQueryParameters) {\n parameterBuilder.addExtraQueryParameters(request.tokenQueryParameters);\n }\n\n return parameterBuilder.createQueryString();\n }\n\n /**\n * Generates a map for all the params to be sent to the service\n * @param request\n */\n private async createTokenRequestBody(request: CommonAuthorizationCodeRequest): Promise<string> {\n const parameterBuilder = new RequestParameterBuilder();\n\n parameterBuilder.addClientId(this.config.authOptions.clientId);\n\n // validate the redirectUri (to be a non null value)\n parameterBuilder.addRedirectUri(request.redirectUri);\n\n // Add scope array, parameter builder will add default scopes and dedupe\n parameterBuilder.addScopes(request.scopes);\n\n // add code: user set, not validated\n parameterBuilder.addAuthorizationCode(request.code);\n\n // Add library metadata\n parameterBuilder.addLibraryInfo(this.config.libraryInfo);\n\n parameterBuilder.addThrottling();\n \n if (this.serverTelemetryManager) {\n parameterBuilder.addServerTelemetry(this.serverTelemetryManager);\n }\n\n // add code_verifier if passed\n if (request.codeVerifier) {\n parameterBuilder.addCodeVerifier(request.codeVerifier);\n }\n\n if (this.config.clientCredentials.clientSecret) {\n parameterBuilder.addClientSecret(this.config.clientCredentials.clientSecret);\n }\n\n if (this.config.clientCredentials.clientAssertion) {\n const clientAssertion = this.config.clientCredentials.clientAssertion;\n parameterBuilder.addClientAssertion(clientAssertion.assertion);\n parameterBuilder.addClientAssertionType(clientAssertion.assertionType);\n }\n\n parameterBuilder.addGrantType(GrantType.AUTHORIZATION_CODE_GRANT);\n parameterBuilder.addClientInfo();\n\n if (request.authenticationScheme === AuthenticationScheme.POP) {\n const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils);\n const cnfString = await popTokenGenerator.generateCnf(request);\n parameterBuilder.addPopToken(cnfString);\n } else if (request.authenticationScheme === AuthenticationScheme.SSH) {\n if(request.sshJwk) {\n parameterBuilder.addSshJwk(request.sshJwk);\n } else {\n throw ClientConfigurationError.createMissingSshJwkError();\n }\n }\n\n const correlationId = request.correlationId || this.config.cryptoInterface.createNewGuid();\n parameterBuilder.addCorrelationId(correlationId);\n\n if (!StringUtils.isEmptyObj(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {\n parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);\n }\n \n let ccsCred: CcsCredential | undefined = undefined;\n if (request.clientInfo) {\n try {\n const clientInfo = buildClientInfo(request.clientInfo, this.cryptoUtils);\n ccsCred = {\n credential: `${clientInfo.uid}${Separators.CLIENT_INFO_SEPARATOR}${clientInfo.utid}`,\n type: CcsCredentialType.HOME_ACCOUNT_ID\n };\n } catch (e) {\n this.logger.verbose(\"Could not parse client info for CCS Header: \" + e);\n }\n } else {\n ccsCred = request.ccsCredential;\n }\n\n // Adds these as parameters in the request instead of headers to prevent CORS preflight request\n if (this.config.systemOptions.preventCorsPreflight && ccsCred) {\n switch (ccsCred.type) {\n case CcsCredentialType.HOME_ACCOUNT_ID:\n try {\n const clientInfo = buildClientInfoFromHomeAccountId(ccsCred.credential);\n parameterBuilder.addCcsOid(clientInfo);\n } catch (e) {\n this.logger.verbose(\"Could not parse home account ID for CCS Header: \" + e);\n }\n break;\n case CcsCredentialType.UPN:\n parameterBuilder.addCcsUpn(ccsCred.credential);\n break;\n }\n }\n\n return parameterBuilder.createQueryString();\n }\n\n /**\n * This API validates the `AuthorizationCodeUrlRequest` and creates a URL\n * @param request\n */\n private createAuthCodeUrlQueryString(request: CommonAuthorizationUrlRequest): string {\n const parameterBuilder = new RequestParameterBuilder();\n\n parameterBuilder.addClientId(this.config.authOptions.clientId);\n\n const requestScopes = [...request.scopes || [], ...request.extraScopesToConsent || []];\n parameterBuilder.addScopes(requestScopes);\n\n // validate the redirectUri (to be a non null value)\n parameterBuilder.addRedirectUri(request.redirectUri);\n\n // generate the correlationId if not set by the user and add\n const correlationId = request.correlationId || this.config.cryptoInterface.createNewGuid();\n parameterBuilder.addCorrelationId(correlationId);\n\n // add response_mode. If not passed in it defaults to query.\n parameterBuilder.addResponseMode(request.responseMode);\n\n // add response_type = code\n parameterBuilder.addResponseTypeCode();\n\n // add library info parameters\n parameterBuilder.addLibraryInfo(this.config.libraryInfo);\n\n // add client_info=1\n parameterBuilder.addClientInfo();\n\n if (request.codeChallenge && request.codeChallengeMethod) {\n parameterBuilder.addCodeChallengeParams(request.codeChallenge, request.codeChallengeMethod);\n }\n\n if (request.prompt) {\n parameterBuilder.addPrompt(request.prompt);\n }\n\n if (request.domainHint) {\n parameterBuilder.addDomainHint(request.domainHint);\n }\n\n // Add sid or loginHint with preference for sid -> loginHint -> username of AccountInfo object\n if (request.prompt !== PromptValue.SELECT_ACCOUNT) {\n // AAD will throw if prompt=select_account is passed with an account hint\n if (request.sid && request.prompt === PromptValue.NONE) {\n // SessionID is only used in silent calls\n this.logger.verbose(\"createAuthCodeUrlQueryString: Prompt is none, adding sid from request\");\n parameterBuilder.addSid(request.sid);\n } else if (request.account) {\n const accountSid = this.extractAccountSid(request.account);\n // If account and loginHint are provided, we will check account first for sid before adding loginHint\n if (accountSid && request.prompt === PromptValue.NONE) {\n // SessionId is only used in silent calls\n this.logger.verbose(\"createAuthCodeUrlQueryString: Prompt is none, adding sid from account\");\n parameterBuilder.addSid(accountSid);\n try {\n const clientInfo = buildClientInfoFromHomeAccountId(request.account.homeAccountId);\n parameterBuilder.addCcsOid(clientInfo);\n } catch (e) {\n this.logger.verbose(\"Could not parse home account ID for CCS Header: \" + e);\n }\n } else if (request.loginHint) {\n this.logger.verbose(\"createAuthCodeUrlQueryString: Adding login_hint from request\");\n parameterBuilder.addLoginHint(request.loginHint);\n parameterBuilder.addCcsUpn(request.loginHint);\n } else if (request.account.username) {\n // Fallback to account username if provided\n this.logger.verbose(\"createAuthCodeUrlQueryString: Adding login_hint from account\");\n parameterBuilder.addLoginHint(request.account.username);\n try {\n const clientInfo = buildClientInfoFromHomeAccountId(request.account.homeAccountId);\n parameterBuilder.addCcsOid(clientInfo);\n } catch (e) {\n this.logger.verbose(\"Could not parse home account ID for CCS Header: \" + e);\n }\n }\n } else if (request.loginHint) {\n this.logger.verbose(\"createAuthCodeUrlQueryString: No account, adding login_hint from request\");\n parameterBuilder.addLoginHint(request.loginHint);\n parameterBuilder.addCcsUpn(request.loginHint);\n }\n } else {\n this.logger.verbose(\"createAuthCodeUrlQueryString: Prompt is select_account, ignoring account hints\");\n }\n\n if (request.nonce) {\n parameterBuilder.addNonce(request.nonce);\n }\n\n if (request.state) {\n parameterBuilder.addState(request.state);\n }\n\n if (!StringUtils.isEmpty(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {\n parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);\n }\n\n if (request.extraQueryParameters) {\n parameterBuilder.addExtraQueryParameters(request.extraQueryParameters);\n }\n\n return parameterBuilder.createQueryString();\n }\n\n /**\n * This API validates the `EndSessionRequest` and creates a URL\n * @param request\n */\n private createLogoutUrlQueryString(request: CommonEndSessionRequest): string {\n const parameterBuilder = new RequestParameterBuilder();\n\n if (request.postLogoutRedirectUri) {\n parameterBuilder.addPostLogoutRedirectUri(request.postLogoutRedirectUri);\n }\n\n if (request.correlationId) {\n parameterBuilder.addCorrelationId(request.correlationId);\n }\n\n if (request.idTokenHint) {\n parameterBuilder.addIdTokenHint(request.idTokenHint);\n }\n \n if(request.state) {\n parameterBuilder.addState(request.state);\n }\n\n if (request.extraQueryParameters) {\n parameterBuilder.addExtraQueryParameters(request.extraQueryParameters);\n }\n\n return parameterBuilder.createQueryString();\n }\n\n /**\n * Helper to get sid from account. Returns null if idTokenClaims are not present or sid is not present.\n * @param account \n */\n private extractAccountSid(account: AccountInfo): string | null {\n if (account.idTokenClaims) {\n const tokenClaims = account.idTokenClaims as TokenClaims;\n return tokenClaims.sid || null;\n }\n return null;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;AA+BA;;;;IAG6C,2CAAU;IAEnD,iCAAY,aAAkC;eAC1C,kBAAM,aAAa,CAAC;KACvB;;;;;;;;;;;IAYK,gDAAc,GAApB,UAAqB,OAAsC;;;;gBACjD,WAAW,GAAG,IAAI,CAAC,4BAA4B,CAAC,OAAO,CAAC,CAAC;gBAE/D,sBAAO,SAAS,CAAC,iBAAiB,CAAC,IAAI,CAAC,SAAS,CAAC,qBAAqB,EAAE,WAAW,CAAC,EAAC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G,OAAO,CAAC,KAAK,EAAE;YACd,gBAAgB,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;SAC5C;QAED,IAAI,OAAO,CAAC,oBAAoB,EAAE;YAC9B,gBAAgB,CAAC,uBAAuB,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC;SAC1E;QAED,OAAO,gBAAgB,CAAC,iBAAiB,EAAE,CAAC;KAC/C;;;;;IAMO,mDAAiB,GAAzB,UAA0B,OAAoB;QAC1C,IAAI,OAAO,CAAC,aAAa,EAAE;YACvB,IAAM,WAAW,GAAG,OAAO,CAAC,aAA4B,CAAC;YACzD,OAAO,WAAW,CAAC,GAAG,IAAI,IAAI,CAAC;SAClC;QACD,OAAO,IAAI,CAAC;KACf;IACL,8BAAC;AAAD,CAxYA,CAA6C,UAAU;;;;"}
1
+ {"version":3,"file":"AuthorizationCodeClient.js","sources":["../../src/client/AuthorizationCodeClient.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { BaseClient } from \"./BaseClient\";\nimport { CommonAuthorizationUrlRequest } from \"../request/CommonAuthorizationUrlRequest\";\nimport { CommonAuthorizationCodeRequest } from \"../request/CommonAuthorizationCodeRequest\";\nimport { Authority } from \"../authority/Authority\";\nimport { RequestParameterBuilder } from \"../request/RequestParameterBuilder\";\nimport { GrantType, AuthenticationScheme, PromptValue, Separators, AADServerParamKeys } from \"../utils/Constants\";\nimport { ClientConfiguration } from \"../config/ClientConfiguration\";\nimport { ServerAuthorizationTokenResponse } from \"../response/ServerAuthorizationTokenResponse\";\nimport { NetworkResponse } from \"../network/NetworkManager\";\nimport { ResponseHandler } from \"../response/ResponseHandler\";\nimport { AuthenticationResult } from \"../response/AuthenticationResult\";\nimport { StringUtils } from \"../utils/StringUtils\";\nimport { ClientAuthError } from \"../error/ClientAuthError\";\nimport { UrlString } from \"../url/UrlString\";\nimport { ServerAuthorizationCodeResponse } from \"../response/ServerAuthorizationCodeResponse\";\nimport { CommonEndSessionRequest } from \"../request/CommonEndSessionRequest\";\nimport { PopTokenGenerator } from \"../crypto/PopTokenGenerator\";\nimport { RequestThumbprint } from \"../network/RequestThumbprint\";\nimport { AuthorizationCodePayload } from \"../response/AuthorizationCodePayload\";\nimport { TimeUtils } from \"../utils/TimeUtils\";\nimport { TokenClaims } from \"../account/TokenClaims\";\nimport { AccountInfo } from \"../account/AccountInfo\";\nimport { buildClientInfoFromHomeAccountId, buildClientInfo } from \"../account/ClientInfo\";\nimport { CcsCredentialType, CcsCredential } from \"../account/CcsCredential\";\nimport { ClientConfigurationError } from \"../error/ClientConfigurationError\";\nimport { RequestValidator } from \"../request/RequestValidator\";\n\n/**\n * Oauth2.0 Authorization Code client\n */\nexport class AuthorizationCodeClient extends BaseClient {\n // Flag to indicate if client is for hybrid spa auth code redemption\n protected includeRedirectUri: boolean = true;\n\n constructor(configuration: ClientConfiguration) {\n super(configuration);\n }\n\n /**\n * Creates the URL of the authorization request letting the user input credentials and consent to the\n * application. The URL target the /authorize endpoint of the authority configured in the\n * application object.\n *\n * Once the user inputs their credentials and consents, the authority will send a response to the redirect URI\n * sent in the request and should contain an authorization code, which can then be used to acquire tokens via\n * acquireToken(AuthorizationCodeRequest)\n * @param request\n */\n async getAuthCodeUrl(request: CommonAuthorizationUrlRequest): Promise<string> {\n const queryString = this.createAuthCodeUrlQueryString(request);\n\n return UrlString.appendQueryString(this.authority.authorizationEndpoint, queryString);\n }\n\n /**\n * API to acquire a token in exchange of 'authorization_code` acquired by the user in the first leg of the\n * authorization_code_grant\n * @param request\n */\n async acquireToken(request: CommonAuthorizationCodeRequest, authCodePayload?: AuthorizationCodePayload): Promise<AuthenticationResult> {\n this.logger.info(\"in acquireToken call\");\n if (!request || StringUtils.isEmpty(request.code)) {\n throw ClientAuthError.createTokenRequestCannotBeMadeError();\n }\n\n const reqTimestamp = TimeUtils.nowSeconds();\n const response = await this.executeTokenRequest(this.authority, request);\n\n const responseHandler = new ResponseHandler(\n this.config.authOptions.clientId,\n this.cacheManager,\n this.cryptoUtils,\n this.logger,\n this.config.serializableCache,\n this.config.persistencePlugin\n );\n\n // Validate response. This function throws a server error if an error is returned by the server.\n responseHandler.validateTokenResponse(response.body);\n return await responseHandler.handleServerTokenResponse(response.body, this.authority, reqTimestamp, request, authCodePayload);\n }\n\n /**\n * Handles the hash fragment response from public client code request. Returns a code response used by\n * the client to exchange for a token in acquireToken.\n * @param hashFragment\n */\n handleFragmentResponse(hashFragment: string, cachedState: string): AuthorizationCodePayload {\n // Handle responses.\n const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, null, null);\n\n // Deserialize hash fragment response parameters.\n const hashUrlString = new UrlString(hashFragment);\n // Deserialize hash fragment response parameters.\n const serverParams: ServerAuthorizationCodeResponse = UrlString.getDeserializedHash(hashUrlString.getHash());\n\n // Get code response\n responseHandler.validateServerAuthorizationCodeResponse(serverParams, cachedState, this.cryptoUtils);\n\n // throw when there is no auth code in the response\n if (!serverParams.code) {\n throw ClientAuthError.createNoAuthCodeInServerResponseError();\n }\n return {\n ...serverParams,\n // Code param is optional in ServerAuthorizationCodeResponse but required in AuthorizationCodePaylod\n code: serverParams.code\n };\n }\n\n /**\n * Used to log out the current user, and redirect the user to the postLogoutRedirectUri.\n * Default behaviour is to redirect the user to `window.location.href`.\n * @param authorityUri\n */\n getLogoutUri(logoutRequest: CommonEndSessionRequest): string {\n // Throw error if logoutRequest is null/undefined\n if (!logoutRequest) {\n throw ClientConfigurationError.createEmptyLogoutRequestError();\n }\n const queryString = this.createLogoutUrlQueryString(logoutRequest);\n\n // Construct logout URI.\n return UrlString.appendQueryString(this.authority.endSessionEndpoint, queryString);\n }\n\n /**\n * Executes POST request to token endpoint\n * @param authority\n * @param request\n */\n private async executeTokenRequest(authority: Authority, request: CommonAuthorizationCodeRequest): Promise<NetworkResponse<ServerAuthorizationTokenResponse>> {\n const thumbprint: RequestThumbprint = {\n clientId: this.config.authOptions.clientId,\n authority: authority.canonicalAuthority,\n scopes: request.scopes,\n authenticationScheme: request.authenticationScheme,\n resourceRequestMethod: request.resourceRequestMethod,\n resourceRequestUri: request.resourceRequestUri,\n shrClaims: request.shrClaims,\n sshJwk: request.sshJwk,\n sshKid: request.sshKid\n };\n\n const requestBody = await this.createTokenRequestBody(request);\n const queryParameters = this.createTokenQueryParameters(request);\n let ccsCredential: CcsCredential | undefined = undefined;\n if (request.clientInfo) {\n try {\n const clientInfo = buildClientInfo(request.clientInfo, this.cryptoUtils);\n ccsCredential = {\n credential: `${clientInfo.uid}${Separators.CLIENT_INFO_SEPARATOR}${clientInfo.utid}`,\n type: CcsCredentialType.HOME_ACCOUNT_ID\n };\n } catch (e) {\n this.logger.verbose(\"Could not parse client info for CCS Header: \" + e);\n }\n }\n const headers: Record<string, string> = this.createTokenRequestHeaders(ccsCredential || request.ccsCredential);\n const endpoint = StringUtils.isEmpty(queryParameters) ? authority.tokenEndpoint : `${authority.tokenEndpoint}?${queryParameters}`;\n\n return this.executePostToTokenEndpoint(endpoint, requestBody, headers, thumbprint);\n }\n\n /**\n * Creates query string for the /token request\n * @param request \n */\n private createTokenQueryParameters(request: CommonAuthorizationCodeRequest): string {\n const parameterBuilder = new RequestParameterBuilder();\n\n if (request.tokenQueryParameters) {\n parameterBuilder.addExtraQueryParameters(request.tokenQueryParameters);\n }\n\n return parameterBuilder.createQueryString();\n }\n\n /**\n * Generates a map for all the params to be sent to the service\n * @param request\n */\n private async createTokenRequestBody(request: CommonAuthorizationCodeRequest): Promise<string> {\n const parameterBuilder = new RequestParameterBuilder();\n\n parameterBuilder.addClientId(this.config.authOptions.clientId);\n\n /*\n * For hybrid spa flow, there will be a code but no verifier\n * In this scenario, don't include redirect uri as auth code will not be bound to redirect URI\n */\n if (!this.includeRedirectUri) {\n // Just validate\n RequestValidator.validateRedirectUri(request.redirectUri);\n } else {\n // Validate and include redirect uri\n parameterBuilder.addRedirectUri(request.redirectUri);\n }\n\n // Add scope array, parameter builder will add default scopes and dedupe\n parameterBuilder.addScopes(request.scopes);\n\n // add code: user set, not validated\n parameterBuilder.addAuthorizationCode(request.code);\n\n // Add library metadata\n parameterBuilder.addLibraryInfo(this.config.libraryInfo);\n\n parameterBuilder.addThrottling();\n \n if (this.serverTelemetryManager) {\n parameterBuilder.addServerTelemetry(this.serverTelemetryManager);\n }\n\n // add code_verifier if passed\n if (request.codeVerifier) {\n parameterBuilder.addCodeVerifier(request.codeVerifier);\n }\n\n if (this.config.clientCredentials.clientSecret) {\n parameterBuilder.addClientSecret(this.config.clientCredentials.clientSecret);\n }\n\n if (this.config.clientCredentials.clientAssertion) {\n const clientAssertion = this.config.clientCredentials.clientAssertion;\n parameterBuilder.addClientAssertion(clientAssertion.assertion);\n parameterBuilder.addClientAssertionType(clientAssertion.assertionType);\n }\n\n parameterBuilder.addGrantType(GrantType.AUTHORIZATION_CODE_GRANT);\n parameterBuilder.addClientInfo();\n\n if (request.authenticationScheme === AuthenticationScheme.POP) {\n const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils);\n const cnfString = await popTokenGenerator.generateCnf(request);\n parameterBuilder.addPopToken(cnfString);\n } else if (request.authenticationScheme === AuthenticationScheme.SSH) {\n if(request.sshJwk) {\n parameterBuilder.addSshJwk(request.sshJwk);\n } else {\n throw ClientConfigurationError.createMissingSshJwkError();\n }\n }\n\n const correlationId = request.correlationId || this.config.cryptoInterface.createNewGuid();\n parameterBuilder.addCorrelationId(correlationId);\n\n if (!StringUtils.isEmptyObj(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {\n parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);\n }\n \n let ccsCred: CcsCredential | undefined = undefined;\n if (request.clientInfo) {\n try {\n const clientInfo = buildClientInfo(request.clientInfo, this.cryptoUtils);\n ccsCred = {\n credential: `${clientInfo.uid}${Separators.CLIENT_INFO_SEPARATOR}${clientInfo.utid}`,\n type: CcsCredentialType.HOME_ACCOUNT_ID\n };\n } catch (e) {\n this.logger.verbose(\"Could not parse client info for CCS Header: \" + e);\n }\n } else {\n ccsCred = request.ccsCredential;\n }\n\n // Adds these as parameters in the request instead of headers to prevent CORS preflight request\n if (this.config.systemOptions.preventCorsPreflight && ccsCred) {\n switch (ccsCred.type) {\n case CcsCredentialType.HOME_ACCOUNT_ID:\n try {\n const clientInfo = buildClientInfoFromHomeAccountId(ccsCred.credential);\n parameterBuilder.addCcsOid(clientInfo);\n } catch (e) {\n this.logger.verbose(\"Could not parse home account ID for CCS Header: \" + e);\n }\n break;\n case CcsCredentialType.UPN:\n parameterBuilder.addCcsUpn(ccsCred.credential);\n break;\n }\n }\n\n if (request.tokenBodyParameters) {\n parameterBuilder.addExtraQueryParameters(request.tokenBodyParameters);\n }\n\n // Add hybrid spa parameters if not already provided\n if (request.enableSpaAuthorizationCode && (!request.tokenBodyParameters || !request.tokenBodyParameters[AADServerParamKeys.RETURN_SPA_CODE])) {\n parameterBuilder.addExtraQueryParameters({\n [AADServerParamKeys.RETURN_SPA_CODE]: \"1\"\n });\n }\n \n return parameterBuilder.createQueryString();\n }\n\n /**\n * This API validates the `AuthorizationCodeUrlRequest` and creates a URL\n * @param request\n */\n private createAuthCodeUrlQueryString(request: CommonAuthorizationUrlRequest): string {\n const parameterBuilder = new RequestParameterBuilder();\n\n parameterBuilder.addClientId(this.config.authOptions.clientId);\n\n const requestScopes = [...request.scopes || [], ...request.extraScopesToConsent || []];\n parameterBuilder.addScopes(requestScopes);\n\n // validate the redirectUri (to be a non null value)\n parameterBuilder.addRedirectUri(request.redirectUri);\n\n // generate the correlationId if not set by the user and add\n const correlationId = request.correlationId || this.config.cryptoInterface.createNewGuid();\n parameterBuilder.addCorrelationId(correlationId);\n\n // add response_mode. If not passed in it defaults to query.\n parameterBuilder.addResponseMode(request.responseMode);\n\n // add response_type = code\n parameterBuilder.addResponseTypeCode();\n\n // add library info parameters\n parameterBuilder.addLibraryInfo(this.config.libraryInfo);\n\n // add client_info=1\n parameterBuilder.addClientInfo();\n\n if (request.codeChallenge && request.codeChallengeMethod) {\n parameterBuilder.addCodeChallengeParams(request.codeChallenge, request.codeChallengeMethod);\n }\n\n if (request.prompt) {\n parameterBuilder.addPrompt(request.prompt);\n }\n\n if (request.domainHint) {\n parameterBuilder.addDomainHint(request.domainHint);\n }\n\n // Add sid or loginHint with preference for sid -> loginHint -> username of AccountInfo object\n if (request.prompt !== PromptValue.SELECT_ACCOUNT) {\n // AAD will throw if prompt=select_account is passed with an account hint\n if (request.sid && request.prompt === PromptValue.NONE) {\n // SessionID is only used in silent calls\n this.logger.verbose(\"createAuthCodeUrlQueryString: Prompt is none, adding sid from request\");\n parameterBuilder.addSid(request.sid);\n } else if (request.account) {\n const accountSid = this.extractAccountSid(request.account);\n // If account and loginHint are provided, we will check account first for sid before adding loginHint\n if (accountSid && request.prompt === PromptValue.NONE) {\n // SessionId is only used in silent calls\n this.logger.verbose(\"createAuthCodeUrlQueryString: Prompt is none, adding sid from account\");\n parameterBuilder.addSid(accountSid);\n try {\n const clientInfo = buildClientInfoFromHomeAccountId(request.account.homeAccountId);\n parameterBuilder.addCcsOid(clientInfo);\n } catch (e) {\n this.logger.verbose(\"Could not parse home account ID for CCS Header: \" + e);\n }\n } else if (request.loginHint) {\n this.logger.verbose(\"createAuthCodeUrlQueryString: Adding login_hint from request\");\n parameterBuilder.addLoginHint(request.loginHint);\n parameterBuilder.addCcsUpn(request.loginHint);\n } else if (request.account.username) {\n // Fallback to account username if provided\n this.logger.verbose(\"createAuthCodeUrlQueryString: Adding login_hint from account\");\n parameterBuilder.addLoginHint(request.account.username);\n try {\n const clientInfo = buildClientInfoFromHomeAccountId(request.account.homeAccountId);\n parameterBuilder.addCcsOid(clientInfo);\n } catch (e) {\n this.logger.verbose(\"Could not parse home account ID for CCS Header: \" + e);\n }\n }\n } else if (request.loginHint) {\n this.logger.verbose(\"createAuthCodeUrlQueryString: No account, adding login_hint from request\");\n parameterBuilder.addLoginHint(request.loginHint);\n parameterBuilder.addCcsUpn(request.loginHint);\n }\n } else {\n this.logger.verbose(\"createAuthCodeUrlQueryString: Prompt is select_account, ignoring account hints\");\n }\n\n if (request.nonce) {\n parameterBuilder.addNonce(request.nonce);\n }\n\n if (request.state) {\n parameterBuilder.addState(request.state);\n }\n\n if (!StringUtils.isEmpty(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {\n parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);\n }\n\n if (request.extraQueryParameters) {\n parameterBuilder.addExtraQueryParameters(request.extraQueryParameters);\n }\n\n return parameterBuilder.createQueryString();\n }\n\n /**\n * This API validates the `EndSessionRequest` and creates a URL\n * @param request\n */\n private createLogoutUrlQueryString(request: CommonEndSessionRequest): string {\n const parameterBuilder = new RequestParameterBuilder();\n\n if (request.postLogoutRedirectUri) {\n parameterBuilder.addPostLogoutRedirectUri(request.postLogoutRedirectUri);\n }\n\n if (request.correlationId) {\n parameterBuilder.addCorrelationId(request.correlationId);\n }\n\n if (request.idTokenHint) {\n parameterBuilder.addIdTokenHint(request.idTokenHint);\n }\n \n if(request.state) {\n parameterBuilder.addState(request.state);\n }\n\n if (request.extraQueryParameters) {\n parameterBuilder.addExtraQueryParameters(request.extraQueryParameters);\n }\n\n return parameterBuilder.createQueryString();\n }\n\n /**\n * Helper to get sid from account. Returns null if idTokenClaims are not present or sid is not present.\n * @param account \n */\n private extractAccountSid(account: AccountInfo): string | null {\n if (account.idTokenClaims) {\n const tokenClaims = account.idTokenClaims as TokenClaims;\n return tokenClaims.sid || null;\n }\n return null;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;AAgCA;;;;IAG6C,2CAAU;IAInD,iCAAY,aAAkC;QAA9C,YACI,kBAAM,aAAa,CAAC,SACvB;;QAJS,wBAAkB,GAAY,IAAI,CAAC;;KAI5C;;;;;;;;;;;IAYK,gDAAc,GAApB,UAAqB,OAAsC;;;;gBACjD,WAAW,GA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msal-common v5.2.0 2021-12-07 */
2
2
  'use strict';
3
3
  import { __awaiter, __generator } from '../_virtual/_tslib.js';
4
4
  import { buildClientConfiguration } from '../config/ClientConfiguration.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v5.1.0 2021-11-02 */
1
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
2
2
  'use strict';
3
3
  import { __extends, __awaiter, __generator } from '../_virtual/_tslib.js';
4
4
  import { BaseClient } from './BaseClient.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v5.1.0 2021-11-02 */
1
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
2
2
  'use strict';
3
3
  import { __extends, __awaiter, __generator } from '../_virtual/_tslib.js';
4
4
  import { BaseClient } from './BaseClient.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v5.1.0 2021-11-02 */
1
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
2
2
  'use strict';
3
3
  import { __extends, __awaiter, __generator } from '../_virtual/_tslib.js';
4
4
  import { BaseClient } from './BaseClient.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v5.1.0 2021-11-02 */
1
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
2
2
  'use strict';
3
3
  import { __extends, __awaiter, __generator, __assign } from '../_virtual/_tslib.js';
4
4
  import { BaseClient } from './BaseClient.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v5.1.0 2021-11-02 */
1
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
2
2
  'use strict';
3
3
  import { __extends, __awaiter, __generator } from '../_virtual/_tslib.js';
4
4
  import { BaseClient } from './BaseClient.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v5.1.0 2021-11-02 */
1
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
2
2
  'use strict';
3
3
  import { __extends, __awaiter, __generator } from '../_virtual/_tslib.js';
4
4
  import { BaseClient } from './BaseClient.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v5.1.0 2021-11-02 */
1
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
2
2
  'use strict';
3
3
  import { __assign, __awaiter, __generator } from '../_virtual/_tslib.js';
4
4
  import { DEFAULT_CRYPTO_IMPLEMENTATION } from '../crypto/ICrypto.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v5.1.0 2021-11-02 */
1
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
2
2
  'use strict';
3
3
  import { __awaiter, __generator } from '../_virtual/_tslib.js';
4
4
  import { AuthError } from '../error/AuthError.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v5.1.0 2021-11-02 */
1
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
2
2
  'use strict';
3
3
  import { __awaiter, __generator, __assign } from '../_virtual/_tslib.js';
4
4
  import { AuthToken } from '../account/AuthToken.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v5.1.0 2021-11-02 */
1
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
2
2
  'use strict';
3
3
  import { __extends } from '../_virtual/_tslib.js';
4
4
  import { Constants } from '../utils/Constants.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v5.1.0 2021-11-02 */
1
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
2
2
  'use strict';
3
3
  import { __extends } from '../_virtual/_tslib.js';
4
4
  import { AuthError } from './AuthError.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v5.1.0 2021-11-02 */
1
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
2
2
  'use strict';
3
3
  import { __extends } from '../_virtual/_tslib.js';
4
4
  import { ClientAuthError } from './ClientAuthError.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v5.1.0 2021-11-02 */
1
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
2
2
  'use strict';
3
3
  import { __extends } from '../_virtual/_tslib.js';
4
4
  import { AuthError } from './AuthError.js';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v5.1.0 2021-11-02 */
1
+ /*! @azure/msal-common v5.2.0 2021-12-07 */
2
2
  'use strict';
3
3
  import { __extends } from '../_virtual/_tslib.js';
4
4
  import { AuthError } from './AuthError.js';