scimgateway 5.1.8 → 5.2.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/README.md CHANGED
@@ -15,10 +15,14 @@ Validated through IdP's:
15
15
  - SailPoint/IdentityNow
16
16
 
17
17
  Latest news:
18
-
18
+
19
+ - Remote real-time log subscription for monitoring and centralized logging
20
+ using browser and url: https://host/logger
21
+ curl -N https://host/logger -u gwread:password
22
+ custom client API, see configuration notes
19
23
  - 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
24
  - 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
- - 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.
25
+ - Major version **v5.0.0** marks a shift from JavaScript to native TypeScript and prioritizes [Bun](https://bun.sh/) over Node.js. This upgrade requires some modifications to existing plugins.
22
26
  - **BREAKING**: [SCIM Stream](https://elshaug.xyz/docs/scim-stream) is the modern way of user provisioning letting clients subscribe to messages instead of traditional IGA top-down provisioning. SCIM Gateway now offers enhanced functionality with support for message subscription and automated provisioning using SCIM Stream
23
27
  - Authentication PassThrough letting plugin pass authentication directly to endpoint for avoid maintaining secrets at the gateway. E.g., using Entra ID application OAuth
24
28
  - Supports OAuth Client Credentials authentication
@@ -128,10 +132,13 @@ If internet connection is blocked, we could install on another machine and copy
128
132
  http://localhost:8880/ping
129
133
  => Health check with a "hello" response
130
134
 
131
- http://localhost:8880/Users
132
- http://localhost:8880/Groups
135
+ http://localhost:8880/Users
136
+ http://localhost:8880/Groups
133
137
  => Logon using gwadmin/password and two users and groups should be listed
134
138
 
139
+ Start a new browser for log monitoring (info level)
140
+ using url: http://localhost:8880/logger
141
+
135
142
  http://localhost:8880/Users/bjensen
136
143
  http://localhost:8880/Groups/Admins
137
144
  or
@@ -139,12 +146,12 @@ If internet connection is blocked, we could install on another machine and copy
139
146
  http://localhost:8880/Groups?filter=displayName eq "Admins"
140
147
  => Lists all attributes for specified user/group
141
148
 
142
- http://localhost:8880/Groups?filter=displayName eq "Admins"&excludedAttributes=members
143
- http://localhost:8880/Groups?filter=members.value eq "bjensen"&attributes=id,displayName,members.value
144
- http://localhost:8880/Users?filter=userName eq "bjensen"&attributes=userName,id,name.givenName
145
- http://localhost:8880/Users?filter=meta.created ge "2010-01-01T00:00:00Z"&attributes=userName,name.familyName,meta.created
146
- http://localhost:8880/Users?filter=emails.value co "@example.com"&attributes=userName,name.familyName,emails&sortBy=name.familyName&sortOrder=descending
147
- => Filtering and attribute examples
149
+ http://localhost:8880/Groups?filter=displayName eq "Admins"&excludedAttributes=members
150
+ http://localhost:8880/Groups?filter=members.value eq "bjensen"&attributes=id,displayName,members.value
151
+ http://localhost:8880/Users?filter=userName eq "bjensen"&attributes=userName,id,name.givenName
152
+ http://localhost:8880/Users?filter=meta.created ge "2010-01-01T00:00:00Z"&attributes=userName,name.familyName,meta.created
153
+ http://localhost:8880/Users?filter=emails.value co "@example.com"&attributes=userName,name.familyName,emails&sortBy=name.familyName&sortOrder=descending
154
+ => Filtering and attribute examples
148
155
 
149
156
  "Ctrl + c" to stop the SCIM Gateway
150
157
 
@@ -382,12 +389,20 @@ Definitions in `endpoint` object are customized according to our plugin code. Pl
382
389
 
383
390
  - **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
391
 
385
- - **log.loglevel.file** - off, error, info, or debug. Output to plugin-logfile e.g. `logs\plugin-saphana.log`
392
+ - **log.loglevel.file** - off, debug, info, warn or error. Default off. Output to plugin-logfile e.g. `logs\plugin-saphana.log`
393
+
394
+ - **log.loglevel.console** - off, debug, info, warn or error. Default off. Output to stdout and errors to stderr
386
395
 
387
- - **log.loglevel.console** - off, error, info, or debug. Output to stdout and errors to stderr.
396
+ - **log.loglevel.push** - off, debug, info, warn or error. Default info. Push to stream that can be used by client subscriber
388
397
 
389
398
  - **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
399
 
400
+ - **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
401
+
402
+ - **log.maxSize** - default 20 (MB) log file size
403
+
404
+ - **log.maxFiles** - default 5, keep only the last 5 logs - note, new and rotated file on startup
405
+
391
406
  - **auth** - Contains one or more authentication/authorization methods used by clients for accessing gateway - may also include:
392
407
  - **auth.xx.readOnly** - true/false, true gives read only access - only allowing `GET` requests for corresponding admin user
393
408
  - **auth.xx.baseEntities** - array containing one or more `baseEntity` allowed for this user e.g. ["client-a"] - empty array allowing all.
@@ -719,6 +734,101 @@ Example using general OAuth:
719
734
 
720
735
  Please see code editor method HelperRest doRequest() IntelliSense for type and option details
721
736
 
737
+ ### Configuration notes - Remote real-time log subscription
738
+ We may have monitoring and centralized logging through remote real-time log subscription
739
+
740
+ - using browser and url: https://host/logger
741
+ - curl -N https://host/logger -u gwread:password
742
+ - curl -N https://host/logger -H "Authorization: Bearer secret"
743
+ - custom client API
744
+
745
+ We may configure read-only user/secret for log collection purpose
746
+
747
+ "auth": {
748
+ "basic": [
749
+ {
750
+ "username": "gwadmin",
751
+ "password": "password",
752
+ "readOnly": false,
753
+ "baseEntities": []
754
+ },
755
+ {
756
+ "username": "gwread",
757
+ "password": "password",
758
+ "readOnly": true,
759
+ "baseEntities": []
760
+ }
761
+ ],
762
+ "bearerToken": [
763
+ {
764
+ "token": "secret",
765
+ "readOnly": true,
766
+ "baseEntities": []
767
+ }
768
+ ],
769
+ ...
770
+ }
771
+
772
+ push logger using default `info` log level
773
+ push log level may be customized by configuration
774
+
775
+ "log": {
776
+ "loglevel": {
777
+ "push": "debug"
778
+ }
779
+ }
780
+
781
+ Example code using custom subscriber API for log collection and monitoring
782
+
783
+ let headers = new Headers()
784
+ headers.append('Authorization', 'Basic ' + btoa('gwadmin' + ':' + 'password'))
785
+
786
+ // message handling and custom logic
787
+ // we could also do JSON.parse(message) and granular filtering on log "level"
788
+ const messageHandler = async (message: string) => {
789
+ console.log(message)
790
+ }
791
+
792
+ let ignoreCatch = false
793
+ do { // retry loop when connection closed or service unavailable
794
+ if (ignoreCatch) ignoreCatch = false
795
+
796
+ try {
797
+ const resp = await fetch("http://localhost:8880/logger", {
798
+ method: "GET",
799
+ headers: headers,
800
+ })
801
+
802
+ const reader = resp.body.pipeThrough(new TextDecoderStream()).getReader()
803
+ console.log('Now awaiting log events..\n')
804
+
805
+ while (true) {
806
+ const { value, done } = await reader.read()
807
+ if (done) break;
808
+ if (value.at(-1) !== '\n') continue
809
+ const message = value.slice(0, -1)
810
+ messageHandler(message)
811
+ }
812
+
813
+ // shouldn't be here... authentication failure?
814
+ const e = {
815
+ url: resp.url,
816
+ status: resp.status,
817
+ statusText: resp.statusText
818
+ }
819
+ console.error('error', e)
820
+
821
+ } catch (err: any) {
822
+ if (['ConnectionClosed', 'ConnectionRefused'].includes(err.code)) {
823
+ console.log('Connection closed or service unavailable')
824
+ ignoreCatch = true
825
+ await Bun.sleep(10 * 1000)
826
+ } else console.error(err)
827
+ }
828
+
829
+ } while (ignoreCatch)
830
+
831
+ console.log('\n\ndone!')
722
832
 
723
833
  ## Manual startup
724
834
 
@@ -1291,6 +1401,27 @@ MIT © [Jarle Elshaug](https://www.elshaug.xyz)
1291
1401
 
1292
1402
  ## Change log
1293
1403
 
1404
+ ### v5.2.1
1405
+
1406
+ [Fixed]
1407
+
1408
+ - Logger did not use the correct plugin rollover filename when the gateway ran multiple plugins
1409
+
1410
+ ### v5.2.0
1411
+
1412
+ [Improved]
1413
+
1414
+ - Logger have been redesigned
1415
+
1416
+ Supports console, file and push (client subscriber) logging
1417
+ Remote real-time log subscription, see configuration notes
1418
+ JSON formatted log messages
1419
+ UTC (Coordinated Universal Time)
1420
+ File logging will rotate on startup
1421
+ File logging now includes configuration options for maxFiles and maxSize
1422
+ Console using default colorized and minimized output. If redirecting stdout/stderr, standard JSON will be used and no color encoding
1423
+
1424
+
1294
1425
  ### v5.1.8
1295
1426
 
1296
1427
  [Fixed]