scimgateway 5.1.0 → 5.1.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.
@@ -0,0 +1,33 @@
1
+ name: Test Master Branch
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ pull_request:
8
+ branches:
9
+ - master
10
+
11
+ jobs:
12
+ build:
13
+ runs-on: ubuntu-latest
14
+ env:
15
+ FORCE_COLOR: "1"
16
+ TERM: "xterm-256color"
17
+ steps:
18
+ - name: Checkout code
19
+ uses: actions/checkout@v3
20
+
21
+ # - name: Install Bun
22
+ # run: |
23
+ # curl -fsSL https://bun.sh/install | bash
24
+ # echo "$HOME/.bun/bin" >> $GITHUB_PATH
25
+
26
+ - name: Set up Bun
27
+ uses: oven-sh/setup-bun@v2
28
+
29
+ - name: Install dependencies
30
+ run: bun install
31
+
32
+ - name: Run master tests
33
+ run: bun run test
@@ -0,0 +1,30 @@
1
+ name: Test Release Workflow
2
+
3
+ on:
4
+ release:
5
+ types:
6
+ - published
7
+
8
+ jobs:
9
+ release:
10
+ runs-on: ubuntu-latest
11
+ env:
12
+ FORCE_COLOR: "1"
13
+ TERM: "xterm-256color"
14
+ steps:
15
+ - name: Checkout code
16
+ uses: actions/checkout@v3
17
+
18
+ # - name: Install Bun
19
+ # run: |
20
+ # curl -fsSL https://bun.sh/install | bash
21
+ # echo "$HOME/.bun/bin" >> $GITHUB_PATH
22
+
23
+ - name: Set up Bun
24
+ uses: oven-sh/setup-bun@v2
25
+
26
+ - name: Install dependencies
27
+ run: bun install
28
+
29
+ - name: Run release tests
30
+ run: bun run test
package/.travis.yml CHANGED
@@ -13,4 +13,4 @@ install:
13
13
 
14
14
  # Run the Bun test runner
15
15
  script:
16
- - bun test
16
+ - bun run test
package/README.md CHANGED
@@ -59,10 +59,8 @@ Shows how to implement a highly configurable multi tenant or multi endpoint solu
59
59
 
60
60
  * **SCIM** (REST Webservice)
61
61
  Demonstrates user provisioning towards REST-Based endpoint (type SCIM)
62
- Using plugin Loki as SCIM endpoint
62
+ Using plugin Loki as SCIM endpoint through HelperRest
63
63
  Can be used as SCIM version-gateway e.g. 1.1=>2.0 or 2.0=>1.1
64
- Can be used to chain several gateways
65
-
66
64
 
67
65
  * **Soap** (SOAP Webservice)
68
66
  Demonstrates user provisioning towards SOAP-Based endpoint
@@ -78,7 +76,7 @@ Demonstrates SAP HANA specific user provisioning
78
76
 
79
77
  * **Entra ID** (REST Webservices)
80
78
  Entra ID user provisioning including license management (App Service plans) e.g. Office 365
81
- Using Microsoft Graph API
79
+ Using Microsoft Graph API through HelperRest
82
80
  Using customized SCIM attributes according to Microsoft Graph API
83
81
  Includes Symantec/Broadcom/CA ConnectorXpress metafile for creating provisioning "Azure - ScimGateway" endpoint type
84
82
 
@@ -88,7 +86,7 @@ Pre-configured for Microsoft Active Directory
88
86
  Using endpointMapper (like plugin-entra-id) for attribute mapping flexibility
89
87
 
90
88
  * **API** (REST Webservices)
91
- Demonstrates API Gateway/plugin functionality using post/put/patch/get/delete
89
+ Demonstrates API Gateway/plugin functionality using post/put/patch/get/delete combined with HelperRest
92
90
  None SCIM plugin, becomes what you want it to become.
93
91
  Methods included can also be used in standard SCIM plugins
94
92
  Endpoint complexity could be put in this plugin, and client could instead communicate through Gateway using your own simplified REST specification.
