scimgateway 5.3.4 → 5.3.6
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/.gitattribute +2 -0
- package/.github/dependabot.yml +0 -0
- package/.github/workflows/test-master.yml +0 -0
- package/.github/workflows/test-release.yml +0 -0
- package/.travis.yml +0 -0
- package/LICENSE +0 -0
- package/README.md +13 -0
- package/bun.lock +57 -171
- package/config/docker/DataDockerfile +0 -0
- package/config/docker/Dockerfile +0 -0
- package/config/docker/dbinit/init.sql +0 -0
- package/config/docker/docker-compose-debug.yml +0 -0
- package/config/docker/docker-compose-mssql.yml +0 -0
- package/config/docker/docker-compose.yml +0 -0
- package/config/plugin-entra-id.json +0 -0
- package/config/plugin-ldap.json +0 -0
- package/config/plugin-mongodb.json +0 -0
- package/config/plugin-mssql.json +0 -0
- package/config/plugin-saphana.json +0 -0
- package/config/plugin-soap.json +0 -0
- package/config/resources/Azure - ScimGateway.xml +0 -0
- package/config/wsdls/GroupService.wsdl +0 -0
- package/config/wsdls/UserService.wsdl +0 -0
- package/eslint.config.js +0 -0
- package/lib/countries.json +0 -0
- package/lib/helper-rest.ts +0 -0
- package/lib/logger.ts +0 -0
- package/lib/plugin-api.ts +0 -0
- package/lib/plugin-entra-id.ts +0 -0
- package/lib/plugin-ldap.ts +0 -0
- package/lib/plugin-loki.ts +0 -0
- package/lib/plugin-mongodb.ts +0 -0
- package/lib/plugin-mssql.ts +0 -0
- package/lib/plugin-saphana.ts +0 -0
- package/lib/plugin-scim.ts +0 -0
- package/lib/plugin-soap.ts +0 -0
- package/lib/postinstall.ts +0 -0
- package/lib/samlAssertion.ts +0 -0
- package/lib/scim-stream.js +0 -0
- package/lib/scimdef-v1.json +1 -1
- package/lib/scimdef-v2.json +1 -1
- package/lib/scimgateway.ts +115 -33
- package/lib/utils-scim.ts +1 -0
- package/lib/utils.ts +27 -2
- package/package.json +10 -10
- package/test/lib/plugin-api_test.ts +0 -0
- package/test/lib/plugin-loki_test.ts +53 -8
- package/test/lib/plugin-mongodb_test.ts_excluded +0 -0
- package/test/lib/plugin-scim_test.ts +8 -6
- package/tsconfig.json +0 -0
|
@@ -28,7 +28,7 @@ async function fetchSCIM(method: string, endpoint: string, body?: any, headers?:
|
|
|
28
28
|
body: body ? JSON.stringify(body) : undefined,
|
|
29
29
|
})
|
|
30
30
|
const data = response.status !== 204 ? await response.json() : null
|
|
31
|
-
return { status: response.status, body: data }
|
|
31
|
+
return { status: response.status, body: data, headers: response.headers }
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
describe('plugin-loki', async () => {
|
|
@@ -72,16 +72,18 @@ describe('plugin-loki', async () => {
|
|
|
72
72
|
expect(users.Resources[0].groups[0].value).toBe('Admins')
|
|
73
73
|
expect(users.Resources[0].groups[0].display).toBe('Admins')
|
|
74
74
|
expect(users.Resources[0].groups[0].type).toBe('direct')
|
|
75
|
+
expect(users.Resources[0].meta.version).toBeDefined()
|
|
75
76
|
expect(users.Resources[1].userName).toBe('jsmith')
|
|
76
77
|
expect(users.Resources[1].id).toBe('jsmith')
|
|
77
78
|
expect(users.Resources[1].name.givenName).toBe('John')
|
|
78
79
|
expect(users.Resources[1].groups[0].value).toBe('Employees')
|
|
79
80
|
expect(users.Resources[1].groups[0].display).toBe('Employees')
|
|
80
81
|
expect(users.Resources[1].groups[0].type).toBe('direct')
|
|
82
|
+
expect(users.Resources[1].meta.version).toBeDefined()
|
|
81
83
|
})
|
|
82
84
|
|
|
83
85
|
test('getUsers all test (2)', async () => {
|
|
84
|
-
const res = await fetchSCIM('GET', '/Users?attributes=userName&startIndex=1&count=100', undefined, options.std.headers)
|
|
86
|
+
const res = await fetchSCIM('GET', '/Users?attributes=userName&startIndex=1&count=100', undefined, options.std.headers) // id and meta is always returned
|
|
85
87
|
const users = res.body
|
|
86
88
|
expect(res.status).toBe(200)
|
|
87
89
|
expect(users.totalResults).toBe(2)
|
|
@@ -89,16 +91,20 @@ describe('plugin-loki', async () => {
|
|
|
89
91
|
expect(users.startIndex).toBe(1)
|
|
90
92
|
expect(users).toBeDefined()
|
|
91
93
|
expect(users.Resources[0].userName).toBe('bjensen')
|
|
92
|
-
expect(users.Resources[0].id).toBe(
|
|
94
|
+
expect(users.Resources[0].id).toBe('bjensen')
|
|
95
|
+
expect(users.Resources[0].meta.version).toBeDefined()
|
|
93
96
|
expect(users.Resources[0].groups).toBe(undefined)
|
|
94
97
|
expect(users.Resources[1].userName).toBe('jsmith')
|
|
95
|
-
expect(users.Resources[1].id).toBe(
|
|
98
|
+
expect(users.Resources[1].id).toBe('jsmith')
|
|
99
|
+
expect(users.Resources[1].meta.version).toBeDefined()
|
|
96
100
|
expect(users.Resources[1].groups).toBe(undefined)
|
|
97
101
|
})
|
|
98
102
|
|
|
99
103
|
test('getUsers unique test (1)', async () => {
|
|
100
104
|
const res = await fetchSCIM('GET', '/Users/bjensen', undefined, options.std.headers)
|
|
101
105
|
const user = res.body
|
|
106
|
+
expect(res.headers.get('etag')).toBe('W/"0"')
|
|
107
|
+
expect(res.headers.get('location')).toBe('http://localhost:8880/Users/bjensen')
|
|
102
108
|
expect(res.status).toBe(200)
|
|
103
109
|
expect(user).toBeDefined()
|
|
104
110
|
expect(user.id).toBe('bjensen')
|
|
@@ -116,6 +122,7 @@ describe('plugin-loki', async () => {
|
|
|
116
122
|
expect(user.groups[0].display).toBe('Admins')
|
|
117
123
|
expect(user.groups[0].type).toBe('direct')
|
|
118
124
|
expect(user['urn:ietf:params:scim:schemas:extension:enterprise:2.0:User'].manager.value).toBe('jsmith')
|
|
125
|
+
expect(user.meta.version).toBeDefined()
|
|
119
126
|
expect(user.meta.location).toBeDefined()
|
|
120
127
|
expect(user.schemas[0]).toBe('urn:ietf:params:scim:schemas:core:2.0:User')
|
|
121
128
|
expect(user.schemas[1]).toBe('urn:ietf:params:scim:schemas:extension:enterprise:2.0:User')
|
|
@@ -190,7 +197,7 @@ describe('plugin-loki', async () => {
|
|
|
190
197
|
|
|
191
198
|
test('getGroups all test (2)', async () => {
|
|
192
199
|
const res = await fetchSCIM('GET', '/Groups'
|
|
193
|
-
+ '?attributes=displayName&startIndex=1&count=100',
|
|
200
|
+
+ '?attributes=displayName&startIndex=1&count=100', // id and meta is always returned
|
|
194
201
|
undefined, options.std.headers)
|
|
195
202
|
const groups = res.body
|
|
196
203
|
expect(res.status).toBe(200)
|
|
@@ -200,16 +207,20 @@ describe('plugin-loki', async () => {
|
|
|
200
207
|
expect(groups).toBeDefined()
|
|
201
208
|
expect(groups.Resources[0].members).toBe(undefined)
|
|
202
209
|
expect(groups.Resources[0].displayName).toBe('Admins')
|
|
203
|
-
expect(groups.Resources[0].id).toBe(
|
|
210
|
+
expect(groups.Resources[0].id).toBe('Admins')
|
|
211
|
+
expect(groups.Resources[0].meta).toBeDefined()
|
|
204
212
|
expect(groups.Resources[1].members).toBe(undefined)
|
|
205
213
|
expect(groups.Resources[1].displayName).toBe('Employees')
|
|
206
|
-
expect(groups.Resources[1].id).toBe(
|
|
214
|
+
expect(groups.Resources[1].id).toBe('Employees')
|
|
215
|
+
expect(groups.Resources[1].meta).toBeDefined()
|
|
207
216
|
})
|
|
208
217
|
|
|
209
218
|
test('getGroups unique test (1)', async () => {
|
|
210
219
|
const res = await fetchSCIM('GET', '/Groups/Admins', undefined, options.std.headers)
|
|
211
220
|
const group = res.body
|
|
212
221
|
expect(res.status).toBe(200)
|
|
222
|
+
expect(res.headers.get('etag')).toBe('W/"0"')
|
|
223
|
+
expect(res.headers.get('location')).toBe('http://localhost:8880/Groups/Admins')
|
|
213
224
|
expect(group).toBeDefined()
|
|
214
225
|
expect(group.schemas).toBeDefined()
|
|
215
226
|
expect(group.meta.location).toBeDefined()
|
|
@@ -287,6 +298,8 @@ describe('plugin-loki', async () => {
|
|
|
287
298
|
test('getUser just created test', async () => {
|
|
288
299
|
const res = await fetchSCIM('GET', '/Users/jgilber', undefined, options.std.headers)
|
|
289
300
|
const user = res.body
|
|
301
|
+
expect(res.headers.get('etag')).toBe('W/"0"')
|
|
302
|
+
expect(res.headers.get('location')).toBe('http://localhost:8880/Users/jgilber')
|
|
290
303
|
expect(res.status).toBe(200)
|
|
291
304
|
expect(user).toBeDefined()
|
|
292
305
|
expect(user.id).toBe('jgilber')
|
|
@@ -307,6 +320,7 @@ describe('plugin-loki', async () => {
|
|
|
307
320
|
expect(user['urn:ietf:params:scim:schemas:extension:enterprise:2.0:User'].employeeNumber).toBe('123456')
|
|
308
321
|
expect(user['urn:ietf:params:scim:schemas:extension:enterprise:2.0:User'].test1).toBe('xxx')
|
|
309
322
|
expect(user['urn:ietf:params:scim:schemas:extension:enterprise:2.0:User'].test2).toBe('yyy')
|
|
323
|
+
expect(user.meta.version).toBe('W/"0"')
|
|
310
324
|
expect(user.schemas[0]).toBe('urn:ietf:params:scim:schemas:core:2.0:User')
|
|
311
325
|
expect(user.schemas[1]).toBe('urn:ietf:params:scim:schemas:extension:enterprise:2.0:User')
|
|
312
326
|
})
|
|
@@ -409,12 +423,18 @@ describe('plugin-loki', async () => {
|
|
|
409
423
|
}
|
|
410
424
|
const res = await fetchSCIM('PATCH', '/Users/jgilber', user, options.content.headers)
|
|
411
425
|
expect(res.status).toBe(200)
|
|
426
|
+
expect(res.headers.get('etag')).toBe('W/"1"')
|
|
427
|
+
expect(res.headers.get('location')).toBe('http://localhost:8880/Users/jgilber')
|
|
428
|
+
expect(res.body.meta.version).toBe('W/"1"')
|
|
429
|
+
expect(res.body.meta.location).toBe('http://localhost:8880/Users/jgilber')
|
|
412
430
|
})
|
|
413
431
|
|
|
414
432
|
test('getUser just modified test', async () => {
|
|
415
433
|
const res = await fetchSCIM('GET', '/Users/jgilber', undefined, options.std.headers)
|
|
416
434
|
const user = res.body
|
|
417
435
|
expect(res.status).toBe(200)
|
|
436
|
+
expect(res.headers.get('etag')).toBe('W/"1"')
|
|
437
|
+
expect(res.headers.get('location')).toBe('http://localhost:8880/Users/jgilber')
|
|
418
438
|
expect(user).toBeDefined()
|
|
419
439
|
expect(user.id).toBe('jgilber')
|
|
420
440
|
expect(user.active).toBe(false) // modified
|
|
@@ -435,6 +455,8 @@ describe('plugin-loki', async () => {
|
|
|
435
455
|
expect(user['urn:ietf:params:scim:schemas:extension:enterprise:2.0:User'].manager.value).toBe('bjensen') // added
|
|
436
456
|
expect(user['urn:ietf:params:scim:schemas:extension:enterprise:2.0:User'].test1).toBe('test1-value') // modified
|
|
437
457
|
expect(user['urn:ietf:params:scim:schemas:extension:enterprise:2.0:User'].test2).toBe('test2-value') // modified
|
|
458
|
+
expect(user.meta.version).toBe('W/"1"')
|
|
459
|
+
expect(user.meta.location).toBe('http://localhost:8880/Users/jgilber')
|
|
438
460
|
})
|
|
439
461
|
|
|
440
462
|
test('replaceUser test', async () => {
|
|
@@ -470,6 +492,8 @@ describe('plugin-loki', async () => {
|
|
|
470
492
|
const res = await fetchSCIM('PUT', '/Users/jgilber', putUser, options.content.headers)
|
|
471
493
|
const user = res.body
|
|
472
494
|
expect(res.status).toBe(200)
|
|
495
|
+
expect(res.headers.get('etag')).toBe('W/"2"')
|
|
496
|
+
expect(res.headers.get('location')).toBe('http://localhost:8880/Users/jgilber')
|
|
473
497
|
expect(user).toBeDefined()
|
|
474
498
|
expect(user.id).toBe('jgilber')
|
|
475
499
|
expect(user.active).toBe(false)
|
|
@@ -489,6 +513,8 @@ describe('plugin-loki', async () => {
|
|
|
489
513
|
expect(user.groups.length).toBe(2)
|
|
490
514
|
expect(user.groups[0].value).toBe('Admins')
|
|
491
515
|
expect(user.groups[1].value).toBe('Employees')
|
|
516
|
+
expect(user.meta.version).toBe('W/"2"')
|
|
517
|
+
expect(user.meta.location).toBe('http://localhost:8880/Users/jgilber')
|
|
492
518
|
})
|
|
493
519
|
|
|
494
520
|
test('deleteUser test', async () => {
|
|
@@ -506,6 +532,9 @@ describe('plugin-loki', async () => {
|
|
|
506
532
|
}
|
|
507
533
|
const res = await fetchSCIM('POST', '/Groups', newGroup, options.content.headers)
|
|
508
534
|
expect(res.status).toBe(201)
|
|
535
|
+
expect(res.headers.get('etag')).toBe('W/"0"')
|
|
536
|
+
expect(res.headers.get('location')).toBe('http://localhost:8880/Groups/GoGoLoki')
|
|
537
|
+
expect(res.body.meta.version).toBe('W/"0"')
|
|
509
538
|
expect(res.body.meta.location).toBe('http://localhost:8880/Groups/GoGoLoki')
|
|
510
539
|
})
|
|
511
540
|
|
|
@@ -513,9 +542,13 @@ describe('plugin-loki', async () => {
|
|
|
513
542
|
const res = await fetchSCIM('GET', '/Groups/GoGoLoki', undefined, options.std.headers)
|
|
514
543
|
const group = res.body
|
|
515
544
|
expect(res.status).toBe(200)
|
|
545
|
+
expect(res.headers.get('etag')).toBe('W/"0"')
|
|
546
|
+
expect(res.headers.get('location')).toBe('http://localhost:8880/Groups/GoGoLoki')
|
|
516
547
|
expect(group).toBeDefined()
|
|
517
548
|
expect(group.displayName).toBe('GoGoLoki')
|
|
518
549
|
expect(group.id).toBe('GoGoLoki')
|
|
550
|
+
expect(group.meta.version).toBe('W/"0"')
|
|
551
|
+
expect(group.meta.location).toBe('http://localhost:8880/Groups/GoGoLoki')
|
|
519
552
|
})
|
|
520
553
|
|
|
521
554
|
test('modifyGroupMembers test', async () => {
|
|
@@ -542,19 +575,27 @@ describe('plugin-loki', async () => {
|
|
|
542
575
|
const res = await fetchSCIM('PATCH', '/Groups/GoGoLoki?attributes=members', body, options.content.headers)
|
|
543
576
|
const group = res.body
|
|
544
577
|
expect(res.status).toBe(200)
|
|
578
|
+
expect(res.headers.get('etag')).toBe('W/"1"')
|
|
579
|
+
expect(res.headers.get('location')).toBe('http://localhost:8880/Groups/GoGoLoki')
|
|
545
580
|
expect(group.members).toBeDefined()
|
|
546
581
|
expect(group.schemas[0]).toBe('urn:ietf:params:scim:schemas:core:2.0:Group')
|
|
582
|
+
expect(group.meta.version).toBe('W/"1"')
|
|
583
|
+
expect(group.meta.location).toBe('http://localhost:8880/Groups/GoGoLoki')
|
|
547
584
|
})
|
|
548
585
|
|
|
549
586
|
test('getGroup just modified members test', async () => {
|
|
550
587
|
const res = await fetchSCIM('GET', '/Groups/GoGoLoki', undefined, options.std.headers)
|
|
551
588
|
const group = res.body
|
|
552
589
|
expect(res.status).toBe(200)
|
|
590
|
+
expect(res.headers.get('etag')).toBe('W/"1"')
|
|
591
|
+
expect(res.headers.get('location')).toBe('http://localhost:8880/Groups/GoGoLoki')
|
|
553
592
|
expect(group).toBeDefined()
|
|
554
593
|
expect(group.displayName).toBe('GoGoLoki')
|
|
555
594
|
expect(group.id).toBe('GoGoLoki')
|
|
556
595
|
expect(group.members.length).toBe(1) // bjensen removed
|
|
557
|
-
expect(group.members[0].value).toBe('jsmith') //
|
|
596
|
+
expect(group.members[0].value).toBe('jsmith') //
|
|
597
|
+
expect(group.meta.version).toBe('W/"1"')
|
|
598
|
+
expect(group.meta.location).toBe('http://localhost:8880/Groups/GoGoLoki')
|
|
558
599
|
})
|
|
559
600
|
|
|
560
601
|
test('replaceGroup test', async () => {
|
|
@@ -571,8 +612,11 @@ describe('plugin-loki', async () => {
|
|
|
571
612
|
const res = await fetchSCIM('PUT', '/Groups/GoGoLoki', obj, options.content.headers)
|
|
572
613
|
const group = res.body
|
|
573
614
|
expect(res.status).toBe(200)
|
|
615
|
+
expect(res.headers.get('etag')).toBe('W/"2"')
|
|
616
|
+
expect(res.headers.get('location')).toBe('http://localhost:8880/Groups/GoGoLoki')
|
|
574
617
|
expect(group.displayName).toBe('NewGoGoLoki')
|
|
575
618
|
expect(group.members.length).toBe(2)
|
|
619
|
+
expect(group.meta.version).toBe('W/"2"')
|
|
576
620
|
expect(group.meta.location).toBe('http://localhost:8880/Groups/GoGoLoki')
|
|
577
621
|
})
|
|
578
622
|
|
|
@@ -612,6 +656,7 @@ describe('plugin-loki', async () => {
|
|
|
612
656
|
{
|
|
613
657
|
method: 'PATCH',
|
|
614
658
|
path: '/Groups/Tour Guides',
|
|
659
|
+
version: 'W/"0"',
|
|
615
660
|
data: {
|
|
616
661
|
op: 'add',
|
|
617
662
|
path: 'members',
|
|
File without changes
|
|
@@ -53,7 +53,7 @@ describe('plugin-scim', async () => {
|
|
|
53
53
|
})
|
|
54
54
|
|
|
55
55
|
test('getUsers all test (2)', async () => {
|
|
56
|
-
const res = await fetchSCIM('GET', '/Users?attributes=userName&startIndex=1&count=100', undefined, options.std.headers)
|
|
56
|
+
const res = await fetchSCIM('GET', '/Users?attributes=userName&startIndex=1&count=100', undefined, options.std.headers) // id is always returned
|
|
57
57
|
const users = res.body
|
|
58
58
|
expect(res.status).toBe(200)
|
|
59
59
|
expect(users.totalResults).toBe(2)
|
|
@@ -61,10 +61,10 @@ describe('plugin-scim', async () => {
|
|
|
61
61
|
expect(users.startIndex).toBe(1)
|
|
62
62
|
expect(users).toBeDefined()
|
|
63
63
|
expect(users.Resources[0].userName).toBe('bjensen')
|
|
64
|
-
expect(users.Resources[0].id).toBe(
|
|
64
|
+
expect(users.Resources[0].id).toBe('bjensen')
|
|
65
65
|
expect(users.Resources[0].groups).toBe(undefined)
|
|
66
66
|
expect(users.Resources[1].userName).toBe('jsmith')
|
|
67
|
-
expect(users.Resources[1].id).toBe(
|
|
67
|
+
expect(users.Resources[1].id).toBe('jsmith')
|
|
68
68
|
expect(users.Resources[1].groups).toBe(undefined)
|
|
69
69
|
})
|
|
70
70
|
|
|
@@ -154,7 +154,7 @@ describe('plugin-scim', async () => {
|
|
|
154
154
|
|
|
155
155
|
test('getGroups all test (2)', async () => {
|
|
156
156
|
const res = await fetchSCIM('GET', '/Groups'
|
|
157
|
-
+ '?attributes=displayName&startIndex=1&count=100',
|
|
157
|
+
+ '?attributes=displayName&startIndex=1&count=100', // id is always returned
|
|
158
158
|
undefined, options.std.headers)
|
|
159
159
|
const groups = res.body
|
|
160
160
|
expect(res.status).toBe(200)
|
|
@@ -163,9 +163,11 @@ describe('plugin-scim', async () => {
|
|
|
163
163
|
expect(groups.itemsPerPage).toBe(2)
|
|
164
164
|
expect(groups.startIndex).toBe(1)
|
|
165
165
|
expect(groups.Resources[0].displayName).toBe('Admins')
|
|
166
|
-
expect(groups.Resources[0].id).toBe(
|
|
166
|
+
expect(groups.Resources[0].id).toBe('Admins')
|
|
167
|
+
expect(groups.Resources[0].members).toBe(undefined)
|
|
167
168
|
expect(groups.Resources[1].displayName).toBe('Employees')
|
|
168
|
-
expect(groups.Resources[1].id).toBe(
|
|
169
|
+
expect(groups.Resources[1].id).toBe('Employees')
|
|
170
|
+
expect(groups.Resources[1].members).toBe(undefined)
|
|
169
171
|
})
|
|
170
172
|
|
|
171
173
|
test('getGroups uniqe test (1)', async () => {
|
package/tsconfig.json
CHANGED
|
File without changes
|