mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-02 17:23:40 -05:00
Merge from vscode 2e5312cd61ff99c570299ecc122c52584265eda2
This commit is contained in:
committed by
Anthony Dresser
parent
3603f55d97
commit
7f1d8fc32f
@@ -9,14 +9,19 @@ import { Disposable } from 'vs/base/common/lifecycle';
|
||||
|
||||
export const IAuthenticationTokenService = createDecorator<IAuthenticationTokenService>('IAuthenticationTokenService');
|
||||
|
||||
export interface IUserDataSyncAuthToken {
|
||||
readonly authenticationProviderId: string;
|
||||
readonly token: string;
|
||||
}
|
||||
|
||||
export interface IAuthenticationTokenService {
|
||||
_serviceBrand: undefined;
|
||||
|
||||
readonly onDidChangeToken: Event<string | undefined>;
|
||||
readonly onDidChangeToken: Event<IUserDataSyncAuthToken | undefined>;
|
||||
readonly onTokenFailed: Event<void>;
|
||||
|
||||
getToken(): Promise<string | undefined>;
|
||||
setToken(accessToken: string | undefined): Promise<void>;
|
||||
getToken(): Promise<IUserDataSyncAuthToken | undefined>;
|
||||
setToken(userDataSyncAuthToken: IUserDataSyncAuthToken | undefined): Promise<void>;
|
||||
sendTokenFailed(): void;
|
||||
}
|
||||
|
||||
@@ -24,24 +29,24 @@ export class AuthenticationTokenService extends Disposable implements IAuthentic
|
||||
|
||||
_serviceBrand: any;
|
||||
|
||||
private _onDidChangeToken: Emitter<string | undefined> = this._register(new Emitter<string | undefined>());
|
||||
readonly onDidChangeToken: Event<string | undefined> = this._onDidChangeToken.event;
|
||||
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: string | undefined;
|
||||
private _token: IUserDataSyncAuthToken | undefined;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
async getToken(): Promise<string | undefined> {
|
||||
async getToken(): Promise<IUserDataSyncAuthToken | undefined> {
|
||||
return this._token;
|
||||
}
|
||||
|
||||
async setToken(token: string | undefined): Promise<void> {
|
||||
if (token !== 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) {
|
||||
this._token = token;
|
||||
this._onDidChangeToken.fire(token);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user