mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
default to native credential service in linux (#18716)
This commit is contained in:
@@ -43,16 +43,20 @@ export class SqlCredentialService extends SqlOpsFeature<any> {
|
|||||||
|
|
||||||
protected override registerProvider(options: any): Disposable {
|
protected override registerProvider(options: any): Disposable {
|
||||||
let readCredential = async (credentialId: string): Promise<azdata.Credential> => {
|
let readCredential = async (credentialId: string): Promise<azdata.Credential> => {
|
||||||
|
if (Utils.isLinux) {
|
||||||
|
const password = await this._secretStorage.get(credentialId);
|
||||||
|
return {
|
||||||
|
credentialId: credentialId,
|
||||||
|
password: password
|
||||||
|
};
|
||||||
|
}
|
||||||
return this._client.sendRequest(Contracts.ReadCredentialRequest.type, { credentialId, password: undefined });
|
return this._client.sendRequest(Contracts.ReadCredentialRequest.type, { credentialId, password: undefined });
|
||||||
};
|
};
|
||||||
|
|
||||||
let saveCredential = async (credentialId: string, password: string): Promise<boolean> => {
|
let saveCredential = async (credentialId: string, password: string): Promise<boolean> => {
|
||||||
if (Utils.isLinux) {
|
if (Utils.isLinux) {
|
||||||
/**
|
|
||||||
* This is only done for linux because this is going to be
|
|
||||||
* the default credential system for linux in the next release
|
|
||||||
*/
|
|
||||||
await this._secretStorage.store(credentialId, password);
|
await this._secretStorage.store(credentialId, password);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return this._client.sendRequest(Contracts.SaveCredentialRequest.type, { credentialId, password });
|
return this._client.sendRequest(Contracts.SaveCredentialRequest.type, { credentialId, password });
|
||||||
};
|
};
|
||||||
@@ -61,6 +65,7 @@ export class SqlCredentialService extends SqlOpsFeature<any> {
|
|||||||
if (Utils.isLinux) {
|
if (Utils.isLinux) {
|
||||||
try {
|
try {
|
||||||
await this._secretStorage.delete(credentialId);
|
await this._secretStorage.delete(credentialId);
|
||||||
|
return true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('credential does not exist in native secret store');
|
console.log('credential does not exist in native secret store');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user