scimgateway 6.0.1 → 6.1.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 +176 -28
- package/bun.lock +199 -175
- package/index.ts +13 -14
- package/lib/plugin-api.ts +3 -21
- package/lib/plugin-entra-id.ts +2 -20
- package/lib/plugin-ldap.ts +1 -11
- package/lib/plugin-loki.ts +1 -10
- package/lib/plugin-mongodb.ts +1 -10
- package/lib/plugin-mssql.ts +1 -10
- package/lib/plugin-saphana.ts +1 -10
- package/lib/plugin-scim.ts +2 -21
- package/lib/plugin-soap.ts +1 -10
- package/lib/scimgateway.ts +39 -80
- package/lib/utils-scim.ts +40 -22
- package/package.json +12 -14
- package/test/index.ts +4 -4
package/README.md
CHANGED
|
@@ -16,6 +16,7 @@ Validated through IdP's:
|
|
|
16
16
|
|
|
17
17
|
Latest news:
|
|
18
18
|
|
|
19
|
+
- tsx is now included, allowing SCIM Gateway to be run as a module in Node.js. Bun binary build is now supported. A single binary can be compiled that includes both the gateway and the plugin.
|
|
19
20
|
- Major release **v6.0.0** introduces changes to API method response bodies (not SCIM-related) and a new method `publicApi()` for handling public path `/pub/api` requests with no authentication required. In addition, the configuration option `bearerJwtAzure.tenantIdGUID` has been replaced by `bearerJwt.azureTenantId`. See the version history for details.
|
|
20
21
|
- Entra ID [Federated Identity Credentials](https://learn.microsoft.com/en-us/graph/api/resources/federatedidentitycredentials-overview?view=graph-rest-1.0) is now supported. Identity federation allows SCIM Gateway to access Microsoft Entra protected resources without needing to manage secrets
|
|
21
22
|
- External JWKS (JSON Web Key Set) is now supported by JWT Authentication. These are public and typically frequent rotated by modern identity providers
|
|
@@ -160,8 +161,8 @@ If internet connection is blocked, we could install on another machine and copy
|
|
|
160
161
|
|
|
161
162
|
>Tip, take a look at bun test scripts located in `node_modules\scimgateway\test\lib`
|
|
162
163
|
|
|
163
|
-
> If using Node.js instead of Bun,
|
|
164
|
-
`node --
|
|
164
|
+
> If using Node.js instead of Bun, startup will then be:
|
|
165
|
+
`node --import=tsx ./index.ts`
|
|
165
166
|
|
|
166
167
|
#### Upgrade SCIM Gateway
|
|
167
168
|
|
|
@@ -190,20 +191,20 @@ For Node.js (and also Bun), we might set the property `scimgateway_postinstall_s
|
|
|
190
191
|
|
|
191
192
|
## Configuration
|
|
192
193
|
|
|
193
|
-
**index.ts** defines one or more plugins to be started by the `
|
|
194
|
+
**index.ts** defines one or more plugins to be started by the `import statement`.
|
|
194
195
|
|
|
195
|
-
//
|
|
196
|
-
//
|
|
196
|
+
// start one or more plugins:
|
|
197
|
+
// import './lib/plugin-scim.ts'
|
|
198
|
+
// import './lib/plugin-entra-id.ts'
|
|
199
|
+
// import './lib/plugin-ldap.ts'
|
|
200
|
+
// import './lib/plugin-mongodb.ts'
|
|
201
|
+
// import './lib/plugin-api.ts'
|
|
202
|
+
// import './lib/plugin-mssql.ts'
|
|
203
|
+
// import './lib/plugin-saphana.ts'
|
|
204
|
+
// import './lib/plugin-soap.ts'
|
|
197
205
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
for (const plugin of plugins) {
|
|
201
|
-
try {
|
|
202
|
-
await import(`./lib/plugin-${plugin}.ts`)
|
|
203
|
-
} catch (err: any) {
|
|
204
|
-
console.error(err)
|
|
205
|
-
}
|
|
206
|
-
}
|
|
206
|
+
import './lib/plugin-loki.ts'
|
|
207
|
+
export {}
|
|
207
208
|
|
|
208
209
|
|
|
209
210
|
Each endpoint plugin needs a TypeScript file (.ts) and a configuration file (.json).
|
|
@@ -913,6 +914,21 @@ GET `https://<namespace-name>.servicebus.windows.net/<hybrid-connection-name>/<b
|
|
|
913
914
|
|
|
914
915
|
If several SCIM Gateway´s (same plugin) connect listeners using the same Azure Relay connectionUrl, there will be load-balancing and round-robin distribution
|
|
915
916
|
|
|
917
|
+
### Configuration notes - running SCIM Gateway as a single binary
|
|
918
|
+
|
|
919
|
+
A single binary can be compiled that includes both the gateway and the plugin. The binary must have the same name (prefix) as the configuration file in the config directory, and this directory must be located in the same folder as the binary.
|
|
920
|
+
|
|
921
|
+
cd my-scimgateway
|
|
922
|
+
bun build --compile --target=bun-darwin-arm64 --outfile ./build/plugin-loki ./lib/plugin-loki.ts
|
|
923
|
+
// for target options, see: https://bun.com/docs/bundler/executables#cross-compile-to-other-platforms
|
|
924
|
+
|
|
925
|
+
cp -r ./config ./build
|
|
926
|
+
// build directory now have what is needed and can be put into production
|
|
927
|
+
cd build
|
|
928
|
+
// run the binary - note, binary must have same name (prefix) as the configuration file in the config directory
|
|
929
|
+
./plugin-loki
|
|
930
|
+
|
|
931
|
+
|
|
916
932
|
|
|
917
933
|
## Manual startup
|
|
918
934
|
|
|
@@ -960,7 +976,47 @@ Verification:
|
|
|
960
976
|
- **Reboot** server and verify SCIM Gateway have been automatically started
|
|
961
977
|
|
|
962
978
|
## Running as a isolated virtual Docker container
|
|
963
|
-
|
|
979
|
+
|
|
980
|
+
Installing Docker Desktop may be an alternative for creating and testing docker images and containers
|
|
981
|
+
|
|
982
|
+
There are two options: run SCIM Gateway in a single image, or use Docker Compose, which allows configuration and data outside the image and including other images as dependencies (e.g., MSSQL)
|
|
983
|
+
|
|
984
|
+
### Docker single image
|
|
985
|
+
|
|
986
|
+
- Install SCIM Gateway within your own package and copy provided docker files:
|
|
987
|
+
|
|
988
|
+
```
|
|
989
|
+
mkdir /opt/my-scimgateway
|
|
990
|
+
cd /opt/my-scimgateway
|
|
991
|
+
bun init -y
|
|
992
|
+
bun install scimgateway
|
|
993
|
+
bun pm trust scimgateway
|
|
994
|
+
cp ./config/docker/* .
|
|
995
|
+
```
|
|
996
|
+
|
|
997
|
+
**Dockerfile** <== Main dockerfile
|
|
998
|
+
**.dockerignore** <== Files to exclude from the build context
|
|
999
|
+
|
|
1000
|
+
|
|
1001
|
+
- Build docker images
|
|
1002
|
+
|
|
1003
|
+
`docker build --platform linux/amd64 --force-rm=true -t my-scimgateway:1.0.0 .`
|
|
1004
|
+
|
|
1005
|
+
- Create container
|
|
1006
|
+
|
|
1007
|
+
`docker create --init --ulimit memlock=-1:-1 --name my-scimgateway -p 8880:8880 my-scimgateway:1.0.0`
|
|
1008
|
+
|
|
1009
|
+
Note, consider using `-e SEED=<random-characters>` and plugin configuration file my-scimgateway.json must already be encrypted using same SEED environment
|
|
1010
|
+
|
|
1011
|
+
- Start container
|
|
1012
|
+
|
|
1013
|
+
`docker start my-scimgateway`
|
|
1014
|
+
|
|
1015
|
+
- Stop container
|
|
1016
|
+
|
|
1017
|
+
`docker stop my-scimgateway`
|
|
1018
|
+
|
|
1019
|
+
### Docker image using docker-compose
|
|
964
1020
|
|
|
965
1021
|
* Docker Pre-requisites:
|
|
966
1022
|
**docker-ce
|
|
@@ -968,27 +1024,29 @@ docker-compose**
|
|
|
968
1024
|
|
|
969
1025
|
- Install SCIM Gateway within your own package and copy provided docker files:
|
|
970
1026
|
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
1027
|
+
```
|
|
1028
|
+
mkdir /opt/my-scimgateway
|
|
1029
|
+
cd /opt/my-scimgateway
|
|
1030
|
+
bun init -y
|
|
1031
|
+
bun install scimgateway
|
|
1032
|
+
bun pm trust scimgateway
|
|
1033
|
+
cp ./config/docker/* .
|
|
1034
|
+
```
|
|
977
1035
|
|
|
978
1036
|
**docker-compose.yml** <== Here is where you would set the exposed port and environment
|
|
979
1037
|
**Dockerfile** <== Main dockerfile
|
|
980
1038
|
**DataDockerfile** <== Handles volume mapping
|
|
981
1039
|
**docker-compose-debug.yml** <== Debugging
|
|
982
|
-
**docker-compose-mssql.yml** <== Example including MSSQL docker image
|
|
1040
|
+
**docker-compose-mssql.yml** <== Example including MSSQL docker image
|
|
983
1041
|
**.dockerignore** <== Files to exclude from the build context
|
|
984
1042
|
|
|
985
1043
|
- Create a scimgateway user on your Linux VM.
|
|
986
1044
|
|
|
987
|
-
|
|
1045
|
+
`adduser scimgateway`
|
|
988
1046
|
|
|
989
1047
|
- Create a directory on your VM host for the scimgateway configs:
|
|
990
1048
|
|
|
991
|
-
|
|
1049
|
+
`mkdir /home/scimgateway/config`
|
|
992
1050
|
|
|
993
1051
|
- Copy your updated configuration file e.g. /opt/my-scimgateway/config/plugin-loki.json to /home/scimgateway/config. Use scp to perform the copy.
|
|
994
1052
|
|
|
@@ -996,7 +1054,7 @@ docker-compose**
|
|
|
996
1054
|
|
|
997
1055
|
- Build docker images and start it up
|
|
998
1056
|
|
|
999
|
-
|
|
1057
|
+
`docker-compose up --build -d`
|
|
1000
1058
|
|
|
1001
1059
|
NOTE: Add the -d flag to run the command above detached.
|
|
1002
1060
|
|
|
@@ -1004,9 +1062,11 @@ docker-compose**
|
|
|
1004
1062
|
|
|
1005
1063
|
If using default plugin-loki and we have configured `{"persistence": true}`, we could confirm scimgateway created loki.db:
|
|
1006
1064
|
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1065
|
+
```
|
|
1066
|
+
su scimgateway
|
|
1067
|
+
cd /home/scimgateway/config
|
|
1068
|
+
ls loki.db
|
|
1069
|
+
```
|
|
1010
1070
|
|
|
1011
1071
|
To list running containers information:
|
|
1012
1072
|
`docker ps`
|
|
@@ -1474,6 +1534,7 @@ In addition following general API methods are available for use:
|
|
|
1474
1534
|
* scimgateway.patchApi()
|
|
1475
1535
|
* scimgateway.getApi()
|
|
1476
1536
|
* scimgateway.deleteApi()
|
|
1537
|
+
* scimgateway.publicApi()
|
|
1477
1538
|
|
|
1478
1539
|
In code editor (e.g., Visual Studio Code), method details and documentation are shown by IntelliSense
|
|
1479
1540
|
|
|
@@ -1484,6 +1545,93 @@ MIT © [Jarle Elshaug](https://www.elshaug.xyz)
|
|
|
1484
1545
|
|
|
1485
1546
|
## Change log
|
|
1486
1547
|
|
|
1548
|
+
### v6.1.0
|
|
1549
|
+
|
|
1550
|
+
[Improved]
|
|
1551
|
+
|
|
1552
|
+
- tsx is now included, allowing SCIM Gateway to be run as a module in Node.js. The mandatory plugin section, which previously required complex dynamic loading, can now be simplified using static imports
|
|
1553
|
+
|
|
1554
|
+
**Old plugin-xxx.ts:**
|
|
1555
|
+
|
|
1556
|
+
// start - mandatory plugin initialization
|
|
1557
|
+
const ScimGateway: typeof import('scimgateway').ScimGateway = await (async () => {
|
|
1558
|
+
try {
|
|
1559
|
+
return (await import('scimgateway')).ScimGateway
|
|
1560
|
+
} catch (err) {
|
|
1561
|
+
const source = './scimgateway.ts'
|
|
1562
|
+
return (await import(source)).ScimGateway
|
|
1563
|
+
}
|
|
1564
|
+
})()
|
|
1565
|
+
const scimgateway = new ScimGateway()
|
|
1566
|
+
const config = scimgateway.getConfig()
|
|
1567
|
+
scimgateway.authPassThroughAllowed = false
|
|
1568
|
+
// end - mandatory plugin initialization
|
|
1569
|
+
|
|
1570
|
+
**New plugin-xxx.ts:**
|
|
1571
|
+
|
|
1572
|
+
// start - mandatory plugin initialization
|
|
1573
|
+
import { ScimGateway } from 'scimgateway'
|
|
1574
|
+
const scimgateway = new ScimGateway()
|
|
1575
|
+
const config = scimgateway.getConfig()
|
|
1576
|
+
scimgateway.authPassThroughAllowed = false
|
|
1577
|
+
// end - mandatory plugin initialization
|
|
1578
|
+
|
|
1579
|
+
|
|
1580
|
+
**Old Node.js startup:**
|
|
1581
|
+
|
|
1582
|
+
node --experimental-strip-types c:\scimgateway\index.ts // scimgateway downloaded from github
|
|
1583
|
+
|
|
1584
|
+
**New Node.js startup:**
|
|
1585
|
+
|
|
1586
|
+
node --import=tsx ./index.ts // running in local package
|
|
1587
|
+
|
|
1588
|
+
- index.ts now using static import instead of dynamic
|
|
1589
|
+
|
|
1590
|
+
**Old index.ts:**
|
|
1591
|
+
|
|
1592
|
+
const plugins = ['loki']
|
|
1593
|
+
for (const plugin of plugins) {
|
|
1594
|
+
try {
|
|
1595
|
+
await import(`./lib/plugin-${plugin}.ts`)
|
|
1596
|
+
} catch (err: any) {
|
|
1597
|
+
console.error(err)
|
|
1598
|
+
}
|
|
1599
|
+
}
|
|
1600
|
+
|
|
1601
|
+
**New index.ts:**
|
|
1602
|
+
|
|
1603
|
+
// start one or more plugins:
|
|
1604
|
+
// import './lib/plugin-scim.ts'
|
|
1605
|
+
// import './lib/plugin-entra-id.ts'
|
|
1606
|
+
// import './lib/plugin-ldap.ts'
|
|
1607
|
+
// import './lib/plugin-mongodb.ts'
|
|
1608
|
+
// import './lib/plugin-api.ts'
|
|
1609
|
+
// import './lib/plugin-mssql.ts'
|
|
1610
|
+
// import './lib/plugin-saphana.ts'
|
|
1611
|
+
// import './lib/plugin-soap.ts'
|
|
1612
|
+
|
|
1613
|
+
import './lib/plugin-loki.ts'
|
|
1614
|
+
export {}
|
|
1615
|
+
|
|
1616
|
+
|
|
1617
|
+
- Bun binary build is now supported. A single binary can be compiled that includes both the gateway and the plugin. The binary must have the same name (prefix) as the configuration file in the config directory, and this directory must be located in the same folder as the binary.
|
|
1618
|
+
|
|
1619
|
+
cd my-scimgateway
|
|
1620
|
+
bun build --compile --target=bun-darwin-arm64 --outfile ./build/plugin-loki ./lib/plugin-loki.ts
|
|
1621
|
+
// for target options, see: https://bun.com/docs/bundler/executables#cross-compile-to-other-platforms
|
|
1622
|
+
|
|
1623
|
+
cp -r ./config ./build
|
|
1624
|
+
// build directory now have what is needed and can be put into production
|
|
1625
|
+
cd build
|
|
1626
|
+
// run the binary - note, binary must have same name (prefix) as the configuration file in the config directory
|
|
1627
|
+
./plugin-loki
|
|
1628
|
+
|
|
1629
|
+
- Dependencies bump
|
|
1630
|
+
|
|
1631
|
+
### v6.0.2
|
|
1632
|
+
|
|
1633
|
+
[Fixed]
|
|
1634
|
+
- Gateway now passing provided filter attributes for getUsers()/getGroups to plugin instead of using empty array for having all supported attributes returned
|
|
1487
1635
|
|
|
1488
1636
|
### v6.0.1
|
|
1489
1637
|
|