@azure/msal-common 4.2.1 → 4.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +212 -1
- package/LICENSE +21 -21
- package/README.md +61 -58
- package/changelog.md +402 -344
- package/dist/_virtual/_tslib.js +90 -0
- package/dist/_virtual/_tslib.js.map +1 -0
- package/dist/account/AuthToken.js +43 -0
- package/dist/account/AuthToken.js.map +1 -0
- package/dist/account/CcsCredential.d.ts +9 -0
- package/dist/account/CcsCredential.d.ts.map +1 -0
- package/dist/account/CcsCredential.js +14 -0
- package/dist/account/CcsCredential.js.map +1 -0
- package/dist/account/ClientInfo.d.ts +6 -1
- package/dist/account/ClientInfo.d.ts.map +1 -1
- package/dist/account/ClientInfo.js +44 -0
- package/dist/account/ClientInfo.js.map +1 -0
- package/dist/account/TokenClaims.d.ts +1 -0
- package/dist/account/TokenClaims.d.ts.map +1 -1
- package/dist/authority/Authority.d.ts +25 -0
- package/dist/authority/Authority.d.ts.map +1 -1
- package/dist/authority/Authority.js +574 -0
- package/dist/authority/Authority.js.map +1 -0
- package/dist/authority/AuthorityFactory.js +69 -0
- package/dist/authority/AuthorityFactory.js.map +1 -0
- package/dist/authority/AuthorityOptions.d.ts +2 -0
- package/dist/authority/AuthorityOptions.d.ts.map +1 -1
- package/dist/authority/AuthorityType.js +17 -0
- package/dist/authority/AuthorityType.js.map +1 -0
- package/dist/authority/AzureRegion.d.ts +2 -0
- package/dist/authority/AzureRegion.d.ts.map +1 -0
- package/dist/authority/AzureRegionConfiguration.d.ts +6 -0
- package/dist/authority/AzureRegionConfiguration.d.ts.map +1 -0
- package/dist/authority/CloudInstanceDiscoveryResponse.js +13 -0
- package/dist/authority/CloudInstanceDiscoveryResponse.js.map +1 -0
- package/dist/authority/OpenIdConfigResponse.js +15 -0
- package/dist/authority/OpenIdConfigResponse.js.map +1 -0
- package/dist/authority/ProtocolMode.js +17 -0
- package/dist/authority/ProtocolMode.js.map +1 -0
- package/dist/authority/RegionDiscovery.d.ts +31 -0
- package/dist/authority/RegionDiscovery.d.ts.map +1 -0
- package/dist/authority/RegionDiscovery.js +119 -0
- package/dist/authority/RegionDiscovery.js.map +1 -0
- package/dist/authority/RegionDiscoveryMetadata.d.ts +7 -0
- package/dist/authority/RegionDiscoveryMetadata.d.ts.map +1 -0
- package/dist/cache/CacheManager.js +713 -0
- package/dist/cache/CacheManager.js.map +1 -0
- package/dist/cache/entities/AccessTokenEntity.js +111 -0
- package/dist/cache/entities/AccessTokenEntity.js.map +1 -0
- package/dist/cache/entities/AccountEntity.d.ts +5 -5
- package/dist/cache/entities/AccountEntity.d.ts.map +1 -1
- package/dist/cache/entities/AccountEntity.js +242 -0
- package/dist/cache/entities/AccountEntity.js.map +1 -0
- package/dist/cache/entities/AppMetadataEntity.js +74 -0
- package/dist/cache/entities/AppMetadataEntity.js.map +1 -0
- package/dist/cache/entities/AuthorityMetadataEntity.js +81 -0
- package/dist/cache/entities/AuthorityMetadataEntity.js.map +1 -0
- package/dist/cache/entities/CacheRecord.js +19 -0
- package/dist/cache/entities/CacheRecord.js.map +1 -0
- package/dist/cache/entities/CredentialEntity.js +142 -0
- package/dist/cache/entities/CredentialEntity.js.map +1 -0
- package/dist/cache/entities/IdTokenEntity.js +71 -0
- package/dist/cache/entities/IdTokenEntity.js.map +1 -0
- package/dist/cache/entities/RefreshTokenEntity.js +73 -0
- package/dist/cache/entities/RefreshTokenEntity.js.map +1 -0
- package/dist/cache/entities/ServerTelemetryEntity.js +35 -0
- package/dist/cache/entities/ServerTelemetryEntity.js.map +1 -0
- package/dist/cache/entities/ThrottlingEntity.js +32 -0
- package/dist/cache/entities/ThrottlingEntity.js.map +1 -0
- package/dist/cache/persistence/TokenCacheContext.js +39 -0
- package/dist/cache/persistence/TokenCacheContext.js.map +1 -0
- package/dist/client/AuthorizationCodeClient.d.ts.map +1 -1
- package/dist/client/AuthorizationCodeClient.js +388 -0
- package/dist/client/AuthorizationCodeClient.js.map +1 -0
- package/dist/client/BaseClient.d.ts +2 -1
- package/dist/client/BaseClient.d.ts.map +1 -1
- package/dist/client/BaseClient.js +101 -0
- package/dist/client/BaseClient.js.map +1 -0
- package/dist/client/ClientCredentialClient.d.ts.map +1 -1
- package/dist/client/ClientCredentialClient.js +169 -0
- package/dist/client/ClientCredentialClient.js.map +1 -0
- package/dist/client/DeviceCodeClient.d.ts +6 -0
- package/dist/client/DeviceCodeClient.d.ts.map +1 -1
- package/dist/client/DeviceCodeClient.js +212 -0
- package/dist/client/DeviceCodeClient.js.map +1 -0
- package/dist/client/OnBehalfOfClient.d.ts.map +1 -1
- package/dist/client/OnBehalfOfClient.js +209 -0
- package/dist/client/OnBehalfOfClient.js.map +1 -0
- package/dist/client/RefreshTokenClient.d.ts.map +1 -1
- package/dist/client/RefreshTokenClient.js +212 -0
- package/dist/client/RefreshTokenClient.js.map +1 -0
- package/dist/client/SilentFlowClient.d.ts.map +1 -1
- package/dist/client/SilentFlowClient.js +132 -0
- package/dist/client/SilentFlowClient.js.map +1 -0
- package/dist/client/UsernamePasswordClient.d.ts.map +1 -1
- package/dist/client/UsernamePasswordClient.js +112 -0
- package/dist/client/UsernamePasswordClient.js.map +1 -0
- package/dist/config/ClientConfiguration.d.ts +3 -0
- package/dist/config/ClientConfiguration.d.ts.map +1 -1
- package/dist/config/ClientConfiguration.js +91 -0
- package/dist/config/ClientConfiguration.js.map +1 -0
- package/dist/crypto/ICrypto.js +53 -0
- package/dist/crypto/ICrypto.js.map +1 -0
- package/dist/crypto/PopTokenGenerator.js +72 -0
- package/dist/crypto/PopTokenGenerator.js.map +1 -0
- package/dist/error/AuthError.js +46 -0
- package/dist/error/AuthError.js.map +1 -0
- package/dist/error/ClientAuthError.d.ts +13 -6
- package/dist/error/ClientAuthError.d.ts.map +1 -1
- package/dist/error/ClientAuthError.js +456 -0
- package/dist/error/ClientAuthError.js.map +1 -0
- package/dist/error/ClientConfigurationError.d.ts +1 -6
- package/dist/error/ClientConfigurationError.d.ts.map +1 -1
- package/dist/error/ClientConfigurationError.js +210 -0
- package/dist/error/ClientConfigurationError.js.map +1 -0
- package/dist/error/InteractionRequiredAuthError.js +48 -0
- package/dist/error/InteractionRequiredAuthError.js.map +1 -0
- package/dist/error/ServerError.js +25 -0
- package/dist/error/ServerError.js.map +1 -0
- package/dist/index.cjs.js +7045 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +43 -6479
- package/dist/index.js.map +1 -0
- package/dist/logger/Logger.d.ts +12 -3
- package/dist/logger/Logger.d.ts.map +1 -1
- package/dist/logger/Logger.js +183 -0
- package/dist/logger/Logger.js.map +1 -0
- package/dist/network/INetworkModule.d.ts +1 -1
- package/dist/network/INetworkModule.d.ts.map +1 -1
- package/dist/network/INetworkModule.js +21 -0
- package/dist/network/INetworkModule.js.map +1 -0
- package/dist/network/NetworkManager.js +56 -0
- package/dist/network/NetworkManager.js.map +1 -0
- package/dist/network/ThrottlingUtils.d.ts.map +1 -1
- package/dist/network/ThrottlingUtils.js +95 -0
- package/dist/network/ThrottlingUtils.js.map +1 -0
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.js +8 -0
- package/dist/packageMetadata.js.map +1 -0
- package/dist/request/CommonAuthorizationCodeRequest.d.ts +3 -0
- package/dist/request/CommonAuthorizationCodeRequest.d.ts.map +1 -1
- package/dist/request/CommonAuthorizationUrlRequest.d.ts +1 -0
- package/dist/request/CommonAuthorizationUrlRequest.d.ts.map +1 -1
- package/dist/request/CommonClientCredentialRequest.d.ts +7 -4
- package/dist/request/CommonClientCredentialRequest.d.ts.map +1 -1
- package/dist/request/CommonRefreshTokenRequest.d.ts +2 -0
- package/dist/request/CommonRefreshTokenRequest.d.ts.map +1 -1
- package/dist/request/RequestParameterBuilder.d.ts +11 -0
- package/dist/request/RequestParameterBuilder.d.ts.map +1 -1
- package/dist/request/RequestParameterBuilder.js +340 -0
- package/dist/request/RequestParameterBuilder.js.map +1 -0
- package/dist/request/RequestValidator.d.ts.map +1 -1
- package/dist/request/RequestValidator.js +92 -0
- package/dist/request/RequestValidator.js.map +1 -0
- package/dist/request/ScopeSet.js +192 -0
- package/dist/request/ScopeSet.js.map +1 -0
- package/dist/response/AuthenticationResult.d.ts +1 -1
- package/dist/response/AuthenticationResult.d.ts.map +1 -1
- package/dist/response/AuthorizationCodePayload.d.ts +1 -0
- package/dist/response/AuthorizationCodePayload.d.ts.map +1 -1
- package/dist/response/IMDSBadResponse.d.ts +5 -0
- package/dist/response/IMDSBadResponse.d.ts.map +1 -0
- package/dist/response/ResponseHandler.d.ts.map +1 -1
- package/dist/response/ResponseHandler.js +281 -0
- package/dist/response/ResponseHandler.js.map +1 -0
- package/dist/telemetry/server/ServerTelemetryManager.d.ts +23 -1
- package/dist/telemetry/server/ServerTelemetryManager.d.ts.map +1 -1
- package/dist/telemetry/server/ServerTelemetryManager.js +168 -0
- package/dist/telemetry/server/ServerTelemetryManager.js.map +1 -0
- package/dist/url/UrlString.d.ts +10 -0
- package/dist/url/UrlString.d.ts.map +1 -1
- package/dist/url/UrlString.js +223 -0
- package/dist/url/UrlString.js.map +1 -0
- package/dist/utils/Constants.d.ts +47 -4
- package/dist/utils/Constants.d.ts.map +1 -1
- package/dist/utils/Constants.js +362 -0
- package/dist/utils/Constants.js.map +1 -0
- package/dist/utils/ProtocolUtils.js +77 -0
- package/dist/utils/ProtocolUtils.js.map +1 -0
- package/dist/utils/StringUtils.d.ts +5 -0
- package/dist/utils/StringUtils.d.ts.map +1 -1
- package/dist/utils/StringUtils.js +128 -0
- package/dist/utils/StringUtils.js.map +1 -0
- package/dist/utils/TimeUtils.d.ts +13 -0
- package/dist/utils/TimeUtils.d.ts.map +1 -1
- package/dist/utils/TimeUtils.js +53 -0
- package/dist/utils/TimeUtils.js.map +1 -0
- package/package.json +10 -19
- package/dist/index.es.js +0 -6472
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/*! @azure/msal-common v4.5.1 2021-08-02 */
|
|
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 { CredentialType, GrantType, CacheOutcome } from '../utils/Constants.js';
|
|
8
|
+
import { ResponseHandler } from '../response/ResponseHandler.js';
|
|
9
|
+
import { TimeUtils } from '../utils/TimeUtils.js';
|
|
10
|
+
import { StringUtils } from '../utils/StringUtils.js';
|
|
11
|
+
import { ClientAuthError } from '../error/ClientAuthError.js';
|
|
12
|
+
|
|
13
|
+
/*
|
|
14
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
15
|
+
* Licensed under the MIT License.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* OAuth2.0 client credential grant
|
|
19
|
+
*/
|
|
20
|
+
var ClientCredentialClient = /** @class */ (function (_super) {
|
|
21
|
+
__extends(ClientCredentialClient, _super);
|
|
22
|
+
function ClientCredentialClient(configuration) {
|
|
23
|
+
return _super.call(this, configuration) || this;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Public API to acquire a token with ClientCredential Flow for Confidential clients
|
|
27
|
+
* @param request
|
|
28
|
+
*/
|
|
29
|
+
ClientCredentialClient.prototype.acquireToken = function (request) {
|
|
30
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
31
|
+
var cachedAuthenticationResult;
|
|
32
|
+
return __generator(this, function (_a) {
|
|
33
|
+
switch (_a.label) {
|
|
34
|
+
case 0:
|
|
35
|
+
this.scopeSet = new ScopeSet(request.scopes || []);
|
|
36
|
+
if (!request.skipCache) return [3 /*break*/, 2];
|
|
37
|
+
return [4 /*yield*/, this.executeTokenRequest(request, this.authority)];
|
|
38
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
39
|
+
case 2: return [4 /*yield*/, this.getCachedAuthenticationResult(request)];
|
|
40
|
+
case 3:
|
|
41
|
+
cachedAuthenticationResult = _a.sent();
|
|
42
|
+
if (!cachedAuthenticationResult) return [3 /*break*/, 4];
|
|
43
|
+
return [2 /*return*/, cachedAuthenticationResult];
|
|
44
|
+
case 4: return [4 /*yield*/, this.executeTokenRequest(request, this.authority)];
|
|
45
|
+
case 5: return [2 /*return*/, _a.sent()];
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* looks up cache if the tokens are cached already
|
|
52
|
+
*/
|
|
53
|
+
ClientCredentialClient.prototype.getCachedAuthenticationResult = function (request) {
|
|
54
|
+
var _a, _b;
|
|
55
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
56
|
+
var cachedAccessToken;
|
|
57
|
+
return __generator(this, function (_c) {
|
|
58
|
+
switch (_c.label) {
|
|
59
|
+
case 0:
|
|
60
|
+
cachedAccessToken = this.readAccessTokenFromCache();
|
|
61
|
+
if (!cachedAccessToken) {
|
|
62
|
+
(_a = this.serverTelemetryManager) === null || _a === void 0 ? void 0 : _a.setCacheOutcome(CacheOutcome.NO_CACHED_ACCESS_TOKEN);
|
|
63
|
+
return [2 /*return*/, null];
|
|
64
|
+
}
|
|
65
|
+
if (TimeUtils.isTokenExpired(cachedAccessToken.expiresOn, this.config.systemOptions.tokenRenewalOffsetSeconds)) {
|
|
66
|
+
(_b = this.serverTelemetryManager) === null || _b === void 0 ? void 0 : _b.setCacheOutcome(CacheOutcome.CACHED_ACCESS_TOKEN_EXPIRED);
|
|
67
|
+
return [2 /*return*/, null];
|
|
68
|
+
}
|
|
69
|
+
return [4 /*yield*/, ResponseHandler.generateAuthenticationResult(this.cryptoUtils, this.authority, {
|
|
70
|
+
account: null,
|
|
71
|
+
idToken: null,
|
|
72
|
+
accessToken: cachedAccessToken,
|
|
73
|
+
refreshToken: null,
|
|
74
|
+
appMetadata: null
|
|
75
|
+
}, true, request)];
|
|
76
|
+
case 1: return [2 /*return*/, _c.sent()];
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Reads access token from the cache
|
|
83
|
+
* TODO: Move this call to cacheManager instead
|
|
84
|
+
*/
|
|
85
|
+
ClientCredentialClient.prototype.readAccessTokenFromCache = function () {
|
|
86
|
+
var accessTokenFilter = {
|
|
87
|
+
homeAccountId: "",
|
|
88
|
+
environment: this.authority.canonicalAuthorityUrlComponents.HostNameAndPort,
|
|
89
|
+
credentialType: CredentialType.ACCESS_TOKEN,
|
|
90
|
+
clientId: this.config.authOptions.clientId,
|
|
91
|
+
realm: this.authority.tenant,
|
|
92
|
+
target: this.scopeSet.printScopesLowerCase()
|
|
93
|
+
};
|
|
94
|
+
var credentialCache = this.cacheManager.getCredentialsFilteredBy(accessTokenFilter);
|
|
95
|
+
var accessTokens = Object.keys(credentialCache.accessTokens).map(function (key) { return credentialCache.accessTokens[key]; });
|
|
96
|
+
if (accessTokens.length < 1) {
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
else if (accessTokens.length > 1) {
|
|
100
|
+
throw ClientAuthError.createMultipleMatchingTokensInCacheError();
|
|
101
|
+
}
|
|
102
|
+
return accessTokens[0];
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* Makes a network call to request the token from the service
|
|
106
|
+
* @param request
|
|
107
|
+
* @param authority
|
|
108
|
+
*/
|
|
109
|
+
ClientCredentialClient.prototype.executeTokenRequest = function (request, authority) {
|
|
110
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
111
|
+
var requestBody, headers, thumbprint, reqTimestamp, response, responseHandler, tokenResponse;
|
|
112
|
+
return __generator(this, function (_a) {
|
|
113
|
+
switch (_a.label) {
|
|
114
|
+
case 0:
|
|
115
|
+
requestBody = this.createTokenRequestBody(request);
|
|
116
|
+
headers = this.createTokenRequestHeaders();
|
|
117
|
+
thumbprint = {
|
|
118
|
+
clientId: this.config.authOptions.clientId,
|
|
119
|
+
authority: request.authority,
|
|
120
|
+
scopes: request.scopes
|
|
121
|
+
};
|
|
122
|
+
reqTimestamp = TimeUtils.nowSeconds();
|
|
123
|
+
return [4 /*yield*/, this.executePostToTokenEndpoint(authority.tokenEndpoint, requestBody, headers, thumbprint)];
|
|
124
|
+
case 1:
|
|
125
|
+
response = _a.sent();
|
|
126
|
+
responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.config.serializableCache, this.config.persistencePlugin);
|
|
127
|
+
responseHandler.validateTokenResponse(response.body);
|
|
128
|
+
return [4 /*yield*/, responseHandler.handleServerTokenResponse(response.body, this.authority, reqTimestamp, request)];
|
|
129
|
+
case 2:
|
|
130
|
+
tokenResponse = _a.sent();
|
|
131
|
+
return [2 /*return*/, tokenResponse];
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* generate the request to the server in the acceptable format
|
|
138
|
+
* @param request
|
|
139
|
+
*/
|
|
140
|
+
ClientCredentialClient.prototype.createTokenRequestBody = function (request) {
|
|
141
|
+
var parameterBuilder = new RequestParameterBuilder();
|
|
142
|
+
parameterBuilder.addClientId(this.config.authOptions.clientId);
|
|
143
|
+
parameterBuilder.addScopes(request.scopes, false);
|
|
144
|
+
parameterBuilder.addGrantType(GrantType.CLIENT_CREDENTIALS_GRANT);
|
|
145
|
+
parameterBuilder.addLibraryInfo(this.config.libraryInfo);
|
|
146
|
+
parameterBuilder.addThrottling();
|
|
147
|
+
if (this.serverTelemetryManager) {
|
|
148
|
+
parameterBuilder.addServerTelemetry(this.serverTelemetryManager);
|
|
149
|
+
}
|
|
150
|
+
var correlationId = request.correlationId || this.config.cryptoInterface.createNewGuid();
|
|
151
|
+
parameterBuilder.addCorrelationId(correlationId);
|
|
152
|
+
if (this.config.clientCredentials.clientSecret) {
|
|
153
|
+
parameterBuilder.addClientSecret(this.config.clientCredentials.clientSecret);
|
|
154
|
+
}
|
|
155
|
+
if (this.config.clientCredentials.clientAssertion) {
|
|
156
|
+
var clientAssertion = this.config.clientCredentials.clientAssertion;
|
|
157
|
+
parameterBuilder.addClientAssertion(clientAssertion.assertion);
|
|
158
|
+
parameterBuilder.addClientAssertionType(clientAssertion.assertionType);
|
|
159
|
+
}
|
|
160
|
+
if (!StringUtils.isEmptyObj(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {
|
|
161
|
+
parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);
|
|
162
|
+
}
|
|
163
|
+
return parameterBuilder.createQueryString();
|
|
164
|
+
};
|
|
165
|
+
return ClientCredentialClient;
|
|
166
|
+
}(BaseClient));
|
|
167
|
+
|
|
168
|
+
export { ClientCredentialClient };
|
|
169
|
+
//# sourceMappingURL=ClientCredentialClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClientCredentialClient.js","sources":["../../src/client/ClientCredentialClient.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 , CredentialType, CacheOutcome } from \"../utils/Constants\";\nimport { ResponseHandler } from \"../response/ResponseHandler\";\nimport { AuthenticationResult } from \"../response/AuthenticationResult\";\nimport { CommonClientCredentialRequest } from \"../request/CommonClientCredentialRequest\";\nimport { CredentialFilter, CredentialCache } from \"../cache/utils/CacheTypes\";\nimport { AccessTokenEntity } from \"../cache/entities/AccessTokenEntity\";\nimport { TimeUtils } from \"../utils/TimeUtils\";\nimport { StringUtils } from \"../utils/StringUtils\";\nimport { RequestThumbprint } from \"../network/RequestThumbprint\";\nimport { ClientAuthError } from \"../error/ClientAuthError\";\n\n/**\n * OAuth2.0 client credential grant\n */\nexport class ClientCredentialClient extends BaseClient {\n\n private scopeSet: ScopeSet;\n\n constructor(configuration: ClientConfiguration) {\n super(configuration);\n }\n\n /**\n * Public API to acquire a token with ClientCredential Flow for Confidential clients\n * @param request\n */\n public async acquireToken(request: CommonClientCredentialRequest): Promise<AuthenticationResult | null> {\n\n this.scopeSet = new ScopeSet(request.scopes || []);\n\n if (request.skipCache) {\n return await this.executeTokenRequest(request, this.authority);\n }\n\n const cachedAuthenticationResult = await this.getCachedAuthenticationResult(request);\n if (cachedAuthenticationResult) {\n return cachedAuthenticationResult;\n } else {\n return await this.executeTokenRequest(request, this.authority);\n }\n }\n\n /**\n * looks up cache if the tokens are cached already\n */\n private async getCachedAuthenticationResult(request: CommonClientCredentialRequest): Promise<AuthenticationResult | null> {\n \n const cachedAccessToken = this.readAccessTokenFromCache();\n\n if (!cachedAccessToken) {\n this.serverTelemetryManager?.setCacheOutcome(CacheOutcome.NO_CACHED_ACCESS_TOKEN);\n return null;\n }\n\n if (TimeUtils.isTokenExpired(cachedAccessToken.expiresOn, this.config.systemOptions.tokenRenewalOffsetSeconds)) {\n this.serverTelemetryManager?.setCacheOutcome(CacheOutcome.CACHED_ACCESS_TOKEN_EXPIRED);\n return null;\n }\n\n return await ResponseHandler.generateAuthenticationResult(\n this.cryptoUtils,\n this.authority,\n {\n account: null,\n idToken: null,\n accessToken: cachedAccessToken,\n refreshToken: null,\n appMetadata: null\n },\n true,\n request\n );\n }\n\n /**\n * Reads access token from the cache\n * TODO: Move this call to cacheManager instead\n */\n private readAccessTokenFromCache(): AccessTokenEntity | null {\n const accessTokenFilter: CredentialFilter = {\n homeAccountId: \"\",\n environment: this.authority.canonicalAuthorityUrlComponents.HostNameAndPort,\n credentialType: CredentialType.ACCESS_TOKEN,\n clientId: this.config.authOptions.clientId,\n realm: this.authority.tenant,\n target: this.scopeSet.printScopesLowerCase()\n };\n const credentialCache: CredentialCache = this.cacheManager.getCredentialsFilteredBy(accessTokenFilter);\n const accessTokens = Object.keys(credentialCache.accessTokens).map(key => credentialCache.accessTokens[key]);\n if (accessTokens.length < 1) {\n return null;\n } else if (accessTokens.length > 1) {\n throw ClientAuthError.createMultipleMatchingTokensInCacheError();\n }\n return accessTokens[0] as AccessTokenEntity;\n }\n\n /**\n * Makes a network call to request the token from the service\n * @param request\n * @param authority\n */\n private async executeTokenRequest(request: CommonClientCredentialRequest, authority: Authority)\n : Promise<AuthenticationResult | null> {\n\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 };\n\n const reqTimestamp = TimeUtils.nowSeconds();\n const response = await this.executePostToTokenEndpoint(authority.tokenEndpoint, 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 );\n\n return tokenResponse;\n }\n\n /**\n * generate the request to the server in the acceptable format\n * @param request\n */\n private createTokenRequestBody(request: CommonClientCredentialRequest): string {\n const parameterBuilder = new RequestParameterBuilder();\n\n parameterBuilder.addClientId(this.config.authOptions.clientId);\n\n parameterBuilder.addScopes(request.scopes, false);\n\n parameterBuilder.addGrantType(GrantType.CLIENT_CREDENTIALS_GRANT);\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 return parameterBuilder.createQueryString();\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;AAqBA;;;;IAG4C,0CAAU;IAIlD,gCAAY,aAAkC;eAC1C,kBAAM,aAAa,CAAC;KACvB;;;;;IAMY,6CAAY,GAAzB,UAA0B,OAAsC;;;;;;wBAE5D,IAAI,CAAC,QAAQ,GAAG,IAAI,QAAQ,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;6BAE/C,OAAO,CAAC,SAAS,EAAjB,wBAAiB;wBACV,qBAAM,IAAI,CAAC,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,EAAA;4BAA9D,sBAAO,SAAuD,EAAC;4BAGhC,qBAAM,IAAI,CAAC,6BAA6B,CAAC,OAAO,CAAC,EAAA;;wBAA9E,0BAA0B,GAAG,SAAiD;6BAChF,0BAA0B,EAA1B,wBAA0B;wBAC1B,sBAAO,0BAA0B,EAAC;4BAE3B,qBAAM,IAAI,CAAC,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,EAAA;4BAA9D,sBAAO,SAAuD,EAAC;;;;KAEtE;;;;IAKa,8DAA6B,GAA3C,UAA4C,OAAsC;;;;;;;wBAExE,iBAAiB,GAAG,IAAI,CAAC,wBAAwB,EAAE,CAAC;wBAE1D,IAAI,CAAC,iBAAiB,EAAE;4BACpB,MAAA,IAAI,CAAC,sBAAsB,0CAAE,eAAe,CAAC,YAAY,C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AkB,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,OAAO,gBAAgB,CAAC,iBAAiB,EAAE,CAAC;KAC/C;IACL,6BAAC;AAAD,CAlKA,CAA4C,UAAU;;;;"}
|
|
@@ -29,6 +29,12 @@ export declare class DeviceCodeClient extends BaseClient {
|
|
|
29
29
|
* Create device code endpoint query parameters and returns string
|
|
30
30
|
*/
|
|
31
31
|
private createQueryString;
|
|
32
|
+
/**
|
|
33
|
+
* Breaks the polling with specific conditions.
|
|
34
|
+
* @param request CommonDeviceCodeRequest
|
|
35
|
+
* @param deviceCodeResponse DeviceCodeResponse
|
|
36
|
+
*/
|
|
37
|
+
private continuePolling;
|
|
32
38
|
/**
|
|
33
39
|
* Creates token request with device code response and polls token endpoint at interval set by the device code
|
|
34
40
|
* response
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeviceCodeClient.d.ts","sourceRoot":"","sources":["../../src/client/DeviceCodeClient.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAI7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAIpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAIxE;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,UAAU;gBAEhC,aAAa,EAAE,mBAAmB;IAI9C;;;;OAIG;IACU,YAAY,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IA2BjG;;;OAGG;YACW,aAAa;IAY3B;;;;;OAKG;YACW,sCAAsC;IAiCpD;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAczB;;;;;OAKG;YACW,0BAA0B;
|
|
1
|
+
{"version":3,"file":"DeviceCodeClient.d.ts","sourceRoot":"","sources":["../../src/client/DeviceCodeClient.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAI7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAIpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAIxE;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,UAAU;gBAEhC,aAAa,EAAE,mBAAmB;IAI9C;;;;OAIG;IACU,YAAY,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IA2BjG;;;OAGG;YACW,aAAa;IAY3B;;;;;OAKG;YACW,sCAAsC;IAiCpD;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAczB;;;;OAIG;IACH,OAAO,CAAC,eAAe;IAqBvB;;;;;OAKG;YACW,0BAA0B;IA8CxC;;;;OAIG;IACH,OAAO,CAAC,sBAAsB;CAuBjC"}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
/*! @azure/msal-common v4.5.1 2021-08-02 */
|
|
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
|
+
|
|
12
|
+
/*
|
|
13
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
14
|
+
* Licensed under the MIT License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* OAuth2.0 Device code client
|
|
18
|
+
*/
|
|
19
|
+
var DeviceCodeClient = /** @class */ (function (_super) {
|
|
20
|
+
__extends(DeviceCodeClient, _super);
|
|
21
|
+
function DeviceCodeClient(configuration) {
|
|
22
|
+
return _super.call(this, configuration) || this;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Gets device code from device code endpoint, calls back to with device code response, and
|
|
26
|
+
* polls token endpoint to exchange device code for tokens
|
|
27
|
+
* @param request
|
|
28
|
+
*/
|
|
29
|
+
DeviceCodeClient.prototype.acquireToken = function (request) {
|
|
30
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
31
|
+
var deviceCodeResponse, reqTimestamp, response, responseHandler;
|
|
32
|
+
return __generator(this, function (_a) {
|
|
33
|
+
switch (_a.label) {
|
|
34
|
+
case 0: return [4 /*yield*/, this.getDeviceCode(request)];
|
|
35
|
+
case 1:
|
|
36
|
+
deviceCodeResponse = _a.sent();
|
|
37
|
+
request.deviceCodeCallback(deviceCodeResponse);
|
|
38
|
+
reqTimestamp = TimeUtils.nowSeconds();
|
|
39
|
+
return [4 /*yield*/, this.acquireTokenWithDeviceCode(request, deviceCodeResponse)];
|
|
40
|
+
case 2:
|
|
41
|
+
response = _a.sent();
|
|
42
|
+
responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.config.serializableCache, this.config.persistencePlugin);
|
|
43
|
+
// Validate response. This function throws a server error if an error is returned by the server.
|
|
44
|
+
responseHandler.validateTokenResponse(response);
|
|
45
|
+
return [4 /*yield*/, responseHandler.handleServerTokenResponse(response, this.authority, reqTimestamp, request)];
|
|
46
|
+
case 3: return [2 /*return*/, _a.sent()];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Creates device code request and executes http GET
|
|
53
|
+
* @param request
|
|
54
|
+
*/
|
|
55
|
+
DeviceCodeClient.prototype.getDeviceCode = function (request) {
|
|
56
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
57
|
+
var queryString, headers, thumbprint;
|
|
58
|
+
return __generator(this, function (_a) {
|
|
59
|
+
queryString = this.createQueryString(request);
|
|
60
|
+
headers = this.createTokenRequestHeaders();
|
|
61
|
+
thumbprint = {
|
|
62
|
+
clientId: this.config.authOptions.clientId,
|
|
63
|
+
authority: request.authority,
|
|
64
|
+
scopes: request.scopes
|
|
65
|
+
};
|
|
66
|
+
return [2 /*return*/, this.executePostRequestToDeviceCodeEndpoint(this.authority.deviceCodeEndpoint, queryString, headers, thumbprint)];
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Executes POST request to device code endpoint
|
|
72
|
+
* @param deviceCodeEndpoint
|
|
73
|
+
* @param queryString
|
|
74
|
+
* @param headers
|
|
75
|
+
*/
|
|
76
|
+
DeviceCodeClient.prototype.executePostRequestToDeviceCodeEndpoint = function (deviceCodeEndpoint, queryString, headers, thumbprint) {
|
|
77
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
78
|
+
var _a, userCode, deviceCode, verificationUri, expiresIn, interval, message;
|
|
79
|
+
return __generator(this, function (_b) {
|
|
80
|
+
switch (_b.label) {
|
|
81
|
+
case 0: return [4 /*yield*/, this.networkManager.sendPostRequest(thumbprint, deviceCodeEndpoint, {
|
|
82
|
+
body: queryString,
|
|
83
|
+
headers: headers
|
|
84
|
+
})];
|
|
85
|
+
case 1:
|
|
86
|
+
_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;
|
|
87
|
+
return [2 /*return*/, {
|
|
88
|
+
userCode: userCode,
|
|
89
|
+
deviceCode: deviceCode,
|
|
90
|
+
verificationUri: verificationUri,
|
|
91
|
+
expiresIn: expiresIn,
|
|
92
|
+
interval: interval,
|
|
93
|
+
message: message
|
|
94
|
+
}];
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Create device code endpoint query parameters and returns string
|
|
101
|
+
*/
|
|
102
|
+
DeviceCodeClient.prototype.createQueryString = function (request) {
|
|
103
|
+
var parameterBuilder = new RequestParameterBuilder();
|
|
104
|
+
parameterBuilder.addScopes(request.scopes);
|
|
105
|
+
parameterBuilder.addClientId(this.config.authOptions.clientId);
|
|
106
|
+
if (!StringUtils.isEmpty(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {
|
|
107
|
+
parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);
|
|
108
|
+
}
|
|
109
|
+
return parameterBuilder.createQueryString();
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Breaks the polling with specific conditions.
|
|
113
|
+
* @param request CommonDeviceCodeRequest
|
|
114
|
+
* @param deviceCodeResponse DeviceCodeResponse
|
|
115
|
+
*/
|
|
116
|
+
DeviceCodeClient.prototype.continuePolling = function (deviceCodeExpirationTime, userSpecifiedTimeout, userSpecifiedCancelFlag) {
|
|
117
|
+
if (userSpecifiedCancelFlag) {
|
|
118
|
+
this.logger.error("Token request cancelled by setting DeviceCodeRequest.cancel = true");
|
|
119
|
+
throw ClientAuthError.createDeviceCodeCancelledError();
|
|
120
|
+
}
|
|
121
|
+
else if (userSpecifiedTimeout && userSpecifiedTimeout < deviceCodeExpirationTime && TimeUtils.nowSeconds() > userSpecifiedTimeout) {
|
|
122
|
+
this.logger.error("User defined timeout for device code polling reached. The timeout was set for " + userSpecifiedTimeout);
|
|
123
|
+
throw ClientAuthError.createUserTimeoutReachedError();
|
|
124
|
+
}
|
|
125
|
+
else if (TimeUtils.nowSeconds() > deviceCodeExpirationTime) {
|
|
126
|
+
if (userSpecifiedTimeout) {
|
|
127
|
+
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);
|
|
128
|
+
}
|
|
129
|
+
this.logger.error("Device code expired. Expiration time of device code was " + deviceCodeExpirationTime);
|
|
130
|
+
throw ClientAuthError.createDeviceCodeExpiredError();
|
|
131
|
+
}
|
|
132
|
+
return true;
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* Creates token request with device code response and polls token endpoint at interval set by the device code
|
|
136
|
+
* response
|
|
137
|
+
* @param request
|
|
138
|
+
* @param deviceCodeResponse
|
|
139
|
+
*/
|
|
140
|
+
DeviceCodeClient.prototype.acquireTokenWithDeviceCode = function (request, deviceCodeResponse) {
|
|
141
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
142
|
+
var requestBody, headers, userSpecifiedTimeout, deviceCodeExpirationTime, pollingIntervalMilli, thumbprint, response;
|
|
143
|
+
return __generator(this, function (_a) {
|
|
144
|
+
switch (_a.label) {
|
|
145
|
+
case 0:
|
|
146
|
+
requestBody = this.createTokenRequestBody(request, deviceCodeResponse);
|
|
147
|
+
headers = this.createTokenRequestHeaders();
|
|
148
|
+
userSpecifiedTimeout = request.timeout ? TimeUtils.nowSeconds() + request.timeout : undefined;
|
|
149
|
+
deviceCodeExpirationTime = TimeUtils.nowSeconds() + deviceCodeResponse.expiresIn;
|
|
150
|
+
pollingIntervalMilli = deviceCodeResponse.interval * 1000;
|
|
151
|
+
_a.label = 1;
|
|
152
|
+
case 1:
|
|
153
|
+
if (!this.continuePolling(deviceCodeExpirationTime, userSpecifiedTimeout, request.cancel)) return [3 /*break*/, 6];
|
|
154
|
+
thumbprint = {
|
|
155
|
+
clientId: this.config.authOptions.clientId,
|
|
156
|
+
authority: request.authority,
|
|
157
|
+
scopes: request.scopes
|
|
158
|
+
};
|
|
159
|
+
return [4 /*yield*/, this.executePostToTokenEndpoint(this.authority.tokenEndpoint, requestBody, headers, thumbprint)];
|
|
160
|
+
case 2:
|
|
161
|
+
response = _a.sent();
|
|
162
|
+
if (!(response.body && response.body.error === Constants.AUTHORIZATION_PENDING)) return [3 /*break*/, 4];
|
|
163
|
+
// user authorization is pending. Sleep for polling interval and try again
|
|
164
|
+
this.logger.info(response.body.error_description || "Authorization pending. Continue polling.");
|
|
165
|
+
return [4 /*yield*/, TimeUtils.delay(pollingIntervalMilli)];
|
|
166
|
+
case 3:
|
|
167
|
+
_a.sent();
|
|
168
|
+
return [3 /*break*/, 5];
|
|
169
|
+
case 4:
|
|
170
|
+
this.logger.verbose("Authorization completed successfully. Polling stopped.");
|
|
171
|
+
return [2 /*return*/, response.body];
|
|
172
|
+
case 5: return [3 /*break*/, 1];
|
|
173
|
+
case 6:
|
|
174
|
+
/*
|
|
175
|
+
* The above code should've thrown by this point, but to satisfy TypeScript,
|
|
176
|
+
* and in the rare case the conditionals in continuePolling() may not catch everything...
|
|
177
|
+
*/
|
|
178
|
+
this.logger.error("Polling stopped for unknown reasons.");
|
|
179
|
+
throw ClientAuthError.createDeviceCodeUnknownError();
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* Creates query parameters and converts to string.
|
|
186
|
+
* @param request
|
|
187
|
+
* @param deviceCodeResponse
|
|
188
|
+
*/
|
|
189
|
+
DeviceCodeClient.prototype.createTokenRequestBody = function (request, deviceCodeResponse) {
|
|
190
|
+
var requestParameters = new RequestParameterBuilder();
|
|
191
|
+
requestParameters.addScopes(request.scopes);
|
|
192
|
+
requestParameters.addClientId(this.config.authOptions.clientId);
|
|
193
|
+
requestParameters.addGrantType(GrantType.DEVICE_CODE_GRANT);
|
|
194
|
+
requestParameters.addDeviceCode(deviceCodeResponse.deviceCode);
|
|
195
|
+
var correlationId = request.correlationId || this.config.cryptoInterface.createNewGuid();
|
|
196
|
+
requestParameters.addCorrelationId(correlationId);
|
|
197
|
+
requestParameters.addClientInfo();
|
|
198
|
+
requestParameters.addLibraryInfo(this.config.libraryInfo);
|
|
199
|
+
requestParameters.addThrottling();
|
|
200
|
+
if (this.serverTelemetryManager) {
|
|
201
|
+
requestParameters.addServerTelemetry(this.serverTelemetryManager);
|
|
202
|
+
}
|
|
203
|
+
if (!StringUtils.isEmptyObj(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {
|
|
204
|
+
requestParameters.addClaims(request.claims, this.config.authOptions.clientCapabilities);
|
|
205
|
+
}
|
|
206
|
+
return requestParameters.createQueryString();
|
|
207
|
+
};
|
|
208
|
+
return DeviceCodeClient;
|
|
209
|
+
}(BaseClient));
|
|
210
|
+
|
|
211
|
+
export { DeviceCodeClient };
|
|
212
|
+
//# sourceMappingURL=DeviceCodeClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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\";\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 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 };\n\n return this.executePostRequestToDeviceCodeEndpoint(this.authority.deviceCodeEndpoint, queryString, headers, thumbprint);\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 (!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\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 };\n const response = await this.executePostToTokenEndpoint(\n this.authority.tokenEndpoint,\n requestBody,\n headers,\n thumbprint);\n\n if (response.body && response.body.error === Constants.AUTHORIZATION_PENDING) {\n // user authorization is pending. Sleep for polling interval and try again\n this.logger.info(response.body.error_description || \"Authorization pending. Continue polling.\");\n \n await TimeUtils.delay(pollingIntervalMilli);\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.addThrottling();\n \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;;;;AAmBA;;;;IAGsC,oCAAU;IAE5C,0BAAY,aAAkC;eAC1C,kBAAM,aAAa,CAAC;KACvB;;;;;;IAOY,uCAAY,GAAzB,UAA0B,OAAgC;;;;;4BACP,qBAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,EAAA;;wBAA1E,kBAAkB,GAAuB,SAAiC;wBAChF,OAAO,CAAC,kBAAkB,CAAC,kBAAkB,CAAC,CAAC;wBACzC,YAAY,GAAG,SAAS,CAAC,UAAU,EAAE,CAAC;wBACO,qBAAM,IAAI,CAAC,0BAA0B,CACpF,OAAO,EACP,kBAAkB,CAAC,EAAA;;wBAFjB,QAAQ,GAAqC,SAE5B;wBAEjB,eAAe,GAAG,IAAI,eAAe,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;;wBAGF,eAAe,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC;wBACzC,qBAAM,eAAe,CAAC,yBAAyB,CAClD,QAAQ,EACR,IAAI,CAAC,SAAS,EACd,YAAY,EACZ,OAAO,CACV,EAAA;4BALD,sBAAO,SAKN,EAAC;;;;KACL;;;;;IAMa,wCAAa,GAA3B,UAA4B,OAAgC;;;;gBAClD,WAAW,GAAG,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;gBAC9C,OAAO,GAAG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","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;AAW7E;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,UAAU;IAE5C,OAAO,CAAC,QAAQ,CAAW;gBAEf,aAAa,EAAE,mBAAmB;IAI9C;;;OAGG;IACU,YAAY,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAejG;;;OAGG;YACW,6BAA6B;
|
|
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;AAW7E;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,UAAU;IAE5C,OAAO,CAAC,QAAQ,CAAW;gBAEf,aAAa,EAAE,mBAAmB;IAI9C;;;OAGG;IACU,YAAY,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAejG;;;OAGG;YACW,6BAA6B;IA2C3C;;;OAGG;IACH,OAAO,CAAC,wBAAwB;IAqBhC;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IAkB5B;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IAI5B;;;;OAIG;YACW,mBAAmB;IAkCjC;;;OAGG;IACH,OAAO,CAAC,sBAAsB;CAsCjC"}
|