scimgateway 4.1.13 → 4.1.14

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
@@ -1146,7 +1146,7 @@ MIT © [Jarle Elshaug](https://www.elshaug.xyz)
1146
1146
 
1147
1147
  ## Change log
1148
1148
 
1149
- ### v4.1.13
1149
+ ### v4.1.14
1150
1150
 
1151
1151
  [Fixed]
1152
1152
 
@@ -319,7 +319,7 @@ const ScimGateway = function () {
319
319
  // start auth methods - used by auth
320
320
  const basic = (baseEntity, method, authType, authToken, url) => {
321
321
  return new Promise((resolve, reject) => { // basic auth
322
- if (url === '/ping' || url.endsWith('/oauth/token') || url === '/favicon.ico') resolve(true) // no auth
322
+ if (url === '/ping' || url.endsWith('/oauth/token') || url === '/_ah/start' || url === '/_ah/stop' || url === '/favicon.ico') resolve(true) // no auth
323
323
  if (authType !== 'Basic') resolve(false)
324
324
  if (!foundBasic) resolve(false) // not configured
325
325
  const [userName, userPassword] = (Buffer.from(authToken, 'base64').toString() || '').split(':')
@@ -599,6 +599,18 @@ const ScimGateway = function () {
599
599
  ctx.body = tx
600
600
  })
601
601
 
602
+ // Google App Engine B-class instance start/stop request
603
+ router.get(['/_ah/start', '/_ah/stop'], async (ctx) => {
604
+ const cli = ctx.request.ipcli
605
+ const ver = process.env.GAE_VERSION
606
+ if (!cli || cli !== '0.1.0.3' || !ver || !ctx.origin.includes(`.${ver}.`)) { // ctx.origin = http://<instance>.<version>.<project-id>.<region>.r.appspot.com
607
+ ctx.status = 403 // request not coming from GCP App Engine
608
+ return
609
+ }
610
+ // could have some start/stop logic here
611
+ ctx.status = 200
612
+ })
613
+
602
614
  // Initial connection, step #1: GET /ServiceProviderConfigs
603
615
  // If not included => Provisioning will always use GET /Users without any paramenters
604
616
  // scimv1 = ServiceProviderConfigs, scimv2 ServiceProviderConfig
@@ -1787,11 +1799,11 @@ const ScimGateway = function () {
1787
1799
  logger.close()
1788
1800
  server.close(function () {
1789
1801
  setTimeout(function () { // plugins may also use SIGTERM/SIGINT
1790
- process.exit(1)
1802
+ process.exit(0)
1791
1803
  }, 0.5 * 1000)
1792
1804
  })
1793
1805
  setTimeout(function () { // problem closing server connections in time due to keep-alive sessions (active browser connection?), now forcing exit
1794
- process.exit(2)
1806
+ process.exit(1)
1795
1807
  }, 2 * 1000)
1796
1808
  }
1797
1809
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scimgateway",
3
- "version": "4.1.13",
3
+ "version": "4.1.14",
4
4
  "description": "Using SCIM protocol as a gateway for user provisioning to other endpoints",
5
5
  "author": "Jarle Elshaug <jarle.elshaug@gmail.com> (https://elshaug.xyz)",
6
6
  "homepage": "https://elshaug.xyz",