@azure/msal-common 4.5.0 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. package/CHANGELOG.json +178 -0
  2. package/{changelog.md → CHANGELOG.md} +446 -390
  3. package/LICENSE +21 -21
  4. package/README.md +62 -61
  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/account/TokenClaims.d.ts +5 -0
  13. package/dist/account/TokenClaims.d.ts.map +1 -1
  14. package/dist/authority/Authority.d.ts.map +1 -1
  15. package/dist/authority/Authority.js +60 -54
  16. package/dist/authority/Authority.js.map +1 -1
  17. package/dist/authority/AuthorityFactory.js +9 -9
  18. package/dist/authority/AuthorityFactory.js.map +1 -1
  19. package/dist/authority/AuthorityType.js +1 -1
  20. package/dist/authority/AuthorityType.js.map +1 -1
  21. package/dist/authority/CloudInstanceDiscoveryResponse.js +1 -1
  22. package/dist/authority/CloudInstanceDiscoveryResponse.js.map +1 -1
  23. package/dist/authority/OpenIdConfigResponse.d.ts +1 -1
  24. package/dist/authority/OpenIdConfigResponse.d.ts.map +1 -1
  25. package/dist/authority/OpenIdConfigResponse.js +1 -2
  26. package/dist/authority/OpenIdConfigResponse.js.map +1 -1
  27. package/dist/authority/ProtocolMode.js +1 -1
  28. package/dist/authority/ProtocolMode.js.map +1 -1
  29. package/dist/authority/RegionDiscovery.js +9 -9
  30. package/dist/authority/RegionDiscovery.js.map +1 -1
  31. package/dist/cache/CacheManager.d.ts +23 -9
  32. package/dist/cache/CacheManager.d.ts.map +1 -1
  33. package/dist/cache/CacheManager.js +244 -114
  34. package/dist/cache/CacheManager.js.map +1 -1
  35. package/dist/cache/entities/AccessTokenEntity.d.ts +3 -2
  36. package/dist/cache/entities/AccessTokenEntity.d.ts.map +1 -1
  37. package/dist/cache/entities/AccessTokenEntity.js +23 -17
  38. package/dist/cache/entities/AccessTokenEntity.js.map +1 -1
  39. package/dist/cache/entities/AccountEntity.d.ts +2 -2
  40. package/dist/cache/entities/AccountEntity.d.ts.map +1 -1
  41. package/dist/cache/entities/AccountEntity.js +18 -18
  42. package/dist/cache/entities/AccountEntity.js.map +1 -1
  43. package/dist/cache/entities/AppMetadataEntity.js +1 -1
  44. package/dist/cache/entities/AppMetadataEntity.js.map +1 -1
  45. package/dist/cache/entities/AuthorityMetadataEntity.d.ts +1 -1
  46. package/dist/cache/entities/AuthorityMetadataEntity.d.ts.map +1 -1
  47. package/dist/cache/entities/AuthorityMetadataEntity.js +5 -6
  48. package/dist/cache/entities/AuthorityMetadataEntity.js.map +1 -1
  49. package/dist/cache/entities/CacheRecord.js +1 -1
  50. package/dist/cache/entities/CacheRecord.js.map +1 -1
  51. package/dist/cache/entities/CredentialEntity.d.ts +7 -3
  52. package/dist/cache/entities/CredentialEntity.d.ts.map +1 -1
  53. package/dist/cache/entities/CredentialEntity.js +16 -9
  54. package/dist/cache/entities/CredentialEntity.js.map +1 -1
  55. package/dist/cache/entities/IdTokenEntity.js +3 -3
  56. package/dist/cache/entities/IdTokenEntity.js.map +1 -1
  57. package/dist/cache/entities/RefreshTokenEntity.js +3 -3
  58. package/dist/cache/entities/RefreshTokenEntity.js.map +1 -1
  59. package/dist/cache/entities/ServerTelemetryEntity.js +1 -1
  60. package/dist/cache/entities/ServerTelemetryEntity.js.map +1 -1
  61. package/dist/cache/entities/ThrottlingEntity.js +1 -1
  62. package/dist/cache/entities/ThrottlingEntity.js.map +1 -1
  63. package/dist/cache/interface/ICacheManager.d.ts +5 -5
  64. package/dist/cache/interface/ICacheManager.d.ts.map +1 -1
  65. package/dist/cache/persistence/TokenCacheContext.js +3 -3
  66. package/dist/cache/persistence/TokenCacheContext.js.map +1 -1
  67. package/dist/cache/utils/CacheTypes.d.ts +4 -1
  68. package/dist/cache/utils/CacheTypes.d.ts.map +1 -1
  69. package/dist/client/AuthorizationCodeClient.d.ts +1 -1
  70. package/dist/client/AuthorizationCodeClient.d.ts.map +1 -1
  71. package/dist/client/AuthorizationCodeClient.js +56 -43
  72. package/dist/client/AuthorizationCodeClient.js.map +1 -1
  73. package/dist/client/BaseClient.js +11 -11
  74. package/dist/client/BaseClient.js.map +1 -1
  75. package/dist/client/ClientCredentialClient.d.ts.map +1 -1
  76. package/dist/client/ClientCredentialClient.js +24 -18
  77. package/dist/client/ClientCredentialClient.js.map +1 -1
  78. package/dist/client/DeviceCodeClient.d.ts.map +1 -1
  79. package/dist/client/DeviceCodeClient.js +39 -27
  80. package/dist/client/DeviceCodeClient.js.map +1 -1
  81. package/dist/client/OnBehalfOfClient.d.ts.map +1 -1
  82. package/dist/client/OnBehalfOfClient.js +26 -20
  83. package/dist/client/OnBehalfOfClient.js.map +1 -1
  84. package/dist/client/RefreshTokenClient.d.ts.map +1 -1
  85. package/dist/client/RefreshTokenClient.js +49 -32
  86. package/dist/client/RefreshTokenClient.js.map +1 -1
  87. package/dist/client/SilentFlowClient.d.ts.map +1 -1
  88. package/dist/client/SilentFlowClient.js +40 -35
  89. package/dist/client/SilentFlowClient.js.map +1 -1
  90. package/dist/client/UsernamePasswordClient.d.ts.map +1 -1
  91. package/dist/client/UsernamePasswordClient.js +18 -12
  92. package/dist/client/UsernamePasswordClient.js.map +1 -1
  93. package/dist/config/ClientConfiguration.d.ts.map +1 -1
  94. package/dist/config/ClientConfiguration.js +8 -7
  95. package/dist/config/ClientConfiguration.js.map +1 -1
  96. package/dist/crypto/ICrypto.d.ts +11 -1
  97. package/dist/crypto/ICrypto.d.ts.map +1 -1
  98. package/dist/crypto/ICrypto.js +26 -8
  99. package/dist/crypto/ICrypto.js.map +1 -1
  100. package/dist/crypto/PopTokenGenerator.d.ts +21 -4
  101. package/dist/crypto/PopTokenGenerator.d.ts.map +1 -1
  102. package/dist/crypto/PopTokenGenerator.js +42 -31
  103. package/dist/crypto/PopTokenGenerator.js.map +1 -1
  104. package/dist/error/AuthError.d.ts +5 -0
  105. package/dist/error/AuthError.d.ts.map +1 -1
  106. package/dist/error/AuthError.js +6 -3
  107. package/dist/error/AuthError.js.map +1 -1
  108. package/dist/error/ClientAuthError.d.ts +13 -4
  109. package/dist/error/ClientAuthError.d.ts.map +1 -1
  110. package/dist/error/ClientAuthError.js +20 -9
  111. package/dist/error/ClientAuthError.js.map +1 -1
  112. package/dist/error/ClientConfigurationError.d.ts +29 -0
  113. package/dist/error/ClientConfigurationError.d.ts.map +1 -1
  114. package/dist/error/ClientConfigurationError.js +45 -5
  115. package/dist/error/ClientConfigurationError.js.map +1 -1
  116. package/dist/error/InteractionRequiredAuthError.d.ts +24 -5
  117. package/dist/error/InteractionRequiredAuthError.d.ts.map +1 -1
  118. package/dist/error/InteractionRequiredAuthError.js +30 -9
  119. package/dist/error/InteractionRequiredAuthError.js.map +1 -1
  120. package/dist/error/ServerError.js +3 -3
  121. package/dist/error/ServerError.js.map +1 -1
  122. package/dist/index.cjs.js +675 -244
  123. package/dist/index.cjs.js.map +1 -1
  124. package/dist/index.d.ts +7 -2
  125. package/dist/index.d.ts.map +1 -1
  126. package/dist/index.js +33 -29
  127. package/dist/index.js.map +1 -1
  128. package/dist/logger/Logger.d.ts.map +1 -1
  129. package/dist/logger/Logger.js +11 -9
  130. package/dist/logger/Logger.js.map +1 -1
  131. package/dist/network/INetworkModule.js +4 -4
  132. package/dist/network/INetworkModule.js.map +1 -1
  133. package/dist/network/NetworkManager.js +8 -8
  134. package/dist/network/NetworkManager.js.map +1 -1
  135. package/dist/network/RequestThumbprint.d.ts +7 -0
  136. package/dist/network/RequestThumbprint.d.ts.map +1 -1
  137. package/dist/network/ThrottlingUtils.d.ts +2 -1
  138. package/dist/network/ThrottlingUtils.d.ts.map +1 -1
  139. package/dist/network/ThrottlingUtils.js +14 -8
  140. package/dist/network/ThrottlingUtils.js.map +1 -1
  141. package/dist/packageMetadata.d.ts +1 -1
  142. package/dist/packageMetadata.js +2 -2
  143. package/dist/packageMetadata.js.map +1 -1
  144. package/dist/request/AuthenticationHeaderParser.d.ts +20 -0
  145. package/dist/request/AuthenticationHeaderParser.d.ts.map +1 -0
  146. package/dist/request/AuthenticationHeaderParser.js +64 -0
  147. package/dist/request/AuthenticationHeaderParser.js.map +1 -0
  148. package/dist/request/BaseAuthRequest.d.ts +7 -1
  149. package/dist/request/BaseAuthRequest.d.ts.map +1 -1
  150. package/dist/request/CommonEndSessionRequest.d.ts +4 -0
  151. package/dist/request/CommonEndSessionRequest.d.ts.map +1 -1
  152. package/dist/request/RequestParameterBuilder.d.ts +4 -0
  153. package/dist/request/RequestParameterBuilder.d.ts.map +1 -1
  154. package/dist/request/RequestParameterBuilder.js +27 -18
  155. package/dist/request/RequestParameterBuilder.js.map +1 -1
  156. package/dist/request/RequestValidator.js +10 -10
  157. package/dist/request/RequestValidator.js.map +1 -1
  158. package/dist/request/ScopeSet.js +14 -14
  159. package/dist/request/ScopeSet.js.map +1 -1
  160. package/dist/response/AuthenticationResult.d.ts +2 -1
  161. package/dist/response/AuthenticationResult.d.ts.map +1 -1
  162. package/dist/response/ExternalTokenResponse.d.ts +15 -0
  163. package/dist/response/ExternalTokenResponse.d.ts.map +1 -0
  164. package/dist/response/ResponseHandler.d.ts.map +1 -1
  165. package/dist/response/ResponseHandler.js +74 -69
  166. package/dist/response/ResponseHandler.js.map +1 -1
  167. package/dist/response/ServerAuthorizationTokenResponse.d.ts +5 -2
  168. package/dist/response/ServerAuthorizationTokenResponse.d.ts.map +1 -1
  169. package/dist/telemetry/server/ServerTelemetryManager.js +13 -13
  170. package/dist/telemetry/server/ServerTelemetryManager.js.map +1 -1
  171. package/dist/url/UrlString.d.ts +0 -6
  172. package/dist/url/UrlString.d.ts.map +1 -1
  173. package/dist/url/UrlString.js +25 -40
  174. package/dist/url/UrlString.js.map +1 -1
  175. package/dist/utils/Constants.d.ts +5 -2
  176. package/dist/utils/Constants.d.ts.map +1 -1
  177. package/dist/utils/Constants.js +5 -2
  178. package/dist/utils/Constants.js.map +1 -1
  179. package/dist/utils/ProtocolUtils.js +13 -13
  180. package/dist/utils/ProtocolUtils.js.map +1 -1
  181. package/dist/utils/StringUtils.d.ts.map +1 -1
  182. package/dist/utils/StringUtils.js +15 -14
  183. package/dist/utils/StringUtils.js.map +1 -1
  184. package/dist/utils/TimeUtils.js +1 -1
  185. package/dist/utils/TimeUtils.js.map +1 -1
  186. package/package.json +1 -1
