scimgateway 6.0.1 → 6.0.2
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 +61 -13
- package/lib/scimgateway.ts +9 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -960,7 +960,47 @@ Verification:
|
|
|
960
960
|
- **Reboot** server and verify SCIM Gateway have been automatically started
|
|
961
961
|
|
|
962
962
|
## Running as a isolated virtual Docker container
|
|
963
|
-
|
|
963
|
+
|
|
964
|
+
Installing Docker Desktop may be an alternative for creating and testing docker images and containers
|
|
965
|
+
|
|
966
|
+
There are two options: run SCIM Gateway in a single image, or use Docker Compose, which allows placing configuration and data outside the image and including other images as dependencies (e.g., MSSQL)
|
|
967
|
+
|
|
968
|
+
### Docker single image
|
|
969
|
+
|
|
970
|
+
- Install SCIM Gateway within your own package and copy provided docker files:
|
|
971
|
+
|
|
972
|
+
```
|
|
973
|
+
mkdir /opt/my-scimgateway
|
|
974
|
+
cd /opt/my-scimgateway
|
|
975
|
+
bun init -y
|
|
976
|
+
bun install scimgateway
|
|
977
|
+
bun pm trust scimgateway
|
|
978
|
+
cp ./config/docker/* .
|
|
979
|
+
```
|
|
980
|
+
|
|
981
|
+
**Dockerfile** <== Main dockerfile
|
|
982
|
+
**.dockerignore** <== Files to exclude from the build context
|
|
983
|
+
|
|
984
|
+
|
|
985
|
+
- Build docker images
|
|
986
|
+
|
|
987
|
+
`docker build --platform linux/amd64 --force-rm=true -t my-scimgateway:1.0.0 .`
|
|
988
|
+
|
|
989
|
+
- Create container
|
|
990
|
+
|
|
991
|
+
`docker create --init --ulimit memlock=-1:-1 --name my-scimgateway -p 8880:8880 my-scimgateway:1.0.0`
|
|
992
|
+
|
|
993
|
+
Note, consider using `-e SEED=<random-characters>` and plugin configuration file my-scimgateway.json must already be encrypted using same SEED environment
|
|
994
|
+
|
|
995
|
+
- Start container
|
|
996
|
+
|
|
997
|
+
`docker start my-scimgateway`
|
|
998
|
+
|
|
999
|
+
- Stop container
|
|
1000
|
+
|
|
1001
|
+
`docker stop my-scimgateway`
|
|
1002
|
+
|
|
1003
|
+
### Docker image using docker-compose
|
|
964
1004
|
|
|
965
1005
|
* Docker Pre-requisites:
|
|
966
1006
|
**docker-ce
|
|
@@ -968,12 +1008,14 @@ docker-compose**
|
|
|
968
1008
|
|
|
969
1009
|
- Install SCIM Gateway within your own package and copy provided docker files:
|
|
970
1010
|
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
1011
|
+
```
|
|
1012
|
+
mkdir /opt/my-scimgateway
|
|
1013
|
+
cd /opt/my-scimgateway
|
|
1014
|
+
bun init -y
|
|
1015
|
+
bun install scimgateway
|
|
1016
|
+
bun pm trust scimgateway
|
|
1017
|
+
cp ./config/docker/* .
|
|
1018
|
+
```
|
|
977
1019
|
|
|
978
1020
|
**docker-compose.yml** <== Here is where you would set the exposed port and environment
|
|
979
1021
|
**Dockerfile** <== Main dockerfile
|
|
@@ -984,11 +1026,11 @@ docker-compose**
|
|
|
984
1026
|
|
|
985
1027
|
- Create a scimgateway user on your Linux VM.
|
|
986
1028
|
|
|
987
|
-
|
|
1029
|
+
`adduser scimgateway`
|
|
988
1030
|
|
|
989
1031
|
- Create a directory on your VM host for the scimgateway configs:
|
|
990
1032
|
|
|
991
|
-
|
|
1033
|
+
`mkdir /home/scimgateway/config`
|
|
992
1034
|
|
|
993
1035
|
- 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
1036
|
|
|
@@ -996,7 +1038,7 @@ docker-compose**
|
|
|
996
1038
|
|
|
997
1039
|
- Build docker images and start it up
|
|
998
1040
|
|
|
999
|
-
|
|
1041
|
+
`docker-compose up --build -d`
|
|
1000
1042
|
|
|
1001
1043
|
NOTE: Add the -d flag to run the command above detached.
|
|
1002
1044
|
|
|
@@ -1004,9 +1046,11 @@ docker-compose**
|
|
|
1004
1046
|
|
|
1005
1047
|
If using default plugin-loki and we have configured `{"persistence": true}`, we could confirm scimgateway created loki.db:
|
|
1006
1048
|
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1049
|
+
```
|
|
1050
|
+
su scimgateway
|
|
1051
|
+
cd /home/scimgateway/config
|
|
1052
|
+
ls loki.db
|
|
1053
|
+
```
|
|
1010
1054
|
|
|
1011
1055
|
To list running containers information:
|
|
1012
1056
|
`docker ps`
|
|
@@ -1484,6 +1528,10 @@ MIT © [Jarle Elshaug](https://www.elshaug.xyz)
|
|
|
1484
1528
|
|
|
1485
1529
|
## Change log
|
|
1486
1530
|
|
|
1531
|
+
### v6.0.2
|
|
1532
|
+
|
|
1533
|
+
[Fixed]
|
|
1534
|
+
- Gateway now passing provided filter attributes for getUsers()/getGroups to plugin instead of using empty array for having all supported attributes returned
|
|
1487
1535
|
|
|
1488
1536
|
### v6.0.1
|
|
1489
1537
|
|
package/lib/scimgateway.ts
CHANGED
|
@@ -96,7 +96,7 @@ export class ScimGateway {
|
|
|
96
96
|
* not want getGroups() requests, user object should include `{ "groups": [] }`
|
|
97
97
|
* @remarks the value of returned 'id' will be used as 'id' in modifyUser and deleteUser
|
|
98
98
|
*/
|
|
99
|
-
getUsers!: (baseEntity: string, getObj: Record<string, any>, attributes:
|
|
99
|
+
getUsers!: (baseEntity: string, getObj: Record<string, any>, attributes: string[], ctx?: undefined | Record<string, any>) => any
|
|
100
100
|
/**
|
|
101
101
|
* createUser method is defined at the plugin and should create user at endpoint
|
|
102
102
|
* @param baseEntity used for multi tenant or multi endpoint support, either "undefined" or set by request url e.g., http://localhost:8880/loki2/Users gives baseEntity=loki2
|
|
@@ -183,7 +183,7 @@ export class ScimGateway {
|
|
|
183
183
|
* ```
|
|
184
184
|
* @remarks the value of returned 'id' will be used as 'id' in modifyGroup and deleteGroup
|
|
185
185
|
*/
|
|
186
|
-
getGroups!: (baseEntity: string, getObj: Record<string, any>, attributes:
|
|
186
|
+
getGroups!: (baseEntity: string, getObj: Record<string, any>, attributes: string[], ctx?: undefined | Record<string, any>) => any
|
|
187
187
|
/**
|
|
188
188
|
* createGroup method is defined at the plugin and should create group at endpoint
|
|
189
189
|
* @param baseEntity used for multi tenant or multi endpoint support, either "undefined" or set by request url e.g., http://localhost:8880/loki2/Users gives baseEntity=loki2
|
|
@@ -1179,9 +1179,10 @@ export class ScimGateway {
|
|
|
1179
1179
|
|
|
1180
1180
|
try {
|
|
1181
1181
|
const ob = utils.copyObj(getObj)
|
|
1182
|
-
const attributes = ctx.query.attributes ? ctx.query.attributes.split(',').map((item: string) => item.trim()) : []
|
|
1182
|
+
const attributes: string[] = ctx.query.attributes ? ctx.query.attributes.split(',').map((item: string) => item.trim()) : []
|
|
1183
|
+
if (attributes.length > 0 && !attributes.includes('id')) attributes.push('id')
|
|
1183
1184
|
logger.debug(`${gwName}[${pluginName}][${ctx?.routeObj?.baseEntity}] calling ${handle.getMethod} and awaiting result`, { baseEntity: ctx?.routeObj?.baseEntity })
|
|
1184
|
-
let res = await (this as any)[handle.getMethod](baseEntity, ob,
|
|
1185
|
+
let res = await (this as any)[handle.getMethod](baseEntity, ob, attributes, ctx.passThrough)
|
|
1185
1186
|
|
|
1186
1187
|
let scimdata: { [key: string]: any } = {
|
|
1187
1188
|
Resources: [],
|
|
@@ -1397,7 +1398,8 @@ export class ScimGateway {
|
|
|
1397
1398
|
|
|
1398
1399
|
let res: any
|
|
1399
1400
|
const obj: any = utils.copyObj(getObj)
|
|
1400
|
-
const attributes = ctx.query.attributes ? ctx.query.attributes.split(',').map((item: string) => item.trim()) : []
|
|
1401
|
+
const attributes: string[] = ctx.query.attributes ? ctx.query.attributes.split(',').map((item: string) => item.trim()) : []
|
|
1402
|
+
if (attributes.length > 0 && !attributes.includes('id')) attributes.push('id')
|
|
1401
1403
|
if (!obj.operator && obj.rawFilter && obj.rawFilter.includes(' or ')) {
|
|
1402
1404
|
// advanced filtering using or logic - used by One Identity Manager
|
|
1403
1405
|
// e.g.: (id eq "bjensen") or (id eq "jsmith")
|
|
@@ -1420,7 +1422,7 @@ export class ScimGateway {
|
|
|
1420
1422
|
}
|
|
1421
1423
|
if (getObjArr.length > 0) {
|
|
1422
1424
|
const getObj = async (o: Record<string, any>) => {
|
|
1423
|
-
return await (this as any)[handle.getMethod](baseEntity, o,
|
|
1425
|
+
return await (this as any)[handle.getMethod](baseEntity, o, attributes, ctx.passThrough)
|
|
1424
1426
|
}
|
|
1425
1427
|
const chunk = 5
|
|
1426
1428
|
const chunkRes: Record<string, any>[] = []
|
|
@@ -1444,7 +1446,7 @@ export class ScimGateway {
|
|
|
1444
1446
|
|
|
1445
1447
|
if (!res) { // standard
|
|
1446
1448
|
logger.debug(`${gwName}[${pluginName}][${ctx?.routeObj?.baseEntity}] calling ${handle.getMethod} and awaiting result`, { baseEntity: ctx?.routeObj?.baseEntity })
|
|
1447
|
-
res = await (this as any)[handle.getMethod](baseEntity, obj,
|
|
1449
|
+
res = await (this as any)[handle.getMethod](baseEntity, obj, attributes, ctx.passThrough)
|
|
1448
1450
|
}
|
|
1449
1451
|
// check for user attribute groups and include if needed
|
|
1450
1452
|
if (Array.isArray(res?.Resources)) {
|
package/package.json
CHANGED