@azure/msal-common 13.0.0 → 14.0.0-alpha.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.
- package/LICENSE +21 -21
- package/README.md +62 -62
- package/dist/account/AccountInfo.d.ts +2 -2
- package/dist/account/AccountInfo.d.ts.map +1 -1
- package/dist/account/AuthToken.d.ts.map +1 -1
- package/dist/account/AuthToken.js +13 -14
- package/dist/account/AuthToken.js.map +1 -1
- package/dist/account/CcsCredential.d.ts +1 -1
- package/dist/account/CcsCredential.d.ts.map +1 -1
- package/dist/account/CcsCredential.js +1 -1
- package/dist/account/CcsCredential.js.map +1 -1
- package/dist/account/ClientCredentials.d.ts +2 -2
- package/dist/account/ClientCredentials.d.ts.map +1 -1
- package/dist/account/ClientInfo.d.ts +1 -1
- package/dist/account/ClientInfo.d.ts.map +1 -1
- package/dist/account/ClientInfo.js +6 -4
- package/dist/account/ClientInfo.js.map +1 -1
- package/dist/account/DecodedAuthToken.d.ts.map +1 -1
- package/dist/account/TokenClaims.d.ts +1 -1
- package/dist/account/TokenClaims.d.ts.map +1 -1
- package/dist/authority/Authority.d.ts.map +1 -1
- package/dist/authority/Authority.js +464 -546
- package/dist/authority/Authority.js.map +1 -1
- package/dist/authority/AuthorityFactory.d.ts.map +1 -1
- package/dist/authority/AuthorityFactory.js +19 -34
- package/dist/authority/AuthorityFactory.js.map +1 -1
- package/dist/authority/AuthorityMetadata.d.ts.map +1 -1
- package/dist/authority/AuthorityMetadata.js +873 -4
- package/dist/authority/AuthorityMetadata.js.map +1 -1
- package/dist/authority/AuthorityOptions.d.ts +1 -1
- package/dist/authority/AuthorityOptions.d.ts.map +1 -1
- package/dist/authority/AuthorityOptions.js +1 -1
- package/dist/authority/AuthorityOptions.js.map +1 -1
- package/dist/authority/AuthorityType.js +1 -1
- package/dist/authority/AuthorityType.js.map +1 -1
- package/dist/authority/AzureRegion.d.ts +1 -1
- package/dist/authority/AzureRegion.d.ts.map +1 -1
- package/dist/authority/AzureRegionConfiguration.d.ts +1 -1
- package/dist/authority/AzureRegionConfiguration.d.ts.map +1 -1
- package/dist/authority/CloudDiscoveryMetadata.d.ts +1 -1
- package/dist/authority/CloudDiscoveryMetadata.d.ts.map +1 -1
- package/dist/authority/CloudInstanceDiscoveryErrorResponse.d.ts +1 -1
- package/dist/authority/CloudInstanceDiscoveryErrorResponse.d.ts.map +1 -1
- package/dist/authority/CloudInstanceDiscoveryErrorResponse.js +1 -1
- package/dist/authority/CloudInstanceDiscoveryErrorResponse.js.map +1 -1
- package/dist/authority/CloudInstanceDiscoveryResponse.d.ts +1 -1
- package/dist/authority/CloudInstanceDiscoveryResponse.d.ts.map +1 -1
- package/dist/authority/CloudInstanceDiscoveryResponse.js +1 -1
- package/dist/authority/CloudInstanceDiscoveryResponse.js.map +1 -1
- package/dist/authority/ImdsOptions.d.ts +1 -1
- package/dist/authority/ImdsOptions.d.ts.map +1 -1
- package/dist/authority/OpenIdConfigResponse.d.ts +1 -1
- package/dist/authority/OpenIdConfigResponse.d.ts.map +1 -1
- package/dist/authority/OpenIdConfigResponse.js +1 -1
- package/dist/authority/OpenIdConfigResponse.js.map +1 -1
- package/dist/authority/ProtocolMode.js +1 -1
- package/dist/authority/ProtocolMode.js.map +1 -1
- package/dist/authority/RegionDiscovery.d.ts.map +1 -1
- package/dist/authority/RegionDiscovery.js +85 -107
- package/dist/authority/RegionDiscovery.js.map +1 -1
- package/dist/authority/RegionDiscoveryMetadata.d.ts +1 -1
- package/dist/authority/RegionDiscoveryMetadata.d.ts.map +1 -1
- package/dist/broker/nativeBroker/INativeBrokerPlugin.d.ts.map +1 -1
- package/dist/cache/CacheManager.d.ts.map +1 -1
- package/dist/cache/CacheManager.js +440 -475
- package/dist/cache/CacheManager.js.map +1 -1
- package/dist/cache/entities/AccessTokenEntity.d.ts.map +1 -1
- package/dist/cache/entities/AccessTokenEntity.js +21 -22
- package/dist/cache/entities/AccessTokenEntity.js.map +1 -1
- package/dist/cache/entities/AccountEntity.d.ts.map +1 -1
- package/dist/cache/entities/AccountEntity.js +78 -66
- package/dist/cache/entities/AccountEntity.js.map +1 -1
- package/dist/cache/entities/AppMetadataEntity.d.ts.map +1 -1
- package/dist/cache/entities/AppMetadataEntity.js +16 -17
- package/dist/cache/entities/AppMetadataEntity.js.map +1 -1
- package/dist/cache/entities/AuthorityMetadataEntity.d.ts.map +1 -1
- package/dist/cache/entities/AuthorityMetadataEntity.js +22 -19
- package/dist/cache/entities/AuthorityMetadataEntity.js.map +1 -1
- package/dist/cache/entities/CacheRecord.d.ts.map +1 -1
- package/dist/cache/entities/CacheRecord.js +4 -5
- package/dist/cache/entities/CacheRecord.js.map +1 -1
- package/dist/cache/entities/CredentialEntity.d.ts.map +1 -1
- package/dist/cache/entities/CredentialEntity.js +35 -34
- package/dist/cache/entities/CredentialEntity.js.map +1 -1
- package/dist/cache/entities/IdTokenEntity.d.ts.map +1 -1
- package/dist/cache/entities/IdTokenEntity.js +8 -14
- package/dist/cache/entities/IdTokenEntity.js.map +1 -1
- package/dist/cache/entities/RefreshTokenEntity.d.ts.map +1 -1
- package/dist/cache/entities/RefreshTokenEntity.js +8 -14
- package/dist/cache/entities/RefreshTokenEntity.js.map +1 -1
- package/dist/cache/entities/ServerTelemetryEntity.d.ts.map +1 -1
- package/dist/cache/entities/ServerTelemetryEntity.js +8 -9
- package/dist/cache/entities/ServerTelemetryEntity.js.map +1 -1
- package/dist/cache/entities/ThrottlingEntity.js +9 -11
- package/dist/cache/entities/ThrottlingEntity.js.map +1 -1
- package/dist/cache/interface/ICacheManager.d.ts.map +1 -1
- package/dist/cache/persistence/TokenCacheContext.d.ts.map +1 -1
- package/dist/cache/persistence/TokenCacheContext.js +16 -25
- package/dist/cache/persistence/TokenCacheContext.js.map +1 -1
- package/dist/cache/utils/CacheTypes.d.ts +11 -11
- package/dist/cache/utils/CacheTypes.d.ts.map +1 -1
- package/dist/client/AuthorizationCodeClient.d.ts.map +1 -1
- package/dist/client/AuthorizationCodeClient.js +341 -384
- package/dist/client/AuthorizationCodeClient.js.map +1 -1
- package/dist/client/BaseClient.d.ts.map +1 -1
- package/dist/client/BaseClient.js +27 -35
- package/dist/client/BaseClient.js.map +1 -1
- package/dist/client/RefreshTokenClient.d.ts.map +1 -1
- package/dist/client/RefreshTokenClient.js +208 -241
- package/dist/client/RefreshTokenClient.js.map +1 -1
- package/dist/client/SilentFlowClient.d.ts.map +1 -1
- package/dist/client/SilentFlowClient.js +77 -105
- package/dist/client/SilentFlowClient.js.map +1 -1
- package/dist/config/AppTokenProvider.d.ts +2 -2
- package/dist/config/AppTokenProvider.d.ts.map +1 -1
- package/dist/config/ClientConfiguration.d.ts +9 -9
- package/dist/config/ClientConfiguration.d.ts.map +1 -1
- package/dist/config/ClientConfiguration.js +40 -43
- package/dist/config/ClientConfiguration.js.map +1 -1
- package/dist/crypto/ICrypto.d.ts +2 -2
- package/dist/crypto/ICrypto.d.ts.map +1 -1
- package/dist/crypto/ICrypto.js +27 -58
- package/dist/crypto/ICrypto.js.map +1 -1
- package/dist/crypto/JoseHeader.d.ts +1 -1
- package/dist/crypto/JoseHeader.d.ts.map +1 -1
- package/dist/crypto/JoseHeader.js +8 -9
- package/dist/crypto/JoseHeader.js.map +1 -1
- package/dist/crypto/PopTokenGenerator.d.ts +2 -2
- package/dist/crypto/PopTokenGenerator.d.ts.map +1 -1
- package/dist/crypto/PopTokenGenerator.js +47 -71
- package/dist/crypto/PopTokenGenerator.js.map +1 -1
- package/dist/crypto/SignedHttpRequest.d.ts +1 -1
- package/dist/crypto/SignedHttpRequest.d.ts.map +1 -1
- package/dist/error/AuthError.d.ts.map +1 -1
- package/dist/error/AuthError.js +25 -28
- package/dist/error/AuthError.js.map +1 -1
- package/dist/error/ClientAuthError.d.ts +8 -0
- package/dist/error/ClientAuthError.d.ts.map +1 -1
- package/dist/error/ClientAuthError.js +187 -181
- package/dist/error/ClientAuthError.js.map +1 -1
- package/dist/error/ClientConfigurationError.d.ts.map +1 -1
- package/dist/error/ClientConfigurationError.js +82 -86
- package/dist/error/ClientConfigurationError.js.map +1 -1
- package/dist/error/InteractionRequiredAuthError.d.ts.map +1 -1
- package/dist/error/InteractionRequiredAuthError.js +36 -35
- package/dist/error/InteractionRequiredAuthError.js.map +1 -1
- package/dist/error/JoseHeaderError.d.ts.map +1 -1
- package/dist/error/JoseHeaderError.js +14 -18
- package/dist/error/JoseHeaderError.js.map +1 -1
- package/dist/error/ServerError.d.ts.map +1 -1
- package/dist/error/ServerError.js +7 -11
- package/dist/error/ServerError.js.map +1 -1
- package/dist/index.cjs.js +4221 -4476
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +20 -21
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -6
- package/dist/index.js.map +1 -1
- package/dist/logger/Logger.d.ts +1 -1
- package/dist/logger/Logger.d.ts.map +1 -1
- package/dist/logger/Logger.js +70 -60
- package/dist/logger/Logger.js.map +1 -1
- package/dist/network/INetworkModule.d.ts +1 -1
- package/dist/network/INetworkModule.d.ts.map +1 -1
- package/dist/network/INetworkModule.js +7 -7
- package/dist/network/INetworkModule.js.map +1 -1
- package/dist/network/NetworkManager.d.ts +4 -3
- package/dist/network/NetworkManager.d.ts.map +1 -1
- package/dist/network/NetworkManager.js +21 -35
- package/dist/network/NetworkManager.js.map +1 -1
- package/dist/network/RequestThumbprint.d.ts +1 -1
- package/dist/network/RequestThumbprint.d.ts.map +1 -1
- package/dist/network/ThrottlingUtils.d.ts.map +1 -1
- package/dist/network/ThrottlingUtils.js +37 -36
- package/dist/network/ThrottlingUtils.js.map +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.d.ts.map +1 -1
- package/dist/packageMetadata.js +3 -3
- package/dist/packageMetadata.js.map +1 -1
- package/dist/request/AuthenticationHeaderParser.d.ts.map +1 -1
- package/dist/request/AuthenticationHeaderParser.js +17 -18
- package/dist/request/AuthenticationHeaderParser.js.map +1 -1
- package/dist/request/BaseAuthRequest.d.ts +1 -1
- package/dist/request/BaseAuthRequest.d.ts.map +1 -1
- package/dist/request/CommonAuthorizationCodeRequest.d.ts +1 -1
- package/dist/request/CommonAuthorizationCodeRequest.d.ts.map +1 -1
- package/dist/request/CommonAuthorizationUrlRequest.d.ts +1 -1
- package/dist/request/CommonAuthorizationUrlRequest.d.ts.map +1 -1
- package/dist/request/CommonClientCredentialRequest.d.ts +1 -1
- package/dist/request/CommonClientCredentialRequest.d.ts.map +1 -1
- package/dist/request/CommonDeviceCodeRequest.d.ts +1 -1
- package/dist/request/CommonDeviceCodeRequest.d.ts.map +1 -1
- package/dist/request/CommonEndSessionRequest.d.ts +1 -1
- package/dist/request/CommonEndSessionRequest.d.ts.map +1 -1
- package/dist/request/CommonOnBehalfOfRequest.d.ts +1 -1
- package/dist/request/CommonOnBehalfOfRequest.d.ts.map +1 -1
- package/dist/request/CommonRefreshTokenRequest.d.ts +1 -1
- package/dist/request/CommonRefreshTokenRequest.d.ts.map +1 -1
- package/dist/request/CommonSilentFlowRequest.d.ts +1 -1
- package/dist/request/CommonSilentFlowRequest.d.ts.map +1 -1
- package/dist/request/CommonUsernamePasswordRequest.d.ts +1 -1
- package/dist/request/CommonUsernamePasswordRequest.d.ts.map +1 -1
- package/dist/request/NativeRequest.d.ts +1 -1
- package/dist/request/NativeRequest.d.ts.map +1 -1
- package/dist/request/NativeSignOutRequest.d.ts +1 -1
- package/dist/request/NativeSignOutRequest.d.ts.map +1 -1
- package/dist/request/RequestParameterBuilder.d.ts.map +1 -1
- package/dist/request/RequestParameterBuilder.js +111 -113
- package/dist/request/RequestParameterBuilder.js.map +1 -1
- package/dist/request/RequestValidator.d.ts.map +1 -1
- package/dist/request/RequestValidator.js +23 -28
- package/dist/request/RequestValidator.js.map +1 -1
- package/dist/request/ScopeSet.d.ts.map +1 -1
- package/dist/request/ScopeSet.js +70 -70
- package/dist/request/ScopeSet.js.map +1 -1
- package/dist/response/AuthenticationResult.d.ts +1 -1
- package/dist/response/AuthenticationResult.d.ts.map +1 -1
- package/dist/response/AuthorizationCodePayload.d.ts +1 -1
- package/dist/response/AuthorizationCodePayload.d.ts.map +1 -1
- package/dist/response/DeviceCodeResponse.d.ts +2 -2
- package/dist/response/DeviceCodeResponse.d.ts.map +1 -1
- package/dist/response/ExternalTokenResponse.d.ts +1 -1
- package/dist/response/ExternalTokenResponse.d.ts.map +1 -1
- package/dist/response/IMDSBadResponse.d.ts +1 -1
- package/dist/response/IMDSBadResponse.d.ts.map +1 -1
- package/dist/response/ResponseHandler.d.ts.map +1 -1
- package/dist/response/ResponseHandler.js +195 -180
- package/dist/response/ResponseHandler.js.map +1 -1
- package/dist/response/ServerAuthorizationCodeResponse.d.ts +1 -1
- package/dist/response/ServerAuthorizationCodeResponse.d.ts.map +1 -1
- package/dist/response/ServerAuthorizationTokenResponse.d.ts +1 -1
- package/dist/response/ServerAuthorizationTokenResponse.d.ts.map +1 -1
- package/dist/telemetry/performance/IPerformanceClient.d.ts +3 -4
- package/dist/telemetry/performance/IPerformanceClient.d.ts.map +1 -1
- package/dist/telemetry/performance/PerformanceClient.d.ts +2 -10
- package/dist/telemetry/performance/PerformanceClient.d.ts.map +1 -1
- package/dist/telemetry/performance/PerformanceClient.js +134 -129
- package/dist/telemetry/performance/PerformanceClient.js.map +1 -1
- package/dist/telemetry/performance/PerformanceEvent.d.ts +4 -4
- package/dist/telemetry/performance/PerformanceEvent.d.ts.map +1 -1
- package/dist/telemetry/performance/PerformanceEvent.js +2 -2
- package/dist/telemetry/performance/PerformanceEvent.js.map +1 -1
- package/dist/telemetry/performance/StubPerformanceClient.d.ts +5 -3
- package/dist/telemetry/performance/StubPerformanceClient.d.ts.map +1 -1
- package/dist/telemetry/performance/StubPerformanceClient.js +23 -32
- package/dist/telemetry/performance/StubPerformanceClient.js.map +1 -1
- package/dist/telemetry/server/ServerTelemetryManager.d.ts +1 -2
- package/dist/telemetry/server/ServerTelemetryManager.d.ts.map +1 -1
- package/dist/telemetry/server/ServerTelemetryManager.js +106 -68
- package/dist/telemetry/server/ServerTelemetryManager.js.map +1 -1
- package/dist/telemetry/server/ServerTelemetryRequest.d.ts +1 -1
- package/dist/telemetry/server/ServerTelemetryRequest.d.ts.map +1 -1
- package/dist/url/UrlString.d.ts.map +1 -1
- package/dist/url/UrlString.js +85 -74
- package/dist/url/UrlString.js.map +1 -1
- package/dist/utils/Constants.d.ts.map +1 -1
- package/dist/utils/Constants.js +28 -27
- package/dist/utils/Constants.js.map +1 -1
- package/dist/utils/MsalTypes.d.ts +1 -1
- package/dist/utils/MsalTypes.d.ts.map +1 -1
- package/dist/utils/ProtocolUtils.d.ts +2 -2
- package/dist/utils/ProtocolUtils.d.ts.map +1 -1
- package/dist/utils/ProtocolUtils.js +27 -24
- package/dist/utils/ProtocolUtils.js.map +1 -1
- package/dist/utils/StringUtils.d.ts.map +1 -1
- package/dist/utils/StringUtils.js +44 -42
- package/dist/utils/StringUtils.js.map +1 -1
- package/dist/utils/TimeUtils.d.ts.map +1 -1
- package/dist/utils/TimeUtils.js +16 -19
- package/dist/utils/TimeUtils.js.map +1 -1
- package/package.json +79 -76
- package/dist/_virtual/_tslib.js +0 -90
- package/dist/_virtual/_tslib.js.map +0 -1
- package/dist/client/ClientCredentialClient.d.ts +0 -38
- package/dist/client/ClientCredentialClient.d.ts.map +0 -1
- package/dist/client/ClientCredentialClient.js +0 -203
- package/dist/client/ClientCredentialClient.js.map +0 -1
- package/dist/client/DeviceCodeClient.d.ts +0 -57
- package/dist/client/DeviceCodeClient.d.ts.map +0 -1
- package/dist/client/DeviceCodeClient.js +0 -250
- package/dist/client/DeviceCodeClient.js.map +0 -1
- package/dist/client/OnBehalfOfClient.d.ts +0 -51
- package/dist/client/OnBehalfOfClient.d.ts.map +0 -1
- package/dist/client/OnBehalfOfClient.js +0 -248
- package/dist/client/OnBehalfOfClient.js.map +0 -1
- package/dist/client/UsernamePasswordClient.d.ts +0 -29
- package/dist/client/UsernamePasswordClient.d.ts.map +0 -1
- package/dist/client/UsernamePasswordClient.js +0 -129
- package/dist/client/UsernamePasswordClient.js.map +0 -1
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
/*! @azure/msal-common v13.0.0 2023-05-01 */
|
|
2
|
-
'use strict';
|
|
3
|
-
import { __extends, __awaiter, __generator } from '../_virtual/_tslib.js';
|
|
4
|
-
import { BaseClient } from './BaseClient.js';
|
|
5
|
-
import { ClientAuthError } from '../error/ClientAuthError.js';
|
|
6
|
-
import { RequestParameterBuilder } from '../request/RequestParameterBuilder.js';
|
|
7
|
-
import { GrantType, Constants } from '../utils/Constants.js';
|
|
8
|
-
import { TimeUtils } from '../utils/TimeUtils.js';
|
|
9
|
-
import { ResponseHandler } from '../response/ResponseHandler.js';
|
|
10
|
-
import { StringUtils } from '../utils/StringUtils.js';
|
|
11
|
-
import { ServerError } from '../error/ServerError.js';
|
|
12
|
-
import { UrlString } from '../url/UrlString.js';
|
|
13
|
-
|
|
14
|
-
/*
|
|
15
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
16
|
-
* Licensed under the MIT License.
|
|
17
|
-
*/
|
|
18
|
-
/**
|
|
19
|
-
* OAuth2.0 Device code client
|
|
20
|
-
*/
|
|
21
|
-
var DeviceCodeClient = /** @class */ (function (_super) {
|
|
22
|
-
__extends(DeviceCodeClient, _super);
|
|
23
|
-
function DeviceCodeClient(configuration) {
|
|
24
|
-
return _super.call(this, configuration) || this;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Gets device code from device code endpoint, calls back to with device code response, and
|
|
28
|
-
* polls token endpoint to exchange device code for tokens
|
|
29
|
-
* @param request
|
|
30
|
-
*/
|
|
31
|
-
DeviceCodeClient.prototype.acquireToken = function (request) {
|
|
32
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
33
|
-
var deviceCodeResponse, reqTimestamp, response, responseHandler;
|
|
34
|
-
return __generator(this, function (_a) {
|
|
35
|
-
switch (_a.label) {
|
|
36
|
-
case 0: return [4 /*yield*/, this.getDeviceCode(request)];
|
|
37
|
-
case 1:
|
|
38
|
-
deviceCodeResponse = _a.sent();
|
|
39
|
-
request.deviceCodeCallback(deviceCodeResponse);
|
|
40
|
-
reqTimestamp = TimeUtils.nowSeconds();
|
|
41
|
-
return [4 /*yield*/, this.acquireTokenWithDeviceCode(request, deviceCodeResponse)];
|
|
42
|
-
case 2:
|
|
43
|
-
response = _a.sent();
|
|
44
|
-
responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.config.serializableCache, this.config.persistencePlugin);
|
|
45
|
-
// Validate response. This function throws a server error if an error is returned by the server.
|
|
46
|
-
responseHandler.validateTokenResponse(response);
|
|
47
|
-
return [4 /*yield*/, responseHandler.handleServerTokenResponse(response, this.authority, reqTimestamp, request)];
|
|
48
|
-
case 3: return [2 /*return*/, _a.sent()];
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* Creates device code request and executes http GET
|
|
55
|
-
* @param request
|
|
56
|
-
*/
|
|
57
|
-
DeviceCodeClient.prototype.getDeviceCode = function (request) {
|
|
58
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
59
|
-
var queryParametersString, endpoint, queryString, headers, thumbprint;
|
|
60
|
-
return __generator(this, function (_a) {
|
|
61
|
-
queryParametersString = this.createExtraQueryParameters(request);
|
|
62
|
-
endpoint = UrlString.appendQueryString(this.authority.deviceCodeEndpoint, queryParametersString);
|
|
63
|
-
queryString = this.createQueryString(request);
|
|
64
|
-
headers = this.createTokenRequestHeaders();
|
|
65
|
-
thumbprint = {
|
|
66
|
-
clientId: this.config.authOptions.clientId,
|
|
67
|
-
authority: request.authority,
|
|
68
|
-
scopes: request.scopes,
|
|
69
|
-
claims: request.claims,
|
|
70
|
-
authenticationScheme: request.authenticationScheme,
|
|
71
|
-
resourceRequestMethod: request.resourceRequestMethod,
|
|
72
|
-
resourceRequestUri: request.resourceRequestUri,
|
|
73
|
-
shrClaims: request.shrClaims,
|
|
74
|
-
sshKid: request.sshKid
|
|
75
|
-
};
|
|
76
|
-
return [2 /*return*/, this.executePostRequestToDeviceCodeEndpoint(endpoint, queryString, headers, thumbprint)];
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
};
|
|
80
|
-
/**
|
|
81
|
-
* Creates query string for the device code request
|
|
82
|
-
* @param request
|
|
83
|
-
*/
|
|
84
|
-
DeviceCodeClient.prototype.createExtraQueryParameters = function (request) {
|
|
85
|
-
var parameterBuilder = new RequestParameterBuilder();
|
|
86
|
-
if (request.extraQueryParameters) {
|
|
87
|
-
parameterBuilder.addExtraQueryParameters(request.extraQueryParameters);
|
|
88
|
-
}
|
|
89
|
-
return parameterBuilder.createQueryString();
|
|
90
|
-
};
|
|
91
|
-
/**
|
|
92
|
-
* Executes POST request to device code endpoint
|
|
93
|
-
* @param deviceCodeEndpoint
|
|
94
|
-
* @param queryString
|
|
95
|
-
* @param headers
|
|
96
|
-
*/
|
|
97
|
-
DeviceCodeClient.prototype.executePostRequestToDeviceCodeEndpoint = function (deviceCodeEndpoint, queryString, headers, thumbprint) {
|
|
98
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
99
|
-
var _a, userCode, deviceCode, verificationUri, expiresIn, interval, message;
|
|
100
|
-
return __generator(this, function (_b) {
|
|
101
|
-
switch (_b.label) {
|
|
102
|
-
case 0: return [4 /*yield*/, this.networkManager.sendPostRequest(thumbprint, deviceCodeEndpoint, {
|
|
103
|
-
body: queryString,
|
|
104
|
-
headers: headers
|
|
105
|
-
})];
|
|
106
|
-
case 1:
|
|
107
|
-
_a = (_b.sent()).body, userCode = _a.user_code, deviceCode = _a.device_code, verificationUri = _a.verification_uri, expiresIn = _a.expires_in, interval = _a.interval, message = _a.message;
|
|
108
|
-
return [2 /*return*/, {
|
|
109
|
-
userCode: userCode,
|
|
110
|
-
deviceCode: deviceCode,
|
|
111
|
-
verificationUri: verificationUri,
|
|
112
|
-
expiresIn: expiresIn,
|
|
113
|
-
interval: interval,
|
|
114
|
-
message: message
|
|
115
|
-
}];
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
});
|
|
119
|
-
};
|
|
120
|
-
/**
|
|
121
|
-
* Create device code endpoint query parameters and returns string
|
|
122
|
-
*/
|
|
123
|
-
DeviceCodeClient.prototype.createQueryString = function (request) {
|
|
124
|
-
var parameterBuilder = new RequestParameterBuilder();
|
|
125
|
-
parameterBuilder.addScopes(request.scopes);
|
|
126
|
-
parameterBuilder.addClientId(this.config.authOptions.clientId);
|
|
127
|
-
if (request.extraQueryParameters) {
|
|
128
|
-
parameterBuilder.addExtraQueryParameters(request.extraQueryParameters);
|
|
129
|
-
}
|
|
130
|
-
if (!StringUtils.isEmpty(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {
|
|
131
|
-
parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);
|
|
132
|
-
}
|
|
133
|
-
return parameterBuilder.createQueryString();
|
|
134
|
-
};
|
|
135
|
-
/**
|
|
136
|
-
* Breaks the polling with specific conditions.
|
|
137
|
-
* @param request CommonDeviceCodeRequest
|
|
138
|
-
* @param deviceCodeResponse DeviceCodeResponse
|
|
139
|
-
*/
|
|
140
|
-
DeviceCodeClient.prototype.continuePolling = function (deviceCodeExpirationTime, userSpecifiedTimeout, userSpecifiedCancelFlag) {
|
|
141
|
-
if (userSpecifiedCancelFlag) {
|
|
142
|
-
this.logger.error("Token request cancelled by setting DeviceCodeRequest.cancel = true");
|
|
143
|
-
throw ClientAuthError.createDeviceCodeCancelledError();
|
|
144
|
-
}
|
|
145
|
-
else if (userSpecifiedTimeout && userSpecifiedTimeout < deviceCodeExpirationTime && TimeUtils.nowSeconds() > userSpecifiedTimeout) {
|
|
146
|
-
this.logger.error("User defined timeout for device code polling reached. The timeout was set for " + userSpecifiedTimeout);
|
|
147
|
-
throw ClientAuthError.createUserTimeoutReachedError();
|
|
148
|
-
}
|
|
149
|
-
else if (TimeUtils.nowSeconds() > deviceCodeExpirationTime) {
|
|
150
|
-
if (userSpecifiedTimeout) {
|
|
151
|
-
this.logger.verbose("User specified timeout ignored as the device code has expired before the timeout elapsed. The user specified timeout was set for " + userSpecifiedTimeout);
|
|
152
|
-
}
|
|
153
|
-
this.logger.error("Device code expired. Expiration time of device code was " + deviceCodeExpirationTime);
|
|
154
|
-
throw ClientAuthError.createDeviceCodeExpiredError();
|
|
155
|
-
}
|
|
156
|
-
return true;
|
|
157
|
-
};
|
|
158
|
-
/**
|
|
159
|
-
* Creates token request with device code response and polls token endpoint at interval set by the device code
|
|
160
|
-
* response
|
|
161
|
-
* @param request
|
|
162
|
-
* @param deviceCodeResponse
|
|
163
|
-
*/
|
|
164
|
-
DeviceCodeClient.prototype.acquireTokenWithDeviceCode = function (request, deviceCodeResponse) {
|
|
165
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
166
|
-
var queryParametersString, endpoint, requestBody, headers, userSpecifiedTimeout, deviceCodeExpirationTime, pollingIntervalMilli, thumbprint, response;
|
|
167
|
-
return __generator(this, function (_a) {
|
|
168
|
-
switch (_a.label) {
|
|
169
|
-
case 0:
|
|
170
|
-
queryParametersString = this.createTokenQueryParameters(request);
|
|
171
|
-
endpoint = UrlString.appendQueryString(this.authority.tokenEndpoint, queryParametersString);
|
|
172
|
-
requestBody = this.createTokenRequestBody(request, deviceCodeResponse);
|
|
173
|
-
headers = this.createTokenRequestHeaders();
|
|
174
|
-
userSpecifiedTimeout = request.timeout ? TimeUtils.nowSeconds() + request.timeout : undefined;
|
|
175
|
-
deviceCodeExpirationTime = TimeUtils.nowSeconds() + deviceCodeResponse.expiresIn;
|
|
176
|
-
pollingIntervalMilli = deviceCodeResponse.interval * 1000;
|
|
177
|
-
_a.label = 1;
|
|
178
|
-
case 1:
|
|
179
|
-
if (!this.continuePolling(deviceCodeExpirationTime, userSpecifiedTimeout, request.cancel)) return [3 /*break*/, 8];
|
|
180
|
-
thumbprint = {
|
|
181
|
-
clientId: this.config.authOptions.clientId,
|
|
182
|
-
authority: request.authority,
|
|
183
|
-
scopes: request.scopes,
|
|
184
|
-
claims: request.claims,
|
|
185
|
-
authenticationScheme: request.authenticationScheme,
|
|
186
|
-
resourceRequestMethod: request.resourceRequestMethod,
|
|
187
|
-
resourceRequestUri: request.resourceRequestUri,
|
|
188
|
-
shrClaims: request.shrClaims,
|
|
189
|
-
sshKid: request.sshKid
|
|
190
|
-
};
|
|
191
|
-
return [4 /*yield*/, this.executePostToTokenEndpoint(endpoint, requestBody, headers, thumbprint)];
|
|
192
|
-
case 2:
|
|
193
|
-
response = _a.sent();
|
|
194
|
-
if (!(response.body && response.body.error)) return [3 /*break*/, 6];
|
|
195
|
-
if (!(response.body.error === Constants.AUTHORIZATION_PENDING)) return [3 /*break*/, 4];
|
|
196
|
-
this.logger.info("Authorization pending. Continue polling.");
|
|
197
|
-
return [4 /*yield*/, TimeUtils.delay(pollingIntervalMilli)];
|
|
198
|
-
case 3:
|
|
199
|
-
_a.sent();
|
|
200
|
-
return [3 /*break*/, 5];
|
|
201
|
-
case 4:
|
|
202
|
-
// for any other error, throw
|
|
203
|
-
this.logger.info("Unexpected error in polling from the server");
|
|
204
|
-
throw ServerError.createPostRequestFailed(response.body.error);
|
|
205
|
-
case 5: return [3 /*break*/, 7];
|
|
206
|
-
case 6:
|
|
207
|
-
this.logger.verbose("Authorization completed successfully. Polling stopped.");
|
|
208
|
-
return [2 /*return*/, response.body];
|
|
209
|
-
case 7: return [3 /*break*/, 1];
|
|
210
|
-
case 8:
|
|
211
|
-
/*
|
|
212
|
-
* The above code should've thrown by this point, but to satisfy TypeScript,
|
|
213
|
-
* and in the rare case the conditionals in continuePolling() may not catch everything...
|
|
214
|
-
*/
|
|
215
|
-
this.logger.error("Polling stopped for unknown reasons.");
|
|
216
|
-
throw ClientAuthError.createDeviceCodeUnknownError();
|
|
217
|
-
}
|
|
218
|
-
});
|
|
219
|
-
});
|
|
220
|
-
};
|
|
221
|
-
/**
|
|
222
|
-
* Creates query parameters and converts to string.
|
|
223
|
-
* @param request
|
|
224
|
-
* @param deviceCodeResponse
|
|
225
|
-
*/
|
|
226
|
-
DeviceCodeClient.prototype.createTokenRequestBody = function (request, deviceCodeResponse) {
|
|
227
|
-
var requestParameters = new RequestParameterBuilder();
|
|
228
|
-
requestParameters.addScopes(request.scopes);
|
|
229
|
-
requestParameters.addClientId(this.config.authOptions.clientId);
|
|
230
|
-
requestParameters.addGrantType(GrantType.DEVICE_CODE_GRANT);
|
|
231
|
-
requestParameters.addDeviceCode(deviceCodeResponse.deviceCode);
|
|
232
|
-
var correlationId = request.correlationId || this.config.cryptoInterface.createNewGuid();
|
|
233
|
-
requestParameters.addCorrelationId(correlationId);
|
|
234
|
-
requestParameters.addClientInfo();
|
|
235
|
-
requestParameters.addLibraryInfo(this.config.libraryInfo);
|
|
236
|
-
requestParameters.addApplicationTelemetry(this.config.telemetry.application);
|
|
237
|
-
requestParameters.addThrottling();
|
|
238
|
-
if (this.serverTelemetryManager) {
|
|
239
|
-
requestParameters.addServerTelemetry(this.serverTelemetryManager);
|
|
240
|
-
}
|
|
241
|
-
if (!StringUtils.isEmptyObj(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {
|
|
242
|
-
requestParameters.addClaims(request.claims, this.config.authOptions.clientCapabilities);
|
|
243
|
-
}
|
|
244
|
-
return requestParameters.createQueryString();
|
|
245
|
-
};
|
|
246
|
-
return DeviceCodeClient;
|
|
247
|
-
}(BaseClient));
|
|
248
|
-
|
|
249
|
-
export { DeviceCodeClient };
|
|
250
|
-
//# sourceMappingURL=DeviceCodeClient.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DeviceCodeClient.js","sources":["../../src/client/DeviceCodeClient.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { DeviceCodeResponse, ServerDeviceCodeResponse } from \"../response/DeviceCodeResponse\";\nimport { BaseClient } from \"./BaseClient\";\nimport { CommonDeviceCodeRequest } from \"../request/CommonDeviceCodeRequest\";\nimport { ClientAuthError } from \"../error/ClientAuthError\";\nimport { RequestParameterBuilder } from \"../request/RequestParameterBuilder\";\nimport { Constants, GrantType } from \"../utils/Constants\";\nimport { ClientConfiguration } from \"../config/ClientConfiguration\";\nimport { TimeUtils } from \"../utils/TimeUtils\";\nimport { ServerAuthorizationTokenResponse } from \"../response/ServerAuthorizationTokenResponse\";\nimport { ResponseHandler } from \"../response/ResponseHandler\";\nimport { AuthenticationResult } from \"../response/AuthenticationResult\";\nimport { StringUtils } from \"../utils/StringUtils\";\nimport { RequestThumbprint } from \"../network/RequestThumbprint\";\nimport { ServerError } from \"../error/ServerError\";\nimport { UrlString } from \"../url/UrlString\";\n\n/**\n * OAuth2.0 Device code client\n */\nexport class DeviceCodeClient extends BaseClient {\n\n constructor(configuration: ClientConfiguration) {\n super(configuration);\n }\n\n /**\n * Gets device code from device code endpoint, calls back to with device code response, and\n * polls token endpoint to exchange device code for tokens\n * @param request\n */\n public async acquireToken(request: CommonDeviceCodeRequest): Promise<AuthenticationResult | null> {\n const deviceCodeResponse: DeviceCodeResponse = await this.getDeviceCode(request);\n request.deviceCodeCallback(deviceCodeResponse);\n const reqTimestamp = TimeUtils.nowSeconds();\n const response: ServerAuthorizationTokenResponse = await this.acquireTokenWithDeviceCode(\n request,\n deviceCodeResponse);\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);\n return await responseHandler.handleServerTokenResponse(\n response,\n this.authority,\n reqTimestamp,\n request\n );\n }\n\n /**\n * Creates device code request and executes http GET\n * @param request\n */\n private async getDeviceCode(request: CommonDeviceCodeRequest): Promise<DeviceCodeResponse> {\n const queryParametersString = this.createExtraQueryParameters(request);\n const endpoint = UrlString.appendQueryString(this.authority.deviceCodeEndpoint, queryParametersString);\n const queryString = this.createQueryString(request);\n const headers = this.createTokenRequestHeaders();\n const thumbprint: RequestThumbprint = {\n clientId: this.config.authOptions.clientId,\n authority: request.authority,\n scopes: request.scopes,\n claims: request.claims,\n authenticationScheme: request.authenticationScheme,\n resourceRequestMethod: request.resourceRequestMethod,\n resourceRequestUri: request.resourceRequestUri,\n shrClaims: request.shrClaims,\n sshKid: request.sshKid\n };\n\n return this.executePostRequestToDeviceCodeEndpoint(endpoint, queryString, headers, thumbprint);\n }\n\n /**\n * Creates query string for the device code request\n * @param request\n */\n createExtraQueryParameters(request: CommonDeviceCodeRequest): string {\n const parameterBuilder = new RequestParameterBuilder();\n\n if (request.extraQueryParameters) {\n parameterBuilder.addExtraQueryParameters(request.extraQueryParameters);\n }\n\n return parameterBuilder.createQueryString();\n }\n\n /**\n * Executes POST request to device code endpoint\n * @param deviceCodeEndpoint\n * @param queryString\n * @param headers\n */\n private async executePostRequestToDeviceCodeEndpoint(\n deviceCodeEndpoint: string,\n queryString: string,\n headers: Record<string, string>,\n thumbprint: RequestThumbprint): Promise<DeviceCodeResponse> {\n\n const {\n body: {\n user_code: userCode,\n device_code: deviceCode,\n verification_uri: verificationUri,\n expires_in: expiresIn,\n interval,\n message\n }\n } = await this.networkManager.sendPostRequest<ServerDeviceCodeResponse>(\n thumbprint,\n deviceCodeEndpoint,\n {\n body: queryString,\n headers: headers\n });\n\n return {\n userCode,\n deviceCode,\n verificationUri,\n expiresIn,\n interval,\n message\n };\n }\n\n /**\n * Create device code endpoint query parameters and returns string\n */\n private createQueryString(request: CommonDeviceCodeRequest): string {\n\n const parameterBuilder: RequestParameterBuilder = new RequestParameterBuilder();\n\n parameterBuilder.addScopes(request.scopes);\n parameterBuilder.addClientId(this.config.authOptions.clientId);\n\n if (request.extraQueryParameters) {\n parameterBuilder.addExtraQueryParameters(request.extraQueryParameters);\n }\n\n if (!StringUtils.isEmpty(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {\n parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);\n }\n\n return parameterBuilder.createQueryString();\n }\n\n /**\n * Breaks the polling with specific conditions.\n * @param request CommonDeviceCodeRequest\n * @param deviceCodeResponse DeviceCodeResponse\n */\n private continuePolling(\n deviceCodeExpirationTime: number,\n userSpecifiedTimeout?: number,\n userSpecifiedCancelFlag?: boolean,\n ): boolean {\n if (userSpecifiedCancelFlag) {\n this.logger.error(\"Token request cancelled by setting DeviceCodeRequest.cancel = true\");\n throw ClientAuthError.createDeviceCodeCancelledError();\n } else if (userSpecifiedTimeout && userSpecifiedTimeout < deviceCodeExpirationTime && TimeUtils.nowSeconds() > userSpecifiedTimeout) {\n this.logger.error(`User defined timeout for device code polling reached. The timeout was set for ${userSpecifiedTimeout}`);\n throw ClientAuthError.createUserTimeoutReachedError();\n } else if (TimeUtils.nowSeconds() > deviceCodeExpirationTime) {\n if (userSpecifiedTimeout) {\n this.logger.verbose(`User specified timeout ignored as the device code has expired before the timeout elapsed. The user specified timeout was set for ${userSpecifiedTimeout}`);\n }\n this.logger.error(`Device code expired. Expiration time of device code was ${deviceCodeExpirationTime}`);\n throw ClientAuthError.createDeviceCodeExpiredError();\n }\n return true;\n }\n\n /**\n * Creates token request with device code response and polls token endpoint at interval set by the device code\n * response\n * @param request\n * @param deviceCodeResponse\n */\n private async acquireTokenWithDeviceCode(\n request: CommonDeviceCodeRequest,\n deviceCodeResponse: DeviceCodeResponse): Promise<ServerAuthorizationTokenResponse> {\n const queryParametersString = this.createTokenQueryParameters(request);\n const endpoint = UrlString.appendQueryString(this.authority.tokenEndpoint, queryParametersString);\n const requestBody = this.createTokenRequestBody(request, deviceCodeResponse);\n const headers: Record<string, string> = this.createTokenRequestHeaders();\n\n const userSpecifiedTimeout = request.timeout ? TimeUtils.nowSeconds() + request.timeout : undefined;\n const deviceCodeExpirationTime = TimeUtils.nowSeconds() + deviceCodeResponse.expiresIn;\n const pollingIntervalMilli = deviceCodeResponse.interval * 1000;\n\n /*\n * Poll token endpoint while (device code is not expired AND operation has not been cancelled by\n * setting CancellationToken.cancel = true). POST request is sent at interval set by pollingIntervalMilli\n */\n while (this.continuePolling(deviceCodeExpirationTime, userSpecifiedTimeout, request.cancel)) {\n const thumbprint: RequestThumbprint = {\n clientId: this.config.authOptions.clientId,\n authority: request.authority,\n scopes: request.scopes,\n claims: request.claims,\n authenticationScheme: request.authenticationScheme,\n resourceRequestMethod: request.resourceRequestMethod,\n resourceRequestUri: request.resourceRequestUri,\n shrClaims: request.shrClaims,\n sshKid: request.sshKid\n };\n const response = await this.executePostToTokenEndpoint(\n endpoint,\n requestBody,\n headers,\n thumbprint);\n\n if (response.body && response.body.error) {\n // user authorization is pending. Sleep for polling interval and try again\n if(response.body.error === Constants.AUTHORIZATION_PENDING) {\n this.logger.info(\"Authorization pending. Continue polling.\");\n await TimeUtils.delay(pollingIntervalMilli);\n } else {\n // for any other error, throw\n this.logger.info(\"Unexpected error in polling from the server\");\n throw ServerError.createPostRequestFailed(response.body.error);\n }\n } else {\n this.logger.verbose(\"Authorization completed successfully. Polling stopped.\");\n return response.body;\n }\n }\n\n /*\n * The above code should've thrown by this point, but to satisfy TypeScript,\n * and in the rare case the conditionals in continuePolling() may not catch everything...\n */\n this.logger.error(\"Polling stopped for unknown reasons.\");\n throw ClientAuthError.createDeviceCodeUnknownError();\n }\n\n /**\n * Creates query parameters and converts to string.\n * @param request\n * @param deviceCodeResponse\n */\n private createTokenRequestBody(request: CommonDeviceCodeRequest, deviceCodeResponse: DeviceCodeResponse): string {\n\n const requestParameters: RequestParameterBuilder = new RequestParameterBuilder();\n\n requestParameters.addScopes(request.scopes);\n requestParameters.addClientId(this.config.authOptions.clientId);\n requestParameters.addGrantType(GrantType.DEVICE_CODE_GRANT);\n requestParameters.addDeviceCode(deviceCodeResponse.deviceCode);\n const correlationId = request.correlationId || this.config.cryptoInterface.createNewGuid();\n requestParameters.addCorrelationId(correlationId);\n requestParameters.addClientInfo();\n requestParameters.addLibraryInfo(this.config.libraryInfo);\n requestParameters.addApplicationTelemetry(this.config.telemetry.application);\n requestParameters.addThrottling();\n if (this.serverTelemetryManager) {\n requestParameters.addServerTelemetry(this.serverTelemetryManager);\n }\n\n if (!StringUtils.isEmptyObj(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {\n requestParameters.addClaims(request.claims, this.config.authOptions.clientCapabilities);\n }\n return requestParameters.createQueryString();\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AAAA;;;AAGG;AAkBH;;AAEG;AACH,IAAA,gBAAA,kBAAA,UAAA,MAAA,EAAA;IAAsC,SAAU,CAAA,gBAAA,EAAA,MAAA,CAAA,CAAA;AAE5C,IAAA,SAAA,gBAAA,CAAY,aAAkC,EAAA;AAC1C,QAAA,OAAA,MAAA,CAAA,IAAA,CAAA,IAAA,EAAM,aAAa,CAAC,IAAA,IAAA,CAAA;KACvB;AAED;;;;AAIG;IACU,gBAAY,CAAA,SAAA,CAAA,YAAA,GAAzB,UAA0B,OAAgC,EAAA;;;;;AACP,oBAAA,KAAA,CAAA,EAAA,OAAA,CAAA,CAAA,YAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAA,CAAA;;AAA1E,wBAAA,kBAAkB,GAAuB,EAAiC,CAAA,IAAA,EAAA,CAAA;AAChF,wBAAA,OAAO,CAAC,kBAAkB,CAAC,kBAAkB,CAAC,CAAC;AACzC,wBAAA,YAAY,GAAG,SAAS,CAAC,UAAU,EAAE,CAAC;wBACO,OAAM,CAAA,CAAA,YAAA,IAAI,CAAC,0BAA0B,CACpF,OAAO,EACP,kBAAkB,CAAC,CAAA,CAAA;;AAFjB,wBAAA,QAAQ,GAAqC,EAE5B,CAAA,IAAA,EAAA,CAAA;AAEjB,wBAAA,eAAe,GAAG,IAAI,eAAe,CACvC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,QAAQ,EAChC,IAAI,CAAC,Y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,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;QAC7E,iBAAiB,CAAC,aAAa,EAAE,CAAC;QAClC,IAAI,IAAI,CAAC,sBAAsB,EAAE;AAC7B,YAAA,iBAAiB,CAAC,kBAAkB,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;AACrE,SAAA;AAED,QAAA,IAAI,CAAC,WAAW,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;AAChJ,YAAA,iBAAiB,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC;AAC3F,SAAA;AACD,QAAA,OAAO,iBAAiB,CAAC,iBAAiB,EAAE,CAAC;KAChD,CAAA;IACL,OAAC,gBAAA,CAAA;AAAD,CA9PA,CAAsC,UAAU,CA8P/C;;;;"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { ClientConfiguration } from "../config/ClientConfiguration";
|
|
2
|
-
import { BaseClient } from "./BaseClient";
|
|
3
|
-
import { AuthenticationResult } from "../response/AuthenticationResult";
|
|
4
|
-
import { CommonOnBehalfOfRequest } from "../request/CommonOnBehalfOfRequest";
|
|
5
|
-
/**
|
|
6
|
-
* On-Behalf-Of client
|
|
7
|
-
*/
|
|
8
|
-
export declare class OnBehalfOfClient extends BaseClient {
|
|
9
|
-
private scopeSet;
|
|
10
|
-
private userAssertionHash;
|
|
11
|
-
constructor(configuration: ClientConfiguration);
|
|
12
|
-
/**
|
|
13
|
-
* Public API to acquire tokens with on behalf of flow
|
|
14
|
-
* @param request
|
|
15
|
-
*/
|
|
16
|
-
acquireToken(request: CommonOnBehalfOfRequest): Promise<AuthenticationResult | null>;
|
|
17
|
-
/**
|
|
18
|
-
* look up cache for tokens
|
|
19
|
-
* Find idtoken in the cache
|
|
20
|
-
* Find accessToken based on user assertion and account info in the cache
|
|
21
|
-
* Please note we are not yet supported OBO tokens refreshed with long lived RT. User will have to send a new assertion if the current access token expires
|
|
22
|
-
* This is to prevent security issues when the assertion changes over time, however, longlived RT helps retaining the session
|
|
23
|
-
* @param request
|
|
24
|
-
*/
|
|
25
|
-
private getCachedAuthenticationResult;
|
|
26
|
-
/**
|
|
27
|
-
* read idtoken from cache, this is a specific implementation for OBO as the requirements differ from a generic lookup in the cacheManager
|
|
28
|
-
* Certain use cases of OBO flow do not expect an idToken in the cache/or from the service
|
|
29
|
-
* @param request
|
|
30
|
-
*/
|
|
31
|
-
private readIdTokenFromCacheForOBO;
|
|
32
|
-
/**
|
|
33
|
-
* Fetches the cached access token based on incoming assertion
|
|
34
|
-
* @param clientId
|
|
35
|
-
* @param request
|
|
36
|
-
* @param userAssertionHash
|
|
37
|
-
*/
|
|
38
|
-
private readAccessTokenFromCacheForOBO;
|
|
39
|
-
/**
|
|
40
|
-
* Make a network call to the server requesting credentials
|
|
41
|
-
* @param request
|
|
42
|
-
* @param authority
|
|
43
|
-
*/
|
|
44
|
-
private executeTokenRequest;
|
|
45
|
-
/**
|
|
46
|
-
* generate a server request in accepable format
|
|
47
|
-
* @param request
|
|
48
|
-
*/
|
|
49
|
-
private createTokenRequestBody;
|
|
50
|
-
}
|
|
51
|
-
//# sourceMappingURL=OnBehalfOfClient.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OnBehalfOfClient.d.ts","sourceRoot":"","sources":["../../src/client/OnBehalfOfClient.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAM1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAY7E;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,UAAU;IAE5C,OAAO,CAAC,QAAQ,CAAW;IAC3B,OAAO,CAAC,iBAAiB,CAAS;gBAEtB,aAAa,EAAE,mBAAmB;IAI9C;;;OAGG;IACU,YAAY,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAkBjG;;;;;;;OAOG;YACW,6BAA6B;IAsD3C;;;;OAIG;IACH,OAAO,CAAC,0BAA0B;IAmBlC;;;;;OAKG;IACH,OAAO,CAAC,8BAA8B;IA8BtC;;;;OAIG;YACW,mBAAmB;IA2CjC;;;OAGG;IACH,OAAO,CAAC,sBAAsB;CA0CjC"}
|
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
/*! @azure/msal-common v13.0.0 2023-05-01 */
|
|
2
|
-
'use strict';
|
|
3
|
-
import { __extends, __awaiter, __generator } from '../_virtual/_tslib.js';
|
|
4
|
-
import { BaseClient } from './BaseClient.js';
|
|
5
|
-
import { RequestParameterBuilder } from '../request/RequestParameterBuilder.js';
|
|
6
|
-
import { ScopeSet } from '../request/ScopeSet.js';
|
|
7
|
-
import { AuthenticationScheme, CredentialType, GrantType, AADServerParamKeys, CacheOutcome, Constants } from '../utils/Constants.js';
|
|
8
|
-
import { ResponseHandler } from '../response/ResponseHandler.js';
|
|
9
|
-
import { TimeUtils } from '../utils/TimeUtils.js';
|
|
10
|
-
import { AuthToken } from '../account/AuthToken.js';
|
|
11
|
-
import { ClientAuthError } from '../error/ClientAuthError.js';
|
|
12
|
-
import { UrlString } from '../url/UrlString.js';
|
|
13
|
-
|
|
14
|
-
/*
|
|
15
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
16
|
-
* Licensed under the MIT License.
|
|
17
|
-
*/
|
|
18
|
-
/**
|
|
19
|
-
* On-Behalf-Of client
|
|
20
|
-
*/
|
|
21
|
-
var OnBehalfOfClient = /** @class */ (function (_super) {
|
|
22
|
-
__extends(OnBehalfOfClient, _super);
|
|
23
|
-
function OnBehalfOfClient(configuration) {
|
|
24
|
-
return _super.call(this, configuration) || this;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Public API to acquire tokens with on behalf of flow
|
|
28
|
-
* @param request
|
|
29
|
-
*/
|
|
30
|
-
OnBehalfOfClient.prototype.acquireToken = function (request) {
|
|
31
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
32
|
-
var _a;
|
|
33
|
-
return __generator(this, function (_b) {
|
|
34
|
-
switch (_b.label) {
|
|
35
|
-
case 0:
|
|
36
|
-
this.scopeSet = new ScopeSet(request.scopes || []);
|
|
37
|
-
// generate the user_assertion_hash for OBOAssertion
|
|
38
|
-
_a = this;
|
|
39
|
-
return [4 /*yield*/, this.cryptoUtils.hashString(request.oboAssertion)];
|
|
40
|
-
case 1:
|
|
41
|
-
// generate the user_assertion_hash for OBOAssertion
|
|
42
|
-
_a.userAssertionHash = _b.sent();
|
|
43
|
-
if (!request.skipCache) return [3 /*break*/, 3];
|
|
44
|
-
return [4 /*yield*/, this.executeTokenRequest(request, this.authority, this.userAssertionHash)];
|
|
45
|
-
case 2: return [2 /*return*/, _b.sent()];
|
|
46
|
-
case 3:
|
|
47
|
-
_b.trys.push([3, 5, , 7]);
|
|
48
|
-
return [4 /*yield*/, this.getCachedAuthenticationResult(request)];
|
|
49
|
-
case 4: return [2 /*return*/, _b.sent()];
|
|
50
|
-
case 5:
|
|
51
|
-
_b.sent();
|
|
52
|
-
return [4 /*yield*/, this.executeTokenRequest(request, this.authority, this.userAssertionHash)];
|
|
53
|
-
case 6:
|
|
54
|
-
// Any failure falls back to interactive request, once we implement distributed cache, we plan to handle `createRefreshRequiredError` to refresh using the RT
|
|
55
|
-
return [2 /*return*/, _b.sent()];
|
|
56
|
-
case 7: return [2 /*return*/];
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
};
|
|
61
|
-
/**
|
|
62
|
-
* look up cache for tokens
|
|
63
|
-
* Find idtoken in the cache
|
|
64
|
-
* Find accessToken based on user assertion and account info in the cache
|
|
65
|
-
* Please note we are not yet supported OBO tokens refreshed with long lived RT. User will have to send a new assertion if the current access token expires
|
|
66
|
-
* This is to prevent security issues when the assertion changes over time, however, longlived RT helps retaining the session
|
|
67
|
-
* @param request
|
|
68
|
-
*/
|
|
69
|
-
OnBehalfOfClient.prototype.getCachedAuthenticationResult = function (request) {
|
|
70
|
-
var _a, _b;
|
|
71
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
72
|
-
var cachedAccessToken, cachedIdToken, idTokenObject, cachedAccount, localAccountId, accountInfo;
|
|
73
|
-
return __generator(this, function (_c) {
|
|
74
|
-
switch (_c.label) {
|
|
75
|
-
case 0:
|
|
76
|
-
cachedAccessToken = this.readAccessTokenFromCacheForOBO(this.config.authOptions.clientId, request);
|
|
77
|
-
if (!cachedAccessToken) {
|
|
78
|
-
// Must refresh due to non-existent access_token.
|
|
79
|
-
(_a = this.serverTelemetryManager) === null || _a === void 0 ? void 0 : _a.setCacheOutcome(CacheOutcome.NO_CACHED_ACCESS_TOKEN);
|
|
80
|
-
this.logger.info("SilentFlowClient:acquireCachedToken - No access token found in cache for the given properties.");
|
|
81
|
-
throw ClientAuthError.createRefreshRequiredError();
|
|
82
|
-
}
|
|
83
|
-
else if (TimeUtils.isTokenExpired(cachedAccessToken.expiresOn, this.config.systemOptions.tokenRenewalOffsetSeconds)) {
|
|
84
|
-
// Access token expired, will need to renewed
|
|
85
|
-
(_b = this.serverTelemetryManager) === null || _b === void 0 ? void 0 : _b.setCacheOutcome(CacheOutcome.CACHED_ACCESS_TOKEN_EXPIRED);
|
|
86
|
-
this.logger.info("OnbehalfofFlow:getCachedAuthenticationResult - Cached access token is expired or will expire within " + this.config.systemOptions.tokenRenewalOffsetSeconds + " seconds.");
|
|
87
|
-
throw ClientAuthError.createRefreshRequiredError();
|
|
88
|
-
}
|
|
89
|
-
cachedIdToken = this.readIdTokenFromCacheForOBO(cachedAccessToken.homeAccountId);
|
|
90
|
-
cachedAccount = null;
|
|
91
|
-
if (cachedIdToken) {
|
|
92
|
-
idTokenObject = new AuthToken(cachedIdToken.secret, this.config.cryptoInterface);
|
|
93
|
-
localAccountId = idTokenObject.claims.oid ? idTokenObject.claims.oid : idTokenObject.claims.sub;
|
|
94
|
-
accountInfo = {
|
|
95
|
-
homeAccountId: cachedIdToken.homeAccountId,
|
|
96
|
-
environment: cachedIdToken.environment,
|
|
97
|
-
tenantId: cachedIdToken.realm,
|
|
98
|
-
username: Constants.EMPTY_STRING,
|
|
99
|
-
localAccountId: localAccountId || Constants.EMPTY_STRING
|
|
100
|
-
};
|
|
101
|
-
cachedAccount = this.cacheManager.readAccountFromCache(accountInfo);
|
|
102
|
-
}
|
|
103
|
-
// increment telemetry cache hit counter
|
|
104
|
-
if (this.config.serverTelemetryManager) {
|
|
105
|
-
this.config.serverTelemetryManager.incrementCacheHits();
|
|
106
|
-
}
|
|
107
|
-
return [4 /*yield*/, ResponseHandler.generateAuthenticationResult(this.cryptoUtils, this.authority, {
|
|
108
|
-
account: cachedAccount,
|
|
109
|
-
accessToken: cachedAccessToken,
|
|
110
|
-
idToken: cachedIdToken,
|
|
111
|
-
refreshToken: null,
|
|
112
|
-
appMetadata: null
|
|
113
|
-
}, true, request, idTokenObject)];
|
|
114
|
-
case 1: return [2 /*return*/, _c.sent()];
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
};
|
|
119
|
-
/**
|
|
120
|
-
* read idtoken from cache, this is a specific implementation for OBO as the requirements differ from a generic lookup in the cacheManager
|
|
121
|
-
* Certain use cases of OBO flow do not expect an idToken in the cache/or from the service
|
|
122
|
-
* @param request
|
|
123
|
-
*/
|
|
124
|
-
OnBehalfOfClient.prototype.readIdTokenFromCacheForOBO = function (atHomeAccountId) {
|
|
125
|
-
var idTokenFilter = {
|
|
126
|
-
homeAccountId: atHomeAccountId,
|
|
127
|
-
environment: this.authority.canonicalAuthorityUrlComponents.HostNameAndPort,
|
|
128
|
-
credentialType: CredentialType.ID_TOKEN,
|
|
129
|
-
clientId: this.config.authOptions.clientId,
|
|
130
|
-
realm: this.authority.tenant
|
|
131
|
-
};
|
|
132
|
-
var idTokens = this.cacheManager.getIdTokensByFilter(idTokenFilter);
|
|
133
|
-
// When acquiring a token on behalf of an application, there might not be an id token in the cache
|
|
134
|
-
if (idTokens.length < 1) {
|
|
135
|
-
return null;
|
|
136
|
-
}
|
|
137
|
-
return idTokens[0];
|
|
138
|
-
};
|
|
139
|
-
/**
|
|
140
|
-
* Fetches the cached access token based on incoming assertion
|
|
141
|
-
* @param clientId
|
|
142
|
-
* @param request
|
|
143
|
-
* @param userAssertionHash
|
|
144
|
-
*/
|
|
145
|
-
OnBehalfOfClient.prototype.readAccessTokenFromCacheForOBO = function (clientId, request) {
|
|
146
|
-
var authScheme = request.authenticationScheme || AuthenticationScheme.BEARER;
|
|
147
|
-
/*
|
|
148
|
-
* Distinguish between Bearer and PoP/SSH token cache types
|
|
149
|
-
* Cast to lowercase to handle "bearer" from ADFS
|
|
150
|
-
*/
|
|
151
|
-
var credentialType = (authScheme && authScheme.toLowerCase() !== AuthenticationScheme.BEARER.toLowerCase()) ? CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME : CredentialType.ACCESS_TOKEN;
|
|
152
|
-
var accessTokenFilter = {
|
|
153
|
-
credentialType: credentialType,
|
|
154
|
-
clientId: clientId,
|
|
155
|
-
target: ScopeSet.createSearchScopes(this.scopeSet.asArray()),
|
|
156
|
-
tokenType: authScheme,
|
|
157
|
-
keyId: request.sshKid,
|
|
158
|
-
requestedClaimsHash: request.requestedClaimsHash,
|
|
159
|
-
userAssertionHash: this.userAssertionHash
|
|
160
|
-
};
|
|
161
|
-
var accessTokens = this.cacheManager.getAccessTokensByFilter(accessTokenFilter);
|
|
162
|
-
var numAccessTokens = accessTokens.length;
|
|
163
|
-
if (numAccessTokens < 1) {
|
|
164
|
-
return null;
|
|
165
|
-
}
|
|
166
|
-
else if (numAccessTokens > 1) {
|
|
167
|
-
throw ClientAuthError.createMultipleMatchingTokensInCacheError();
|
|
168
|
-
}
|
|
169
|
-
return accessTokens[0];
|
|
170
|
-
};
|
|
171
|
-
/**
|
|
172
|
-
* Make a network call to the server requesting credentials
|
|
173
|
-
* @param request
|
|
174
|
-
* @param authority
|
|
175
|
-
*/
|
|
176
|
-
OnBehalfOfClient.prototype.executeTokenRequest = function (request, authority, userAssertionHash) {
|
|
177
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
178
|
-
var queryParametersString, endpoint, requestBody, headers, thumbprint, reqTimestamp, response, responseHandler, tokenResponse;
|
|
179
|
-
return __generator(this, function (_a) {
|
|
180
|
-
switch (_a.label) {
|
|
181
|
-
case 0:
|
|
182
|
-
queryParametersString = this.createTokenQueryParameters(request);
|
|
183
|
-
endpoint = UrlString.appendQueryString(authority.tokenEndpoint, queryParametersString);
|
|
184
|
-
requestBody = this.createTokenRequestBody(request);
|
|
185
|
-
headers = this.createTokenRequestHeaders();
|
|
186
|
-
thumbprint = {
|
|
187
|
-
clientId: this.config.authOptions.clientId,
|
|
188
|
-
authority: request.authority,
|
|
189
|
-
scopes: request.scopes,
|
|
190
|
-
claims: request.claims,
|
|
191
|
-
authenticationScheme: request.authenticationScheme,
|
|
192
|
-
resourceRequestMethod: request.resourceRequestMethod,
|
|
193
|
-
resourceRequestUri: request.resourceRequestUri,
|
|
194
|
-
shrClaims: request.shrClaims,
|
|
195
|
-
sshKid: request.sshKid
|
|
196
|
-
};
|
|
197
|
-
reqTimestamp = TimeUtils.nowSeconds();
|
|
198
|
-
return [4 /*yield*/, this.executePostToTokenEndpoint(endpoint, requestBody, headers, thumbprint)];
|
|
199
|
-
case 1:
|
|
200
|
-
response = _a.sent();
|
|
201
|
-
responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.config.serializableCache, this.config.persistencePlugin);
|
|
202
|
-
responseHandler.validateTokenResponse(response.body);
|
|
203
|
-
return [4 /*yield*/, responseHandler.handleServerTokenResponse(response.body, this.authority, reqTimestamp, request, undefined, userAssertionHash)];
|
|
204
|
-
case 2:
|
|
205
|
-
tokenResponse = _a.sent();
|
|
206
|
-
return [2 /*return*/, tokenResponse];
|
|
207
|
-
}
|
|
208
|
-
});
|
|
209
|
-
});
|
|
210
|
-
};
|
|
211
|
-
/**
|
|
212
|
-
* generate a server request in accepable format
|
|
213
|
-
* @param request
|
|
214
|
-
*/
|
|
215
|
-
OnBehalfOfClient.prototype.createTokenRequestBody = function (request) {
|
|
216
|
-
var parameterBuilder = new RequestParameterBuilder();
|
|
217
|
-
parameterBuilder.addClientId(this.config.authOptions.clientId);
|
|
218
|
-
parameterBuilder.addScopes(request.scopes);
|
|
219
|
-
parameterBuilder.addGrantType(GrantType.JWT_BEARER);
|
|
220
|
-
parameterBuilder.addClientInfo();
|
|
221
|
-
parameterBuilder.addLibraryInfo(this.config.libraryInfo);
|
|
222
|
-
parameterBuilder.addApplicationTelemetry(this.config.telemetry.application);
|
|
223
|
-
parameterBuilder.addThrottling();
|
|
224
|
-
if (this.serverTelemetryManager) {
|
|
225
|
-
parameterBuilder.addServerTelemetry(this.serverTelemetryManager);
|
|
226
|
-
}
|
|
227
|
-
var correlationId = request.correlationId || this.config.cryptoInterface.createNewGuid();
|
|
228
|
-
parameterBuilder.addCorrelationId(correlationId);
|
|
229
|
-
parameterBuilder.addRequestTokenUse(AADServerParamKeys.ON_BEHALF_OF);
|
|
230
|
-
parameterBuilder.addOboAssertion(request.oboAssertion);
|
|
231
|
-
if (this.config.clientCredentials.clientSecret) {
|
|
232
|
-
parameterBuilder.addClientSecret(this.config.clientCredentials.clientSecret);
|
|
233
|
-
}
|
|
234
|
-
if (this.config.clientCredentials.clientAssertion) {
|
|
235
|
-
var clientAssertion = this.config.clientCredentials.clientAssertion;
|
|
236
|
-
parameterBuilder.addClientAssertion(clientAssertion.assertion);
|
|
237
|
-
parameterBuilder.addClientAssertionType(clientAssertion.assertionType);
|
|
238
|
-
}
|
|
239
|
-
if (request.claims || (this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0)) {
|
|
240
|
-
parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);
|
|
241
|
-
}
|
|
242
|
-
return parameterBuilder.createQueryString();
|
|
243
|
-
};
|
|
244
|
-
return OnBehalfOfClient;
|
|
245
|
-
}(BaseClient));
|
|
246
|
-
|
|
247
|
-
export { OnBehalfOfClient };
|
|
248
|
-
//# sourceMappingURL=OnBehalfOfClient.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OnBehalfOfClient.js","sources":["../../src/client/OnBehalfOfClient.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 { Authority } from \"../authority/Authority\";\nimport { RequestParameterBuilder } from \"../request/RequestParameterBuilder\";\nimport { ScopeSet } from \"../request/ScopeSet\";\nimport { GrantType, AADServerParamKeys , CredentialType, Constants, CacheOutcome, AuthenticationScheme } from \"../utils/Constants\";\nimport { ResponseHandler } from \"../response/ResponseHandler\";\nimport { AuthenticationResult } from \"../response/AuthenticationResult\";\nimport { CommonOnBehalfOfRequest } from \"../request/CommonOnBehalfOfRequest\";\nimport { TimeUtils } from \"../utils/TimeUtils\";\nimport { CredentialFilter } from \"../cache/utils/CacheTypes\";\nimport { AccessTokenEntity } from \"../cache/entities/AccessTokenEntity\";\nimport { IdTokenEntity } from \"../cache/entities/IdTokenEntity\";\nimport { AccountEntity } from \"../cache/entities/AccountEntity\";\nimport { AuthToken } from \"../account/AuthToken\";\nimport { ClientAuthError } from \"../error/ClientAuthError\";\nimport { RequestThumbprint } from \"../network/RequestThumbprint\";\nimport { AccountInfo } from \"../account/AccountInfo\";\nimport { UrlString } from \"../url/UrlString\";\n\n/**\n * On-Behalf-Of client\n */\nexport class OnBehalfOfClient extends BaseClient {\n\n private scopeSet: ScopeSet;\n private userAssertionHash: string;\n\n constructor(configuration: ClientConfiguration) {\n super(configuration);\n }\n\n /**\n * Public API to acquire tokens with on behalf of flow\n * @param request\n */\n public async acquireToken(request: CommonOnBehalfOfRequest): Promise<AuthenticationResult | null> {\n this.scopeSet = new ScopeSet(request.scopes || []);\n\n // generate the user_assertion_hash for OBOAssertion\n this.userAssertionHash = await this.cryptoUtils.hashString(request.oboAssertion);\n\n if (request.skipCache) {\n return await this.executeTokenRequest(request, this.authority, this.userAssertionHash);\n }\n\n try {\n return await this.getCachedAuthenticationResult(request);\n } catch (e) {\n // Any failure falls back to interactive request, once we implement distributed cache, we plan to handle `createRefreshRequiredError` to refresh using the RT\n return await this.executeTokenRequest(request, this.authority, this.userAssertionHash);\n }\n }\n\n /**\n * look up cache for tokens\n * Find idtoken in the cache\n * Find accessToken based on user assertion and account info in the cache\n * Please note we are not yet supported OBO tokens refreshed with long lived RT. User will have to send a new assertion if the current access token expires\n * This is to prevent security issues when the assertion changes over time, however, longlived RT helps retaining the session\n * @param request\n */\n private async getCachedAuthenticationResult(request: CommonOnBehalfOfRequest): Promise<AuthenticationResult | null> {\n\n // look in the cache for the access_token which matches the incoming_assertion\n const cachedAccessToken = this.readAccessTokenFromCacheForOBO(this.config.authOptions.clientId, request);\n if (!cachedAccessToken) {\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 (TimeUtils.isTokenExpired(cachedAccessToken.expiresOn, this.config.systemOptions.tokenRenewalOffsetSeconds)) {\n // Access token expired, will need to renewed\n this.serverTelemetryManager?.setCacheOutcome(CacheOutcome.CACHED_ACCESS_TOKEN_EXPIRED);\n this.logger.info(`OnbehalfofFlow:getCachedAuthenticationResult - Cached access token is expired or will expire within ${this.config.systemOptions.tokenRenewalOffsetSeconds} seconds.`);\n throw ClientAuthError.createRefreshRequiredError();\n }\n\n // fetch the idToken from cache\n const cachedIdToken = this.readIdTokenFromCacheForOBO(cachedAccessToken.homeAccountId);\n let idTokenObject: AuthToken | undefined;\n let cachedAccount: AccountEntity | null = null;\n if (cachedIdToken) {\n idTokenObject = new AuthToken(cachedIdToken.secret, this.config.cryptoInterface);\n const localAccountId = idTokenObject.claims.oid ? idTokenObject.claims.oid : idTokenObject.claims.sub;\n const accountInfo: AccountInfo = {\n homeAccountId: cachedIdToken.homeAccountId,\n environment: cachedIdToken.environment,\n tenantId: cachedIdToken.realm,\n username: Constants.EMPTY_STRING,\n localAccountId: localAccountId || Constants.EMPTY_STRING\n };\n\n cachedAccount = this.cacheManager.readAccountFromCache(accountInfo);\n }\n\n // increment telemetry cache hit counter\n if (this.config.serverTelemetryManager) {\n this.config.serverTelemetryManager.incrementCacheHits();\n }\n\n return await ResponseHandler.generateAuthenticationResult(\n this.cryptoUtils,\n this.authority,\n {\n account: cachedAccount,\n accessToken: cachedAccessToken,\n idToken: cachedIdToken,\n refreshToken: null,\n appMetadata: null\n },\n true,\n request,\n idTokenObject);\n }\n\n /**\n * read idtoken from cache, this is a specific implementation for OBO as the requirements differ from a generic lookup in the cacheManager\n * Certain use cases of OBO flow do not expect an idToken in the cache/or from the service\n * @param request\n */\n private readIdTokenFromCacheForOBO(atHomeAccountId: string): IdTokenEntity | null {\n\n const idTokenFilter: CredentialFilter = {\n homeAccountId: atHomeAccountId,\n environment: this.authority.canonicalAuthorityUrlComponents.HostNameAndPort,\n credentialType: CredentialType.ID_TOKEN,\n clientId: this.config.authOptions.clientId,\n realm: this.authority.tenant\n };\n\n const idTokens: IdTokenEntity[] = this.cacheManager.getIdTokensByFilter(idTokenFilter);\n\n // When acquiring a token on behalf of an application, there might not be an id token in the cache\n if (idTokens.length < 1) {\n return null;\n }\n return idTokens[0] as IdTokenEntity;\n }\n\n /**\n * Fetches the cached access token based on incoming assertion\n * @param clientId\n * @param request\n * @param userAssertionHash\n */\n private readAccessTokenFromCacheForOBO(clientId: string, request: CommonOnBehalfOfRequest) {\n const authScheme = request.authenticationScheme || AuthenticationScheme.BEARER;\n /*\n * Distinguish between Bearer and PoP/SSH token cache types\n * Cast to lowercase to handle \"bearer\" from ADFS\n */\n const credentialType = (authScheme && authScheme.toLowerCase() !== AuthenticationScheme.BEARER.toLowerCase()) ? CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME : CredentialType.ACCESS_TOKEN;\n\n const accessTokenFilter: CredentialFilter = {\n credentialType: credentialType,\n clientId,\n target: ScopeSet.createSearchScopes(this.scopeSet.asArray()),\n tokenType: authScheme,\n keyId: request.sshKid,\n requestedClaimsHash: request.requestedClaimsHash,\n userAssertionHash: this.userAssertionHash\n };\n\n const accessTokens = this.cacheManager.getAccessTokensByFilter(accessTokenFilter);\n\n const numAccessTokens = accessTokens.length;\n if (numAccessTokens < 1) {\n return null;\n } else if (numAccessTokens > 1) {\n throw ClientAuthError.createMultipleMatchingTokensInCacheError();\n }\n\n return accessTokens[0] as AccessTokenEntity;\n }\n\n /**\n * Make a network call to the server requesting credentials\n * @param request\n * @param authority\n */\n private async executeTokenRequest(request: CommonOnBehalfOfRequest, authority: Authority, userAssertionHash: string)\n : Promise<AuthenticationResult | null> {\n const queryParametersString = this.createTokenQueryParameters(request);\n const endpoint = UrlString.appendQueryString(authority.tokenEndpoint, queryParametersString);\n const requestBody = this.createTokenRequestBody(request);\n const headers: Record<string, string> = this.createTokenRequestHeaders();\n const thumbprint: RequestThumbprint = {\n clientId: this.config.authOptions.clientId,\n authority: request.authority,\n scopes: request.scopes,\n claims: request.claims,\n authenticationScheme: request.authenticationScheme,\n resourceRequestMethod: request.resourceRequestMethod,\n resourceRequestUri: request.resourceRequestUri,\n shrClaims: request.shrClaims,\n sshKid: request.sshKid\n };\n\n const reqTimestamp = TimeUtils.nowSeconds();\n const response = await this.executePostToTokenEndpoint(endpoint, requestBody, headers, thumbprint);\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 const tokenResponse = await responseHandler.handleServerTokenResponse(\n response.body,\n this.authority,\n reqTimestamp,\n request,\n undefined,\n userAssertionHash\n );\n\n return tokenResponse;\n }\n\n /**\n * generate a server request in accepable format\n * @param request\n */\n private createTokenRequestBody(request: CommonOnBehalfOfRequest): 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.JWT_BEARER);\n\n parameterBuilder.addClientInfo();\n\n parameterBuilder.addLibraryInfo(this.config.libraryInfo);\n parameterBuilder.addApplicationTelemetry(this.config.telemetry.application);\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.addRequestTokenUse(AADServerParamKeys.ON_BEHALF_OF);\n\n parameterBuilder.addOboAssertion(request.oboAssertion);\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.claims || (this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0)) {\n parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);\n }\n \n return parameterBuilder.createQueryString();\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AAAA;;;AAGG;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