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.
- package/.github/workflows/test-master.yml +33 -0
- package/.github/workflows/test-release.yml +30 -0
- package/.travis.yml +1 -1
- package/README.md +16 -5
- package/lib/helper-rest.ts +2 -3
- package/lib/scimgateway.ts +13 -23
- package/package.json +1 -1
|
@@ -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
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]
|
package/lib/helper-rest.ts
CHANGED
|
@@ -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
|
|
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:
|
|
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)
|
package/lib/scimgateway.ts
CHANGED
|
@@ -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
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
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