Skip to content

Commit

Permalink
chore: fixed in-app AWS Identity Center integration login
Browse files Browse the repository at this point in the history
  • Loading branch information
ericvilla committed Mar 27, 2024
1 parent 8b35897 commit 2d50bc7
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ import {
import { IAwsSsoOidcVerificationWindowService } from "@noovolari/leapp-core/interfaces/i-aws-sso-oidc-verification-window-service";
import { WindowService } from "./window.service";
import { MessageToasterService, ToastLevel } from "./message-toaster.service";
import { AwsCoreService } from "@noovolari/leapp-core/services/aws-core-service";

@Injectable({ providedIn: "root" })
export class AppVerificationWindowService implements IAwsSsoOidcVerificationWindowService {
constructor(private windowService: WindowService, private toasterService: MessageToasterService) {}
constructor(private windowService: WindowService, private toasterService: MessageToasterService, private awsCoreService: AwsCoreService) {}

async openVerificationWindow(
registerClientResponse: RegisterClientResponse,
Expand Down Expand Up @@ -62,7 +63,7 @@ export class AppVerificationWindowService implements IAwsSsoOidcVerificationWind
// When the code is verified and the user has been logged in, the window can be closed
verificationWindow.webContents.session.webRequest.onCompleted(
{
urls: ["https://oidc.eu-west-1.amazonaws.com/device_authorization/associate_token"],
urls: this.getAssociateTokenUrls(),
},
(details, callback) => {
if (details.method === "POST" && details.statusCode === 200) {
Expand Down Expand Up @@ -99,6 +100,10 @@ export class AppVerificationWindowService implements IAwsSsoOidcVerificationWind
});
}

private getAssociateTokenUrls() {
return this.awsCoreService.getRegions().map((region) => `https://oidc.${region.region}.amazonaws.com/device_authorization/associate_token`);
}

private async openExternalVerificationBrowserWindow(
registerClientResponse: RegisterClientResponse,
startDeviceAuthorizationResponse: StartDeviceAuthorizationResponse
Expand Down

0 comments on commit 2d50bc7

Please sign in to comment.