scimgateway 5.2.2 → 5.2.3

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
@@ -18,7 +18,7 @@ Latest news:
18
18
 
19
19
  - Remote real-time log subscription for monitoring and centralized logging
20
20
  using browser and url: https://host/logger
21
- curl -N https://host/logger -u gwread:password
21
+ curl -N https://host/logger -u user:password
22
22
  custom client API, see configuration notes
23
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
24
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
@@ -695,7 +695,7 @@ Example Entra ID (plugin-entra-id) using clientId/clientSecret:
695
695
  "type": "oauth",
696
696
  "options": {
697
697
  "tenantIdGUID": "<tenantId>",
698
- "clientId": "<clientId",
698
+ "clientId": "<clientId>",
699
699
  "clientSecret": "<clientSecret>"
700
700
  }
701
701
  }
@@ -709,7 +709,7 @@ Example Entra ID (plugin-entra-id) using certificate secret:
709
709
  "type": "oauth",
710
710
  "options": {
711
711
  "tenantIdGUID": "<tenantId>",
712
- "clientId": "<clientId",
712
+ "clientId": "<clientId>",
713
713
  "tls": {
714
714
  "key": "key.pem",
715
715
  "cert": "cert.pem"
@@ -726,7 +726,7 @@ Example using general OAuth:
726
726
  "type": "oauth",
727
727
  "options": {
728
728
  "tokenUrl": "<tokenUrl>"
729
- "clientId": "<clientId",
729
+ "clientId": "<clientId>",
730
730
  "clientSecret": "<clientSecret>"
731
731
  }
732
732
  }
@@ -819,7 +819,7 @@ Example code implementing subscriber for real-time log messages collection
819
819
  console.error('error', e)
820
820
 
821
821
  } catch (err: any) {
822
- if (['ConnectionClosed', 'ConnectionRefused'].includes(err.code)) {
822
+ if (['ConnectionClosed', 'ConnectionRefused', 'ECONNRESET'].includes(err.code)) {
823
823
  console.log('Connection closed or service unavailable')
824
824
  ignoreCatch = true
825
825
  await Bun.sleep(10 * 1000)
@@ -1401,6 +1401,12 @@ MIT © [Jarle Elshaug](https://www.elshaug.xyz)
1401
1401
 
1402
1402
  ## Change log
1403
1403
 
1404
+ ### v5.2.3
1405
+
1406
+ [Fixed]
1407
+
1408
+ - GET /ResourceTypes was missing in v5
1409
+
1404
1410
  ### v5.2.2
1405
1411
 
1406
1412
  [Fixed]
@@ -483,7 +483,7 @@ export class ScimGateway {
483
483
  getMethod: 'getAppRoles',
484
484
  }
485
485
  /** handlers supported url paths */
486
- const handlers = ['users', 'groups', 'serviceplans', 'approles', 'api', 'schemas', 'serviceproviderconfig', 'serviceproviderconfigs', 'logger']
486
+ const handlers = ['users', 'groups', 'serviceplans', 'approles', 'api', 'schemas', 'resourcetypes', 'serviceproviderconfig', 'serviceproviderconfigs', 'logger']
487
487
 
488
488
  try {
489
489
  if (!fs.existsSync(configDir + '/wsdls')) fs.mkdirSync(configDir + '/wsdls')
@@ -832,6 +832,21 @@ export class ScimGateway {
832
832
  }
833
833
  funcHandler.getHandlerSchemas = getHandlerSchemas
834
834
 
835
+ // scimv2 GET /ResourceTypes, scimv1 not used
836
+ const getHandlerResourceTypes = async (ctx: Context) => {
837
+ const tx = this.scimDef.ResourceType
838
+ if (!this.config.scimgateway.scim.skipMetaLocation) {
839
+ const location = ctx.origin + ctx.path
840
+ if (tx.meta) tx.meta.location = location
841
+ else {
842
+ tx.meta = {}
843
+ tx.meta.location = location
844
+ }
845
+ }
846
+ ctx.response.body = JSON.stringify(tx)
847
+ }
848
+ funcHandler.getHandlerResourceTypes = getHandlerResourceTypes
849
+
835
850
  // scimv1 = GET /ServiceProviderConfigs, scimv2 GET /ServiceProviderConfig
836
851
  const getHandlerServiceProviderConfig = async (ctx: Context) => {
837
852
  const tx = this.scimDef.ServiceProviderConfigs
@@ -2414,6 +2429,9 @@ export class ScimGateway {
2414
2429
  case 'GET schemas':
2415
2430
  await getHandlerSchemas(ctx)
2416
2431
  return await onAfterHandle(ctx)
2432
+ case 'GET resourcetypes':
2433
+ await getHandlerResourceTypes(ctx)
2434
+ return await onAfterHandle(ctx)
2417
2435
  case 'GET serviceproviderconfig':
2418
2436
  case 'GET serviceproviderconfigs':
2419
2437
  await getHandlerServiceProviderConfig(ctx)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scimgateway",
3
- "version": "5.2.2",
3
+ "version": "5.2.3",
4
4
  "type": "module",
5
5
  "description": "Using SCIM protocol as a gateway for user provisioning to other endpoints",
6
6
  "author": "Jarle Elshaug <jarle.elshaug@gmail.com> (https://elshaug.xyz)",
@@ -32,8 +32,8 @@ async function fetchSCIM(method: string, endpoint: string, body?: any, headers?:
32
32
  }
33
33
 
34
34
  describe('plugin-loki', async () => {
35
- test('ServiceProviderConfigs test', async () => {
36
- const response: any = await fetchSCIM('GET', '/ServiceProviderConfigs', undefined, options.std.headers)
35
+ test('ServiceProviderConfig test', async () => {
36
+ const response: any = await fetchSCIM('GET', '/ServiceProviderConfig', undefined, options.std.headers)
37
37
  expect(response.status).toBe(200)
38
38
  expect(response.body.schemas).toContain('urn:ietf:params:scim:schemas:core:2.0:ServiceProviderConfig')
39
39
  })
@@ -48,6 +48,16 @@ describe('plugin-loki', async () => {
48
48
  })
49
49
  })
50
50
 
51
+ test('ResourceTypes test', async () => {
52
+ const response: any = await fetchSCIM('GET', '/ResourceTypes', undefined, options.std.headers)
53
+ expect(response.status).toBe(200)
54
+ expect(Array.isArray(response.body.Resources)).toBe(true)
55
+ expect(response.body.Resources.length).toEqual(2)
56
+ expect(response.body.Resources[0].schemas).toContain('urn:ietf:params:scim:schemas:core:2.0:ResourceType')
57
+ expect(response.body.Resources[0].id).toBe('urn:ietf:params:scim:schemas:core:2.0:User')
58
+ expect(response.body.Resources[1].id).toBe('urn:ietf:params:scim:schemas:core:2.0:Group')
59
+ })
60
+
51
61
  test('getUsers all test (1)', async () => {
52
62
  const response: any = await fetchSCIM('GET', '/Users?startIndex=1&count=100', undefined, options.std.headers)
53
63
  const users = response?.body