@deephaven/auth-plugins 0.44.1-beta.0 → 0.44.2-plugin-cleanup.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +116 -0
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -8,6 +8,122 @@ Authentication plugins for Deephaven. Used by [AuthBootstrap](../app-utils/src/c
|
|
|
8
8
|
npm install --save @deephaven/auth-plugins
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
+
## Developing New Auth Plugins
|
|
12
|
+
|
|
13
|
+
Export an `AuthPlugin` from a module to register an authentication plugin. Authentication plugins must implement the [AuthPlugin interface](./src/AuthPlugin.ts#L32). Authentication plugins can display a UI which then triggers how to login.
|
|
14
|
+
|
|
15
|
+
The Web UI loads all plugins on initialization, and uses the first available authentication plugin for authenticating. A sequence diagram of this flow at a high level, where `AuthPlugin` is the first authentication plugin that returns true when the `isAvailable` method is called.
|
|
16
|
+
|
|
17
|
+
```mermaid
|
|
18
|
+
sequenceDiagram
|
|
19
|
+
participant U as User
|
|
20
|
+
participant W as Web UI
|
|
21
|
+
participant P as AuthPlugin
|
|
22
|
+
participant S as Server
|
|
23
|
+
U->>W: Open app
|
|
24
|
+
activate W
|
|
25
|
+
W->>S: Load plugin modules
|
|
26
|
+
S-->>W: PluginModule[]
|
|
27
|
+
W->>S: client.getAuthConfigValues()
|
|
28
|
+
S-->>W: Auth config [string, string][]
|
|
29
|
+
W->>W: Select first available AuthPlugin
|
|
30
|
+
deactivate W
|
|
31
|
+
W->>P: Login
|
|
32
|
+
P->>S: client.login()
|
|
33
|
+
S-->>P: Login success
|
|
34
|
+
P-->>W: Login success
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Examples
|
|
38
|
+
|
|
39
|
+
Below are some sequence diagrams for some of the included Auth Plugins.
|
|
40
|
+
|
|
41
|
+
#### Pre-shared Key ([AuthPluginPsk](./src/AuthPluginPsk.tsx))
|
|
42
|
+
|
|
43
|
+
```mermaid
|
|
44
|
+
sequenceDiagram
|
|
45
|
+
participant W as Web UI
|
|
46
|
+
participant P as AuthPluginPsk
|
|
47
|
+
participant J as JS API
|
|
48
|
+
W->>P: Login
|
|
49
|
+
alt Key in query string
|
|
50
|
+
P->>J: client.login(key)
|
|
51
|
+
else Prompt user for key
|
|
52
|
+
P->>P: Prompt for key
|
|
53
|
+
P->>J: client.login(key)
|
|
54
|
+
end
|
|
55
|
+
J-->>P: Login success
|
|
56
|
+
P-->>W: Login success
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Composite Password/Anonymous plugin
|
|
60
|
+
|
|
61
|
+
Composite plugin giving the user the choice of logging in with a password or logging in anonymously
|
|
62
|
+
|
|
63
|
+
```mermaid
|
|
64
|
+
sequenceDiagram
|
|
65
|
+
participant W as Web UI
|
|
66
|
+
participant CP as CompositePlugin
|
|
67
|
+
participant AP as AnonymousPlugin
|
|
68
|
+
participant PP as PasswordPlugin
|
|
69
|
+
participant J as JS API
|
|
70
|
+
W->>CP: Login
|
|
71
|
+
CP->>CP: Prompt for authentication method
|
|
72
|
+
activate CP
|
|
73
|
+
alt Password login
|
|
74
|
+
activate PP
|
|
75
|
+
loop Until success
|
|
76
|
+
PP->>PP: Show Login UI
|
|
77
|
+
PP->>J: client.login(password)
|
|
78
|
+
alt Login success
|
|
79
|
+
J-->>PP: Login success
|
|
80
|
+
else Login failure
|
|
81
|
+
J-->>PP: Login failure
|
|
82
|
+
PP->>PP: Show login error
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
PP-->>CP: Login success
|
|
86
|
+
deactivate PP
|
|
87
|
+
else Anonymous login
|
|
88
|
+
activate AP
|
|
89
|
+
AP->>J: client.login(anonymous)
|
|
90
|
+
J-->>AP: Login success
|
|
91
|
+
AP-->>CP: Login success
|
|
92
|
+
deactivate AP
|
|
93
|
+
end
|
|
94
|
+
CP-->>W: Login success
|
|
95
|
+
deactivate CP
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
#### Auth0
|
|
99
|
+
|
|
100
|
+
Translation of flow from https://auth0.com/docs/get-started/authentication-and-authorization-flow/authorization-code-flow, showing which responsibilities login plugin handles. Note that the plugins need to be loaded initially prior to redirecting to the authorization prompt, and then again after redirecting back to the Web UI. For a specific example using Keycloak, see [AuthPluginKeycloak](https://github.com/deephaven/deephaven-js-plugins/tree/main/plugins/auth-keycloak).
|
|
101
|
+
|
|
102
|
+
```mermaid
|
|
103
|
+
sequenceDiagram
|
|
104
|
+
participant U as User
|
|
105
|
+
participant W as Web UI
|
|
106
|
+
participant S as Server
|
|
107
|
+
participant P as Auth0Plugin
|
|
108
|
+
participant T as Auth0 Tenant
|
|
109
|
+
participant J as JS API
|
|
110
|
+
U->>W: Open app
|
|
111
|
+
W->>W: Select first available AuthPlugin
|
|
112
|
+
W->>P: Login
|
|
113
|
+
P->>T: Authorization code request to /authorize
|
|
114
|
+
T->>U: Redirect to login/authorization prompt
|
|
115
|
+
U-->>T: Authenticate and Consent
|
|
116
|
+
T->>W: Authorization code
|
|
117
|
+
W->>W: Select first available AuthPlugin
|
|
118
|
+
W->>P: Login
|
|
119
|
+
P->>T: Authorization Code + Client ID + Client Secret to /oauth/token
|
|
120
|
+
T->>T: Validate Authorization Code + Client ID + Client Secret
|
|
121
|
+
T-->>P: ID Token and Access Token
|
|
122
|
+
P->>J: client.login(token)
|
|
123
|
+
J-->>P: Login success
|
|
124
|
+
P-->>W: Login success
|
|
125
|
+
```
|
|
126
|
+
|
|
11
127
|
# Legal Notices
|
|
12
128
|
|
|
13
129
|
Deephaven Data Labs and any contributors grant you a license to the content of this repository under the Apache 2.0 License, see the [LICENSE](../../LICENSE) file.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deephaven/auth-plugins",
|
|
3
|
-
"version": "0.44.
|
|
3
|
+
"version": "0.44.2-plugin-cleanup.3+218cf522",
|
|
4
4
|
"description": "Deephaven Auth Plugins",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Deephaven",
|
|
@@ -33,14 +33,14 @@
|
|
|
33
33
|
"build:sass": "sass --embed-sources --load-path=../../node_modules ./src:./dist"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@deephaven/components": "^0.44.
|
|
37
|
-
"@deephaven/jsapi-bootstrap": "^0.44.
|
|
38
|
-
"@deephaven/jsapi-components": "^0.44.
|
|
39
|
-
"@deephaven/jsapi-types": "^0.44.
|
|
40
|
-
"@deephaven/jsapi-utils": "^0.44.
|
|
41
|
-
"@deephaven/log": "^0.44.
|
|
42
|
-
"@deephaven/redux": "^0.44.
|
|
43
|
-
"@deephaven/utils": "^0.44.
|
|
36
|
+
"@deephaven/components": "^0.44.2-plugin-cleanup.3+218cf522",
|
|
37
|
+
"@deephaven/jsapi-bootstrap": "^0.44.2-plugin-cleanup.3+218cf522",
|
|
38
|
+
"@deephaven/jsapi-components": "^0.44.2-plugin-cleanup.3+218cf522",
|
|
39
|
+
"@deephaven/jsapi-types": "^0.44.2-plugin-cleanup.3+218cf522",
|
|
40
|
+
"@deephaven/jsapi-utils": "^0.44.2-plugin-cleanup.3+218cf522",
|
|
41
|
+
"@deephaven/log": "^0.44.2-plugin-cleanup.3+218cf522",
|
|
42
|
+
"@deephaven/redux": "^0.44.2-plugin-cleanup.3+218cf522",
|
|
43
|
+
"@deephaven/utils": "^0.44.2-plugin-cleanup.3+218cf522",
|
|
44
44
|
"classnames": "^2.3.1",
|
|
45
45
|
"js-cookie": "^3.0.5",
|
|
46
46
|
"react-transition-group": "^4.4.2"
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"publishConfig": {
|
|
60
60
|
"access": "public"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "218cf5224bcba3734025749fe55b1161bc3bb4a6"
|
|
63
63
|
}
|