Skip to content

Commit ff13922

Browse files
#944: Fixed auth. sessions not persistent
1 parent b407d0a commit ff13922

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

Diff for: arduino-ide-extension/src/browser/auth/authentication-client-service.ts

+3
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ export class AuthenticationClientService
4949
this.service
5050
.session()
5151
.then((session) => this.notifySessionDidChange(session));
52+
5253
this.setOptions();
54+
this.service.initAuthSession()
55+
5356
this.arduinoPreferences.onPreferenceChanged((event) => {
5457
if (event.preferenceName.startsWith('arduino.auth.')) {
5558
this.setOptions();

Diff for: arduino-ide-extension/src/common/protocol/authentication-service.ts

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export interface AuthenticationService
2323
session(): Promise<AuthenticationSession | undefined>;
2424
disposeClient(client: AuthenticationServiceClient): void;
2525
setOptions(authOptions: AuthOptions): void;
26+
initAuthSession(): Promise<void>;
2627
}
2728

2829
export interface AuthenticationServiceClient {

Diff for: arduino-ide-extension/src/node/auth/authentication-service-impl.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ export class AuthenticationServiceImpl
1919
protected readonly delegate = new ArduinoAuthenticationProvider();
2020
protected readonly clients: AuthenticationServiceClient[] = [];
2121
protected readonly toDispose = new DisposableCollection();
22+
23+
private initialized = false;
2224

2325
async onStart(): Promise<void> {
2426
this.toDispose.pushAll([
@@ -42,7 +44,13 @@ export class AuthenticationServiceImpl
4244
this.clients.forEach((client) => this.disposeClient(client))
4345
),
4446
]);
45-
await this.delegate.init();
47+
}
48+
49+
async initAuthSession(): Promise<void> {
50+
if (!this.initialized) {
51+
await this.delegate.init();
52+
this.initialized = true
53+
}
4654
}
4755

4856
setOptions(authOptions: AuthOptions) {

0 commit comments

Comments
 (0)