@@ -1,19 +1,20 @@
1
- /*! @azure/msal-common v4.5.0 2021-07-22 */
1
+ /*! @azure/msal-common v5.1.0 2021-11-02 */
2
2
  'use strict';
3
3
  import { __extends, __awaiter, __generator, __assign } from '../_virtual/_tslib.js';
4
+ import { BaseClient } from './BaseClient.js';
5
+ import { RequestParameterBuilder } from '../request/RequestParameterBuilder.js';
4
6
  import { AuthenticationScheme, GrantType, Errors } from '../utils/Constants.js';
5
- import { ClientAuthError as ClientAuthError$1, ClientAuthErrorMessage } from '../error/ClientAuthError.js';
6
- import { StringUtils as StringUtils$1 } from '../utils/StringUtils.js';
7
- import { ClientConfigurationError as ClientConfigurationError$1 } from '../error/ClientConfigurationError.js';
8
- import { buildClientInfoFromHomeAccountId } from '../account/ClientInfo.js';
9
- import { ServerError as ServerError$1 } from '../error/ServerError.js';
7
+ import { ResponseHandler } from '../response/ResponseHandler.js';
8
+ import { PopTokenGenerator } from '../crypto/PopTokenGenerator.js';
9
+ import { StringUtils } from '../utils/StringUtils.js';
10
+ import { ClientConfigurationError } from '../error/ClientConfigurationError.js';
11
+ import { ClientAuthError } from '../error/ClientAuthError.js';
12
+ import { ServerError } from '../error/ServerError.js';
13
+ import { TimeUtils } from '../utils/TimeUtils.js';
14
+ import { UrlString } from '../url/UrlString.js';
10
15
  import { CcsCredentialType } from '../account/CcsCredential.js';
11
- import { BaseClient as BaseClient$1 } from './BaseClient.js';
12
- import { RequestParameterBuilder as RequestParameterBuilder$1 } from '../request/RequestParameterBuilder.js';
13
- import { TimeUtils as TimeUtils$1 } from '../utils/TimeUtils.js';
14
- import { UrlString as UrlString$1 } from '../url/UrlString.js';
15
- import { PopTokenGenerator as PopTokenGenerator$1 } from '../crypto/PopTokenGenerator.js';
16
- import { ResponseHandler as ResponseHandler$1 } from '../response/ResponseHandler.js';
16
+ import { buildClientInfoFromHomeAccountId } from '../account/ClientInfo.js';
17
+ import { InteractionRequiredAuthError, InteractionRequiredAuthErrorMessage } from '../error/InteractionRequiredAuthError.js';
17
18
 
