mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-07-26 20:56:35 +00:00
parent
b407d0aee0
commit
b8c718ce9e
@ -49,7 +49,10 @@ export class AuthenticationClientService
|
|||||||
this.service
|
this.service
|
||||||
.session()
|
.session()
|
||||||
.then((session) => this.notifySessionDidChange(session));
|
.then((session) => this.notifySessionDidChange(session));
|
||||||
|
|
||||||
this.setOptions();
|
this.setOptions();
|
||||||
|
this.service.initAuthSession()
|
||||||
|
|
||||||
this.arduinoPreferences.onPreferenceChanged((event) => {
|
this.arduinoPreferences.onPreferenceChanged((event) => {
|
||||||
if (event.preferenceName.startsWith('arduino.auth.')) {
|
if (event.preferenceName.startsWith('arduino.auth.')) {
|
||||||
this.setOptions();
|
this.setOptions();
|
||||||
|
@ -23,6 +23,7 @@ export interface AuthenticationService
|
|||||||
session(): Promise<AuthenticationSession | undefined>;
|
session(): Promise<AuthenticationSession | undefined>;
|
||||||
disposeClient(client: AuthenticationServiceClient): void;
|
disposeClient(client: AuthenticationServiceClient): void;
|
||||||
setOptions(authOptions: AuthOptions): void;
|
setOptions(authOptions: AuthOptions): void;
|
||||||
|
initAuthSession(): Promise<void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AuthenticationServiceClient {
|
export interface AuthenticationServiceClient {
|
||||||
|
@ -19,6 +19,8 @@ export class AuthenticationServiceImpl
|
|||||||
protected readonly delegate = new ArduinoAuthenticationProvider();
|
protected readonly delegate = new ArduinoAuthenticationProvider();
|
||||||
protected readonly clients: AuthenticationServiceClient[] = [];
|
protected readonly clients: AuthenticationServiceClient[] = [];
|
||||||
protected readonly toDispose = new DisposableCollection();
|
protected readonly toDispose = new DisposableCollection();
|
||||||
|
|
||||||
|
private initialized = false;
|
||||||
|
|
||||||
async onStart(): Promise<void> {
|
async onStart(): Promise<void> {
|
||||||
this.toDispose.pushAll([
|
this.toDispose.pushAll([
|
||||||
@ -42,7 +44,13 @@ export class AuthenticationServiceImpl
|
|||||||
this.clients.forEach((client) => this.disposeClient(client))
|
this.clients.forEach((client) => this.disposeClient(client))
|
||||||
),
|
),
|
||||||
]);
|
]);
|
||||||
await this.delegate.init();
|
}
|
||||||
|
|
||||||
|
async initAuthSession(): Promise<void> {
|
||||||
|
if (!this.initialized) {
|
||||||
|
await this.delegate.init();
|
||||||
|
this.initialized = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setOptions(authOptions: AuthOptions) {
|
setOptions(authOptions: AuthOptions) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user