mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-04 17:23:45 -05:00
Merge from vscode 79a1f5a5ca0c6c53db617aa1fa5a2396d2caebe2
This commit is contained in:
@@ -17,11 +17,12 @@ export interface IUserDataSyncAuthToken {
|
||||
export interface IAuthenticationTokenService {
|
||||
_serviceBrand: undefined;
|
||||
|
||||
readonly token: IUserDataSyncAuthToken | undefined;
|
||||
readonly onDidChangeToken: Event<IUserDataSyncAuthToken | undefined>;
|
||||
readonly onTokenFailed: Event<void>;
|
||||
|
||||
getToken(): Promise<IUserDataSyncAuthToken | undefined>;
|
||||
setToken(userDataSyncAuthToken: IUserDataSyncAuthToken | undefined): Promise<void>;
|
||||
|
||||
readonly onTokenFailed: Event<void>;
|
||||
sendTokenFailed(): void;
|
||||
}
|
||||
|
||||
@@ -29,21 +30,14 @@ export class AuthenticationTokenService extends Disposable implements IAuthentic
|
||||
|
||||
_serviceBrand: any;
|
||||
|
||||
private _token: IUserDataSyncAuthToken | undefined;
|
||||
get token(): IUserDataSyncAuthToken | undefined { return this._token; }
|
||||
private _onDidChangeToken = this._register(new Emitter<IUserDataSyncAuthToken | undefined>());
|
||||
readonly onDidChangeToken = this._onDidChangeToken.event;
|
||||
|
||||
private _onTokenFailed: Emitter<void> = this._register(new Emitter<void>());
|
||||
readonly onTokenFailed: Event<void> = this._onTokenFailed.event;
|
||||
|
||||
private _token: IUserDataSyncAuthToken | undefined;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
async getToken(): Promise<IUserDataSyncAuthToken | undefined> {
|
||||
return this._token;
|
||||
}
|
||||
|
||||
async setToken(token: IUserDataSyncAuthToken | undefined): Promise<void> {
|
||||
if (token && this._token ? token.token !== this._token.token || token.authenticationProviderId !== this._token.authenticationProviderId : token !== this._token) {
|
||||
|
||||
@@ -7,7 +7,6 @@ import { IServerChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { IAuthenticationTokenService } from 'vs/platform/authentication/common/authentication';
|
||||
|
||||
|
||||
export class AuthenticationTokenServiceChannel implements IServerChannel {
|
||||
constructor(private readonly service: IAuthenticationTokenService) { }
|
||||
|
||||
@@ -22,7 +21,6 @@ export class AuthenticationTokenServiceChannel implements IServerChannel {
|
||||
call(context: any, command: string, args?: any): Promise<any> {
|
||||
switch (command) {
|
||||
case 'setToken': return this.service.setToken(args);
|
||||
case 'getToken': return this.service.getToken();
|
||||
}
|
||||
throw new Error('Invalid call');
|
||||
}
|
||||
Reference in New Issue
Block a user