18
19
  /*
19
20
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -33,11 +34,11 @@ var RefreshTokenClient = /** @class */ (function (_super) {
33
34
  return __generator(this, function (_a) {
34
35
  switch (_a.label) {
35
36
  case 0:
36
- reqTimestamp = TimeUtils$1.nowSeconds();
37
+ reqTimestamp = TimeUtils.nowSeconds();
37
38
  return [4 /*yield*/, this.executeTokenRequest(request, this.authority)];
38
39
  case 1:
39
40
  response = _a.sent();
40
- responseHandler = new ResponseHandler$1(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.config.serializableCache, this.config.persistencePlugin);
41
+ responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.config.serializableCache, this.config.persistencePlugin);
41
42
  responseHandler.validateTokenResponse(response.body);
42
43
  return [2 /*return*/, responseHandler.handleServerTokenResponse(response.body, this.authority, reqTimestamp, request, undefined, undefined, true)];
43
44
  }
@@ -54,11 +55,11 @@ var RefreshTokenClient = /** @class */ (function (_super) {
54
55
  return __generator(this, function (_a) {
55
56
  // Cannot renew token if no request object is given.
56
57
  if (!request) {
57
- throw ClientConfigurationError$1.createEmptyTokenRequestError();
58
+ throw ClientConfigurationError.createEmptyTokenRequestError();
58
59
  }
59
60
  // We currently do not support silent flow for account === null use cases; This will be revisited for confidential flow usecases
60
61
  if (!request.account) {
61
- throw ClientAuthError$1.createNoAccountInSilentRequestError();
62
+ throw ClientAuthError.createNoAccountInSilentRequestError();
62
63
  }
63
64
  isFOCI = this.cacheManager.isAppMetadataFOCI(request.account.environment, this.config.authOptions.clientId);
64
65
  // if the app is part of the family, retrive a Family refresh token if present and make a refreshTokenRequest
@@ -67,8 +68,8 @@ var RefreshTokenClient = /** @class */ (function (_super) {
67
68
  return [2 /*return*/, this.acquireTokenWithCachedRefreshToken(request, true)];
68
69
  }
69
70
  catch (e) {
70
- noFamilyRTInCache = e instanceof ClientAuthError$1 && e.errorCode === ClientAuthErrorMessage.noTokensFoundError.code;
71
- clientMismatchErrorWithFamilyRT = e instanceof ServerError$1 && e.errorCode === Errors.INVALID_GRANT_ERROR && e.subError === Errors.CLIENT_MISMATCH_ERROR;
71
+ noFamilyRTInCache = e instanceof InteractionRequiredAuthError && e.errorCode === InteractionRequiredAuthErrorMessage.noTokensFoundError.code;
72
+ clientMismatchErrorWithFamilyRT = e instanceof ServerError && e.errorCode === Errors.INVALID_GRANT_ERROR && e.subError === Errors.CLIENT_MISMATCH_ERROR;
72
73
  // if family Refresh Token (FRT) cache acquisition fails or if client_mismatch error is seen with FRT, reattempt with application Refresh Token (ART)
73
74
  if (noFamilyRTInCache || clientMismatchErrorWithFamilyRT) {
74
75
  return [2 /*return*/, this.acquireTokenWithCachedRefreshToken(request, false)];
@@ -95,7 +96,7 @@ var RefreshTokenClient = /** @class */ (function (_super) {
95
96
  refreshToken = this.cacheManager.readRefreshTokenFromCache(this.config.authOptions.clientId, request.account, foci);
96
97
  // no refresh Token
97
98
  if (!refreshToken) {
98
- throw ClientAuthError$1.createNoTokensFoundError();
99
+ throw InteractionRequiredAuthError.createNoTokensFoundError();
99
100
  }
100
101
  refreshTokenRequest = __assign(__assign({}, request), { refreshToken: refreshToken.secret, authenticationScheme: request.authenticationScheme || AuthenticationScheme.BEARER, ccsCredential: {
101
102
  credential: request.account.homeAccountId,
@@ -123,9 +124,15 @@ var RefreshTokenClient = /** @class */ (function (_super) {
123
124
  thumbprint = {
124
125
  clientId: this.config.authOptions.clientId,
125
126
  authority: authority.canonicalAuthority,
126
- scopes: request.scopes
127
+ scopes: request.scopes,
128
+ authenticationScheme: request.authenticationScheme,
129
+ resourceRequestMethod: request.resourceRequestMethod,
130
+ resourceRequestUri: request.resourceRequestUri,
131
+ shrClaims: request.shrClaims,
132
+ sshJwk: request.sshJwk,
133
+ sshKid: request.sshKid
127
134
  };
128
- endpoint = UrlString$1.appendQueryString(authority.tokenEndpoint, queryParameters);
135
+ endpoint = UrlString.appendQueryString(authority.tokenEndpoint, queryParameters);
129
136
  return [2 /*return*/, this.executePostToTokenEndpoint(endpoint, requestBody, headers, thumbprint)];
130
137
  }
131
138
  });
@@ -136,7 +143,7 @@ var RefreshTokenClient = /** @class */ (function (_super) {
136
143
  * @param request
137
144
  */
138
145
  RefreshTokenClient.prototype.createTokenQueryParameters = function (request) {
139
- var parameterBuilder = new RequestParameterBuilder$1();
146
+ var parameterBuilder = new RequestParameterBuilder();
140
147
  if (request.tokenQueryParameters) {
141
148
  parameterBuilder.addExtraQueryParameters(request.tokenQueryParameters);
142
149
  }
@@ -148,11 +155,11 @@ var RefreshTokenClient = /** @class */ (function (_super) {
148
155
  */
149
156
  RefreshTokenClient.prototype.createTokenRequestBody = function (request) {
150
157
  return __awaiter(this, void 0, void 0, function () {
151
- var parameterBuilder, correlationId, clientAssertion, popTokenGenerator, _a, _b, clientInfo;
152
- return __generator(this, function (_c) {
153
- switch (_c.label) {
158
+ var parameterBuilder, correlationId, clientAssertion, popTokenGenerator, cnfString, clientInfo;
159
+ return __generator(this, function (_a) {
160
+ switch (_a.label) {
154
161
  case 0:
155
- parameterBuilder = new RequestParameterBuilder$1();
162
+ parameterBuilder = new RequestParameterBuilder();
156
163
  parameterBuilder.addClientId(this.config.authOptions.clientId);
157
164
  parameterBuilder.addScopes(request.scopes);
158
165
  parameterBuilder.addGrantType(GrantType.REFRESH_TOKEN_GRANT);
@@ -174,14 +181,24 @@ var RefreshTokenClient = /** @class */ (function (_super) {
174
181
  parameterBuilder.addClientAssertionType(clientAssertion.assertionType);
175
182
  }
176
183
  if (!(request.authenticationScheme === AuthenticationScheme.POP)) return [3 /*break*/, 2];
177
- popTokenGenerator = new PopTokenGenerator$1(this.cryptoUtils);
178
- _b = (_a = parameterBuilder).addPopToken;
184
+ popTokenGenerator = new PopTokenGenerator(this.cryptoUtils);
179
185
  return [4 /*yield*/, popTokenGenerator.generateCnf(request)];
180
186
  case 1:
181
- _b.apply(_a, [_c.sent()]);
182
- _c.label = 2;
187
+ cnfString = _a.sent();
188
+ parameterBuilder.addPopToken(cnfString);
189
+ return [3 /*break*/, 3];
183
190
  case 2:
184
- if (!StringUtils$1.isEmptyObj(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {
191
+ if (request.authenticationScheme === AuthenticationScheme.SSH) {
192
+ if (request.sshJwk) {
193
+ parameterBuilder.addSshJwk(request.sshJwk);
194
+ }
195
+ else {
196
+ throw ClientConfigurationError.createMissingSshJwkError();
197
+ }
198
+ }
199
+ _a.label = 3;
200
+ case 3:
201
+ if (!StringUtils.isEmptyObj(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {
185
202
  parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);
186
203
  }
187
204
  if (this.config.systemOptions.preventCorsPreflight && request.ccsCredential) {
@@ -206,7 +223,7 @@ var RefreshTokenClient = /** @class */ (function (_super) {
206
223
  });
207
224
  };
208
225
  return RefreshTokenClient;
209
- }(BaseClient$1));
226
+ }(BaseClient));
210
227
 
211
228
  export { RefreshTokenClient };
212
229
  //# sourceMappingURL=RefreshTokenClient.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RefreshTokenClient.js","sources":["../../src/client/RefreshTokenClient.ts"],"sourcesContent":["/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { ClientConfiguration } from \"../config/ClientConfiguration\";\r\nimport { BaseClient } from \"./BaseClient\";\r\nimport { CommonRefreshTokenRequest } from \"../request/CommonRefreshTokenRequest\";\r\nimport { Authority } from \"../authority/Authority\";\r\nimport { ServerAuthorizationTokenResponse } from \"../response/ServerAuthorizationTokenResponse\";\r\nimport { RequestParameterBuilder } from \"../request/RequestParameterBuilder\";\r\nimport { GrantType, AuthenticationScheme, Errors } from \"../utils/Constants\";\r\nimport { ResponseHandler } from \"../response/ResponseHandler\";\r\nimport { AuthenticationResult } from \"../response/AuthenticationResult\";\r\nimport { PopTokenGenerator } from \"../crypto/PopTokenGenerator\";\r\nimport { StringUtils } from \"../utils/StringUtils\";\r\nimport { RequestThumbprint } from \"../network/RequestThumbprint\";\r\nimport { NetworkResponse } from \"../network/NetworkManager\";\r\nimport { CommonSilentFlowRequest } from \"../request/CommonSilentFlowRequest\";\r\nimport { ClientConfigurationError } from \"../error/ClientConfigurationError\";\r\nimport { ClientAuthError, ClientAuthErrorMessage } from \"../error/ClientAuthError\";\r\nimport { ServerError } from \"../error/ServerError\";\r\nimport { TimeUtils } from \"../utils/TimeUtils\";\r\nimport { UrlString } from \"../url/UrlString\";\r\nimport { CcsCredentialType } from \"../account/CcsCredential\";\r\nimport { buildClientInfoFromHomeAccountId } from \"../account/ClientInfo\";\r\n\r\n/**\r\n * OAuth2.0 refresh token client\r\n */\r\nexport class RefreshTokenClient extends BaseClient {\r\n\r\n constructor(configuration: ClientConfiguration) {\r\n super(configuration);\r\n }\r\n\r\n public async acquireToken(request: CommonRefreshTokenRequest): Promise<AuthenticationResult>{\r\n const reqTimestamp = TimeUtils.nowSeconds();\r\n const response = await this.executeTokenRequest(request, this.authority);\r\n\r\n const responseHandler = new ResponseHandler(\r\n this.config.authOptions.clientId,\r\n this.cacheManager,\r\n this.cryptoUtils,\r\n this.logger,\r\n this.config.serializableCache,\r\n this.config.persistencePlugin\r\n );\r\n\r\n responseHandler.validateTokenResponse(response.body);\r\n return responseHandler.handleServerTokenResponse(\r\n response.body,\r\n this.authority,\r\n reqTimestamp,\r\n request,\r\n undefined,\r\n undefined,\r\n true\r\n );\r\n }\r\n\r\n /**\r\n * Gets cached refresh token and attaches to request, then calls acquireToken API\r\n * @param request\r\n */\r\n public async acquireTokenByRefreshToken(request: CommonSilentFlowRequest): Promise<AuthenticationResult> {\r\n // Cannot renew token if no request object is given.\r\n if (!request) {\r\n throw ClientConfigurationError.createEmptyTokenRequestError();\r\n }\r\n\r\n // We currently do not support silent flow for account === null use cases; This will be revisited for confidential flow usecases\r\n if (!request.account) {\r\n throw ClientAuthError.createNoAccountInSilentRequestError();\r\n }\r\n\r\n // try checking if FOCI is enabled for the given application\r\n const isFOCI = this.cacheManager.isAppMetadataFOCI(request.account.environment, this.config.authOptions.clientId);\r\n\r\n // if the app is part of the family, retrive a Family refresh token if present and make a refreshTokenRequest\r\n if (isFOCI) {\r\n try {\r\n return this.acquireTokenWithCachedRefreshToken(request, true);\r\n } catch (e) {\r\n const noFamilyRTInCache = e instanceof ClientAuthError && e.errorCode === ClientAuthErrorMessage.noTokensFoundError.code;\r\n const clientMismatchErrorWithFamilyRT = e instanceof ServerError && e.errorCode === Errors.INVALID_GRANT_ERROR && e.subError === Errors.CLIENT_MISMATCH_ERROR;\r\n\r\n // if family Refresh Token (FRT) cache acquisition fails or if client_mismatch error is seen with FRT, reattempt with application Refresh Token (ART)\r\n if (noFamilyRTInCache || clientMismatchErrorWithFamilyRT) {\r\n return this.acquireTokenWithCachedRefreshToken(request, false);\r\n // throw in all other cases\r\n } else {\r\n throw e;\r\n }\r\n }\r\n }\r\n\r\n // fall back to application refresh token acquisition\r\n return this.acquireTokenWithCachedRefreshToken(request, false);\r\n }\r\n\r\n /**\r\n * makes a network call to acquire tokens by exchanging RefreshToken available in userCache; throws if refresh token is not cached\r\n * @param request\r\n */\r\n private async acquireTokenWithCachedRefreshToken(request: CommonSilentFlowRequest, foci: boolean) {\r\n // fetches family RT or application RT based on FOCI value\r\n const refreshToken = this.cacheManager.readRefreshTokenFromCache(this.config.authOptions.clientId, request.account, foci);\r\n\r\n // no refresh Token\r\n if (!refreshToken) {\r\n throw ClientAuthError.createNoTokensFoundError();\r\n }\r\n\r\n const refreshTokenRequest: CommonRefreshTokenRequest = {\r\n ...request,\r\n refreshToken: refreshToken.secret,\r\n authenticationScheme: request.authenticationScheme || AuthenticationScheme.BEARER,\r\n ccsCredential: {\r\n credential: request.account.homeAccountId,\r\n type: CcsCredentialType.HOME_ACCOUNT_ID\r\n }\r\n };\r\n\r\n return this.acquireToken(refreshTokenRequest);\r\n }\r\n\r\n /**\r\n * Constructs the network message and makes a NW call to the underlying secure token service\r\n * @param request\r\n * @param authority\r\n */\r\n private async executeTokenRequest(request: CommonRefreshTokenRequest, authority: Authority)\r\n : Promise<NetworkResponse<ServerAuthorizationTokenResponse>> {\r\n\r\n const requestBody = await this.createTokenRequestBody(request);\r\n const queryParameters = this.createTokenQueryParameters(request);\r\n const headers: Record<string, string> = this.createTokenRequestHeaders(request.ccsCredential);\r\n const thumbprint: RequestThumbprint = {\r\n clientId: this.config.authOptions.clientId,\r\n authority: authority.canonicalAuthority,\r\n scopes: request.scopes\r\n };\r\n\r\n const endpoint = UrlString.appendQueryString(authority.tokenEndpoint, queryParameters);\r\n return this.executePostToTokenEndpoint(endpoint, requestBody, headers, thumbprint);\r\n }\r\n\r\n /**\r\n * Creates query string for the /token request\r\n * @param request \r\n */\r\n private createTokenQueryParameters(request: CommonRefreshTokenRequest): string {\r\n const parameterBuilder = new RequestParameterBuilder();\r\n\r\n if (request.tokenQueryParameters) {\r\n parameterBuilder.addExtraQueryParameters(request.tokenQueryParameters);\r\n }\r\n\r\n return parameterBuilder.createQueryString();\r\n }\r\n\r\n /**\r\n * Helper function to create the token request body\r\n * @param request\r\n */\r\n private async createTokenRequestBody(request: CommonRefreshTokenRequest): Promise<string> {\r\n const parameterBuilder = new RequestParameterBuilder();\r\n\r\n parameterBuilder.addClientId(this.config.authOptions.clientId);\r\n\r\n parameterBuilder.addScopes(request.scopes);\r\n\r\n parameterBuilder.addGrantType(GrantType.REFRESH_TOKEN_GRANT);\r\n\r\n parameterBuilder.addClientInfo();\r\n\r\n parameterBuilder.addLibraryInfo(this.config.libraryInfo);\r\n\r\n parameterBuilder.addThrottling();\r\n \r\n if (this.serverTelemetryManager) {\r\n parameterBuilder.addServerTelemetry(this.serverTelemetryManager);\r\n }\r\n\r\n const correlationId = request.correlationId || this.config.cryptoInterface.createNewGuid();\r\n parameterBuilder.addCorrelationId(correlationId);\r\n\r\n parameterBuilder.addRefreshToken(request.refreshToken);\r\n\r\n if (this.config.clientCredentials.clientSecret) {\r\n parameterBuilder.addClientSecret(this.config.clientCredentials.clientSecret);\r\n }\r\n\r\n if (this.config.clientCredentials.clientAssertion) {\r\n const clientAssertion = this.config.clientCredentials.clientAssertion;\r\n parameterBuilder.addClientAssertion(clientAssertion.assertion);\r\n parameterBuilder.addClientAssertionType(clientAssertion.assertionType);\r\n }\r\n\r\n if (request.authenticationScheme === AuthenticationScheme.POP) {\r\n const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils);\r\n\r\n parameterBuilder.addPopToken(await popTokenGenerator.generateCnf(request));\r\n }\r\n\r\n if (!StringUtils.isEmptyObj(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {\r\n parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);\r\n }\r\n\r\n if (this.config.systemOptions.preventCorsPreflight && request.ccsCredential) {\r\n switch (request.ccsCredential.type) {\r\n case CcsCredentialType.HOME_ACCOUNT_ID:\r\n try {\r\n const clientInfo = buildClientInfoFromHomeAccountId(request.ccsCredential.credential);\r\n parameterBuilder.addCcsOid(clientInfo);\r\n } catch (e) {\r\n this.logger.verbose(\"Could not parse home account ID for CCS Header: \" + e);\r\n }\r\n break;\r\n case CcsCredentialType.UPN:\r\n parameterBuilder.addCcsUpn(request.ccsCredential.credential);\r\n break;\r\n }\r\n }\r\n\r\n return parameterBuilder.createQueryString();\r\n }\r\n}\r\n"],"names":["TimeUtils","ResponseHandler","ClientConfigurationError","ClientAuthError","ServerError","UrlString","RequestParameterBuilder","PopTokenGenerator","StringUtils","BaseClient"],"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;AA2BA;;;;IAGwC,sCAAU;IAE9C,4BAAY,aAAkC;eAC1C,kBAAM,aAAa,CAAC;KACvB;IAEY,yCAAY,GAAzB,UAA0B,OAAkC;;;;;;wBAClD,YAAY,GAAGA,WAAS,CAAC,UAAU,EAAE,CAAC;wBAC3B,qBAAM,IAAI,CAAC,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,EAAA;;wBAAlE,QAAQ,GAAG,SAAuD;wBAElE,eAAe,GAAG,IAAIC,iBAAe,CACvC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,QAAQ,EAChC,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,WAAW,EAChB,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAC7B,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAChC,CAAC;wBAEF,eAAe,CAAC,qBAAqB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;wBACrD,sBAAO,eAAe,CAAC,yBAAyB,CAC5C,QAAQ,CAAC,IAAI,EACb,IAAI,CAAC,SAAS,EACd,YAAY,EACZ,OAAO,EACP,SAAS,EACT,SAAS,EACT,IAAI,CACP,EAAC;;;;KACL;;;;;IAMY,uDAA0B,GAAvC,UAAwC,OAAgC;;;;;gBAEpE,IAAI,CAAC,OAAO,EAAE;oBACV,MAAMC,0BAAwB,CAAC,4BAA4B,EAAE,CAAC;iBACjE;;gBAGD,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;oBAClB,MAAMC,iBAAe,CAAC,mCAAmC,EAAE,CAAC;iBAC/D;gBAGK,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,iBAAiB,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE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EAAC,WAAW,CAAA;wBAAC,qBAAM,iBAAiB,CAAC,WAAW,CAAC,OAAO,CAAC,EAAA;;wBAAzE,cAA6B,SAA4C,EAAC,CAAC;;;wBAG/E,IAAI,CAACC,aAAW,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,kBAAkB,IAAI,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,kBAAkB,CAAC,MAAM,GAAG,CAAC,EAAE;4BAChJ,gBAAgB,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC;yBAC1F;wBAED,IAAI,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,oBAAoB,IAAI,OAAO,CAAC,aAAa,EAAE;4BACzE,QAAQ,OAAO,CAAC,aAAa,CAAC,IAAI;gCAC9B,KAAK,iBAAiB,CAAC,eAAe;oCAClC,IAAI;wCACM,UAAU,GAAG,gCAAgC,CAAC,OAAO,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;wCACtF,gBAAgB,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;qCAC1C;oCAAC,OAAO,CAAC,EAAE;wCACR,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,kDAAkD,GAAG,CAAC,CAAC,CAAC;qCAC/E;oCACD,MAAM;gCACV,KAAK,iBAAiB,CAAC,GAAG;oCACtB,gBAAgB,CAAC,SAAS,CAAC,OAAO,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;oCAC7D,MAAM;6BACb;yBACJ;wBAED,sBAAO,gBAAgB,CAAC,iBAAiB,EAAE,EAAC;;;;KAC/C;IACL,yBAAC;AAAD,CAtMA,CAAwCC,YAAU;;;;"}
1
+ {"version":3,"file":"RefreshTokenClient.js","sources":["../../src/client/RefreshTokenClient.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ClientConfiguration } from \"../config/ClientConfiguration\";\nimport { BaseClient } from \"./BaseClient\";\nimport { CommonRefreshTokenRequest } from \"../request/CommonRefreshTokenRequest\";\nimport { Authority } from \"../authority/Authority\";\nimport { ServerAuthorizationTokenResponse } from \"../response/ServerAuthorizationTokenResponse\";\nimport { RequestParameterBuilder } from \"../request/RequestParameterBuilder\";\nimport { GrantType, AuthenticationScheme, Errors } from \"../utils/Constants\";\nimport { ResponseHandler } from \"../response/ResponseHandler\";\nimport { AuthenticationResult } from \"../response/AuthenticationResult\";\nimport { PopTokenGenerator } from \"../crypto/PopTokenGenerator\";\nimport { StringUtils } from \"../utils/StringUtils\";\nimport { RequestThumbprint } from \"../network/RequestThumbprint\";\nimport { NetworkResponse } from \"../network/NetworkManager\";\nimport { CommonSilentFlowRequest } from \"../request/CommonSilentFlowRequest\";\nimport { ClientConfigurationError } from \"../error/ClientConfigurationError\";\nimport { ClientAuthError } from \"../error/ClientAuthError\";\nimport { ServerError } from \"../error/ServerError\";\nimport { TimeUtils } from \"../utils/TimeUtils\";\nimport { UrlString } from \"../url/UrlString\";\nimport { CcsCredentialType } from \"../account/CcsCredential\";\nimport { buildClientInfoFromHomeAccountId } from \"../account/ClientInfo\";\nimport { InteractionRequiredAuthError, InteractionRequiredAuthErrorMessage } from \"../error/InteractionRequiredAuthError\";\n\n/**\n * OAuth2.0 refresh token client\n */\nexport class RefreshTokenClient extends BaseClient {\n\n constructor(configuration: ClientConfiguration) {\n super(configuration);\n }\n\n public async acquireToken(request: CommonRefreshTokenRequest): Promise<AuthenticationResult>{\n const reqTimestamp = TimeUtils.nowSeconds();\n const response = await this.executeTokenRequest(request, this.authority);\n\n const responseHandler = new ResponseHandler(\n this.config.authOptions.clientId,\n this.cacheManager,\n this.cryptoUtils,\n this.logger,\n this.config.serializableCache,\n this.config.persistencePlugin\n );\n\n responseHandler.validateTokenResponse(response.body);\n return responseHandler.handleServerTokenResponse(\n response.body,\n this.authority,\n reqTimestamp,\n request,\n undefined,\n undefined,\n true\n );\n }\n\n /**\n * Gets cached refresh token and attaches to request, then calls acquireToken API\n * @param request\n */\n public async acquireTokenByRefreshToken(request: CommonSilentFlowRequest): Promise<AuthenticationResult> {\n // Cannot renew token if no request object is given.\n if (!request) {\n throw ClientConfigurationError.createEmptyTokenRequestError();\n }\n\n // We currently do not support silent flow for account === null use cases; This will be revisited for confidential flow usecases\n if (!request.account) {\n throw ClientAuthError.createNoAccountInSilentRequestError();\n }\n\n // try checking if FOCI is enabled for the given application\n const isFOCI = this.cacheManager.isAppMetadataFOCI(request.account.environment, this.config.authOptions.clientId);\n\n // if the app is part of the family, retrive a Family refresh token if present and make a refreshTokenRequest\n if (isFOCI) {\n try {\n return this.acquireTokenWithCachedRefreshToken(request, true);\n } catch (e) {\n const noFamilyRTInCache = e instanceof InteractionRequiredAuthError && e.errorCode === InteractionRequiredAuthErrorMessage.noTokensFoundError.code;\n const clientMismatchErrorWithFamilyRT = e instanceof ServerError && e.errorCode === Errors.INVALID_GRANT_ERROR && e.subError === Errors.CLIENT_MISMATCH_ERROR;\n\n // if family Refresh Token (FRT) cache acquisition fails or if client_mismatch error is seen with FRT, reattempt with application Refresh Token (ART)\n if (noFamilyRTInCache || clientMismatchErrorWithFamilyRT) {\n return this.acquireTokenWithCachedRefreshToken(request, false);\n // throw in all other cases\n } else {\n throw e;\n }\n }\n }\n\n // fall back to application refresh token acquisition\n return this.acquireTokenWithCachedRefreshToken(request, false);\n }\n\n /**\n * makes a network call to acquire tokens by exchanging RefreshToken available in userCache; throws if refresh token is not cached\n * @param request\n */\n private async acquireTokenWithCachedRefreshToken(request: CommonSilentFlowRequest, foci: boolean) {\n // fetches family RT or application RT based on FOCI value\n const refreshToken = this.cacheManager.readRefreshTokenFromCache(this.config.authOptions.clientId, request.account, foci);\n\n // no refresh Token\n if (!refreshToken) {\n throw InteractionRequiredAuthError.createNoTokensFoundError();\n }\n\n const refreshTokenRequest: CommonRefreshTokenRequest = {\n ...request,\n refreshToken: refreshToken.secret,\n authenticationScheme: request.authenticationScheme || AuthenticationScheme.BEARER,\n ccsCredential: {\n credential: request.account.homeAccountId,\n type: CcsCredentialType.HOME_ACCOUNT_ID\n }\n };\n\n return this.acquireToken(refreshTokenRequest);\n }\n\n /**\n * Constructs the network message and makes a NW call to the underlying secure token service\n * @param request\n * @param authority\n */\n private async executeTokenRequest(request: CommonRefreshTokenRequest, authority: Authority)\n : Promise<NetworkResponse<ServerAuthorizationTokenResponse>> {\n\n const requestBody = await this.createTokenRequestBody(request);\n const queryParameters = this.createTokenQueryParameters(request);\n const headers: Record<string, string> = this.createTokenRequestHeaders(request.ccsCredential);\n const thumbprint: RequestThumbprint = {\n clientId: this.config.authOptions.clientId,\n authority: authority.canonicalAuthority,\n scopes: request.scopes,\n authenticationScheme: request.authenticationScheme,\n resourceRequestMethod: request.resourceRequestMethod,\n resourceRequestUri: request.resourceRequestUri,\n shrClaims: request.shrClaims,\n sshJwk: request.sshJwk,\n sshKid: request.sshKid\n };\n\n const endpoint = UrlString.appendQueryString(authority.tokenEndpoint, queryParameters);\n return this.executePostToTokenEndpoint(endpoint, requestBody, headers, thumbprint);\n }\n\n /**\n * Creates query string for the /token request\n * @param request \n */\n private createTokenQueryParameters(request: CommonRefreshTokenRequest): string {\n const parameterBuilder = new RequestParameterBuilder();\n\n if (request.tokenQueryParameters) {\n parameterBuilder.addExtraQueryParameters(request.tokenQueryParameters);\n }\n\n return parameterBuilder.createQueryString();\n }\n\n /**\n * Helper function to create the token request body\n * @param request\n */\n private async createTokenRequestBody(request: CommonRefreshTokenRequest): Promise<string> {\n const parameterBuilder = new RequestParameterBuilder();\n\n parameterBuilder.addClientId(this.config.authOptions.clientId);\n\n parameterBuilder.addScopes(request.scopes);\n\n parameterBuilder.addGrantType(GrantType.REFRESH_TOKEN_GRANT);\n\n parameterBuilder.addClientInfo();\n\n parameterBuilder.addLibraryInfo(this.config.libraryInfo);\n\n parameterBuilder.addThrottling();\n \n if (this.serverTelemetryManager) {\n parameterBuilder.addServerTelemetry(this.serverTelemetryManager);\n }\n\n const correlationId = request.correlationId || this.config.cryptoInterface.createNewGuid();\n parameterBuilder.addCorrelationId(correlationId);\n\n parameterBuilder.addRefreshToken(request.refreshToken);\n\n if (this.config.clientCredentials.clientSecret) {\n parameterBuilder.addClientSecret(this.config.clientCredentials.clientSecret);\n }\n\n if (this.config.clientCredentials.clientAssertion) {\n const clientAssertion = this.config.clientCredentials.clientAssertion;\n parameterBuilder.addClientAssertion(clientAssertion.assertion);\n parameterBuilder.addClientAssertionType(clientAssertion.assertionType);\n }\n\n if (request.authenticationScheme === AuthenticationScheme.POP) {\n const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils);\n const cnfString = await popTokenGenerator.generateCnf(request);\n parameterBuilder.addPopToken(cnfString);\n } else if (request.authenticationScheme === AuthenticationScheme.SSH) {\n if(request.sshJwk) {\n parameterBuilder.addSshJwk(request.sshJwk);\n } else {\n throw ClientConfigurationError.createMissingSshJwkError();\n }\n }\n\n if (!StringUtils.isEmptyObj(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {\n parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);\n }\n\n if (this.config.systemOptions.preventCorsPreflight && request.ccsCredential) {\n switch (request.ccsCredential.type) {\n case CcsCredentialType.HOME_ACCOUNT_ID:\n try {\n const clientInfo = buildClientInfoFromHomeAccountId(request.ccsCredential.credential);\n parameterBuilder.addCcsOid(clientInfo);\n } catch (e) {\n this.logger.verbose(\"Could not parse home account ID for CCS Header: \" + e);\n }\n break;\n case CcsCredentialType.UPN:\n parameterBuilder.addCcsUpn(request.ccsCredential.credential);\n break;\n }\n }\n\n return parameterBuilder.createQueryString();\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;AA4BA;;;;IAGwC,sCAAU;IAE9C,4BAAY,aAAkC;eAC1C,kBAAM,aAAa,CAAC;KACvB;IAEY,yCAAY,GAAz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,sBAAO,gBAAgB,CAAC,iBAAiB,EAAE,EAAC;;;;KAC/C;IACL,yBAAC;AAAD,CAlNA,CAAwC,UAAU;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"SilentFlowClient.d.ts","sourceRoot":"","sources":["../../src/client/SilentFlowClient.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAYxE,qBAAa,gBAAiB,SAAQ,UAAU;gBAEhC,aAAa,EAAE,mBAAmB;IAI9C;;;;OAIG;IACG,YAAY,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAanF;;;OAGG;IACG,kBAAkB,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IA8CzF;;;OAGG;YACW,6BAA6B;CAc9C"}
1
+ {"version":3,"file":"SilentFlowClient.d.ts","sourceRoot":"","sources":["../../src/client/SilentFlowClient.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAYxE,qBAAa,gBAAiB,SAAQ,UAAU;gBAEhC,aAAa,EAAE,mBAAmB;IAI9C;;;;OAIG;IACG,YAAY,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAanF;;;OAGG;IACG,kBAAkB,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAsDzF;;;OAGG;YACW,6BAA6B;CAc9C"}
@@ -1,16 +1,16 @@
1
- /*! @azure/msal-common v4.5.0 2021-07-22 */
1
+ /*! @azure/msal-common v5.1.0 2021-11-02 */
2
2
  'use strict';
3
3
  import { __extends, __awaiter, __generator } from '../_virtual/_tslib.js';
4
+ import { BaseClient } from './BaseClient.js';
5
+ import { ScopeSet } from '../request/ScopeSet.js';
6
+ import { AuthToken } from '../account/AuthToken.js';
7
+ import { TimeUtils } from '../utils/TimeUtils.js';
8
+ import { RefreshTokenClient } from './RefreshTokenClient.js';
9
+ import { ClientAuthError, ClientAuthErrorMessage } from '../error/ClientAuthError.js';
10
+ import { ClientConfigurationError } from '../error/ClientConfigurationError.js';
11
+ import { ResponseHandler } from '../response/ResponseHandler.js';
4
12
  import { CacheOutcome, AuthenticationScheme } from '../utils/Constants.js';
5
- import { ClientAuthError as ClientAuthError$1, ClientAuthErrorMessage } from '../error/ClientAuthError.js';
6
- import { StringUtils as StringUtils$1 } from '../utils/StringUtils.js';
7
- import { ClientConfigurationError as ClientConfigurationError$1 } from '../error/ClientConfigurationError.js';
8
- import { ScopeSet as ScopeSet$1 } from '../request/ScopeSet.js';
9
- import { AuthToken as AuthToken$1 } from '../account/AuthToken.js';
10
- import { BaseClient as BaseClient$1 } from './BaseClient.js';
11
- import { TimeUtils as TimeUtils$1 } from '../utils/TimeUtils.js';
12
- import { ResponseHandler as ResponseHandler$1 } from '../response/ResponseHandler.js';
13
- import { RefreshTokenClient as RefreshTokenClient$1 } from './RefreshTokenClient.js';
13
+ import { StringUtils } from '../utils/StringUtils.js';
14
14
 
15
15
  /*
16
16
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -37,8 +37,8 @@ var SilentFlowClient = /** @class */ (function (_super) {
37
37
  case 1: return [2 /*return*/, _a.sent()];
38
38
  case 2:
39
39
  e_1 = _a.sent();
40
- if (e_1 instanceof ClientAuthError$1 && e_1.errorCode === ClientAuthErrorMessage.tokenRefreshRequired.code) {
41
- refreshTokenClient = new RefreshTokenClient$1(this.config);
40
+ if (e_1 instanceof ClientAuthError && e_1.errorCode === ClientAuthErrorMessage.tokenRefreshRequired.code) {
41
+ refreshTokenClient = new RefreshTokenClient(this.config);
42
42
  return [2 /*return*/, refreshTokenClient.acquireTokenByRefreshToken(request)];
43
43
  }
44
44
  else {
@@ -62,40 +62,45 @@ var SilentFlowClient = /** @class */ (function (_super) {
62
62
  case 0:
63
63
  // Cannot renew token if no request object is given.
64
64
  if (!request) {
65
- throw ClientConfigurationError$1.createEmptyTokenRequestError();
65
+ throw ClientConfigurationError.createEmptyTokenRequestError();
66
+ }
67
+ if (request.forceRefresh) {
68
+ // Must refresh due to present force_refresh flag.
69
+ (_a = this.serverTelemetryManager) === null || _a === void 0 ? void 0 : _a.setCacheOutcome(CacheOutcome.FORCE_REFRESH);
70
+ this.logger.info("SilentFlowClient:acquireCachedToken - Skipping cache because forceRefresh is true.");
71
+ throw ClientAuthError.createRefreshRequiredError();
72
+ }
73
+ else if (!StringUtils.isEmptyObj(request.claims)) {
74
+ // Must refresh due to request parameters.
75
+ this.logger.info("SilentFlowClient:acquireCachedToken - Skipping cache because claims are requested.");
76
+ throw ClientAuthError.createRefreshRequiredError();
66
77
  }
67
78
  // We currently do not support silent flow for account === null use cases; This will be revisited for confidential flow usecases
68
79
  if (!request.account) {
69
- throw ClientAuthError$1.createNoAccountInSilentRequestError();
80
+ throw ClientAuthError.createNoAccountInSilentRequestError();
70
81
  }
71
- requestScopes = new ScopeSet$1(request.scopes || []);
82
+ requestScopes = new ScopeSet(request.scopes || []);
72
83
  environment = request.authority || this.authority.getPreferredCache();
73
84
  authScheme = request.authenticationScheme || AuthenticationScheme.BEARER;
74
- cacheRecord = this.cacheManager.readCacheRecord(request.account, this.config.authOptions.clientId, requestScopes, environment, authScheme);
75
- if (request.forceRefresh) {
76
- // Must refresh due to present force_refresh flag.
77
- (_a = this.serverTelemetryManager) === null || _a === void 0 ? void 0 : _a.setCacheOutcome(CacheOutcome.FORCE_REFRESH);
78
- throw ClientAuthError$1.createRefreshRequiredError();
79
- }
80
- else if (!cacheRecord.accessToken) {
85
+ cacheRecord = this.cacheManager.readCacheRecord(request.account, this.config.authOptions.clientId, requestScopes, environment, authScheme, request.sshKid);
86
+ if (!cacheRecord.accessToken) {
81
87
  // Must refresh due to non-existent access_token.
82
88
  (_b = this.serverTelemetryManager) === null || _b === void 0 ? void 0 : _b.setCacheOutcome(CacheOutcome.NO_CACHED_ACCESS_TOKEN);
83
- throw ClientAuthError$1.createRefreshRequiredError();
89
+ this.logger.info("SilentFlowClient:acquireCachedToken - No access token found in cache for the given properties.");
90
+ throw ClientAuthError.createRefreshRequiredError();
84
91
  }
85
- else if (TimeUtils$1.wasClockTurnedBack(cacheRecord.accessToken.cachedAt) ||
86
- TimeUtils$1.isTokenExpired(cacheRecord.accessToken.expiresOn, this.config.systemOptions.tokenRenewalOffsetSeconds)) {
92
+ else if (TimeUtils.wasClockTurnedBack(cacheRecord.accessToken.cachedAt) ||
93
+ TimeUtils.isTokenExpired(cacheRecord.accessToken.expiresOn, this.config.systemOptions.tokenRenewalOffsetSeconds)) {
87
94
  // Must refresh due to expired access_token.
88
95
  (_c = this.serverTelemetryManager) === null || _c === void 0 ? void 0 : _c.setCacheOutcome(CacheOutcome.CACHED_ACCESS_TOKEN_EXPIRED);
89
- throw ClientAuthError$1.createRefreshRequiredError();
96
+ this.logger.info("SilentFlowClient:acquireCachedToken - Cached access token is expired or will expire within " + this.config.systemOptions.tokenRenewalOffsetSeconds + " seconds.");
97
+ throw ClientAuthError.createRefreshRequiredError();
90
98
  }
91
- else if (cacheRecord.accessToken.refreshOn && TimeUtils$1.isTokenExpired(cacheRecord.accessToken.refreshOn, 0)) {
99
+ else if (cacheRecord.accessToken.refreshOn && TimeUtils.isTokenExpired(cacheRecord.accessToken.refreshOn, 0)) {
92
100
  // Must refresh due to the refresh_in value.
93
101
  (_d = this.serverTelemetryManager) === null || _d === void 0 ? void 0 : _d.setCacheOutcome(CacheOutcome.REFRESH_CACHED_ACCESS_TOKEN);
94
- throw ClientAuthError$1.createRefreshRequiredError();
95
- }
96
- else if (!StringUtils$1.isEmptyObj(request.claims)) {
97
- // Must refresh due to request parameters.
98
- throw ClientAuthError$1.createRefreshRequiredError();
102
+ this.logger.info("SilentFlowClient:acquireCachedToken - Cached access token's refreshOn property has been exceeded'.");
103
+ throw ClientAuthError.createRefreshRequiredError();
99
104
  }
100
105
  if (this.config.serverTelemetryManager) {
101
106
  this.config.serverTelemetryManager.incrementCacheHits();
@@ -117,16 +122,16 @@ var SilentFlowClient = /** @class */ (function (_super) {
117
122
  switch (_a.label) {
118
123
  case 0:
119
124
  if (cacheRecord.idToken) {
120
- idTokenObj = new AuthToken$1(cacheRecord.idToken.secret, this.config.cryptoInterface);
125
+ idTokenObj = new AuthToken(cacheRecord.idToken.secret, this.config.cryptoInterface);
121
126
  }
122
- return [4 /*yield*/, ResponseHandler$1.generateAuthenticationResult(this.cryptoUtils, this.authority, cacheRecord, true, request, idTokenObj)];
127
+ return [4 /*yield*/, ResponseHandler.generateAuthenticationResult(this.cryptoUtils, this.authority, cacheRecord, true, request, idTokenObj)];
123
128
  case 1: return [2 /*return*/, _a.sent()];
124
129
  }
125
130
  });
126
131
  });
127
132
  };
128
133
  return SilentFlowClient;
129
- }(BaseClient$1));
134
+ }(BaseClient));
130
135
 
131
136
  export { SilentFlowClient };
132
137
  //# sourceMappingURL=SilentFlowClient.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SilentFlowClient.js","sources":["../../src/client/SilentFlowClient.ts"],"sourcesContent":["/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { BaseClient } from \"./BaseClient\";\r\nimport { ClientConfiguration } from \"../config/ClientConfiguration\";\r\nimport { CommonSilentFlowRequest } from \"../request/CommonSilentFlowRequest\";\r\nimport { AuthenticationResult } from \"../response/AuthenticationResult\";\r\nimport { ScopeSet } from \"../request/ScopeSet\";\r\nimport { AuthToken } from \"../account/AuthToken\";\r\nimport { TimeUtils } from \"../utils/TimeUtils\";\r\nimport { RefreshTokenClient } from \"./RefreshTokenClient\";\r\nimport { ClientAuthError, ClientAuthErrorMessage } from \"../error/ClientAuthError\";\r\nimport { ClientConfigurationError } from \"../error/ClientConfigurationError\";\r\nimport { ResponseHandler } from \"../response/ResponseHandler\";\r\nimport { CacheRecord } from \"../cache/entities/CacheRecord\";\r\nimport { AuthenticationScheme, CacheOutcome } from \"../utils/Constants\";\r\nimport { StringUtils } from \"../utils/StringUtils\";\r\n\r\nexport class SilentFlowClient extends BaseClient {\r\n\r\n constructor(configuration: ClientConfiguration) {\r\n super(configuration);\r\n }\r\n\r\n /**\r\n * Retrieves a token from cache if it is still valid, or uses the cached refresh token to renew\r\n * the given token and returns the renewed token\r\n * @param request\r\n */\r\n async acquireToken(request: CommonSilentFlowRequest): Promise<AuthenticationResult> {\r\n try {\r\n return await this.acquireCachedToken(request);\r\n } catch (e) {\r\n if (e instanceof ClientAuthError && e.errorCode === ClientAuthErrorMessage.tokenRefreshRequired.code) {\r\n const refreshTokenClient = new RefreshTokenClient(this.config);\r\n return refreshTokenClient.acquireTokenByRefreshToken(request);\r\n } else {\r\n throw e;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Retrieves token from cache or throws an error if it must be refreshed.\r\n * @param request\r\n */\r\n async acquireCachedToken(request: CommonSilentFlowRequest): Promise<AuthenticationResult> {\r\n // Cannot renew token if no request object is given.\r\n if (!request) {\r\n throw ClientConfigurationError.createEmptyTokenRequestError();\r\n }\r\n\r\n // We currently do not support silent flow for account === null use cases; This will be revisited for confidential flow usecases\r\n if (!request.account) {\r\n throw ClientAuthError.createNoAccountInSilentRequestError();\r\n }\r\n const requestScopes = new ScopeSet(request.scopes || []);\r\n const environment = request.authority || this.authority.getPreferredCache();\r\n const authScheme = request.authenticationScheme || AuthenticationScheme.BEARER;\r\n const cacheRecord = this.cacheManager.readCacheRecord(request.account, this.config.authOptions.clientId, requestScopes, environment, authScheme);\r\n \r\n if (request.forceRefresh) {\r\n // Must refresh due to present force_refresh flag.\r\n this.serverTelemetryManager?.setCacheOutcome(CacheOutcome.FORCE_REFRESH);\r\n throw ClientAuthError.createRefreshRequiredError();\r\n } else if (!cacheRecord.accessToken) {\r\n // Must refresh due to non-existent access_token.\r\n this.serverTelemetryManager?.setCacheOutcome(CacheOutcome.NO_CACHED_ACCESS_TOKEN);\r\n throw ClientAuthError.createRefreshRequiredError();\r\n } else if (\r\n TimeUtils.wasClockTurnedBack(cacheRecord.accessToken.cachedAt) ||\r\n TimeUtils.isTokenExpired(cacheRecord.accessToken.expiresOn, this.config.systemOptions.tokenRenewalOffsetSeconds)\r\n ) {\r\n // Must refresh due to expired access_token.\r\n this.serverTelemetryManager?.setCacheOutcome(CacheOutcome.CACHED_ACCESS_TOKEN_EXPIRED);\r\n throw ClientAuthError.createRefreshRequiredError();\r\n } else if (cacheRecord.accessToken.refreshOn && TimeUtils.isTokenExpired(cacheRecord.accessToken.refreshOn, 0)) {\r\n // Must refresh due to the refresh_in value.\r\n this.serverTelemetryManager?.setCacheOutcome(CacheOutcome.REFRESH_CACHED_ACCESS_TOKEN);\r\n throw ClientAuthError.createRefreshRequiredError();\r\n } else if (!StringUtils.isEmptyObj(request.claims)) {\r\n // Must refresh due to request parameters.\r\n throw ClientAuthError.createRefreshRequiredError();\r\n }\r\n\r\n if (this.config.serverTelemetryManager) {\r\n this.config.serverTelemetryManager.incrementCacheHits();\r\n }\r\n\r\n return await this.generateResultFromCacheRecord(cacheRecord, request);\r\n }\r\n\r\n /**\r\n * Helper function to build response object from the CacheRecord\r\n * @param cacheRecord\r\n */\r\n private async generateResultFromCacheRecord(cacheRecord: CacheRecord, request: CommonSilentFlowRequest): Promise<AuthenticationResult> {\r\n let idTokenObj: AuthToken | undefined;\r\n if (cacheRecord.idToken) {\r\n idTokenObj = new AuthToken(cacheRecord.idToken.secret, this.config.cryptoInterface);\r\n }\r\n return await ResponseHandler.generateAuthenticationResult(\r\n this.cryptoUtils,\r\n this.authority,\r\n cacheRecord,\r\n true,\r\n request,\r\n idTokenObj\r\n );\r\n }\r\n}\r\n"],"names":["ClientAuthError","RefreshTokenClient","ClientConfigurationError","ScopeSet","TimeUtils","StringUtils","AuthToken","ResponseHandler","BaseClient"],"mappings":";;;;;;;;;;;;;;AAAA;;;;;IAoBsC,oCAAU;IAE5C,0BAAY,aAAkC;eAC1C,kBAAM,aAAa,CAAC;KACvB;;;;;;IAOK,uCAAY,GAAlB,UAAmB,OAAgC;;;;;;;wBAEpC,qBAAM,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,EAAA;4BAA7C,sBAAO,SAAsC,EAAC;;;wBAE9C,IAAI,GAAC,YAAYA,iBAAe,IAAI,GAAC,CAAC,SAAS,KAAK,sBAAsB,CAAC,oBAAoB,CAAC,IAAI,EAAE;4BAC5F,kBAAkB,GAAG,IAAIC,oBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;4BAC/D,sBAAO,kBAAkB,CAAC,0BAA0B,CAAC,OAAO,CAAC,EAAC;yBACjE;6BAAM;4BACH,MAAM,GAAC,CAAC;yBACX;;;;;KAER;;;;;IAMK,6CAAkB,GAAxB,UAAyB,OAAgC;;;;;;;;wBAErD,IAAI,CAAC,OAAO,EAAE;4BACV,MAAMC,0BAAwB,CAAC,4BAA4B,EAAE,CAAC;yBACjE;;wBAGD,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;4BAClB,MAAMF,iBAAe,CAAC,mCAAmC,EAAE,CAAC;yBAC/D;wBACK,aAAa,GAAG,IAAIG,UAAQ,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;wBACnD,WAAW,GAAG,OAAO,CAAC,SAAS,IAAI,IAAI,CAAC,SAAS,CAAC,iBAAiB,EAAE,CAAC;wBACtE,UAAU,GAAG,OAAO,CAAC,oBAAoB,IAAI,oBAAoB,CAAC,MAAM,CAAC;wBACzE,WAAW,GAAG,IAAI,C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tD;wBAED,IAAI,IAAI,CAAC,MAAM,CAAC,sBAAsB,EAAE;4BACpC,IAAI,CAAC,MAAM,CAAC,sBAAsB,CAAC,kBAAkB,EAAE,CAAC;yBAC3D;wBAEM,qBAAM,IAAI,CAAC,6BAA6B,CAAC,WAAW,EAAE,OAAO,CAAC,EAAA;4BAArE,sBAAO,SAA8D,EAAC;;;;KACzE;;;;;IAMa,wDAA6B,GAA3C,UAA4C,WAAwB,EAAE,OAAgC;;;;;;wBAElG,IAAI,WAAW,CAAC,OAAO,EAAE;4BACrB,UAAU,GAAG,IAAIM,WAAS,CAAC,WAAW,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;yBACvF;wBACM,qBAAMC,iBAAe,CAAC,4BAA4B,CACrD,IAAI,CAAC,WAAW,EAChB,IAAI,CAAC,SAAS,EACd,WAAW,EACX,IAAI,EACJ,OAAO,EACP,UAAU,CACb,EAAA;4BAPD,sBAAO,SAON,EAAC;;;;KACL;IACL,uBAAC;AAAD,CA5FA,CAAsCC,YAAU;;;;"}
1
+ {"version":3,"file":"SilentFlowClient.js","sources":["../../src/client/SilentFlowClient.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { BaseClient } from \"./BaseClient\";\nimport { ClientConfiguration } from \"../config/ClientConfiguration\";\nimport { CommonSilentFlowRequest } from \"../request/CommonSilentFlowRequest\";\nimport { AuthenticationResult } from \"../response/AuthenticationResult\";\nimport { ScopeSet } from \"../request/ScopeSet\";\nimport { AuthToken } from \"../account/AuthToken\";\nimport { TimeUtils } from \"../utils/TimeUtils\";\nimport { RefreshTokenClient } from \"./RefreshTokenClient\";\nimport { ClientAuthError, ClientAuthErrorMessage } from \"../error/ClientAuthError\";\nimport { ClientConfigurationError } from \"../error/ClientConfigurationError\";\nimport { ResponseHandler } from \"../response/ResponseHandler\";\nimport { CacheRecord } from \"../cache/entities/CacheRecord\";\nimport { AuthenticationScheme, CacheOutcome } from \"../utils/Constants\";\nimport { StringUtils } from \"../utils/StringUtils\";\n\nexport class SilentFlowClient extends BaseClient {\n\n constructor(configuration: ClientConfiguration) {\n super(configuration);\n }\n\n /**\n * Retrieves a token from cache if it is still valid, or uses the cached refresh token to renew\n * the given token and returns the renewed token\n * @param request\n */\n async acquireToken(request: CommonSilentFlowRequest): Promise<AuthenticationResult> {\n try {\n return await this.acquireCachedToken(request);\n } catch (e) {\n if (e instanceof ClientAuthError && e.errorCode === ClientAuthErrorMessage.tokenRefreshRequired.code) {\n const refreshTokenClient = new RefreshTokenClient(this.config);\n return refreshTokenClient.acquireTokenByRefreshToken(request);\n } else {\n throw e;\n }\n }\n }\n\n /**\n * Retrieves token from cache or throws an error if it must be refreshed.\n * @param request\n */\n async acquireCachedToken(request: CommonSilentFlowRequest): Promise<AuthenticationResult> {\n // Cannot renew token if no request object is given.\n if (!request) {\n throw ClientConfigurationError.createEmptyTokenRequestError();\n }\n\n if (request.forceRefresh) {\n // Must refresh due to present force_refresh flag.\n this.serverTelemetryManager?.setCacheOutcome(CacheOutcome.FORCE_REFRESH);\n this.logger.info(\"SilentFlowClient:acquireCachedToken - Skipping cache because forceRefresh is true.\");\n throw ClientAuthError.createRefreshRequiredError();\n } else if (!StringUtils.isEmptyObj(request.claims)) {\n // Must refresh due to request parameters.\n this.logger.info(\"SilentFlowClient:acquireCachedToken - Skipping cache because claims are requested.\");\n throw ClientAuthError.createRefreshRequiredError();\n }\n\n // We currently do not support silent flow for account === null use cases; This will be revisited for confidential flow usecases\n if (!request.account) {\n throw ClientAuthError.createNoAccountInSilentRequestError();\n }\n\n const requestScopes = new ScopeSet(request.scopes || []);\n const environment = request.authority || this.authority.getPreferredCache();\n const authScheme = request.authenticationScheme || AuthenticationScheme.BEARER;\n const cacheRecord = this.cacheManager.readCacheRecord(request.account, this.config.authOptions.clientId, requestScopes, environment, authScheme, request.sshKid);\n \n if (!cacheRecord.accessToken) {\n // Must refresh due to non-existent access_token.\n this.serverTelemetryManager?.setCacheOutcome(CacheOutcome.NO_CACHED_ACCESS_TOKEN);\n this.logger.info(\"SilentFlowClient:acquireCachedToken - No access token found in cache for the given properties.\");\n throw ClientAuthError.createRefreshRequiredError();\n } else if (\n TimeUtils.wasClockTurnedBack(cacheRecord.accessToken.cachedAt) ||\n TimeUtils.isTokenExpired(cacheRecord.accessToken.expiresOn, this.config.systemOptions.tokenRenewalOffsetSeconds)\n ) {\n // Must refresh due to expired access_token.\n this.serverTelemetryManager?.setCacheOutcome(CacheOutcome.CACHED_ACCESS_TOKEN_EXPIRED);\n this.logger.info(`SilentFlowClient:acquireCachedToken - Cached access token is expired or will expire within ${this.config.systemOptions.tokenRenewalOffsetSeconds} seconds.`);\n throw ClientAuthError.createRefreshRequiredError();\n } else if (cacheRecord.accessToken.refreshOn && TimeUtils.isTokenExpired(cacheRecord.accessToken.refreshOn, 0)) {\n // Must refresh due to the refresh_in value.\n this.serverTelemetryManager?.setCacheOutcome(CacheOutcome.REFRESH_CACHED_ACCESS_TOKEN);\n this.logger.info(\"SilentFlowClient:acquireCachedToken - Cached access token's refreshOn property has been exceeded'.\");\n throw ClientAuthError.createRefreshRequiredError();\n }\n\n if (this.config.serverTelemetryManager) {\n this.config.serverTelemetryManager.incrementCacheHits();\n }\n\n return await this.generateResultFromCacheRecord(cacheRecord, request);\n }\n\n /**\n * Helper function to build response object from the CacheRecord\n * @param cacheRecord\n */\n private async generateResultFromCacheRecord(cacheRecord: CacheRecord, request: CommonSilentFlowRequest): Promise<AuthenticationResult> {\n let idTokenObj: AuthToken | undefined;\n if (cacheRecord.idToken) {\n idTokenObj = new AuthToken(cacheRecord.idToken.secret, this.config.cryptoInterface);\n }\n return await ResponseHandler.generateAuthenticationResult(\n this.cryptoUtils,\n this.authority,\n cacheRecord,\n true,\n request,\n idTokenObj\n );\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA;;;;;IAoBsC,oCAAU;IAE5C,0BAA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A6B,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAsBhG;;;;OAIG;YACW,mBAAmB;IAejC;;;OAGG;IACH,OAAO,CAAC,sBAAsB;CA2CjC"}
1
+ {"version":3,"file":"UsernamePasswordClient.d.ts","sourceRoot":"","sources":["../../src/client/UsernamePasswordClient.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,6BAA6B,EAAE,MAAM,0CAA0C,CAAC;AACzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAYxE;;;GAGG;AACH,qBAAa,sBAAuB,SAAQ,UAAU;gBAEtC,aAAa,EAAE,mBAAmB;IAI9C;;;;OAIG;IACG,YAAY,CAAC,OAAO,EAAE,6BAA6B,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAsBhG;;;;OAIG;YACW,mBAAmB;IAqBjC;;;OAGG;IACH,OAAO,CAAC,sBAAsB;CA2CjC"}
@@ -1,13 +1,13 @@
1
- /*! @azure/msal-common v4.5.0 2021-07-22 */
1
+ /*! @azure/msal-common v5.1.0 2021-11-02 */
2
2
  'use strict';
3
3
  import { __extends, __awaiter, __generator } from '../_virtual/_tslib.js';
4
+ import { BaseClient } from './BaseClient.js';
5
+ import { ResponseHandler } from '../response/ResponseHandler.js';
6
+ import { RequestParameterBuilder } from '../request/RequestParameterBuilder.js';
4
7
  import { GrantType } from '../utils/Constants.js';
5
- import { StringUtils as StringUtils$1 } from '../utils/StringUtils.js';
8
+ import { StringUtils } from '../utils/StringUtils.js';
9
+ import { TimeUtils } from '../utils/TimeUtils.js';
6
10
  import { CcsCredentialType } from '../account/CcsCredential.js';
7
- import { BaseClient as BaseClient$1 } from './BaseClient.js';
8
- import { RequestParameterBuilder as RequestParameterBuilder$1 } from '../request/RequestParameterBuilder.js';
9
- import { TimeUtils as TimeUtils$1 } from '../utils/TimeUtils.js';
10
- import { ResponseHandler as ResponseHandler$1 } from '../response/ResponseHandler.js';
11
11
 
12
12
  /*
13
13
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -34,11 +34,11 @@ var UsernamePasswordClient = /** @class */ (function (_super) {
34
34
  switch (_a.label) {
35
35
  case 0:
36
36
  this.logger.info("in acquireToken call");
37
- reqTimestamp = TimeUtils$1.nowSeconds();
37
+ reqTimestamp = TimeUtils.nowSeconds();
38
38
  return [4 /*yield*/, this.executeTokenRequest(this.authority, request)];
39
39
  case 1:
40
40
  response = _a.sent();
41
- responseHandler = new ResponseHandler$1(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.config.serializableCache, this.config.persistencePlugin);
41
+ responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.config.serializableCache, this.config.persistencePlugin);
42
42
  // Validate response. This function throws a server error if an error is returned by the server.
43
43
  responseHandler.validateTokenResponse(response.body);
44
44
  tokenResponse = responseHandler.handleServerTokenResponse(response.body, this.authority, reqTimestamp, request);
@@ -59,7 +59,13 @@ var UsernamePasswordClient = /** @class */ (function (_super) {
59
59
  thumbprint = {
60
60
  clientId: this.config.authOptions.clientId,
61
61
  authority: authority.canonicalAuthority,
62
- scopes: request.scopes
62
+ scopes: request.scopes,
63
+ authenticationScheme: request.authenticationScheme,
64
+ resourceRequestMethod: request.resourceRequestMethod,
65
+ resourceRequestUri: request.resourceRequestUri,
66
+ shrClaims: request.shrClaims,
67
+ sshJwk: request.sshJwk,
68
+ sshKid: request.sshKid
63
69
  };
64
70
  requestBody = this.createTokenRequestBody(request);
65
71
  headers = this.createTokenRequestHeaders({
@@ -75,7 +81,7 @@ var UsernamePasswordClient = /** @class */ (function (_super) {
75
81
  * @param request
76
82
  */
77
83
  UsernamePasswordClient.prototype.createTokenRequestBody = function (request) {
78
- var parameterBuilder = new RequestParameterBuilder$1();
84
+ var parameterBuilder = new RequestParameterBuilder();
79
85
  parameterBuilder.addClientId(this.config.authOptions.clientId);
80
86
  parameterBuilder.addUsername(request.username);
81
87
  parameterBuilder.addPassword(request.password);
@@ -97,7 +103,7 @@ var UsernamePasswordClient = /** @class */ (function (_super) {
97
103
  parameterBuilder.addClientAssertion(clientAssertion.assertion);
98
104
  parameterBuilder.addClientAssertionType(clientAssertion.assertionType);
99
105
  }
100
- if (!StringUtils$1.isEmptyObj(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {
106
+ if (!StringUtils.isEmptyObj(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {
101
107
  parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);
102
108
  }
103
109
  if (this.config.systemOptions.preventCorsPreflight && request.username) {
@@ -106,7 +112,7 @@ var UsernamePasswordClient = /** @class */ (function (_super) {
106
112
  return parameterBuilder.createQueryString();
107
113
  };
108
114
  return UsernamePasswordClient;
109
- }(BaseClient$1));
115
+ }(BaseClient));
110
116
 
111
117
  export { UsernamePasswordClient };
112
118
  //# sourceMappingURL=UsernamePasswordClient.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"UsernamePasswordClient.js","sources":["../../src/client/UsernamePasswordClient.ts"],"sourcesContent":["/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { BaseClient } from \"./BaseClient\";\r\nimport { ClientConfiguration } from \"../config/ClientConfiguration\";\r\nimport { CommonUsernamePasswordRequest } from \"../request/CommonUsernamePasswordRequest\";\r\nimport { AuthenticationResult } from \"../response/AuthenticationResult\";\r\nimport { ResponseHandler } from \"../response/ResponseHandler\";\r\nimport { Authority } from \"../authority/Authority\";\r\nimport { NetworkResponse } from \"../network/NetworkManager\";\r\nimport { ServerAuthorizationTokenResponse } from \"../response/ServerAuthorizationTokenResponse\";\r\nimport { RequestParameterBuilder } from \"../request/RequestParameterBuilder\";\r\nimport { GrantType } from \"../utils/Constants\";\r\nimport { StringUtils } from \"../utils/StringUtils\";\r\nimport { RequestThumbprint } from \"../network/RequestThumbprint\";\r\nimport { TimeUtils } from \"../utils/TimeUtils\";\r\nimport { CcsCredentialType } from \"../account/CcsCredential\";\r\n\r\n/**\r\n * Oauth2.0 Password grant client\r\n * Note: We are only supporting public clients for password grant and for purely testing purposes\r\n */\r\nexport class UsernamePasswordClient extends BaseClient {\r\n\r\n constructor(configuration: ClientConfiguration) {\r\n super(configuration);\r\n }\r\n\r\n /**\r\n * API to acquire a token by passing the username and password to the service in exchage of credentials\r\n * password_grant\r\n * @param request\r\n */\r\n async acquireToken(request: CommonUsernamePasswordRequest): Promise<AuthenticationResult | null> {\r\n this.logger.info(\"in acquireToken call\");\r\n\r\n const reqTimestamp = TimeUtils.nowSeconds();\r\n const response = await this.executeTokenRequest(this.authority, request);\r\n\r\n const responseHandler = new ResponseHandler(\r\n this.config.authOptions.clientId,\r\n this.cacheManager,\r\n this.cryptoUtils,\r\n this.logger,\r\n this.config.serializableCache,\r\n this.config.persistencePlugin\r\n );\r\n\r\n // Validate response. This function throws a server error if an error is returned by the server.\r\n responseHandler.validateTokenResponse(response.body);\r\n const tokenResponse = responseHandler.handleServerTokenResponse(response.body, this.authority, reqTimestamp, request);\r\n\r\n return tokenResponse;\r\n }\r\n\r\n /**\r\n * Executes POST request to token endpoint\r\n * @param authority\r\n * @param request\r\n */\r\n private async executeTokenRequest(authority: Authority, request: CommonUsernamePasswordRequest): Promise<NetworkResponse<ServerAuthorizationTokenResponse>> {\r\n const thumbprint: RequestThumbprint = {\r\n clientId: this.config.authOptions.clientId,\r\n authority: authority.canonicalAuthority,\r\n scopes: request.scopes\r\n };\r\n const requestBody = this.createTokenRequestBody(request);\r\n const headers: Record<string, string> = this.createTokenRequestHeaders({\r\n credential: request.username,\r\n type: CcsCredentialType.UPN\r\n });\r\n\r\n return this.executePostToTokenEndpoint(authority.tokenEndpoint, requestBody, headers, thumbprint);\r\n }\r\n\r\n /**\r\n * Generates a map for all the params to be sent to the service\r\n * @param request\r\n */\r\n private createTokenRequestBody(request: CommonUsernamePasswordRequest): string {\r\n const parameterBuilder = new RequestParameterBuilder();\r\n\r\n parameterBuilder.addClientId(this.config.authOptions.clientId);\r\n parameterBuilder.addUsername(request.username);\r\n parameterBuilder.addPassword(request.password);\r\n\r\n parameterBuilder.addScopes(request.scopes);\r\n\r\n parameterBuilder.addGrantType(GrantType.RESOURCE_OWNER_PASSWORD_GRANT);\r\n parameterBuilder.addClientInfo();\r\n\r\n parameterBuilder.addLibraryInfo(this.config.libraryInfo);\r\n\r\n parameterBuilder.addThrottling();\r\n\r\n if (this.serverTelemetryManager) {\r\n parameterBuilder.addServerTelemetry(this.serverTelemetryManager);\r\n }\r\n\r\n const correlationId = request.correlationId || this.config.cryptoInterface.createNewGuid();\r\n parameterBuilder.addCorrelationId(correlationId);\r\n\r\n if (this.config.clientCredentials.clientSecret) {\r\n parameterBuilder.addClientSecret(this.config.clientCredentials.clientSecret);\r\n }\r\n\r\n if (this.config.clientCredentials.clientAssertion) {\r\n const clientAssertion = this.config.clientCredentials.clientAssertion;\r\n parameterBuilder.addClientAssertion(clientAssertion.assertion);\r\n parameterBuilder.addClientAssertionType(clientAssertion.assertionType);\r\n }\r\n\r\n if (!StringUtils.isEmptyObj(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {\r\n parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);\r\n }\r\n\r\n if (this.config.systemOptions.preventCorsPreflight && request.username) {\r\n parameterBuilder.addCcsUpn(request.username);\r\n }\r\n\r\n return parameterBuilder.createQueryString();\r\n }\r\n}\r\n"],"names":["TimeUtils","ResponseHandler","RequestParameterBuilder","StringUtils","BaseClient"],"mappings":";;;;;;;;;;;AAAA;;;;AAoBA;;;;;IAI4C,0CAAU;IAElD,gCAAY,aAAkC;eAC1C,kBAAM,aAAa,CAAC;KACvB;;;;;;IAOK,6CAAY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BAAgB,CAAC,kBAAkB,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;YAC/D,gBAAgB,CAAC,sBAAsB,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC;SAC1E;QAED,IAAI,CAACC,aAAW,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,kBAAkB,IAAI,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,kBAAkB,CAAC,MAAM,GAAG,CAAC,EAAE;YAChJ,gBAAgB,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC;SAC1F;QAED,IAAI,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,oBAAoB,IAAI,OAAO,CAAC,QAAQ,EAAE;YACpE,gBAAgB,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;SAChD;QAED,OAAO,gBAAgB,CAAC,iBAAiB,EAAE,CAAC;KAC/C;IACL,6BAAC;AAAD,CApGA,CAA4CC,YAAU;;;;"}
1
+ {"version":3,"file":"UsernamePasswordClient.js","sources":["../../src/client/UsernamePasswordClient.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { BaseClient } from \"./BaseClient\";\nimport { ClientConfiguration } from \"../config/ClientConfiguration\";\nimport { CommonUsernamePasswordRequest } from \"../request/CommonUsernamePasswordRequest\";\nimport { AuthenticationResult } from \"../response/AuthenticationResult\";\nimport { ResponseHandler } from \"../response/ResponseHandler\";\nimport { Authority } from \"../authority/Authority\";\nimport { NetworkResponse } from \"../network/NetworkManager\";\nimport { ServerAuthorizationTokenResponse } from \"../response/ServerAuthorizationTokenResponse\";\nimport { RequestParameterBuilder } from \"../request/RequestParameterBuilder\";\nimport { GrantType } from \"../utils/Constants\";\nimport { StringUtils } from \"../utils/StringUtils\";\nimport { RequestThumbprint } from \"../network/RequestThumbprint\";\nimport { TimeUtils } from \"../utils/TimeUtils\";\nimport { CcsCredentialType } from \"../account/CcsCredential\";\n\n/**\n * Oauth2.0 Password grant client\n * Note: We are only supporting public clients for password grant and for purely testing purposes\n */\nexport class UsernamePasswordClient extends BaseClient {\n\n constructor(configuration: ClientConfiguration) {\n super(configuration);\n }\n\n /**\n * API to acquire a token by passing the username and password to the service in exchage of credentials\n * password_grant\n * @param request\n */\n async acquireToken(request: CommonUsernamePasswordRequest): Promise<AuthenticationResult | null> {\n this.logger.info(\"in acquireToken call\");\n\n const reqTimestamp = TimeUtils.nowSeconds();\n const response = await this.executeTokenRequest(this.authority, request);\n\n const responseHandler = new ResponseHandler(\n this.config.authOptions.clientId,\n this.cacheManager,\n this.cryptoUtils,\n this.logger,\n this.config.serializableCache,\n this.config.persistencePlugin\n );\n\n // Validate response. This function throws a server error if an error is returned by the server.\n responseHandler.validateTokenResponse(response.body);\n const tokenResponse = responseHandler.handleServerTokenResponse(response.body, this.authority, reqTimestamp, request);\n\n return tokenResponse;\n }\n\n /**\n * Executes POST request to token endpoint\n * @param authority\n * @param request\n */\n private async executeTokenRequest(authority: Authority, request: CommonUsernamePasswordRequest): Promise<NetworkResponse<ServerAuthorizationTokenResponse>> {\n const thumbprint: RequestThumbprint = {\n clientId: this.config.authOptions.clientId,\n authority: authority.canonicalAuthority,\n scopes: request.scopes,\n authenticationScheme: request.authenticationScheme,\n resourceRequestMethod: request.resourceRequestMethod,\n resourceRequestUri: request.resourceRequestUri,\n shrClaims: request.shrClaims,\n sshJwk: request.sshJwk,\n sshKid: request.sshKid\n };\n const requestBody = this.createTokenRequestBody(request);\n const headers: Record<string, string> = this.createTokenRequestHeaders({\n credential: request.username,\n type: CcsCredentialType.UPN\n });\n\n return this.executePostToTokenEndpoint(authority.tokenEndpoint, requestBody, headers, thumbprint);\n }\n\n /**\n * Generates a map for all the params to be sent to the service\n * @param request\n */\n private createTokenRequestBody(request: CommonUsernamePasswordRequest): string {\n const parameterBuilder = new RequestParameterBuilder();\n\n parameterBuilder.addClientId(this.config.authOptions.clientId);\n parameterBuilder.addUsername(request.username);\n parameterBuilder.addPassword(request.password);\n\n parameterBuilder.addScopes(request.scopes);\n\n parameterBuilder.addGrantType(GrantType.RESOURCE_OWNER_PASSWORD_GRANT);\n parameterBuilder.addClientInfo();\n\n parameterBuilder.addLibraryInfo(this.config.libraryInfo);\n\n parameterBuilder.addThrottling();\n\n if (this.serverTelemetryManager) {\n parameterBuilder.addServerTelemetry(this.serverTelemetryManager);\n }\n\n const correlationId = request.correlationId || this.config.cryptoInterface.createNewGuid();\n parameterBuilder.addCorrelationId(correlationId);\n\n if (this.config.clientCredentials.clientSecret) {\n parameterBuilder.addClientSecret(this.config.clientCredentials.clientSecret);\n }\n\n if (this.config.clientCredentials.clientAssertion) {\n const clientAssertion = this.config.clientCredentials.clientAssertion;\n parameterBuilder.addClientAssertion(clientAssertion.assertion);\n parameterBuilder.addClientAssertionType(clientAssertion.assertionType);\n }\n\n if (!StringUtils.isEmptyObj(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {\n parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);\n }\n\n if (this.config.systemOptions.preventCorsPreflight && request.username) {\n parameterBuilder.addCcsUpn(request.username);\n }\n\n return parameterBuilder.createQueryString();\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAAA;;;;AAoBA;;;;;IAI4C,0CAAU;IAElD,gCAAY,aAAkC;eAC1C,kBAAM,aAAa,CAAC;KACvB;;;;;;IAOK,6CAAY,GAAlB,UAAmB,OAAsC;;;;;;wBACrD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;wBAEnC,YAAY,GAAG,SAAS,CAAC,UAAU,EAAE,CAAC;wBAC3B,qBAAM,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,EAAA;;wBAAlE,Q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