Skip to content

Commit

Permalink
Update provider.ts
Browse files Browse the repository at this point in the history
Adding workaround for connect params
  • Loading branch information
openfin-johans authored Dec 2, 2024
1 parent 164a38b commit f585467
Showing 1 changed file with 33 additions and 2 deletions.
35 changes: 33 additions & 2 deletions how-to/use-interop/cloud-interop/client/src/provider.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,45 @@
import { cloudInteropOverride } from "@openfin/cloud-interop";
import { cloudInteropOverride,CloudInteropOverrideParams } from "@openfin/cloud-interop";
import type OpenFin from "@openfin/core";
import { getManifestCustomSettings } from "./settings";

window.addEventListener("DOMContentLoaded", async () => {
const customSettings = await getManifestCustomSettings();
const interopOverrides = [];

// TEMP WORKAROUND TO CREATE CONNECT PARAMS

const jwtConnectParams:CloudInteropOverrideParams = {
url: "<PLEASE ASK OPENFIN FOR A URL>",
authenticationType: "jwt",
jwtAuthenticationParameters: {
authenticationId: "<PLEASE ASK OPENFIN FOR THE AUTH ID>",
jwtRequestCallback: () => "<PLEASE ASK OPENFIN FOR JWT DETAILS TO CREATE TOKEN>"
},
platformId: customSettings?.cloudInteropProvider?.connectParams?.platformId as string,
sourceId: customSettings?.cloudInteropProvider?.connectParams?.sourceId,
sourceDisplayName: customSettings?.cloudInteropProvider?.connectParams?.sourceDisplayName
}

const basicConnectParams:CloudInteropOverrideParams = {
url: "<PLEASE ASK OPENFIN FOR A URL>",
authenticationType: "basic",
basicAuthenticationParameters: {
username: "<PLEASE ASK OPENFIN FOR A USER ID>",
password: "<PLEASE ASK OPENFIN FOR A PASSWORD>"
},
platformId: customSettings?.cloudInteropProvider?.connectParams?.platformId as string,
sourceId: customSettings?.cloudInteropProvider?.connectParams?.sourceId,
sourceDisplayName: customSettings?.cloudInteropProvider?.connectParams?.sourceDisplayName
}

// END

if (customSettings?.cloudInteropProvider?.enabled) {
const initializedCloudInteropOverride = (await cloudInteropOverride(
customSettings?.cloudInteropProvider?.connectParams
// TEMP WORKAROUND
//customSettings?.cloudInteropProvider?.connectParams
//basicConnectParams
jwtConnectParams
)) as unknown as OpenFin.ConstructorOverride<OpenFin.InteropBroker>;
interopOverrides.push(initializedCloudInteropOverride);
}
Expand Down

0 comments on commit f585467

Please sign in to comment.