Skip to content

Commit

Permalink
fixed plain creds from saved token observer.next()
Browse files Browse the repository at this point in the history
  • Loading branch information
urz9999 committed Apr 14, 2021
1 parent 1a77968 commit 9bf8433
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/app/strategies/awsStrategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export class AwsStrategy extends RefreshCredentialsStrategy {
this.getIamUserAccessKeysFromKeychain(session).then(credentials => {
this.keychainService.getSecret(environment.appName, this.generatePlainAccountSessionTokenExpirationString(session)).then(sessionTokenData => {
if (sessionTokenData && this.isSessionTokenStillValid(sessionTokenData)) {
this.applyPlainAccountSessionToken(workspace, session);
this.applyPlainAccountSessionToken(observer, workspace, session);
} else {
if (this.processSubscription) { this.processSubscription.unsubscribe(); }
this.processSubscription = this.getPlainAccountSessionToken(credentials, session).subscribe((awsCredentials) => {
Expand Down Expand Up @@ -513,12 +513,17 @@ export class AwsStrategy extends RefreshCredentialsStrategy {
return 'truster-account-session-token-' + session.account.accountName;
}

private applyPlainAccountSessionToken(workspace, session: Session) {
private applyPlainAccountSessionToken(observer, workspace, session: Session) {
this.keychainService.getSecret(environment.appName, `plain-account-session-token-${session.account.accountName}`).then(sessionToken => {
sessionToken = JSON.parse(sessionToken);
this.fileService.iniWriteSync(this.appService.awsCredentialPath(), sessionToken);
this.configurationService.updateWorkspaceSync(workspace);
this.configurationService.disableLoadingWhenReady(workspace, session);

// Start Calculating time here once credentials are actually retrieved
this.timerService.defineTimer();
observer.next(true);
observer.complete();
});
}

Expand Down

0 comments on commit 9bf8433

Please sign in to comment.