scimgateway 5.3.5 → 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 +6 -0
- package/bun.lock +0 -0
- 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 +0 -0
- package/lib/scimdef-v2.json +0 -0
- package/lib/scimgateway.ts +20 -17
- package/lib/utils-scim.ts +0 -0
- package/lib/utils.ts +0 -0
- package/package.json +1 -1
- package/test/lib/plugin-api_test.ts +0 -0
- package/test/lib/plugin-loki_test.ts +0 -0
- package/test/lib/plugin-mongodb_test.ts_excluded +0 -0
- package/test/lib/plugin-scim_test.ts +0 -0
- package/tsconfig.json +0 -0
package/.gitattribute
ADDED
package/.github/dependabot.yml
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/.travis.yml
CHANGED
|
File without changes
|
package/LICENSE
CHANGED
|
File without changes
|
package/README.md
CHANGED
package/bun.lock
CHANGED
|
File without changes
|
|
File without changes
|
package/config/docker/Dockerfile
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/config/plugin-ldap.json
CHANGED
|
File without changes
|
|
File without changes
|
package/config/plugin-mssql.json
CHANGED
|
File without changes
|
|
File without changes
|
package/config/plugin-soap.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/eslint.config.js
CHANGED
|
File without changes
|
package/lib/countries.json
CHANGED
|
File without changes
|
package/lib/helper-rest.ts
CHANGED
|
File without changes
|
package/lib/logger.ts
CHANGED
|
File without changes
|
package/lib/plugin-api.ts
CHANGED
|
File without changes
|
package/lib/plugin-entra-id.ts
CHANGED
|
File without changes
|
package/lib/plugin-ldap.ts
CHANGED
|
File without changes
|
package/lib/plugin-loki.ts
CHANGED
|
File without changes
|
package/lib/plugin-mongodb.ts
CHANGED
|
File without changes
|
package/lib/plugin-mssql.ts
CHANGED
|
File without changes
|
package/lib/plugin-saphana.ts
CHANGED
|
File without changes
|
package/lib/plugin-scim.ts
CHANGED
|
File without changes
|
package/lib/plugin-soap.ts
CHANGED
|
File without changes
|
package/lib/postinstall.ts
CHANGED
|
File without changes
|
package/lib/samlAssertion.ts
CHANGED
|
File without changes
|
package/lib/scim-stream.js
CHANGED
|
File without changes
|
package/lib/scimdef-v1.json
CHANGED
|
File without changes
|
package/lib/scimdef-v2.json
CHANGED
|
File without changes
|
package/lib/scimgateway.ts
CHANGED
|
@@ -583,7 +583,9 @@ export class ScimGateway {
|
|
|
583
583
|
}
|
|
584
584
|
|
|
585
585
|
if (ctx.response.status && (ctx.response.status < 200 || ctx.response.status > 299)) {
|
|
586
|
-
if (ctx.response.status ===
|
|
586
|
+
if (ctx.response.status === 412 || ctx.response.status === 304) {
|
|
587
|
+
logger.info(`${gwName}[${pluginName}][${ctx?.routeObj?.baseEntity}] ${ellapsed} ${ctx.ip} ${userName} ${ctx.response.status} ${ctx.request.method} ${ctx.request.url} Inbound=${JSON.stringify(ctx.request.body)} Outbound=${outbound}`)
|
|
588
|
+
} else if (ctx.response.status === 404) {
|
|
587
589
|
logger.warn(`${gwName}[${pluginName}][${ctx?.routeObj?.baseEntity}] ${ellapsed} ${ctx.ip} ${userName} ${ctx.response.status} ${ctx.request.method} ${ctx.request.url} Inbound=${JSON.stringify(ctx.request.body)} Outbound=${outbound}`)
|
|
588
590
|
} else logger.error(`${gwName}[${pluginName}][${ctx?.routeObj?.baseEntity}] ${ellapsed} ${ctx.ip} ${userName} ${ctx.response.status} ${ctx.request.method} ${ctx.request.url} Inbound=${JSON.stringify(ctx.request.body)} Outbound=${outbound}`)
|
|
589
591
|
} else logger.info(`${gwName}[${pluginName}][${ctx?.routeObj?.baseEntity}] ${ellapsed} ${ctx.ip} ${ctx.response.status} ${userName} ${ctx.request.method} ${ctx.request.url} Inbound=${JSON.stringify(ctx.request.body)} Outbound=${outbound}`)
|
|
@@ -1089,18 +1091,18 @@ export class ScimGateway {
|
|
|
1089
1091
|
const userObj = scimdata.Resources[0]
|
|
1090
1092
|
const eTag = utils.getEtag(userObj)
|
|
1091
1093
|
|
|
1092
|
-
const eTagIfMatch = ctx.request.headers.get('if-match')
|
|
1093
|
-
const eTagIfNoneMatch = ctx.request.headers.get('if-none-match')
|
|
1094
|
+
const eTagIfMatch = ctx.request.headers.get('if-match')?.split(',').map((item: string) => item.trim()).filter(Boolean)
|
|
1095
|
+
const eTagIfNoneMatch = ctx.request.headers.get('if-none-match')?.split(',').map((item: string) => item.trim()).filter(Boolean)
|
|
1094
1096
|
|
|
1095
1097
|
if (eTag) {
|
|
1096
|
-
if (eTagIfMatch && eTagIfMatch
|
|
1098
|
+
if (eTagIfMatch && !eTagIfMatch.includes(eTag) && !eTagIfMatch.includes('*')) {
|
|
1097
1099
|
ctx.response.headers.set('ETag', eTag)
|
|
1098
1100
|
ctx.response.status = 412 // Precondition Failed
|
|
1099
1101
|
const err = new Error(`ETag If-Match mismatch: ${eTagIfMatch} != ${eTag}`)
|
|
1100
1102
|
const [e] = utilsScim.jsonErr(this.config.scimgateway.scim.version, pluginName, ctx.response.status, err)
|
|
1101
1103
|
ctx.response.body = JSON.stringify(e)
|
|
1102
1104
|
return
|
|
1103
|
-
} else if (eTagIfNoneMatch && eTagIfNoneMatch
|
|
1105
|
+
} else if (eTagIfNoneMatch && (eTagIfNoneMatch.includes(eTag) || eTagIfNoneMatch.includes('*'))) {
|
|
1104
1106
|
ctx.response.headers.set('ETag', eTag)
|
|
1105
1107
|
ctx.response.status = 304 // Not Modified
|
|
1106
1108
|
ctx.response.body = ''
|
|
@@ -1587,8 +1589,8 @@ export class ScimGateway {
|
|
|
1587
1589
|
|
|
1588
1590
|
logger.debug(`${gwName}[${pluginName}][${ctx?.routeObj?.baseEntity}] [Modify ${handle.description}] id=${id}`)
|
|
1589
1591
|
|
|
1590
|
-
const eTagIfMatch = ctx.request.headers.get('if-match')
|
|
1591
|
-
const eTagIfNoneMatch = ctx.request.headers.get('if-none-match')
|
|
1592
|
+
const eTagIfMatch = ctx.request.headers.get('if-match')?.split(',').map((item: string) => item.trim()).filter(Boolean)
|
|
1593
|
+
const eTagIfNoneMatch = ctx.request.headers.get('if-none-match')?.split(',').map((item: string) => item.trim()).filter(Boolean)
|
|
1592
1594
|
if (eTagIfMatch || eTagIfNoneMatch) {
|
|
1593
1595
|
let eTag = ''
|
|
1594
1596
|
if (handle.getMethod === handler.users.getMethod || handle.getMethod === handler.groups.getMethod) { // getUsers or getGroups implemented
|
|
@@ -1608,16 +1610,16 @@ export class ScimGateway {
|
|
|
1608
1610
|
}
|
|
1609
1611
|
}
|
|
1610
1612
|
if (eTag)
|
|
1611
|
-
if (eTagIfMatch && eTagIfMatch
|
|
1613
|
+
if (eTagIfMatch && !eTagIfMatch.includes(eTag) && !eTagIfMatch.includes('*')) {
|
|
1612
1614
|
ctx.response.headers.set('ETag', eTag)
|
|
1613
1615
|
ctx.response.status = 412 // Precondition Failed
|
|
1614
1616
|
const err = new Error(`ETag If-Match mismatch: ${eTagIfMatch} != ${eTag}`)
|
|
1615
1617
|
const [e] = utilsScim.jsonErr(this.config.scimgateway.scim.version, pluginName, ctx.response.status, err)
|
|
1616
1618
|
ctx.response.body = JSON.stringify(e)
|
|
1617
1619
|
return
|
|
1618
|
-
} else if (eTagIfNoneMatch && eTagIfNoneMatch
|
|
1620
|
+
} else if (eTagIfNoneMatch && (eTagIfNoneMatch.includes(eTag) || eTagIfNoneMatch.includes('*'))) {
|
|
1619
1621
|
ctx.response.headers.set('ETag', eTag)
|
|
1620
|
-
ctx.response.status =
|
|
1622
|
+
ctx.response.status = 412 // Precondition Failed
|
|
1621
1623
|
ctx.response.body = ''
|
|
1622
1624
|
return
|
|
1623
1625
|
}
|
|
@@ -1746,18 +1748,18 @@ export class ScimGateway {
|
|
|
1746
1748
|
throw err
|
|
1747
1749
|
}
|
|
1748
1750
|
|
|
1749
|
-
const eTagIfMatch = headers ? headers.get('if-match') : undefined
|
|
1750
|
-
const eTagIfNoneMatch = headers ? headers.get('if-none-match') : undefined
|
|
1751
|
+
const eTagIfMatch = headers ? headers.get('if-match')?.split(',').map((item: string) => item.trim()).filter(Boolean) : undefined
|
|
1752
|
+
const eTagIfNoneMatch = headers ? headers.get('if-none-match')?.split(',').map((item: string) => item.trim()).filter(Boolean) : undefined
|
|
1751
1753
|
if (eTagIfMatch || eTagIfNoneMatch) {
|
|
1752
1754
|
const eTag = utils.getEtag(currentObj)
|
|
1753
1755
|
if (eTag) {
|
|
1754
|
-
if (eTagIfMatch && eTagIfMatch
|
|
1756
|
+
if (eTagIfMatch && !eTagIfMatch.includes(eTag) && !eTagIfMatch.includes('*')) {
|
|
1755
1757
|
const err = new Error(`put using method ${handle.getMethod} error: ETag If-Match mismatch: ${eTagIfMatch} != ${eTag}`)
|
|
1756
1758
|
err.name += '#412' // Precondition Failed
|
|
1757
1759
|
throw err
|
|
1758
|
-
} else if (eTagIfNoneMatch && eTagIfNoneMatch
|
|
1760
|
+
} else if (eTagIfNoneMatch && (eTagIfNoneMatch.includes(eTag) || eTagIfNoneMatch.includes('*'))) {
|
|
1759
1761
|
const err = new Error(`put using method ${handle.getMethod} error: ETag If-None-Match mismatch: ${eTagIfNoneMatch} = ${eTag}`)
|
|
1760
|
-
err.name += '#
|
|
1762
|
+
err.name += '#412' // Precondition Failed
|
|
1761
1763
|
throw err
|
|
1762
1764
|
}
|
|
1763
1765
|
}
|
|
@@ -2758,9 +2760,10 @@ export class ScimGateway {
|
|
|
2758
2760
|
idleTimeout,
|
|
2759
2761
|
hostname, // hostname === 'localhost' ? hostname : undefined, // bun defaults to '0.0.0.0', but using '0.0.0.0.' or other ip like '127.0.0.1' becomes extremly slow - bun bug
|
|
2760
2762
|
tls,
|
|
2761
|
-
async fetch(req
|
|
2763
|
+
async fetch(req, srv) {
|
|
2762
2764
|
// start route processing and return response
|
|
2763
|
-
|
|
2765
|
+
const reqWithRaw = req as Request & { raw: IncomingMessage }
|
|
2766
|
+
return await route(reqWithRaw, srv.requestIP(req)?.address || '')
|
|
2764
2767
|
},
|
|
2765
2768
|
error(err) {
|
|
2766
2769
|
logger.error(`${gwName} internal error: ${err.message}`)
|
package/lib/utils-scim.ts
CHANGED
|
File without changes
|
package/lib/utils.ts
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/tsconfig.json
CHANGED
|
File without changes
|