@azure/msal-common 4.2.1 → 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 (190) hide show
  1. package/CHANGELOG.json +212 -1
  2. package/LICENSE +21 -21
  3. package/README.md +61 -58
  4. package/changelog.md +402 -344
  5. package/dist/_virtual/_tslib.js +90 -0
  6. package/dist/_virtual/_tslib.js.map +1 -0
  7. package/dist/account/AuthToken.js +43 -0
  8. package/dist/account/AuthToken.js.map +1 -0
  9. package/dist/account/CcsCredential.d.ts +9 -0
  10. package/dist/account/CcsCredential.d.ts.map +1 -0
  11. package/dist/account/CcsCredential.js +14 -0
  12. package/dist/account/CcsCredential.js.map +1 -0
  13. package/dist/account/ClientInfo.d.ts +6 -1
  14. package/dist/account/ClientInfo.d.ts.map +1 -1
  15. package/dist/account/ClientInfo.js +44 -0
  16. package/dist/account/ClientInfo.js.map +1 -0
  17. package/dist/account/TokenClaims.d.ts +1 -0
  18. package/dist/account/TokenClaims.d.ts.map +1 -1
  19. package/dist/authority/Authority.d.ts +25 -0
  20. package/dist/authority/Authority.d.ts.map +1 -1
  21. package/dist/authority/Authority.js +574 -0
  22. package/dist/authority/Authority.js.map +1 -0
  23. package/dist/authority/AuthorityFactory.js +69 -0
  24. package/dist/authority/AuthorityFactory.js.map +1 -0
  25. package/dist/authority/AuthorityOptions.d.ts +2 -0
  26. package/dist/authority/AuthorityOptions.d.ts.map +1 -1
  27. package/dist/authority/AuthorityType.js +17 -0
  28. package/dist/authority/AuthorityType.js.map +1 -0
  29. package/dist/authority/AzureRegion.d.ts +2 -0
  30. package/dist/authority/AzureRegion.d.ts.map +1 -0
  31. package/dist/authority/AzureRegionConfiguration.d.ts +6 -0
  32. package/dist/authority/AzureRegionConfiguration.d.ts.map +1 -0
  33. package/dist/authority/CloudInstanceDiscoveryResponse.js +13 -0
  34. package/dist/authority/CloudInstanceDiscoveryResponse.js.map +1 -0
  35. package/dist/authority/OpenIdConfigResponse.js +15 -0
  36. package/dist/authority/OpenIdConfigResponse.js.map +1 -0
  37. package/dist/authority/ProtocolMode.js +17 -0
  38. package/dist/authority/ProtocolMode.js.map +1 -0
  39. package/dist/authority/RegionDiscovery.d.ts +31 -0
  40. package/dist/authority/RegionDiscovery.d.ts.map +1 -0
  41. package/dist/authority/RegionDiscovery.js +119 -0
  42. package/dist/authority/RegionDiscovery.js.map +1 -0
  43. package/dist/authority/RegionDiscoveryMetadata.d.ts +7 -0
  44. package/dist/authority/RegionDiscoveryMetadata.d.ts.map +1 -0
  45. package/dist/cache/CacheManager.js +713 -0
  46. package/dist/cache/CacheManager.js.map +1 -0
  47. package/dist/cache/entities/AccessTokenEntity.js +111 -0
  48. package/dist/cache/entities/AccessTokenEntity.js.map +1 -0
  49. package/dist/cache/entities/AccountEntity.d.ts +5 -5
  50. package/dist/cache/entities/AccountEntity.d.ts.map +1 -1
  51. package/dist/cache/entities/AccountEntity.js +242 -0
  52. package/dist/cache/entities/AccountEntity.js.map +1 -0
  53. package/dist/cache/entities/AppMetadataEntity.js +74 -0
  54. package/dist/cache/entities/AppMetadataEntity.js.map +1 -0
  55. package/dist/cache/entities/AuthorityMetadataEntity.js +81 -0
  56. package/dist/cache/entities/AuthorityMetadataEntity.js.map +1 -0
  57. package/dist/cache/entities/CacheRecord.js +19 -0
  58. package/dist/cache/entities/CacheRecord.js.map +1 -0
  59. package/dist/cache/entities/CredentialEntity.js +142 -0
  60. package/dist/cache/entities/CredentialEntity.js.map +1 -0
  61. package/dist/cache/entities/IdTokenEntity.js +71 -0
  62. package/dist/cache/entities/IdTokenEntity.js.map +1 -0
  63. package/dist/cache/entities/RefreshTokenEntity.js +73 -0
  64. package/dist/cache/entities/RefreshTokenEntity.js.map +1 -0
  65. package/dist/cache/entities/ServerTelemetryEntity.js +35 -0
  66. package/dist/cache/entities/ServerTelemetryEntity.js.map +1 -0
  67. package/dist/cache/entities/ThrottlingEntity.js +32 -0
  68. package/dist/cache/entities/ThrottlingEntity.js.map +1 -0
  69. package/dist/cache/persistence/TokenCacheContext.js +39 -0
  70. package/dist/cache/persistence/TokenCacheContext.js.map +1 -0
  71. package/dist/client/AuthorizationCodeClient.d.ts.map +1 -1
  72. package/dist/client/AuthorizationCodeClient.js +388 -0
  73. package/dist/client/AuthorizationCodeClient.js.map +1 -0
  74. package/dist/client/BaseClient.d.ts +2 -1
  75. package/dist/client/BaseClient.d.ts.map +1 -1
  76. package/dist/client/BaseClient.js +101 -0
  77. package/dist/client/BaseClient.js.map +1 -0
  78. package/dist/client/ClientCredentialClient.d.ts.map +1 -1
  79. package/dist/client/ClientCredentialClient.js +169 -0
  80. package/dist/client/ClientCredentialClient.js.map +1 -0
  81. package/dist/client/DeviceCodeClient.d.ts +6 -0
  82. package/dist/client/DeviceCodeClient.d.ts.map +1 -1
  83. package/dist/client/DeviceCodeClient.js +212 -0
  84. package/dist/client/DeviceCodeClient.js.map +1 -0
  85. package/dist/client/OnBehalfOfClient.d.ts.map +1 -1
  86. package/dist/client/OnBehalfOfClient.js +209 -0
  87. package/dist/client/OnBehalfOfClient.js.map +1 -0
  88. package/dist/client/RefreshTokenClient.d.ts.map +1 -1
  89. package/dist/client/RefreshTokenClient.js +212 -0
  90. package/dist/client/RefreshTokenClient.js.map +1 -0
  91. package/dist/client/SilentFlowClient.d.ts.map +1 -1
  92. package/dist/client/SilentFlowClient.js +132 -0
  93. package/dist/client/SilentFlowClient.js.map +1 -0
  94. package/dist/client/UsernamePasswordClient.d.ts.map +1 -1
  95. package/dist/client/UsernamePasswordClient.js +112 -0
  96. package/dist/client/UsernamePasswordClient.js.map +1 -0
  97. package/dist/config/ClientConfiguration.d.ts +3 -0
  98. package/dist/config/ClientConfiguration.d.ts.map +1 -1
  99. package/dist/config/ClientConfiguration.js +91 -0
  100. package/dist/config/ClientConfiguration.js.map +1 -0
  101. package/dist/crypto/ICrypto.js +53 -0
  102. package/dist/crypto/ICrypto.js.map +1 -0
  103. package/dist/crypto/PopTokenGenerator.js +72 -0
  104. package/dist/crypto/PopTokenGenerator.js.map +1 -0
  105. package/dist/error/AuthError.js +46 -0
  106. package/dist/error/AuthError.js.map +1 -0
  107. package/dist/error/ClientAuthError.d.ts +13 -6
  108. package/dist/error/ClientAuthError.d.ts.map +1 -1
  109. package/dist/error/ClientAuthError.js +456 -0
  110. package/dist/error/ClientAuthError.js.map +1 -0
  111. package/dist/error/ClientConfigurationError.d.ts +1 -6
  112. package/dist/error/ClientConfigurationError.d.ts.map +1 -1
  113. package/dist/error/ClientConfigurationError.js +210 -0
  114. package/dist/error/ClientConfigurationError.js.map +1 -0
  115. package/dist/error/InteractionRequiredAuthError.js +48 -0
  116. package/dist/error/InteractionRequiredAuthError.js.map +1 -0
  117. package/dist/error/ServerError.js +25 -0
  118. package/dist/error/ServerError.js.map +1 -0
  119. package/dist/index.cjs.js +7045 -0
  120. package/dist/index.cjs.js.map +1 -0
  121. package/dist/index.d.ts +4 -0
  122. package/dist/index.d.ts.map +1 -1
  123. package/dist/index.js +43 -6479
  124. package/dist/index.js.map +1 -0
  125. package/dist/logger/Logger.d.ts +12 -3
  126. package/dist/logger/Logger.d.ts.map +1 -1
  127. package/dist/logger/Logger.js +183 -0
  128. package/dist/logger/Logger.js.map +1 -0
  129. package/dist/network/INetworkModule.d.ts +1 -1
  130. package/dist/network/INetworkModule.d.ts.map +1 -1
  131. package/dist/network/INetworkModule.js +21 -0
  132. package/dist/network/INetworkModule.js.map +1 -0
  133. package/dist/network/NetworkManager.js +56 -0
  134. package/dist/network/NetworkManager.js.map +1 -0
  135. package/dist/network/ThrottlingUtils.d.ts.map +1 -1
  136. package/dist/network/ThrottlingUtils.js +95 -0
  137. package/dist/network/ThrottlingUtils.js.map +1 -0
  138. package/dist/packageMetadata.d.ts +1 -1
  139. package/dist/packageMetadata.js +8 -0
  140. package/dist/packageMetadata.js.map +1 -0
  141. package/dist/request/CommonAuthorizationCodeRequest.d.ts +3 -0
  142. package/dist/request/CommonAuthorizationCodeRequest.d.ts.map +1 -1
  143. package/dist/request/CommonAuthorizationUrlRequest.d.ts +1 -0
  144. package/dist/request/CommonAuthorizationUrlRequest.d.ts.map +1 -1
  145. package/dist/request/CommonClientCredentialRequest.d.ts +7 -4
  146. package/dist/request/CommonClientCredentialRequest.d.ts.map +1 -1
  147. package/dist/request/CommonRefreshTokenRequest.d.ts +2 -0
  148. package/dist/request/CommonRefreshTokenRequest.d.ts.map +1 -1
  149. package/dist/request/RequestParameterBuilder.d.ts +11 -0
  150. package/dist/request/RequestParameterBuilder.d.ts.map +1 -1
  151. package/dist/request/RequestParameterBuilder.js +340 -0
  152. package/dist/request/RequestParameterBuilder.js.map +1 -0
  153. package/dist/request/RequestValidator.d.ts.map +1 -1
  154. package/dist/request/RequestValidator.js +92 -0
  155. package/dist/request/RequestValidator.js.map +1 -0
  156. package/dist/request/ScopeSet.js +192 -0
  157. package/dist/request/ScopeSet.js.map +1 -0
  158. package/dist/response/AuthenticationResult.d.ts +1 -1
  159. package/dist/response/AuthenticationResult.d.ts.map +1 -1
  160. package/dist/response/AuthorizationCodePayload.d.ts +1 -0
  161. package/dist/response/AuthorizationCodePayload.d.ts.map +1 -1
  162. package/dist/response/IMDSBadResponse.d.ts +5 -0
  163. package/dist/response/IMDSBadResponse.d.ts.map +1 -0
  164. package/dist/response/ResponseHandler.d.ts.map +1 -1
  165. package/dist/response/ResponseHandler.js +281 -0
  166. package/dist/response/ResponseHandler.js.map +1 -0
  167. package/dist/telemetry/server/ServerTelemetryManager.d.ts +23 -1
  168. package/dist/telemetry/server/ServerTelemetryManager.d.ts.map +1 -1
  169. package/dist/telemetry/server/ServerTelemetryManager.js +168 -0
  170. package/dist/telemetry/server/ServerTelemetryManager.js.map +1 -0
  171. package/dist/url/UrlString.d.ts +10 -0
  172. package/dist/url/UrlString.d.ts.map +1 -1
  173. package/dist/url/UrlString.js +223 -0
  174. package/dist/url/UrlString.js.map +1 -0
  175. package/dist/utils/Constants.d.ts +47 -4
  176. package/dist/utils/Constants.d.ts.map +1 -1
  177. package/dist/utils/Constants.js +362 -0
  178. package/dist/utils/Constants.js.map +1 -0
  179. package/dist/utils/ProtocolUtils.js +77 -0
  180. package/dist/utils/ProtocolUtils.js.map +1 -0
  181. package/dist/utils/StringUtils.d.ts +5 -0
  182. package/dist/utils/StringUtils.d.ts.map +1 -1
  183. package/dist/utils/StringUtils.js +128 -0
  184. package/dist/utils/StringUtils.js.map +1 -0
  185. package/dist/utils/TimeUtils.d.ts +13 -0
  186. package/dist/utils/TimeUtils.d.ts.map +1 -1
  187. package/dist/utils/TimeUtils.js +53 -0
  188. package/dist/utils/TimeUtils.js.map +1 -0
  189. package/package.json +10 -19
  190. package/dist/index.es.js +0 -6472
