@azure/msal-common 4.5.0 → 4.5.1

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 (116) hide show
  1. package/CHANGELOG.json +15 -0
  2. package/LICENSE +21 -21
  3. package/README.md +61 -61
  4. package/changelog.md +398 -390
  5. package/dist/_virtual/_tslib.js +1 -1
  6. package/dist/account/AuthToken.js +7 -7
  7. package/dist/account/AuthToken.js.map +1 -1
  8. package/dist/account/CcsCredential.js +1 -1
  9. package/dist/account/CcsCredential.js.map +1 -1
  10. package/dist/account/ClientInfo.js +10 -10
  11. package/dist/account/ClientInfo.js.map +1 -1
  12. package/dist/authority/Authority.js +53 -53
  13. package/dist/authority/Authority.js.map +1 -1
  14. package/dist/authority/AuthorityFactory.js +9 -9
  15. package/dist/authority/AuthorityFactory.js.map +1 -1
  16. package/dist/authority/AuthorityType.js +1 -1
  17. package/dist/authority/AuthorityType.js.map +1 -1
  18. package/dist/authority/CloudInstanceDiscoveryResponse.js +1 -1
  19. package/dist/authority/CloudInstanceDiscoveryResponse.js.map +1 -1
  20. package/dist/authority/OpenIdConfigResponse.js +1 -1
  21. package/dist/authority/OpenIdConfigResponse.js.map +1 -1
  22. package/dist/authority/ProtocolMode.js +1 -1
  23. package/dist/authority/ProtocolMode.js.map +1 -1
  24. package/dist/authority/RegionDiscovery.js +9 -9
  25. package/dist/authority/RegionDiscovery.js.map +1 -1
  26. package/dist/cache/CacheManager.js +47 -47
  27. package/dist/cache/CacheManager.js.map +1 -1
  28. package/dist/cache/entities/AccessTokenEntity.js +11 -11
  29. package/dist/cache/entities/AccessTokenEntity.js.map +1 -1
  30. package/dist/cache/entities/AccountEntity.js +14 -14
  31. package/dist/cache/entities/AccountEntity.js.map +1 -1
  32. package/dist/cache/entities/AppMetadataEntity.js +1 -1
  33. package/dist/cache/entities/AppMetadataEntity.js.map +1 -1
  34. package/dist/cache/entities/AuthorityMetadataEntity.js +5 -5
  35. package/dist/cache/entities/AuthorityMetadataEntity.js.map +1 -1
  36. package/dist/cache/entities/CacheRecord.js +1 -1
  37. package/dist/cache/entities/CacheRecord.js.map +1 -1
  38. package/dist/cache/entities/CredentialEntity.js +5 -5
  39. package/dist/cache/entities/CredentialEntity.js.map +1 -1
  40. package/dist/cache/entities/IdTokenEntity.js +3 -3
  41. package/dist/cache/entities/IdTokenEntity.js.map +1 -1
  42. package/dist/cache/entities/RefreshTokenEntity.js +3 -3
  43. package/dist/cache/entities/RefreshTokenEntity.js.map +1 -1
  44. package/dist/cache/entities/ServerTelemetryEntity.js +1 -1
  45. package/dist/cache/entities/ServerTelemetryEntity.js.map +1 -1
  46. package/dist/cache/entities/ThrottlingEntity.js +1 -1
  47. package/dist/cache/entities/ThrottlingEntity.js.map +1 -1
  48. package/dist/cache/persistence/TokenCacheContext.js +3 -3
  49. package/dist/cache/persistence/TokenCacheContext.js.map +1 -1
  50. package/dist/client/AuthorizationCodeClient.js +32 -32
  51. package/dist/client/AuthorizationCodeClient.js.map +1 -1
  52. package/dist/client/BaseClient.js +11 -11
  53. package/dist/client/BaseClient.js.map +1 -1
  54. package/dist/client/ClientCredentialClient.js +17 -17
  55. package/dist/client/ClientCredentialClient.js.map +1 -1
  56. package/dist/client/DeviceCodeClient.js +25 -25
  57. package/dist/client/DeviceCodeClient.js.map +1 -1
  58. package/dist/client/OnBehalfOfClient.js +19 -19
  59. package/dist/client/OnBehalfOfClient.js.map +1 -1
  60. package/dist/client/RefreshTokenClient.js +25 -25
  61. package/dist/client/RefreshTokenClient.js.map +1 -1
  62. package/dist/client/SilentFlowClient.js +27 -27
  63. package/dist/client/SilentFlowClient.js.map +1 -1
  64. package/dist/client/UsernamePasswordClient.js +11 -11
  65. package/dist/client/UsernamePasswordClient.js.map +1 -1
  66. package/dist/config/ClientConfiguration.js +6 -6
  67. package/dist/config/ClientConfiguration.js.map +1 -1
  68. package/dist/crypto/ICrypto.js +8 -8
  69. package/dist/crypto/ICrypto.js.map +1 -1
  70. package/dist/crypto/PopTokenGenerator.js +9 -9
  71. package/dist/crypto/PopTokenGenerator.js.map +1 -1
  72. package/dist/error/AuthError.js +3 -3
  73. package/dist/error/AuthError.js.map +1 -1
  74. package/dist/error/ClientAuthError.js +3 -3
  75. package/dist/error/ClientAuthError.js.map +1 -1
  76. package/dist/error/ClientConfigurationError.js +3 -3
  77. package/dist/error/ClientConfigurationError.js.map +1 -1
  78. package/dist/error/InteractionRequiredAuthError.js +3 -3
  79. package/dist/error/InteractionRequiredAuthError.js.map +1 -1
  80. package/dist/error/ServerError.js +3 -3
  81. package/dist/error/ServerError.js.map +1 -1
  82. package/dist/index.cjs.js +70 -29
  83. package/dist/index.cjs.js.map +1 -1
  84. package/dist/index.js +29 -29
  85. package/dist/logger/Logger.js +7 -7
  86. package/dist/logger/Logger.js.map +1 -1
  87. package/dist/network/INetworkModule.js +4 -4
  88. package/dist/network/INetworkModule.js.map +1 -1
  89. package/dist/network/NetworkManager.js +8 -8
  90. package/dist/network/NetworkManager.js.map +1 -1
  91. package/dist/network/ThrottlingUtils.js +4 -4
  92. package/dist/network/ThrottlingUtils.js.map +1 -1
  93. package/dist/packageMetadata.d.ts +1 -1
  94. package/dist/packageMetadata.js +2 -2
  95. package/dist/packageMetadata.js.map +1 -1
  96. package/dist/request/RequestParameterBuilder.js +18 -18
  97. package/dist/request/RequestParameterBuilder.js.map +1 -1
  98. package/dist/request/RequestValidator.js +10 -10
  99. package/dist/request/RequestValidator.js.map +1 -1
  100. package/dist/request/ScopeSet.js +14 -14
  101. package/dist/request/ScopeSet.js.map +1 -1
  102. package/dist/response/ResponseHandler.js +61 -61
  103. package/dist/response/ResponseHandler.js.map +1 -1
  104. package/dist/telemetry/server/ServerTelemetryManager.js +13 -13
  105. package/dist/telemetry/server/ServerTelemetryManager.js.map +1 -1
  106. package/dist/url/UrlString.js +24 -24
  107. package/dist/url/UrlString.js.map +1 -1
  108. package/dist/utils/Constants.js +1 -1
  109. package/dist/utils/Constants.js.map +1 -1
  110. package/dist/utils/ProtocolUtils.js +13 -13
  111. package/dist/utils/ProtocolUtils.js.map +1 -1
  112. package/dist/utils/StringUtils.js +5 -5
  113. package/dist/utils/StringUtils.js.map +1 -1
  114. package/dist/utils/TimeUtils.js +1 -1
  115. package/dist/utils/TimeUtils.js.map +1 -1
  116. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v4.5.0 2021-07-22 */
