scimgateway 5.0.14 → 5.1.0
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/dependabot.yml +6 -0
- package/README.md +113 -51
- package/bun.lockb +0 -0
- package/config/plugin-api.json +1 -0
- package/config/plugin-entra-id.json +1 -0
- package/config/plugin-ldap.json +1 -0
- package/config/plugin-loki.json +1 -0
- package/config/plugin-mongodb.json +1 -0
- package/config/plugin-mssql.json +1 -0
- package/config/plugin-saphana.json +1 -0
- package/config/plugin-scim.json +1 -0
- package/config/plugin-soap.json +1 -0
- package/lib/helper-rest.ts +25 -16
- package/lib/logger.ts +1 -1
- package/lib/samlAssertion.ts +1 -0
- package/lib/scim-stream.js +1 -1
- package/lib/scimgateway.ts +227 -331
- package/package.json +2 -3
- package/test/lib/plugin-api_test.ts +21 -22
- package/test/lib/plugin-loki_test.ts +108 -106
- package/test/lib/plugin-mongodb_test.ts_excluded +87 -102
- package/test/lib/plugin-scim_test.ts +86 -99
package/README.md
CHANGED
|
@@ -16,7 +16,8 @@ Validated through IdP's:
|
|
|
16
16
|
|
|
17
17
|
Latest news:
|
|
18
18
|
|
|
19
|
-
-
|
|
19
|
+
- 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
|
|
20
|
+
- 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
|
|
20
21
|
- Major version **v5.0.0** marks a shift to native TypeScript support and prioritizes [Bun](https://bun.sh/) over Node.js. This upgrade requires some modifications to existing plugins.
|
|
21
22
|
- **BREAKING**: [SCIM Stream](https://elshaug.xyz/docs/scim-stream) is the modern way of user provisioning letting clients subscribe to messages instead of traditional IGA top-down provisioning. SCIM Gateway now offers enhanced functionality with support for message subscription and automated provisioning using SCIM Stream
|
|
22
23
|
- Authentication PassThrough letting plugin pass authentication directly to endpoint for avoid maintaining secrets at the gateway. E.g., using Entra ID application OAuth
|
|
@@ -185,7 +186,7 @@ For Node.js (and also Bun), we might set the property `scimgateway_postinstall_s
|
|
|
185
186
|
// example starting all default plugins:
|
|
186
187
|
// const plugins = ['loki', 'scim', 'entra-id', 'ldap', 'mssql', 'api', 'mongodb', 'saphana', 'soap']
|
|
187
188
|
|
|
188
|
-
const plugins = ['
|
|
189
|
+
const plugins = ['loki']
|
|
189
190
|
|
|
190
191
|
for (const plugin of plugins) {
|
|
191
192
|
try {
|
|
@@ -354,6 +355,8 @@ Definitions in `endpoint` object are customized according to our plugin code. Pl
|
|
|
354
355
|
|
|
355
356
|
- **localhostonly** - true or false. False means gateway accepts incoming requests from all clients. True means traffic from only localhost (127.0.0.1) is accepted.
|
|
356
357
|
|
|
358
|
+
- **chainingBaseUrl** - baseUrl for chaining anohter gateway, syntax: `http(s)://host:port`. If defined, gateway beave much like a reverse proxy, validating authorization unless PassThrough mode is enabled. See `Configuration notes` for details
|
|
359
|
+
|
|
357
360
|
- **idleTimeout** - default 120, sets the the number of seconds to wait before timing out a connection due to inactivity
|
|
358
361
|
|
|
359
362
|
- **scim.version** - "1.1" or "2.0". Default is "2.0".
|
|
@@ -399,7 +402,7 @@ Definitions in `endpoint` object are customized according to our plugin code. Pl
|
|
|
399
402
|
|
|
400
403
|
- **auth.bearerJwt** - Array of one or more standard JWT objects. Using **secret** or **publicKey** for signature verification. publicKey should be set to the filename of public key or certificate pem-file located in `<package-root>\config\certs` or absolute path being used. Clear text secret will become encrypted when gateway is started. **options.issuer** is mandatory. Other options may also be included according to jsonwebtoken npm package definition.
|
|
401
404
|
|
|
402
|
-
- **auth.bearerOAuth** - Array of one or more Client Credentials OAuth configuration objects. **`clientId`** and **`clientSecret`** are mandatory. clientSecret value will become encrypted when gateway is started. OAuth token request url is **/oauth/token** e.g. http://localhost:8880/oauth/token
|
|
405
|
+
- **auth.bearerOAuth** - Array of one or more Client Credentials OAuth configuration objects. **`clientId`** and **`clientSecret`** are mandatory. clientSecret value will become encrypted when gateway is started. OAuth token request url is **/oauth/token** e.g. `http://localhost:8880/oauth/token`
|
|
403
406
|
|
|
404
407
|
- **auth.passThrough** - Setting **auth.passThrough.enabled=true** will bypass SCIM Gateway authentication. Gateway will instead pass ctx containing authentication header to the plugin. Plugin could then use this information for endpoint authentication and we don't have any password/token stored at the gateway. Note, this also requires plugin binary having `scimgateway.authPassThroughAllowed = true` and endpoint logic for handling/passing ctx.request.header.authorization
|
|
405
408
|
|
|
@@ -437,13 +440,13 @@ Definitions in `endpoint` object are customized according to our plugin code. Pl
|
|
|
437
440
|
"2603:1056:2000::/48",
|
|
438
441
|
"2603:1057:2::/48"
|
|
439
442
|
]
|
|
440
|
-
- **email** -
|
|
443
|
+
- **email** - Sending email from plugin or automated error notifications emailOnError. For emailOnError only the first error will be sent until sendInterval have passed. Supporting both SMTP Auth and modern REST OAuth. For OAuth, currently Microsoft Exchange Online (ExO) and Google Workspace Gmail are supported - see configuration notes
|
|
441
444
|
- **email.auth** - Authentication configuration
|
|
442
445
|
- **email.auth.type** - `oauth` or `smtp`
|
|
443
446
|
- **email.auth.options** - Authentication options - note, different options for type oauth and smtp
|
|
444
|
-
- **email.auth.options.tenantIdGUID (oauth/ExO)** - Entra
|
|
445
|
-
- **email.auth.options.clientId (oauth/ExO)** - Client ID
|
|
446
|
-
- **email.auth.options.clientSecret (oauth/ExO)** - Client Secret
|
|
447
|
+
- **email.auth.options.tenantIdGUID (oauth/ExO)** - Entra tenant id or domain name
|
|
448
|
+
- **email.auth.options.clientId (oauth/ExO)** - Entra OAuth application Client ID
|
|
449
|
+
- **email.auth.options.clientSecret (oauth/ExO)** - Entra OAuth application Client Secret
|
|
447
450
|
- **email.auth.options.serviceAccountKeyFile (oauth/Gmail)** - Google Service Account key json-file name located in the `package-root>\config\certs` directory unless absolute path being defined
|
|
448
451
|
- **email.auth.options.host (smtp)** - Mailserver e.g. "smtp.gmail.com" - mandatory for smtp
|
|
449
452
|
- **email.auth.options.port (smtp)** - Port used by mailserver e.g. 587, 25 or 465 - mandatory for smtp
|
|
@@ -461,45 +464,6 @@ Definitions in `endpoint` object are customized according to our plugin code. Pl
|
|
|
461
464
|
- **email.emailOnError.cc** - Optional comma separated list of cc mail addresses
|
|
462
465
|
- **email.emailOnError.subject** - Optional mail subject, default `SCIM Gateway error message`
|
|
463
466
|
|
|
464
|
-
**Configuration notes for Microsoft Exchange Online (ExO):**
|
|
465
|
-
|
|
466
|
-
- Entra ID application must have application permissions `Mail.Send`
|
|
467
|
-
- To prevent the sending of emails from any defined mailboxes, an ExO `ApplicationAccessPolicy` must be defined through PowerShell.
|
|
468
|
-
|
|
469
|
-
First create a mail-enabled security-group that only includes those users (mailboxes) the application is allowed to send from
|
|
470
|
-
Note, `mail enabled security group` cannot be created from portal, only from admin or admin.exchange console
|
|
471
|
-
|
|
472
|
-
##Connect to Exchange
|
|
473
|
-
Install-Module -Name ExchangeOnlineManagement
|
|
474
|
-
Connect-ExchangeOnline
|
|
475
|
-
|
|
476
|
-
##Create ApplicationAccessPolicy
|
|
477
|
-
New-ApplicationAccessPolicy -AppId <AppClientID> -PolicyScopeGroupId <MailEnabledSecurityGrpId> -AccessRight RestrictAccess -Description "Restrict app to specific mailboxes"
|
|
478
|
-
|
|
479
|
-
**Configuration notes for Google Workspace Gmail:**
|
|
480
|
-
|
|
481
|
-
- https://console.cloud.google.com
|
|
482
|
-
- IAM & Admin > Service Accounts > Create Service Account
|
|
483
|
-
- Name=email-sender
|
|
484
|
-
- Create and Continue
|
|
485
|
-
- Grant this service account access to project - not needed
|
|
486
|
-
- Grant users access to this service - not needed
|
|
487
|
-
- IAM & Admin > Service Accounts > "email-sender" account > Keys
|
|
488
|
-
- Add Key > Create new key > JSON
|
|
489
|
-
- download json `serviceAccountKeyFile` file, refere to configuration `email.auth.options.serviceAccountKeyFile`
|
|
490
|
-
|
|
491
|
-
- https://admin.google.com
|
|
492
|
-
- Security > Access and data control > API controls
|
|
493
|
-
- Manage Domain Wide Delegation > Add new
|
|
494
|
-
- Client ID = id of service account created
|
|
495
|
-
- OAuth scope = https://www.googleapis.com/auth/gmail.send
|
|
496
|
-
|
|
497
|
-
- https://admin.google.com
|
|
498
|
-
- Billing > Subscriptions - verify Google Workspace license
|
|
499
|
-
- Directory > Users > "user"
|
|
500
|
-
- Licenses > Edit > enable Google Workspace license
|
|
501
|
-
`email.onerror.from` mail address must have Google Workspace Business license
|
|
502
|
-
|
|
503
467
|
- **stream** - See [SCIM Stream](https://elshaug.xyz/docs/scim-stream) for configuration details
|
|
504
468
|
|
|
505
469
|
- **endpoint** - Contains endpoint specific configuration according to customized **plugin code**.
|
|
@@ -561,6 +525,89 @@ Definitions in `endpoint` object are customized according to our plugin code. Pl
|
|
|
561
525
|
}
|
|
562
526
|
|
|
563
527
|
|
|
528
|
+
- Email, using Microsoft Exchange Online (ExO)
|
|
529
|
+
|
|
530
|
+
- Entra ID application must have application permissions `Mail.Send`
|
|
531
|
+
- To prevent the sending of emails from any defined mailboxes, an ExO `ApplicationAccessPolicy` must be defined through PowerShell.
|
|
532
|
+
|
|
533
|
+
First create a mail-enabled security-group that only includes those users (mailboxes) the application is allowed to send from
|
|
534
|
+
Note, `mail enabled security group` cannot be created from portal, only from admin or admin.exchange console
|
|
535
|
+
|
|
536
|
+
##Connect to Exchange
|
|
537
|
+
Install-Module -Name ExchangeOnlineManagement
|
|
538
|
+
Connect-ExchangeOnline
|
|
539
|
+
|
|
540
|
+
##Create ApplicationAccessPolicy
|
|
541
|
+
New-ApplicationAccessPolicy -AppId <AppClientID> -PolicyScopeGroupId <MailEnabledSecurityGrpId> -AccessRight RestrictAccess -Description "Restrict app to specific mailboxes"
|
|
542
|
+
|
|
543
|
+
- Email, using Google Workspace Gmail
|
|
544
|
+
|
|
545
|
+
- https://console.cloud.google.com
|
|
546
|
+
- IAM & Admin > Service Accounts > Create Service Account
|
|
547
|
+
- Name=email-sender
|
|
548
|
+
- Create and Continue
|
|
549
|
+
- Grant this service account access to project - not needed
|
|
550
|
+
- Grant users access to this service - not needed
|
|
551
|
+
- IAM & Admin > Service Accounts > "email-sender" account > Keys
|
|
552
|
+
- Add Key > Create new key > JSON
|
|
553
|
+
- download json Service Account Key file, refere to configuration `email.auth.options.serviceAccountKeyFile`
|
|
554
|
+
|
|
555
|
+
- https://admin.google.com
|
|
556
|
+
- Security > Access and data control > API controls
|
|
557
|
+
- Manage Domain Wide Delegation > Add new
|
|
558
|
+
- Client ID = id of service account created
|
|
559
|
+
- OAuth scope = `https://www.googleapis.com/auth/gmail.send`
|
|
560
|
+
|
|
561
|
+
- https://admin.google.com
|
|
562
|
+
- Billing > Subscriptions - verify Google Workspace license
|
|
563
|
+
- Directory > Users > "user"
|
|
564
|
+
- Licenses > Edit > enable Google Workspace license
|
|
565
|
+
`email.emailOnError.from` mail address must have Google Workspace license
|
|
566
|
+
|
|
567
|
+
- Gateway chainging and chainingBaseUrl configuration
|
|
568
|
+
|
|
569
|
+
By configuring the `chainingBaseUrl`, it is possible to chain multiple gateways in sequence, such as `gateway1->gateway2->gateway3->endpoint`. In this setup, gateway behave much like a reverse proxy, validating authorization at each step unless PassThrough mode is enabled. Chaining is also supported in stream subscriber mode
|
|
570
|
+
|
|
571
|
+
{
|
|
572
|
+
"scimgateway": {
|
|
573
|
+
...
|
|
574
|
+
"chainingBaseUrl": "https:\\gateway2:8880",
|
|
575
|
+
...
|
|
576
|
+
"auth": {
|
|
577
|
+
...
|
|
578
|
+
"passThrough": {
|
|
579
|
+
"enabled": false,
|
|
580
|
+
"readOnly": false,
|
|
581
|
+
"baseEntities": []
|
|
582
|
+
}
|
|
583
|
+
...
|
|
584
|
+
}
|
|
585
|
+
},
|
|
586
|
+
...
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
|
|
590
|
+
Using above configuration example on gateway1, incoming requests will be routed to `https:\\gateway2:8880`
|
|
591
|
+
|
|
592
|
+
The plugin and its associated authentication configuration can mirror the setup running on the final gateway. However, in chaining mode, the plugin binary is used solely for initializing and configuring the gateway. This allows for the use of a simplified `plugin-<name>.ts` binary containing only the essential mandatory components:
|
|
593
|
+
|
|
594
|
+
// start - mandatory plugin initialization
|
|
595
|
+
const ScimGateway: typeof import('scimgateway').ScimGateway = await (async () => {
|
|
596
|
+
try {
|
|
597
|
+
return (await import('scimgateway')).ScimGateway
|
|
598
|
+
} catch (err) {
|
|
599
|
+
const source = './scimgateway.ts'
|
|
600
|
+
return (await import(source)).ScimGateway
|
|
601
|
+
}
|
|
602
|
+
})()
|
|
603
|
+
const scimgateway = new ScimGateway()
|
|
604
|
+
const config = scimgateway.getConfig()
|
|
605
|
+
scimgateway.authPassThroughAllowed = false
|
|
606
|
+
// end - mandatory plugin initialization
|
|
607
|
+
|
|
608
|
+
Using `scimgateway.authPassThroughAllowed = true` and `plugin-<name>.json` configuration `scimgateway.auth.passThrough=true` enables Authentication PassTrhough
|
|
609
|
+
|
|
610
|
+
|
|
564
611
|
|
|
565
612
|
## Manual startup
|
|
566
613
|
|
|
@@ -1009,17 +1056,17 @@ For JavaScript coding editor you may use [Visual Studio Code](https://code.visua
|
|
|
1009
1056
|
|
|
1010
1057
|
Preparation:
|
|
1011
1058
|
|
|
1012
|
-
* Copy "best matching" example plugin e.g. `lib\plugin-mssql.ts` and `config\plugin-mssql.json` and rename both copies to your plugin name prefix e.g. plugin-mine.ts and plugin-mine.json
|
|
1059
|
+
* Copy "best matching" example plugin e.g. `lib\plugin-mssql.ts` and `config\plugin-mssql.json` and rename both copies to your plugin name prefix e.g. plugin-mine.ts and plugin-mine.json
|
|
1013
1060
|
* Edit plugin-mine.json and define a unique port number for the gateway setting
|
|
1014
1061
|
* Edit index.ts and include your plugin in the startup e.g. `const plugins = ['mine']');`
|
|
1015
|
-
* Start SCIM Gateway and verify
|
|
1062
|
+
* Start SCIM Gateway and verify using using your own SCIM API requests or your IdP/IGA system.
|
|
1016
1063
|
|
|
1017
1064
|
Now we are ready for custom coding by editing plugin-mine.ts
|
|
1018
|
-
Coding should be done step by step and each step should be verified and tested before starting the next
|
|
1065
|
+
Coding should be done step by step and each step should be verified and tested before starting the next
|
|
1019
1066
|
|
|
1020
|
-
1. **Turn off group functionality** - getGroups to return empty response
|
|
1067
|
+
1. **Turn off group functionality** - getGroups to return empty response (gateway automatically use getGroups for some of the methods if groups not included)
|
|
1021
1068
|
Please see plugin-saphana that do not use groups.
|
|
1022
|
-
2. **getUsers** (test provisioning retrieve accounts)
|
|
1069
|
+
2. **getUsers** (test provisioning retrieve all accounts and single account)
|
|
1023
1070
|
4. **createUser** (test provisioning new account)
|
|
1024
1071
|
5. **deleteUser** (test provisioning delete account)
|
|
1025
1072
|
6. **modifyUser** (test provisioning modify account)
|
|
@@ -1136,6 +1183,21 @@ MIT © [Jarle Elshaug](https://www.elshaug.xyz)
|
|
|
1136
1183
|
|
|
1137
1184
|
## Change log
|
|
1138
1185
|
|
|
1186
|
+
### v5.1.0
|
|
1187
|
+
|
|
1188
|
+
[Improved]
|
|
1189
|
+
|
|
1190
|
+
- 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
|
|
1191
|
+
|
|
1192
|
+
Please see `Configuration notes` for details
|
|
1193
|
+
|
|
1194
|
+
|
|
1195
|
+
### v5.0.15
|
|
1196
|
+
|
|
1197
|
+
[Improved]
|
|
1198
|
+
|
|
1199
|
+
- HelperRest, auth.type=oauthSamlAssertion and auth.type=oauthJwtAssertion have been updated to `oauthSamlBearer` and `oauthJwtBearer` for consistency
|
|
1200
|
+
|
|
1139
1201
|
### v5.0.14
|
|
1140
1202
|
|
|
1141
1203
|
[Improved]
|
package/bun.lockb
CHANGED
|
Binary file
|
package/config/plugin-api.json
CHANGED
package/config/plugin-ldap.json
CHANGED
package/config/plugin-loki.json
CHANGED
package/config/plugin-mssql.json
CHANGED
package/config/plugin-scim.json
CHANGED
package/config/plugin-soap.json
CHANGED
package/lib/helper-rest.ts
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
|
+
// =================================================================================
|
|
2
|
+
// File: helper-rest.ts
|
|
3
|
+
//
|
|
4
|
+
// Author: Jarle Elshaug
|
|
5
|
+
//
|
|
6
|
+
// Purpose: HelperRest class for executing REST calls supporting various auth types
|
|
7
|
+
// Plugins may use this class: import { HelperRest } from 'scimgateway'
|
|
8
|
+
// =================================================================================
|
|
9
|
+
|
|
1
10
|
import { HttpsProxyAgent } from 'https-proxy-agent'
|
|
2
11
|
import { URL } from 'url'
|
|
3
12
|
import { Buffer } from 'node:buffer'
|
|
4
|
-
import { samlAssertion } from './samlAssertion.ts'
|
|
13
|
+
import { samlAssertion } from './samlAssertion.ts'
|
|
5
14
|
import { sign as jwtSign } from 'jsonwebtoken'
|
|
6
15
|
import fs from 'node:fs'
|
|
7
16
|
import querystring from 'querystring'
|
|
@@ -37,7 +46,7 @@ export class HelperRest {
|
|
|
37
46
|
}
|
|
38
47
|
} else if (this.config_entity[baseEntity]?.connection?.auth?.options?.serviceAccountKeyFile) { // Google, setting baseUrls to googleapis
|
|
39
48
|
const type = this.config_entity[baseEntity]?.connection?.auth?.type
|
|
40
|
-
if (type === '
|
|
49
|
+
if (type === 'oauthJwtBearer' || type === 'oauth') { // includes oauth because of email.auth.type
|
|
41
50
|
this.config_entity[baseEntity].connection.baseUrls = [this.googleUrl]
|
|
42
51
|
}
|
|
43
52
|
}
|
|
@@ -99,7 +108,7 @@ export class HelperRest {
|
|
|
99
108
|
}
|
|
100
109
|
break
|
|
101
110
|
|
|
102
|
-
case '
|
|
111
|
+
case 'oauthSamlBearer':
|
|
103
112
|
tokenUrl = this.config_entity[baseEntity].connection.auth.options.tokenUrl
|
|
104
113
|
const context = null
|
|
105
114
|
const cert = fs.readFileSync(this.config_entity[baseEntity].connection.auth.options.certificate.cert).toString()
|
|
@@ -123,7 +132,7 @@ export class HelperRest {
|
|
|
123
132
|
}
|
|
124
133
|
break
|
|
125
134
|
|
|
126
|
-
case '
|
|
135
|
+
case 'oauthJwtBearer':
|
|
127
136
|
let privateKey = ''
|
|
128
137
|
let jwtAttr: Record<string, any> = {}
|
|
129
138
|
const serviceAccountKeyFile = this.config_entity[baseEntity]?.connection?.auth?.options?.serviceAccountKeyFile
|
|
@@ -284,7 +293,7 @@ export class HelperRest {
|
|
|
284
293
|
}
|
|
285
294
|
|
|
286
295
|
// Support no auth, header based auth (e.g., config {"options":{"headers":{"APIkey":"123"}}}),
|
|
287
|
-
// basicAuth, bearerAuth, oauth, tokenAuth,
|
|
296
|
+
// basicAuth, bearerAuth, oauth, tokenAuth, oauthSamlBearer, oauthJwtBearer and auth PassTrough using request header authorization
|
|
288
297
|
|
|
289
298
|
let orgConnection: any
|
|
290
299
|
if (opt?.connection) { // allow overriding/extending configuration connection by caller argument opt.connection
|
|
@@ -325,19 +334,19 @@ export class HelperRest {
|
|
|
325
334
|
}
|
|
326
335
|
param.options.headers['Authorization'] = 'Bearer ' + Buffer.from(this.config_entity[baseEntity].connection.auth.options.token).toString('base64')
|
|
327
336
|
break
|
|
328
|
-
case '
|
|
337
|
+
case 'oauthSamlBearer':
|
|
329
338
|
if (!this.config_entity[baseEntity]?.connection?.auth?.options?.clientId || !this.config_entity[baseEntity]?.connection?.auth?.options?.companyId
|
|
330
339
|
|| !this.config_entity[baseEntity]?.connection?.auth?.options?.certificate?.key) {
|
|
331
|
-
const err = new Error(`auth.type '
|
|
340
|
+
const err = new Error(`auth.type 'oauthSamlBearer' - missing configuration entity.${baseEntity}.connection.auth.options...`)
|
|
332
341
|
throw err
|
|
333
342
|
}
|
|
334
343
|
param.accessToken = await this.getAccessToken(baseEntity, ctx)
|
|
335
344
|
param.options.headers['Authorization'] = `Bearer ${param.accessToken.access_token}`
|
|
336
345
|
break
|
|
337
|
-
case '
|
|
346
|
+
case 'oauthJwtBearer':
|
|
338
347
|
if (this.config_entity[baseEntity]?.connection?.auth?.options?.serviceAccountKeyFile) { // Google Service Account
|
|
339
348
|
if (!this.config_entity[baseEntity]?.connection?.auth?.options?.scope || !this.config_entity[baseEntity]?.connection?.auth?.options?.subject) {
|
|
340
|
-
const err = new Error(`auth.type '
|
|
349
|
+
const err = new Error(`auth.type 'oauthJwtBearer' - using auth.options 'serviceAccountKeyFile' also requires mandatory configuration entity.${baseEntity}.connection.auth.options.scope/subject`)
|
|
341
350
|
throw err
|
|
342
351
|
}
|
|
343
352
|
} else if (!this.config_entity[baseEntity]?.connection?.auth?.options?.tokenUrl
|
|
@@ -347,7 +356,7 @@ export class HelperRest {
|
|
|
347
356
|
|| !this.config_entity[baseEntity]?.connection?.auth?.options?.audience
|
|
348
357
|
|| !this.config_entity[baseEntity]?.connection?.auth?.options?.certificate?.key
|
|
349
358
|
) {
|
|
350
|
-
const err = new Error(`auth.type '
|
|
359
|
+
const err = new Error(`auth.type 'oauthJwtBearer' - when not using auth.options 'serviceAccountKeyFile' which is related to Google, following auth.options is mandatory: tokenUrl, scope, subject, issuer, audience, certificate.key`)
|
|
351
360
|
throw err
|
|
352
361
|
}
|
|
353
362
|
|
|
@@ -428,9 +437,9 @@ export class HelperRest {
|
|
|
428
437
|
return cli // final client
|
|
429
438
|
}
|
|
430
439
|
//
|
|
431
|
-
// url path - none config based and used as is (no cache)
|
|
440
|
+
// url path - none config based (enpoint.entity) and used as is (no cache)
|
|
432
441
|
//
|
|
433
|
-
this.scimgateway.logDebug(baseEntity, `${action}: Using
|
|
442
|
+
this.scimgateway.logDebug(baseEntity, `${action}: Using raw client`)
|
|
434
443
|
let options: any = {
|
|
435
444
|
json: true,
|
|
436
445
|
headers: {
|
|
@@ -440,7 +449,7 @@ export class HelperRest {
|
|
|
440
449
|
port: urlObj.port,
|
|
441
450
|
protocol: urlObj.protocol,
|
|
442
451
|
method: method,
|
|
443
|
-
path: urlObj.pathname,
|
|
452
|
+
path: urlObj.pathname + urlObj.search,
|
|
444
453
|
}
|
|
445
454
|
|
|
446
455
|
// proxy
|
|
@@ -653,7 +662,7 @@ export class HelperRest {
|
|
|
653
662
|
* ```
|
|
654
663
|
* type defines authentication being used
|
|
655
664
|
* if type not defined, no authentication used
|
|
656
|
-
* valid type is: `basic`, `oauth`, `token`, `bearer` or `
|
|
665
|
+
* valid type is: `basic`, `oauth`, `token`, `bearer` or `oauthSamlBearer`
|
|
657
666
|
*
|
|
658
667
|
* for each valid type there are different auth.options
|
|
659
668
|
*
|
|
@@ -699,7 +708,7 @@ export class HelperRest {
|
|
|
699
708
|
* }
|
|
700
709
|
* ```
|
|
701
710
|
*
|
|
702
|
-
* type=**"
|
|
711
|
+
* type=**"oauthSamlBearer"** having auth.options:
|
|
703
712
|
* ```
|
|
704
713
|
* {
|
|
705
714
|
* "options": {
|
|
@@ -715,7 +724,7 @@ export class HelperRest {
|
|
|
715
724
|
* }
|
|
716
725
|
* ```
|
|
717
726
|
*
|
|
718
|
-
* type=**"
|
|
727
|
+
* type=**"oauthJwtBearer"** having auth.options:
|
|
719
728
|
* ```
|
|
720
729
|
* // Google API - baseUrls automatically set to [https://www.googleapis.com]
|
|
721
730
|
* {
|
package/lib/logger.ts
CHANGED