@@ -0,0 +1,192 @@
1
+ /*! @azure/msal-common v4.5.1 2021-08-02 */
2
+ 'use strict';
3
+ import { __spreadArrays } from '../_virtual/_tslib.js';
4
+ import { ClientConfigurationError } from '../error/ClientConfigurationError.js';
5
+ import { StringUtils } from '../utils/StringUtils.js';
6
+ import { ClientAuthError } from '../error/ClientAuthError.js';
7
+ import { OIDC_SCOPES } from '../utils/Constants.js';
8
+
9
+ /*
10
+ * Copyright (c) Microsoft Corporation. All rights reserved.
11
+ * Licensed under the MIT License.
12
+ */
13
+ /**
14
+ * The ScopeSet class creates a set of scopes. Scopes are case-insensitive, unique values, so the Set object in JS makes
15
+ * the most sense to implement for this class. All scopes are trimmed and converted to lower case strings in intersection and union functions
16
+ * to ensure uniqueness of strings.
17
+ */
18
+ var ScopeSet = /** @class */ (function () {
19
+ function ScopeSet(inputScopes) {
20
+ var _this = this;
21
+ // Filter empty string and null/undefined array items
22
+ var scopeArr = inputScopes ? StringUtils.trimArrayEntries(__spreadArrays(inputScopes)) : [];
23
+ var filteredInput = scopeArr ? StringUtils.removeEmptyStringsFromArray(scopeArr) : [];
24
+ // Validate and filter scopes (validate function throws if validation fails)
25
+ this.validateInputScopes(filteredInput);
26
+ this.scopes = new Set(); // Iterator in constructor not supported by IE11
27
+ filteredInput.forEach(function (scope) { return _this.scopes.add(scope); });
28
+ }
29
+ /**
30
+ * Factory method to create ScopeSet from space-delimited string
31
+ * @param inputScopeString
32
+ * @param appClientId
33
+ * @param scopesRequired
34
+ */
35
+ ScopeSet.fromString = function (inputScopeString) {
36
+ var scopeString = inputScopeString || "";
37
+ var inputScopes = scopeString.split(" ");
38
+ return new ScopeSet(inputScopes);
39
+ };
40
+ /**
41
+ * Used to validate the scopes input parameter requested by the developer.
42
+ * @param {Array<string>} inputScopes - Developer requested permissions. Not all scopes are guaranteed to be included in the access token returned.
43
+ * @param {boolean} scopesRequired - Boolean indicating whether the scopes array is required or not
44
+ */
45
+ ScopeSet.prototype.validateInputScopes = function (inputScopes) {
46
+ // Check if scopes are required but not given or is an empty array
47
+ if (!inputScopes || inputScopes.length < 1) {
48
+ throw ClientConfigurationError.createEmptyScopesArrayError();
49
+ }
50
+ };
51
+ /**
52
+ * Check if a given scope is present in this set of scopes.
53
+ * @param scope
54
+ */
55
+ ScopeSet.prototype.containsScope = function (scope) {
56
+ var lowerCaseScopes = this.printScopesLowerCase().split(" ");
57
+ var lowerCaseScopesSet = new ScopeSet(lowerCaseScopes);
58
+ // compare lowercase scopes
59
+ return !StringUtils.isEmpty(scope) ? lowerCaseScopesSet.scopes.has(scope.toLowerCase()) : false;
60
+ };
61
+ /**
62
+ * Check if a set of scopes is present in this set of scopes.
63
+ * @param scopeSet
64
+ */
65
+ ScopeSet.prototype.containsScopeSet = function (scopeSet) {
66
+ var _this = this;
67
+ if (!scopeSet || scopeSet.scopes.size <= 0) {
68
+ return false;
69
+ }
70
+ return (this.scopes.size >= scopeSet.scopes.size && scopeSet.asArray().every(function (scope) { return _this.containsScope(scope); }));
71
+ };
72
+ /**
73
+ * Check if set of scopes contains only the defaults
74
+ */
75
+ ScopeSet.prototype.containsOnlyOIDCScopes = function () {
76
+ var _this = this;
77
+ var defaultScopeCount = 0;
78
+ OIDC_SCOPES.forEach(function (defaultScope) {
79
+ if (_this.containsScope(defaultScope)) {
80
+ defaultScopeCount += 1;
81
+ }
82
+ });
83
+ return this.scopes.size === defaultScopeCount;
84
+ };
85
+ /**
86
+ * Appends single scope if passed
87
+ * @param newScope
88
+ */
89
+ ScopeSet.prototype.appendScope = function (newScope) {
90
+ if (!StringUtils.isEmpty(newScope)) {
91
+ this.scopes.add(newScope.trim());
92
+ }
93
+ };
94
+ /**
95
+ * Appends multiple scopes if passed
96
+ * @param newScopes
97
+ */
98
+ ScopeSet.prototype.appendScopes = function (newScopes) {
99
+ var _this = this;
100
+ try {
101
+ newScopes.forEach(function (newScope) { return _this.appendScope(newScope); });
102
+ }
103
+ catch (e) {
104
+ throw ClientAuthError.createAppendScopeSetError(e);
105
+ }
106
+ };
107
+ /**
108
+ * Removes element from set of scopes.
109
+ * @param scope
110
+ */
111
+ ScopeSet.prototype.removeScope = function (scope) {
112
+ if (StringUtils.isEmpty(scope)) {
113
+ throw ClientAuthError.createRemoveEmptyScopeFromSetError(scope);
114
+ }
115
+ this.scopes.delete(scope.trim());
116
+ };
117
+ /**
118
+ * Removes default scopes from set of scopes
119
+ * Primarily used to prevent cache misses if the default scopes are not returned from the server
120
+ */
121
+ ScopeSet.prototype.removeOIDCScopes = function () {
122
+ var _this = this;
123
+ OIDC_SCOPES.forEach(function (defaultScope) {
124
+ _this.scopes.delete(defaultScope);
125
+ });
126
+ };
127
+ /**
128
+ * Combines an array of scopes with the current set of scopes.
129
+ * @param otherScopes
130
+ */
131
+ ScopeSet.prototype.unionScopeSets = function (otherScopes) {
132
+ if (!otherScopes) {
133
+ throw ClientAuthError.createEmptyInputScopeSetError();
134
+ }
135
+ var unionScopes = new Set(); // Iterator in constructor not supported in IE11
136
+ otherScopes.scopes.forEach(function (scope) { return unionScopes.add(scope.toLowerCase()); });
137
+ this.scopes.forEach(function (scope) { return unionScopes.add(scope.toLowerCase()); });
138
+ return unionScopes;
139
+ };
140
+ /**
141
+ * Check if scopes intersect between this set and another.
142
+ * @param otherScopes
143
+ */
144
+ ScopeSet.prototype.intersectingScopeSets = function (otherScopes) {
145
+ if (!otherScopes) {
146
+ throw ClientAuthError.createEmptyInputScopeSetError();
147
+ }
148
+ // Do not allow OIDC scopes to be the only intersecting scopes
149
+ if (!otherScopes.containsOnlyOIDCScopes()) {
150
+ otherScopes.removeOIDCScopes();
151
+ }
152
+ var unionScopes = this.unionScopeSets(otherScopes);
153
+ var sizeOtherScopes = otherScopes.getScopeCount();
154
+ var sizeThisScopes = this.getScopeCount();
155
+ var sizeUnionScopes = unionScopes.size;
156
+ return sizeUnionScopes < (sizeThisScopes + sizeOtherScopes);
157
+ };
158
+ /**
159
+ * Returns size of set of scopes.
160
+ */
161
+ ScopeSet.prototype.getScopeCount = function () {
162
+ return this.scopes.size;
163
+ };
164
+ /**
165
+ * Returns the scopes as an array of string values
166
+ */
167
+ ScopeSet.prototype.asArray = function () {
168
+ var array = [];
169
+ this.scopes.forEach(function (val) { return array.push(val); });
170
+ return array;
171
+ };
172
+ /**
173
+ * Prints scopes into a space-delimited string
174
+ */
175
+ ScopeSet.prototype.printScopes = function () {
176
+ if (this.scopes) {
177
+ var scopeArr = this.asArray();
178
+ return scopeArr.join(" ");
179
+ }
180
+ return "";
181
+ };
182
+ /**
183
+ * Prints scopes into a space-delimited lower-case string (used for caching)
184
+ */
185
+ ScopeSet.prototype.printScopesLowerCase = function () {
186
+ return this.printScopes().toLowerCase();
187
+ };
188
+ return ScopeSet;
189
+ }());
190
+
191
+ export { ScopeSet };
192
+ //# sourceMappingURL=ScopeSet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScopeSet.js","sources":["../../src/request/ScopeSet.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ClientConfigurationError } from \"../error/ClientConfigurationError\";\nimport { StringUtils } from \"../utils/StringUtils\";\nimport { ClientAuthError } from \"../error/ClientAuthError\";\nimport { OIDC_SCOPES } from \"../utils/Constants\";\n\n/**\n * The ScopeSet class creates a set of scopes. Scopes are case-insensitive, unique values, so the Set object in JS makes\n * the most sense to implement for this class. All scopes are trimmed and converted to lower case strings in intersection and union functions\n * to ensure uniqueness of strings.\n */\nexport class ScopeSet {\n // Scopes as a Set of strings\n private scopes: Set<string>;\n\n constructor(inputScopes: Array<string>) {\n // Filter empty string and null/undefined array items\n const scopeArr = inputScopes ? StringUtils.trimArrayEntries([...inputScopes]) : [];\n const filteredInput = scopeArr ? StringUtils.removeEmptyStringsFromArray(scopeArr) : [];\n\n // Validate and filter scopes (validate function throws if validation fails)\n this.validateInputScopes(filteredInput);\n\n this.scopes = new Set<string>(); // Iterator in constructor not supported by IE11\n filteredInput.forEach(scope => this.scopes.add(scope));\n }\n\n /**\n * Factory method to create ScopeSet from space-delimited string\n * @param inputScopeString\n * @param appClientId\n * @param scopesRequired\n */\n static fromString(inputScopeString: string): ScopeSet {\n const scopeString = inputScopeString || \"\";\n const inputScopes: Array<string> = scopeString.split(\" \");\n return new ScopeSet(inputScopes);\n }\n\n /**\n * Used to validate the scopes input parameter requested by the developer.\n * @param {Array<string>} inputScopes - Developer requested permissions. Not all scopes are guaranteed to be included in the access token returned.\n * @param {boolean} scopesRequired - Boolean indicating whether the scopes array is required or not\n */\n private validateInputScopes(inputScopes: Array<string>): void {\n // Check if scopes are required but not given or is an empty array\n if (!inputScopes || inputScopes.length < 1) {\n throw ClientConfigurationError.createEmptyScopesArrayError();\n }\n }\n\n /**\n * Check if a given scope is present in this set of scopes.\n * @param scope\n */\n containsScope(scope: string): boolean {\n const lowerCaseScopes = this.printScopesLowerCase().split(\" \");\n const lowerCaseScopesSet = new ScopeSet(lowerCaseScopes);\n // compare lowercase scopes\n return !StringUtils.isEmpty(scope) ? lowerCaseScopesSet.scopes.has(scope.toLowerCase()) : false;\n }\n\n /**\n * Check if a set of scopes is present in this set of scopes.\n * @param scopeSet\n */\n containsScopeSet(scopeSet: ScopeSet): boolean {\n if (!scopeSet || scopeSet.scopes.size <= 0) {\n return false;\n }\n\n return (this.scopes.size >= scopeSet.scopes.size && scopeSet.asArray().every(scope => this.containsScope(scope)));\n }\n\n /**\n * Check if set of scopes contains only the defaults\n */\n containsOnlyOIDCScopes(): boolean {\n let defaultScopeCount = 0;\n OIDC_SCOPES.forEach((defaultScope: string) => {\n if (this.containsScope(defaultScope)) {\n defaultScopeCount += 1;\n }\n });\n\n return this.scopes.size === defaultScopeCount;\n }\n\n /**\n * Appends single scope if passed\n * @param newScope\n */\n appendScope(newScope: string): void {\n if (!StringUtils.isEmpty(newScope)) {\n this.scopes.add(newScope.trim());\n }\n }\n\n /**\n * Appends multiple scopes if passed\n * @param newScopes\n */\n appendScopes(newScopes: Array<string>): void {\n try {\n newScopes.forEach(newScope => this.appendScope(newScope));\n } catch (e) {\n throw ClientAuthError.createAppendScopeSetError(e);\n }\n }\n\n /**\n * Removes element from set of scopes.\n * @param scope\n */\n removeScope(scope: string): void {\n if (StringUtils.isEmpty(scope)) {\n throw ClientAuthError.createRemoveEmptyScopeFromSetError(scope);\n }\n this.scopes.delete(scope.trim());\n }\n\n /**\n * Removes default scopes from set of scopes\n * Primarily used to prevent cache misses if the default scopes are not returned from the server\n */\n removeOIDCScopes(): void {\n OIDC_SCOPES.forEach((defaultScope: string) => {\n this.scopes.delete(defaultScope);\n });\n }\n\n /**\n * Combines an array of scopes with the current set of scopes.\n * @param otherScopes\n */\n unionScopeSets(otherScopes: ScopeSet): Set<string> {\n if (!otherScopes) {\n throw ClientAuthError.createEmptyInputScopeSetError();\n }\n const unionScopes = new Set<string>(); // Iterator in constructor not supported in IE11\n otherScopes.scopes.forEach(scope => unionScopes.add(scope.toLowerCase()));\n this.scopes.forEach(scope => unionScopes.add(scope.toLowerCase()));\n return unionScopes;\n }\n\n /**\n * Check if scopes intersect between this set and another.\n * @param otherScopes\n */\n intersectingScopeSets(otherScopes: ScopeSet): boolean {\n if (!otherScopes) {\n throw ClientAuthError.createEmptyInputScopeSetError();\n }\n \n // Do not allow OIDC scopes to be the only intersecting scopes\n if (!otherScopes.containsOnlyOIDCScopes()) {\n otherScopes.removeOIDCScopes();\n }\n const unionScopes = this.unionScopeSets(otherScopes);\n const sizeOtherScopes = otherScopes.getScopeCount();\n const sizeThisScopes = this.getScopeCount();\n const sizeUnionScopes = unionScopes.size;\n return sizeUnionScopes < (sizeThisScopes + sizeOtherScopes);\n }\n\n /**\n * Returns size of set of scopes.\n */\n getScopeCount(): number {\n return this.scopes.size;\n }\n\n /**\n * Returns the scopes as an array of string values\n */\n asArray(): Array<string> {\n const array: Array<string> = [];\n this.scopes.forEach(val => array.push(val));\n return array;\n }\n\n /**\n * Prints scopes into a space-delimited string\n */\n printScopes(): string {\n if (this.scopes) {\n const scopeArr = this.asArray();\n return scopeArr.join(\" \");\n }\n return \"\";\n }\n\n /**\n * Prints scopes into a space-delimited lower-case string (used for caching)\n */\n printScopesLowerCase(): string {\n return this.printScopes().toLowerCase();\n }\n}\n"],"names":[],"mappings":";;;;;;;;AAAA;;;;AAUA;;;;;;IASI,kBAAY,WAA0B;QAAtC,iBAUC;;QARG,IAAM,QAAQ,GAAG,WAAW,GAAG,WAAW,CAAC,gBAAgB,gBAAK,WAAW,EAAE,GAAG,EAAE,CAAC;QACnF,IAAM,aAAa,GAAG,QAAQ,GAAG,WAAW,CAAC,2BAA2B,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC;;QAGxF,IAAI,CAAC,mBAAmB,CAAC,aAAa,CAAC,CAAC;QAExC,IAAI,CAAC,MAAM,GAAG,IAAI,GAAG,EAAU,CAAC;QAChC,aAAa,CAAC,OAAO,CAAC,UAAA,KAAK,IAAI,OAAA,KAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,GAAA,CAAC,CAAC;KAC1D;;;;;;;IAQM,mBAAU,GAAjB,UAAkB,gBAAwB;QACtC,IAAM,WAAW,GAAG,gBAAgB,IAAI,EAAE,CAAC;QAC3C,IAAM,WAAW,GAAkB,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC1D,OAA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@@ export declare type AuthenticationResult = {
24
24
  idTokenClaims: object;