1
+ /*! @azure/msal-common v4.5.1 2021-08-02 */
2
2
  'use strict';
3
3
  /*! *****************************************************************************
4
4
  Copyright (c) Microsoft Corporation.
@@ -1,7 +1,7 @@
1
- /*! @azure/msal-common v4.5.0 2021-07-22 */
1
+ /*! @azure/msal-common v4.5.1 2021-08-02 */
2
2
  'use strict';
3
- import { ClientAuthError as ClientAuthError$1 } from '../error/ClientAuthError.js';
4
- import { StringUtils as StringUtils$1 } from '../utils/StringUtils.js';
3
+ import { ClientAuthError } from '../error/ClientAuthError.js';
4
+ import { StringUtils } from '../utils/StringUtils.js';
5
5
 
6
6
  /*
7
7
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -12,8 +12,8 @@ import { StringUtils as StringUtils$1 } from '../utils/StringUtils.js';
12
12
  */
13
13
  var AuthToken = /** @class */ (function () {
14
14
  function AuthToken(rawToken, crypto) {
15
- if (StringUtils$1.isEmpty(rawToken)) {
16
- throw ClientAuthError$1.createTokenNullOrEmptyError(rawToken);
15
+ if (StringUtils.isEmpty(rawToken)) {
16
+ throw ClientAuthError.createTokenNullOrEmptyError(rawToken);
17
17
  }
18
18
  this.rawToken = rawToken;
19
19
  this.claims = AuthToken.extractTokenClaims(rawToken, crypto);
@@ -24,7 +24,7 @@ var AuthToken = /** @class */ (function () {
24
24
  * @param encodedToken
25
25
  */
26
26
  AuthToken.extractTokenClaims = function (encodedToken, crypto) {
27
- var decodedToken = StringUtils$1.decodeAuthToken(encodedToken);
27
+ var decodedToken = StringUtils.decodeAuthToken(encodedToken);
28
28
  // token will be decoded to get the username
29
29
  try {
30
30
  var base64TokenPayload = decodedToken.JWSPayload;
@@ -33,7 +33,7 @@ var AuthToken = /** @class */ (function () {
33
33
  return JSON.parse(base64Decoded);
34
34
  }
35
35
  catch (err) {
36
- throw ClientAuthError$1.createTokenParsingError(err);
36
+ throw ClientAuthError.createTokenParsingError(err);
37
37
  }
38
38
  };
39
39
  return AuthToken;
@@ -1 +1 @@
1
- {"version":3,"file":"AuthToken.js","sources":["../../src/account/AuthToken.ts"],"sourcesContent":["/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { TokenClaims } from \"./TokenClaims\";\r\nimport { DecodedAuthToken } from \"./DecodedAuthToken\";\r\nimport { ClientAuthError } from \"../error/ClientAuthError\";\r\nimport { StringUtils } from \"../utils/StringUtils\";\r\nimport { ICrypto } from \"../crypto/ICrypto\";\r\n\r\n/**\r\n * JWT Token representation class. Parses token string and generates claims object.\r\n */\r\nexport class AuthToken {\r\n\r\n // Raw Token string\r\n rawToken: string;\r\n // Claims inside token\r\n claims: TokenClaims;\r\n constructor(rawToken: string, crypto: ICrypto) {\r\n if (StringUtils.isEmpty(rawToken)) {\r\n throw ClientAuthError.createTokenNullOrEmptyError(rawToken);\r\n }\r\n\r\n this.rawToken = rawToken;\r\n this.claims = AuthToken.extractTokenClaims(rawToken, crypto);\r\n }\r\n\r\n /**\r\n * Extract token by decoding the rawToken\r\n *\r\n * @param encodedToken\r\n */\r\n static extractTokenClaims(encodedToken: string, crypto: ICrypto): TokenClaims {\r\n\r\n const decodedToken: DecodedAuthToken = StringUtils.decodeAuthToken(encodedToken);\r\n\r\n // token will be decoded to get the username\r\n try {\r\n const base64TokenPayload = decodedToken.JWSPayload;\r\n\r\n // base64Decode() should throw an error if there is an issue\r\n const base64Decoded = crypto.base64Decode(base64TokenPayload);\r\n return JSON.parse(base64Decoded) as TokenClaims;\r\n } catch (err) {\r\n throw ClientAuthError.createTokenParsingError(err);\r\n }\r\n }\r\n}\r\n"],"names":["StringUtils","ClientAuthError"],"mappings":";;;;;AAAA;;;;AAWA;;;;IASI,mBAAY,QAAgB,EAAE,MAAe;QACzC,IAAIA,aAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YAC/B,MAAMC,iBAAe,CAAC,2BAA2B,CAAC,QAAQ,CAAC,CAAC;SAC/D;QAED,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,kBAAkB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;KAChE;;;;;;IAOM,4BAAkB,GAAzB,UAA0B,YAAoB,EAAE,MAAe;QAE3D,IAAM,YAAY,GAAqBD,aAAW,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;;QAGjF,IAAI;YACA,IAAM,kBAAkB,GAAG,YAAY,CAAC,UAAU,CAAC;;YAGnD,IAAM,aAAa,GAAG,MAAM,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAAC;YAC9D,OAAO,IAAI,CAAC,KAAK,CAAC,aAAa,CAAgB,CAAC;SACnD;QAAC,OAAO,GAAG,EAAE;YACV,MAAMC,iBAAe,CAAC,uBAAuB,CAAC,GAAG,CAAC,CAAC;SACtD;KACJ;IACL,gBAAC;AAAD,CAAC;;;;"}
1
+ {"version":3,"file":"AuthToken.js","sources":["../../src/account/AuthToken.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { TokenClaims } from \"./TokenClaims\";\nimport { DecodedAuthToken } from \"./DecodedAuthToken\";\nimport { ClientAuthError } from \"../error/ClientAuthError\";\nimport { StringUtils } from \"../utils/StringUtils\";\nimport { ICrypto } from \"../crypto/ICrypto\";\n\n/**\n * JWT Token representation class. Parses token string and generates claims object.\n */\nexport class AuthToken {\n\n // Raw Token string\n rawToken: string;\n // Claims inside token\n claims: TokenClaims;\n constructor(rawToken: string, crypto: ICrypto) {\n if (StringUtils.isEmpty(rawToken)) {\n throw ClientAuthError.createTokenNullOrEmptyError(rawToken);\n }\n\n this.rawToken = rawToken;\n this.claims = AuthToken.extractTokenClaims(rawToken, crypto);\n }\n\n /**\n * Extract token by decoding the rawToken\n *\n * @param encodedToken\n */\n static extractTokenClaims(encodedToken: string, crypto: ICrypto): TokenClaims {\n\n const decodedToken: DecodedAuthToken = StringUtils.decodeAuthToken(encodedToken);\n\n // token will be decoded to get the username\n try {\n const base64TokenPayload = decodedToken.JWSPayload;\n\n // base64Decode() should throw an error if there is an issue\n const base64Decoded = crypto.base64Decode(base64TokenPayload);\n return JSON.parse(base64Decoded) as TokenClaims;\n } catch (err) {\n throw ClientAuthError.createTokenParsingError(err);\n }\n }\n}\n"],"names":[],"mappings":";;;;;AAAA;;;;AAWA;;;;IASI,mBAAY,QAAgB,EAAE,MAAe;QACzC,IAAI,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YAC/B,MAAM,eAAe,CAAC,2BAA2B,CAAC,QAAQ,CAAC,CAAC;SAC/D;QAED,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,kBAAkB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;KAChE;;;;;;IAOM,4BAAkB,GAAzB,UAA0B,YAAoB,EAAE,MAAe;QAE3D,IAAM,YAAY,GAAqB,WAAW,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;;QAGjF,IAAI;YACA,IAAM,kBAAkB,GAAG,YAAY,CAAC,UAAU,CAAC;;YAGnD,IAAM,aAAa,GAAG,MAAM,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAAC;YAC9D,OAAO,IAAI,CAAC,KAAK,CAAC,aAAa,CAAgB,CAAC;SACnD;QAAC,OAAO,GAAG,EAAE;YACV,MAAM,eAAe,CAAC,uBAAuB,CAAC,GAAG,CAAC,CAAC;SACtD;KACJ;IACL,gBAAC;AAAD,CAAC;;;;"}
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v4.5.0 2021-07-22 */
1
+ /*! @azure/msal-common v4.5.1 2021-08-02 */
2
2
  'use strict';
3
3
  /*
4
4
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1 +1 @@
1
- {"version":3,"file":"CcsCredential.js","sources":["../../src/account/CcsCredential.ts"],"sourcesContent":["/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nexport type CcsCredential = {\r\n credential: string,\r\n type: CcsCredentialType\r\n};\r\n\r\nexport enum CcsCredentialType {\r\n HOME_ACCOUNT_ID = \"home_account_id\",\r\n UPN = \"UPN\"\r\n}\r\n"],"names":[],"mappings":";;AAAA;;;;IAUY;AAAZ,WAAY,iBAAiB;IACzB,wDAAmC,CAAA;IACnC,gCAAW,CAAA;AACf,CAAC,EAHW,iBAAiB,KAAjB,iBAAiB;;;;"}
1
+ {"version":3,"file":"CcsCredential.js","sources":["../../src/account/CcsCredential.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport type CcsCredential = {\n credential: string,\n type: CcsCredentialType\n};\n\nexport enum CcsCredentialType {\n HOME_ACCOUNT_ID = \"home_account_id\",\n UPN = \"UPN\"\n}\n"],"names":[],"mappings":";;AAAA;;;;IAUY;AAAZ,WAAY,iBAAiB;IACzB,wDAAmC,CAAA;IACnC,gCAAW,CAAA;AACf,CAAC,EAHW,iBAAiB,KAAjB,iBAAiB;;;;"}
@@ -1,8 +1,8 @@
1
- /*! @azure/msal-common v4.5.0 2021-07-22 */
1
+ /*! @azure/msal-common v4.5.1 2021-08-02 */
2
2
  'use strict';
3
- import { Constants as Constants$1, Separators } from '../utils/Constants.js';
4
- import { ClientAuthError as ClientAuthError$1 } from '../error/ClientAuthError.js';
5
- import { StringUtils as StringUtils$1 } from '../utils/StringUtils.js';
3
+ import { ClientAuthError } from '../error/ClientAuthError.js';
4
+ import { StringUtils } from '../utils/StringUtils.js';
5
+ import { Constants, Separators } from '../utils/Constants.js';
6
6
 
7
7
  /*
8
8
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -14,15 +14,15 @@ import { StringUtils as StringUtils$1 } from '../utils/StringUtils.js';
14
14
  * @param crypto
15
15
  */
16
16
  function buildClientInfo(rawClientInfo, crypto) {
17
- if (StringUtils$1.isEmpty(rawClientInfo)) {
18
- throw ClientAuthError$1.createClientInfoEmptyError();
17
+ if (StringUtils.isEmpty(rawClientInfo)) {
18
+ throw ClientAuthError.createClientInfoEmptyError();
19
19
  }
20
20
  try {
21
21
  var decodedClientInfo = crypto.base64Decode(rawClientInfo);
22
22
  return JSON.parse(decodedClientInfo);
23
23
  }
24
24
  catch (e) {
25
- throw ClientAuthError$1.createClientInfoDecodingError(e);
25
+ throw ClientAuthError.createClientInfoDecodingError(e);
26
26
  }
27
27
  }
28
28
  /**
@@ -30,13 +30,13 @@ function buildClientInfo(rawClientInfo, crypto) {
30
30
  * @param homeAccountId
31
31
  */
32
32
  function buildClientInfoFromHomeAccountId(homeAccountId) {
33
- if (StringUtils$1.isEmpty(homeAccountId)) {
34
- throw ClientAuthError$1.createClientInfoDecodingError("Home account ID was empty.");
33
+ if (StringUtils.isEmpty(homeAccountId)) {
34
+ throw ClientAuthError.createClientInfoDecodingError("Home account ID was empty.");
35
35
  }
36
36
  var clientInfoParts = homeAccountId.split(Separators.CLIENT_INFO_SEPARATOR, 2);
37
37
  return {
38
38
  uid: clientInfoParts[0],
39
- utid: clientInfoParts.length < 2 ? Constants$1.EMPTY_STRING : clientInfoParts[1]
39
+ utid: clientInfoParts.length < 2 ? Constants.EMPTY_STRING : clientInfoParts[1]
40
40
  };
41
41
  }
42
42
 
@@ -1 +1 @@
1
- {"version":3,"file":"ClientInfo.js","sources":["../../src/account/ClientInfo.ts"],"sourcesContent":["/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { ClientAuthError } from \"../error/ClientAuthError\";\r\nimport { StringUtils } from \"../utils/StringUtils\";\r\nimport { ICrypto } from \"../crypto/ICrypto\";\r\nimport { Separators, Constants } from \"../utils/Constants\";\r\n\r\n/**\r\n * Client info object which consists of two IDs. Need to add more info here.\r\n */\r\nexport type ClientInfo = {\r\n uid: string,\r\n utid: string\r\n};\r\n\r\n/**\r\n * Function to build a client info object from server clientInfo string\r\n * @param rawClientInfo\r\n * @param crypto\r\n */\r\nexport function buildClientInfo(rawClientInfo: string, crypto: ICrypto): ClientInfo {\r\n if (StringUtils.isEmpty(rawClientInfo)) {\r\n throw ClientAuthError.createClientInfoEmptyError();\r\n }\r\n\r\n try {\r\n const decodedClientInfo: string = crypto.base64Decode(rawClientInfo);\r\n return JSON.parse(decodedClientInfo) as ClientInfo;\r\n } catch (e) {\r\n throw ClientAuthError.createClientInfoDecodingError(e);\r\n }\r\n}\r\n\r\n/**\r\n * Function to build a client info object from cached homeAccountId string\r\n * @param homeAccountId \r\n */\r\nexport function buildClientInfoFromHomeAccountId(homeAccountId: string): ClientInfo {\r\n if (StringUtils.isEmpty(homeAccountId)) {\r\n throw ClientAuthError.createClientInfoDecodingError(\"Home account ID was empty.\");\r\n }\r\n const clientInfoParts: string[] = homeAccountId.split(Separators.CLIENT_INFO_SEPARATOR, 2);\r\n return {\r\n uid: clientInfoParts[0],\r\n utid: clientInfoParts.length < 2 ? Constants.EMPTY_STRING : clientInfoParts[1]\r\n };\r\n}\r\n"],"names":["StringUtils","ClientAuthError","Constants"],"mappings":";;;;;;AAAA;;;;AAkBA;;;;;SAKgB,eAAe,CAAC,aAAqB,EAAE,MAAe;IAClE,IAAIA,aAAW,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE;QACpC,MAAMC,iBAAe,CAAC,0BAA0B,EAAE,CAAC;KACtD;IAED,IAAI;QACA,IAAM,iBAAiB,GAAW,MAAM,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;QACrE,OAAO,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAe,CAAC;KACtD;IAAC,OAAO,CAAC,EAAE;QACR,MAAMA,iBAAe,CAAC,6BAA6B,CAAC,CAAC,CAAC,CAAC;KAC1D;AACL,CAAC;AAED;;;;SAIgB,gCAAgC,CAAC,aAAqB;IAClE,IAAID,aAAW,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE;QACpC,MAAMC,iBAAe,CAAC,6BAA6B,CAAC,4BAA4B,CAAC,CAAC;KACrF;IACD,IAAM,eAAe,GAAa,aAAa,CAAC,KAAK,CAAC,UAAU,CAAC,qBAAqB,EAAE,CAAC,CAAC,CAAC;IAC3F,OAAO;QACH,GAAG,EAAE,eAAe,CAAC,CAAC,CAAC;QACvB,IAAI,EAAE,eAAe,CAAC,MAAM,GAAG,CAAC,GAAGC,WAAS,CAAC,YAAY,GAAG,eAAe,CAAC,CAAC,CAAC;KACjF,CAAC;AACN;;;;"}
1
+ {"version":3,"file":"ClientInfo.js","sources":["../../src/account/ClientInfo.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ClientAuthError } from \"../error/ClientAuthError\";\nimport { StringUtils } from \"../utils/StringUtils\";\nimport { ICrypto } from \"../crypto/ICrypto\";\nimport { Separators, Constants } from \"../utils/Constants\";\n\n/**\n * Client info object which consists of two IDs. Need to add more info here.\n */\nexport type ClientInfo = {\n uid: string,\n utid: string\n};\n\n/**\n * Function to build a client info object from server clientInfo string\n * @param rawClientInfo\n * @param crypto\n */\nexport function buildClientInfo(rawClientInfo: string, crypto: ICrypto): ClientInfo {\n if (StringUtils.isEmpty(rawClientInfo)) {\n throw ClientAuthError.createClientInfoEmptyError();\n }\n\n try {\n const decodedClientInfo: string = crypto.base64Decode(rawClientInfo);\n return JSON.parse(decodedClientInfo) as ClientInfo;\n } catch (e) {\n throw ClientAuthError.createClientInfoDecodingError(e);\n }\n}\n\n/**\n * Function to build a client info object from cached homeAccountId string\n * @param homeAccountId \n */\nexport function buildClientInfoFromHomeAccountId(homeAccountId: string): ClientInfo {\n if (StringUtils.isEmpty(homeAccountId)) {\n throw ClientAuthError.createClientInfoDecodingError(\"Home account ID was empty.\");\n }\n const clientInfoParts: string[] = homeAccountId.split(Separators.CLIENT_INFO_SEPARATOR, 2);\n return {\n uid: clientInfoParts[0],\n utid: clientInfoParts.length < 2 ? Constants.EMPTY_STRING : clientInfoParts[1]\n };\n}\n"],"names":[],"mappings":";;;;;;AAAA;;;;AAkBA;;;;;SAKgB,eAAe,CAAC,aAAqB,EAAE,MAAe;IAClE,IAAI,WAAW,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE;QACpC,MAAM,eAAe,CAAC,0BAA0B,EAAE,CAAC;KACtD;IAED,IAAI;QACA,IAAM,iBAAiB,GAAW,MAAM,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;QACrE,OAAO,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAe,CAAC;KACtD;IAAC,OAAO,CAAC,EAAE;QACR,MAAM,eAAe,CAAC,6BAA6B,CAAC,CAAC,CAAC,CAAC;KAC1D;AACL,CAAC;AAED;;;;SAIgB,gCAAgC,CAAC,aAAqB;IAClE,IAAI,WAAW,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE;QACpC,MAAM,eAAe,CAAC,6BAA6B,CAAC,4BAA4B,CAAC,CAAC;KACrF;IACD,IAAM,eAAe,GAAa,aAAa,CAAC,KAAK,CAAC,UAAU,CAAC,qBAAqB,EAAE,CAAC,CAAC,CAAC;IAC3F,OAAO;QACH,GAAG,EAAE,eAAe,CAAC,CAAC,CAAC;QACvB,IAAI,EAAE,eAAe,CAAC,MAAM,GAAG,CAAC,GAAG,SAAS,CAAC,YAAY,GAAG,eAAe,CAAC,CAAC,CAAC;KACjF,CAAC;AACN;;;;"}
@@ -1,16 +1,16 @@
1
- /*! @azure/msal-common v4.5.0 2021-07-22 */
1
+ /*! @azure/msal-common v4.5.1 2021-08-02 */
2
2
  'use strict';
3
3
  import { __awaiter, __generator, __assign } from '../_virtual/_tslib.js';
4
- import { Constants as Constants$1, AuthorityMetadataSource, RegionDiscoveryOutcomes } from '../utils/Constants.js';
5
- import { ClientAuthError as ClientAuthError$1 } from '../error/ClientAuthError.js';
6
- import { ClientConfigurationError as ClientConfigurationError$1 } from '../error/ClientConfigurationError.js';
7
- import { AuthorityType as AuthorityType$1 } from './AuthorityType.js';
8
- import { UrlString as UrlString$1 } from '../url/UrlString.js';
4
+ import { AuthorityType } from './AuthorityType.js';
9
5
  import { isOpenIdConfigResponse } from './OpenIdConfigResponse.js';
10
- import { ProtocolMode as ProtocolMode$1 } from './ProtocolMode.js';
11
- import { AuthorityMetadataEntity as AuthorityMetadataEntity$1 } from '../cache/entities/AuthorityMetadataEntity.js';
6
+ import { UrlString } from '../url/UrlString.js';
7
+ import { ClientAuthError } from '../error/ClientAuthError.js';
8
+ import { Constants, AuthorityMetadataSource, RegionDiscoveryOutcomes } from '../utils/Constants.js';
9
+ import { ClientConfigurationError } from '../error/ClientConfigurationError.js';
10
+ import { ProtocolMode } from './ProtocolMode.js';
11
+ import { AuthorityMetadataEntity } from '../cache/entities/AuthorityMetadataEntity.js';
12
12
  import { isCloudInstanceDiscoveryResponse } from './CloudInstanceDiscoveryResponse.js';
13
- import { RegionDiscovery as RegionDiscovery$1 } from './RegionDiscovery.js';
13
+ import { RegionDiscovery } from './RegionDiscovery.js';
14
14
 
15
15
  /*
16
16
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -27,19 +27,19 @@ var Authority = /** @class */ (function () {
27
27
  this.networkInterface = networkInterface;
28
28
  this.cacheManager = cacheManager;
29
29
  this.authorityOptions = authorityOptions;
30
- this.regionDiscovery = new RegionDiscovery$1(networkInterface);
30
+ this.regionDiscovery = new RegionDiscovery(networkInterface);
31
31
  this.regionDiscoveryMetadata = { region_used: undefined, region_source: undefined, region_outcome: undefined };
32
32
  }
33
33
  Object.defineProperty(Authority.prototype, "authorityType", {
34
34
  // See above for AuthorityType
35
35
  get: function () {
36
36
  var pathSegments = this.canonicalAuthorityUrlComponents.PathSegments;
37
- if (pathSegments.length && pathSegments[0].toLowerCase() === Constants$1.ADFS) {
38
- return AuthorityType$1.Adfs;
37
+ if (pathSegments.length && pathSegments[0].toLowerCase() === Constants.ADFS) {
38
+ return AuthorityType.Adfs;
39
39
  }
40
- return AuthorityType$1.Default;
40
+ return AuthorityType.Default;
41
41
  },
42
- enumerable: true,
42
+ enumerable: false,
43
43
  configurable: true
44
44
  });
45
45
  Object.defineProperty(Authority.prototype, "protocolMode", {
@@ -49,7 +49,7 @@ var Authority = /** @class */ (function () {
49
49
  get: function () {
50
50
  return this.authorityOptions.protocolMode;
51
51
  },
52
- enumerable: true,
52
+ enumerable: false,
53
53
  configurable: true
54
54
  });
55
55
  Object.defineProperty(Authority.prototype, "options", {
@@ -59,7 +59,7 @@ var Authority = /** @class */ (function () {
59
59
  get: function () {
60
60
  return this.authorityOptions;
61
61
  },
62
- enumerable: true,
62
+ enumerable: false,
63
63
  configurable: true
64
64
  });
65
65
  Object.defineProperty(Authority.prototype, "canonicalAuthority", {
@@ -73,11 +73,11 @@ var Authority = /** @class */ (function () {
73
73
  * Sets canonical authority.
74
74
  */
75
75
  set: function (url) {
76
- this._canonicalAuthority = new UrlString$1(url);
76
+ this._canonicalAuthority = new UrlString(url);
77
77
  this._canonicalAuthority.validateAsUri();
78
78
  this._canonicalAuthorityUrlComponents = null;
79
79
  },
80
- enumerable: true,
80
+ enumerable: false,
81
81
  configurable: true
82
82
  });
83
83
  Object.defineProperty(Authority.prototype, "canonicalAuthorityUrlComponents", {
@@ -90,7 +90,7 @@ var Authority = /** @class */ (function () {
90
90
  }
91
91
  return this._canonicalAuthorityUrlComponents;
92
92
  },
93
- enumerable: true,
93
+ enumerable: false,
94
94
  configurable: true
95
95
  });
96
96
  Object.defineProperty(Authority.prototype, "hostnameAndPort", {
@@ -100,7 +100,7 @@ var Authority = /** @class */ (function () {
100
100
  get: function () {
101
101
  return this.canonicalAuthorityUrlComponents.HostNameAndPort.toLowerCase();
102
102
  },
103
- enumerable: true,
103
+ enumerable: false,
104
104
  configurable: true
105
105
  });
106
106
  Object.defineProperty(Authority.prototype, "tenant", {
@@ -110,7 +110,7 @@ var Authority = /** @class */ (function () {
110
110
  get: function () {
111
111
  return this.canonicalAuthorityUrlComponents.PathSegments[0];
112
112
  },
113
- enumerable: true,
113
+ enumerable: false,
114
114
  configurable: true
115
115
  });
116
116
  Object.defineProperty(Authority.prototype, "authorizationEndpoint", {
@@ -123,10 +123,10 @@ var Authority = /** @class */ (function () {
123
123
  return this.replaceTenant(endpoint);
124
124
  }
125
125
  else {
126
- throw ClientAuthError$1.createEndpointDiscoveryIncompleteError("Discovery incomplete.");
126
+ throw ClientAuthError.createEndpointDiscoveryIncompleteError("Discovery incomplete.");
127
127
  }
128
128
  },
129
- enumerable: true,
129
+ enumerable: false,
130
130
  configurable: true
131
131
  });
132
132
  Object.defineProperty(Authority.prototype, "tokenEndpoint", {
@@ -139,10 +139,10 @@ var Authority = /** @class */ (function () {
139
139
  return this.replaceTenant(endpoint);
140
140
  }
141
141
  else {
142
- throw ClientAuthError$1.createEndpointDiscoveryIncompleteError("Discovery incomplete.");
142
+ throw ClientAuthError.createEndpointDiscoveryIncompleteError("Discovery incomplete.");
143
143
  }
144
144
  },
145
- enumerable: true,
145
+ enumerable: false,
146
146
  configurable: true
147
147
  });
148
148
  Object.defineProperty(Authority.prototype, "deviceCodeEndpoint", {
@@ -152,10 +152,10 @@ var Authority = /** @class */ (function () {
152
152
  return this.replaceTenant(endpoint);
153
153
  }
154
154
  else {
155
- throw ClientAuthError$1.createEndpointDiscoveryIncompleteError("Discovery incomplete.");
155
+ throw ClientAuthError.createEndpointDiscoveryIncompleteError("Discovery incomplete.");
156
156
  }
157
157
  },
158
- enumerable: true,
158
+ enumerable: false,
159
159
  configurable: true
160
160
  });
161
161
  Object.defineProperty(Authority.prototype, "endSessionEndpoint", {
@@ -168,10 +168,10 @@ var Authority = /** @class */ (function () {
168
168
  return this.replaceTenant(endpoint);
169
169
  }
170
170
  else {
171
- throw ClientAuthError$1.createEndpointDiscoveryIncompleteError("Discovery incomplete.");
171
+ throw ClientAuthError.createEndpointDiscoveryIncompleteError("Discovery incomplete.");
172
172
  }
173
173
  },
174
- enumerable: true,
174
+ enumerable: false,
175
175
  configurable: true
176
176
  });
177
177
  Object.defineProperty(Authority.prototype, "selfSignedJwtAudience", {
@@ -184,10 +184,10 @@ var Authority = /** @class */ (function () {
184
184
  return this.replaceTenant(endpoint);
185
185
  }
186
186
  else {
187
- throw ClientAuthError$1.createEndpointDiscoveryIncompleteError("Discovery incomplete.");
187
+ throw ClientAuthError.createEndpointDiscoveryIncompleteError("Discovery incomplete.");
188
188
  }
189
189
  },
190
- enumerable: true,
190
+ enumerable: false,
191
191
  configurable: true
192
192
  });
193
193
  /**
@@ -203,7 +203,7 @@ var Authority = /** @class */ (function () {
203
203
  */
204
204
  Authority.prototype.replacePath = function (urlString) {
205
205
  var endpoint = urlString;
206
- var cachedAuthorityUrl = new UrlString$1(this.metadata.canonical_authority);
206
+ var cachedAuthorityUrl = new UrlString(this.metadata.canonical_authority);
207
207
  var cachedAuthorityParts = cachedAuthorityUrl.getUrlComponents().PathSegments;
208
208
  var currentAuthorityParts = this.canonicalAuthorityUrlComponents.PathSegments;
209
209
  currentAuthorityParts.forEach(function (currentPart, index) {
@@ -219,12 +219,12 @@ var Authority = /** @class */ (function () {
219
219
  * The default open id configuration endpoint for any canonical authority.
220
220
  */
221
221
  get: function () {
222
- if (this.authorityType === AuthorityType$1.Adfs || this.protocolMode === ProtocolMode$1.OIDC) {
222
+ if (this.authorityType === AuthorityType.Adfs || this.protocolMode === ProtocolMode.OIDC) {
223
223
  return this.canonicalAuthority + ".well-known/openid-configuration";
224
224
  }
225
225
  return this.canonicalAuthority + "v2.0/.well-known/openid-configuration";
226
226
  },
227
- enumerable: true,
227
+ enumerable: false,
228
228
  configurable: true
229
229
  });
230
230
  /**
@@ -245,7 +245,7 @@ var Authority = /** @class */ (function () {
245
245
  case 0:
246
246
  metadataEntity = this.cacheManager.getAuthorityMetadataByAlias(this.hostnameAndPort);
247
247
  if (!metadataEntity) {
248
- metadataEntity = new AuthorityMetadataEntity$1();
248
+ metadataEntity = new AuthorityMetadataEntity();
249
249
  metadataEntity.updateCanonicalAuthority(this.canonicalAuthority);
250
250
  }
251
251
  return [4 /*yield*/, this.updateCloudDiscoveryMetadata(metadataEntity)];
@@ -296,10 +296,10 @@ var Authority = /** @class */ (function () {
296
296
  return [4 /*yield*/, this.regionDiscovery.detectRegion(this.authorityOptions.azureRegionConfiguration.environmentRegion, this.regionDiscoveryMetadata)];
297
297
  case 2:
298
298
  autodetectedRegionName = _b.sent();
299
- azureRegion = this.authorityOptions.azureRegionConfiguration.azureRegion === Constants$1.AZURE_REGION_AUTO_DISCOVER_FLAG
299
+ azureRegion = this.authorityOptions.azureRegionConfiguration.azureRegion === Constants.AZURE_REGION_AUTO_DISCOVER_FLAG
300
300
  ? autodetectedRegionName
301
301
  : this.authorityOptions.azureRegionConfiguration.azureRegion;
302
- if (this.authorityOptions.azureRegionConfiguration.azureRegion === Constants$1.AZURE_REGION_AUTO_DISCOVER_FLAG) {
302
+ if (this.authorityOptions.azureRegionConfiguration.azureRegion === Constants.AZURE_REGION_AUTO_DISCOVER_FLAG) {
303
303
  this.regionDiscoveryMetadata.region_outcome = autodetectedRegionName ?
304
304
  RegionDiscoveryOutcomes.AUTO_DETECTION_REQUESTED_SUCCESSFUL :
305
305
  RegionDiscoveryOutcomes.AUTO_DETECTION_REQUESTED_FAILED;
@@ -322,7 +322,7 @@ var Authority = /** @class */ (function () {
322
322
  case 3:
323
323
  metadataEntity.updateEndpointMetadata(metadata, true);
324
324
  return [2 /*return*/, AuthorityMetadataSource.NETWORK];
325
- case 4: throw ClientAuthError$1.createUnableToGetOpenidConfigError(this.defaultOpenIdConfigurationEndpoint);
325
+ case 4: throw ClientAuthError.createUnableToGetOpenidConfigError(this.defaultOpenIdConfigurationEndpoint);
326
326
  }
327
327
  });
328
328
  });
@@ -333,7 +333,7 @@ var Authority = /** @class */ (function () {
333
333
  * @param metadataEntity
334
334
  */
335
335
  Authority.prototype.isAuthoritySameType = function (metadataEntity) {
336
- var cachedAuthorityUrl = new UrlString$1(metadataEntity.canonical_authority);
336
+ var cachedAuthorityUrl = new UrlString(metadataEntity.canonical_authority);
337
337
  var cachedParts = cachedAuthorityUrl.getUrlComponents().PathSegments;
338
338
  return cachedParts.length === this.canonicalAuthorityUrlComponents.PathSegments.length;
339
339
  };
@@ -346,7 +346,7 @@ var Authority = /** @class */ (function () {
346
346
  return JSON.parse(this.authorityOptions.authorityMetadata);
347
347
  }
348
348
  catch (e) {
349
- throw ClientConfigurationError$1.createInvalidAuthorityMetadataError();
349
+ throw ClientConfigurationError.createInvalidAuthorityMetadataError();
350
350
  }
351
351
  }
352
352
  return null;
@@ -356,7 +356,7 @@ var Authority = /** @class */ (function () {
356
356
  */
357
357
  Authority.prototype.getEndpointMetadataFromNetwork = function () {
358
358
  return __awaiter(this, void 0, void 0, function () {
359
- var response, e_1;
359
+ var response;
360
360
  return __generator(this, function (_a) {
361
361
  switch (_a.label) {
362
362
  case 0:
@@ -366,7 +366,7 @@ var Authority = /** @class */ (function () {
366
366
  response = _a.sent();
367
367
  return [2 /*return*/, isOpenIdConfigResponse(response.body) ? response.body : null];
368
368
  case 2:
369
- e_1 = _a.sent();
369
+ _a.sent();
370
370
  return [2 /*return*/, null];
371
371
  case 3: return [2 /*return*/];
372
372
  }
@@ -403,7 +403,7 @@ var Authority = /** @class */ (function () {
403
403
  }
404
404
  else {
405
405
  // Metadata could not be obtained from config, cache or network
406
- throw ClientConfigurationError$1.createUntrustedAuthorityError();
406
+ throw ClientConfigurationError.createUntrustedAuthorityError();
407
407
  }
408
408
  }
409
409
  });
@@ -423,7 +423,7 @@ var Authority = /** @class */ (function () {
423
423
  }
424
424
  }
425
425
  catch (e) {
426
- throw ClientConfigurationError$1.createInvalidCloudDiscoveryMetadataError();
426
+ throw ClientConfigurationError.createInvalidCloudDiscoveryMetadataError();
427
427
  }
428
428
  }
429
429
  // If cloudDiscoveryMetadata is empty or does not contain the host, check knownAuthorities
@@ -438,11 +438,11 @@ var Authority = /** @class */ (function () {
438
438
  */
439
439
  Authority.prototype.getCloudDiscoveryMetadataFromNetwork = function () {
440
440
  return __awaiter(this, void 0, void 0, function () {
441
- var instanceDiscoveryEndpoint, match, response, metadata, e_2;
441
+ var instanceDiscoveryEndpoint, match, response, metadata;
442
442
  return __generator(this, function (_a) {
443
443
  switch (_a.label) {
444
444
  case 0:
445
- instanceDiscoveryEndpoint = "" + Constants$1.AAD_INSTANCE_DISCOVERY_ENDPT + this.canonicalAuthority + "oauth2/v2.0/authorize";
445
+ instanceDiscoveryEndpoint = "" + Constants.AAD_INSTANCE_DISCOVERY_ENDPT + this.canonicalAuthority + "oauth2/v2.0/authorize";
446
446
  match = null;
447
447
  _a.label = 1;
448
448
  case 1:
@@ -458,7 +458,7 @@ var Authority = /** @class */ (function () {
458
458
  match = Authority.getCloudDiscoveryMetadataFromNetworkResponse(metadata, this.hostnameAndPort);
459
459
  return [3 /*break*/, 4];
460
460
  case 3:
461
- e_2 = _a.sent();
461
+ _a.sent();
462
462
  return [2 /*return*/, null];
463
463
  case 4:
464
464
  if (!match) {
@@ -476,7 +476,7 @@ var Authority = /** @class */ (function () {
476
476
  Authority.prototype.isInKnownAuthorities = function () {
477
477
  var _this = this;
478
478
  var matches = this.authorityOptions.knownAuthorities.filter(function (authority) {
479
- return UrlString$1.getDomainFromUrl(authority).toLowerCase() === _this.hostnameAndPort;
479
+ return UrlString.getDomainFromUrl(authority).toLowerCase() === _this.hostnameAndPort;
480
480
  });
481
481
  return matches.length > 0;
482
482
  };
@@ -513,7 +513,7 @@ var Authority = /** @class */ (function () {
513
513
  return this.metadata.preferred_cache;
514
514
  }
515
515
  else {
516
- throw ClientAuthError$1.createEndpointDiscoveryIncompleteError("Discovery incomplete.");
516
+ throw ClientAuthError.createEndpointDiscoveryIncompleteError("Discovery incomplete.");
517
517
  }
518
518
  };
519
519
  /**
@@ -530,7 +530,7 @@ var Authority = /** @class */ (function () {
530
530
  * @returns bool
531
531
  */
532
532
  Authority.isPublicCloudAuthority = function (host) {
533
- return Constants$1.KNOWN_PUBLIC_CLOUDS.indexOf(host) >= 0;
533
+ return Constants.KNOWN_PUBLIC_CLOUDS.indexOf(host) >= 0;
534
534
  };
535
535
  /**
536
536
  * Rebuild the authority string with the region
@@ -540,15 +540,15 @@ var Authority = /** @class */ (function () {
540
540
  */
541
541
  Authority.buildRegionalAuthorityString = function (host, region, queryString) {
542
542
  // Create and validate a Url string object with the initial authority string
543
- var authorityUrlInstance = new UrlString$1(host);
543
+ var authorityUrlInstance = new UrlString(host);
544
544
  authorityUrlInstance.validateAsUri();
545
545
  var authorityUrlParts = authorityUrlInstance.getUrlComponents();
546
546
  var hostNameAndPort = region + "." + authorityUrlParts.HostNameAndPort;
547
547
  if (this.isPublicCloudAuthority(authorityUrlParts.HostNameAndPort)) {
548
- hostNameAndPort = region + "." + Constants$1.REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX;
548
+ hostNameAndPort = region + "." + Constants.REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX;
549
549
  }
550
550
  // Include the query string portion of the url
551
- var url = UrlString$1.constructAuthorityUriFromObject(__assign(__assign({}, authorityUrlInstance.getUrlComponents()), { HostNameAndPort: hostNameAndPort })).urlString;
551
+ var url = UrlString.constructAuthorityUriFromObject(__assign(__assign({}, authorityUrlInstance.getUrlComponents()), { HostNameAndPort: hostNameAndPort })).urlString;
552
552
  // Add the query string if a query string was provided
553
553
  if (queryString)
554
554
  return url + "?" + queryString;