scimgateway 5.1.8 → 5.2.0
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 +136 -10
- package/bun.lock +669 -638
- package/lib/logger.ts +287 -159
- package/lib/plugin-api.ts +5 -5
- package/lib/plugin-entra-id.ts +9 -9
- package/lib/plugin-ldap.ts +9 -9
- package/lib/plugin-loki.ts +8 -8
- package/lib/plugin-mongodb.ts +11 -11
- package/lib/plugin-mssql.ts +8 -8
- package/lib/plugin-saphana.ts +8 -8
- package/lib/plugin-scim.ts +8 -8
- package/lib/plugin-soap.ts +8 -8
- package/lib/scim-stream.js +1 -1
- package/lib/scimgateway.ts +155 -62
- package/lib/utils-scim.ts +1 -1
- package/package.json +11 -12
package/README.md
CHANGED
|
@@ -16,6 +16,11 @@ Validated through IdP's:
|
|
|
16
16
|
|
|
17
17
|
Latest news:
|
|
18
18
|
|
|
19
|
+
- Centralized logging and monitoring through online log subscription
|
|
20
|
+
using browser and url: https://host/logger
|
|
21
|
+
curl -N https://host/logger -u gwread:password
|
|
22
|
+
curl -N https://host/logger -H "Authorization: Bearer secret"
|
|
23
|
+
custom client API, see configuration notes
|
|
19
24
|
- By configuring the chainingBaseUrl, it is now possible to chain multiple gateways in sequence, such as `gateway1->gateway2->gateway3->endpoint`. In this setup, gateway beave much like a reverse proxy, validating authorization at each step unless PassThrough mode is enabled. Chaining is also supported in stream subscriber mode
|
|
20
25
|
- Email, onError and sendMail() supports more secure RESTful OAuth for Microsoft Exchange Online (ExO) and Google Workspace Gmail, alongside traditional SMTP Auth for all mail systems. HelperRest supports a wide range of common authentication methods, including basicAuth, bearerAuth, tokenAuth, oauth, oauthSamlBearer, oauthJwtBearer and Auth PassTrough
|
|
21
26
|
- Major version **v5.0.0** marks a shift to native TypeScript support and prioritizes [Bun](https://bun.sh/) over Node.js. This upgrade requires some modifications to existing plugins.
|
|
@@ -128,10 +133,13 @@ If internet connection is blocked, we could install on another machine and copy
|
|
|
128
133
|
http://localhost:8880/ping
|
|
129
134
|
=> Health check with a "hello" response
|
|
130
135
|
|
|
131
|
-
http://localhost:8880/Users
|
|
132
|
-
http://localhost:8880/Groups
|
|
136
|
+
http://localhost:8880/Users
|
|
137
|
+
http://localhost:8880/Groups
|
|
133
138
|
=> Logon using gwadmin/password and two users and groups should be listed
|
|
134
139
|
|
|
140
|
+
Start a new browser for log monitoring (info level)
|
|
141
|
+
using url: http://localhost:8880/logger
|
|
142
|
+
|
|
135
143
|
http://localhost:8880/Users/bjensen
|
|
136
144
|
http://localhost:8880/Groups/Admins
|
|
137
145
|
or
|
|
@@ -139,12 +147,12 @@ If internet connection is blocked, we could install on another machine and copy
|
|
|
139
147
|
http://localhost:8880/Groups?filter=displayName eq "Admins"
|
|
140
148
|
=> Lists all attributes for specified user/group
|
|
141
149
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
150
|
+
http://localhost:8880/Groups?filter=displayName eq "Admins"&excludedAttributes=members
|
|
151
|
+
http://localhost:8880/Groups?filter=members.value eq "bjensen"&attributes=id,displayName,members.value
|
|
152
|
+
http://localhost:8880/Users?filter=userName eq "bjensen"&attributes=userName,id,name.givenName
|
|
153
|
+
http://localhost:8880/Users?filter=meta.created ge "2010-01-01T00:00:00Z"&attributes=userName,name.familyName,meta.created
|
|
154
|
+
http://localhost:8880/Users?filter=emails.value co "@example.com"&attributes=userName,name.familyName,emails&sortBy=name.familyName&sortOrder=descending
|
|
155
|
+
=> Filtering and attribute examples
|
|
148
156
|
|
|
149
157
|
"Ctrl + c" to stop the SCIM Gateway
|
|
150
158
|
|
|
@@ -382,12 +390,20 @@ Definitions in `endpoint` object are customized according to our plugin code. Pl
|
|
|
382
390
|
|
|
383
391
|
- **scim.usePutSoftSync** - true or false, default false. `PUT /Users/bjensen` will replace the user bjensen with body content. If set to `true`, only PUT body content will be replaced. Any additional existing user attributes and groups supported by plugin will remain as-is.
|
|
384
392
|
|
|
385
|
-
- **log.loglevel.file** - off,
|
|
393
|
+
- **log.loglevel.file** - off, debug, info, warn or error. Default off. Output to plugin-logfile e.g. `logs\plugin-saphana.log`
|
|
394
|
+
|
|
395
|
+
- **log.loglevel.console** - off, debug, info, warn or error. Default off. Output to stdout and errors to stderr
|
|
386
396
|
|
|
387
|
-
- **log.loglevel.
|
|
397
|
+
- **log.loglevel.push** - off, debug, info, warn or error. Default info. Push to stream that can be used by client subscriber
|
|
388
398
|
|
|
389
399
|
- **log.customMasking** - array of attributes to be masked e.g. `"customMasking": ["SSN", "weight"]`. By default SCIM Gateway includes masking of some standard attributes like password.
|
|
390
400
|
|
|
401
|
+
- **log.colorize** - default true, gives colorized and minimized console output, if redirected to stdout/stderr standard JSON formatted output and no colors. Set to false give standard JSON
|
|
402
|
+
|
|
403
|
+
- **log.maxSize** - default 20 (MB) log file size
|
|
404
|
+
|
|
405
|
+
- **log.maxFiles** - default 5, keep only the last 5 logs - note, new and rotated file on startup
|
|
406
|
+
|
|
391
407
|
- **auth** - Contains one or more authentication/authorization methods used by clients for accessing gateway - may also include:
|
|
392
408
|
- **auth.xx.readOnly** - true/false, true gives read only access - only allowing `GET` requests for corresponding admin user
|
|
393
409
|
- **auth.xx.baseEntities** - array containing one or more `baseEntity` allowed for this user e.g. ["client-a"] - empty array allowing all.
|
|
@@ -719,6 +735,101 @@ Example using general OAuth:
|
|
|
719
735
|
|
|
720
736
|
Please see code editor method HelperRest doRequest() IntelliSense for type and option details
|
|
721
737
|
|
|
738
|
+
### Configuration notes - Centralized logging and monitoring
|
|
739
|
+
We may subscribe for online log events using `GET /logger` e.g.:
|
|
740
|
+
|
|
741
|
+
- using browser and url: https://host/logger
|
|
742
|
+
- curl -N https://host/logger -u gwread:password
|
|
743
|
+
- curl -N https://host/logger -H "Authorization: Bearer secret"
|
|
744
|
+
- custom client API
|
|
745
|
+
|
|
746
|
+
We may configure read-only user/secret for log collection purpose
|
|
747
|
+
|
|
748
|
+
"auth": {
|
|
749
|
+
"basic": [
|
|
750
|
+
{
|
|
751
|
+
"username": "gwadmin",
|
|
752
|
+
"password": "password",
|
|
753
|
+
"readOnly": false,
|
|
754
|
+
"baseEntities": []
|
|
755
|
+
},
|
|
756
|
+
{
|
|
757
|
+
"username": "gwread",
|
|
758
|
+
"password": "password",
|
|
759
|
+
"readOnly": true,
|
|
760
|
+
"baseEntities": []
|
|
761
|
+
}
|
|
762
|
+
],
|
|
763
|
+
"bearerToken": [
|
|
764
|
+
{
|
|
765
|
+
"token": "secret",
|
|
766
|
+
"readOnly": true,
|
|
767
|
+
"baseEntities": []
|
|
768
|
+
}
|
|
769
|
+
],
|
|
770
|
+
...
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
push logger using default `info` log level
|
|
774
|
+
push log level may be customized by configuration
|
|
775
|
+
|
|
776
|
+
"log": {
|
|
777
|
+
"loglevel": {
|
|
778
|
+
"push": "debug"
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
Example code using custom subscriber API for log collection and monitoring
|
|
783
|
+
|
|
784
|
+
let headers = new Headers()
|
|
785
|
+
headers.append('Authorization', 'Basic ' + btoa('gwadmin' + ':' + 'password'))
|
|
786
|
+
|
|
787
|
+
// message handling and custom logic
|
|
788
|
+
// we could also do JSON.parse(message) and granular filtering on log "level"
|
|
789
|
+
const messageHandler = async (message: string) => {
|
|
790
|
+
console.log(message)
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
let ignoreCatch = false
|
|
794
|
+
do { // retry loop when connection closed or service unavailable
|
|
795
|
+
if (ignoreCatch) ignoreCatch = false
|
|
796
|
+
|
|
797
|
+
try {
|
|
798
|
+
const resp = await fetch("http://localhost:8880/logger", {
|
|
799
|
+
method: "GET",
|
|
800
|
+
headers: headers,
|
|
801
|
+
})
|
|
802
|
+
|
|
803
|
+
const reader = resp.body.pipeThrough(new TextDecoderStream()).getReader()
|
|
804
|
+
console.log('Now awaiting log events..\n')
|
|
805
|
+
|
|
806
|
+
while (true) {
|
|
807
|
+
const { value, done } = await reader.read();
|
|
808
|
+
if (done) break;
|
|
809
|
+
if (value.at(-1) !== '\n') continue
|
|
810
|
+
const message = value.slice(0, -1)
|
|
811
|
+
await messageHandler(message)
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
// shouldn't be here... authentication failure?
|
|
815
|
+
const e = {
|
|
816
|
+
url: resp.url,
|
|
817
|
+
status: resp.status,
|
|
818
|
+
statusText: resp.statusText
|
|
819
|
+
}
|
|
820
|
+
console.error('error', e)
|
|
821
|
+
|
|
822
|
+
} catch (err: any) {
|
|
823
|
+
if (['ConnectionClosed', 'ConnectionRefused'].includes(err.code)) {
|
|
824
|
+
console.log('Connection closed or service unavailable')
|
|
825
|
+
ignoreCatch = true
|
|
826
|
+
await Bun.sleep(10 * 1000)
|
|
827
|
+
} else console.error(err)
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
} while (ignoreCatch)
|
|
831
|
+
|
|
832
|
+
console.log('\n\ndone!')
|
|
722
833
|
|
|
723
834
|
## Manual startup
|
|
724
835
|
|
|
@@ -1291,6 +1402,21 @@ MIT © [Jarle Elshaug](https://www.elshaug.xyz)
|
|
|
1291
1402
|
|
|
1292
1403
|
## Change log
|
|
1293
1404
|
|
|
1405
|
+
### v5.2.0
|
|
1406
|
+
|
|
1407
|
+
[Improved]
|
|
1408
|
+
|
|
1409
|
+
- Logger have been redesigned
|
|
1410
|
+
|
|
1411
|
+
Supports console, file and push (client subscriber) logging
|
|
1412
|
+
Centralized logging and monitoring through online log subscription, see configuration notes
|
|
1413
|
+
JSON formatted log messages
|
|
1414
|
+
UTC (Coordinated Universal Time)
|
|
1415
|
+
File logging will rotate on startup
|
|
1416
|
+
File logging now includes configuration options for maxFiles and maxSize
|
|
1417
|
+
Console using default colorized and minimized output, if redirected to stdout/stderr standard JSON will be used and no color encoding
|
|
1418
|
+
|
|
1419
|
+
|
|
1294
1420
|
### v5.1.8
|
|
1295
1421
|
|
|
1296
1422
|
[Fixed]
|