@openfin/cloud-interop 0.41.63 → 0.41.64

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -1,30 +1,23 @@
1
1
  # @openfin/cloud-interop
2
2
 
3
- This package contains an override that enables Cloud Interop for OpenFin `InteropBroker`'s unlocking Interop across applications and devices.
3
+ This package contains an override that enables Cloud Interop for `InteropBroker`'s unlocking Interop across applications and devices. It is powered by the [@openfin/cloud-interop-core-api](https://www.npmjs.com/package/@openfin/cloud-interop-core-api?activeTab=readme) package which provides an API client to communicate with the Cloud Interop Service.
4
4
 
5
5
  Overrides are passed to `fin.Platform.init` when initializing a platform or to `fin.Interop.init` when creating an `InteropBroker` directly.
6
6
 
7
- Once overriden the `InteropBroker` will connect to Cloud Interop. `Context` will be sent to the Cloud Interop server and the broker will receive `Context` updates from other any other connected brokers in the shared session.
8
-
9
- ## Auth
10
-
11
- Using the service currently requires user credentials provided by OpenFin, please contact support@openfin.co.
7
+ Once overriden the `InteropBroker` will connect to the given Cloud Interop Service upon initialization. `Context` will be sent to the Cloud Interop server and the broker will receive `Context` updates from other any other connected brokers in the shared session.
12
8
 
13
9
  ## Usage
14
10
 
15
- In a Platform:
11
+ In a Platform with other overrides:
16
12
 
17
13
  ```typescript
18
14
  import { cloudInteropOverride } from "@openfin/cloud-interop";
19
15
  import { ExampleOverride } from "./example";
20
16
 
21
17
  const cloudConfig = {
22
- userId: "andy", // Credentials provided by OpenFin
23
- password: "asdf1234", // Credentials provided by OpenFin
24
- platformId: "8cef8205-d5a8-41c4-b368-47475b32c019", // Shared identifier for apps that should communicate
25
- url: "<CLOUD_INTEROP_SERVER_URL>",
26
- sourceId: fin.me.identity.uuid,
27
- source: "Desktop",
18
+ url: "<CLOUD_INTEROP_SERVICE_URL>",
19
+ platformId: "my-platform", // Shared identifier for apps that should communicate
20
+ sourceId: "my-desktop"
28
21
  };
29
22
 
30
23
  const InitializedCloudInteropOverride = await cloudInteropOverride(cloudConfig);
@@ -41,15 +34,70 @@ When creating an `InteropBroker` directly:
41
34
  import { cloudInteropOverride } from "@openfin/cloud-interop";
42
35
 
43
36
  const cloudConfig = {
44
- userId: "andy", // Credentials provided by OpenFin
45
- password: "asdf1234", // Credentials provided by OpenFin
46
- platformId: "8cef8205-d5a8-41c4-b368-47475b32c019", // Shared identifier for apps that should communicate
47
- url: "<CLOUD_INTEROP_SERVER_URL>",
48
- sourceId: fin.me.identity.uuid,
49
- source: "Desktop",
37
+ url: "<CLOUD_INTEROP_SERVICE_URL>",
38
+ platformId: "my-platform", // Shared identifier for apps that should communicate
39
+ sourceId: "my-desktop"
50
40
  };
51
41
 
52
42
  const InitializedCloudInteropOverride = await cloudInteropOverride(cloudConfig);
53
43
 
54
44
  await fin.Interop.init(fin.me.uuid, InitializedCloudInteropOverride);
55
45
  ```
46
+
47
+ ## Authentication
48
+
49
+ The Cloud Interop API client offers various authentication methods which can be enabled through configuration.
50
+
51
+ Interactive session based authentication using cookies (default):
52
+
53
+ ```typescript
54
+ import { cloudInteropOverride } from "@openfin/cloud-interop";
55
+
56
+ const cloudConfig = {
57
+ url: "<CLOUD_INTEROP_SERVICE_URL>",
58
+ platformId: "my-platform", // Shared identifier for apps that should communicate
59
+ sourceId: "my-desktop",
60
+ };
61
+
62
+ const InitializedCloudInteropOverride = await cloudInteropOverride(cloudConfig);
63
+ ```
64
+
65
+ Basic authentication with credentials provisioned per Cloud Interop Service:
66
+
67
+ ```typescript
68
+ import { cloudInteropOverride } from "@openfin/cloud-interop";
69
+
70
+ const cloudConfig = {
71
+ url: "<CLOUD_INTEROP_SERVICE_URL>",
72
+ platformId: "my-platform", // Shared identifier for apps that should communicate
73
+ sourceId: "my-desktop",
74
+ authenticationType: "basic",
75
+ basicAuthenticationParameters: {
76
+ username: "bob@acme.com",
77
+ password: "password"
78
+ }
79
+ };
80
+
81
+ const InitializedCloudInteropOverride = await cloudInteropOverride(cloudConfig);
82
+ ```
83
+
84
+ JWT token authentication:
85
+
86
+ ```typescript
87
+ import { cloudInteropOverride } from "@openfin/cloud-interop";
88
+
89
+ const cloudConfig = {
90
+ url: "<CLOUD_INTEROP_SERVICE_URL>",
91
+ platformId: "my-platform", // Shared identifier for apps that should communicate
92
+ sourceId: "my-desktop",
93
+ authenticationType: "jwt",
94
+ jwtAuthenticationParameters: {
95
+ // Service Gateway authentication identifier, contact Here support to obtain id for your organization.
96
+ authenticationId: "00b671f2-e1a9-4c29-9fa9-55f1988a11fb",
97
+ // Callback invoked whenever a jwt token is required for a request
98
+ jwtRequestCallback: () => "my-token"
99
+ }
100
+ };
101
+
102
+ const InitializedCloudInteropOverride = await cloudInteropOverride(cloudConfig);
103
+ ```