25
25
  accessToken: string;
26
26
  fromCache: boolean;
27
- expiresOn: Date;
27
+ expiresOn: Date | null;
28
28
  tokenType: string;
29
29
  extExpiresOn?: Date;
30
30
  state?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"AuthenticationResult.d.ts","sourceRoot":"","sources":["../../src/response/AuthenticationResult.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD;;;;;;;;;;;;;;GAcG;AACH,oBAAY,oBAAoB,GAAG;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACtB,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,IAAI,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC"}
1
+ {"version":3,"file":"AuthenticationResult.d.ts","sourceRoot":"","sources":["../../src/response/AuthenticationResult.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD;;;;;;;;;;;;;;GAcG;AACH,oBAAY,oBAAoB,GAAG;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACtB,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,IAAI,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC"}
@@ -9,5 +9,6 @@ export declare type AuthorizationCodePayload = {
9
9
  msgraph_host?: string;
10
10
  state?: string;
11
11
  nonce?: string;
12
+ client_info?: string;
12
13
  };
13
14
  //# sourceMappingURL=AuthorizationCodePayload.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AuthorizationCodePayload.d.ts","sourceRoot":"","sources":["../../src/response/AuthorizationCodePayload.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,oBAAY,wBAAwB,GAAG;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;CACjB,CAAC"}
1
+ {"version":3,"file":"AuthorizationCodePayload.d.ts","sourceRoot":"","sources":["../../src/response/AuthorizationCodePayload.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,oBAAY,wBAAwB,GAAG;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare type IMDSBadResponse = {
2
+ error: string;
3
+ "newest-versions": Array<string>;
4
+ };
5
+ //# sourceMappingURL=IMDSBadResponse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IMDSBadResponse.d.ts","sourceRoot":"","sources":["../../src/response/IMDSBadResponse.ts"],"names":[],"mappings":"AAKA,oBAAY,eAAe,GAAG;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACpC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ResponseHandler.d.ts","sourceRoot":"","sources":["../../src/response/ResponseHandler.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;AAEtF,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAG5C,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAMnD,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAiB,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAI3E,OAAO,EAAE,YAAY,EAAE,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,CAAC,iBAAiB,CAAsB;gBAEnC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,EAAE,uBAAuB,GAAG,IAAI,EAAE,iBAAiB,EAAE,YAAY,GAAG,IAAI;IASvL;;;;;OAKG;IACH,uCAAuC,CAAC,kBAAkB,EAAE,+BAA+B,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,GAAG,IAAI;IAwB3I;;;OAGG;IACH,qBAAqB,CAAC,cAAc,EAAE,gCAAgC,GAAG,IAAI;IAY7E;;;;OAIG;IACG,yBAAyB,CAC3B,mBAAmB,EAAE,gCAAgC,EACrD,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,eAAe,EACxB,eAAe,CAAC,EAAE,wBAAwB,EAC1C,YAAY,CAAC,EAAE,MAAM,EACrB,4BAA4B,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAuD1E;;;;;OAKG;IACH,OAAO,CAAC,mBAAmB;IAqF3B;;;;;OAKG;IACH,OAAO,CAAC,qBAAqB;IAqB7B;;;;;;;;;OASG;WACU,4BAA4B,CACrC,SAAS,EAAE,OAAO,EAClB,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,WAAW,EACxB,cAAc,EAAE,OAAO,EACvB,OAAO,EAAE,eAAe,EACxB,UAAU,CAAC,EAAE,SAAS,EACtB,YAAY,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,oBAAoB,CAAC;CA4CxE"}
@@ -0,0 +1,281 @@
1
+ /*! @azure/msal-common v4.5.1 2021-08-02 */
2
+ 'use strict';
3
+ import { __awaiter, __generator } from '../_virtual/_tslib.js';
4
+ import { buildClientInfo } from '../account/ClientInfo.js';
5
+ import { ClientAuthError } from '../error/ClientAuthError.js';
6
+ import { StringUtils } from '../utils/StringUtils.js';
7
+ import { ServerError } from '../error/ServerError.js';
8
+ import { AuthToken } from '../account/AuthToken.js';
9
+ import { ScopeSet } from '../request/ScopeSet.js';
10
+ import { AccountEntity } from '../cache/entities/AccountEntity.js';
11
+ import { AuthorityType } from '../authority/AuthorityType.js';
12
+ import { IdTokenEntity } from '../cache/entities/IdTokenEntity.js';
13
+ import { AccessTokenEntity } from '../cache/entities/AccessTokenEntity.js';
14
+ import { RefreshTokenEntity } from '../cache/entities/RefreshTokenEntity.js';
15
+ import { InteractionRequiredAuthError } from '../error/InteractionRequiredAuthError.js';
16
+ import { CacheRecord } from '../cache/entities/CacheRecord.js';
17
+ import { ProtocolUtils } from '../utils/ProtocolUtils.js';
18
+ import { Constants, AuthenticationScheme, THE_FAMILY_ID } from '../utils/Constants.js';
19
+ import { PopTokenGenerator } from '../crypto/PopTokenGenerator.js';
20
+ import { AppMetadataEntity } from '../cache/entities/AppMetadataEntity.js';
21
+ import { TokenCacheContext } from '../cache/persistence/TokenCacheContext.js';
22
+
23
+ /*
24
+ * Copyright (c) Microsoft Corporation. All rights reserved.
25
+ * Licensed under the MIT License.
26
+ */
27
+ /**
28
+ * Class that handles response parsing.
29
+ */
30
+ var ResponseHandler = /** @class */ (function () {
31
+ function ResponseHandler(clientId, cacheStorage, cryptoObj, logger, serializableCache, persistencePlugin) {
32
+ this.clientId = clientId;
33
+ this.cacheStorage = cacheStorage;
34
+ this.cryptoObj = cryptoObj;
35
+ this.logger = logger;
36
+ this.serializableCache = serializableCache;
37
+ this.persistencePlugin = persistencePlugin;
38
+ }
39
+ /**
40
+ * Function which validates server authorization code response.
41
+ * @param serverResponseHash
42
+ * @param cachedState
43
+ * @param cryptoObj
44
+ */
45
+ ResponseHandler.prototype.validateServerAuthorizationCodeResponse = function (serverResponseHash, cachedState, cryptoObj) {
46
+ if (!serverResponseHash.state || !cachedState) {
47
+ throw !serverResponseHash.state ? ClientAuthError.createStateNotFoundError("Server State") : ClientAuthError.createStateNotFoundError("Cached State");
48
+ }
49
+ if (decodeURIComponent(serverResponseHash.state) !== decodeURIComponent(cachedState)) {
50
+ throw ClientAuthError.createStateMismatchError();
51
+ }
52
+ // Check for error
53
+ if (serverResponseHash.error || serverResponseHash.error_description || serverResponseHash.suberror) {
54
+ if (InteractionRequiredAuthError.isInteractionRequiredError(serverResponseHash.error, serverResponseHash.error_description, serverResponseHash.suberror)) {
55
+ throw new InteractionRequiredAuthError(serverResponseHash.error || Constants.EMPTY_STRING, serverResponseHash.error_description, serverResponseHash.suberror);
56
+ }
57
+ throw new ServerError(serverResponseHash.error || Constants.EMPTY_STRING, serverResponseHash.error_description, serverResponseHash.suberror);
58
+ }
59
+ if (serverResponseHash.client_info) {
60
+ buildClientInfo(serverResponseHash.client_info, cryptoObj);
61
+ }
62
+ };
63
+ /**
64
+ * Function which validates server authorization token response.
65
+ * @param serverResponse
66
+ */
67
+ ResponseHandler.prototype.validateTokenResponse = function (serverResponse) {
68
+ // Check for error
69
+ if (serverResponse.error || serverResponse.error_description || serverResponse.suberror) {
70
+ if (InteractionRequiredAuthError.isInteractionRequiredError(serverResponse.error, serverResponse.error_description, serverResponse.suberror)) {
71
+ throw new InteractionRequiredAuthError(serverResponse.error, serverResponse.error_description, serverResponse.suberror);
72
+ }
73
+ var errString = serverResponse.error_codes + " - [" + serverResponse.timestamp + "]: " + serverResponse.error_description + " - Correlation ID: " + serverResponse.correlation_id + " - Trace ID: " + serverResponse.trace_id;
74
+ throw new ServerError(serverResponse.error, errString, serverResponse.suberror);
75
+ }
76
+ };
77
+ /**
78
+ * Returns a constructed token response based on given string. Also manages the cache updates and cleanups.
79
+ * @param serverTokenResponse
80
+ * @param authority
81
+ */
82
+ ResponseHandler.prototype.handleServerTokenResponse = function (serverTokenResponse, authority, reqTimestamp, request, authCodePayload, oboAssertion, handlingRefreshTokenResponse) {
83
+ return __awaiter(this, void 0, void 0, function () {
84
+ var idTokenObj, requestStateObj, cacheRecord, cacheContext, key, account;
85
+ return __generator(this, function (_a) {
86
+ switch (_a.label) {
87
+ case 0:
88
+ if (serverTokenResponse.id_token) {
89
+ idTokenObj = new AuthToken(serverTokenResponse.id_token || Constants.EMPTY_STRING, this.cryptoObj);
90
+ // token nonce check (TODO: Add a warning if no nonce is given?)
91
+ if (authCodePayload && !StringUtils.isEmpty(authCodePayload.nonce)) {
92
+ if (idTokenObj.claims.nonce !== authCodePayload.nonce) {
93
+ throw ClientAuthError.createNonceMismatchError();
94
+ }
95
+ }
96
+ }
97
+ // generate homeAccountId
98
+ this.homeAccountIdentifier = AccountEntity.generateHomeAccountId(serverTokenResponse.client_info || Constants.EMPTY_STRING, authority.authorityType, this.logger, this.cryptoObj, idTokenObj);
99
+ if (!!authCodePayload && !!authCodePayload.state) {
100
+ requestStateObj = ProtocolUtils.parseRequestState(this.cryptoObj, authCodePayload.state);
101
+ }
102
+ cacheRecord = this.generateCacheRecord(serverTokenResponse, authority, reqTimestamp, idTokenObj, request.scopes, oboAssertion, authCodePayload);
103
+ _a.label = 1;
104
+ case 1:
105
+ _a.trys.push([1, , 4, 7]);
106
+ if (!(this.persistencePlugin && this.serializableCache)) return [3 /*break*/, 3];
107
+ this.logger.verbose("Persistence enabled, calling beforeCacheAccess");
108
+ cacheContext = new TokenCacheContext(this.serializableCache, true);
109
+ return [4 /*yield*/, this.persistencePlugin.beforeCacheAccess(cacheContext)];
110
+ case 2:
111
+ _a.sent();
112
+ _a.label = 3;
113
+ case 3:
114
+ /*
115
+ * When saving a refreshed tokens to the cache, it is expected that the account that was used is present in the cache.
116
+ * If not present, we should return null, as it's the case that another application called removeAccount in between
117
+ * the calls to getAllAccounts and acquireTokenSilent. We should not overwrite that removal.
118
+ */
119
+ if (handlingRefreshTokenResponse && cacheRecord.account) {
120
+ key = cacheRecord.account.generateAccountKey();
121
+ account = this.cacheStorage.getAccount(key);
122
+ if (!account) {
123
+ this.logger.warning("Account used to refresh tokens not in persistence, refreshed tokens will not be stored in the cache");
124
+ return [2 /*return*/, ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, idTokenObj, requestStateObj)];
125
+ }
126
+ }
127
+ this.cacheStorage.saveCacheRecord(cacheRecord);
128
+ return [3 /*break*/, 7];
129
+ case 4:
130
+ if (!(this.persistencePlugin && this.serializableCache && cacheContext)) return [3 /*break*/, 6];
131
+ this.logger.verbose("Persistence enabled, calling afterCacheAccess");
132
+ return [4 /*yield*/, this.persistencePlugin.afterCacheAccess(cacheContext)];
133
+ case 5:
134
+ _a.sent();
135
+ _a.label = 6;
136
+ case 6: return [7 /*endfinally*/];
137
+ case 7: return [2 /*return*/, ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, idTokenObj, requestStateObj)];
138
+ }
139
+ });
140
+ });
141
+ };
142
+ /**
143
+ * Generates CacheRecord
144
+ * @param serverTokenResponse
145
+ * @param idTokenObj
146
+ * @param authority
147
+ */
148
+ ResponseHandler.prototype.generateCacheRecord = function (serverTokenResponse, authority, reqTimestamp, idTokenObj, requestScopes, oboAssertion, authCodePayload) {
149
+ var env = authority.getPreferredCache();
150
+ if (StringUtils.isEmpty(env)) {
151
+ throw ClientAuthError.createInvalidCacheEnvironmentError();
152
+ }
153
+ // IdToken: non AAD scenarios can have empty realm
154
+ var cachedIdToken;
155
+ var cachedAccount;
156
+ if (!StringUtils.isEmpty(serverTokenResponse.id_token) && !!idTokenObj) {
157
+ cachedIdToken = IdTokenEntity.createIdTokenEntity(this.homeAccountIdentifier, env, serverTokenResponse.id_token || Constants.EMPTY_STRING, this.clientId, idTokenObj.claims.tid || Constants.EMPTY_STRING, oboAssertion);
158
+ cachedAccount = this.generateAccountEntity(serverTokenResponse, idTokenObj, authority, oboAssertion, authCodePayload);
159
+ }
160
+ // AccessToken
161
+ var cachedAccessToken = null;
162
+ if (!StringUtils.isEmpty(serverTokenResponse.access_token)) {
163
+ // If scopes not returned in server response, use request scopes
164
+ var responseScopes = serverTokenResponse.scope ? ScopeSet.fromString(serverTokenResponse.scope) : new ScopeSet(requestScopes || []);
165
+ /*
166
+ * Use timestamp calculated before request
167
+ * Server may return timestamps as strings, parse to numbers if so.
168
+ */
169
+ var expiresIn = (typeof serverTokenResponse.expires_in === "string" ? parseInt(serverTokenResponse.expires_in, 10) : serverTokenResponse.expires_in) || 0;
170
+ var extExpiresIn = (typeof serverTokenResponse.ext_expires_in === "string" ? parseInt(serverTokenResponse.ext_expires_in, 10) : serverTokenResponse.ext_expires_in) || 0;
171
+ var refreshIn = (typeof serverTokenResponse.refresh_in === "string" ? parseInt(serverTokenResponse.refresh_in, 10) : serverTokenResponse.refresh_in) || undefined;
172
+ var tokenExpirationSeconds = reqTimestamp + expiresIn;
173
+ var extendedTokenExpirationSeconds = tokenExpirationSeconds + extExpiresIn;
174
+ var refreshOnSeconds = refreshIn && refreshIn > 0 ? reqTimestamp + refreshIn : undefined;
175
+ // non AAD scenarios can have empty realm
176
+ cachedAccessToken = AccessTokenEntity.createAccessTokenEntity(this.homeAccountIdentifier, env, serverTokenResponse.access_token || Constants.EMPTY_STRING, this.clientId, idTokenObj ? idTokenObj.claims.tid || Constants.EMPTY_STRING : authority.tenant, responseScopes.printScopes(), tokenExpirationSeconds, extendedTokenExpirationSeconds, this.cryptoObj, refreshOnSeconds, serverTokenResponse.token_type, oboAssertion);
177
+ }
178
+ // refreshToken
179
+ var cachedRefreshToken = null;
180
+ if (!StringUtils.isEmpty(serverTokenResponse.refresh_token)) {
181
+ cachedRefreshToken = RefreshTokenEntity.createRefreshTokenEntity(this.homeAccountIdentifier, env, serverTokenResponse.refresh_token || Constants.EMPTY_STRING, this.clientId, serverTokenResponse.foci, oboAssertion);
182
+ }
183
+ // appMetadata
184
+ var cachedAppMetadata = null;
185
+ if (!StringUtils.isEmpty(serverTokenResponse.foci)) {
186
+ cachedAppMetadata = AppMetadataEntity.createAppMetadataEntity(this.clientId, env, serverTokenResponse.foci);
187
+ }
188
+ return new CacheRecord(cachedAccount, cachedIdToken, cachedAccessToken, cachedRefreshToken, cachedAppMetadata);
189
+ };
190
+ /**
191
+ * Generate Account
192
+ * @param serverTokenResponse
193
+ * @param idToken
194
+ * @param authority
195
+ */
196
+ ResponseHandler.prototype.generateAccountEntity = function (serverTokenResponse, idToken, authority, oboAssertion, authCodePayload) {
197
+ var authorityType = authority.authorityType;
198
+ var cloudGraphHostName = authCodePayload ? authCodePayload.cloud_graph_host_name : "";
199
+ var msGraphhost = authCodePayload ? authCodePayload.msgraph_host : "";
200
+ // ADFS does not require client_info in the response
201
+ if (authorityType === AuthorityType.Adfs) {
202
+ this.logger.verbose("Authority type is ADFS, creating ADFS account");
203
+ return AccountEntity.createGenericAccount(authority, this.homeAccountIdentifier, idToken, oboAssertion, cloudGraphHostName, msGraphhost);
204
+ }
205
+ // This fallback applies to B2C as well as they fall under an AAD account type.
206
+ if (StringUtils.isEmpty(serverTokenResponse.client_info) && authority.protocolMode === "AAD") {
207
+ throw ClientAuthError.createClientInfoEmptyError();
208
+ }
209
+ return serverTokenResponse.client_info ?
210
+ AccountEntity.createAccount(serverTokenResponse.client_info, this.homeAccountIdentifier, authority, idToken, oboAssertion, cloudGraphHostName, msGraphhost) :
211
+ AccountEntity.createGenericAccount(authority, this.homeAccountIdentifier, idToken, oboAssertion, cloudGraphHostName, msGraphhost);
212
+ };
213
+ /**
214
+ * Creates an @AuthenticationResult from @CacheRecord , @IdToken , and a boolean that states whether or not the result is from cache.
215
+ *
216
+ * Optionally takes a state string that is set as-is in the response.
217
+ *
218
+ * @param cacheRecord
219
+ * @param idTokenObj
220
+ * @param fromTokenCache
221
+ * @param stateString
222
+ */
223
+ ResponseHandler.generateAuthenticationResult = function (cryptoObj, authority, cacheRecord, fromTokenCache, request, idTokenObj, requestState) {
224
+ var _a, _b, _c;
225
+ return __awaiter(this, void 0, void 0, function () {
226
+ var accessToken, responseScopes, expiresOn, extExpiresOn, familyId, popTokenGenerator, uid, tid;
227
+ return __generator(this, function (_d) {
228
+ switch (_d.label) {
229
+ case 0:
230
+ accessToken = "";
231
+ responseScopes = [];
232
+ expiresOn = null;
233
+ familyId = Constants.EMPTY_STRING;
234
+ if (!cacheRecord.accessToken) return [3 /*break*/, 4];
235
+ if (!(cacheRecord.accessToken.tokenType === AuthenticationScheme.POP)) return [3 /*break*/, 2];
236
+ popTokenGenerator = new PopTokenGenerator(cryptoObj);
237
+ return [4 /*yield*/, popTokenGenerator.signPopToken(cacheRecord.accessToken.secret, request)];
238
+ case 1:
239
+ accessToken = _d.sent();
240
+ return [3 /*break*/, 3];
241
+ case 2:
242
+ accessToken = cacheRecord.accessToken.secret;
243
+ _d.label = 3;
244
+ case 3:
245
+ responseScopes = ScopeSet.fromString(cacheRecord.accessToken.target).asArray();
246
+ expiresOn = new Date(Number(cacheRecord.accessToken.expiresOn) * 1000);
247
+ extExpiresOn = new Date(Number(cacheRecord.accessToken.extendedExpiresOn) * 1000);
248
+ _d.label = 4;
249
+ case 4:
250
+ if (cacheRecord.appMetadata) {
251
+ familyId = cacheRecord.appMetadata.familyId === THE_FAMILY_ID ? THE_FAMILY_ID : Constants.EMPTY_STRING;
252
+ }
253
+ uid = (idTokenObj === null || idTokenObj === void 0 ? void 0 : idTokenObj.claims.oid) || (idTokenObj === null || idTokenObj === void 0 ? void 0 : idTokenObj.claims.sub) || Constants.EMPTY_STRING;
254
+ tid = (idTokenObj === null || idTokenObj === void 0 ? void 0 : idTokenObj.claims.tid) || Constants.EMPTY_STRING;
255
+ return [2 /*return*/, {
256
+ authority: authority.canonicalAuthority,
257
+ uniqueId: uid,
258
+ tenantId: tid,
259
+ scopes: responseScopes,
260
+ account: cacheRecord.account ? cacheRecord.account.getAccountInfo() : null,
261
+ idToken: idTokenObj ? idTokenObj.rawToken : Constants.EMPTY_STRING,
262
+ idTokenClaims: idTokenObj ? idTokenObj.claims : {},
263
+ accessToken: accessToken,
264
+ fromCache: fromTokenCache,
265
+ expiresOn: expiresOn,
266
+ extExpiresOn: extExpiresOn,
267
+ familyId: familyId,
268
+ tokenType: ((_a = cacheRecord.accessToken) === null || _a === void 0 ? void 0 : _a.tokenType) || Constants.EMPTY_STRING,
269
+ state: requestState ? requestState.userRequestState : Constants.EMPTY_STRING,
270
+ cloudGraphHostName: ((_b = cacheRecord.account) === null || _b === void 0 ? void 0 : _b.cloudGraphHostName) || Constants.EMPTY_STRING,
271
+ msGraphHost: ((_c = cacheRecord.account) === null || _c === void 0 ? void 0 : _c.msGraphHost) || Constants.EMPTY_STRING
272
+ }];
273
+ }
274
+ });
275
+ });
276
+ };
277
+ return ResponseHandler;
278
+ }());
279
+
280
+ export { ResponseHandler };
281
+ //# sourceMappingURL=ResponseHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResponseHandler.js","sources":["../../src/response/ResponseHandler.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ServerAuthorizationTokenResponse } from \"./ServerAuthorizationTokenResponse\";\nimport { buildClientInfo} from \"../account/ClientInfo\";\nimport { ICrypto } from \"../crypto/ICrypto\";\nimport { ClientAuthError } from \"../error/ClientAuthError\";\nimport { StringUtils } from \"../utils/StringUtils\";\nimport { ServerAuthorizationCodeResponse } from \"./ServerAuthorizationCodeResponse\";\nimport { Logger } from \"../logger/Logger\";\nimport { ServerError } from \"../error/ServerError\";\nimport { AuthToken } from \"../account/AuthToken\";\nimport { ScopeSet } from \"../request/ScopeSet\";\nimport { AuthenticationResult } from \"./AuthenticationResult\";\nimport { AccountEntity } from \"../cache/entities/AccountEntity\";\nimport { Authority } from \"../authority/Authority\";\nimport { AuthorityType } from \"../authority/AuthorityType\";\nimport { IdTokenEntity } from \"../cache/entities/IdTokenEntity\";\nimport { AccessTokenEntity } from \"../cache/entities/AccessTokenEntity\";\nimport { RefreshTokenEntity } from \"../cache/entities/RefreshTokenEntity\";\nimport { InteractionRequiredAuthError } from \"../error/InteractionRequiredAuthError\";\nimport { CacheRecord } from \"../cache/entities/CacheRecord\";\nimport { CacheManager } from \"../cache/CacheManager\";\nimport { ProtocolUtils, RequestStateObject } from \"../utils/ProtocolUtils\";\nimport { AuthenticationScheme, Constants, THE_FAMILY_ID } from \"../utils/Constants\";\nimport { PopTokenGenerator } from \"../crypto/PopTokenGenerator\";\nimport { AppMetadataEntity } from \"../cache/entities/AppMetadataEntity\";\nimport { ICachePlugin } from \"../cache/interface/ICachePlugin\";\nimport { TokenCacheContext } from \"../cache/persistence/TokenCacheContext\";\nimport { ISerializableTokenCache } from \"../cache/interface/ISerializableTokenCache\";\nimport { AuthorizationCodePayload } from \"./AuthorizationCodePayload\";\nimport { BaseAuthRequest } from \"../request/BaseAuthRequest\";\n\n/**\n * Class that handles response parsing.\n */\nexport class ResponseHandler {\n private clientId: string;\n private cacheStorage: CacheManager;\n private cryptoObj: ICrypto;\n private logger: Logger;\n private homeAccountIdentifier: string;\n private serializableCache: ISerializableTokenCache | null;\n private persistencePlugin: ICachePlugin | null;\n\n constructor(clientId: string, cacheStorage: CacheManager, cryptoObj: ICrypto, logger: Logger, serializableCache: ISerializableTokenCache | null, persistencePlugin: ICachePlugin | null) {\n this.clientId = clientId;\n this.cacheStorage = cacheStorage;\n this.cryptoObj = cryptoObj;\n this.logger = logger;\n this.serializableCache = serializableCache;\n this.persistencePlugin = persistencePlugin;\n }\n\n /**\n * Function which validates server authorization code response.\n * @param serverResponseHash\n * @param cachedState\n * @param cryptoObj\n */\n validateServerAuthorizationCodeResponse(serverResponseHash: ServerAuthorizationCodeResponse, cachedState: string, cryptoObj: ICrypto): void {\n\n if (!serverResponseHash.state || !cachedState) {\n throw !serverResponseHash.state ? ClientAuthError.createStateNotFoundError(\"Server State\") : ClientAuthError.createStateNotFoundError(\"Cached State\");\n }\n\n if (decodeURIComponent(serverResponseHash.state) !== decodeURIComponent(cachedState)) {\n throw ClientAuthError.createStateMismatchError();\n }\n\n // Check for error\n if (serverResponseHash.error || serverResponseHash.error_description || serverResponseHash.suberror) {\n if (InteractionRequiredAuthError.isInteractionRequiredError(serverResponseHash.error, serverResponseHash.error_description, serverResponseHash.suberror)) {\n throw new InteractionRequiredAuthError(serverResponseHash.error || Constants.EMPTY_STRING, serverResponseHash.error_description, serverResponseHash.suberror);\n }\n\n throw new ServerError(serverResponseHash.error || Constants.EMPTY_STRING, serverResponseHash.error_description, serverResponseHash.suberror);\n }\n\n if (serverResponseHash.client_info) {\n buildClientInfo(serverResponseHash.client_info, cryptoObj);\n }\n }\n\n /**\n * Function which validates server authorization token response.\n * @param serverResponse\n */\n validateTokenResponse(serverResponse: ServerAuthorizationTokenResponse): void {\n // Check for error\n if (serverResponse.error || serverResponse.error_description || serverResponse.suberror) {\n if (InteractionRequiredAuthError.isInteractionRequiredError(serverResponse.error, serverResponse.error_description, serverResponse.suberror)) {\n throw new InteractionRequiredAuthError(serverResponse.error, serverResponse.error_description, serverResponse.suberror);\n }\n\n const errString = `${serverResponse.error_codes} - [${serverResponse.timestamp}]: ${serverResponse.error_description} - Correlation ID: ${serverResponse.correlation_id} - Trace ID: ${serverResponse.trace_id}`;\n throw new ServerError(serverResponse.error, errString, serverResponse.suberror);\n }\n }\n\n /**\n * Returns a constructed token response based on given string. Also manages the cache updates and cleanups.\n * @param serverTokenResponse\n * @param authority\n */\n async handleServerTokenResponse(\n serverTokenResponse: ServerAuthorizationTokenResponse,\n authority: Authority,\n reqTimestamp: number,\n request: BaseAuthRequest,\n authCodePayload?: AuthorizationCodePayload,\n oboAssertion?: string,\n handlingRefreshTokenResponse?: boolean): Promise<AuthenticationResult> {\n\n // create an idToken object (not entity)\n let idTokenObj: AuthToken | undefined;\n if (serverTokenResponse.id_token) {\n idTokenObj = new AuthToken(serverTokenResponse.id_token || Constants.EMPTY_STRING, this.cryptoObj);\n \n // token nonce check (TODO: Add a warning if no nonce is given?)\n if (authCodePayload && !StringUtils.isEmpty(authCodePayload.nonce)) {\n if (idTokenObj.claims.nonce !== authCodePayload.nonce) {\n throw ClientAuthError.createNonceMismatchError();\n }\n }\n }\n\n // generate homeAccountId\n this.homeAccountIdentifier = AccountEntity.generateHomeAccountId(serverTokenResponse.client_info || Constants.EMPTY_STRING, authority.authorityType, this.logger, this.cryptoObj, idTokenObj);\n\n // save the response tokens\n let requestStateObj: RequestStateObject | undefined;\n if (!!authCodePayload && !!authCodePayload.state) {\n requestStateObj = ProtocolUtils.parseRequestState(this.cryptoObj, authCodePayload.state);\n }\n\n const cacheRecord = this.generateCacheRecord(serverTokenResponse, authority, reqTimestamp, idTokenObj, request.scopes, oboAssertion, authCodePayload);\n let cacheContext;\n try {\n if (this.persistencePlugin && this.serializableCache) {\n this.logger.verbose(\"Persistence enabled, calling beforeCacheAccess\");\n cacheContext = new TokenCacheContext(this.serializableCache, true);\n await this.persistencePlugin.beforeCacheAccess(cacheContext);\n }\n /*\n * When saving a refreshed tokens to the cache, it is expected that the account that was used is present in the cache.\n * If not present, we should return null, as it's the case that another application called removeAccount in between\n * the calls to getAllAccounts and acquireTokenSilent. We should not overwrite that removal.\n */\n if (handlingRefreshTokenResponse && cacheRecord.account) {\n const key = cacheRecord.account.generateAccountKey();\n const account = this.cacheStorage.getAccount(key);\n if (!account) {\n this.logger.warning(\"Account used to refresh tokens not in persistence, refreshed tokens will not be stored in the cache\");\n return ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, idTokenObj, requestStateObj);\n }\n }\n this.cacheStorage.saveCacheRecord(cacheRecord);\n } finally {\n if (this.persistencePlugin && this.serializableCache && cacheContext) {\n this.logger.verbose(\"Persistence enabled, calling afterCacheAccess\");\n await this.persistencePlugin.afterCacheAccess(cacheContext);\n }\n }\n return ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, idTokenObj, requestStateObj);\n }\n\n /**\n * Generates CacheRecord\n * @param serverTokenResponse\n * @param idTokenObj\n * @param authority\n */\n private generateCacheRecord(serverTokenResponse: ServerAuthorizationTokenResponse, authority: Authority, reqTimestamp: number, idTokenObj?: AuthToken, requestScopes?: string[], oboAssertion?: string, authCodePayload?: AuthorizationCodePayload): CacheRecord {\n const env = authority.getPreferredCache();\n if (StringUtils.isEmpty(env)) {\n throw ClientAuthError.createInvalidCacheEnvironmentError();\n }\n\n // IdToken: non AAD scenarios can have empty realm\n let cachedIdToken: IdTokenEntity | undefined;\n let cachedAccount: AccountEntity | undefined;\n if (!StringUtils.isEmpty(serverTokenResponse.id_token) && !!idTokenObj) {\n cachedIdToken = IdTokenEntity.createIdTokenEntity(\n this.homeAccountIdentifier,\n env,\n serverTokenResponse.id_token || Constants.EMPTY_STRING,\n this.clientId,\n idTokenObj.claims.tid || Constants.EMPTY_STRING,\n oboAssertion\n );\n\n cachedAccount = this.generateAccountEntity(\n serverTokenResponse,\n idTokenObj,\n authority,\n oboAssertion,\n authCodePayload\n );\n }\n\n // AccessToken\n let cachedAccessToken: AccessTokenEntity | null = null;\n if (!StringUtils.isEmpty(serverTokenResponse.access_token)) {\n\n // If scopes not returned in server response, use request scopes\n const responseScopes = serverTokenResponse.scope ? ScopeSet.fromString(serverTokenResponse.scope) : new ScopeSet(requestScopes || []);\n\n /*\n * Use timestamp calculated before request\n * Server may return timestamps as strings, parse to numbers if so.\n */\n const expiresIn: number = (typeof serverTokenResponse.expires_in === \"string\" ? parseInt(serverTokenResponse.expires_in, 10) : serverTokenResponse.expires_in) || 0;\n const extExpiresIn: number = (typeof serverTokenResponse.ext_expires_in === \"string\" ? parseInt(serverTokenResponse.ext_expires_in, 10) : serverTokenResponse.ext_expires_in) || 0;\n const refreshIn: number | undefined = (typeof serverTokenResponse.refresh_in === \"string\" ? parseInt(serverTokenResponse.refresh_in, 10) : serverTokenResponse.refresh_in) || undefined;\n const tokenExpirationSeconds = reqTimestamp + expiresIn;\n const extendedTokenExpirationSeconds = tokenExpirationSeconds + extExpiresIn;\n const refreshOnSeconds = refreshIn && refreshIn > 0 ? reqTimestamp + refreshIn : undefined;\n\n // non AAD scenarios can have empty realm\n cachedAccessToken = AccessTokenEntity.createAccessTokenEntity(\n this.homeAccountIdentifier,\n env,\n serverTokenResponse.access_token || Constants.EMPTY_STRING,\n this.clientId,\n idTokenObj ? idTokenObj.claims.tid || Constants.EMPTY_STRING : authority.tenant,\n responseScopes.printScopes(),\n tokenExpirationSeconds,\n extendedTokenExpirationSeconds,\n this.cryptoObj,\n refreshOnSeconds,\n serverTokenResponse.token_type,\n oboAssertion\n );\n }\n\n // refreshToken\n let cachedRefreshToken: RefreshTokenEntity | null = null;\n if (!StringUtils.isEmpty(serverTokenResponse.refresh_token)) {\n cachedRefreshToken = RefreshTokenEntity.createRefreshTokenEntity(\n this.homeAccountIdentifier,\n env,\n serverTokenResponse.refresh_token || Constants.EMPTY_STRING,\n this.clientId,\n serverTokenResponse.foci,\n oboAssertion\n );\n }\n\n // appMetadata\n let cachedAppMetadata: AppMetadataEntity | null = null;\n if (!StringUtils.isEmpty(serverTokenResponse.foci)) {\n cachedAppMetadata = AppMetadataEntity.createAppMetadataEntity(this.clientId, env, serverTokenResponse.foci);\n }\n\n return new CacheRecord(cachedAccount, cachedIdToken, cachedAccessToken, cachedRefreshToken, cachedAppMetadata);\n }\n\n /**\n * Generate Account\n * @param serverTokenResponse\n * @param idToken\n * @param authority\n */\n private generateAccountEntity(serverTokenResponse: ServerAuthorizationTokenResponse, idToken: AuthToken, authority: Authority, oboAssertion?: string, authCodePayload?: AuthorizationCodePayload): AccountEntity {\n const authorityType = authority.authorityType;\n const cloudGraphHostName = authCodePayload ? authCodePayload.cloud_graph_host_name : \"\";\n const msGraphhost = authCodePayload ? authCodePayload.msgraph_host : \"\";\n\n // ADFS does not require client_info in the response\n if (authorityType === AuthorityType.Adfs) {\n this.logger.verbose(\"Authority type is ADFS, creating ADFS account\");\n return AccountEntity.createGenericAccount(authority, this.homeAccountIdentifier, idToken, oboAssertion, cloudGraphHostName, msGraphhost);\n }\n\n // This fallback applies to B2C as well as they fall under an AAD account type.\n if (StringUtils.isEmpty(serverTokenResponse.client_info) && authority.protocolMode === \"AAD\") {\n throw ClientAuthError.createClientInfoEmptyError();\n }\n\n return serverTokenResponse.client_info ?\n AccountEntity.createAccount(serverTokenResponse.client_info, this.homeAccountIdentifier, authority, idToken, oboAssertion, cloudGraphHostName, msGraphhost) :\n AccountEntity.createGenericAccount(authority, this.homeAccountIdentifier, idToken, oboAssertion, cloudGraphHostName, msGraphhost);\n }\n\n /**\n * Creates an @AuthenticationResult from @CacheRecord , @IdToken , and a boolean that states whether or not the result is from cache.\n *\n * Optionally takes a state string that is set as-is in the response.\n *\n * @param cacheRecord\n * @param idTokenObj\n * @param fromTokenCache\n * @param stateString\n */\n static async generateAuthenticationResult(\n cryptoObj: ICrypto, \n authority: Authority,\n cacheRecord: CacheRecord, \n fromTokenCache: boolean, \n request: BaseAuthRequest,\n idTokenObj?: AuthToken,\n requestState?: RequestStateObject): Promise<AuthenticationResult> {\n let accessToken: string = \"\";\n let responseScopes: Array<string> = [];\n let expiresOn: Date | null = null;\n let extExpiresOn: Date | undefined;\n let familyId: string = Constants.EMPTY_STRING;\n\n if (cacheRecord.accessToken) {\n if (cacheRecord.accessToken.tokenType === AuthenticationScheme.POP) {\n const popTokenGenerator: PopTokenGenerator = new PopTokenGenerator(cryptoObj);\n accessToken = await popTokenGenerator.signPopToken(cacheRecord.accessToken.secret, request);\n } else {\n accessToken = cacheRecord.accessToken.secret;\n }\n responseScopes = ScopeSet.fromString(cacheRecord.accessToken.target).asArray();\n expiresOn = new Date(Number(cacheRecord.accessToken.expiresOn) * 1000);\n extExpiresOn = new Date(Number(cacheRecord.accessToken.extendedExpiresOn) * 1000);\n }\n\n if (cacheRecord.appMetadata) {\n familyId = cacheRecord.appMetadata.familyId === THE_FAMILY_ID ? THE_FAMILY_ID : Constants.EMPTY_STRING;\n }\n const uid = idTokenObj?.claims.oid || idTokenObj?.claims.sub || Constants.EMPTY_STRING;\n const tid = idTokenObj?.claims.tid || Constants.EMPTY_STRING;\n\n return {\n authority: authority.canonicalAuthority,\n uniqueId: uid,\n tenantId: tid,\n scopes: responseScopes,\n account: cacheRecord.account ? cacheRecord.account.getAccountInfo() : null,\n idToken: idTokenObj ? idTokenObj.rawToken : Constants.EMPTY_STRING,\n idTokenClaims: idTokenObj ? idTokenObj.claims : {},\n accessToken: accessToken,\n fromCache: fromTokenCache,\n expiresOn: expiresOn,\n extExpiresOn: extExpiresOn,\n familyId: familyId,\n tokenType: cacheRecord.accessToken?.tokenType || Constants.EMPTY_STRING,\n state: requestState ? requestState.userRequestState : Constants.EMPTY_STRING,\n cloudGraphHostName: cacheRecord.account?.cloudGraphHostName || Constants.EMPTY_STRING,\n msGraphHost: cacheRecord.account?.msGraphHost || Constants.EMPTY_STRING\n };\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;;AAmCA;;;;IAYI,yBAAY,QAAgB,EAAE,YAA0B,EAAE,SAAkB,EAAE,MAAc,EAAE,iBAAiD,EAAE,iBAAsC;QACnL,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;QAC3C,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;KAC9C;;;;;;;IAQD,iEAAuC,GAAvC,UAAwC,kBAAmD,EAAE,WAAmB,EAAE,SAAkB;QAEhI,IAAI,CAAC,kBAAkB,CAAC,KAAK,IAAI,CAAC,WAAW,EAAE;YAC3C,MAAM,CAAC,kBAAkB,CAAC,KAAK,GAAG,eAAe,CAAC,wBAAwB,CAAC,cAAc,CAAC,GAAG,eAAe,CAAC,wBAAwB,CAAC,cAAc,CAAC,CAAC;SACzJ;QAED,IAAI,kBAAkB,CAAC,kBAAkB,CAAC,KAAK,CAAC,KAAK,kBAAkB,CAAC,WAAW,CAAC,EAAE;YAClF,MAAM,eAAe,CAAC,wBAAwB,EAAE,CAAC;SACpD;;QAGD,IAAI,kBAAkB,CAAC,KAAK,IAAI,kBAAkB,CAA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