@@ -210,6 +208,7 @@ Below shows an example of config\plugin-saphana.json
210
208
  "scimgateway": {
211
209
  "port": 8884,
212
210
  "localhostonly": false,
211
+ "chainingBaseUrl": null,
213
212
  "scim": {
214
213
  "version": "2.0",
215
214
  "skipTypeConvert" : false,
@@ -1183,6 +1182,18 @@ MIT © [Jarle Elshaug](https://www.elshaug.xyz)
1183
1182
 
1184
1183
  ## Change log
1185
1184
 
1185
+ ### v5.1.2
1186
+
1187
+ [Improved]
1188
+
1189
+ - Simplified some initialization logic
1190
+
1191
+ ### v5.1.1
1192
+
1193
+ [Fixed]
1194
+
1195
+ - SCIM Gateway failed to start on linux using Bun >= v1.1.43
1196
+
1186
1197
  ### v5.1.0
1187
1198
 
1188
1199
  [Improved]
@@ -11,7 +11,7 @@ import { HttpsProxyAgent } from 'https-proxy-agent'
11
11
  import { URL } from 'url'
12
12
  import { Buffer } from 'node:buffer'
13
13
  import { samlAssertion } from './samlAssertion.ts'
14
- import { sign as jwtSign } from 'jsonwebtoken'
14
+ import * as jsonwebtoken from 'jsonwebtoken'
15
15
  import fs from 'node:fs'
16
16
  import querystring from 'querystring'
17
17
  import * as utils from './utils.ts'
@@ -173,7 +173,7 @@ export class HelperRest {
173
173
 
174
174
  form = {
175
175
  grant_type: 'urn:ietf:params:oauth:grant-type:jwt-bearer',
176
- assertion: jwtSign(jwtAttr, privateKey, { algorithm: 'RS256' }),
176
+ assertion: jsonwebtoken.sign(jwtAttr, privateKey, { algorithm: 'RS256' }),
177
177
  }
178
178
  break
179
179
 
@@ -525,7 +525,6 @@ export class HelperRest {
525
525
  const timeout = setTimeout(() => controller.abort(), options.abortTimeout ? options.abortTimeout * 1000 : this.idleTimeout * 1000) // 120 seconds default abort timeout
526
526
  options.signal = signal
527
527
  const url = `${options.protocol}//${options.host}${options.port ? ':' + options.port : ''}${options.path}`
528
- if (path.includes(')?$') && !options.headers['Accept-Encoding']) options.headers['Accept-Encoding'] = 'identity' // workaround for bun fetch error: "Decompression error: ShortRead" - have seen this error using OData with "<some-path>('xxx')?$expand=" or "<some-path>('xxx')?$select=" ref: https://github.com/oven-sh/bun/issues/8017
529
528
  // execute request
530
529
  const f = await fetch(url, options)
531
530
  clearTimeout(timeout)
@@ -13,7 +13,7 @@ import { createServer as httpsCreateServer } from 'node:https'
13
13
  import { type IncomingMessage, type ServerResponse } from 'node:http'
14
14
  import { createChecker } from 'is-in-subnet'
15
15
  import { BearerStrategy, type IBearerStrategyOptionWithRequest } from 'passport-azure-ad'
16
- import { fileURLToPath } from 'url'
16
+ import { fileURLToPath } from 'node:url'
17
17
  import { Log } from './logger.ts'
18
18
  import passport from 'passport'
19
19
  import dot from 'dot-object'
@@ -307,31 +307,21 @@ export class ScimGateway {
307
307
  constructor() {
308
308
  const funcHandler: any = {}
309
309
  const startTime = utils.timestamp()
310
-
311
- // need requester/plugin full path for setting pluginName and configDir
312
- const originalStackTrace = new Error().stack
313
- const stackLines = originalStackTrace ? originalStackTrace.split('\n') : ''
314
310
  let requester: string = ''
315
- let callerLine = ''
316
- for (let i = 0; i < stackLines.length; i++) {
317
- if (stackLines[i].includes('new ScimGateway') && i < stackLines.length - 1) {
318
- callerLine = stackLines[i + 1]
319
- break
320
- }
321
- }
322
- if (callerLine) {
323
- let match = callerLine.match(/(?:\()([^)]+):\d+:\d+(?:\))/)
324
- if (match && match[1]) {
325
- requester = match[1]
326
- }
327
- if (!requester) {
328
- match = callerLine.match(/.*(file:\/\/\/)?([A-Za-z]:[/\\].*?):\d+:\d+(?:\))?/) // nodejs
329
- if (match && match[2]) {
330
- requester = match[2]
331
- }
311
+ {
312
+ let _prepareStackTrace = Error.prepareStackTrace
313
+ Error.prepareStackTrace = (_, stack) => {
314
+ return stack.map((callSite) => {
315
+ return callSite.getFileName()
316
+ })
332
317
  }
318
+ const e = new Error()
319
+ requester = e.stack?.[1] || ''
320
+ try { // node.js using url-path win: file:///path - linux: file://path
321
+ requester = fileURLToPath(requester)
322
+ } catch (err) { void 0 }
323
+ Error.prepareStackTrace = _prepareStackTrace
333
324
  }
334
-
335
325
  let pluginName = path.basename(requester)
336
326
  pluginName = pluginName.substring(0, pluginName.lastIndexOf('.')) || pluginName
337
327
  let pluginDir = path.dirname(requester)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scimgateway",
3
- "version": "5.1.0",
3
+ "version": "5.1.2",
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)",