Skip to content

Commit 59d2330

Browse files
Implement caching value of skipCertValidation (#436)
* saved skipCertValidation value to cache * implemented logic to get value of skipCertValidation from cache * bumped version up to 0.15.0 * small correction
1 parent c0a2987 commit 59d2330

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

app/exec/login.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ export class Login extends TfCommand<CoreArguments, LoginResult> {
4444
}
4545
await tfxCredStore.storeCredential(collectionUrl, "allusers", credString);
4646
await tfxCache.setItem("cache", "connection", collectionUrl);
47+
await tfxCache.setItem("cache", "skipCertValidation", skipCertValidation.toString());
4748
return { success: true } as LoginResult;
4849
} catch (err) {
4950
if (err && err.statusCode && err.statusCode === 401) {

app/lib/tfcommand.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,13 @@ export abstract class TfCommand<TArguments extends CoreArguments, TResult> {
418418
});
419419
}
420420

421-
public getWebApi(options?: IRequestOptions): Promise<WebApi> {
421+
public async getWebApi(options?: IRequestOptions): Promise<WebApi> {
422+
// try to get value of skipCertValidation from cache
423+
const tfxCache = new DiskCache("tfx");
424+
if (await tfxCache.itemExists("cache", "skipCertValidation")) {
425+
const skipCertValidation = await tfxCache.getItem("cache", "skipCertValidation");
426+
options = {...options, ignoreSslError: <any>skipCertValidation}
427+
}
422428
return this.commandArgs.serviceUrl.val().then(url => {
423429
return this.getCredentials(url).then(handler => {
424430
this.connection = new TfsConnection(url);

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tfx-cli",
3-
"version": "0.14.0",
3+
"version": "0.15.0",
44
"description": "CLI for Azure DevOps Services and Team Foundation Server",
55
"repository": {
66
"type": "git",

0 commit comments

Comments
 (0)