Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement caching value of skipCertValidation #436

Merged
merged 4 commits into from
May 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/exec/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export class Login extends TfCommand<CoreArguments, LoginResult> {
}
await tfxCredStore.storeCredential(collectionUrl, "allusers", credString);
await tfxCache.setItem("cache", "connection", collectionUrl);
await tfxCache.setItem("cache", "skipCertValidation", skipCertValidation.toString());
return { success: true } as LoginResult;
} catch (err) {
if (err && err.statusCode && err.statusCode === 401) {
Expand Down
8 changes: 7 additions & 1 deletion app/lib/tfcommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,13 @@ export abstract class TfCommand<TArguments extends CoreArguments, TResult> {
});
}

public getWebApi(options?: IRequestOptions): Promise<WebApi> {
public async getWebApi(options?: IRequestOptions): Promise<WebApi> {
// try to get value of skipCertValidation from cache
const tfxCache = new DiskCache("tfx");
if (await tfxCache.itemExists("cache", "skipCertValidation")) {
const skipCertValidation = await tfxCache.getItem("cache", "skipCertValidation");
options = {...options, ignoreSslError: <any>skipCertValidation}
}
return this.commandArgs.serviceUrl.val().then(url => {
return this.getCredentials(url).then(handler => {
this.connection = new TfsConnection(url);
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tfx-cli",
"version": "0.14.0",
"version": "0.15.0",
"description": "CLI for Azure DevOps Services and Team Foundation Server",
"repository": {
"type": "git",
Expand Down