@@ -331,6 +331,8 @@ export class Auth implements AuthService, ConnectionManager {
331
331
}
332
332
}
333
333
334
+ public async reauthenticate ( { id } : Pick < SsoConnection , 'id' > ) : Promise < SsoConnection >
335
+ public async reauthenticate ( { id } : Pick < IamConnection , 'id' > ) : Promise < IamConnection >
334
336
public async reauthenticate ( { id } : Pick < Connection , 'id' > ) : Promise < Connection > {
335
337
const profile = this . store . getProfileOrThrow ( id )
336
338
if ( profile . type === 'sso' ) {
@@ -347,7 +349,7 @@ export class Auth implements AuthService, ConnectionManager {
347
349
}
348
350
349
351
public async useConnection ( { id } : Pick < SsoConnection , 'id' > ) : Promise < SsoConnection >
350
- public async useConnection ( { id } : Pick < Connection , 'id' > ) : Promise < Connection >
352
+ public async useConnection ( { id } : Pick < IamConnection , 'id' > ) : Promise < IamConnection >
351
353
public async useConnection ( { id } : Pick < Connection , 'id' > ) : Promise < Connection > {
352
354
const profile = this . store . getProfile ( id )
353
355
if ( profile === undefined ) {
@@ -569,7 +571,7 @@ export class Auth implements AuthService, ConnectionManager {
569
571
type : 'iam' ,
570
572
state : profile . metadata . connectionState ,
571
573
label : profile . metadata . label ?? id ,
572
- getCredentials : ( ) => this . debouncedGetCredentials ( id , provider ) ,
574
+ getCredentials : ( ) => this . getCredentials ( id , provider ) ,
573
575
}
574
576
}
575
577
@@ -591,11 +593,12 @@ export class Auth implements AuthService, ConnectionManager {
591
593
startUrl : profile . startUrl ,
592
594
state : profile . metadata . connectionState ,
593
595
label : profile . metadata ?. label ?? label ,
594
- getToken : ( ) => this . debouncedGetToken ( id , provider ) ,
596
+ getToken : ( ) => this . getToken ( id , provider ) ,
595
597
}
596
598
}
597
599
598
- private async authenticate < T > ( id : Connection [ 'id' ] , callback : ( ) => Promise < T > ) : Promise < T > {
600
+ private readonly authenticate = keyedDebounce ( this . _authenticate . bind ( this ) )
601
+ private async _authenticate < T > ( id : Connection [ 'id' ] , callback : ( ) => Promise < T > ) : Promise < T > {
599
602
await this . updateConnectionState ( id , 'authenticating' )
600
603
601
604
try {
@@ -625,15 +628,15 @@ export class Auth implements AuthService, ConnectionManager {
625
628
}
626
629
}
627
630
628
- private readonly debouncedGetToken = keyedDebounce ( Auth . prototype . getToken . bind ( this ) )
629
- private async getToken ( id : Connection [ 'id' ] , provider : SsoAccessTokenProvider ) : Promise < SsoToken > {
631
+ private readonly getToken = keyedDebounce ( this . _getToken . bind ( this ) )
632
+ private async _getToken ( id : Connection [ 'id' ] , provider : SsoAccessTokenProvider ) : Promise < SsoToken > {
630
633
const token = await provider . getToken ( )
631
634
632
635
return token ?? this . handleInvalidCredentials ( id , ( ) => provider . createToken ( ) )
633
636
}
634
637
635
- private readonly debouncedGetCredentials = keyedDebounce ( Auth . prototype . getCredentials . bind ( this ) )
636
- private async getCredentials ( id : Connection [ 'id' ] , provider : CredentialsProvider ) : Promise < Credentials > {
638
+ private readonly getCredentials = keyedDebounce ( this . _getCredentials . bind ( this ) )
639
+ private async _getCredentials ( id : Connection [ 'id' ] , provider : CredentialsProvider ) : Promise < Credentials > {
637
640
const credentials = await this . getCachedCredentials ( provider )
638
641
if ( credentials !== undefined ) {
639
642
return credentials
0 commit comments