carta-controller 3.0.1 → 4.0.0-beta.1
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/.prettierrc.json +0 -1
- package/README.md +2 -2
- package/config/config_schema.json +147 -0
- package/config/workspace_schema_1.json +255 -0
- package/dist/auth/index.js +25 -2
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/ldap.js +3 -4
- package/dist/auth/ldap.js.map +1 -1
- package/dist/auth/local.js +2 -2
- package/dist/auth/local.js.map +1 -1
- package/dist/auth/oidc.js +370 -0
- package/dist/auth/oidc.js.map +1 -0
- package/dist/auth/oidcRefreshManager.js +225 -0
- package/dist/auth/oidcRefreshManager.js.map +1 -0
- package/dist/auth/pam.js +2 -2
- package/dist/auth/pam.js.map +1 -1
- package/dist/controllerTests.js +4 -5
- package/dist/database.js +162 -14
- package/dist/index.js +11 -8
- package/dist/util.js +33 -1
- package/docs/_build/doctrees/centos8_instructions.doctree +0 -0
- package/docs/_build/doctrees/configuration.doctree +0 -0
- package/docs/_build/doctrees/environment.pickle +0 -0
- package/docs/_build/doctrees/index.doctree +0 -0
- package/docs/_build/doctrees/introduction.doctree +0 -0
- package/docs/_build/doctrees/schema.doctree +0 -0
- package/docs/_build/html/.buildinfo +1 -1
- package/docs/_build/html/_sources/centos8_instructions.rst.txt +2 -3
- package/docs/_build/html/_sources/configuration.rst.txt +8 -2
- package/docs/_build/html/_sources/index.rst.txt +3 -3
- package/docs/_build/html/_sources/introduction.rst.txt +1 -1
- package/docs/_build/html/_static/config/config_schema.json +147 -0
- package/docs/_build/html/_static/config/workspace_schema_1.json +255 -0
- package/docs/_build/html/_static/documentation_options.js +1 -1
- package/docs/_build/html/centos8_instructions.html +55 -56
- package/docs/_build/html/configuration.html +90 -86
- package/docs/_build/html/genindex.html +2 -2
- package/docs/_build/html/index.html +4 -3
- package/docs/_build/html/installation.html +2 -2
- package/docs/_build/html/introduction.html +3 -3
- package/docs/_build/html/objects.inv +0 -0
- package/docs/_build/html/schema.html +280 -3
- package/docs/_build/html/schema_backend.html +2 -2
- package/docs/_build/html/search.html +2 -2
- package/docs/_build/html/searchindex.js +1 -1
- package/docs/_build/html/ubuntu_focal_instructions.html +22 -22
- package/docs/src/centos8_instructions.rst +4 -5
- package/docs/src/conf.py +2 -2
- package/docs/src/configuration.rst +11 -5
- package/docs/src/index.rst +3 -3
- package/docs/src/installation.rst +1 -1
- package/docs/src/introduction.rst +1 -1
- package/docs/src/ubuntu_focal_instructions.rst +3 -3
- package/package.json +18 -16
- package/public/dashboard.js +21 -3
- package/views/templated.pug +10 -7
package/.prettierrc.json
CHANGED
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# CARTA Controller
|
|
2
2
|
|
|
3
|
-
[](https://github.com/CARTAvis/carta-backend/releases/tag/v3.0.0)
|
|
4
|
-
[](https://npmjs.org/package/carta-controller "View this project on npm")
|
|
3
|
+
[](https://github.com/CARTAvis/carta-backend/releases/tag/v3.0.0-beta.3)
|
|
4
|
+
[](https://npmjs.org/package/carta-controller "View this project on npm")
|
|
5
5
|

|
|
6
6
|

|
|
7
7
|
|
|
@@ -341,6 +341,149 @@
|
|
|
341
341
|
]
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
|
+
},
|
|
345
|
+
"oidcAuthProvider": {
|
|
346
|
+
"title": "OpenID Connect AuthProvider",
|
|
347
|
+
"description": "OpenID Connect authentication configuration",
|
|
348
|
+
"type": "object",
|
|
349
|
+
"additionalProperties": false,
|
|
350
|
+
"required": [
|
|
351
|
+
"idpUrl",
|
|
352
|
+
"uniqueField",
|
|
353
|
+
"clientId",
|
|
354
|
+
"scope",
|
|
355
|
+
"localPublicKeyLocation",
|
|
356
|
+
"localPrivateKeyLocation",
|
|
357
|
+
"keyAlgorithm",
|
|
358
|
+
"issuer",
|
|
359
|
+
"symmetricKeyLocation"
|
|
360
|
+
],
|
|
361
|
+
"properties": {
|
|
362
|
+
"idpUrl": {
|
|
363
|
+
"description": "Base URL for identity provider endpoint",
|
|
364
|
+
"type": "string",
|
|
365
|
+
"format": "uri",
|
|
366
|
+
"pattern": "^https?://",
|
|
367
|
+
"examples": [
|
|
368
|
+
"https://domain.xyz/auth/realms/example"
|
|
369
|
+
]
|
|
370
|
+
},
|
|
371
|
+
"uniqueField": {
|
|
372
|
+
"description": "Name of unique field to use as user ID. Note that as per the OpenID Connect specification only sub/issuer combination is guaranteed to be stable and unique for an arbitrary issuer, though other values such as preferred_username may be usable when the team running the CARTA installation and the issuer are the same.",
|
|
373
|
+
"type": "string",
|
|
374
|
+
"examples": [
|
|
375
|
+
"sub",
|
|
376
|
+
"preferred_username"
|
|
377
|
+
],
|
|
378
|
+
"default": "sub"
|
|
379
|
+
},
|
|
380
|
+
"clientId": {
|
|
381
|
+
"description": "Client ID as registered with identity provider",
|
|
382
|
+
"type": "string",
|
|
383
|
+
"minLength": 1,
|
|
384
|
+
"examples": [
|
|
385
|
+
"carta"
|
|
386
|
+
]
|
|
387
|
+
},
|
|
388
|
+
"clientSecret": {
|
|
389
|
+
"description": "Client secret as registered with identity provider",
|
|
390
|
+
"type": "string",
|
|
391
|
+
"minLength": 1
|
|
392
|
+
},
|
|
393
|
+
"scope": {
|
|
394
|
+
"description": "Scopes to request from the OpenID Connect server",
|
|
395
|
+
"type": "string",
|
|
396
|
+
"default": "openid",
|
|
397
|
+
"examples": [
|
|
398
|
+
"openid",
|
|
399
|
+
"openid groups"
|
|
400
|
+
]
|
|
401
|
+
},
|
|
402
|
+
"userLookupTable": {
|
|
403
|
+
"description": "Path of user lookup table as text file in format <unique user ID> <system user>. If no user lookup is needed, this should be omitted. Example table given in `usertable.txt.stub`",
|
|
404
|
+
"type": "string",
|
|
405
|
+
"examples": [
|
|
406
|
+
"/etc/carta/userlookup.txt"
|
|
407
|
+
]
|
|
408
|
+
},
|
|
409
|
+
"groupsField": {
|
|
410
|
+
"description": "Name of field containing list of user roles/groups",
|
|
411
|
+
"type": "string",
|
|
412
|
+
"examples": [
|
|
413
|
+
"groups",
|
|
414
|
+
"roles"
|
|
415
|
+
]
|
|
416
|
+
},
|
|
417
|
+
"requiredGroup": {
|
|
418
|
+
"description": "Role to ensure is included among the values in groupsField",
|
|
419
|
+
"type": "string",
|
|
420
|
+
"examples": [
|
|
421
|
+
"carta-users",
|
|
422
|
+
"carta-testers"
|
|
423
|
+
]
|
|
424
|
+
},
|
|
425
|
+
"localPublicKeyLocation": {
|
|
426
|
+
"description": "Path to public key (in PEM format) used for verifying JWTs",
|
|
427
|
+
"type": "string",
|
|
428
|
+
"examples": [
|
|
429
|
+
"/etc/carta/carta_public.pem"
|
|
430
|
+
]
|
|
431
|
+
},
|
|
432
|
+
"localPrivateKeyLocation": {
|
|
433
|
+
"description": "Path to private key (in PEM format) used for signing JWTs",
|
|
434
|
+
"type": "string",
|
|
435
|
+
"examples": [
|
|
436
|
+
"/etc/carta/carta_private.pem"
|
|
437
|
+
]
|
|
438
|
+
},
|
|
439
|
+
"keyAlgorithm": {
|
|
440
|
+
"$ref": "#/definitions/keyAlgorithm",
|
|
441
|
+
"default": "RS256"
|
|
442
|
+
},
|
|
443
|
+
"issuer": {
|
|
444
|
+
"description": "Issuer field for JWT",
|
|
445
|
+
"type": "string",
|
|
446
|
+
"examples": [
|
|
447
|
+
"my-carta-server"
|
|
448
|
+
]
|
|
449
|
+
},
|
|
450
|
+
"cacheAccessTokenMinValidity": {
|
|
451
|
+
"description": "If an access token was previously issued from the upstream server with at least this many seconds of lifetime remaining, a new upstream query will not be performed and a local token with the previous token's remaining lifetime will be issued instead",
|
|
452
|
+
"type": "integer",
|
|
453
|
+
"default": 100
|
|
454
|
+
},
|
|
455
|
+
"symmetricKeyLocation": {
|
|
456
|
+
"description": "Path to symmetric key (base64-encoded) used for refresh tokens. At present this uses the A256GCM algorithm which requires 32 bytes of random data which can be generated using `openssl rand -base64 32`",
|
|
457
|
+
"type": "string",
|
|
458
|
+
"examples": [
|
|
459
|
+
"/etc/carta/carta_symmetric.pem"
|
|
460
|
+
]
|
|
461
|
+
},
|
|
462
|
+
"symmetricKeyType": {
|
|
463
|
+
"description": "Selected from the 'JSON Web Signature and Encryption Algorithms' section of https://www.iana.org/assignments/jose/jose.xhtml",
|
|
464
|
+
"type": "string",
|
|
465
|
+
"default": "A256GCM"
|
|
466
|
+
},
|
|
467
|
+
"additionalAuthParams": {
|
|
468
|
+
"description": "Additional parameters to include in authentication requests to deal with identity providers. The example contains the additional arguments required to ensure that Google provide a refresh token when using it with OIDC.",
|
|
469
|
+
"type": "array",
|
|
470
|
+
"default": [],
|
|
471
|
+
"examples": [
|
|
472
|
+
[[["access_type", "offline"], ["prompt", "consent"]]]
|
|
473
|
+
],
|
|
474
|
+
"items": {
|
|
475
|
+
"type": "array",
|
|
476
|
+
"minItems": 2,
|
|
477
|
+
"maxItems": 2
|
|
478
|
+
}
|
|
479
|
+
},
|
|
480
|
+
"postLogoutRedirect": {
|
|
481
|
+
"description": "Optional parameter for specifying an alternate address to redirect to after logout",
|
|
482
|
+
"type": "string",
|
|
483
|
+
"format": "uri-reference",
|
|
484
|
+
"examples": ["https://my-organisation.com/"]
|
|
485
|
+
}
|
|
486
|
+
}
|
|
344
487
|
}
|
|
345
488
|
},
|
|
346
489
|
"additionalProperties": false,
|
|
@@ -369,6 +512,10 @@
|
|
|
369
512
|
"external": {
|
|
370
513
|
"description": "External AuthProvider",
|
|
371
514
|
"$ref": "#/definitions/externalAuthProvider"
|
|
515
|
+
},
|
|
516
|
+
"oidc": {
|
|
517
|
+
"description": "OpenID Connect AuthProvider",
|
|
518
|
+
"$ref": "#/definitions/oidcAuthProvider"
|
|
372
519
|
}
|
|
373
520
|
},
|
|
374
521
|
"default": {
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"title": "Workspace",
|
|
4
|
+
"description": "Schema for CARTA Workspaces (Version 1)",
|
|
5
|
+
"$id": "carta_workspace_1",
|
|
6
|
+
"definitions": {
|
|
7
|
+
"render-config": {
|
|
8
|
+
"type": "object",
|
|
9
|
+
"properties": {
|
|
10
|
+
"scaling": {
|
|
11
|
+
"type": "integer",
|
|
12
|
+
"minimum": 0,
|
|
13
|
+
"maximum": 7
|
|
14
|
+
},
|
|
15
|
+
"colorMap": {
|
|
16
|
+
"type": "string"
|
|
17
|
+
},
|
|
18
|
+
"bias": {
|
|
19
|
+
"type": "number"
|
|
20
|
+
},
|
|
21
|
+
"contrast": {
|
|
22
|
+
"type": "number"
|
|
23
|
+
},
|
|
24
|
+
"gamma": {
|
|
25
|
+
"type": "number"
|
|
26
|
+
},
|
|
27
|
+
"alpha": {
|
|
28
|
+
"type": "number"
|
|
29
|
+
},
|
|
30
|
+
"inverted": {
|
|
31
|
+
"type": "boolean"
|
|
32
|
+
},
|
|
33
|
+
"scaleMin": {
|
|
34
|
+
"type": "array",
|
|
35
|
+
"items": {
|
|
36
|
+
"type": "number"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"scaleMax": {
|
|
40
|
+
"type": "array",
|
|
41
|
+
"items": {
|
|
42
|
+
"type": "number"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"selectedPercentile": {
|
|
46
|
+
"type": "array",
|
|
47
|
+
"items": {
|
|
48
|
+
"type": "number",
|
|
49
|
+
"maximum": 100,
|
|
50
|
+
"minimum": -1
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"contour-config": {
|
|
56
|
+
"type": "object",
|
|
57
|
+
"properties": {
|
|
58
|
+
"scaling": {
|
|
59
|
+
"type": "integer",
|
|
60
|
+
"minimum": 0,
|
|
61
|
+
"maximum": 7
|
|
62
|
+
},
|
|
63
|
+
"colorMap": {
|
|
64
|
+
"type": "string"
|
|
65
|
+
},
|
|
66
|
+
"bias": {
|
|
67
|
+
"type": "number"
|
|
68
|
+
},
|
|
69
|
+
"contrast": {
|
|
70
|
+
"type": "number"
|
|
71
|
+
},
|
|
72
|
+
"gamma": {
|
|
73
|
+
"type": "number"
|
|
74
|
+
},
|
|
75
|
+
"alpha": {
|
|
76
|
+
"type": "number"
|
|
77
|
+
},
|
|
78
|
+
"inverted": {
|
|
79
|
+
"type": "boolean"
|
|
80
|
+
},
|
|
81
|
+
"scaleMin": {
|
|
82
|
+
"type": "array",
|
|
83
|
+
"items": {
|
|
84
|
+
"type": "number"
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
"scaleMax": {
|
|
88
|
+
"type": "array",
|
|
89
|
+
"items": {
|
|
90
|
+
"type": "number"
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
"selectedPercentile": {
|
|
94
|
+
"type": "array",
|
|
95
|
+
"items": {
|
|
96
|
+
"type": "number",
|
|
97
|
+
"maximum": 100,
|
|
98
|
+
"minimum": -1
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"vector-overlay-config": {
|
|
104
|
+
"type": "object",
|
|
105
|
+
"properties": {
|
|
106
|
+
"scaling": {
|
|
107
|
+
"type": "integer",
|
|
108
|
+
"minimum": 0,
|
|
109
|
+
"maximum": 7
|
|
110
|
+
},
|
|
111
|
+
"colorMap": {
|
|
112
|
+
"type": "string"
|
|
113
|
+
},
|
|
114
|
+
"bias": {
|
|
115
|
+
"type": "number"
|
|
116
|
+
},
|
|
117
|
+
"contrast": {
|
|
118
|
+
"type": "number"
|
|
119
|
+
},
|
|
120
|
+
"gamma": {
|
|
121
|
+
"type": "number"
|
|
122
|
+
},
|
|
123
|
+
"alpha": {
|
|
124
|
+
"type": "number"
|
|
125
|
+
},
|
|
126
|
+
"inverted": {
|
|
127
|
+
"type": "boolean"
|
|
128
|
+
},
|
|
129
|
+
"scaleMin": {
|
|
130
|
+
"type": "array",
|
|
131
|
+
"items": {
|
|
132
|
+
"type": "number"
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
"scaleMax": {
|
|
136
|
+
"type": "array",
|
|
137
|
+
"items": {
|
|
138
|
+
"type": "number"
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
"selectedPercentile": {
|
|
142
|
+
"type": "array",
|
|
143
|
+
"items": {
|
|
144
|
+
"type": "number",
|
|
145
|
+
"maximum": 100,
|
|
146
|
+
"minimum": -1
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
"references": {
|
|
152
|
+
"type": "object",
|
|
153
|
+
"properties": {
|
|
154
|
+
"spatial": {
|
|
155
|
+
"description": "ID of the spatial reference file",
|
|
156
|
+
"type": "integer",
|
|
157
|
+
"minimum": 0
|
|
158
|
+
},
|
|
159
|
+
"spectral": {
|
|
160
|
+
"description": "ID of the spectral reference file",
|
|
161
|
+
"type": "integer",
|
|
162
|
+
"minimum": 0
|
|
163
|
+
},
|
|
164
|
+
"raster": {
|
|
165
|
+
"description": "ID of the raster reference file",
|
|
166
|
+
"type": "integer",
|
|
167
|
+
"minimum": 0
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
"file": {
|
|
172
|
+
"type": "object",
|
|
173
|
+
"required": [
|
|
174
|
+
"id",
|
|
175
|
+
"directory",
|
|
176
|
+
"filename"
|
|
177
|
+
],
|
|
178
|
+
"properties": {
|
|
179
|
+
"id": {
|
|
180
|
+
"description": "ID of the file",
|
|
181
|
+
"type": "integer",
|
|
182
|
+
"minimum": 0
|
|
183
|
+
},
|
|
184
|
+
"directory": {
|
|
185
|
+
"description": "Directory of the file, relative to the top-level folder",
|
|
186
|
+
"type": "string"
|
|
187
|
+
},
|
|
188
|
+
"filename": {
|
|
189
|
+
"description": "Name of the file",
|
|
190
|
+
"type": "string"
|
|
191
|
+
},
|
|
192
|
+
"hdu": {
|
|
193
|
+
"description": "HDU to load. If none is specified, the first image HDU will be used",
|
|
194
|
+
"type": "string"
|
|
195
|
+
},
|
|
196
|
+
"renderConfig": {
|
|
197
|
+
"$ref": "#/definitions/render-config"
|
|
198
|
+
},
|
|
199
|
+
"contourConfig": {
|
|
200
|
+
"$ref": "#/definitions/contour-config"
|
|
201
|
+
},
|
|
202
|
+
"vectorOverlayConfig": {
|
|
203
|
+
"$ref": "#/definitions/vector-overlay-config"
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
"required": [
|
|
209
|
+
"workspaceVersion",
|
|
210
|
+
"frontendVersion",
|
|
211
|
+
"files"
|
|
212
|
+
],
|
|
213
|
+
"properties": {
|
|
214
|
+
"workspaceVersion": {
|
|
215
|
+
"description": "The version of the workspace contained",
|
|
216
|
+
"type": "integer",
|
|
217
|
+
"minimum": 0
|
|
218
|
+
},
|
|
219
|
+
"frontendVersion": {
|
|
220
|
+
"description": "The version of the frontend targeted by this workspace",
|
|
221
|
+
"type": "string"
|
|
222
|
+
},
|
|
223
|
+
"description": {
|
|
224
|
+
"description": "Optional workspace description",
|
|
225
|
+
"type": "string"
|
|
226
|
+
},
|
|
227
|
+
"name": {
|
|
228
|
+
"description": "Optional workspace name. Filename will be used if this is missing",
|
|
229
|
+
"type": "string"
|
|
230
|
+
},
|
|
231
|
+
"shared": {
|
|
232
|
+
"description": "Whether workspace is shared across multiple users",
|
|
233
|
+
"type": "boolean"
|
|
234
|
+
},
|
|
235
|
+
"files": {
|
|
236
|
+
"type": "array",
|
|
237
|
+
"items": {
|
|
238
|
+
"$ref": "#/definitions/file"
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
"selectedFile": {
|
|
242
|
+
"description": "ID of the currently active file",
|
|
243
|
+
"type": "number"
|
|
244
|
+
},
|
|
245
|
+
"thumbnail": {
|
|
246
|
+
"description": "A base64-encoded JPEG",
|
|
247
|
+
"type": "string",
|
|
248
|
+
"contentEncoding": "base64",
|
|
249
|
+
"contentMediaType": "image/jpeg"
|
|
250
|
+
},
|
|
251
|
+
"references": {
|
|
252
|
+
"$ref": "#/definitions/references"
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
package/dist/auth/index.js
CHANGED
|
@@ -16,6 +16,7 @@ const util_1 = require("../util");
|
|
|
16
16
|
const config_1 = require("../config");
|
|
17
17
|
const external_1 = require("./external");
|
|
18
18
|
const local_1 = require("./local");
|
|
19
|
+
const oidc_1 = require("./oidc");
|
|
19
20
|
const ldap_1 = require("./ldap");
|
|
20
21
|
const pam_1 = require("./pam");
|
|
21
22
|
const google_1 = require("./google");
|
|
@@ -29,6 +30,9 @@ let loginHandler = (req, res) => {
|
|
|
29
30
|
let refreshHandler = (req, res) => {
|
|
30
31
|
throw { statusCode: 501, message: "Token refresh not implemented" };
|
|
31
32
|
};
|
|
33
|
+
let callbackHandler = (req, res) => {
|
|
34
|
+
throw { statusCode: 501, message: "Token refresh not implemented" };
|
|
35
|
+
};
|
|
32
36
|
// Local providers
|
|
33
37
|
if (config_1.ServerConfig.authProviders.pam) {
|
|
34
38
|
const authConf = config_1.ServerConfig.authProviders.pam;
|
|
@@ -57,6 +61,18 @@ else if (config_1.ServerConfig.authProviders.external) {
|
|
|
57
61
|
(0, external_1.watchUserTable)(userMaps, authConf.issuers, tablePath);
|
|
58
62
|
}
|
|
59
63
|
}
|
|
64
|
+
else if (config_1.ServerConfig.authProviders.oidc) {
|
|
65
|
+
const authConf = config_1.ServerConfig.authProviders.oidc;
|
|
66
|
+
(0, oidc_1.generateLocalOidcVerifier)(tokenVerifiers, authConf);
|
|
67
|
+
refreshHandler = (0, oidc_1.generateLocalOidcRefreshHandler)(authConf);
|
|
68
|
+
loginHandler = (req, res) => (0, oidc_1.oidcLoginStart)(req, res, authConf);
|
|
69
|
+
callbackHandler = (req, res) => (0, oidc_1.oidcCallbackHandler)(req, res, authConf);
|
|
70
|
+
(0, oidc_1.initOidc)(authConf);
|
|
71
|
+
if (authConf.userLookupTable) {
|
|
72
|
+
console.log(`Using ${authConf.userLookupTable} for user mapping`);
|
|
73
|
+
(0, external_1.watchUserTable)(userMaps, authConf.issuer, authConf.userLookupTable);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
60
76
|
// Check for empty token verifies
|
|
61
77
|
if (!tokenVerifiers.size) {
|
|
62
78
|
console.error("No valid token verifiers specified");
|
|
@@ -130,8 +146,15 @@ function handleCheckAuth(req, res) {
|
|
|
130
146
|
});
|
|
131
147
|
}
|
|
132
148
|
exports.authRouter = express.Router();
|
|
133
|
-
|
|
134
|
-
exports.authRouter.
|
|
149
|
+
if (config_1.ServerConfig.authProviders.oidc) {
|
|
150
|
+
exports.authRouter.get("/logout", util_1.noCache, oidc_1.oidcLogoutHandler);
|
|
151
|
+
exports.authRouter.get("/oidcCallback", util_1.noCache, callbackHandler);
|
|
152
|
+
exports.authRouter.get("/login", util_1.noCache, loginHandler);
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
exports.authRouter.post("/login", util_1.noCache, loginHandler);
|
|
156
|
+
exports.authRouter.post("/logout", util_1.noCache, logoutHandler);
|
|
157
|
+
}
|
|
135
158
|
exports.authRouter.post("/refresh", util_1.noCache, refreshHandler);
|
|
136
159
|
exports.authRouter.get("/status", authGuard, util_1.noCache, handleCheckAuth);
|
|
137
160
|
//# sourceMappingURL=index.js.map
|
package/dist/auth/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oCAAoC;AACpC,mCAAmC;AACnC,kCAAgC;AAEhC,sCAAsD;AACtD,yCAAqE;AACrE,mCAA2E;AAC3E,iCAA2C;AAC3C,+BAAyC;AACzC,qCAAoE;AAEpE,2CAA2C;AAC3C,MAAM,cAAc,GAAG,IAAI,GAAG,EAAoB,CAAC;AACnD,qCAAqC;AACrC,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAmB,CAAC;AAE5C,IAAI,YAAY,GAAmB,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;IAC5C,MAAM,EAAC,U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QACL,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,GAAG,CAAC,QAAQ;KACzB,CAAC,CAAC;AACP,CAAC;AAEY,QAAA,UAAU,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;AAC3C,IAAI,qBAAY,CAAC,aAAa,CAAC,IAAI,EAAE;IACjC,kBAAU,CAAC,GAAG,CAAC,SAAS,EAAE,cAAO,EAAE,wBAAiB,CAAC,CAAC;IACtD,kBAAU,CAAC,GAAG,CAAC,eAAe,EAAE,cAAO,EAAE,eAAe,CAAC,CAAC;IAC1D,kBAAU,CAAC,GAAG,CAAC,QAAQ,EAAE,cAAO,EAAE,YAAY,CAAC,CAAC;CACnD;KACI;IACD,kBAAU,CAAC,IAAI,CAAC,QAAQ,EAAE,cAAO,EAAE,YAAY,CAAC,CAAC;IACjD,kBAAU,CAAC,IAAI,CAAC,SAAS,EAAE,cAAO,EAAE,aAAa,CAAC,CAAC;CACtD;AACD,kBAAU,CAAC,IAAI,CAAC,UAAU,EAAE,cAAO,EAAE,cAAc,CAAC,CAAC;AACrD,kBAAU,CAAC,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,cAAO,EAAE,eAAe,CAAC,CAAC"}
|
package/dist/auth/ldap.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getLdapLoginHandler = void 0;
|
|
4
|
-
const userid = require("userid");
|
|
5
4
|
const LdapAuth = require("ldapauth-fork");
|
|
6
5
|
const local_1 = require("./local");
|
|
7
6
|
const util_1 = require("../util");
|
|
@@ -10,8 +9,8 @@ function getLdapLoginHandler(authConf) {
|
|
|
10
9
|
ldap = new LdapAuth(authConf.ldapOptions);
|
|
11
10
|
ldap.on("error", err => console.error("LdapAuth: ", err));
|
|
12
11
|
setTimeout(() => {
|
|
13
|
-
var _a
|
|
14
|
-
const ldapConnected = (
|
|
12
|
+
var _a;
|
|
13
|
+
const ldapConnected = (_a = ldap === null || ldap === void 0 ? void 0 : ldap._userClient) === null || _a === void 0 ? void 0 : _a.connected;
|
|
15
14
|
if (ldapConnected) {
|
|
16
15
|
console.log("LDAP connected correctly");
|
|
17
16
|
}
|
|
@@ -36,7 +35,7 @@ function getLdapLoginHandler(authConf) {
|
|
|
36
35
|
(0, util_1.verboseLog)(user);
|
|
37
36
|
}
|
|
38
37
|
try {
|
|
39
|
-
const uid =
|
|
38
|
+
const uid = (0, util_1.getUserId)(username);
|
|
40
39
|
console.log(`Authenticated as user ${username} with uid ${uid} using LDAP`);
|
|
41
40
|
return (0, local_1.addTokensToResponse)(res, authConf, username);
|
|
42
41
|
}
|
package/dist/auth/ldap.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ldap.js","sourceRoot":"","sources":["../../src/auth/ldap.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"ldap.js","sourceRoot":"","sources":["../../src/auth/ldap.ts"],"names":[],"mappings":";;;AACA,0CAA0C;AAE1C,mCAA4C;AAC5C,kCAA4D;AAE5D,IAAI,IAAc,CAAC;AAEnB,SAAgB,mBAAmB,CAAC,QAA6B;IAC7D,IAAI,GAAG,IAAI,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IAC1C,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC,CAAC;IAC1D,UAAU,CAAC,GAAG,EAAE;;QACZ,MAAM,aAAa,GAAG,MAAC,IAAY,aAAZ,IAAI,uBAAJ,IAAI,CAAU,WAAW,0CAAE,SAAS,CAAC;QAC5D,IAAI,aAAa,EAAE;YACf,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;SAC3C;aAAM;YACH,OAAO,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;SACxC;IACL,CAAC,EAAE,IAAI,C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AAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAC,UAAU,EAAE,GAAG,EAAE,OAAO,EAAE,qBAAqB,EAAC,CAAC,CAAC;aAClF;QACL,CAAC,CAAC;QAEF,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;;YAClD,MAAM,QAAQ,GAAG,KAAc,CAAC;YAChC,oDAAoD;YACpD,IAAI,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,0CAAE,QAAQ,CAAC,8BAA8B,CAAC,EAAE;gBAC1D,OAAO,CAAC,GAAG,CAAC,yDAAyD,CAAC,CAAC;gBACvE,IAAI,CAAC,KAAK,EAAE,CAAC;gBACb,IAAI,GAAG,IAAI,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;gBAC1C,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC,CAAC;gBAC1D,+CAA+C;gBAC/C,UAAU,CAAC,GAAG,EAAE;oBACZ,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;gBACtD,CAAC,EAAE,GAAG,CAAC,CAAC;aACX;iBAAM;gBACH,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;aAC3B;QACL,CAAC,CAAC,CAAC;IACP,CAAC,CAAC;AACN,CAAC;AAxDD,kDAwDC"}
|
package/dist/auth/local.js
CHANGED
|
@@ -13,10 +13,10 @@ exports.generateLocalRefreshHandler = exports.generateLocalVerifier = exports.ad
|
|
|
13
13
|
const types_1 = require("../types");
|
|
14
14
|
const fs = require("fs");
|
|
15
15
|
const jwt = require("jsonwebtoken");
|
|
16
|
-
const userid = require("userid");
|
|
17
16
|
const index_1 = require("./index");
|
|
18
17
|
const config_1 = require("../config");
|
|
19
18
|
const ms = require("ms");
|
|
19
|
+
const util_1 = require("../util");
|
|
20
20
|
let privateKey;
|
|
21
21
|
var TokenType;
|
|
22
22
|
(function (TokenType) {
|
|
@@ -95,7 +95,7 @@ function generateLocalRefreshHandler(authConf) {
|
|
|
95
95
|
next({ statusCode: 500, message: "Scripting access not enabled for this server" });
|
|
96
96
|
}
|
|
97
97
|
else {
|
|
98
|
-
const uid =
|
|
98
|
+
const uid = (0, util_1.getUserId)(refreshToken.username);
|
|
99
99
|
const access_token = generateToken(authConf, refreshToken.username, scriptingToken ? TokenType.Scripting : TokenType.Access);
|
|
100
100
|
console.log(`Refreshed ${scriptingToken ? "scripting" : "access"} token for user ${refreshToken.username} with uid ${uid}`);
|
|
101
101
|
res.json({
|
package/dist/auth/local.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local.js","sourceRoot":"","sources":["../../src/auth/local.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oCAA+F;AAC/F,yBAAyB;AACzB,oCAAoC;AAGpC,
|
|
1
|
+
{"version":3,"file":"local.js","sourceRoot":"","sources":["../../src/auth/local.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oCAA+F;AAC/F,yBAAyB;AACzB,oCAAoC;AAGpC,mCAAoC;AACpC,sCAAsD;AACtD,yBAA0B;AAC1B,kCAAkC;AAElC,IAAI,UAAkB,CAAC;AAEvB,IAAY,SAIX;AAJD,WAAY,SAAS;IACjB,6CAAM,CAAA;IACN,+CAAO,CAAA;IACP,mDAAS,CAAA;AACb,CAAC,EAJW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAIpB;AAED,SAAgB,aAAa,CAAC,QAA8B,EAAE,QAAgB,EAAE,SAAoB;IAChG,IAAI,CAAC,UAAU,EAAE;QACb,UAAU,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC;KAC7D;IACD,IAAI,CAAC,QAAQ,IAAI,CAAC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