scimgateway 4.5.5 → 4.5.7
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 +22 -6
- package/config/plugin-api.json +2 -2
- package/config/plugin-entra-id.json +2 -2
- package/config/plugin-ldap.json +2 -2
- package/config/plugin-loki.json +2 -2
- package/config/plugin-mongodb.json +2 -2
- package/config/plugin-mssql.json +2 -2
- package/config/plugin-saphana.json +2 -2
- package/config/plugin-scim.json +2 -2
- package/config/plugin-soap.json +2 -2
- package/lib/plugin-ldap.js +9 -1
- package/lib/plugin-loki.js +16 -0
- package/lib/plugin-mongodb.js +18 -0
- package/lib/scim-stream.js +1 -1
- package/lib/scimgateway.js +133 -61
- package/lib/utils.js +8 -4
- package/package.json +1 -1
- package/test/lib/plugin-loki.js +28 -2
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ Validated through IdP's:
|
|
|
9
9
|
|
|
10
10
|
- Symantec/Broadcom/CA Identity Manager
|
|
11
11
|
- Microsoft Entra ID
|
|
12
|
-
- OneLogin
|
|
12
|
+
- One Identity/OneLogin
|
|
13
13
|
- Okta
|
|
14
14
|
- Omada
|
|
15
15
|
- SailPoint/IdentityNow
|
|
@@ -212,8 +212,8 @@ Below shows an example of config\plugin-saphana.json
|
|
|
212
212
|
"version": "2.0",
|
|
213
213
|
"skipTypeConvert" : false,
|
|
214
214
|
"skipMetaLocation" false,
|
|
215
|
-
"
|
|
216
|
-
"
|
|
215
|
+
"groupMemberOfUser": false
|
|
216
|
+
"usePutSoftSync" : false
|
|
217
217
|
},
|
|
218
218
|
"log": {
|
|
219
219
|
"loglevel": {
|
|
@@ -379,9 +379,9 @@ Definitions in `endpoint` object are customized according to our plugin code. Pl
|
|
|
379
379
|
|
|
380
380
|
- **scim.skipMetaLocation** - true or false, default false. If set to true, `meta.location` which contains protocol and hostname from request-url, will be excluded from response e.g. `"{...,meta":{"location":"https://my-company.com/<...>"}}`. If using reverse proxy and not including headers `X-Forwarded-Proto` and `X-Forwarded-Host`, originator will be the proxy and we might not want to expose internal protocol and hostname being used by the proxy request.
|
|
381
381
|
|
|
382
|
-
- **scim.
|
|
382
|
+
- **scim."groupMemberOfUser** - true or false, default false. If body contains groups and groupMemberOfUser=true, groups attribute will remain at user object (groups are member of user) instead of default user member of groups that will use modifyGroup method for maintaining group members.
|
|
383
383
|
|
|
384
|
-
- **scim.
|
|
384
|
+
- **scim.usePutSoftSync** - true or false, default false. `PUT /Users/bjensen` will replace the user bjensen with body content. If set to `true`, only PUT body content will be replaced. Any additional existing user attributes and groups supported by plugin will remain as-is.
|
|
385
385
|
|
|
386
386
|
- **log.loglevel.file** - off, error, info, or debug. Output to plugin-logfile e.g. `logs\plugin-saphana.log`
|
|
387
387
|
|
|
@@ -522,7 +522,7 @@ Definitions in `endpoint` object are customized according to our plugin code. Pl
|
|
|
522
522
|
|
|
523
523
|
## Manual startup
|
|
524
524
|
|
|
525
|
-
Gateway can
|
|
525
|
+
Gateway can be started from a command window running in administrative mode
|
|
526
526
|
|
|
527
527
|
3 ways to start:
|
|
528
528
|
|
|
@@ -1163,6 +1163,22 @@ MIT © [Jarle Elshaug](https://www.elshaug.xyz)
|
|
|
1163
1163
|
|
|
1164
1164
|
## Change log
|
|
1165
1165
|
|
|
1166
|
+
### v4.5.7
|
|
1167
|
+
|
|
1168
|
+
[Fixed]
|
|
1169
|
+
|
|
1170
|
+
- PUT changes introduced in v4.4.6 did not handle PUT /Groups correctly
|
|
1171
|
+
|
|
1172
|
+
[Improved]
|
|
1173
|
+
- configuration scim.usePutGroupMemberOfUser replaced by scim.groupMemberOfUser
|
|
1174
|
+
- misc cosmetics
|
|
1175
|
+
|
|
1176
|
+
### v4.5.6
|
|
1177
|
+
|
|
1178
|
+
[Improved]
|
|
1179
|
+
|
|
1180
|
+
- plugin-ldap preserve multivalue-attribute order on modify. Do not apply to groups/members.
|
|
1181
|
+
|
|
1166
1182
|
### v4.5.5
|
|
1167
1183
|
|
|
1168
1184
|
[Fixed]
|
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/plugin-ldap.js
CHANGED
|
@@ -1110,7 +1110,15 @@ const doRequest = async (baseEntity, method, base, ldapOptions, ctx) => {
|
|
|
1110
1110
|
for (const key in options.modification) {
|
|
1111
1111
|
const mod = {}
|
|
1112
1112
|
mod.type = key
|
|
1113
|
-
if (Array.isArray(options.modification[key]))
|
|
1113
|
+
if (Array.isArray(options.modification[key])) {
|
|
1114
|
+
mod.values = options.modification[key]
|
|
1115
|
+
if (mod.values.length > 1) { // delete before replace to keep inbound order
|
|
1116
|
+
changes.push({
|
|
1117
|
+
operation: 'delete',
|
|
1118
|
+
modification: {type: key, values: []}
|
|
1119
|
+
})
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1114
1122
|
else {
|
|
1115
1123
|
if (typeof options.modification[key] === 'string') mod.values = [options.modification[key]]
|
|
1116
1124
|
else mod.values = [options.modification[key].toString()]
|
package/lib/plugin-loki.js
CHANGED
|
@@ -510,6 +510,22 @@ scimgateway.createGroup = async (baseEntity, groupObj, ctx) => {
|
|
|
510
510
|
if (groupObj.externalId) groupObj.id = groupObj.externalId // for loki-plugin (scim endpoint) id is mandatory and set to displayName
|
|
511
511
|
else groupObj.id = groupObj.displayName
|
|
512
512
|
|
|
513
|
+
if (groupObj.members) {
|
|
514
|
+
const noneExistingUsers = []
|
|
515
|
+
await Promise.all(groupObj.members.map(async (el) => {
|
|
516
|
+
if (el.value) {
|
|
517
|
+
const getObj = { attribute: 'id', operator: 'eq', value: el.value }
|
|
518
|
+
const usrs = await scimgateway.getUsers(baseEntity, getObj, ['id', 'displayName'], ctx) // check if user exist
|
|
519
|
+
if (!usrs || !usrs.Resources || usrs.Resources.length !== 1 || usrs.Resources[0].id !== el.value) {
|
|
520
|
+
noneExistingUsers.push(el.value)
|
|
521
|
+
} else if (usrs.Resources[0].displayName) {
|
|
522
|
+
el.display = usrs.Resources[0].displayName
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
}))
|
|
526
|
+
if (noneExistingUsers.length > 0) throw new Error(`following user(s) does not exist and can't be member of group: ${noneExistingUsers.join(', ')}`)
|
|
527
|
+
}
|
|
528
|
+
|
|
513
529
|
try {
|
|
514
530
|
await groups.insert(groupObj)
|
|
515
531
|
return null
|
package/lib/plugin-mongodb.js
CHANGED
|
@@ -629,6 +629,24 @@ scimgateway.createGroup = async (baseEntity, groupObj, ctx) => {
|
|
|
629
629
|
else groupObj.id = groupObj.displayName
|
|
630
630
|
groupObj = encodeDotDate(groupObj)
|
|
631
631
|
|
|
632
|
+
if (groupObj.members) {
|
|
633
|
+
const noneExistingUsers = []
|
|
634
|
+
await Promise.all(groupObj.members.map(async (el) => {
|
|
635
|
+
if (el.value) {
|
|
636
|
+
const getObj = { attribute: 'id', operator: 'eq', value: el.value }
|
|
637
|
+
const usrs = await scimgateway.getUsers(baseEntity, getObj, ['id', 'displayName'], ctx) // check if user exist
|
|
638
|
+
if (!usrs || !usrs.Resources || usrs.Resources.length !== 1 || usrs.Resources[0].id !== el.value) {
|
|
639
|
+
noneExistingUsers.push(el.value)
|
|
640
|
+
} else if (usrs.Resources[0].displayName) {
|
|
641
|
+
el.display = usrs.Resources[0].displayName
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
}))
|
|
645
|
+
if (noneExistingUsers.length > 0) {
|
|
646
|
+
throw new Error(`following user(s) does not exist and can't be member of group: ${noneExistingUsers.join(', ')}`)
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
|
|
632
650
|
try {
|
|
633
651
|
const groups = config.entity[baseEntity][clientIdentifier].collection.groups
|
|
634
652
|
await groups.insertOne(groupObj)
|
package/lib/scim-stream.js
CHANGED
|
@@ -10,4 +10,4 @@
|
|
|
10
10
|
// Note: scim-stream.js is part of the licensed SCIM Stream which is a prerequisite for message Pub/Sub
|
|
11
11
|
// for details see: https://elshaug.xyz/docs/scim-stream
|
|
12
12
|
//
|
|
13
|
-
'use strict';const a0_0x59b720=a0_0x449c;(function(_0x42bd45,_0x277975){const _0x1de1f9=a0_0x449c,_0xe419f7=_0x42bd45();while(!![]){try{const _0x3ff116=-parseInt(_0x1de1f9(0x18b))/0x1*(parseInt(_0x1de1f9(0x206))/0x2)+parseInt(_0x1de1f9(0x1a8))/0x3*(-parseInt(_0x1de1f9(0x1dd))/0x4)+parseInt(_0x1de1f9(0x17d))/0x5+-parseInt(_0x1de1f9(0x1d5))/0x6+-parseInt(_0x1de1f9(0x13e))/0x7+-parseInt(_0x1de1f9(0x165))/0x8*(parseInt(_0x1de1f9(0x208))/0x9)+parseInt(_0x1de1f9(0x20b))/0xa*(parseInt(_0x1de1f9(0x200))/0xb);if(_0x3ff116===_0x277975)break;else _0xe419f7['push'](_0xe419f7['shift']());}catch(_0x375bb3){_0xe419f7['push'](_0xe419f7['shift']());}}}(a0_0x1758,0xe7181));function a0_0x1758(){const _0x46e2af=['true','Reconnect','drain','decode','toString','Subscriber','subscriber\x20message\x20error:\x20message\x20baseEntity=','StringCodec','value','createUser','doIncrement','servers','trim','hasOwnProperty','3892356sFmLER','sub','deleteGroup','createGroup','getProcessed','filter_subject','ack','display','2421352uxcZOk','getGroups',']\x20client\x20is\x20attempting\x20to\x20reconnect\x20',']\x20initialization\x20error:\x20missing\x20configuration\x20stream.baseUrls','publisher\x20error:\x20none\x20JSON\x20formatted\x20response:\x20','\x20message\x20json\x20parsing\x20error:\x20',']\x20error:\x20','tenant','mkdirSync','createWriteStream','typeId','parse','SIGTERM','subscriber\x20message\x20error:\x20message\x20not\x20JSON\x20formatted','error','\x20message\x20response:\x20','operation',']\x20connect\x20error:\x20',']\x20connected\x20','maxReconnectAttempts','consumers',']\x20initialization\x20error:\x20missing\x20certificate\x20configuration','patchApi','obj','modifyGroup','stringify','configDir','User','convertedScim20',']\x20client\x20consumer\x20reinitiated\x20because\x20of\x20','groups','user','\x20message:\x20user\x20not\x20deleted\x20because\x20of\x20configuration\x20modifyOnly=true','\x20missing\x20user\x20object\x20in\x20message:\x20','\x20createUser()\x20obj=','11WWklnF','\x20Replace\x20User\x20id=','Error','replaceDomains','subject',']\x20subscriber[','214DDcUAT','\x20message\x20handled:\x20','11014551pzSQjN','\x20-\x20','maxPingOut','41886060BNFHwL','forEach','\x20role\x20removal\x20error:\x20','\x20subscriber\x20error:\x20scimgateway\x20endpoint\x20connect\x20problem\x20-\x20will\x20do\x20auto\x20retry\x20until\x20connected','skipConvertRolesToGroups','name','status','deleteUser','SIGINT','push','password','\x20handling\x20message:\x20','getUsers()\x20getObj=','\x20message:\x20user\x20not\x20created\x20because\x20of\x20configuration\x20modifyOnly=true','update',']\x20initialization\x20error:\x20configuration\x20scim.usePutSoftSync\x20must\x20be\x20set\x20to\x20true\x20when\x20subscribing\x20to\x20ENTRA\x20or\x20HR\x20topics','info','\x20error:\x20missing\x20id}','debug','undefined','active','getAppRoles','DebugEvents','##doIncrement','replace','elementnumber','schemas','publisher[','roles','foldReplacing',']\x20publisher[','replaceUsrGrp','Errors','startsWith','jwt','\x20processing\x20incoming\x20message','_info','\x20message:\x20user\x20not\x20created\x20because\x20of\x20active=false','utf-8','level','SCIM\x20Stream\x20-\x20Autogenerated','503','generateUserPassword','GW.','get','/Users/','utf8',']\x20error:\x20client\x20have\x20not\x20been\x20initialized','handle','AckPolicy','indexOf','constructor','Resources','Publisher','UnableConnectingHost','SCIM\x20Stream','gwName','getServer','\x20Delete\x20User\x20userName=','isArray','ConsumerNotFound',',\x20obj=','7072170VIaibz','request','internal\x20stream\x20policy\x20have\x20been\x20changed\x20-\x20central\x20SCIM\x20Stream\x20must\x20be\x20stopped\x20and\x20corresponding\x20./jetstream\x20folder\x20deleted\x20before\x20startup\x20allowing\x20new\x20policy','reconnect','ENTRA.','jetstream','normalize','headers','certificate','isClosed',']\x20client\x20disconnected\x20','connect','getApi','copyObj','false','\x20result=','\x27\x20not\x20supported','substring','append','\x20Delete\x20User\x20id=','type','subscribe','modifyUser','attributes',',\x20id=',']\x20client\x20reconnected\x20','body','write','ETIMEDOUT','\x20convertedScim20\x20error:\x20',']\x20initialization\x20error:\x20missing\x20configuration\x20nats.subject','\x20error:\x20more\x20than\x20one\x20user\x20were\x20found}','durable_','server_name','\x20not\x20equal\x20subscriber\x20configured\x20baseEntity=','\x20done','approles','secret','add','8nnZXUe','activityOperation','exports','ctxCopy','split','\x20=>\x20subscriber\x20not\x20activated','firstn','/certs/',']\x20initialization\x20certificate\x20error:\x20','increment','\x22,\x22errName\x22:\x22','StaleConnection','pingInterval','\x20getUserId()\x20error:\x20','prototype','\x20Create\x20User\x20userName=','Disconnect','\x20Create\x20userName=','displayName','timeout','Application','baseEntity','transports','/approles','6431575YFeDcR','string','ctx','approles_',']\x20client\x20error\x20','waitOnFirstConnect','closed','baseUrls','file','\x20group\x20removal\x20error:\x20','from','tls','\x20error:\x20','Msg-Id','9721TSXwMN',']\x20error:\x20missing\x20entity\x20configuration\x20for\x20baseEntity=','authenticator','HR.','Events','data','deleteApi','replaceAll','call','respond','../lib/utils','close','path','detail','_autogenerated.cfg','pluginName','existsSync','reconnectTimeWait','randomUUID',']\x20error:\x20no\x20subscribers/responders\x20to\x20subject\x20','publisher\x20response\x20error:\x20','\x20message:\x20user\x20does\x20not\x20exist','file-not-configured','rejectUnauthorized','\x20-\x20will\x20do\x20auto\x20connect\x20when\x20available\x20-\x20however,\x20please\x20verify\x20stream\x20configuration','modifyOnly',']\x20closed\x20with\x20error:\x20','ConsumerEvents','\x20-\x20will\x20do\x20auto\x20reconnect\x20when\x20connection\x20becomes\x20available','3LOiqCh','uppercase','userName','UnableConnectingService','lowercase','onCreate','message',']\x20initialization\x20error:\x20missing\x20configuration\x20nats.tenant','\x20missing\x20mandatory\x20user.userName\x20in\x20message:\x20','getUsers','Reconnecting','subscriber\x20message\x20error:\x20handle\x20\x27','join','publish','ENOTFOUND',',false','logger','includes','length','postApi','deleteUserOnLastGroupRoleRemoval','Operations','config','params','toLowerCase',',\x20attributes=',']\x20initialization\x20error:\x20missing\x20configuration\x20nats','\x20(count=','nats','jwtAuthenticator','toUpperCase'];a0_0x1758=function(){return _0x46e2af;};return a0_0x1758();}const nats=require('nats'),ascii127=require('fold-to-ascii'),fs=require('fs'),utils=require(a0_0x59b720(0x195)),path=require(a0_0x59b720(0x197)),crypto=require('crypto');function a0_0x449c(_0x1114b5,_0x3b4de3){const _0x175861=a0_0x1758();return a0_0x449c=function(_0x449c97,_0x91ca13){_0x449c97=_0x449c97-0x111;let _0x3c1a15=_0x175861[_0x449c97];return _0x3c1a15;},a0_0x449c(_0x1114b5,_0x3b4de3);}module['exports'][a0_0x59b720(0x1cc)]=function(_0x427e4a){const _0xbd089d=a0_0x59b720,_0x1339f8=_0x427e4a,_0xf2a4c2={};let _0x36befa='';for(let _0x1a4610=0x0;_0x1a4610<_0x1339f8[_0xbd089d(0x1b8)][_0xbd089d(0x17b)][_0xbd089d(0x1ba)];_0x1a4610++){if(_0x1339f8[_0xbd089d(0x1b8)]['transports'][_0x1a4610][_0xbd089d(0x210)]===_0xbd089d(0x185)){_0x36befa=_0x1339f8[_0xbd089d(0x1b8)][_0xbd089d(0x17b)][_0x1a4610][_0xbd089d(0x127)];break;}}const _0x187267=''+(_0x36befa===_0xbd089d(0x112)?'\x0a':''),_0x3bc994=async(_0x134bfa,_0x330f2)=>{const _0x25bde2=_0xbd089d,_0x3de2e0=_0xf2a4c2[_0x134bfa][_0x25bde2(0x1be)]?.['nats']?.[_0x25bde2(0x204)];let _0x486a4e;try{_0x486a4e=await nats['connect'](_0x330f2);if(_0x486a4e['info'][_0x25bde2(0x15f)]!==_0x25bde2(0x137)){_0x486a4e['close']();return;}_0xf2a4c2[_0x134bfa]['nc']=_0x486a4e,_0x34e901(_0x134bfa,_0x486a4e),_0xb7c83(_0x134bfa,_0x486a4e);}catch(_0x985b02){_0x1339f8[_0x25bde2(0x1b8)]['error'](_0x1339f8[_0x25bde2(0x138)]+'['+_0x1339f8[_0x25bde2(0x19a)]+_0x25bde2(0x205)+_0x134bfa+']['+_0x3de2e0+_0x25bde2(0x1ee)+_0x985b02[_0x25bde2(0x1ae)]+_0x25bde2(0x1a3)),_0x330f2['waitOnFirstConnect']=!![];try{_0x486a4e=await nats[_0x25bde2(0x149)](_0x330f2);if(_0x486a4e[_0x25bde2(0x21b)][_0x25bde2(0x15f)]!==_0x25bde2(0x137)){_0x486a4e[_0x25bde2(0x196)]();return;}_0xf2a4c2[_0x134bfa]['nc']=_0x486a4e,_0x34e901(_0x134bfa,_0x486a4e),_0xb7c83(_0x134bfa,_0x486a4e);}catch(_0x5558e1){_0x1339f8['logger'][_0x25bde2(0x1eb)](_0x1339f8['gwName']+'['+_0x1339f8[_0x25bde2(0x19a)]+_0x25bde2(0x205)+_0x134bfa+']['+_0x3de2e0+_0x25bde2(0x1ee)+_0x5558e1[_0x25bde2(0x1ae)]);return;}}_0x1339f8[_0x25bde2(0x1b8)][_0x25bde2(0x112)](_0x1339f8['gwName']+'['+_0x1339f8[_0x25bde2(0x19a)]+']\x20subscriber['+_0x134bfa+']['+_0x3de2e0+']\x20connected\x20'+(_0x330f2[_0x25bde2(0x188)]['ca']?'tls':'')+'\x20'+_0x486a4e[_0x25bde2(0x139)]()),_0x486a4e[_0x25bde2(0x183)]()['then'](_0x6dacef=>{const _0x1e4f23=_0x25bde2;_0x6dacef&&_0x1339f8[_0x1e4f23(0x1b8)][_0x1e4f23(0x1eb)](_0x1339f8[_0x1e4f23(0x138)]+'['+_0x1339f8[_0x1e4f23(0x19a)]+_0x1e4f23(0x205)+_0x134bfa+']['+_0x3de2e0+_0x1e4f23(0x1a5)+_0x6dacef[_0x1e4f23(0x1ae)]);});};this['add']=async(_0x232764,_0x40132a)=>{const _0x3d6970=_0xbd089d;if(!_0x40132a?.[_0x3d6970(0x1c4)]){_0x1339f8[_0x3d6970(0x1b8)]['error'](_0x1339f8[_0x3d6970(0x138)]+'['+_0x1339f8[_0x3d6970(0x19a)]+_0x3d6970(0x205)+_0x232764+_0x3d6970(0x1c2));return;}if(!_0x40132a?.['nats']?.[_0x3d6970(0x1e4)]){_0x1339f8[_0x3d6970(0x1b8)][_0x3d6970(0x1eb)](_0x1339f8[_0x3d6970(0x138)]+'['+_0x1339f8[_0x3d6970(0x19a)]+_0x3d6970(0x205)+_0x232764+_0x3d6970(0x1af));return;}if(!_0x40132a?.[_0x3d6970(0x1c4)]?.[_0x3d6970(0x204)]){_0x1339f8[_0x3d6970(0x1b8)][_0x3d6970(0x1eb)](_0x1339f8[_0x3d6970(0x138)]+'['+_0x1339f8[_0x3d6970(0x19a)]+_0x3d6970(0x205)+_0x232764+_0x3d6970(0x15c));return;}if(!_0x40132a?.['certificate']?.['ca']){_0x1339f8['logger'][_0x3d6970(0x1eb)](_0x1339f8[_0x3d6970(0x138)]+'['+_0x1339f8[_0x3d6970(0x19a)]+_0x3d6970(0x205)+_0x232764+_0x3d6970(0x1f2));return;}if(!_0x40132a['baseUrls']||!Array[_0x3d6970(0x13b)](_0x40132a[_0x3d6970(0x184)])||_0x40132a[_0x3d6970(0x184)][_0x3d6970(0x1ba)]<0x1){_0x1339f8['logger'][_0x3d6970(0x1eb)](_0x1339f8[_0x3d6970(0x138)]+'['+_0x1339f8[_0x3d6970(0x19a)]+_0x3d6970(0x205)+_0x232764+_0x3d6970(0x1e0));return;}if(!_0x40132a['usePutSoftSync']){const _0x27b106=_0x40132a?.[_0x3d6970(0x1c4)]?.[_0x3d6970(0x204)][_0x3d6970(0x1c6)]();if(_0x27b106[_0x3d6970(0x121)](_0x3d6970(0x142))||_0x27b106['startsWith'](_0x3d6970(0x18e))){_0x1339f8[_0x3d6970(0x1b8)][_0x3d6970(0x1eb)](_0x1339f8['gwName']+'['+_0x1339f8[_0x3d6970(0x19a)]+']\x20subscriber['+_0x232764+_0x3d6970(0x21a));return;}}const _0x31f270={};try{let _0x2f5d2a=path[_0x3d6970(0x1b4)](_0x1339f8[_0x3d6970(0x1f7)],_0x3d6970(0x16c),_0x40132a?.['certificate']?.['ca']||'file-not-configured');(_0x40132a?.[_0x3d6970(0x146)]?.['ca']?.[_0x3d6970(0x121)]('/')||_0x40132a?.['certificate']?.['ca']?.['includes']('\x5c'))&&(_0x2f5d2a=_0x40132a['certificate']['ca']),_0x31f270['ca']=[fs['readFileSync'](_0x2f5d2a)],_0x31f270[_0x3d6970(0x1a2)]=!![];}catch(_0x117da2){_0x1339f8['logger'][_0x3d6970(0x1eb)](_0x1339f8['gwName']+'['+_0x1339f8[_0x3d6970(0x19a)]+']\x20subscriber['+_0x232764+_0x3d6970(0x16d)+_0x117da2['message']);return;}const _0x2d806b={},_0x2f11cb=new TextEncoder()['encode'](_0x40132a?.[_0x3d6970(0x1c4)]?.[_0x3d6970(0x163)]),_0x124d59=_0x40132a?.[_0x3d6970(0x1c4)]?.['jwt'];_0x2d806b[_0x3d6970(0x18d)]=nats['jwtAuthenticator'](_0x124d59,_0x2f11cb),_0x2d806b[_0x3d6970(0x1d2)]=_0x40132a[_0x3d6970(0x184)],_0x2d806b[_0x3d6970(0x188)]=_0x31f270,_0x2d806b['waitOnFirstConnect']=![],_0x2d806b[_0x3d6970(0x141)]=!![],_0x2d806b['reconnectTimeWait']=0x3e8*0xa,_0x2d806b['maxReconnectAttempts']=-0x1,_0x2d806b[_0x3d6970(0x171)]=0x2*0x3c*0x3e8,_0x2d806b['maxPingOut']=0x5,_0x2d806b['debug']=![],_0xf2a4c2[_0x232764]={},_0xf2a4c2[_0x232764][_0x3d6970(0x1be)]=_0x40132a,_0xf2a4c2[_0x232764]['nc']=undefined,_0xf2a4c2[_0x232764][_0x3d6970(0x1d6)]=undefined,_0x3bc994(_0x232764,_0x2d806b);};const _0xb7c83=async(_0xbade0,_0x49deb2)=>{const _0x3dfe9f=_0xbd089d,_0x51bf38=_0xf2a4c2[_0xbade0][_0x3dfe9f(0x1be)],_0x4f488c=_0x51bf38?.[_0x3dfe9f(0x1c4)]?.[_0x3dfe9f(0x204)];if(!_0x49deb2){_0x1339f8[_0x3dfe9f(0x1b8)][_0x3dfe9f(0x1eb)](_0x1339f8[_0x3dfe9f(0x138)]+'['+_0x1339f8[_0x3dfe9f(0x19a)]+_0x3dfe9f(0x205)+_0xbade0+']['+_0x4f488c+_0x3dfe9f(0x12f));return;}const _0x13d681=async(_0x591d35,_0x45402b)=>{const _0xcd3ef=_0x3dfe9f;try{_0x1339f8[_0xcd3ef(0x1b8)][_0xcd3ef(0x21b)](_0x591d35+_0xcd3ef(0x216)+_0x45402b);let _0x2071a6;try{if(_0x51bf38[_0xcd3ef(0x203)]&&Array['isArray'](_0x51bf38[_0xcd3ef(0x203)]))for(let _0x54fdfb=0x0;_0x54fdfb<_0x51bf38[_0xcd3ef(0x203)][_0xcd3ef(0x1ba)];_0x54fdfb++){const _0x42fb98=_0x51bf38['replaceDomains'][_0x54fdfb];if(!_0x42fb98[_0xcd3ef(0x187)]||!_0x42fb98[_0xcd3ef(0x187)][_0xcd3ef(0x1b9)]('.')||!_0x42fb98['to']||!_0x42fb98['to']['includes']('.'))continue;const _0x4ffc89=new RegExp('@'+_0x42fb98[_0xcd3ef(0x187)]+'\x22','gi');_0x45402b=_0x45402b[_0xcd3ef(0x118)](_0x4ffc89,'@'+_0x42fb98['to']+'\x22');}_0x2071a6=JSON[_0xcd3ef(0x1e8)](_0x45402b);}catch(_0x2487c8){_0x1339f8[_0xcd3ef(0x1b8)]['error'](_0x591d35+_0xcd3ef(0x1e2)+_0x2487c8[_0xcd3ef(0x1ae)]+'\x20message:\x20'+_0x45402b),_0x1339f8['logger'][_0xcd3ef(0x112)](_0x591d35+_0xcd3ef(0x161)+_0x187267);return;}const _0x397e7b=_0x2071a6[_0xcd3ef(0x1fc)];if(!_0x397e7b){_0x1339f8[_0xcd3ef(0x1b8)][_0xcd3ef(0x1eb)](_0x591d35+_0xcd3ef(0x1fe)+JSON[_0xcd3ef(0x1f6)](_0x2071a6)),_0x1339f8[_0xcd3ef(0x1b8)]['debug'](_0x591d35+_0xcd3ef(0x161)+_0x187267);return;}if(!_0x397e7b[_0xcd3ef(0x1aa)]){_0x1339f8[_0xcd3ef(0x1b8)][_0xcd3ef(0x1eb)](_0x591d35+_0xcd3ef(0x1b0)+JSON['stringify'](_0x2071a6)),_0x1339f8[_0xcd3ef(0x1b8)][_0xcd3ef(0x112)](_0x591d35+_0xcd3ef(0x161)+_0x187267);return;}delete _0x397e7b[_0xcd3ef(0x11a)];let _0x2e5e17;_0x397e7b['id']&&(_0x2e5e17=_0x397e7b['id'],delete _0x397e7b['id']);let _0x4cd095;_0x397e7b[_0xcd3ef(0x1ad)]&&(_0x4cd095=utils[_0xcd3ef(0x14b)](_0x397e7b[_0xcd3ef(0x1ad)]),delete _0x397e7b['onCreate']);await _0x31ac6a(_0xbade0,_0x397e7b);const _0x16d57d=_0x397e7b[_0xcd3ef(0x1aa)];let _0x44fa85,_0x49a931;try{_0x44fa85=await _0x24fff6(_0xbade0,_0xcd3ef(0x1aa),_0x16d57d);}catch(_0x2f8d4a){_0x1339f8[_0xcd3ef(0x1b8)][_0xcd3ef(0x1eb)](_0x591d35+_0xcd3ef(0x172)+_0x2f8d4a[_0xcd3ef(0x1ae)]),_0x1339f8[_0xcd3ef(0x1b8)][_0xcd3ef(0x112)](_0x591d35+_0xcd3ef(0x161)+_0x187267);const _0xb41ab8=[_0xcd3ef(0x136),_0xcd3ef(0x1ab),'ECONNREFUSED',_0xcd3ef(0x1b6),_0xcd3ef(0x15a),_0xcd3ef(0x178)];for(const _0x58e807 in _0xb41ab8){if(_0x2f8d4a[_0xcd3ef(0x1ae)][_0xcd3ef(0x1b9)](_0x58e807))return!![];}return;}if(!_0x51bf38[_0xcd3ef(0x20f)]){let _0x5d599a=![];if(_0x2071a6[_0xcd3ef(0x1bd)]&&Array[_0xcd3ef(0x13b)](_0x2071a6['Operations']))for(let _0x45e685=0x0;_0x45e685<_0x2071a6[_0xcd3ef(0x1bd)][_0xcd3ef(0x1ba)];_0x45e685++){const _0x5929bb=_0x2071a6[_0xcd3ef(0x1bd)][_0x45e685];_0x5929bb['path'][_0xcd3ef(0x121)]('roles')&&(_0x5929bb[_0xcd3ef(0x197)]=_0xcd3ef(0x1fb),Array[_0xcd3ef(0x13b)](_0x5929bb[_0xcd3ef(0x1cf)])?(_0x5929bb['value'][0x0]['id']=_0x5929bb[_0xcd3ef(0x1cf)][0x0]['value'],_0x5929bb['value'][0x0][_0xcd3ef(0x1dc)]=_0x5929bb[_0xcd3ef(0x1cf)][0x0][_0xcd3ef(0x152)]+_0xcd3ef(0x209)+_0x5929bb[_0xcd3ef(0x1cf)][0x0][_0xcd3ef(0x1cf)],delete _0x5929bb[_0xcd3ef(0x1cf)][0x0][_0xcd3ef(0x1cf)],delete _0x5929bb[_0xcd3ef(0x1cf)][0x0]['type']):_0x5929bb['value']=[{'id':_0x5929bb[_0xcd3ef(0x1cf)],'display':_0x5929bb['value']}],delete _0x5929bb['typeId'],_0x5d599a=!![]);}if(_0x397e7b['roles']&&Array[_0xcd3ef(0x13b)](_0x397e7b[_0xcd3ef(0x11c)])&&_0x397e7b[_0xcd3ef(0x11c)][_0xcd3ef(0x1ba)]>0x0){if(!_0x397e7b[_0xcd3ef(0x1fb)])_0x397e7b[_0xcd3ef(0x1fb)]=[];if(!Array[_0xcd3ef(0x13b)](_0x397e7b[_0xcd3ef(0x1fb)]))_0x397e7b[_0xcd3ef(0x1fb)]=[];for(let _0x41c2b8=0x0;_0x41c2b8<_0x397e7b['roles']['length'];_0x41c2b8++){const _0x357dcf={},_0x4225dd=_0x397e7b[_0xcd3ef(0x11c)][_0x41c2b8];_0x357dcf['value']=_0x4225dd[_0xcd3ef(0x1cf)],_0x357dcf['display']=_0x4225dd[_0xcd3ef(0x152)]+_0xcd3ef(0x209)+_0x4225dd['display'],_0x397e7b['groups'][_0xcd3ef(0x214)](_0x357dcf);}delete _0x397e7b[_0xcd3ef(0x11c)],_0x5d599a=!![];}if(_0x5d599a)_0x1339f8['logger'][_0xcd3ef(0x112)](_0x591d35+'\x20roles\x20converted\x20to\x20groups:\x20'+JSON[_0xcd3ef(0x1f6)](_0x2071a6));}if(!_0x44fa85){if(_0x2071a6[_0xcd3ef(0x166)]===_0xcd3ef(0x212)){_0x1339f8['logger'][_0xcd3ef(0x112)](_0x591d35+_0xcd3ef(0x13a)+_0x16d57d+_0xcd3ef(0x1a0)),_0x1339f8[_0xcd3ef(0x1b8)][_0xcd3ef(0x112)](_0x591d35+'\x20done'+_0x187267);return;}if(_0x51bf38[_0xcd3ef(0x1a4)]&&_0x51bf38[_0xcd3ef(0x1a4)]===!![]){_0x1339f8['logger'][_0xcd3ef(0x112)](_0x591d35+_0xcd3ef(0x176)+_0x16d57d+_0xcd3ef(0x218)),_0x1339f8[_0xcd3ef(0x1b8)][_0xcd3ef(0x112)](_0x591d35+_0xcd3ef(0x161)+_0x187267);return;}if(Object[_0xcd3ef(0x173)][_0xcd3ef(0x1d4)][_0xcd3ef(0x193)](_0x397e7b,'active')){if(typeof _0x397e7b[_0xcd3ef(0x114)]===_0xcd3ef(0x17e)){const _0x12a41f=_0x397e7b[_0xcd3ef(0x114)]['toLowerCase']();if(_0x12a41f==='true')_0x397e7b[_0xcd3ef(0x114)]=!![];else{if(_0x12a41f===_0xcd3ef(0x14c))_0x397e7b[_0xcd3ef(0x114)]=![];}}if(_0x397e7b['active']===![]){_0x1339f8[_0xcd3ef(0x1b8)]['debug'](_0x591d35+_0xcd3ef(0x176)+_0x16d57d+_0xcd3ef(0x125)),_0x1339f8[_0xcd3ef(0x1b8)][_0xcd3ef(0x112)](_0x591d35+_0xcd3ef(0x161)+_0x187267);return;}}_0x1339f8[_0xcd3ef(0x1b8)][_0xcd3ef(0x112)](_0x591d35+_0xcd3ef(0x174)+_0x16d57d);const _0x34106a=utils[_0xcd3ef(0x14b)](_0x397e7b);try{delete _0x34106a[_0xcd3ef(0x1fb)];!_0x34106a[_0xcd3ef(0x215)]&&_0x51bf38[_0xcd3ef(0x12a)]&&_0x51bf38[_0xcd3ef(0x12a)]===!![]&&(_0x34106a[_0xcd3ef(0x215)]=utils['createRandomPassword'](0xf));if(_0x4cd095||_0x2e5e17){if(_0x4cd095)for(const _0x1b3801 in _0x4cd095){_0x34106a[_0x1b3801]=_0x4cd095[_0x1b3801];}if(_0x2e5e17)_0x34106a['id']=_0x2e5e17;await _0x31ac6a(_0xbade0,_0x34106a);}await _0x1339f8['createUser'](_0xbade0,_0x34106a),_0x397e7b[_0xcd3ef(0x1fb)]&&Array[_0xcd3ef(0x13b)](_0x397e7b[_0xcd3ef(0x1fb)])&&_0x397e7b[_0xcd3ef(0x1fb)]['length']>0x0&&(_0x49a931=await _0x24fff6(_0xbade0,_0xcd3ef(0x1aa),_0x16d57d));}catch(_0x5f7ce0){_0x1339f8[_0xcd3ef(0x1b8)]['error'](_0x591d35+_0xcd3ef(0x1ff)+JSON[_0xcd3ef(0x1f6)](_0x34106a)+_0xcd3ef(0x189)+_0x5f7ce0['message']+'}'),_0x1339f8['logger'][_0xcd3ef(0x112)](_0x591d35+_0xcd3ef(0x161)+_0x187267);return;}}if(_0x44fa85||_0x49a931){if(_0x2071a6['activityOperation']===_0xcd3ef(0x212)){if(_0x51bf38['modifyOnly']&&_0x51bf38[_0xcd3ef(0x1a4)]===!![]){_0x1339f8[_0xcd3ef(0x1b8)][_0xcd3ef(0x112)](_0x591d35+_0xcd3ef(0x151)+_0x44fa85+_0xcd3ef(0x1fd)),_0x1339f8[_0xcd3ef(0x1b8)][_0xcd3ef(0x112)](_0x591d35+'\x20done'+_0x187267);return;}_0x1339f8[_0xcd3ef(0x1b8)][_0xcd3ef(0x112)](_0x591d35+_0xcd3ef(0x151)+_0x44fa85);try{await _0x1339f8['deleteUser'](_0xbade0,_0x44fa85);}catch(_0x4f5eac){_0x1339f8[_0xcd3ef(0x1b8)][_0xcd3ef(0x1eb)](_0x591d35+_0xcd3ef(0x151)+_0x44fa85+_0xcd3ef(0x189)+_0x4f5eac['message']+'}'),_0x1339f8[_0xcd3ef(0x1b8)][_0xcd3ef(0x112)](_0x591d35+_0xcd3ef(0x161)+_0x187267);return;}}else{if(_0x49a931)_0x44fa85=_0x49a931;_0x1339f8[_0xcd3ef(0x1b8)]['debug'](_0x591d35+'\x20Replace\x20User\x20id='+_0x44fa85);const _0x4d664c={};_0x4d664c['set']=()=>{},_0x4d664c[_0xcd3ef(0x1bf)]={},_0x4d664c[_0xcd3ef(0x1bf)][_0xcd3ef(0x17a)]=_0xbade0,_0x4d664c[_0xcd3ef(0x1bf)]['id']=_0x44fa85,_0x4d664c[_0xcd3ef(0x13f)]={},_0x4d664c[_0xcd3ef(0x13f)]['originalUrl']=_0xbade0?'/'+_0xbade0+_0xcd3ef(0x12d)+_0x44fa85:'/Users/'+_0x44fa85,_0x4d664c['request'][_0xcd3ef(0x158)]=_0x397e7b;try{await _0x1339f8[_0xcd3ef(0x11f)](_0x4d664c);}catch(_0x3e1509){_0x1339f8[_0xcd3ef(0x1b8)][_0xcd3ef(0x1eb)](_0x591d35+_0xcd3ef(0x201)+_0x44fa85+_0xcd3ef(0x189)+_0x3e1509[_0xcd3ef(0x1ae)]),_0x1339f8['logger'][_0xcd3ef(0x112)](_0x591d35+_0xcd3ef(0x161)+_0x187267);return;}if(_0x4d664c[_0xcd3ef(0x211)]&&(_0x4d664c[_0xcd3ef(0x211)]<0xc8||_0x4d664c[_0xcd3ef(0x211)]>0x12b)){if(_0x4d664c[_0xcd3ef(0x158)]){if(_0x4d664c[_0xcd3ef(0x158)][_0xcd3ef(0x198)]){let _0x5f312d=_0x4d664c[_0xcd3ef(0x158)][_0xcd3ef(0x198)];_0x5f312d=_0x5f312d[_0xcd3ef(0x118)](_0x1339f8[_0xcd3ef(0x138)]+'['+_0x1339f8[_0xcd3ef(0x19a)]+']',''+_0x591d35),_0x1339f8[_0xcd3ef(0x1b8)][_0xcd3ef(0x1eb)](''+_0x5f312d);}else{if(_0x4d664c[_0xcd3ef(0x158)][_0xcd3ef(0x120)]&&Array[_0xcd3ef(0x13b)](_0x4d664c[_0xcd3ef(0x158)][_0xcd3ef(0x120)])&&_0x4d664c[_0xcd3ef(0x158)][_0xcd3ef(0x120)][_0xcd3ef(0x1ba)]>0x0){let _0x5aa452=_0x4d664c[_0xcd3ef(0x158)]['Errors'][0x0]['description'];_0x5aa452=_0x5aa452['replace'](_0x1339f8['gwName']+'['+_0x1339f8['pluginName']+']',''+_0x591d35),_0x1339f8[_0xcd3ef(0x1b8)]['error'](''+_0x5aa452);}}}}if(_0x51bf38['usePutSoftSync']){const [_0x3ee3ee,_0x5cb2be]=_0x1339f8[_0xcd3ef(0x1f9)]({'Operations':_0x2071a6[_0xcd3ef(0x1bd)]});if(_0x5cb2be){_0x1339f8[_0xcd3ef(0x1b8)][_0xcd3ef(0x1eb)](_0x591d35+'\x20Replace\x20User\x20id='+_0x44fa85+_0xcd3ef(0x15b)+_0x5cb2be[_0xcd3ef(0x1ae)]),_0x1339f8[_0xcd3ef(0x1b8)][_0xcd3ef(0x112)](_0x591d35+_0xcd3ef(0x161)+_0x187267);return;}const _0x41693f=[];if(_0x3ee3ee[_0xcd3ef(0x11c)]&&Array[_0xcd3ef(0x13b)](_0x3ee3ee['roles']))for(let _0x2a1e96=0x0;_0x2a1e96<_0x3ee3ee['roles'][_0xcd3ef(0x1ba)];_0x2a1e96++){_0x3ee3ee[_0xcd3ef(0x11c)][_0x2a1e96][_0xcd3ef(0x1ed)]&&_0x3ee3ee[_0xcd3ef(0x11c)][_0x2a1e96]['operation']==='delete'&&_0x41693f['push'](_0x3ee3ee[_0xcd3ef(0x11c)][_0x2a1e96]);}if(_0x41693f['length']>0x0)try{await _0x1339f8[_0xcd3ef(0x154)](_0xbade0,_0x44fa85,{'roles':_0x41693f});}catch(_0x311347){_0x1339f8['logger'][_0xcd3ef(0x1eb)](_0x591d35+_0xcd3ef(0x201)+_0x44fa85+_0xcd3ef(0x20d)+_0x311347[_0xcd3ef(0x1ae)]);}const _0xda83e2=[];if(_0x3ee3ee[_0xcd3ef(0x1fb)]&&Array['isArray'](_0x3ee3ee[_0xcd3ef(0x1fb)]))for(let _0x1db05b=0x0;_0x1db05b<_0x3ee3ee[_0xcd3ef(0x1fb)]['length'];_0x1db05b++){_0x3ee3ee[_0xcd3ef(0x1fb)][_0x1db05b][_0xcd3ef(0x1ed)]&&_0x3ee3ee[_0xcd3ef(0x1fb)][_0x1db05b][_0xcd3ef(0x1ed)]==='delete'&&_0xda83e2[_0xcd3ef(0x214)](_0x3ee3ee[_0xcd3ef(0x1fb)][_0x1db05b]);}if(_0xda83e2[_0xcd3ef(0x1ba)]>0x0)for(let _0x1492b5=0x0;_0x1492b5<_0xda83e2[_0xcd3ef(0x1ba)];_0x1492b5++){try{await _0x1339f8[_0xcd3ef(0x1f5)](_0xbade0,_0xda83e2[_0x1492b5]['id'],{'members':[{'operation':'delete','value':_0x44fa85}]});}catch(_0x28eeb8){_0x1339f8[_0xcd3ef(0x1b8)][_0xcd3ef(0x1eb)](_0x591d35+_0xcd3ef(0x201)+_0x44fa85+_0xcd3ef(0x186)+_0x28eeb8[_0xcd3ef(0x1ae)]);}}}if(_0x51bf38[_0xcd3ef(0x1bc)]&&_0x2071a6[_0xcd3ef(0x166)]===_0xcd3ef(0x154)){if(_0x397e7b[_0xcd3ef(0x1fb)]&&Array[_0xcd3ef(0x13b)](_0x397e7b[_0xcd3ef(0x1fb)])&&_0x397e7b[_0xcd3ef(0x1fb)][_0xcd3ef(0x1ba)]===0x0){if(_0x397e7b[_0xcd3ef(0x11c)]&&Array[_0xcd3ef(0x13b)](_0x397e7b[_0xcd3ef(0x11c)])&&_0x397e7b['roles']['length']===0x0){if(_0x2071a6[_0xcd3ef(0x1bd)]&&Array[_0xcd3ef(0x13b)](_0x2071a6[_0xcd3ef(0x1bd)])&&_0x2071a6[_0xcd3ef(0x1bd)]['length']>0x0){let _0x51e2ef=![];for(let _0xb2cd31=0x0;_0xb2cd31<_0x2071a6[_0xcd3ef(0x1bd)]['length'];_0xb2cd31++){const _0x4d2cb0=_0x2071a6[_0xcd3ef(0x1bd)][_0xb2cd31];if(_0x4d2cb0['op']==='remove'){if(_0x4d2cb0['path']){if(_0x4d2cb0['path'][_0xcd3ef(0x121)]('roles')&&_0x4d2cb0[_0xcd3ef(0x1e7)]){_0x51e2ef=!![];break;}else{if(_0x4d2cb0[_0xcd3ef(0x197)]===_0xcd3ef(0x1fb)){_0x51e2ef=!![];break;}}}}}if(_0x51e2ef){_0x1339f8['logger'][_0xcd3ef(0x112)](_0x591d35+_0xcd3ef(0x151)+_0x44fa85);try{await _0x1339f8[_0xcd3ef(0x212)](_0xbade0,_0x44fa85);}catch(_0x4f2a85){_0x1339f8[_0xcd3ef(0x1b8)][_0xcd3ef(0x1eb)](_0x591d35+'\x20Delete\x20User\x20id='+_0x44fa85+'\x20error:\x20'+_0x4f2a85[_0xcd3ef(0x1ae)]+'}'),_0x1339f8[_0xcd3ef(0x1b8)]['debug'](_0x591d35+_0xcd3ef(0x161)+_0x187267);return;}}}}}}}}_0x1339f8[_0xcd3ef(0x1b8)][_0xcd3ef(0x112)](_0x591d35+_0xcd3ef(0x161)+_0x187267);}catch(_0x21cb10){_0x1339f8[_0xcd3ef(0x1b8)]['error'](_0x1339f8[_0xcd3ef(0x138)]+'['+_0x1339f8[_0xcd3ef(0x19a)]+']\x20subscriber['+_0xbade0+']['+_0x4f488c+']\x20error:\x20'+_0x21cb10[_0xcd3ef(0x1ae)]+_0xcd3ef(0x16a)+_0x187267);}},_0x516132=nats[_0x3dfe9f(0x1ce)](),_0x183fd2=_0x49deb2[_0x3dfe9f(0x143)](),_0xf19ae7=(_0x3dfe9f(0x15e)+_0x1339f8[_0x3dfe9f(0x19a)]+'_'+_0xbade0)[_0x3dfe9f(0x192)]('*','#')[_0x3dfe9f(0x192)]('>','##')[_0x3dfe9f(0x192)]('.','_'),_0x2f3ad6=_0x4f488c[_0x3dfe9f(0x169)]('.')[0x0]['toUpperCase']()==='GW',_0x4d7b7d=async()=>{const _0x22cd52=_0x3dfe9f;try{let _0x521100;const _0x2b343e=''+_0x51bf38?.[_0x22cd52(0x1c4)]?.[_0x22cd52(0x1e4)],_0xd0be05=await _0x49deb2['jetstreamManager'](),_0x5acdc8=async()=>{const _0x11b04d=_0x22cd52;let _0x23c7c0;try{_0x23c7c0=await _0x183fd2[_0x11b04d(0x1f1)][_0x11b04d(0x12c)](_0x2b343e,_0xf19ae7);}catch(_0x2b3137){const _0x3fcf6e={'durable_name':_0xf19ae7,'deliver_policy':nats['DeliverPolicy']['All'],'ack_policy':nats[_0x11b04d(0x131)]['Explicit'],'filter_subject':_0x4f488c};await _0xd0be05[_0x11b04d(0x1f1)][_0x11b04d(0x164)](_0x2b343e,_0x3fcf6e),_0x23c7c0=await _0x183fd2[_0x11b04d(0x1f1)][_0x11b04d(0x12c)](_0x2b343e,_0xf19ae7);}if(_0x23c7c0?.[_0x11b04d(0x124)]?.[_0x11b04d(0x1be)]?.['deliver_policy']!=='all')throw new Error(_0x11b04d(0x140));_0x23c7c0?.[_0x11b04d(0x124)]?.[_0x11b04d(0x1be)]?.[_0x11b04d(0x1da)]!==_0x4f488c&&(await _0xd0be05[_0x11b04d(0x1f1)][_0x11b04d(0x219)](_0x2b343e,_0xf19ae7,{'filter_subject':_0x4f488c}),_0x23c7c0=await _0x183fd2['consumers'][_0x11b04d(0x12c)](_0x2b343e,_0xf19ae7)),_0x521100=await _0x23c7c0['consume']({'max_messages':0x64}),_0x37ea9e(_0x521100);},_0x37ea9e=async _0x320a75=>{const _0x52637a=_0x22cd52;for await(const _0x4f756b of await _0x320a75[_0x52637a(0x211)]()){switch(_0x4f756b[_0x52637a(0x152)]){case nats[_0x52637a(0x1a6)][_0x52637a(0x13c)]:_0x1339f8['logger']['info'](_0x1339f8['gwName']+'['+_0x1339f8[_0x52637a(0x19a)]+_0x52637a(0x205)+_0xbade0+']['+_0x4f488c+_0x52637a(0x1fa)+_0x4f756b['type']),_0x5acdc8();return;}}};await _0x5acdc8();let _0x1f7703=-0x1;do{for await(const _0x38415e of _0x521100){if(!_0x38415e[_0x22cd52(0x145)]||!_0x38415e[_0x22cd52(0x145)]['get'](_0x22cd52(0x18a))){_0x38415e[_0x22cd52(0x1db)]();continue;}_0x1f7703=_0x521100[_0x22cd52(0x1d9)]();const _0x228f08=_0x1339f8[_0x22cd52(0x138)]+'['+_0x1339f8['pluginName']+']\x20subscriber['+_0xbade0+']['+_0x38415e[_0x22cd52(0x204)]+']['+_0x1f7703+']['+(_0x38415e['headers']?_0x38415e[_0x22cd52(0x145)][_0x22cd52(0x12c)](_0x22cd52(0x18a)):'')+']',_0x4171c=_0x516132[_0x22cd52(0x1ca)](_0x38415e['data']),_0x1afa69=await _0x13d681(_0x228f08,_0x4171c);if(!_0x1afa69||_0x1afa69!==!![])_0x38415e[_0x22cd52(0x1db)]();else _0x1339f8[_0x22cd52(0x1b8)]['error'](_0x228f08+_0x22cd52(0x20e));if(_0x1f7703<0x1)break;}}while(_0x1f7703===0x0);}catch(_0x4c1445){_0x1339f8[_0x22cd52(0x1b8)][_0x22cd52(0x1eb)](_0x1339f8[_0x22cd52(0x138)]+'['+_0x1339f8[_0x22cd52(0x19a)]+_0x22cd52(0x205)+_0xbade0+']['+_0x4f488c+']\x20subscriber\x20stopped\x20error:\x20'+_0x4c1445[_0x22cd52(0x1ae)]);}},_0x1510f0=async()=>{const _0x1f6868=_0x3dfe9f,_0x40b5b6=_0x49deb2[_0x1f6868(0x153)](_0x4f488c,{'max':0x64});for await(const _0x55e034 of _0x40b5b6){if(!_0x55e034[_0x1f6868(0x145)]||!_0x55e034[_0x1f6868(0x145)][_0x1f6868(0x12c)](_0x1f6868(0x18a)))continue;let _0x3c918b,_0x2d1ea7;try{try{_0x3c918b=JSON['parse'](_0x55e034[_0x1f6868(0x17e)]());}catch(_0xac04ca){const _0x903b1b=_0x1f6868(0x1ea);_0x1339f8['logger'][_0x1f6868(0x1eb)](_0x1339f8[_0x1f6868(0x138)]+'['+_0x1339f8['pluginName']+_0x1f6868(0x205)+_0xbade0+']['+_0x4f488c+']\x20'+_0x903b1b+':\x20'+_0x55e034[_0x1f6868(0x17e)]());throw new Error(_0x903b1b);}if(!_0x3c918b||!_0x3c918b['handle']){const _0x2edbd0='subscriber\x20message\x20error:\x20message\x20missing\x20handle';_0x1339f8['logger'][_0x1f6868(0x1eb)](_0x1339f8[_0x1f6868(0x138)]+'['+_0x1339f8[_0x1f6868(0x19a)]+_0x1f6868(0x205)+_0xbade0+']['+_0x4f488c+']\x20'+_0x2edbd0+':\x20'+_0x3c918b);throw new Error(_0x2edbd0);}!Object[_0x1f6868(0x173)][_0x1f6868(0x1d4)][_0x1f6868(0x193)](_0x3c918b,'baseEntity')&&(_0x3c918b['baseEntity']=_0x1f6868(0x113));if(_0x3c918b[_0x1f6868(0x17a)]!==_0xbade0){const _0x848aec=_0x1f6868(0x1cd)+_0x3c918b['baseEntity']+_0x1f6868(0x160)+_0xbade0;_0x1339f8[_0x1f6868(0x1b8)][_0x1f6868(0x1eb)](_0x1339f8['gwName']+'['+_0x1339f8['pluginName']+_0x1f6868(0x205)+_0xbade0+']['+_0x4f488c+']\x20'+_0x848aec);throw new Error(_0x848aec);}_0x2d1ea7=_0x1339f8['gwName']+'['+_0x1339f8[_0x1f6868(0x19a)]+_0x1f6868(0x205)+_0xbade0+']['+_0x55e034[_0x1f6868(0x204)]+']['+(_0x55e034[_0x1f6868(0x145)]?_0x55e034[_0x1f6868(0x145)][_0x1f6868(0x12c)]('Msg-Id'):'')+']',_0x1339f8[_0x1f6868(0x1b8)][_0x1f6868(0x112)](_0x2d1ea7+_0x1f6868(0x123));let _0x31d508,_0x591d08;switch(_0x3c918b[_0x1f6868(0x130)]){case _0x1f6868(0x1b1):_0x31d508=await _0x1339f8[_0x3c918b[_0x1f6868(0x130)]](_0xbade0,_0x3c918b[_0x1f6868(0x1f4)],_0x3c918b[_0x1f6868(0x155)],_0x3c918b[_0x1f6868(0x168)]);break;case _0x1f6868(0x1de):_0x31d508=await _0x1339f8[_0x3c918b[_0x1f6868(0x130)]](_0xbade0,_0x3c918b['obj'],_0x3c918b[_0x1f6868(0x155)],_0x3c918b['ctxCopy']);break;case _0x1f6868(0x1d0):_0x31d508=await _0x1339f8[_0x3c918b[_0x1f6868(0x130)]](_0xbade0,_0x3c918b[_0x1f6868(0x1f4)],_0x3c918b['ctxCopy']);break;case _0x1f6868(0x1d8):_0x31d508=await _0x1339f8[_0x3c918b[_0x1f6868(0x130)]](_0xbade0,_0x3c918b[_0x1f6868(0x1f4)],_0x3c918b[_0x1f6868(0x168)]);break;case'deleteUser':_0x31d508=await _0x1339f8[_0x3c918b[_0x1f6868(0x130)]](_0xbade0,_0x3c918b['id'],_0x3c918b[_0x1f6868(0x168)]);break;case _0x1f6868(0x1d7):_0x31d508=await _0x1339f8[_0x3c918b[_0x1f6868(0x130)]](_0xbade0,_0x3c918b['id'],_0x3c918b[_0x1f6868(0x168)]);break;case _0x1f6868(0x154):_0x31d508=await _0x1339f8[_0x3c918b[_0x1f6868(0x130)]](_0xbade0,_0x3c918b['id'],_0x3c918b['obj'],_0x3c918b[_0x1f6868(0x168)]);break;case'modifyGroup':_0x31d508=await _0x1339f8[_0x3c918b['handle']](_0xbade0,_0x3c918b['id'],_0x3c918b[_0x1f6868(0x1f4)],_0x3c918b[_0x1f6868(0x168)]);break;case _0x1f6868(0x11f):_0x31d508=await _0x1339f8[_0x3c918b[_0x1f6868(0x130)]](_0x3c918b[_0x1f6868(0x17f)]);break;case _0x1f6868(0x1bb):_0x31d508=await _0x1339f8[_0x3c918b[_0x1f6868(0x130)]](_0xbade0,_0x3c918b['obj'],_0x3c918b[_0x1f6868(0x168)]);break;case'putApi':_0x31d508=await _0x1339f8[_0x3c918b[_0x1f6868(0x130)]](_0xbade0,_0x3c918b['id'],_0x3c918b[_0x1f6868(0x1f4)],_0x3c918b[_0x1f6868(0x168)]);break;case _0x1f6868(0x1f3):_0x31d508=await _0x1339f8[_0x3c918b['handle']](_0xbade0,_0x3c918b['id'],_0x3c918b['obj'],_0x3c918b['ctxCopy']);break;case _0x1f6868(0x14a):_0x31d508=await _0x1339f8[_0x3c918b[_0x1f6868(0x130)]](_0xbade0,_0x3c918b['id'],_0x3c918b['query'],_0x3c918b[_0x1f6868(0x1f4)],_0x3c918b[_0x1f6868(0x168)]);break;case _0x1f6868(0x191):_0x31d508=await _0x1339f8[_0x3c918b['handle']](_0xbade0,_0x3c918b['id'],_0x3c918b[_0x1f6868(0x168)]);break;default:_0x591d08=_0x1f6868(0x1b3)+_0x3c918b[_0x1f6868(0x130)]+_0x1f6868(0x14e),_0x1339f8['logger'][_0x1f6868(0x1eb)](_0x1339f8['gwName']+'['+_0x1339f8['pluginName']+_0x1f6868(0x205)+_0xbade0+']['+_0x4f488c+']\x20'+_0x591d08);throw new Error(_0x591d08);}if(!_0x31d508)_0x31d508=null;const _0x460e6a=JSON['stringify'](_0x31d508);_0x55e034[_0x1f6868(0x194)](_0x460e6a),_0x1339f8[_0x1f6868(0x1b8)]['info'](_0x2d1ea7+_0x1f6868(0x207)+_0x3c918b[_0x1f6868(0x130)]+_0x1f6868(0x13d)+(_0x3c918b[_0x1f6868(0x1f4)]?JSON[_0x1f6868(0x1f6)](_0x3c918b[_0x1f6868(0x1f4)]):'')+_0x1f6868(0x156)+(_0x3c918b['id']?_0x3c918b['id']:'')+_0x1f6868(0x1c1)+(_0x3c918b[_0x1f6868(0x155)]?_0x3c918b['attributes']:'')+_0x1f6868(0x1ec)+_0x460e6a+_0x187267);}catch(_0x28f1ba){const _0x4a5639='{\x22error\x22:\x22'+_0x28f1ba[_0x1f6868(0x1ae)]+_0x1f6868(0x16f)+_0x28f1ba[_0x1f6868(0x210)]+'\x22}';_0x55e034[_0x1f6868(0x194)](_0x4a5639),_0x1339f8['logger'][_0x1f6868(0x21b)]((_0x2d1ea7||'')+'\x20message\x20handled:\x20'+_0x3c918b[_0x1f6868(0x130)]+_0x1f6868(0x13d)+(_0x3c918b[_0x1f6868(0x1f4)]?JSON[_0x1f6868(0x1f6)](_0x3c918b[_0x1f6868(0x1f4)]):'')+_0x1f6868(0x156)+(_0x3c918b['id']?_0x3c918b['id']:'')+_0x1f6868(0x1c1)+(_0x3c918b[_0x1f6868(0x155)]?_0x3c918b[_0x1f6868(0x155)]:'')+'\x20message\x20error\x20response:\x20'+_0x4a5639+_0x187267);}}};if(_0x2f3ad6)_0x1510f0();else _0x4d7b7d();},_0x34e901=async(_0x42c203,_0x35a666)=>{const _0x31f186=_0xbd089d,_0x229b95=_0xf2a4c2[_0x42c203][_0x31f186(0x1be)]?.[_0x31f186(0x1c4)]?.[_0x31f186(0x204)];let _0x3a8e73=0x0;for await(const _0x35ca48 of _0x35a666['status']()){switch(_0x35ca48[_0x31f186(0x152)]){case nats[_0x31f186(0x18f)][_0x31f186(0x175)]:_0x1339f8[_0x31f186(0x1b8)][_0x31f186(0x1eb)](_0x1339f8[_0x31f186(0x138)]+'['+_0x1339f8[_0x31f186(0x19a)]+']\x20subscriber['+_0x42c203+']['+_0x229b95+_0x31f186(0x148)+_0x35ca48[_0x31f186(0x190)]+_0x31f186(0x1a7)),_0x3a8e73=0x0;break;case nats[_0x31f186(0x18f)][_0x31f186(0x1c8)]:_0x1339f8[_0x31f186(0x1b8)][_0x31f186(0x21b)](_0x1339f8['gwName']+'['+_0x1339f8['pluginName']+']\x20subscriber['+_0x42c203+']['+_0x229b95+_0x31f186(0x157)+_0x35ca48[_0x31f186(0x190)]);break;case nats[_0x31f186(0x18f)][_0x31f186(0x202)]:_0x1339f8[_0x31f186(0x1b8)][_0x31f186(0x1eb)](_0x1339f8[_0x31f186(0x138)]+'['+_0x1339f8[_0x31f186(0x19a)]+']\x20subscriber['+_0x42c203+']['+_0x229b95+_0x31f186(0x181)+_0x35ca48['data']);break;case nats[_0x31f186(0x116)][_0x31f186(0x1b2)]:_0x3a8e73+=0x1;_0x3a8e73%0x1e===0x0&&_0x1339f8['logger']['debug'](_0x1339f8[_0x31f186(0x138)]+'['+_0x1339f8['pluginName']+_0x31f186(0x205)+_0x42c203+']['+_0x229b95+']\x20client\x20is\x20attempting\x20to\x20reconnect\x20'+_0x35ca48[_0x31f186(0x190)]+_0x31f186(0x1c3)+_0x3a8e73+')');break;case nats[_0x31f186(0x116)][_0x31f186(0x170)]:_0x1339f8[_0x31f186(0x1b8)][_0x31f186(0x112)](_0x1339f8[_0x31f186(0x138)]+'['+_0x1339f8[_0x31f186(0x19a)]+']\x20subscriber['+_0x42c203+']['+_0x229b95+']\x20client\x20has\x20a\x20stale\x20connection\x20'+_0x35ca48[_0x31f186(0x190)]);break;}}};process['on'](_0xbd089d(0x1e9),async()=>{const _0x552236=_0xbd089d;for(const _0x38abbf in _0xf2a4c2){_0xf2a4c2[_0x38abbf]['nc']&&!_0xf2a4c2[_0x38abbf]['nc'][_0x552236(0x147)]()&&await _0xf2a4c2[_0x38abbf]['nc'][_0x552236(0x1c9)]();}}),process['on']('SIGINT',async()=>{for(const _0x117e24 in _0xf2a4c2){_0xf2a4c2[_0x117e24]['nc']&&!_0xf2a4c2[_0x117e24]['nc']['isClosed']()&&await _0xf2a4c2[_0x117e24]['nc']['drain']();}});const _0x24fff6=async(_0xb41d57,_0x4b6236,_0x452300)=>{const _0xd4f235=_0xbd089d,_0x23afde={'attribute':_0x4b6236,'operator':'eq','value':_0x452300,'rawFilter':undefined,'startIndex':undefined,'count':undefined},_0x1faf5d=[_0x4b6236];if(_0x4b6236!=='id')_0x1faf5d[_0xd4f235(0x214)]('id');try{const _0x32833a=await _0x1339f8[_0xd4f235(0x1b1)](_0xb41d57,_0x23afde,_0x1faf5d);if(!_0x32833a||!_0x32833a[_0xd4f235(0x134)]||!Array[_0xd4f235(0x13b)](_0x32833a['Resources']))throw new Error(_0xd4f235(0x217)+JSON['stringify'](_0x23afde)+'\x20error:\x20missing\x20result');if(_0x32833a[_0xd4f235(0x134)][_0xd4f235(0x1ba)]===0x0)return null;else{if(_0x32833a[_0xd4f235(0x134)][_0xd4f235(0x1ba)]>0x2)throw new Error(_0xd4f235(0x217)+JSON[_0xd4f235(0x1f6)](_0x23afde)+_0xd4f235(0x15d));else{const _0x115ff0=_0x32833a['Resources'][0x0];if(!_0x115ff0['id'])throw new Error(_0xd4f235(0x217)+JSON[_0xd4f235(0x1f6)](_0x23afde)+_0xd4f235(0x14d)+JSON[_0xd4f235(0x1f6)](_0x115ff0)+_0xd4f235(0x111));return decodeURIComponent(_0x115ff0['id']);}}}catch(_0x55abeb){throw new Error(_0xd4f235(0x217)+JSON[_0xd4f235(0x1f6)](_0x23afde)+_0xd4f235(0x189)+_0x55abeb[_0xd4f235(0x1ae)]+'}');}},_0x1ebc85=_0x5d9a5a=>{const _0x50b690=_0xbd089d;if(!_0x5d9a5a||typeof _0x5d9a5a!=='string')return[null,null];_0x5d9a5a=_0x5d9a5a['trim']();const _0x187907=_0x5d9a5a[_0x50b690(0x132)]('(');if(_0x187907<0x1)return[null,null];if(_0x5d9a5a[_0x50b690(0x14f)](_0x5d9a5a['length']-0x1)!==')')return[null,null];if(_0x1fa6c6(_0x5d9a5a,'(')!==_0x1fa6c6(_0x5d9a5a,')'))return[null,null];const _0x53f5a2=_0x5d9a5a['substring'](0x0,_0x187907),_0x5c2648=_0x5d9a5a['substring'](_0x187907+0x1,_0x5d9a5a[_0x50b690(0x1ba)]-0x1);let _0x596514=[];const _0x20d344=_0x5c2648[_0x50b690(0x169)](',');let _0xbef26e='';for(let _0xbafc4e=0x0;_0xbafc4e<_0x20d344[_0x50b690(0x1ba)];_0xbafc4e++){const _0x187f9b=_0xbef26e?_0xbef26e+','+_0x20d344[_0xbafc4e]:_0x20d344[_0xbafc4e],_0x36e3a7=_0x1fa6c6(_0x187f9b,'('),_0x4c0cd0=_0x1fa6c6(_0x187f9b,')');if(_0x36e3a7===_0x4c0cd0)_0x596514['push'](_0x5d759e(_0x187f9b,'\x22')),_0xbef26e='';else{if(_0xbef26e)_0xbef26e+=','+_0x20d344[_0xbafc4e];else _0xbef26e+=_0x20d344[_0xbafc4e];}}if(_0x596514[_0x50b690(0x1ba)]===0x0)_0x596514=null;return[_0x53f5a2,_0x596514];};function _0x1fa6c6(_0x2135a3,_0x82e98c){const _0x37b0fa=_0xbd089d;let _0x182461=0x0;for(let _0x3bfac0=0x0;_0x3bfac0<_0x2135a3[_0x37b0fa(0x1ba)];_0x3bfac0++){_0x2135a3['charAt'](_0x3bfac0)===_0x82e98c&&(_0x182461+=0x1);}return _0x182461;}const _0x5d759e=(_0x2b79f6,_0x2896bd)=>{const _0x1d4d16=_0xbd089d;if(typeof _0x2b79f6!==_0x1d4d16(0x17e)||typeof _0x2896bd!==_0x1d4d16(0x17e))return _0x2b79f6;if(_0x2b79f6[_0x1d4d16(0x1ba)]===0x1)return _0x2b79f6;if(_0x2896bd[_0x1d4d16(0x1ba)]!==0x1)return _0x2b79f6;return _0x2b79f6=_0x2b79f6[_0x1d4d16(0x1d3)](),_0x2b79f6[_0x1d4d16(0x14f)](0x0,0x1)===_0x2896bd&&(_0x2b79f6=_0x2b79f6[_0x1d4d16(0x14f)](0x1)),_0x2b79f6[_0x1d4d16(0x14f)](_0x2b79f6[_0x1d4d16(0x1ba)]-0x1)===_0x2896bd&&(_0x2b79f6=_0x2b79f6[_0x1d4d16(0x14f)](0x0,_0x2b79f6['length']-0x1)),_0x2b79f6;},_0x51b6dd=async(_0x2ff5bd,_0x37b44c,_0x537ba2,_0x3100d3)=>{const _0x42ee95=_0xbd089d;if(!_0x37b44c||!_0x537ba2||!_0x3100d3)return null;const [_0x41e4e8,_0x3bb1c1]=_0x1ebc85(_0x3100d3);if(!_0x41e4e8||!_0x3bb1c1){const _0x5a8473=_0x3100d3[_0x42ee95(0x169)]('(');if(_0x5a8473[_0x42ee95(0x1ba)]>0x1){const _0x47ab77=[_0x42ee95(0x1ac),_0x42ee95(0x1a9),_0x42ee95(0x16b),_0x42ee95(0x119),_0x42ee95(0x1b4),'replace',_0x42ee95(0x144),_0x42ee95(0x16e),'getuniquevalue'],_0x309d4c=_0x5a8473[0x0][_0x42ee95(0x1c0)]();if(_0x47ab77[_0x42ee95(0x1b9)](_0x309d4c))return null;}return _0x3100d3;}for(let _0x29ab9b=0x0;_0x29ab9b<_0x3bb1c1[_0x42ee95(0x1ba)];_0x29ab9b++){if(_0x3bb1c1[_0x29ab9b]['substring'](0x0,0x1)==='['){const _0x5ec945=_0x3bb1c1[_0x29ab9b]['indexOf'](']');if(_0x5ec945<0x0)return null;const _0x33d4a3=_0x3bb1c1[_0x29ab9b][_0x42ee95(0x14f)](0x1,_0x5ec945),_0x5abb62=_0x33d4a3[_0x42ee95(0x169)]('.');let _0xc41610;for(let _0x2d7760=0x0;_0x2d7760<_0x5abb62[_0x42ee95(0x1ba)];_0x2d7760++){if(_0x2d7760===0x0)_0xc41610=_0x37b44c[_0x5abb62[_0x2d7760]];else{if(!_0xc41610)return null;_0xc41610=_0xc41610[_0x5abb62[_0x2d7760]];}}if(!_0xc41610)return null;_0x3bb1c1[_0x29ab9b]=_0xc41610;}}for(let _0x1d95a3=0x0;_0x1d95a3<_0x3bb1c1[_0x42ee95(0x1ba)];_0x1d95a3++){const [_0x1b66f9]=_0x1ebc85(_0x3bb1c1[_0x1d95a3]);_0x1b66f9&&(_0x3bb1c1[_0x1d95a3]=await _0x51b6dd(_0x2ff5bd,_0x37b44c,_0x537ba2,_0x3bb1c1[_0x1d95a3]));}if(_0x3bb1c1[0x0]===null)return null;switch(_0x41e4e8['toLowerCase']()){case _0x42ee95(0x1ac):{if(_0x3bb1c1['length']!==0x1)return null;const [_0x102d37]=_0x1ebc85(_0x3bb1c1[0x0]);if(_0x102d37)_0x3bb1c1[0x0]=await _0x51b6dd(_0x2ff5bd,_0x37b44c,_0x537ba2,_0x102d37);if(_0x3bb1c1[0x0]===null)return null;return _0x3bb1c1[0x0][_0x42ee95(0x1c0)]();}case _0x42ee95(0x1a9):{if(_0x3bb1c1[_0x42ee95(0x1ba)]!==0x1)return null;const [_0x12464d]=_0x1ebc85(_0x3bb1c1[0x0]);if(_0x12464d)_0x3bb1c1[0x0]=await _0x51b6dd(_0x2ff5bd,_0x37b44c,_0x537ba2,_0x12464d);if(_0x3bb1c1[0x0]===null)return null;return _0x3bb1c1[0x0][_0x42ee95(0x1c6)]();}case _0x42ee95(0x16b):{if(_0x3bb1c1[_0x42ee95(0x1ba)]!==0x2)return null;const [_0xec9130]=_0x1ebc85(_0x3bb1c1[0x0]);if(_0xec9130)_0x3bb1c1[0x0]=await _0x51b6dd(_0x2ff5bd,_0x37b44c,_0x537ba2,_0xec9130);if(_0x3bb1c1[0x0]===null)return null;if(isNaN(_0x3bb1c1[0x1]))return null;return _0x3bb1c1[0x0][_0x42ee95(0x14f)](0x0,_0x3bb1c1[0x1]);}case _0x42ee95(0x119):{const [_0x5d1ec1]=_0x1ebc85(_0x3bb1c1[0x0]);if(_0x3bb1c1[_0x42ee95(0x1ba)]<0x2)return null;if(_0x5d1ec1)_0x3bb1c1[0x0]=await _0x51b6dd(_0x2ff5bd,_0x37b44c,_0x537ba2,_0x5d1ec1);if(_0x3bb1c1[0x0]===null)return null;const _0x2de4a1=_0x3bb1c1[0x1];if(isNaN(_0x2de4a1))return null;let _0x10bc7b;if(_0x3bb1c1['length']===0x3)_0x10bc7b=_0x3bb1c1[0x0][_0x42ee95(0x169)](_0x3bb1c1[0x2]);else _0x10bc7b=_0x10bc7b=_0x3bb1c1[0x0]['split']('\x20');if(_0x2de4a1<=_0x10bc7b['length'])return _0x10bc7b[_0x2de4a1-0x1];else return'';}case _0x42ee95(0x118):{const [_0x1ca6be]=_0x1ebc85(_0x3bb1c1[0x0]);if(_0x1ca6be)_0x3bb1c1[0x0]=await _0x51b6dd(_0x2ff5bd,_0x37b44c,_0x537ba2,_0x1ca6be);if(_0x3bb1c1[0x0]===null)return null;if(_0x3bb1c1[_0x42ee95(0x1ba)]!==0x3)return null;return _0x3bb1c1[0x0][_0x42ee95(0x192)](_0x3bb1c1[0x1],_0x3bb1c1[0x2]);}case'normalize':{if(_0x3bb1c1['length']!==0x1)return null;const [_0xd39d53]=_0x1ebc85(_0x3bb1c1[0x0]);if(_0xd39d53)_0x3bb1c1[0x0]=await _0x51b6dd(_0x2ff5bd,_0x37b44c,_0x537ba2,_0xd39d53);if(_0x3bb1c1[0x0]===null)return null;return ascii127[_0x42ee95(0x11d)](_0x3bb1c1[0x0]);}case _0x42ee95(0x1b4):{let _0x1123f9='';for(let _0x587d14=0x0;_0x587d14<_0x3bb1c1[_0x42ee95(0x1ba)];_0x587d14++){const [_0x250b3a]=_0x1ebc85(_0x3bb1c1[_0x587d14]);if(_0x250b3a)_0x3bb1c1[_0x587d14]=await _0x51b6dd(_0x2ff5bd,_0x37b44c,_0x537ba2,_0x250b3a);if(_0x3bb1c1[_0x587d14]===null)return null;_0x1123f9+=_0x3bb1c1[_0x587d14];}return _0x1123f9;}case'increment':{if(_0x3bb1c1[_0x42ee95(0x1ba)]>0x2)return null;const [_0x354b7c]=_0x1ebc85(_0x3bb1c1[0x0]);if(_0x354b7c)_0x3bb1c1[0x0]=await _0x51b6dd(_0x2ff5bd,_0x37b44c,_0x537ba2,_0x354b7c);if(_0x3bb1c1[0x0]===null)return null;const _0x1a74b5=parseInt(_0x3bb1c1[0x0]);if(isNaN(_0x1a74b5))return null;let _0x249d29=_0x42ee95(0x117);_0x249d29+=','+_0x3bb1c1[0x0];if(_0x3bb1c1[_0x42ee95(0x1ba)]===0x2&&_0x3bb1c1[0x1][_0x42ee95(0x1c0)]()==='true')_0x249d29+=',true';else _0x249d29+=_0x42ee95(0x1b7);return _0x249d29+='##',_0x249d29;}case'getuniquevalue':{if(_0x3bb1c1['length']!==0x1)return null;const [_0x31b679]=_0x1ebc85(_0x3bb1c1[0x0]);if(_0x31b679)_0x3bb1c1[0x0]=await _0x51b6dd(_0x2ff5bd,_0x37b44c,_0x537ba2,_0x31b679);if(_0x3bb1c1[0x0]===null)return null;let _0x1adb93,_0x4243b5=![],_0x270884='';const _0x212704=_0x3bb1c1[0x0][_0x42ee95(0x169)]('##');if(_0x212704['length']>0x2)for(let _0x64553f=0x0;_0x64553f<_0x212704[_0x42ee95(0x1ba)];_0x64553f++){if(_0x212704[_0x64553f][_0x42ee95(0x121)](_0x42ee95(0x1d1))){const _0x53ec48=_0x212704[_0x64553f]['split'](',');if(_0x53ec48[_0x42ee95(0x1ba)]<0x2)return null;const _0x5210dc=parseInt(_0x53ec48[0x1]);if(isNaN(_0x5210dc))return null;_0x270884='##'+_0x212704[_0x64553f]+'##',_0x1adb93=_0x53ec48[0x1],_0x53ec48[_0x42ee95(0x1ba)]>0x2&&(_0x4243b5=_0x53ec48[0x2]['toLowerCase']()===_0x42ee95(0x1c7));}}let _0x341e4c,_0x3b5f53=0x0,_0x157f46=0x0;if(_0x1adb93){_0x157f46=_0x1adb93[_0x42ee95(0x1ba)],_0x3b5f53=0xa;for(let _0x574e08=0x1;_0x574e08<_0x157f46;_0x574e08++){_0x3b5f53*=0xa;}_0x3b5f53-=0x1,_0x341e4c=parseInt(_0x1adb93);if(isNaN(_0x341e4c))return null;_0x341e4c-=0x1;}else _0x341e4c=0x0;do{_0x341e4c+=0x1;let _0x26ff26=_0x3bb1c1[0x0];if(_0x1adb93!==undefined&&_0x270884){let _0x7803ce=_0x341e4c[_0x42ee95(0x1cb)]();while(_0x7803ce[_0x42ee95(0x1ba)]<_0x157f46){_0x7803ce='0'+_0x7803ce;}_0x4243b5?_0x26ff26=_0x26ff26[_0x42ee95(0x118)](_0x270884,_0x7803ce):(_0x26ff26=_0x26ff26[_0x42ee95(0x118)](_0x270884,''),_0x4243b5=!![],_0x341e4c-=0x1);}try{const _0x11758d=await _0x24fff6(_0x2ff5bd,_0x537ba2,_0x26ff26);if(!_0x11758d)return _0x26ff26;}catch(_0x1ec7c2){return _0x1339f8['logger'][_0x42ee95(0x1eb)](_0x1339f8[_0x42ee95(0x138)]+'['+_0x1339f8['pluginName']+']\x20'+_0x41e4e8+_0x42ee95(0x172)+_0x1ec7c2[_0x42ee95(0x1ae)]),null;}}while(_0x341e4c<_0x3b5f53);return null;}default:}return null;},_0x31ac6a=async(_0x4aac1b,_0x2770e9)=>{const _0x232aa8=_0xbd089d;for(const _0x34fb6b in _0x2770e9){const _0x53f8e8=_0x2770e9[_0x34fb6b],[_0x296917,_0x3302e5]=_0x1ebc85(_0x53f8e8);if(_0x296917){const _0x233b89=''+_0x34fb6b,_0x1d8d0c=_0x296917+'('+_0x3302e5['join'](',')+')',_0x50ee07=await _0x51b6dd(_0x4aac1b,_0x2770e9,_0x233b89,_0x1d8d0c);if(_0x50ee07===null)delete _0x2770e9[_0x34fb6b];else _0x2770e9[_0x34fb6b]=_0x50ee07;}for(const _0x29ef32 in _0x53f8e8){const _0x293eba=_0x53f8e8[_0x29ef32],[_0x32ef12,_0xcd881a]=_0x1ebc85(_0x293eba);if(_0x32ef12){const _0x64826=_0x34fb6b+'.'+_0x29ef32,_0xa62ba8=_0x32ef12+'('+_0xcd881a[_0x232aa8(0x1b4)](',')+')',_0x24c426=await _0x51b6dd(_0x4aac1b,_0x2770e9,_0x64826,_0xa62ba8);if(_0x24c426===null)delete _0x53f8e8[_0x29ef32];else _0x53f8e8[_0x29ef32]=_0x24c426;}}}return _0x2770e9;};},module[a0_0x59b720(0x167)][a0_0x59b720(0x135)]=function(_0xf7579){const _0x5e5b21=a0_0x59b720,_0x4fc4b3=_0xf7579,_0x42cd7e={},_0x5a7e9a=async(_0x1905a1,_0x1c4e64)=>{const _0x16473c=a0_0x449c,_0x475ab6=_0x42cd7e[_0x1905a1][_0x16473c(0x1be)]?.[_0x16473c(0x1c4)]?.[_0x16473c(0x204)];let _0x13196e=0x0;for await(const _0x476bb3 of _0x1c4e64['status']()){switch(_0x476bb3[_0x16473c(0x152)]){case nats[_0x16473c(0x18f)]['Disconnect']:_0x4fc4b3['logger'][_0x16473c(0x1eb)](_0x4fc4b3['gwName']+'['+_0x4fc4b3[_0x16473c(0x19a)]+_0x16473c(0x11e)+_0x1905a1+']['+_0x475ab6+']\x20client\x20disconnected\x20'+_0x476bb3['data']+_0x16473c(0x1a7)),_0x13196e=0x0;break;case nats[_0x16473c(0x18f)][_0x16473c(0x1c8)]:_0x4fc4b3['logger'][_0x16473c(0x21b)](_0x4fc4b3[_0x16473c(0x138)]+'['+_0x4fc4b3[_0x16473c(0x19a)]+_0x16473c(0x11e)+_0x1905a1+']['+_0x475ab6+_0x16473c(0x157)+_0x476bb3[_0x16473c(0x190)]);break;case nats['Events'][_0x16473c(0x202)]:_0x4fc4b3[_0x16473c(0x1b8)][_0x16473c(0x1eb)](_0x4fc4b3['gwName']+'['+_0x4fc4b3[_0x16473c(0x19a)]+_0x16473c(0x11e)+_0x1905a1+']['+_0x475ab6+_0x16473c(0x181)+_0x476bb3[_0x16473c(0x190)]);break;case nats['DebugEvents']['Reconnecting']:_0x13196e+=0x1;_0x13196e%0x1e===0x0&&_0x4fc4b3[_0x16473c(0x1b8)][_0x16473c(0x112)](_0x4fc4b3[_0x16473c(0x138)]+'['+_0x4fc4b3[_0x16473c(0x19a)]+_0x16473c(0x11e)+_0x1905a1+']['+_0x475ab6+_0x16473c(0x1df)+_0x476bb3[_0x16473c(0x190)]+_0x16473c(0x1c3)+_0x13196e+')');break;case nats[_0x16473c(0x116)][_0x16473c(0x170)]:_0x4fc4b3[_0x16473c(0x1b8)][_0x16473c(0x112)](_0x4fc4b3['gwName']+'['+_0x4fc4b3[_0x16473c(0x19a)]+_0x16473c(0x11e)+_0x1905a1+']['+_0x475ab6+']\x20client\x20has\x20a\x20stale\x20connection\x20'+_0x476bb3[_0x16473c(0x190)]);break;}}},_0x46d096=async(_0x2235be,_0x471f81)=>{const _0x5fdba8=a0_0x449c,_0x593cfc=_0x42cd7e[_0x2235be][_0x5fdba8(0x1be)]?.['nats']?.[_0x5fdba8(0x204)];let _0x231fce;try{_0x231fce=await nats[_0x5fdba8(0x149)](_0x471f81);if(_0x231fce[_0x5fdba8(0x21b)][_0x5fdba8(0x15f)]!==_0x5fdba8(0x137)){_0x231fce[_0x5fdba8(0x196)]();return;}_0x42cd7e[_0x2235be]['nc']=_0x231fce,_0x5a7e9a(_0x2235be,_0x231fce);}catch(_0x35a13b){_0x4fc4b3['logger'][_0x5fdba8(0x1eb)](_0x4fc4b3[_0x5fdba8(0x138)]+'['+_0x4fc4b3['pluginName']+']\x20publisher['+_0x2235be+']['+_0x593cfc+_0x5fdba8(0x1ee)+_0x35a13b[_0x5fdba8(0x1ae)]+_0x5fdba8(0x1a3)),_0x471f81[_0x5fdba8(0x182)]=!![];try{_0x231fce=await nats[_0x5fdba8(0x149)](_0x471f81);if(_0x231fce[_0x5fdba8(0x21b)][_0x5fdba8(0x15f)]!=='SCIM\x20Stream'){_0x231fce[_0x5fdba8(0x196)]();return;}_0x42cd7e[_0x2235be]['nc']=_0x231fce,_0x5a7e9a(_0x2235be,_0x231fce);}catch(_0x361e9d){_0x4fc4b3[_0x5fdba8(0x1b8)][_0x5fdba8(0x1eb)](_0x4fc4b3['gwName']+'['+_0x4fc4b3['pluginName']+']\x20publisher['+_0x2235be+']['+_0x593cfc+']\x20connect\x20error:\x20'+_0x361e9d[_0x5fdba8(0x1ae)]);return;}}_0x4fc4b3[_0x5fdba8(0x1b8)]['debug'](_0x4fc4b3[_0x5fdba8(0x138)]+'['+_0x4fc4b3[_0x5fdba8(0x19a)]+_0x5fdba8(0x11e)+_0x2235be+']['+_0x593cfc+_0x5fdba8(0x1ef)+(_0x471f81[_0x5fdba8(0x188)]['ca']?_0x5fdba8(0x188):'')+'\x20'+_0x231fce[_0x5fdba8(0x139)]()),_0x231fce[_0x5fdba8(0x183)]()['then'](_0x33f52e=>{const _0x41b60b=_0x5fdba8;_0x33f52e&&_0x4fc4b3[_0x41b60b(0x1b8)][_0x41b60b(0x1eb)](_0x4fc4b3[_0x41b60b(0x138)]+'['+_0x4fc4b3['pluginName']+_0x41b60b(0x11e)+_0x2235be+']['+_0x593cfc+_0x41b60b(0x1a5)+_0x33f52e[_0x41b60b(0x1ae)]);});};this['add']=async(_0x208e3c,_0x1b6dcd)=>{const _0x474cd4=a0_0x449c;if(!_0x1b6dcd?.[_0x474cd4(0x1c4)]){_0x4fc4b3['logger']['error'](_0x4fc4b3[_0x474cd4(0x138)]+'['+_0x4fc4b3[_0x474cd4(0x19a)]+_0x474cd4(0x11e)+_0x208e3c+_0x474cd4(0x1c2));return;}if(!_0x1b6dcd?.[_0x474cd4(0x1c4)]?.[_0x474cd4(0x1e4)]){_0x4fc4b3['logger'][_0x474cd4(0x1eb)](_0x4fc4b3['gwName']+'['+_0x4fc4b3[_0x474cd4(0x19a)]+']\x20publisher['+_0x208e3c+']\x20initialization\x20error:\x20missing\x20configuration\x20nats.tenant');return;}if(!_0x1b6dcd?.[_0x474cd4(0x1c4)]?.[_0x474cd4(0x204)]){_0x4fc4b3[_0x474cd4(0x1b8)][_0x474cd4(0x1eb)](_0x4fc4b3[_0x474cd4(0x138)]+'['+_0x4fc4b3['pluginName']+_0x474cd4(0x11e)+_0x208e3c+']\x20initialization\x20error:\x20missing\x20configuration\x20nats.subject');return;}if(!_0x1b6dcd?.[_0x474cd4(0x1c4)]?.[_0x474cd4(0x204)][_0x474cd4(0x121)](_0x474cd4(0x12b))){_0x4fc4b3['logger'][_0x474cd4(0x1eb)](_0x4fc4b3[_0x474cd4(0x138)]+'['+_0x4fc4b3[_0x474cd4(0x19a)]+_0x474cd4(0x11e)+_0x208e3c+']\x20initialization\x20error:\x20nats.subject\x20root\x20topic\x20must\x20be\x20\x27GW\x27,\x20nats.subject\x20example:\x20GW.APP1');return;}if(!_0x1b6dcd[_0x474cd4(0x184)]||!Array[_0x474cd4(0x13b)](_0x1b6dcd[_0x474cd4(0x184)])||_0x1b6dcd[_0x474cd4(0x184)]['length']<0x1){_0x4fc4b3[_0x474cd4(0x1b8)][_0x474cd4(0x1eb)](_0x4fc4b3[_0x474cd4(0x138)]+'['+_0x4fc4b3[_0x474cd4(0x19a)]+']\x20publisher['+_0x208e3c+']\x20initialization\x20error:\x20missing\x20configuration\x20stream.baseUrls');return;}if(!_0x1b6dcd?.[_0x474cd4(0x146)]?.['ca']){_0x4fc4b3[_0x474cd4(0x1b8)][_0x474cd4(0x1eb)](_0x4fc4b3['gwName']+'['+_0x4fc4b3[_0x474cd4(0x19a)]+_0x474cd4(0x11e)+_0x208e3c+_0x474cd4(0x1f2));return;}const _0x550aab={};try{let _0x323053=path['join'](_0x4fc4b3['configDir'],'/certs/',_0x1b6dcd?.[_0x474cd4(0x146)]?.['ca']||_0x474cd4(0x1a1));(_0x1b6dcd?.[_0x474cd4(0x146)]?.['ca']?.[_0x474cd4(0x121)]('/')||_0x1b6dcd?.[_0x474cd4(0x146)]?.['ca']?.[_0x474cd4(0x1b9)]('\x5c'))&&(_0x323053=_0x1b6dcd[_0x474cd4(0x146)]['ca']),_0x550aab['ca']=[fs['readFileSync'](_0x323053)],_0x550aab['rejectUnauthorized']=!![];}catch(_0x5cefce){_0x4fc4b3['logger'][_0x474cd4(0x1eb)](_0x4fc4b3[_0x474cd4(0x138)]+'['+_0x4fc4b3[_0x474cd4(0x19a)]+_0x474cd4(0x11e)+_0x208e3c+_0x474cd4(0x16d)+_0x5cefce[_0x474cd4(0x1ae)]);return;}const _0x29ec2={},_0x74e3d9=new TextEncoder()['encode'](_0x1b6dcd?.['nats']?.[_0x474cd4(0x163)]),_0x531ea3=_0x1b6dcd?.[_0x474cd4(0x1c4)]?.[_0x474cd4(0x122)];_0x29ec2[_0x474cd4(0x18d)]=nats[_0x474cd4(0x1c5)](_0x531ea3,_0x74e3d9),_0x29ec2[_0x474cd4(0x1d2)]=_0x1b6dcd[_0x474cd4(0x184)],_0x29ec2[_0x474cd4(0x188)]=_0x550aab,_0x29ec2['waitOnFirstConnect']=![],_0x29ec2['reconnect']=!![],_0x29ec2[_0x474cd4(0x19c)]=0x3e8*0xa,_0x29ec2[_0x474cd4(0x1f0)]=-0x1,_0x29ec2['pingInterval']=0x2*0x3c*0x3e8,_0x29ec2[_0x474cd4(0x20a)]=0x5,_0x29ec2[_0x474cd4(0x112)]=![],_0x42cd7e[_0x208e3c]={},_0x42cd7e[_0x208e3c]['config']=_0x1b6dcd,_0x42cd7e[_0x208e3c]['nc']=undefined,_0x46d096(_0x208e3c,_0x29ec2);};const _0x35b882=nats[_0x5e5b21(0x1ce)]();this[_0x5e5b21(0x1b5)]=async _0x257e87=>{const _0x3eca82=_0x5e5b21;let _0xda2baa;try{if(_0x257e87[_0x3eca82(0x133)]===Object){_0xda2baa=_0x257e87['baseEntity'];if(!_0xda2baa)_0x257e87[_0x3eca82(0x17a)]=_0x3eca82(0x113);_0x257e87=JSON[_0x3eca82(0x1f6)](_0x257e87);}else{const _0x2c82a9=JSON[_0x3eca82(0x1e8)](_0x257e87);_0xda2baa=_0x2c82a9[_0x3eca82(0x17a)];}}catch(_0x4b50ee){throw new Error(_0x3eca82(0x11b)+_0xda2baa+']\x20error:\x20message\x20must\x20be\x20JSON\x20formatted');}if(!_0x42cd7e[_0xda2baa])throw new Error(_0x3eca82(0x11b)+_0xda2baa+_0x3eca82(0x18c)+_0xda2baa);const _0x5b021e=nats[_0x3eca82(0x145)]();_0x5b021e[_0x3eca82(0x150)](_0x3eca82(0x18a),crypto['randomUUID']());let _0x51ce87;try{if(!_0x42cd7e[_0xda2baa]['nc'])throw new Error('publisher\x20not\x20initialized/connected');_0x51ce87=await _0x42cd7e[_0xda2baa]['nc'][_0x3eca82(0x13f)](_0x42cd7e[_0xda2baa][_0x3eca82(0x1be)]?.['nats']?.[_0x3eca82(0x204)],_0x35b882['encode'](_0x257e87),{'headers':_0x5b021e});}catch(_0x5aaf34){if(_0x5aaf34[_0x3eca82(0x1ae)]===_0x3eca82(0x129))throw new Error('publisher['+_0xda2baa+_0x3eca82(0x19e)+_0x42cd7e[_0xda2baa][_0x3eca82(0x1be)]?.[_0x3eca82(0x1c4)]?.[_0x3eca82(0x204)]);else throw new Error(_0x3eca82(0x11b)+_0xda2baa+_0x3eca82(0x1e3)+_0x5aaf34[_0x3eca82(0x1ae)]);}let _0x2fa142;try{_0x2fa142=JSON[_0x3eca82(0x1e8)](_0x51ce87['string']());}catch(_0x12d63d){throw new Error(_0x3eca82(0x1e1)+_0x51ce87['string']());}if(_0x2fa142?.['error']){const _0xc19b65=new Error(_0x3eca82(0x19f)+_0x2fa142[_0x3eca82(0x1eb)]);_0xc19b65[_0x3eca82(0x210)]=_0x2fa142['errName'];throw _0xc19b65;}return _0x2fa142;},process['on'](_0x5e5b21(0x1e9),async()=>{const _0x464dec=_0x5e5b21;for(const _0x574eac in _0x42cd7e){_0x42cd7e[_0x574eac]['nc']&&!_0x42cd7e[_0x574eac]['nc'][_0x464dec(0x147)]()&&await _0x42cd7e[_0x574eac]['nc'][_0x464dec(0x1c9)]();}}),process['on'](_0x5e5b21(0x213),async()=>{const _0x2fca3c=_0x5e5b21;for(const _0xacec36 in _0x42cd7e){_0x42cd7e[_0xacec36]['nc']&&!_0x42cd7e[_0xacec36]['nc'][_0x2fca3c(0x147)]()&&await _0x42cd7e[_0xacec36]['nc']['drain']();}});},module['exports'][a0_0x59b720(0x115)]=async(_0x3d72a3,_0x5402b6,_0x51fae7,_0x5c9c22)=>{const _0x3edd6b=a0_0x59b720,_0x18ae16=_0x3edd6b(0x115),_0xe7b213=_0x3d72a3;_0xe7b213[_0x3edd6b(0x1b8)][_0x3edd6b(0x112)](_0xe7b213[_0x3edd6b(0x138)]+'['+_0xe7b213[_0x3edd6b(0x19a)]+']\x20handling\x20\x22'+_0x18ae16+'\x22');try{if(!fs[_0x3edd6b(0x19b)](_0xe7b213[_0x3edd6b(0x1f7)]+'/approles'))fs[_0x3edd6b(0x1e5)](_0xe7b213[_0x3edd6b(0x1f7)]+_0x3edd6b(0x17c));}catch(_0x47545d){}const _0x588dd2=path[_0x3edd6b(0x1b4)](''+_0xe7b213[_0x3edd6b(0x1f7)],_0x3edd6b(0x162),_0x3edd6b(0x180)+_0xe7b213[_0x3edd6b(0x19a)]+_0x3edd6b(0x199)),_0x2ea3af={};utils['fsExistsSync'](_0x588dd2)&&fs['readFileSync'](_0x588dd2,_0x3edd6b(0x126))[_0x3edd6b(0x169)](/\r?\n/)['forEach'](_0x27bae3=>{const _0x4f5e4f=_0x3edd6b,_0x28caca=_0x27bae3[_0x4f5e4f(0x169)]('\x20');_0x28caca['length']===0x2&&(_0x2ea3af[_0x28caca[0x0]]=_0x28caca[0x1]);});const _0x5379c1=fs[_0x3edd6b(0x1e6)](_0x588dd2,{'flags':'w','encoding':_0x3edd6b(0x12e),'mode':0x1b6,'autoClose':!![]}),_0x3d4dcf=[],_0x512ce2=await _0xe7b213[_0x3edd6b(0x1de)](_0x5402b6,{'attribute':undefined,'operator':undefined,'value':undefined},['id',_0x3edd6b(0x177)]);return _0x512ce2[_0x3edd6b(0x134)][_0x3edd6b(0x20c)](_0x490606=>{const _0x433fad=_0x3edd6b;if(_0x490606['id']){let _0x169975=crypto[_0x433fad(0x19d)]();if(_0x2ea3af[_0x490606['id']])_0x169975=_0x2ea3af[_0x490606['id']];const _0x379dd7={'allowedMemberTypes':[_0x433fad(0x1f8)],'description':_0x433fad(0x128),'displayName':_0x490606['displayName']||_0x490606['id'],'id':_0x169975,'isEnabled':!![],'lang':null,'origin':_0x433fad(0x179),'value':decodeURIComponent(_0x490606['id'])};_0x3d4dcf[_0x433fad(0x214)](_0x379dd7),_0x5379c1[_0x433fad(0x159)](_0x490606['id']+'\x20'+_0x169975+'\x0a');}}),_0x5379c1['close'](),_0xe7b213[_0x3edd6b(0x1b8)][_0x3edd6b(0x112)](_0xe7b213[_0x3edd6b(0x138)]+'['+_0xe7b213[_0x3edd6b(0x19a)]+']\x20approle\x20uuid\x20file\x20created:\x20'+_0x588dd2),{'Resources':[{'appRoles':_0x3d4dcf}]};};
|
|
13
|
+
'use strict';const a0_0xf49a16=a0_0x5a7e;(function(_0x5e39d1,_0x5650e3){const _0x4d67be=a0_0x5a7e,_0x4e0af8=_0x5e39d1();while(!![]){try{const _0x9ce7a=parseInt(_0x4d67be(0x198))/0x1+parseInt(_0x4d67be(0x130))/0x2*(parseInt(_0x4d67be(0x161))/0x3)+-parseInt(_0x4d67be(0x10a))/0x4*(parseInt(_0x4d67be(0x192))/0x5)+parseInt(_0x4d67be(0x17a))/0x6*(-parseInt(_0x4d67be(0x146))/0x7)+parseInt(_0x4d67be(0x11c))/0x8*(parseInt(_0x4d67be(0x13a))/0x9)+parseInt(_0x4d67be(0x15b))/0xa+-parseInt(_0x4d67be(0x19a))/0xb;if(_0x9ce7a===_0x5650e3)break;else _0x4e0af8['push'](_0x4e0af8['shift']());}catch(_0x25023b){_0x4e0af8['push'](_0x4e0af8['shift']());}}}(a0_0xfc06,0xa972d));function a0_0xfc06(){const _0x44faf6=['baseUrls',']\x20error:\x20','split','obj','toLowerCase','encode',']\x20initialization\x20error:\x20missing\x20configuration\x20stream.baseUrls','\x20(count=','name','jwtAuthenticator','configDir','publisher[','join',']\x20initialization\x20error:\x20missing\x20configuration\x20nats','\x20Delete\x20User\x20id=','detail',']\x20initialization\x20error:\x20missing\x20certificate\x20configuration','\x20message:\x20user\x20does\x20not\x20exist','passThrough','##doIncrement','data','replaceDomains','tenant','\x20group\x20removal\x20error:\x20',']\x20subscriber[','_info','getUsers()\x20getObj=','40jjFKDj','createGroup','internal\x20stream\x20policy\x20have\x20been\x20changed\x20-\x20central\x20SCIM\x20Stream\x20must\x20be\x20stopped\x20and\x20corresponding\x20./jetstream\x20folder\x20deleted\x20before\x20startup\x20allowing\x20new\x20policy','\x20-\x20will\x20do\x20auto\x20reconnect\x20when\x20connection\x20becomes\x20available','elementnumber','filter_subject','config',']\x20initialization\x20error:\x20missing\x20configuration\x20nats.tenant','userName','servers','getAppRoles','password','set','displayName','gwName','query','Reconnecting','SCIM\x20Stream\x20-\x20Autogenerated','7064ggRruQ','deleteGroup','publisher\x20response\x20error:\x20','patchApi','\x20message:\x20user\x20not\x20created\x20because\x20of\x20active=false',']\x20approle\x20uuid\x20file\x20created:\x20',']\x20client\x20is\x20attempting\x20to\x20reconnect\x20','copyObj','firstn','headers','\x20result=','connect',']\x20client\x20error\x20','subscriber\x20message\x20error:\x20handle\x20\x27','deleteApi','GW.','pingInterval','value','forEach','toString','16AyyVwI','postApi','push','SIGINT','\x20done','lowercase','originalUrl',']\x20connect\x20error:\x20','StaleConnection','usePutSoftSync','12906twQKsu',']\x20initialization\x20error:\x20nats.subject\x20root\x20topic\x20must\x20be\x20\x27GW\x27,\x20nats.subject\x20example:\x20GW.APP1','StringCodec','fsExistsSync','subscribe',']\x20publisher[','certificate','503','write','path','_autogenerated.cfg','handle','28HkuMHe','/Users/','server_name','getApi','ack','\x20message\x20handled:\x20','\x20processing\x20incoming\x20message','User','deleteUserOnLastGroupRoleRemoval','call','operation','authenticator',']\x20initialization\x20error:\x20missing\x20configuration\x20nats.subject','nats','normalize','SCIM\x20Stream','\x27\x20not\x20supported','\x20error:\x20','stringify','\x20getUserId()\x20error:\x20','maxReconnectAttempts','2159090SRcrqo','\x20error:\x20missing\x20result',']\x20initialization\x20error:\x20configuration\x20scim.usePutSoftSync\x20must\x20be\x20set\x20to\x20true\x20when\x20subscribing\x20to\x20ENTRA\x20or\x20HR\x20topics','attributes','replaceUsrGrp','ENTRA.','401613vkrZkJ','substring','description',',\x20obj=','subscriber\x20message\x20error:\x20message\x20not\x20JSON\x20formatted','durable_','Reconnect','/approles','uppercase','error','params',']\x20connected\x20','getGroups','then','roles','UnableConnectingService','deleteUser','Msg-Id','\x20role\x20removal\x20error:\x20','createUser','\x22,\x22errName\x22:\x22','prototype','\x20message:\x20user\x20not\x20created\x20because\x20of\x20configuration\x20modifyOnly=true',']\x20client\x20reconnected\x20','Events','799356WNVvZZ','maxPingOut','publish','replaceAll','string',']\x20client\x20consumer\x20reinitiated\x20because\x20of\x20','timeout','HR.','\x20-\x20','waitOnFirstConnect',',\x20id=','publisher\x20not\x20initialized/connected','modifyOnly','subscriber\x20message\x20error:\x20message\x20baseEntity=','undefined','remove','typeId','baseEntity','\x20handling\x20message:\x20','request','transports','isArray','Errors',']\x20handling\x20\x22','512065vVnHcU','/certs/','AckPolicy','subscriber\x20message\x20error:\x20message\x20missing\x20handle',']\x20client\x20has\x20a\x20stale\x20connection\x20','\x20Create\x20userName=','1011830lRGCPT','activityOperation','14452174RPqIAp','\x20message:\x20','modifyUser','createRandomPassword','jetstreamManager','logger','ETIMEDOUT','\x20message\x20error\x20response:\x20',']\x20error:\x20no\x20subscribers/responders\x20to\x20subject\x20','trim','length','Resources','getProcessed','toUpperCase','{\x22error\x22:\x22','file-not-configured',',true','close','jwt','\x20roles\x20converted\x20to\x20groups:\x20','groups','display','drain',']\x20error:\x20missing\x20entity\x20configuration\x20for\x20baseEntity=',']\x20error:\x20message\x20must\x20be\x20JSON\x20formatted','\x20Create\x20User\x20userName=','Disconnect','rejectUnauthorized','exports','add','status','\x20missing\x20mandatory\x20user.userName\x20in\x20message:\x20','putApi','UnableConnectingHost','closed','get','\x20Replace\x20User\x20id=','foldReplacing','Publisher','\x20error:\x20missing\x20id}','\x20createUser()\x20obj=','SIGTERM','startsWith',']\x20error:\x20client\x20have\x20not\x20been\x20initialized','hasOwnProperty','\x20subscriber\x20error:\x20scimgateway\x20endpoint\x20connect\x20problem\x20-\x20will\x20do\x20auto\x20retry\x20until\x20connected','getuniquevalue','delete','consumers','ENOTFOUND','Operations','\x20=>\x20subscriber\x20not\x20activated','modifyGroup','Explicit',']\x20client\x20disconnected\x20','includes',']\x20closed\x20with\x20error:\x20','generateUserPassword','decode','tls','reconnectTimeWait','isClosed','utf-8','type','existsSync','from','publisher\x20error:\x20none\x20JSON\x20formatted\x20response:\x20','../lib/utils','parse','increment','message','getUsers','onCreate','crypto','readFileSync','subject','replace','DebugEvents','level','secret','ctxPassThrough','\x20convertedScim20\x20error:\x20','body','DeliverPolicy','info','approles_','debug','pluginName','schemas','active','respond',']\x20initialization\x20certificate\x20error:\x20','utf8'];a0_0xfc06=function(){return _0x44faf6;};return a0_0xfc06();}function a0_0x5a7e(_0x223546,_0x1200fe){const _0xfc0625=a0_0xfc06();return a0_0x5a7e=function(_0x5a7efa,_0x30129c){_0x5a7efa=_0x5a7efa-0xcc;let _0x4ae288=_0xfc0625[_0x5a7efa];return _0x4ae288;},a0_0x5a7e(_0x223546,_0x1200fe);}const nats=require(a0_0xf49a16(0x153)),ascii127=require('fold-to-ascii'),fs=require('fs'),utils=require(a0_0xf49a16(0xd5)),path=require(a0_0xf49a16(0x143)),crypto=require(a0_0xf49a16(0xdb));module[a0_0xf49a16(0x1b6)]['Subscriber']=function(_0x9d91cd){const _0x3db26f=a0_0xf49a16,_0x5b85c5=_0x9d91cd,_0x376b9f={};let _0x474f5e='';for(let _0x4b1bc5=0x0;_0x4b1bc5<_0x5b85c5['logger'][_0x3db26f(0x18e)][_0x3db26f(0x1a4)];_0x4b1bc5++){if(_0x5b85c5[_0x3db26f(0x19f)][_0x3db26f(0x18e)][_0x4b1bc5][_0x3db26f(0xf7)]==='file'){_0x474f5e=_0x5b85c5[_0x3db26f(0x19f)][_0x3db26f(0x18e)][_0x4b1bc5][_0x3db26f(0xe0)];break;}}const _0x5270e2=''+(_0x474f5e===_0x3db26f(0xe8)?'\x0a':''),_0x1d509a=async(_0x4b0b79,_0x3c220b)=>{const _0x15052c=_0x3db26f,_0xf2a527=_0x376b9f[_0x4b0b79][_0x15052c(0x110)]?.['nats']?.[_0x15052c(0xdd)];let _0x47ce31;try{_0x47ce31=await nats[_0x15052c(0x127)](_0x3c220b);if(_0x47ce31[_0x15052c(0xe6)]['server_name']!==_0x15052c(0x155)){_0x47ce31[_0x15052c(0x1ab)]();return;}_0x376b9f[_0x4b0b79]['nc']=_0x47ce31,_0x705127(_0x4b0b79,_0x47ce31),_0x521add(_0x4b0b79,_0x47ce31);}catch(_0x57045e){_0x5b85c5[_0x15052c(0x19f)][_0x15052c(0x16a)](_0x5b85c5['gwName']+'['+_0x5b85c5[_0x15052c(0xe9)]+']\x20subscriber['+_0x4b0b79+']['+_0xf2a527+']\x20connect\x20error:\x20'+_0x57045e[_0x15052c(0xd8)]+'\x20-\x20will\x20do\x20auto\x20connect\x20when\x20available\x20-\x20however,\x20please\x20verify\x20stream\x20configuration'),_0x3c220b[_0x15052c(0x183)]=!![];try{_0x47ce31=await nats[_0x15052c(0x127)](_0x3c220b);if(_0x47ce31['info'][_0x15052c(0x148)]!==_0x15052c(0x155)){_0x47ce31[_0x15052c(0x1ab)]();return;}_0x376b9f[_0x4b0b79]['nc']=_0x47ce31,_0x705127(_0x4b0b79,_0x47ce31),_0x521add(_0x4b0b79,_0x47ce31);}catch(_0x3a0e28){_0x5b85c5['logger'][_0x15052c(0x16a)](_0x5b85c5[_0x15052c(0x118)]+'['+_0x5b85c5[_0x15052c(0xe9)]+_0x15052c(0x107)+_0x4b0b79+']['+_0xf2a527+_0x15052c(0x137)+_0x3a0e28[_0x15052c(0xd8)]);return;}}_0x5b85c5[_0x15052c(0x19f)]['debug'](_0x5b85c5[_0x15052c(0x118)]+'['+_0x5b85c5[_0x15052c(0xe9)]+_0x15052c(0x107)+_0x4b0b79+']['+_0xf2a527+_0x15052c(0x16c)+(_0x3c220b[_0x15052c(0xcd)]['ca']?_0x15052c(0xcd):'')+'\x20'+_0x47ce31['getServer']()),_0x47ce31[_0x15052c(0x1bc)]()['then'](_0x1dd804=>{const _0x5e7151=_0x15052c;_0x1dd804&&_0x5b85c5[_0x5e7151(0x19f)]['error'](_0x5b85c5[_0x5e7151(0x118)]+'['+_0x5b85c5['pluginName']+_0x5e7151(0x107)+_0x4b0b79+']['+_0xf2a527+_0x5e7151(0x1d2)+_0x1dd804['message']);});};this['add']=async(_0xdf7874,_0x53c0b4)=>{const _0x51e08a=_0x3db26f;if(!_0x53c0b4?.['nats']){_0x5b85c5[_0x51e08a(0x19f)][_0x51e08a(0x16a)](_0x5b85c5[_0x51e08a(0x118)]+'['+_0x5b85c5[_0x51e08a(0xe9)]+_0x51e08a(0x107)+_0xdf7874+_0x51e08a(0xfc));return;}if(!_0x53c0b4?.[_0x51e08a(0x153)]?.[_0x51e08a(0x105)]){_0x5b85c5[_0x51e08a(0x19f)][_0x51e08a(0x16a)](_0x5b85c5[_0x51e08a(0x118)]+'['+_0x5b85c5[_0x51e08a(0xe9)]+_0x51e08a(0x107)+_0xdf7874+']\x20initialization\x20error:\x20missing\x20configuration\x20nats.tenant');return;}if(!_0x53c0b4?.[_0x51e08a(0x153)]?.[_0x51e08a(0xdd)]){_0x5b85c5['logger']['error'](_0x5b85c5[_0x51e08a(0x118)]+'['+_0x5b85c5['pluginName']+']\x20subscriber['+_0xdf7874+_0x51e08a(0x152));return;}if(!_0x53c0b4?.['certificate']?.['ca']){_0x5b85c5[_0x51e08a(0x19f)][_0x51e08a(0x16a)](_0x5b85c5[_0x51e08a(0x118)]+'['+_0x5b85c5[_0x51e08a(0xe9)]+_0x51e08a(0x107)+_0xdf7874+_0x51e08a(0xff));return;}if(!_0x53c0b4['baseUrls']||!Array[_0x51e08a(0x18f)](_0x53c0b4[_0x51e08a(0xef)])||_0x53c0b4['baseUrls'][_0x51e08a(0x1a4)]<0x1){_0x5b85c5[_0x51e08a(0x19f)][_0x51e08a(0x16a)](_0x5b85c5[_0x51e08a(0x118)]+'['+_0x5b85c5[_0x51e08a(0xe9)]+_0x51e08a(0x107)+_0xdf7874+_0x51e08a(0xf5));return;}if(!_0x53c0b4[_0x51e08a(0x139)]){const _0x235ad8=_0x53c0b4?.[_0x51e08a(0x153)]?.[_0x51e08a(0xdd)]['toUpperCase']();if(_0x235ad8[_0x51e08a(0x1c4)](_0x51e08a(0x160))||_0x235ad8[_0x51e08a(0x1c4)](_0x51e08a(0x181))){_0x5b85c5[_0x51e08a(0x19f)][_0x51e08a(0x16a)](_0x5b85c5[_0x51e08a(0x118)]+'['+_0x5b85c5['pluginName']+_0x51e08a(0x107)+_0xdf7874+_0x51e08a(0x15d));return;}}const _0x1e49f6={};try{let _0x12d19c=path[_0x51e08a(0xfb)](_0x5b85c5[_0x51e08a(0xf9)],_0x51e08a(0x193),_0x53c0b4?.['certificate']?.['ca']||_0x51e08a(0x1a9));(_0x53c0b4?.[_0x51e08a(0x140)]?.['ca']?.[_0x51e08a(0x1c4)]('/')||_0x53c0b4?.[_0x51e08a(0x140)]?.['ca']?.[_0x51e08a(0x1d1)]('\x5c'))&&(_0x12d19c=_0x53c0b4[_0x51e08a(0x140)]['ca']),_0x1e49f6['ca']=[fs[_0x51e08a(0xdc)](_0x12d19c)],_0x1e49f6[_0x51e08a(0x1b5)]=!![];}catch(_0x4529ac){_0x5b85c5['logger']['error'](_0x5b85c5[_0x51e08a(0x118)]+'['+_0x5b85c5[_0x51e08a(0xe9)]+']\x20subscriber['+_0xdf7874+_0x51e08a(0xed)+_0x4529ac[_0x51e08a(0xd8)]);return;}const _0x15f3a8={},_0x531986=new TextEncoder()[_0x51e08a(0xf4)](_0x53c0b4?.[_0x51e08a(0x153)]?.['secret']),_0x3f0833=_0x53c0b4?.[_0x51e08a(0x153)]?.[_0x51e08a(0x1ac)];_0x15f3a8[_0x51e08a(0x151)]=nats[_0x51e08a(0xf8)](_0x3f0833,_0x531986),_0x15f3a8[_0x51e08a(0x113)]=_0x53c0b4[_0x51e08a(0xef)],_0x15f3a8[_0x51e08a(0xcd)]=_0x1e49f6,_0x15f3a8[_0x51e08a(0x183)]=![],_0x15f3a8['reconnect']=!![],_0x15f3a8['reconnectTimeWait']=0x3e8*0xa,_0x15f3a8[_0x51e08a(0x15a)]=-0x1,_0x15f3a8[_0x51e08a(0x12c)]=0x2*0x3c*0x3e8,_0x15f3a8[_0x51e08a(0x17b)]=0x5,_0x15f3a8['debug']=![],_0x376b9f[_0xdf7874]={},_0x376b9f[_0xdf7874]['config']=_0x53c0b4,_0x376b9f[_0xdf7874]['nc']=undefined,_0x376b9f[_0xdf7874]['sub']=undefined,_0x1d509a(_0xdf7874,_0x15f3a8);};const _0x521add=async(_0x2a77f1,_0x4a36dd)=>{const _0x2c4d46=_0x3db26f,_0x1cd796=_0x376b9f[_0x2a77f1][_0x2c4d46(0x110)],_0x2ab88f=_0x1cd796?.[_0x2c4d46(0x153)]?.[_0x2c4d46(0xdd)];if(!_0x4a36dd){_0x5b85c5[_0x2c4d46(0x19f)][_0x2c4d46(0x16a)](_0x5b85c5[_0x2c4d46(0x118)]+'['+_0x5b85c5['pluginName']+']\x20subscriber['+_0x2a77f1+']['+_0x2ab88f+_0x2c4d46(0x1c5));return;}const _0x36d936=async(_0x3cbf23,_0xb61071)=>{const _0x553f2c=_0x2c4d46;try{_0x5b85c5[_0x553f2c(0x19f)][_0x553f2c(0xe6)](_0x3cbf23+_0x553f2c(0x18c)+_0xb61071);let _0x72a681;try{if(_0x1cd796[_0x553f2c(0x104)]&&Array[_0x553f2c(0x18f)](_0x1cd796['replaceDomains']))for(let _0x198023=0x0;_0x198023<_0x1cd796[_0x553f2c(0x104)][_0x553f2c(0x1a4)];_0x198023++){const _0x4edd65=_0x1cd796[_0x553f2c(0x104)][_0x198023];if(!_0x4edd65[_0x553f2c(0xd3)]||!_0x4edd65['from'][_0x553f2c(0x1d1)]('.')||!_0x4edd65['to']||!_0x4edd65['to'][_0x553f2c(0x1d1)]('.'))continue;const _0x22c701=new RegExp('@'+_0x4edd65[_0x553f2c(0xd3)]+'\x22','gi');_0xb61071=_0xb61071['replace'](_0x22c701,'@'+_0x4edd65['to']+'\x22');}_0x72a681=JSON[_0x553f2c(0xd6)](_0xb61071);}catch(_0x22d621){_0x5b85c5['logger'][_0x553f2c(0x16a)](_0x3cbf23+'\x20message\x20json\x20parsing\x20error:\x20'+_0x22d621['message']+_0x553f2c(0x19b)+_0xb61071),_0x5b85c5[_0x553f2c(0x19f)]['debug'](_0x3cbf23+_0x553f2c(0x134)+_0x5270e2);return;}const _0x536239=_0x72a681['user'];if(!_0x536239){_0x5b85c5['logger']['error'](_0x3cbf23+'\x20missing\x20user\x20object\x20in\x20message:\x20'+JSON[_0x553f2c(0x158)](_0x72a681)),_0x5b85c5[_0x553f2c(0x19f)][_0x553f2c(0xe8)](_0x3cbf23+_0x553f2c(0x134)+_0x5270e2);return;}if(!_0x536239[_0x553f2c(0x112)]){_0x5b85c5[_0x553f2c(0x19f)]['error'](_0x3cbf23+_0x553f2c(0x1b9)+JSON[_0x553f2c(0x158)](_0x72a681)),_0x5b85c5[_0x553f2c(0x19f)][_0x553f2c(0xe8)](_0x3cbf23+'\x20done'+_0x5270e2);return;}delete _0x536239[_0x553f2c(0xea)];let _0x20884a;_0x536239['id']&&(_0x20884a=_0x536239['id'],delete _0x536239['id']);let _0x310112;_0x536239[_0x553f2c(0xda)]&&(_0x310112=utils[_0x553f2c(0x123)](_0x536239[_0x553f2c(0xda)]),delete _0x536239[_0x553f2c(0xda)]);await _0x38befb(_0x2a77f1,_0x536239);const _0x280b1a=_0x536239[_0x553f2c(0x112)];let _0xf12229,_0x142dbc;try{_0xf12229=await _0x2c9991(_0x2a77f1,_0x553f2c(0x112),_0x280b1a);}catch(_0x16a13e){_0x5b85c5[_0x553f2c(0x19f)]['error'](_0x3cbf23+_0x553f2c(0x159)+_0x16a13e[_0x553f2c(0xd8)]),_0x5b85c5[_0x553f2c(0x19f)][_0x553f2c(0xe8)](_0x3cbf23+_0x553f2c(0x134)+_0x5270e2);const _0x4996b8=[_0x553f2c(0x1bb),_0x553f2c(0x170),'ECONNREFUSED',_0x553f2c(0x1cb),_0x553f2c(0x1a0),_0x553f2c(0x180)];for(const _0x209b8a in _0x4996b8){if(_0x16a13e['message'][_0x553f2c(0x1d1)](_0x209b8a))return!![];}return;}if(!_0x1cd796['skipConvertRolesToGroups']){let _0x582e2a=![];if(_0x72a681['Operations']&&Array[_0x553f2c(0x18f)](_0x72a681[_0x553f2c(0x1cc)]))for(let _0x5a204a=0x0;_0x5a204a<_0x72a681['Operations'][_0x553f2c(0x1a4)];_0x5a204a++){const _0x210ec4=_0x72a681[_0x553f2c(0x1cc)][_0x5a204a];_0x210ec4[_0x553f2c(0x143)][_0x553f2c(0x1c4)]('roles')&&(_0x210ec4[_0x553f2c(0x143)]=_0x553f2c(0x1ae),Array[_0x553f2c(0x18f)](_0x210ec4[_0x553f2c(0x12d)])?(_0x210ec4[_0x553f2c(0x12d)][0x0]['id']=_0x210ec4['value'][0x0][_0x553f2c(0x12d)],_0x210ec4['value'][0x0][_0x553f2c(0x1af)]=_0x210ec4[_0x553f2c(0x12d)][0x0][_0x553f2c(0xd1)]+'\x20-\x20'+_0x210ec4[_0x553f2c(0x12d)][0x0][_0x553f2c(0x12d)],delete _0x210ec4['value'][0x0]['value'],delete _0x210ec4[_0x553f2c(0x12d)][0x0]['type']):_0x210ec4[_0x553f2c(0x12d)]=[{'id':_0x210ec4[_0x553f2c(0x12d)],'display':_0x210ec4[_0x553f2c(0x12d)]}],delete _0x210ec4[_0x553f2c(0x18a)],_0x582e2a=!![]);}if(_0x536239[_0x553f2c(0x16f)]&&Array['isArray'](_0x536239[_0x553f2c(0x16f)])&&_0x536239['roles'][_0x553f2c(0x1a4)]>0x0){if(!_0x536239[_0x553f2c(0x1ae)])_0x536239[_0x553f2c(0x1ae)]=[];if(!Array[_0x553f2c(0x18f)](_0x536239[_0x553f2c(0x1ae)]))_0x536239[_0x553f2c(0x1ae)]=[];for(let _0x57a7df=0x0;_0x57a7df<_0x536239[_0x553f2c(0x16f)][_0x553f2c(0x1a4)];_0x57a7df++){const _0x25c5a4={},_0x2be95f=_0x536239['roles'][_0x57a7df];_0x25c5a4[_0x553f2c(0x12d)]=_0x2be95f[_0x553f2c(0x12d)],_0x25c5a4[_0x553f2c(0x1af)]=_0x2be95f[_0x553f2c(0xd1)]+_0x553f2c(0x182)+_0x2be95f[_0x553f2c(0x1af)],_0x536239[_0x553f2c(0x1ae)][_0x553f2c(0x132)](_0x25c5a4);}delete _0x536239[_0x553f2c(0x16f)],_0x582e2a=!![];}if(_0x582e2a)_0x5b85c5[_0x553f2c(0x19f)]['debug'](_0x3cbf23+_0x553f2c(0x1ad)+JSON['stringify'](_0x72a681));}if(!_0xf12229){if(_0x72a681[_0x553f2c(0x199)]===_0x553f2c(0x171)){_0x5b85c5['logger'][_0x553f2c(0xe8)](_0x3cbf23+'\x20Delete\x20User\x20userName='+_0x280b1a+_0x553f2c(0x100)),_0x5b85c5[_0x553f2c(0x19f)][_0x553f2c(0xe8)](_0x3cbf23+'\x20done'+_0x5270e2);return;}if(_0x1cd796[_0x553f2c(0x186)]&&_0x1cd796[_0x553f2c(0x186)]===!![]){_0x5b85c5['logger'][_0x553f2c(0xe8)](_0x3cbf23+_0x553f2c(0x197)+_0x280b1a+_0x553f2c(0x177)),_0x5b85c5[_0x553f2c(0x19f)]['debug'](_0x3cbf23+_0x553f2c(0x134)+_0x5270e2);return;}if(Object[_0x553f2c(0x176)][_0x553f2c(0x1c6)][_0x553f2c(0x14f)](_0x536239,_0x553f2c(0xeb))){if(typeof _0x536239[_0x553f2c(0xeb)]==='string'){const _0x5e9bad=_0x536239['active'][_0x553f2c(0xf3)]();if(_0x5e9bad==='true')_0x536239[_0x553f2c(0xeb)]=!![];else{if(_0x5e9bad==='false')_0x536239[_0x553f2c(0xeb)]=![];}}if(_0x536239[_0x553f2c(0xeb)]===![]){_0x5b85c5[_0x553f2c(0x19f)][_0x553f2c(0xe8)](_0x3cbf23+'\x20Create\x20userName='+_0x280b1a+_0x553f2c(0x120)),_0x5b85c5[_0x553f2c(0x19f)]['debug'](_0x3cbf23+_0x553f2c(0x134)+_0x5270e2);return;}}_0x5b85c5['logger'][_0x553f2c(0xe8)](_0x3cbf23+_0x553f2c(0x1b3)+_0x280b1a);const _0x10d736=utils[_0x553f2c(0x123)](_0x536239);try{delete _0x10d736[_0x553f2c(0x1ae)];!_0x10d736[_0x553f2c(0x115)]&&_0x1cd796[_0x553f2c(0x1d3)]&&_0x1cd796[_0x553f2c(0x1d3)]===!![]&&(_0x10d736[_0x553f2c(0x115)]=utils[_0x553f2c(0x19d)](0xf));if(_0x310112||_0x20884a){if(_0x310112)for(const _0x2a0edb in _0x310112){_0x10d736[_0x2a0edb]=_0x310112[_0x2a0edb];}if(_0x20884a)_0x10d736['id']=_0x20884a;await _0x38befb(_0x2a77f1,_0x10d736);}await _0x5b85c5[_0x553f2c(0x174)](_0x2a77f1,_0x10d736),_0x536239['groups']&&Array[_0x553f2c(0x18f)](_0x536239[_0x553f2c(0x1ae)])&&_0x536239[_0x553f2c(0x1ae)][_0x553f2c(0x1a4)]>0x0&&(_0x142dbc=await _0x2c9991(_0x2a77f1,_0x553f2c(0x112),_0x280b1a));}catch(_0x416202){_0x5b85c5['logger'][_0x553f2c(0x16a)](_0x3cbf23+_0x553f2c(0x1c2)+JSON[_0x553f2c(0x158)](_0x10d736)+_0x553f2c(0x157)+_0x416202[_0x553f2c(0xd8)]+'}'),_0x5b85c5[_0x553f2c(0x19f)]['debug'](_0x3cbf23+_0x553f2c(0x134)+_0x5270e2);return;}}if(_0xf12229||_0x142dbc){if(_0x72a681[_0x553f2c(0x199)]===_0x553f2c(0x171)){if(_0x1cd796['modifyOnly']&&_0x1cd796[_0x553f2c(0x186)]===!![]){_0x5b85c5[_0x553f2c(0x19f)][_0x553f2c(0xe8)](_0x3cbf23+_0x553f2c(0xfd)+_0xf12229+'\x20message:\x20user\x20not\x20deleted\x20because\x20of\x20configuration\x20modifyOnly=true'),_0x5b85c5['logger'][_0x553f2c(0xe8)](_0x3cbf23+_0x553f2c(0x134)+_0x5270e2);return;}_0x5b85c5[_0x553f2c(0x19f)][_0x553f2c(0xe8)](_0x3cbf23+_0x553f2c(0xfd)+_0xf12229);try{await _0x5b85c5[_0x553f2c(0x171)](_0x2a77f1,_0xf12229);}catch(_0x1c1f36){_0x5b85c5[_0x553f2c(0x19f)]['error'](_0x3cbf23+_0x553f2c(0xfd)+_0xf12229+_0x553f2c(0x157)+_0x1c1f36[_0x553f2c(0xd8)]+'}'),_0x5b85c5[_0x553f2c(0x19f)]['debug'](_0x3cbf23+'\x20done'+_0x5270e2);return;}}else{if(_0x142dbc)_0xf12229=_0x142dbc;_0x5b85c5[_0x553f2c(0x19f)][_0x553f2c(0xe8)](_0x3cbf23+_0x553f2c(0x1be)+_0xf12229);const _0x12668b={};_0x12668b['set']=()=>{},_0x12668b[_0x553f2c(0x16b)]={},_0x12668b[_0x553f2c(0x16b)][_0x553f2c(0x18b)]=_0x2a77f1,_0x12668b[_0x553f2c(0x16b)]['id']=_0xf12229,_0x12668b[_0x553f2c(0x18d)]={},_0x12668b['request'][_0x553f2c(0x136)]=_0x2a77f1?'/'+_0x2a77f1+_0x553f2c(0x147)+_0xf12229:'/Users/'+_0xf12229,_0x12668b[_0x553f2c(0x18d)][_0x553f2c(0xe4)]=_0x536239;try{await _0x5b85c5[_0x553f2c(0x15f)](_0x12668b);}catch(_0x1d443b){_0x5b85c5[_0x553f2c(0x19f)][_0x553f2c(0x16a)](_0x3cbf23+_0x553f2c(0x1be)+_0xf12229+_0x553f2c(0x157)+_0x1d443b[_0x553f2c(0xd8)]),_0x5b85c5[_0x553f2c(0x19f)]['debug'](_0x3cbf23+_0x553f2c(0x134)+_0x5270e2);return;}if(_0x12668b['status']&&(_0x12668b[_0x553f2c(0x1b8)]<0xc8||_0x12668b[_0x553f2c(0x1b8)]>0x12b)){if(_0x12668b[_0x553f2c(0xe4)]){if(_0x12668b[_0x553f2c(0xe4)]['detail']){let _0x40074c=_0x12668b['body'][_0x553f2c(0xfe)];_0x40074c=_0x40074c[_0x553f2c(0xde)](_0x5b85c5['gwName']+'['+_0x5b85c5[_0x553f2c(0xe9)]+']',''+_0x3cbf23),_0x5b85c5[_0x553f2c(0x19f)][_0x553f2c(0x16a)](''+_0x40074c);}else{if(_0x12668b[_0x553f2c(0xe4)][_0x553f2c(0x190)]&&Array[_0x553f2c(0x18f)](_0x12668b['body'][_0x553f2c(0x190)])&&_0x12668b[_0x553f2c(0xe4)][_0x553f2c(0x190)][_0x553f2c(0x1a4)]>0x0){let _0x4af99a=_0x12668b[_0x553f2c(0xe4)][_0x553f2c(0x190)][0x0][_0x553f2c(0x163)];_0x4af99a=_0x4af99a[_0x553f2c(0xde)](_0x5b85c5[_0x553f2c(0x118)]+'['+_0x5b85c5[_0x553f2c(0xe9)]+']',''+_0x3cbf23),_0x5b85c5['logger'][_0x553f2c(0x16a)](''+_0x4af99a);}}}}if(_0x1cd796[_0x553f2c(0x139)]){const [_0x1f3645,_0x4eca0b]=_0x5b85c5['convertedScim20']({'Operations':_0x72a681['Operations']});if(_0x4eca0b){_0x5b85c5[_0x553f2c(0x19f)][_0x553f2c(0x16a)](_0x3cbf23+_0x553f2c(0x1be)+_0xf12229+_0x553f2c(0xe3)+_0x4eca0b[_0x553f2c(0xd8)]),_0x5b85c5[_0x553f2c(0x19f)]['debug'](_0x3cbf23+_0x553f2c(0x134)+_0x5270e2);return;}const _0x400648=[];if(_0x1f3645[_0x553f2c(0x16f)]&&Array[_0x553f2c(0x18f)](_0x1f3645[_0x553f2c(0x16f)]))for(let _0x3c2129=0x0;_0x3c2129<_0x1f3645['roles'][_0x553f2c(0x1a4)];_0x3c2129++){_0x1f3645['roles'][_0x3c2129][_0x553f2c(0x150)]&&_0x1f3645['roles'][_0x3c2129][_0x553f2c(0x150)]===_0x553f2c(0x1c9)&&_0x400648['push'](_0x1f3645[_0x553f2c(0x16f)][_0x3c2129]);}if(_0x400648[_0x553f2c(0x1a4)]>0x0)try{await _0x5b85c5['modifyUser'](_0x2a77f1,_0xf12229,{'roles':_0x400648});}catch(_0x4090e2){_0x5b85c5[_0x553f2c(0x19f)][_0x553f2c(0x16a)](_0x3cbf23+'\x20Replace\x20User\x20id='+_0xf12229+_0x553f2c(0x173)+_0x4090e2[_0x553f2c(0xd8)]);}const _0x5c88c7=[];if(_0x1f3645['groups']&&Array['isArray'](_0x1f3645[_0x553f2c(0x1ae)]))for(let _0x3c4e9c=0x0;_0x3c4e9c<_0x1f3645['groups'][_0x553f2c(0x1a4)];_0x3c4e9c++){_0x1f3645[_0x553f2c(0x1ae)][_0x3c4e9c][_0x553f2c(0x150)]&&_0x1f3645['groups'][_0x3c4e9c][_0x553f2c(0x150)]===_0x553f2c(0x1c9)&&_0x5c88c7[_0x553f2c(0x132)](_0x1f3645[_0x553f2c(0x1ae)][_0x3c4e9c]);}if(_0x5c88c7[_0x553f2c(0x1a4)]>0x0)for(let _0x58489b=0x0;_0x58489b<_0x5c88c7['length'];_0x58489b++){try{await _0x5b85c5[_0x553f2c(0x1ce)](_0x2a77f1,_0x5c88c7[_0x58489b]['id'],{'members':[{'operation':_0x553f2c(0x1c9),'value':_0xf12229}]});}catch(_0x51d576){_0x5b85c5[_0x553f2c(0x19f)][_0x553f2c(0x16a)](_0x3cbf23+'\x20Replace\x20User\x20id='+_0xf12229+_0x553f2c(0x106)+_0x51d576[_0x553f2c(0xd8)]);}}}if(_0x1cd796[_0x553f2c(0x14e)]&&_0x72a681[_0x553f2c(0x199)]===_0x553f2c(0x19c)){if(_0x536239[_0x553f2c(0x1ae)]&&Array['isArray'](_0x536239[_0x553f2c(0x1ae)])&&_0x536239[_0x553f2c(0x1ae)][_0x553f2c(0x1a4)]===0x0){if(_0x536239['roles']&&Array[_0x553f2c(0x18f)](_0x536239[_0x553f2c(0x16f)])&&_0x536239[_0x553f2c(0x16f)][_0x553f2c(0x1a4)]===0x0){if(_0x72a681[_0x553f2c(0x1cc)]&&Array['isArray'](_0x72a681['Operations'])&&_0x72a681[_0x553f2c(0x1cc)][_0x553f2c(0x1a4)]>0x0){let _0x356a57=![];for(let _0xf110f4=0x0;_0xf110f4<_0x72a681['Operations'][_0x553f2c(0x1a4)];_0xf110f4++){const _0x61397e=_0x72a681[_0x553f2c(0x1cc)][_0xf110f4];if(_0x61397e['op']===_0x553f2c(0x189)){if(_0x61397e[_0x553f2c(0x143)]){if(_0x61397e[_0x553f2c(0x143)][_0x553f2c(0x1c4)](_0x553f2c(0x16f))&&_0x61397e[_0x553f2c(0x18a)]){_0x356a57=!![];break;}else{if(_0x61397e[_0x553f2c(0x143)]==='groups'){_0x356a57=!![];break;}}}}}if(_0x356a57){_0x5b85c5[_0x553f2c(0x19f)][_0x553f2c(0xe8)](_0x3cbf23+_0x553f2c(0xfd)+_0xf12229);try{await _0x5b85c5[_0x553f2c(0x171)](_0x2a77f1,_0xf12229);}catch(_0x2a122f){_0x5b85c5[_0x553f2c(0x19f)][_0x553f2c(0x16a)](_0x3cbf23+_0x553f2c(0xfd)+_0xf12229+_0x553f2c(0x157)+_0x2a122f[_0x553f2c(0xd8)]+'}'),_0x5b85c5['logger'][_0x553f2c(0xe8)](_0x3cbf23+_0x553f2c(0x134)+_0x5270e2);return;}}}}}}}}_0x5b85c5[_0x553f2c(0x19f)][_0x553f2c(0xe8)](_0x3cbf23+_0x553f2c(0x134)+_0x5270e2);}catch(_0x3d5f06){_0x5b85c5[_0x553f2c(0x19f)][_0x553f2c(0x16a)](_0x5b85c5[_0x553f2c(0x118)]+'['+_0x5b85c5['pluginName']+']\x20subscriber['+_0x2a77f1+']['+_0x2ab88f+']\x20error:\x20'+_0x3d5f06[_0x553f2c(0xd8)]+_0x553f2c(0x1cd)+_0x5270e2);}},_0x2ca014=nats[_0x2c4d46(0x13c)](),_0x3a8a87=_0x4a36dd['jetstream'](),_0x4a48e9=(_0x2c4d46(0x166)+_0x5b85c5[_0x2c4d46(0xe9)]+'_'+_0x2a77f1)['replaceAll']('*','#')[_0x2c4d46(0x17d)]('>','##')[_0x2c4d46(0x17d)]('.','_'),_0x103154=_0x2ab88f[_0x2c4d46(0xf1)]('.')[0x0][_0x2c4d46(0x1a7)]()==='GW',_0xcf4135=async()=>{const _0x3f3df0=_0x2c4d46;try{let _0x541313;const _0x269c05=''+_0x1cd796?.[_0x3f3df0(0x153)]?.[_0x3f3df0(0x105)],_0x4e28a1=await _0x4a36dd[_0x3f3df0(0x19e)](),_0xa994e7=async()=>{const _0x192d3a=_0x3f3df0;let _0x9c3ff2;try{_0x9c3ff2=await _0x3a8a87[_0x192d3a(0x1ca)]['get'](_0x269c05,_0x4a48e9);}catch(_0x20c97c){const _0x334452={'durable_name':_0x4a48e9,'deliver_policy':nats[_0x192d3a(0xe5)]['All'],'ack_policy':nats[_0x192d3a(0x194)][_0x192d3a(0x1cf)],'filter_subject':_0x2ab88f};await _0x4e28a1['consumers'][_0x192d3a(0x1b7)](_0x269c05,_0x334452),_0x9c3ff2=await _0x3a8a87[_0x192d3a(0x1ca)][_0x192d3a(0x1bd)](_0x269c05,_0x4a48e9);}if(_0x9c3ff2?.[_0x192d3a(0x108)]?.[_0x192d3a(0x110)]?.['deliver_policy']!=='all')throw new Error(_0x192d3a(0x10c));_0x9c3ff2?.[_0x192d3a(0x108)]?.['config']?.[_0x192d3a(0x10f)]!==_0x2ab88f&&(await _0x4e28a1[_0x192d3a(0x1ca)]['update'](_0x269c05,_0x4a48e9,{'filter_subject':_0x2ab88f}),_0x9c3ff2=await _0x3a8a87[_0x192d3a(0x1ca)][_0x192d3a(0x1bd)](_0x269c05,_0x4a48e9)),_0x541313=await _0x9c3ff2['consume']({'max_messages':0x64}),_0x1e4622(_0x541313);},_0x1e4622=async _0x4964da=>{const _0x1f1886=_0x3f3df0;for await(const _0x4a36ac of await _0x4964da[_0x1f1886(0x1b8)]()){switch(_0x4a36ac['type']){case nats['ConsumerEvents']['ConsumerNotFound']:_0x5b85c5['logger'][_0x1f1886(0xe6)](_0x5b85c5[_0x1f1886(0x118)]+'['+_0x5b85c5[_0x1f1886(0xe9)]+']\x20subscriber['+_0x2a77f1+']['+_0x2ab88f+_0x1f1886(0x17f)+_0x4a36ac[_0x1f1886(0xd1)]),_0xa994e7();return;}}};await _0xa994e7();let _0x4e54a2=-0x1;do{for await(const _0x458606 of _0x541313){if(!_0x458606[_0x3f3df0(0x125)]||!_0x458606[_0x3f3df0(0x125)]['get'](_0x3f3df0(0x172))){_0x458606['ack']();continue;}_0x4e54a2=_0x541313[_0x3f3df0(0x1a6)]();const _0x1b4090=_0x5b85c5[_0x3f3df0(0x118)]+'['+_0x5b85c5[_0x3f3df0(0xe9)]+_0x3f3df0(0x107)+_0x2a77f1+']['+_0x458606[_0x3f3df0(0xdd)]+']['+_0x4e54a2+']['+(_0x458606[_0x3f3df0(0x125)]?_0x458606['headers'][_0x3f3df0(0x1bd)](_0x3f3df0(0x172)):'')+']',_0x44925a=_0x2ca014[_0x3f3df0(0xcc)](_0x458606[_0x3f3df0(0x103)]),_0x334efc=await _0x36d936(_0x1b4090,_0x44925a);if(!_0x334efc||_0x334efc!==!![])_0x458606[_0x3f3df0(0x14a)]();else _0x5b85c5['logger'][_0x3f3df0(0x16a)](_0x1b4090+_0x3f3df0(0x1c7));if(_0x4e54a2<0x1)break;}}while(_0x4e54a2===0x0);}catch(_0xf708ce){_0x5b85c5[_0x3f3df0(0x19f)][_0x3f3df0(0x16a)](_0x5b85c5[_0x3f3df0(0x118)]+'['+_0x5b85c5[_0x3f3df0(0xe9)]+_0x3f3df0(0x107)+_0x2a77f1+']['+_0x2ab88f+']\x20subscriber\x20stopped\x20error:\x20'+_0xf708ce['message']);}},_0x2217c2=async()=>{const _0x1a4208=_0x2c4d46,_0x47c291=_0x4a36dd[_0x1a4208(0x13e)](_0x2ab88f,{'max':0x64});for await(const _0x589cd6 of _0x47c291){if(!_0x589cd6[_0x1a4208(0x125)]||!_0x589cd6[_0x1a4208(0x125)][_0x1a4208(0x1bd)](_0x1a4208(0x172)))continue;let _0x26a652,_0x31a02c;try{try{_0x26a652=JSON['parse'](_0x589cd6['string']());}catch(_0x50e88c){const _0x4fd1c2=_0x1a4208(0x165);_0x5b85c5[_0x1a4208(0x19f)][_0x1a4208(0x16a)](_0x5b85c5[_0x1a4208(0x118)]+'['+_0x5b85c5[_0x1a4208(0xe9)]+_0x1a4208(0x107)+_0x2a77f1+']['+_0x2ab88f+']\x20'+_0x4fd1c2+':\x20'+_0x589cd6['string']());throw new Error(_0x4fd1c2);}if(!_0x26a652||!_0x26a652['handle']){const _0x1c90bc=_0x1a4208(0x195);_0x5b85c5[_0x1a4208(0x19f)][_0x1a4208(0x16a)](_0x5b85c5[_0x1a4208(0x118)]+'['+_0x5b85c5['pluginName']+_0x1a4208(0x107)+_0x2a77f1+']['+_0x2ab88f+']\x20'+_0x1c90bc+':\x20'+_0x26a652);throw new Error(_0x1c90bc);}!Object[_0x1a4208(0x176)]['hasOwnProperty'][_0x1a4208(0x14f)](_0x26a652,'baseEntity')&&(_0x26a652[_0x1a4208(0x18b)]=_0x1a4208(0x188));if(_0x26a652[_0x1a4208(0x18b)]!==_0x2a77f1){const _0x4dfb8e=_0x1a4208(0x187)+_0x26a652[_0x1a4208(0x18b)]+'\x20not\x20equal\x20subscriber\x20configured\x20baseEntity='+_0x2a77f1;_0x5b85c5[_0x1a4208(0x19f)][_0x1a4208(0x16a)](_0x5b85c5[_0x1a4208(0x118)]+'['+_0x5b85c5[_0x1a4208(0xe9)]+_0x1a4208(0x107)+_0x2a77f1+']['+_0x2ab88f+']\x20'+_0x4dfb8e);throw new Error(_0x4dfb8e);}_0x31a02c=_0x5b85c5[_0x1a4208(0x118)]+'['+_0x5b85c5[_0x1a4208(0xe9)]+_0x1a4208(0x107)+_0x2a77f1+']['+_0x589cd6['subject']+']['+(_0x589cd6[_0x1a4208(0x125)]?_0x589cd6['headers']['get'](_0x1a4208(0x172)):'')+']',_0x5b85c5[_0x1a4208(0x19f)][_0x1a4208(0xe8)](_0x31a02c+_0x1a4208(0x14c));let _0x28c8ca,_0x2c2c31;switch(_0x26a652['handle']){case'getUsers':_0x28c8ca=await _0x5b85c5[_0x26a652['handle']](_0x2a77f1,_0x26a652[_0x1a4208(0xf2)],_0x26a652[_0x1a4208(0x15e)],_0x26a652[_0x1a4208(0xe2)]);break;case _0x1a4208(0x16d):_0x28c8ca=await _0x5b85c5[_0x26a652[_0x1a4208(0x145)]](_0x2a77f1,_0x26a652[_0x1a4208(0xf2)],_0x26a652[_0x1a4208(0x15e)],_0x26a652['ctxPassThrough']);break;case'createUser':_0x28c8ca=await _0x5b85c5[_0x26a652[_0x1a4208(0x145)]](_0x2a77f1,_0x26a652[_0x1a4208(0xf2)],_0x26a652['ctxPassThrough']);break;case _0x1a4208(0x10b):_0x28c8ca=await _0x5b85c5[_0x26a652[_0x1a4208(0x145)]](_0x2a77f1,_0x26a652[_0x1a4208(0xf2)],_0x26a652['ctxPassThrough']);break;case _0x1a4208(0x171):_0x28c8ca=await _0x5b85c5[_0x26a652[_0x1a4208(0x145)]](_0x2a77f1,_0x26a652['id'],_0x26a652[_0x1a4208(0xe2)]);break;case _0x1a4208(0x11d):_0x28c8ca=await _0x5b85c5[_0x26a652['handle']](_0x2a77f1,_0x26a652['id'],_0x26a652['ctxPassThrough']);break;case _0x1a4208(0x19c):_0x28c8ca=await _0x5b85c5[_0x26a652[_0x1a4208(0x145)]](_0x2a77f1,_0x26a652['id'],_0x26a652[_0x1a4208(0xf2)],_0x26a652['ctxPassThrough']);break;case _0x1a4208(0x1ce):_0x28c8ca=await _0x5b85c5[_0x26a652[_0x1a4208(0x145)]](_0x2a77f1,_0x26a652['id'],_0x26a652[_0x1a4208(0xf2)],_0x26a652[_0x1a4208(0xe2)]);break;case _0x1a4208(0x15f):const _0x19a9e8={};_0x19a9e8[_0x1a4208(0x116)]=()=>{},_0x19a9e8[_0x1a4208(0x16b)]={},_0x19a9e8[_0x1a4208(0x16b)][_0x1a4208(0x18b)]=_0x2a77f1,_0x19a9e8[_0x1a4208(0x16b)]['id']=_0x26a652['id'],_0x19a9e8[_0x1a4208(0x18d)]={},_0x19a9e8['request'][_0x1a4208(0x136)]=_0x26a652['originalUrl'],_0x19a9e8['request'][_0x1a4208(0xe4)]=_0x26a652['obj'],_0x19a9e8[_0x1a4208(0x101)]=_0x26a652['ctxPassThrough'],_0x28c8ca=await _0x5b85c5[_0x26a652[_0x1a4208(0x145)]](_0x19a9e8);break;case _0x1a4208(0x131):_0x28c8ca=await _0x5b85c5[_0x26a652[_0x1a4208(0x145)]](_0x2a77f1,_0x26a652[_0x1a4208(0xf2)],_0x26a652[_0x1a4208(0xe2)]);break;case _0x1a4208(0x1ba):_0x28c8ca=await _0x5b85c5[_0x26a652['handle']](_0x2a77f1,_0x26a652['id'],_0x26a652[_0x1a4208(0xf2)],_0x26a652['ctxPassThrough']);break;case _0x1a4208(0x11f):_0x28c8ca=await _0x5b85c5[_0x26a652['handle']](_0x2a77f1,_0x26a652['id'],_0x26a652[_0x1a4208(0xf2)],_0x26a652[_0x1a4208(0xe2)]);break;case _0x1a4208(0x149):_0x28c8ca=await _0x5b85c5[_0x26a652[_0x1a4208(0x145)]](_0x2a77f1,_0x26a652['id'],_0x26a652[_0x1a4208(0x119)],_0x26a652[_0x1a4208(0xf2)],_0x26a652[_0x1a4208(0xe2)]);break;case _0x1a4208(0x12a):_0x28c8ca=await _0x5b85c5[_0x26a652[_0x1a4208(0x145)]](_0x2a77f1,_0x26a652['id'],_0x26a652[_0x1a4208(0xe2)]);break;default:_0x2c2c31=_0x1a4208(0x129)+_0x26a652[_0x1a4208(0x145)]+_0x1a4208(0x156),_0x5b85c5['logger'][_0x1a4208(0x16a)](_0x5b85c5[_0x1a4208(0x118)]+'['+_0x5b85c5[_0x1a4208(0xe9)]+_0x1a4208(0x107)+_0x2a77f1+']['+_0x2ab88f+']\x20'+_0x2c2c31);throw new Error(_0x2c2c31);}if(!_0x28c8ca)_0x28c8ca=null;const _0x30cdc9=JSON['stringify'](_0x28c8ca);_0x589cd6[_0x1a4208(0xec)](_0x30cdc9),_0x5b85c5[_0x1a4208(0x19f)][_0x1a4208(0xe6)](_0x31a02c+_0x1a4208(0x14b)+_0x26a652['handle']+_0x1a4208(0x164)+(_0x26a652[_0x1a4208(0xf2)]?JSON[_0x1a4208(0x158)](_0x26a652[_0x1a4208(0xf2)]):'')+_0x1a4208(0x184)+(_0x26a652['id']?_0x26a652['id']:'')+',\x20attributes='+(_0x26a652[_0x1a4208(0x15e)]?_0x26a652[_0x1a4208(0x15e)]:'')+'\x20message\x20response:\x20'+_0x30cdc9+_0x5270e2);}catch(_0x285fff){const _0x41ed35=_0x1a4208(0x1a8)+_0x285fff['message']+_0x1a4208(0x175)+_0x285fff[_0x1a4208(0xf7)]+'\x22}';_0x589cd6['respond'](_0x41ed35),_0x5b85c5['logger'][_0x1a4208(0xe6)]((_0x31a02c||'')+_0x1a4208(0x14b)+_0x26a652[_0x1a4208(0x145)]+',\x20obj='+(_0x26a652[_0x1a4208(0xf2)]?JSON[_0x1a4208(0x158)](_0x26a652[_0x1a4208(0xf2)]):'')+_0x1a4208(0x184)+(_0x26a652['id']?_0x26a652['id']:'')+',\x20attributes='+(_0x26a652['attributes']?_0x26a652[_0x1a4208(0x15e)]:'')+_0x1a4208(0x1a1)+_0x41ed35+_0x5270e2);}}};if(_0x103154)_0x2217c2();else _0xcf4135();},_0x705127=async(_0x3cfac7,_0x152a4d)=>{const _0x454677=_0x3db26f,_0x2fbf10=_0x376b9f[_0x3cfac7][_0x454677(0x110)]?.['nats']?.[_0x454677(0xdd)];let _0x3bfb0d=0x0;for await(const _0x48b079 of _0x152a4d['status']()){switch(_0x48b079[_0x454677(0xd1)]){case nats['Events'][_0x454677(0x1b4)]:_0x5b85c5['logger'][_0x454677(0x16a)](_0x5b85c5[_0x454677(0x118)]+'['+_0x5b85c5[_0x454677(0xe9)]+_0x454677(0x107)+_0x3cfac7+']['+_0x2fbf10+_0x454677(0x1d0)+_0x48b079['data']+_0x454677(0x10d)),_0x3bfb0d=0x0;break;case nats[_0x454677(0x179)][_0x454677(0x167)]:_0x5b85c5[_0x454677(0x19f)][_0x454677(0xe6)](_0x5b85c5['gwName']+'['+_0x5b85c5[_0x454677(0xe9)]+_0x454677(0x107)+_0x3cfac7+']['+_0x2fbf10+_0x454677(0x178)+_0x48b079['data']);break;case nats[_0x454677(0x179)]['Error']:_0x5b85c5['logger'][_0x454677(0x16a)](_0x5b85c5['gwName']+'['+_0x5b85c5['pluginName']+_0x454677(0x107)+_0x3cfac7+']['+_0x2fbf10+_0x454677(0x128)+_0x48b079[_0x454677(0x103)]);break;case nats['DebugEvents'][_0x454677(0x11a)]:_0x3bfb0d+=0x1;_0x3bfb0d%0x1e===0x0&&_0x5b85c5['logger'][_0x454677(0xe8)](_0x5b85c5['gwName']+'['+_0x5b85c5['pluginName']+']\x20subscriber['+_0x3cfac7+']['+_0x2fbf10+_0x454677(0x122)+_0x48b079[_0x454677(0x103)]+_0x454677(0xf6)+_0x3bfb0d+')');break;case nats['DebugEvents'][_0x454677(0x138)]:_0x5b85c5[_0x454677(0x19f)][_0x454677(0xe8)](_0x5b85c5['gwName']+'['+_0x5b85c5[_0x454677(0xe9)]+_0x454677(0x107)+_0x3cfac7+']['+_0x2fbf10+_0x454677(0x196)+_0x48b079[_0x454677(0x103)]);break;}}};process['on'](_0x3db26f(0x1c3),async()=>{const _0xd75158=_0x3db26f;for(const _0x233d23 in _0x376b9f){_0x376b9f[_0x233d23]['nc']&&!_0x376b9f[_0x233d23]['nc'][_0xd75158(0xcf)]()&&await _0x376b9f[_0x233d23]['nc'][_0xd75158(0x1b0)]();}}),process['on'](_0x3db26f(0x133),async()=>{const _0xe8d76c=_0x3db26f;for(const _0x2faad1 in _0x376b9f){_0x376b9f[_0x2faad1]['nc']&&!_0x376b9f[_0x2faad1]['nc'][_0xe8d76c(0xcf)]()&&await _0x376b9f[_0x2faad1]['nc']['drain']();}});const _0x2c9991=async(_0x50a019,_0x288db8,_0x3ea9fe)=>{const _0x2fb830=_0x3db26f,_0x52a9d6={'attribute':_0x288db8,'operator':'eq','value':_0x3ea9fe,'rawFilter':undefined,'startIndex':undefined,'count':undefined},_0x3d80e7=[_0x288db8];if(_0x288db8!=='id')_0x3d80e7['push']('id');try{const _0x16edee=await _0x5b85c5[_0x2fb830(0xd9)](_0x50a019,_0x52a9d6,_0x3d80e7);if(!_0x16edee||!_0x16edee['Resources']||!Array['isArray'](_0x16edee[_0x2fb830(0x1a5)]))throw new Error(_0x2fb830(0x109)+JSON['stringify'](_0x52a9d6)+_0x2fb830(0x15c));if(_0x16edee[_0x2fb830(0x1a5)]['length']===0x0)return null;else{if(_0x16edee['Resources'][_0x2fb830(0x1a4)]>0x2)throw new Error('getUsers()\x20getObj='+JSON[_0x2fb830(0x158)](_0x52a9d6)+'\x20error:\x20more\x20than\x20one\x20user\x20were\x20found}');else{const _0x56a9fe=_0x16edee[_0x2fb830(0x1a5)][0x0];if(!_0x56a9fe['id'])throw new Error(_0x2fb830(0x109)+JSON[_0x2fb830(0x158)](_0x52a9d6)+_0x2fb830(0x126)+JSON[_0x2fb830(0x158)](_0x56a9fe)+_0x2fb830(0x1c1));return decodeURIComponent(_0x56a9fe['id']);}}}catch(_0x530f9a){throw new Error(_0x2fb830(0x109)+JSON[_0x2fb830(0x158)](_0x52a9d6)+_0x2fb830(0x157)+_0x530f9a[_0x2fb830(0xd8)]+'}');}},_0xa13361=_0x1a0753=>{const _0x3210b5=_0x3db26f;if(!_0x1a0753||typeof _0x1a0753!==_0x3210b5(0x17e))return[null,null];_0x1a0753=_0x1a0753[_0x3210b5(0x1a3)]();const _0x567c72=_0x1a0753['indexOf']('(');if(_0x567c72<0x1)return[null,null];if(_0x1a0753[_0x3210b5(0x162)](_0x1a0753['length']-0x1)!==')')return[null,null];if(_0x832160(_0x1a0753,'(')!==_0x832160(_0x1a0753,')'))return[null,null];const _0x4bc13a=_0x1a0753[_0x3210b5(0x162)](0x0,_0x567c72),_0x583bc0=_0x1a0753[_0x3210b5(0x162)](_0x567c72+0x1,_0x1a0753['length']-0x1);let _0xc5a7a3=[];const _0x75d599=_0x583bc0[_0x3210b5(0xf1)](',');let _0x45c6b2='';for(let _0x38d2fd=0x0;_0x38d2fd<_0x75d599['length'];_0x38d2fd++){const _0x912608=_0x45c6b2?_0x45c6b2+','+_0x75d599[_0x38d2fd]:_0x75d599[_0x38d2fd],_0x2195e7=_0x832160(_0x912608,'('),_0x2f0d27=_0x832160(_0x912608,')');if(_0x2195e7===_0x2f0d27)_0xc5a7a3[_0x3210b5(0x132)](_0x51ad44(_0x912608,'\x22')),_0x45c6b2='';else{if(_0x45c6b2)_0x45c6b2+=','+_0x75d599[_0x38d2fd];else _0x45c6b2+=_0x75d599[_0x38d2fd];}}if(_0xc5a7a3[_0x3210b5(0x1a4)]===0x0)_0xc5a7a3=null;return[_0x4bc13a,_0xc5a7a3];};function _0x832160(_0xee7d67,_0x22063e){let _0xa2b70e=0x0;for(let _0x5daece=0x0;_0x5daece<_0xee7d67['length'];_0x5daece++){_0xee7d67['charAt'](_0x5daece)===_0x22063e&&(_0xa2b70e+=0x1);}return _0xa2b70e;}const _0x51ad44=(_0x14af62,_0x336308)=>{const _0x117172=_0x3db26f;if(typeof _0x14af62!==_0x117172(0x17e)||typeof _0x336308!==_0x117172(0x17e))return _0x14af62;if(_0x14af62[_0x117172(0x1a4)]===0x1)return _0x14af62;if(_0x336308[_0x117172(0x1a4)]!==0x1)return _0x14af62;return _0x14af62=_0x14af62['trim'](),_0x14af62[_0x117172(0x162)](0x0,0x1)===_0x336308&&(_0x14af62=_0x14af62['substring'](0x1)),_0x14af62[_0x117172(0x162)](_0x14af62['length']-0x1)===_0x336308&&(_0x14af62=_0x14af62[_0x117172(0x162)](0x0,_0x14af62[_0x117172(0x1a4)]-0x1)),_0x14af62;},_0x576317=async(_0x53b326,_0x2c78b5,_0x4c6278,_0x25a35e)=>{const _0x3b97e1=_0x3db26f;if(!_0x2c78b5||!_0x4c6278||!_0x25a35e)return null;const [_0x4e5eaf,_0x5b2fb9]=_0xa13361(_0x25a35e);if(!_0x4e5eaf||!_0x5b2fb9){const _0x2d73d6=_0x25a35e[_0x3b97e1(0xf1)]('(');if(_0x2d73d6[_0x3b97e1(0x1a4)]>0x1){const _0x34e9b7=[_0x3b97e1(0x135),_0x3b97e1(0x169),_0x3b97e1(0x124),_0x3b97e1(0x10e),'join',_0x3b97e1(0xde),_0x3b97e1(0x154),_0x3b97e1(0xd7),_0x3b97e1(0x1c8)],_0x90e03c=_0x2d73d6[0x0]['toLowerCase']();if(_0x34e9b7['includes'](_0x90e03c))return null;}return _0x25a35e;}for(let _0x166e90=0x0;_0x166e90<_0x5b2fb9[_0x3b97e1(0x1a4)];_0x166e90++){if(_0x5b2fb9[_0x166e90][_0x3b97e1(0x162)](0x0,0x1)==='['){const _0xebfade=_0x5b2fb9[_0x166e90]['indexOf'](']');if(_0xebfade<0x0)return null;const _0x27b333=_0x5b2fb9[_0x166e90][_0x3b97e1(0x162)](0x1,_0xebfade),_0x344a1c=_0x27b333['split']('.');let _0xff8622;for(let _0x200da8=0x0;_0x200da8<_0x344a1c['length'];_0x200da8++){if(_0x200da8===0x0)_0xff8622=_0x2c78b5[_0x344a1c[_0x200da8]];else{if(!_0xff8622)return null;_0xff8622=_0xff8622[_0x344a1c[_0x200da8]];}}if(!_0xff8622)return null;_0x5b2fb9[_0x166e90]=_0xff8622;}}for(let _0x39dd21=0x0;_0x39dd21<_0x5b2fb9['length'];_0x39dd21++){const [_0xb77a69]=_0xa13361(_0x5b2fb9[_0x39dd21]);_0xb77a69&&(_0x5b2fb9[_0x39dd21]=await _0x576317(_0x53b326,_0x2c78b5,_0x4c6278,_0x5b2fb9[_0x39dd21]));}if(_0x5b2fb9[0x0]===null)return null;switch(_0x4e5eaf[_0x3b97e1(0xf3)]()){case _0x3b97e1(0x135):{if(_0x5b2fb9[_0x3b97e1(0x1a4)]!==0x1)return null;const [_0x555c3b]=_0xa13361(_0x5b2fb9[0x0]);if(_0x555c3b)_0x5b2fb9[0x0]=await _0x576317(_0x53b326,_0x2c78b5,_0x4c6278,_0x555c3b);if(_0x5b2fb9[0x0]===null)return null;return _0x5b2fb9[0x0][_0x3b97e1(0xf3)]();}case _0x3b97e1(0x169):{if(_0x5b2fb9[_0x3b97e1(0x1a4)]!==0x1)return null;const [_0x13ebbd]=_0xa13361(_0x5b2fb9[0x0]);if(_0x13ebbd)_0x5b2fb9[0x0]=await _0x576317(_0x53b326,_0x2c78b5,_0x4c6278,_0x13ebbd);if(_0x5b2fb9[0x0]===null)return null;return _0x5b2fb9[0x0][_0x3b97e1(0x1a7)]();}case _0x3b97e1(0x124):{if(_0x5b2fb9[_0x3b97e1(0x1a4)]!==0x2)return null;const [_0x5a73f2]=_0xa13361(_0x5b2fb9[0x0]);if(_0x5a73f2)_0x5b2fb9[0x0]=await _0x576317(_0x53b326,_0x2c78b5,_0x4c6278,_0x5a73f2);if(_0x5b2fb9[0x0]===null)return null;if(isNaN(_0x5b2fb9[0x1]))return null;return _0x5b2fb9[0x0]['substring'](0x0,_0x5b2fb9[0x1]);}case _0x3b97e1(0x10e):{const [_0x2f6dab]=_0xa13361(_0x5b2fb9[0x0]);if(_0x5b2fb9[_0x3b97e1(0x1a4)]<0x2)return null;if(_0x2f6dab)_0x5b2fb9[0x0]=await _0x576317(_0x53b326,_0x2c78b5,_0x4c6278,_0x2f6dab);if(_0x5b2fb9[0x0]===null)return null;const _0x57ed34=_0x5b2fb9[0x1];if(isNaN(_0x57ed34))return null;let _0x4b4324;if(_0x5b2fb9['length']===0x3)_0x4b4324=_0x5b2fb9[0x0][_0x3b97e1(0xf1)](_0x5b2fb9[0x2]);else _0x4b4324=_0x4b4324=_0x5b2fb9[0x0][_0x3b97e1(0xf1)]('\x20');if(_0x57ed34<=_0x4b4324['length'])return _0x4b4324[_0x57ed34-0x1];else return'';}case _0x3b97e1(0xde):{const [_0x348c28]=_0xa13361(_0x5b2fb9[0x0]);if(_0x348c28)_0x5b2fb9[0x0]=await _0x576317(_0x53b326,_0x2c78b5,_0x4c6278,_0x348c28);if(_0x5b2fb9[0x0]===null)return null;if(_0x5b2fb9['length']!==0x3)return null;return _0x5b2fb9[0x0][_0x3b97e1(0x17d)](_0x5b2fb9[0x1],_0x5b2fb9[0x2]);}case _0x3b97e1(0x154):{if(_0x5b2fb9[_0x3b97e1(0x1a4)]!==0x1)return null;const [_0x4f9cb3]=_0xa13361(_0x5b2fb9[0x0]);if(_0x4f9cb3)_0x5b2fb9[0x0]=await _0x576317(_0x53b326,_0x2c78b5,_0x4c6278,_0x4f9cb3);if(_0x5b2fb9[0x0]===null)return null;return ascii127[_0x3b97e1(0x1bf)](_0x5b2fb9[0x0]);}case _0x3b97e1(0xfb):{let _0x176f28='';for(let _0xdb049e=0x0;_0xdb049e<_0x5b2fb9[_0x3b97e1(0x1a4)];_0xdb049e++){const [_0x5b9d73]=_0xa13361(_0x5b2fb9[_0xdb049e]);if(_0x5b9d73)_0x5b2fb9[_0xdb049e]=await _0x576317(_0x53b326,_0x2c78b5,_0x4c6278,_0x5b9d73);if(_0x5b2fb9[_0xdb049e]===null)return null;_0x176f28+=_0x5b2fb9[_0xdb049e];}return _0x176f28;}case _0x3b97e1(0xd7):{if(_0x5b2fb9['length']>0x2)return null;const [_0x490afc]=_0xa13361(_0x5b2fb9[0x0]);if(_0x490afc)_0x5b2fb9[0x0]=await _0x576317(_0x53b326,_0x2c78b5,_0x4c6278,_0x490afc);if(_0x5b2fb9[0x0]===null)return null;const _0xee743d=parseInt(_0x5b2fb9[0x0]);if(isNaN(_0xee743d))return null;let _0x54730a=_0x3b97e1(0x102);_0x54730a+=','+_0x5b2fb9[0x0];if(_0x5b2fb9[_0x3b97e1(0x1a4)]===0x2&&_0x5b2fb9[0x1]['toLowerCase']()==='true')_0x54730a+=_0x3b97e1(0x1aa);else _0x54730a+=',false';return _0x54730a+='##',_0x54730a;}case _0x3b97e1(0x1c8):{if(_0x5b2fb9[_0x3b97e1(0x1a4)]!==0x1)return null;const [_0x485c88]=_0xa13361(_0x5b2fb9[0x0]);if(_0x485c88)_0x5b2fb9[0x0]=await _0x576317(_0x53b326,_0x2c78b5,_0x4c6278,_0x485c88);if(_0x5b2fb9[0x0]===null)return null;let _0x3b2ebc,_0x50f4ed=![],_0x5df141='';const _0x632737=_0x5b2fb9[0x0]['split']('##');if(_0x632737['length']>0x2)for(let _0x522f51=0x0;_0x522f51<_0x632737[_0x3b97e1(0x1a4)];_0x522f51++){if(_0x632737[_0x522f51]['startsWith']('doIncrement')){const _0x39bc85=_0x632737[_0x522f51][_0x3b97e1(0xf1)](',');if(_0x39bc85[_0x3b97e1(0x1a4)]<0x2)return null;const _0x27d6b2=parseInt(_0x39bc85[0x1]);if(isNaN(_0x27d6b2))return null;_0x5df141='##'+_0x632737[_0x522f51]+'##',_0x3b2ebc=_0x39bc85[0x1],_0x39bc85[_0x3b97e1(0x1a4)]>0x2&&(_0x50f4ed=_0x39bc85[0x2][_0x3b97e1(0xf3)]()==='true');}}let _0x3cd424,_0x44768d=0x0,_0x2712f9=0x0;if(_0x3b2ebc){_0x2712f9=_0x3b2ebc['length'],_0x44768d=0xa;for(let _0x118642=0x1;_0x118642<_0x2712f9;_0x118642++){_0x44768d*=0xa;}_0x44768d-=0x1,_0x3cd424=parseInt(_0x3b2ebc);if(isNaN(_0x3cd424))return null;_0x3cd424-=0x1;}else _0x3cd424=0x0;do{_0x3cd424+=0x1;let _0x173299=_0x5b2fb9[0x0];if(_0x3b2ebc!==undefined&&_0x5df141){let _0x4a0601=_0x3cd424[_0x3b97e1(0x12f)]();while(_0x4a0601['length']<_0x2712f9){_0x4a0601='0'+_0x4a0601;}_0x50f4ed?_0x173299=_0x173299[_0x3b97e1(0xde)](_0x5df141,_0x4a0601):(_0x173299=_0x173299['replace'](_0x5df141,''),_0x50f4ed=!![],_0x3cd424-=0x1);}try{const _0x308c56=await _0x2c9991(_0x53b326,_0x4c6278,_0x173299);if(!_0x308c56)return _0x173299;}catch(_0x2df5d4){return _0x5b85c5[_0x3b97e1(0x19f)][_0x3b97e1(0x16a)](_0x5b85c5['gwName']+'['+_0x5b85c5[_0x3b97e1(0xe9)]+']\x20'+_0x4e5eaf+'\x20getUserId()\x20error:\x20'+_0x2df5d4[_0x3b97e1(0xd8)]),null;}}while(_0x3cd424<_0x44768d);return null;}default:}return null;},_0x38befb=async(_0x448519,_0x2bb3a9)=>{const _0x262772=_0x3db26f;for(const _0x7156f3 in _0x2bb3a9){const _0x3ceb57=_0x2bb3a9[_0x7156f3],[_0x18e4f9,_0x527a11]=_0xa13361(_0x3ceb57);if(_0x18e4f9){const _0x28c4fd=''+_0x7156f3,_0xbdc027=_0x18e4f9+'('+_0x527a11[_0x262772(0xfb)](',')+')',_0x52f745=await _0x576317(_0x448519,_0x2bb3a9,_0x28c4fd,_0xbdc027);if(_0x52f745===null)delete _0x2bb3a9[_0x7156f3];else _0x2bb3a9[_0x7156f3]=_0x52f745;}for(const _0x428dac in _0x3ceb57){const _0x2173e8=_0x3ceb57[_0x428dac],[_0xb34633,_0x558bd8]=_0xa13361(_0x2173e8);if(_0xb34633){const _0x428d0c=_0x7156f3+'.'+_0x428dac,_0x3cfa59=_0xb34633+'('+_0x558bd8[_0x262772(0xfb)](',')+')',_0x116e90=await _0x576317(_0x448519,_0x2bb3a9,_0x428d0c,_0x3cfa59);if(_0x116e90===null)delete _0x3ceb57[_0x428dac];else _0x3ceb57[_0x428dac]=_0x116e90;}}}return _0x2bb3a9;};},module[a0_0xf49a16(0x1b6)][a0_0xf49a16(0x1c0)]=function(_0x999858){const _0x4f23e9=a0_0xf49a16,_0x59fa9b=_0x999858,_0x1252bc={},_0x147c9a=async(_0x5bc41c,_0x1866b8)=>{const _0x31e25d=a0_0x5a7e,_0x108e70=_0x1252bc[_0x5bc41c][_0x31e25d(0x110)]?.[_0x31e25d(0x153)]?.['subject'];let _0x410bb3=0x0;for await(const _0x506814 of _0x1866b8['status']()){switch(_0x506814[_0x31e25d(0xd1)]){case nats[_0x31e25d(0x179)][_0x31e25d(0x1b4)]:_0x59fa9b['logger'][_0x31e25d(0x16a)](_0x59fa9b['gwName']+'['+_0x59fa9b['pluginName']+_0x31e25d(0x13f)+_0x5bc41c+']['+_0x108e70+']\x20client\x20disconnected\x20'+_0x506814[_0x31e25d(0x103)]+_0x31e25d(0x10d)),_0x410bb3=0x0;break;case nats[_0x31e25d(0x179)][_0x31e25d(0x167)]:_0x59fa9b[_0x31e25d(0x19f)][_0x31e25d(0xe6)](_0x59fa9b[_0x31e25d(0x118)]+'['+_0x59fa9b[_0x31e25d(0xe9)]+_0x31e25d(0x13f)+_0x5bc41c+']['+_0x108e70+_0x31e25d(0x178)+_0x506814['data']);break;case nats[_0x31e25d(0x179)]['Error']:_0x59fa9b[_0x31e25d(0x19f)][_0x31e25d(0x16a)](_0x59fa9b['gwName']+'['+_0x59fa9b[_0x31e25d(0xe9)]+_0x31e25d(0x13f)+_0x5bc41c+']['+_0x108e70+_0x31e25d(0x128)+_0x506814[_0x31e25d(0x103)]);break;case nats[_0x31e25d(0xdf)][_0x31e25d(0x11a)]:_0x410bb3+=0x1;_0x410bb3%0x1e===0x0&&_0x59fa9b[_0x31e25d(0x19f)][_0x31e25d(0xe8)](_0x59fa9b[_0x31e25d(0x118)]+'['+_0x59fa9b['pluginName']+_0x31e25d(0x13f)+_0x5bc41c+']['+_0x108e70+_0x31e25d(0x122)+_0x506814['data']+_0x31e25d(0xf6)+_0x410bb3+')');break;case nats[_0x31e25d(0xdf)][_0x31e25d(0x138)]:_0x59fa9b[_0x31e25d(0x19f)][_0x31e25d(0xe8)](_0x59fa9b[_0x31e25d(0x118)]+'['+_0x59fa9b['pluginName']+']\x20publisher['+_0x5bc41c+']['+_0x108e70+_0x31e25d(0x196)+_0x506814[_0x31e25d(0x103)]);break;}}},_0x5abc6f=async(_0x5f1b0f,_0x303fa1)=>{const _0x5582f8=a0_0x5a7e,_0x73ab95=_0x1252bc[_0x5f1b0f][_0x5582f8(0x110)]?.[_0x5582f8(0x153)]?.[_0x5582f8(0xdd)];let _0x36fe97;try{_0x36fe97=await nats[_0x5582f8(0x127)](_0x303fa1);if(_0x36fe97[_0x5582f8(0xe6)][_0x5582f8(0x148)]!==_0x5582f8(0x155)){_0x36fe97['close']();return;}_0x1252bc[_0x5f1b0f]['nc']=_0x36fe97,_0x147c9a(_0x5f1b0f,_0x36fe97);}catch(_0xf8608e){_0x59fa9b[_0x5582f8(0x19f)][_0x5582f8(0x16a)](_0x59fa9b[_0x5582f8(0x118)]+'['+_0x59fa9b['pluginName']+_0x5582f8(0x13f)+_0x5f1b0f+']['+_0x73ab95+']\x20connect\x20error:\x20'+_0xf8608e[_0x5582f8(0xd8)]+'\x20-\x20will\x20do\x20auto\x20connect\x20when\x20available\x20-\x20however,\x20please\x20verify\x20stream\x20configuration'),_0x303fa1[_0x5582f8(0x183)]=!![];try{_0x36fe97=await nats[_0x5582f8(0x127)](_0x303fa1);if(_0x36fe97[_0x5582f8(0xe6)][_0x5582f8(0x148)]!==_0x5582f8(0x155)){_0x36fe97[_0x5582f8(0x1ab)]();return;}_0x1252bc[_0x5f1b0f]['nc']=_0x36fe97,_0x147c9a(_0x5f1b0f,_0x36fe97);}catch(_0x33d063){_0x59fa9b[_0x5582f8(0x19f)][_0x5582f8(0x16a)](_0x59fa9b[_0x5582f8(0x118)]+'['+_0x59fa9b[_0x5582f8(0xe9)]+_0x5582f8(0x13f)+_0x5f1b0f+']['+_0x73ab95+']\x20connect\x20error:\x20'+_0x33d063[_0x5582f8(0xd8)]);return;}}_0x59fa9b[_0x5582f8(0x19f)][_0x5582f8(0xe8)](_0x59fa9b[_0x5582f8(0x118)]+'['+_0x59fa9b[_0x5582f8(0xe9)]+_0x5582f8(0x13f)+_0x5f1b0f+']['+_0x73ab95+']\x20connected\x20'+(_0x303fa1[_0x5582f8(0xcd)]['ca']?_0x5582f8(0xcd):'')+'\x20'+_0x36fe97['getServer']()),_0x36fe97[_0x5582f8(0x1bc)]()[_0x5582f8(0x16e)](_0x35c80c=>{const _0x289769=_0x5582f8;_0x35c80c&&_0x59fa9b[_0x289769(0x19f)]['error'](_0x59fa9b['gwName']+'['+_0x59fa9b[_0x289769(0xe9)]+_0x289769(0x13f)+_0x5f1b0f+']['+_0x73ab95+']\x20closed\x20with\x20error:\x20'+_0x35c80c[_0x289769(0xd8)]);});};this[_0x4f23e9(0x1b7)]=async(_0x203d4b,_0x14310a)=>{const _0x36c9b5=_0x4f23e9;if(!_0x14310a?.[_0x36c9b5(0x153)]){_0x59fa9b['logger'][_0x36c9b5(0x16a)](_0x59fa9b['gwName']+'['+_0x59fa9b[_0x36c9b5(0xe9)]+_0x36c9b5(0x13f)+_0x203d4b+_0x36c9b5(0xfc));return;}if(!_0x14310a?.[_0x36c9b5(0x153)]?.['tenant']){_0x59fa9b['logger']['error'](_0x59fa9b[_0x36c9b5(0x118)]+'['+_0x59fa9b[_0x36c9b5(0xe9)]+_0x36c9b5(0x13f)+_0x203d4b+_0x36c9b5(0x111));return;}if(!_0x14310a?.['nats']?.[_0x36c9b5(0xdd)]){_0x59fa9b[_0x36c9b5(0x19f)]['error'](_0x59fa9b[_0x36c9b5(0x118)]+'['+_0x59fa9b['pluginName']+_0x36c9b5(0x13f)+_0x203d4b+_0x36c9b5(0x152));return;}if(!_0x14310a?.['nats']?.[_0x36c9b5(0xdd)][_0x36c9b5(0x1c4)](_0x36c9b5(0x12b))){_0x59fa9b[_0x36c9b5(0x19f)]['error'](_0x59fa9b[_0x36c9b5(0x118)]+'['+_0x59fa9b[_0x36c9b5(0xe9)]+']\x20publisher['+_0x203d4b+_0x36c9b5(0x13b));return;}if(!_0x14310a[_0x36c9b5(0xef)]||!Array[_0x36c9b5(0x18f)](_0x14310a[_0x36c9b5(0xef)])||_0x14310a[_0x36c9b5(0xef)][_0x36c9b5(0x1a4)]<0x1){_0x59fa9b['logger'][_0x36c9b5(0x16a)](_0x59fa9b['gwName']+'['+_0x59fa9b[_0x36c9b5(0xe9)]+_0x36c9b5(0x13f)+_0x203d4b+']\x20initialization\x20error:\x20missing\x20configuration\x20stream.baseUrls');return;}if(!_0x14310a?.[_0x36c9b5(0x140)]?.['ca']){_0x59fa9b[_0x36c9b5(0x19f)][_0x36c9b5(0x16a)](_0x59fa9b[_0x36c9b5(0x118)]+'['+_0x59fa9b[_0x36c9b5(0xe9)]+_0x36c9b5(0x13f)+_0x203d4b+_0x36c9b5(0xff));return;}const _0x48b193={};try{let _0x424989=path[_0x36c9b5(0xfb)](_0x59fa9b[_0x36c9b5(0xf9)],_0x36c9b5(0x193),_0x14310a?.[_0x36c9b5(0x140)]?.['ca']||_0x36c9b5(0x1a9));(_0x14310a?.[_0x36c9b5(0x140)]?.['ca']?.['startsWith']('/')||_0x14310a?.['certificate']?.['ca']?.[_0x36c9b5(0x1d1)]('\x5c'))&&(_0x424989=_0x14310a[_0x36c9b5(0x140)]['ca']),_0x48b193['ca']=[fs[_0x36c9b5(0xdc)](_0x424989)],_0x48b193[_0x36c9b5(0x1b5)]=!![];}catch(_0x395586){_0x59fa9b[_0x36c9b5(0x19f)][_0x36c9b5(0x16a)](_0x59fa9b[_0x36c9b5(0x118)]+'['+_0x59fa9b[_0x36c9b5(0xe9)]+_0x36c9b5(0x13f)+_0x203d4b+_0x36c9b5(0xed)+_0x395586['message']);return;}const _0x31215f={},_0x36d251=new TextEncoder()[_0x36c9b5(0xf4)](_0x14310a?.[_0x36c9b5(0x153)]?.[_0x36c9b5(0xe1)]),_0x3e3597=_0x14310a?.['nats']?.[_0x36c9b5(0x1ac)];_0x31215f[_0x36c9b5(0x151)]=nats['jwtAuthenticator'](_0x3e3597,_0x36d251),_0x31215f[_0x36c9b5(0x113)]=_0x14310a['baseUrls'],_0x31215f[_0x36c9b5(0xcd)]=_0x48b193,_0x31215f[_0x36c9b5(0x183)]=![],_0x31215f['reconnect']=!![],_0x31215f[_0x36c9b5(0xce)]=0x3e8*0xa,_0x31215f[_0x36c9b5(0x15a)]=-0x1,_0x31215f['pingInterval']=0x2*0x3c*0x3e8,_0x31215f[_0x36c9b5(0x17b)]=0x5,_0x31215f['debug']=![],_0x1252bc[_0x203d4b]={},_0x1252bc[_0x203d4b][_0x36c9b5(0x110)]=_0x14310a,_0x1252bc[_0x203d4b]['nc']=undefined,_0x5abc6f(_0x203d4b,_0x31215f);};const _0x4572d8=nats[_0x4f23e9(0x13c)]();this[_0x4f23e9(0x17c)]=async _0x25b5a8=>{const _0x450e28=_0x4f23e9;let _0x2dbd4d;try{if(_0x25b5a8['constructor']===Object){_0x2dbd4d=_0x25b5a8[_0x450e28(0x18b)];if(!_0x2dbd4d)_0x25b5a8[_0x450e28(0x18b)]=_0x450e28(0x188);_0x25b5a8=JSON[_0x450e28(0x158)](_0x25b5a8);}else{const _0xb1ea8d=JSON[_0x450e28(0xd6)](_0x25b5a8);_0x2dbd4d=_0xb1ea8d[_0x450e28(0x18b)];}}catch(_0x5d9e83){throw new Error(_0x450e28(0xfa)+_0x2dbd4d+_0x450e28(0x1b2));}if(!_0x1252bc[_0x2dbd4d])throw new Error(_0x450e28(0xfa)+_0x2dbd4d+_0x450e28(0x1b1)+_0x2dbd4d);const _0x1fc317=nats[_0x450e28(0x125)]();_0x1fc317['append']('Msg-Id',crypto['randomUUID']());let _0x3dce0d;try{if(!_0x1252bc[_0x2dbd4d]['nc'])throw new Error(_0x450e28(0x185));_0x3dce0d=await _0x1252bc[_0x2dbd4d]['nc']['request'](_0x1252bc[_0x2dbd4d][_0x450e28(0x110)]?.[_0x450e28(0x153)]?.['subject'],_0x4572d8[_0x450e28(0xf4)](_0x25b5a8),{'headers':_0x1fc317});}catch(_0x497a3d){if(_0x497a3d['message']===_0x450e28(0x141))throw new Error(_0x450e28(0xfa)+_0x2dbd4d+_0x450e28(0x1a2)+_0x1252bc[_0x2dbd4d][_0x450e28(0x110)]?.[_0x450e28(0x153)]?.[_0x450e28(0xdd)]);else throw new Error(_0x450e28(0xfa)+_0x2dbd4d+_0x450e28(0xf0)+_0x497a3d[_0x450e28(0xd8)]);}let _0xa78444;try{_0xa78444=JSON[_0x450e28(0xd6)](_0x3dce0d[_0x450e28(0x17e)]());}catch(_0x1fa3a9){throw new Error(_0x450e28(0xd4)+_0x3dce0d[_0x450e28(0x17e)]());}if(_0xa78444?.[_0x450e28(0x16a)]){const _0x4823d0=new Error(_0x450e28(0x11e)+_0xa78444[_0x450e28(0x16a)]);_0x4823d0[_0x450e28(0xf7)]=_0xa78444['errName'];throw _0x4823d0;}return _0xa78444;},process['on'](_0x4f23e9(0x1c3),async()=>{const _0x171a99=_0x4f23e9;for(const _0xbd72dc in _0x1252bc){_0x1252bc[_0xbd72dc]['nc']&&!_0x1252bc[_0xbd72dc]['nc'][_0x171a99(0xcf)]()&&await _0x1252bc[_0xbd72dc]['nc'][_0x171a99(0x1b0)]();}}),process['on']('SIGINT',async()=>{const _0x31a248=_0x4f23e9;for(const _0x85903b in _0x1252bc){_0x1252bc[_0x85903b]['nc']&&!_0x1252bc[_0x85903b]['nc'][_0x31a248(0xcf)]()&&await _0x1252bc[_0x85903b]['nc'][_0x31a248(0x1b0)]();}});},module[a0_0xf49a16(0x1b6)][a0_0xf49a16(0x114)]=async(_0x185721,_0x2f2697,_0x4d95a4,_0x24a125)=>{const _0x58811e=a0_0xf49a16,_0x4e20ae=_0x58811e(0x114),_0x4844fc=_0x185721;_0x4844fc[_0x58811e(0x19f)]['debug'](_0x4844fc['gwName']+'['+_0x4844fc[_0x58811e(0xe9)]+_0x58811e(0x191)+_0x4e20ae+'\x22');try{if(!fs[_0x58811e(0xd2)](_0x4844fc['configDir']+_0x58811e(0x168)))fs['mkdirSync'](_0x4844fc['configDir']+_0x58811e(0x168));}catch(_0x294eca){}const _0x4ba2a1=path['join'](''+_0x4844fc[_0x58811e(0xf9)],'approles',_0x58811e(0xe7)+_0x4844fc['pluginName']+_0x58811e(0x144)),_0x13b902={};utils[_0x58811e(0x13d)](_0x4ba2a1)&&fs['readFileSync'](_0x4ba2a1,_0x58811e(0xd0))[_0x58811e(0xf1)](/\r?\n/)['forEach'](_0x5f9303=>{const _0x44493e=_0x58811e,_0x3b2e4f=_0x5f9303[_0x44493e(0xf1)]('\x20');_0x3b2e4f[_0x44493e(0x1a4)]===0x2&&(_0x13b902[_0x3b2e4f[0x0]]=_0x3b2e4f[0x1]);});const _0x4055bc=fs['createWriteStream'](_0x4ba2a1,{'flags':'w','encoding':_0x58811e(0xee),'mode':0x1b6,'autoClose':!![]}),_0x1b5414=[],_0x43b49f=await _0x4844fc[_0x58811e(0x16d)](_0x2f2697,{'attribute':undefined,'operator':undefined,'value':undefined},['id','displayName']);return _0x43b49f[_0x58811e(0x1a5)][_0x58811e(0x12e)](_0x841066=>{const _0x423bb7=_0x58811e;if(_0x841066['id']){let _0x4d0156=crypto['randomUUID']();if(_0x13b902[_0x841066['id']])_0x4d0156=_0x13b902[_0x841066['id']];const _0x113945={'allowedMemberTypes':[_0x423bb7(0x14d)],'description':_0x423bb7(0x11b),'displayName':_0x841066[_0x423bb7(0x117)]||_0x841066['id'],'id':_0x4d0156,'isEnabled':!![],'lang':null,'origin':'Application','value':decodeURIComponent(_0x841066['id'])};_0x1b5414[_0x423bb7(0x132)](_0x113945),_0x4055bc[_0x423bb7(0x142)](_0x841066['id']+'\x20'+_0x4d0156+'\x0a');}}),_0x4055bc['close'](),_0x4844fc['logger'][_0x58811e(0xe8)](_0x4844fc[_0x58811e(0x118)]+'['+_0x4844fc[_0x58811e(0xe9)]+_0x58811e(0x121)+_0x4ba2a1),{'Resources':[{'appRoles':_0x1b5414}]};};
|
package/lib/scimgateway.js
CHANGED
|
@@ -546,9 +546,9 @@ const ScimGateway = function () {
|
|
|
546
546
|
}
|
|
547
547
|
}
|
|
548
548
|
if (obj.readOnly === true && method !== 'GET') throw new Error('only allowing readOnly for passThrough according to passThrough configuration readOnly=true')
|
|
549
|
-
ctx.
|
|
550
|
-
ctx.
|
|
551
|
-
ctx.
|
|
549
|
+
ctx.passThrough = {}
|
|
550
|
+
ctx.passThrough.request = {}
|
|
551
|
+
ctx.passThrough.request.header = Object.assign({}, ctx.request.header)
|
|
552
552
|
return true
|
|
553
553
|
}
|
|
554
554
|
|
|
@@ -864,13 +864,13 @@ const ScimGateway = function () {
|
|
|
864
864
|
baseEntity: ctx.params.baseEntity,
|
|
865
865
|
obj: ob,
|
|
866
866
|
attributes: attributes,
|
|
867
|
-
|
|
867
|
+
ctxPassThrough: ctx.passThrough
|
|
868
868
|
}
|
|
869
869
|
logger.debug(`${gwName}[${pluginName}] publishing "${handle.getMethod}" to SCIM Stream and awaiting result`)
|
|
870
870
|
res = await this.publish(streamObj)
|
|
871
871
|
} else {
|
|
872
872
|
logger.debug(`${gwName}[${pluginName}] calling "${handle.getMethod}" and awaiting result`)
|
|
873
|
-
res = await this[handle.getMethod](ctx.params.baseEntity, ob, attributes, ctx.
|
|
873
|
+
res = await this[handle.getMethod](ctx.params.baseEntity, ob, attributes, ctx.passThrough)
|
|
874
874
|
}
|
|
875
875
|
|
|
876
876
|
let scimdata = {
|
|
@@ -910,13 +910,13 @@ const ScimGateway = function () {
|
|
|
910
910
|
baseEntity: ctx.params.baseEntity,
|
|
911
911
|
obj: ob,
|
|
912
912
|
attributes: attributes,
|
|
913
|
-
|
|
913
|
+
ctxPassThrough: ctx.passThrough
|
|
914
914
|
}
|
|
915
915
|
logger.debug(`${gwName}[${pluginName}] publishing "${handler.groups.getMethod}" to SCIM Stream and awaiting result - groups to be included`)
|
|
916
916
|
res = await this.publish(streamObj)
|
|
917
917
|
} else {
|
|
918
918
|
logger.debug(`${gwName}[${pluginName}] calling "${handler.groups.getMethod}" and awaiting result - groups to be included`)
|
|
919
|
-
res = await this[handler.groups.getMethod](ctx.params.baseEntity, ob, attributes, ctx.
|
|
919
|
+
res = await this[handler.groups.getMethod](ctx.params.baseEntity, ob, attributes, ctx.passThrough)
|
|
920
920
|
}
|
|
921
921
|
} catch (err) {} // method may be implemented but throwing error like groups not supported/implemented
|
|
922
922
|
if (res && res.Resources && Array.isArray(res.Resources) && res.Resources.length > 0) {
|
|
@@ -1109,13 +1109,13 @@ const ScimGateway = function () {
|
|
|
1109
1109
|
baseEntity: ctx.params.baseEntity,
|
|
1110
1110
|
obj: ob,
|
|
1111
1111
|
attributes: attributes,
|
|
1112
|
-
|
|
1112
|
+
ctxPassThrough: ctx.passThrough
|
|
1113
1113
|
}
|
|
1114
1114
|
logger.debug(`${gwName}[${pluginName}] publishing "${handle.getMethod}" to SCIM Stream and awaiting result`)
|
|
1115
1115
|
res = await this.publish(streamObj)
|
|
1116
1116
|
} else {
|
|
1117
1117
|
logger.debug(`${gwName}[${pluginName}] calling "${handle.getMethod}" and awaiting result`)
|
|
1118
|
-
res = await this[handle.getMethod](ctx.params.baseEntity, ob, attributes, ctx.
|
|
1118
|
+
res = await this[handle.getMethod](ctx.params.baseEntity, ob, attributes, ctx.passThrough)
|
|
1119
1119
|
}
|
|
1120
1120
|
let scimdata = {
|
|
1121
1121
|
Resources: [],
|
|
@@ -1148,13 +1148,13 @@ const ScimGateway = function () {
|
|
|
1148
1148
|
baseEntity: ctx.params.baseEntity,
|
|
1149
1149
|
obj: ob,
|
|
1150
1150
|
attributes: attributes,
|
|
1151
|
-
|
|
1151
|
+
ctxPassThrough: ctx.passThrough
|
|
1152
1152
|
}
|
|
1153
1153
|
logger.debug(`${gwName}[${pluginName}] publishing "${handler.groups.getMethod}" to SCIM Stream and awaiting result - groups to be included`)
|
|
1154
1154
|
res = await this.publish(streamObj)
|
|
1155
1155
|
} else {
|
|
1156
1156
|
logger.debug(`${gwName}[${pluginName}] calling "${handler.groups.getMethod}" and awaiting result - groups to be included`)
|
|
1157
|
-
res = await this[handler.groups.getMethod](ctx.params.baseEntity, ob, attributes, ctx.
|
|
1157
|
+
res = await this[handler.groups.getMethod](ctx.params.baseEntity, ob, attributes, ctx.passThrough) // await scimgateway.getUserGroups(baseEntity, userObj.id, 'members.value,displayName')
|
|
1158
1158
|
}
|
|
1159
1159
|
} catch (err) {} // method may be implemented but throwing error like groups not supported/implemented
|
|
1160
1160
|
if (res && res.Resources && Array.isArray(res.Resources) && res.Resources.length > 0) {
|
|
@@ -1251,6 +1251,7 @@ const ScimGateway = function () {
|
|
|
1251
1251
|
return
|
|
1252
1252
|
}
|
|
1253
1253
|
delete jsonBody.id // in case included in request
|
|
1254
|
+
const addGrps = []
|
|
1254
1255
|
try {
|
|
1255
1256
|
let res
|
|
1256
1257
|
if (config.stream.publisher.enabled) {
|
|
@@ -1258,18 +1259,27 @@ const ScimGateway = function () {
|
|
|
1258
1259
|
handle: handle.createMethod,
|
|
1259
1260
|
baseEntity: ctx.params.baseEntity,
|
|
1260
1261
|
obj: scimdata,
|
|
1261
|
-
|
|
1262
|
+
ctxPassThrough: ctx.passThrough
|
|
1262
1263
|
}
|
|
1263
1264
|
logger.debug(`${gwName}[${pluginName}] publishing "${handle.createMethod}" to SCIM Stream and awaiting result`)
|
|
1264
1265
|
res = await this.publish(streamObj)
|
|
1265
1266
|
} else {
|
|
1267
|
+
if (scimdata.groups && Array.isArray(scimdata.groups) && handle.createMethod === 'createUser') {
|
|
1268
|
+
if (!config.scim.groupMemberOfUser) {
|
|
1269
|
+
for (let i = 0; i < scimdata.groups.length; i++) {
|
|
1270
|
+
if (!scimdata.groups[i].value) continue
|
|
1271
|
+
addGrps.push(decodeURIComponent(scimdata.groups[i].value))
|
|
1272
|
+
}
|
|
1273
|
+
delete scimdata.groups
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1266
1276
|
logger.debug(`${gwName}[${pluginName}] calling "${handle.createMethod}" and awaiting result`)
|
|
1267
|
-
res = await this[handle.createMethod](ctx.params.baseEntity, scimdata, ctx.
|
|
1277
|
+
res = await this[handle.createMethod](ctx.params.baseEntity, scimdata, ctx.passThrough)
|
|
1268
1278
|
}
|
|
1269
1279
|
for (const key in res) { // merge any result e.g: {'id': 'xxxx'}
|
|
1270
1280
|
jsonBody[key] = res[key]
|
|
1271
1281
|
}
|
|
1272
|
-
|
|
1282
|
+
|
|
1273
1283
|
if (!jsonBody.id) { // retrieve all attributes including id
|
|
1274
1284
|
let res
|
|
1275
1285
|
try {
|
|
@@ -1284,11 +1294,11 @@ const ScimGateway = function () {
|
|
|
1284
1294
|
baseEntity: ctx.params.baseEntity,
|
|
1285
1295
|
obj: ob,
|
|
1286
1296
|
attributes: attributes,
|
|
1287
|
-
|
|
1297
|
+
ctxPassThrough: ctx.passThrough
|
|
1288
1298
|
}
|
|
1289
1299
|
res = await this.publish(streamObj)
|
|
1290
1300
|
} else {
|
|
1291
|
-
res = await this[handle.getMethod](ctx.params.baseEntity, ob, attributes, ctx.
|
|
1301
|
+
res = await this[handle.getMethod](ctx.params.baseEntity, ob, attributes, ctx.passThrough)
|
|
1292
1302
|
}
|
|
1293
1303
|
} else if (handle.createMethod === 'createGroup') {
|
|
1294
1304
|
let ob = {}
|
|
@@ -1301,11 +1311,11 @@ const ScimGateway = function () {
|
|
|
1301
1311
|
baseEntity: ctx.params.baseEntity,
|
|
1302
1312
|
obj: ob,
|
|
1303
1313
|
attributes: attributes,
|
|
1304
|
-
|
|
1314
|
+
ctxPassThrough: ctx.passThrough
|
|
1305
1315
|
}
|
|
1306
1316
|
res = await this.publish(streamObj)
|
|
1307
1317
|
} else {
|
|
1308
|
-
res = await this[handle.getMethod](ctx.params.baseEntity, ob, attributes, ctx.
|
|
1318
|
+
res = await this[handle.getMethod](ctx.params.baseEntity, ob, attributes, ctx.passThrough)
|
|
1309
1319
|
}
|
|
1310
1320
|
}
|
|
1311
1321
|
} catch (err) { }
|
|
@@ -1316,6 +1326,33 @@ const ScimGateway = function () {
|
|
|
1316
1326
|
if (obj && obj.id) jsonBody = obj // id found, using returned object
|
|
1317
1327
|
}
|
|
1318
1328
|
|
|
1329
|
+
if (addGrps.length > 0 && handle.createMethod === 'createUser') { // add group membership
|
|
1330
|
+
const addGroups = async (groupId) => {
|
|
1331
|
+
if (config.stream.publisher.enabled) {
|
|
1332
|
+
const streamObj = {
|
|
1333
|
+
handle: handler.groups.modifyMethod,
|
|
1334
|
+
baseEntity: ctx.params.baseEntity,
|
|
1335
|
+
id: groupId,
|
|
1336
|
+
obj: { members: [{ value: jsonBody.id }] },
|
|
1337
|
+
ctxPassThrough: ctx.passThrough
|
|
1338
|
+
}
|
|
1339
|
+
return await this.publish(streamObj)
|
|
1340
|
+
} else {
|
|
1341
|
+
return await this[handler.groups.modifyMethod](ctx.params.baseEntity, groupId, { members: [{ value: jsonBody.id }] }, ctx.passThrough)
|
|
1342
|
+
}
|
|
1343
|
+
}
|
|
1344
|
+
const res = await Promise.allSettled(addGrps.map((groupId) => addGroups(groupId)))
|
|
1345
|
+
const errAdd = res.filter(result => result.status === 'rejected').map(result => result.reason.message)
|
|
1346
|
+
if (errAdd.length > 0) {
|
|
1347
|
+
const errMsg = `user created, but there are group membership errors: ${errAdd.join(', ')}`
|
|
1348
|
+
throw new Error(errMsg)
|
|
1349
|
+
}
|
|
1350
|
+
jsonBody.groups = []
|
|
1351
|
+
addGrps.forEach((el) => {
|
|
1352
|
+
jsonBody.groups.push({ 'value': el, 'type': 'direct' })
|
|
1353
|
+
})
|
|
1354
|
+
}
|
|
1355
|
+
|
|
1319
1356
|
if (!config.scim.skipMetaLocation) {
|
|
1320
1357
|
const location = `${ctx.request.origin}${ctx.path}/${jsonBody.id}`
|
|
1321
1358
|
if (!jsonBody.meta) jsonBody.meta = {}
|
|
@@ -1362,13 +1399,13 @@ const ScimGateway = function () {
|
|
|
1362
1399
|
handle: handle.deleteMethod,
|
|
1363
1400
|
baseEntity: ctx.params.baseEntity,
|
|
1364
1401
|
id: id,
|
|
1365
|
-
|
|
1402
|
+
ctxPassThrough: ctx.passThrough
|
|
1366
1403
|
}
|
|
1367
1404
|
logger.debug(`${gwName}[${pluginName}] publishing "${handle.deleteMethod}" to SCIM Stream and awaiting result`)
|
|
1368
1405
|
await this.publish(streamObj)
|
|
1369
1406
|
} else {
|
|
1370
1407
|
logger.debug(`${gwName}[${pluginName}] calling "${handle.deleteMethod}" and awaiting result`)
|
|
1371
|
-
await this[handle.deleteMethod](ctx.params.baseEntity, id, ctx.
|
|
1408
|
+
await this[handle.deleteMethod](ctx.params.baseEntity, id, ctx.passThrough)
|
|
1372
1409
|
}
|
|
1373
1410
|
ctx.status = 204
|
|
1374
1411
|
} catch (err) {
|
|
@@ -1433,6 +1470,18 @@ const ScimGateway = function () {
|
|
|
1433
1470
|
return
|
|
1434
1471
|
}
|
|
1435
1472
|
delete scimdata.id
|
|
1473
|
+
const groups = []
|
|
1474
|
+
if (scimdata.groups && Array.isArray(scimdata.groups) && handle.modifyMethod === 'modifyUser') {
|
|
1475
|
+
if (!config.scim.groupMemberOfUser) {
|
|
1476
|
+
for (let i = 0; i < scimdata.groups.length; i++) {
|
|
1477
|
+
if (!scimdata.groups[i].value) continue
|
|
1478
|
+
const obj = utils.copyObj(scimdata.groups[i])
|
|
1479
|
+
obj.value = decodeURIComponent(obj.value)
|
|
1480
|
+
groups.push(obj)
|
|
1481
|
+
}
|
|
1482
|
+
delete scimdata.groups
|
|
1483
|
+
}
|
|
1484
|
+
}
|
|
1436
1485
|
try {
|
|
1437
1486
|
if (config.stream.publisher.enabled) {
|
|
1438
1487
|
let streamObj = {
|
|
@@ -1440,23 +1489,17 @@ const ScimGateway = function () {
|
|
|
1440
1489
|
baseEntity: ctx.params.baseEntity,
|
|
1441
1490
|
id: id,
|
|
1442
1491
|
obj: scimdata,
|
|
1443
|
-
|
|
1492
|
+
ctxPassThrough: ctx.passThrough
|
|
1444
1493
|
}
|
|
1445
1494
|
if (Array.isArray(scimdata.members) && scimdata.members.length === 0 && handle.modifyMethod === 'modifyGroup') {
|
|
1446
1495
|
ctx.request.body = scimdata
|
|
1447
1496
|
streamObj = {
|
|
1448
1497
|
handle: 'replaceUsrGrp',
|
|
1449
1498
|
baseEntity: ctx.params.baseEntity,
|
|
1499
|
+
originalUrl: ctx.request.originalUrl,
|
|
1450
1500
|
id: id,
|
|
1451
1501
|
obj: scimdata,
|
|
1452
|
-
|
|
1453
|
-
ctxCopy: ctx.ctxCopy,
|
|
1454
|
-
params: ctx.params,
|
|
1455
|
-
request: {
|
|
1456
|
-
body: ctx.request.body,
|
|
1457
|
-
originalUrl: ctx.request.originalUrl
|
|
1458
|
-
}
|
|
1459
|
-
}
|
|
1502
|
+
ctxPassThrough: ctx.passThrough
|
|
1460
1503
|
}
|
|
1461
1504
|
}
|
|
1462
1505
|
logger.debug(`${gwName}[${pluginName}] publishing "${handle.modifyMethod}" to SCIM Stream and awaiting result`)
|
|
@@ -1467,11 +1510,38 @@ const ScimGateway = function () {
|
|
|
1467
1510
|
await replaceUsrGrp(ctx)
|
|
1468
1511
|
} else {
|
|
1469
1512
|
logger.debug(`${gwName}[${pluginName}] calling "${handle.modifyMethod}" and awaiting result`)
|
|
1470
|
-
await this[handle.modifyMethod](ctx.params.baseEntity, id, scimdata, ctx.
|
|
1513
|
+
await this[handle.modifyMethod](ctx.params.baseEntity, id, scimdata, ctx.passThrough)
|
|
1514
|
+
}
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1517
|
+
if (groups.length > 0 && handle.modifyMethod === 'modifyUser') { // modify user includes groups, add/remove group membership
|
|
1518
|
+
const updateGroup = async (groupsObj) => {
|
|
1519
|
+
const groupId = groupsObj.value
|
|
1520
|
+
const memberObj = { 'value': id }
|
|
1521
|
+
if (groupsObj.operation) memberObj.operation= groupsObj.operation
|
|
1522
|
+
if (config.stream.publisher.enabled) {
|
|
1523
|
+
const streamObj = {
|
|
1524
|
+
handle: handler.groups.modifyMethod,
|
|
1525
|
+
baseEntity: ctx.params.baseEntity,
|
|
1526
|
+
id: groupId,
|
|
1527
|
+
obj: { members: [ memberObj ] },
|
|
1528
|
+
ctxPassThrough: ctx.passThrough
|
|
1529
|
+
}
|
|
1530
|
+
return await this.publish(streamObj)
|
|
1531
|
+
} else {
|
|
1532
|
+
return await this[handler.groups.modifyMethod](ctx.params.baseEntity, groupId, { members: [ memberObj ] }, ctx.passThrough)
|
|
1533
|
+
}
|
|
1534
|
+
}
|
|
1535
|
+
const res = await Promise.allSettled(groups.map((groupsObj) => updateGroup(groupsObj)))
|
|
1536
|
+
const errRes = res.filter(result => result.status === 'rejected').map(result => result.reason.message)
|
|
1537
|
+
if (errRes.length > 0) {
|
|
1538
|
+
const errMsg = `modify user group membership error: ${errRes.join(', ')}`
|
|
1539
|
+
throw new Error(errMsg)
|
|
1471
1540
|
}
|
|
1472
1541
|
}
|
|
1473
1542
|
|
|
1474
1543
|
// include full object in response
|
|
1544
|
+
// TODO: include groups
|
|
1475
1545
|
if (handle.getMethod !== handler.users.getMethod && handle.getMethod !== handler.groups.getMethod && !config.stream.publisher.enabled) { // getUsers or getGroups not implemented
|
|
1476
1546
|
ctx.status = 204
|
|
1477
1547
|
return
|
|
@@ -1485,13 +1555,13 @@ const ScimGateway = function () {
|
|
|
1485
1555
|
baseEntity: ctx.params.baseEntity,
|
|
1486
1556
|
obj: ob,
|
|
1487
1557
|
attributes: attributes,
|
|
1488
|
-
|
|
1558
|
+
ctxPassThrough: ctx.passThrough
|
|
1489
1559
|
}
|
|
1490
1560
|
logger.debug(`${gwName}[${pluginName}] publishing "${handle.getMethod}" to SCIM Stream and awaiting result`)
|
|
1491
1561
|
res = await this.publish(streamObj)
|
|
1492
1562
|
} else {
|
|
1493
1563
|
logger.debug(`${gwName}[${pluginName}] calling "${handle.getMethod}" and awaiting result`)
|
|
1494
|
-
res = await this[handle.getMethod](ctx.params.baseEntity, ob, attributes, ctx.
|
|
1564
|
+
res = await this[handle.getMethod](ctx.params.baseEntity, ob, attributes, ctx.passThrough)
|
|
1495
1565
|
}
|
|
1496
1566
|
|
|
1497
1567
|
scimdata = {
|
|
@@ -1536,7 +1606,7 @@ const ScimGateway = function () {
|
|
|
1536
1606
|
let u = ctx.request.originalUrl.substr(0, ctx.request.originalUrl.lastIndexOf('/'))
|
|
1537
1607
|
u = u.substr(u.lastIndexOf('/') + 1) // u = Users, Groups
|
|
1538
1608
|
const handle = handler[u]
|
|
1539
|
-
const id = ctx.params.id
|
|
1609
|
+
const id = decodeURIComponent(ctx.params.id)
|
|
1540
1610
|
const obj = ctx.request.body
|
|
1541
1611
|
const strObj = JSON.stringify(obj)
|
|
1542
1612
|
if (strObj === '{}' || !handle) {
|
|
@@ -1551,7 +1621,7 @@ const ScimGateway = function () {
|
|
|
1551
1621
|
|
|
1552
1622
|
// get current object
|
|
1553
1623
|
logger.debug(`${gwName}[${pluginName}] calling "${handle.getMethod}" and awaiting result`)
|
|
1554
|
-
const res = await this[handle.getMethod](ctx.params.baseEntity, { attribute: 'id', operator: 'eq', value: id }, [], ctx.
|
|
1624
|
+
const res = await this[handle.getMethod](ctx.params.baseEntity, { attribute: 'id', operator: 'eq', value: id }, [], ctx.passThrough)
|
|
1555
1625
|
let currentObj
|
|
1556
1626
|
if (res && res.Resources && Array.isArray(res.Resources)) {
|
|
1557
1627
|
if (res.Resources.length === 1) currentObj = res.Resources[0]
|
|
@@ -1573,7 +1643,7 @@ const ScimGateway = function () {
|
|
|
1573
1643
|
let objGroups
|
|
1574
1644
|
if (obj.groups) {
|
|
1575
1645
|
objGroups = utils.copyObj(obj.groups)
|
|
1576
|
-
if (!config.scim.usePutGroupMemberOfUser) delete obj.groups
|
|
1646
|
+
if (!config.scim.groupMemberOfUser || !config.scim.usePutGroupMemberOfUser) delete obj.groups // usePutGroupMemberOfUser is legacy
|
|
1577
1647
|
}
|
|
1578
1648
|
|
|
1579
1649
|
// merge obj with currentObj as cleared
|
|
@@ -1594,11 +1664,11 @@ const ScimGateway = function () {
|
|
|
1594
1664
|
// update object
|
|
1595
1665
|
if (Object.keys(scimdata).length > 0) {
|
|
1596
1666
|
logger.debug(`${gwName}[${pluginName}] calling "${handle.modifyMethod}" and awaiting result`)
|
|
1597
|
-
await this[handle.modifyMethod](ctx.params.baseEntity, id, scimdata, ctx.
|
|
1667
|
+
await this[handle.modifyMethod](ctx.params.baseEntity, id, scimdata, ctx.passThrough)
|
|
1598
1668
|
}
|
|
1599
1669
|
|
|
1600
1670
|
// add/remove groups
|
|
1601
|
-
if (!config.scim.usePutGroupMemberOfUser) { // default user member of group
|
|
1671
|
+
if (!config.scim.groupMemberOfUser || !config.scim.usePutGroupMemberOfUser) { // default user member of group, usePutGroupMemberOfUser is legacy
|
|
1602
1672
|
if (objGroups && Array.isArray(objGroups)) { // only if groups included, { "groups": [] } will remove all existing
|
|
1603
1673
|
if (typeof this[handler.groups.getMethod] !== 'function' || typeof this[handler.groups.modifyMethod] !== 'function') {
|
|
1604
1674
|
throw new Error('replaceUser error: put operation can not be fully completed for the user`s groups, methods like getGroups() and modifyGroup() are not implemented')
|
|
@@ -1608,7 +1678,7 @@ const ScimGateway = function () {
|
|
|
1608
1678
|
else { // try to get current groups the standard way
|
|
1609
1679
|
let res
|
|
1610
1680
|
try {
|
|
1611
|
-
res = await this[handler.groups.getMethod](ctx.params.baseEntity, { attribute: 'members.value', operator: 'eq', value: decodeURIComponent(id) }, ['id', 'displayName'], ctx.
|
|
1681
|
+
res = await this[handler.groups.getMethod](ctx.params.baseEntity, { attribute: 'members.value', operator: 'eq', value: decodeURIComponent(id) }, ['id', 'displayName'], ctx.passThrough)
|
|
1612
1682
|
} catch (err) {} // method may be implemented but throwing error like groups not supported/implemented
|
|
1613
1683
|
currentGroups = []
|
|
1614
1684
|
if (res && res.Resources && Array.isArray(res.Resources) && res.Resources.length > 0) {
|
|
@@ -1658,11 +1728,11 @@ const ScimGateway = function () {
|
|
|
1658
1728
|
}
|
|
1659
1729
|
|
|
1660
1730
|
const addGroups = async (grp) => {
|
|
1661
|
-
return await this[handler.groups.modifyMethod](ctx.params.baseEntity, grp, { members: [{ value: id }] }, ctx.
|
|
1731
|
+
return await this[handler.groups.modifyMethod](ctx.params.baseEntity, grp, { members: [{ value: id }] }, ctx.passThrough)
|
|
1662
1732
|
}
|
|
1663
1733
|
|
|
1664
1734
|
const removeGroups = async (grp) => {
|
|
1665
|
-
return await this[handler.groups.modifyMethod](ctx.params.baseEntity, grp, { members: [{ operation: 'delete', value: id }] }, ctx.
|
|
1735
|
+
return await this[handler.groups.modifyMethod](ctx.params.baseEntity, grp, { members: [{ operation: 'delete', value: id }] }, ctx.passThrough)
|
|
1666
1736
|
}
|
|
1667
1737
|
|
|
1668
1738
|
let errRemove = []
|
|
@@ -1692,9 +1762,10 @@ const ScimGateway = function () {
|
|
|
1692
1762
|
const streamObj = {
|
|
1693
1763
|
handle: 'replaceUsrGrp',
|
|
1694
1764
|
baseEntity: ctx.params.baseEntity,
|
|
1765
|
+
originalUrl: originalUrl,
|
|
1695
1766
|
id: ctx.params.id,
|
|
1696
1767
|
obj: ctx.request.body,
|
|
1697
|
-
|
|
1768
|
+
ctxPassThrough: ctx.passThrough
|
|
1698
1769
|
}
|
|
1699
1770
|
logger.debug(`${gwName}[${pluginName}] publishing replaceUsrGrp to SCIM Stream and awaiting result`)
|
|
1700
1771
|
await this.publish(streamObj)
|
|
@@ -1730,13 +1801,13 @@ const ScimGateway = function () {
|
|
|
1730
1801
|
handle: 'postApi',
|
|
1731
1802
|
baseEntity: ctx.params.baseEntity,
|
|
1732
1803
|
obj: apiObj,
|
|
1733
|
-
|
|
1804
|
+
ctxPassThrough: ctx.passThrough
|
|
1734
1805
|
}
|
|
1735
1806
|
logger.debug(`${gwName}[${pluginName}] publishing "postApi" to SCIM Stream and awaiting result`)
|
|
1736
1807
|
result = await this.publish(streamObj)
|
|
1737
1808
|
} else {
|
|
1738
1809
|
logger.debug(`${gwName}[${pluginName}] calling "postApi" and awaiting result`)
|
|
1739
|
-
result = await this.postApi(ctx.params.baseEntity, apiObj, ctx.
|
|
1810
|
+
result = await this.postApi(ctx.params.baseEntity, apiObj, ctx.passThrough)
|
|
1740
1811
|
}
|
|
1741
1812
|
if (result) {
|
|
1742
1813
|
if (typeof result === 'object') result = { result: result }
|
|
@@ -1790,13 +1861,13 @@ const ScimGateway = function () {
|
|
|
1790
1861
|
baseEntity: ctx.params.baseEntity,
|
|
1791
1862
|
id: id,
|
|
1792
1863
|
obj: apiObj,
|
|
1793
|
-
|
|
1864
|
+
ctxPassThrough: ctx.passThrough
|
|
1794
1865
|
}
|
|
1795
1866
|
logger.debug(`${gwName}[${pluginName}] publishing "putApi" to SCIM Stream and awaiting result`)
|
|
1796
1867
|
result = await this.publish(streamObj)
|
|
1797
1868
|
} else {
|
|
1798
1869
|
logger.debug(`${gwName}[${pluginName}] calling "putApi" and awaiting result`)
|
|
1799
|
-
result = await this.putApi(ctx.params.baseEntity, id, apiObj, ctx.
|
|
1870
|
+
result = await this.putApi(ctx.params.baseEntity, id, apiObj, ctx.passThrough)
|
|
1800
1871
|
}
|
|
1801
1872
|
if (result) {
|
|
1802
1873
|
if (typeof result === 'object') result = { result: result }
|
|
@@ -1850,13 +1921,13 @@ const ScimGateway = function () {
|
|
|
1850
1921
|
baseEntity: ctx.params.baseEntity,
|
|
1851
1922
|
id: id,
|
|
1852
1923
|
obj: apiObj,
|
|
1853
|
-
|
|
1924
|
+
ctxPassThrough: ctx.passThrough
|
|
1854
1925
|
}
|
|
1855
1926
|
logger.debug(`${gwName}[${pluginName}] publishing "patchApi" to SCIM Stream and awaiting result`)
|
|
1856
1927
|
result = await this.publish(streamObj)
|
|
1857
1928
|
} else {
|
|
1858
1929
|
logger.debug(`${gwName}[${pluginName}] calling "patchApi" and awaiting result`)
|
|
1859
|
-
result = await this.patchApi(ctx.params.baseEntity, id, apiObj, ctx.
|
|
1930
|
+
result = await this.patchApi(ctx.params.baseEntity, id, apiObj, ctx.passThrough)
|
|
1860
1931
|
}
|
|
1861
1932
|
if (result) {
|
|
1862
1933
|
if (typeof result === 'object') result = { result: result }
|
|
@@ -1908,13 +1979,13 @@ const ScimGateway = function () {
|
|
|
1908
1979
|
id: id,
|
|
1909
1980
|
query: ctx.query,
|
|
1910
1981
|
obj: apiObj,
|
|
1911
|
-
|
|
1982
|
+
ctxPassThrough: ctx.passThrough
|
|
1912
1983
|
}
|
|
1913
1984
|
logger.debug(`${gwName}[${pluginName}] publishing "getApi" to SCIM Stream and awaiting result`)
|
|
1914
1985
|
result = await this.publish(streamObj)
|
|
1915
1986
|
} else {
|
|
1916
1987
|
logger.debug(`${gwName}[${pluginName}] calling "getApi" and awaiting result`)
|
|
1917
|
-
result = await this.getApi(ctx.params.baseEntity, id, ctx.query, apiObj, ctx.
|
|
1988
|
+
result = await this.getApi(ctx.params.baseEntity, id, ctx.query, apiObj, ctx.passThrough)
|
|
1918
1989
|
}
|
|
1919
1990
|
if (result) {
|
|
1920
1991
|
if (typeof result === 'object') result = { result: result }
|
|
@@ -1956,13 +2027,13 @@ const ScimGateway = function () {
|
|
|
1956
2027
|
handle: 'deleteApi',
|
|
1957
2028
|
baseEntity: ctx.params.baseEntity,
|
|
1958
2029
|
id: id,
|
|
1959
|
-
|
|
2030
|
+
ctxPassThrough: ctx.passThrough
|
|
1960
2031
|
}
|
|
1961
2032
|
logger.debug(`${gwName}[${pluginName}] publishing "deleteApi" to SCIM Stream and awaiting result`)
|
|
1962
2033
|
result = await this.publish(streamObj)
|
|
1963
2034
|
} else {
|
|
1964
2035
|
logger.debug(`${gwName}[${pluginName}] calling "deleteApi" and awaiting result`)
|
|
1965
|
-
result = await this.deleteApi(ctx.params.baseEntity, id, ctx.
|
|
2036
|
+
result = await this.deleteApi(ctx.params.baseEntity, id, ctx.passThrough)
|
|
1966
2037
|
}
|
|
1967
2038
|
if (result) {
|
|
1968
2039
|
if (typeof result === 'object') result = { result: result }
|
|
@@ -2543,18 +2614,20 @@ ScimGateway.prototype.endpointMapper = function endpointMapper (direction, parse
|
|
|
2543
2614
|
let arrIndex = null
|
|
2544
2615
|
const arr = key.split('.') // multivalue/array - servicePlan.0.value
|
|
2545
2616
|
const keyOrg = key
|
|
2546
|
-
if (arr[arr.length - 1] === 'value') {
|
|
2547
|
-
|
|
2548
|
-
|
|
2617
|
+
if (arr.length > 1 && arr[arr.length - 1] === 'value') {
|
|
2618
|
+
const secondLast = arr.length - 2
|
|
2619
|
+
if (!isNaN(arr[secondLast])) { // servicePlan.0.value => servicePlan.0
|
|
2620
|
+
for (let i = 0; i < (secondLast); i++) {
|
|
2549
2621
|
if (i === 0) key = arr[i]
|
|
2550
2622
|
else key += `.${arr[i]}`
|
|
2551
2623
|
}
|
|
2552
|
-
arrIndex = arr[
|
|
2553
|
-
} else if (arr[
|
|
2554
|
-
const
|
|
2624
|
+
arrIndex = arr[secondLast]
|
|
2625
|
+
} else if (arr[secondLast].slice(-1) === ']') { // groups[0].value => groups.value
|
|
2626
|
+
const prefix = arr.slice(0, -1).join('.')
|
|
2627
|
+
const startPos = prefix.indexOf('[')
|
|
2555
2628
|
if (startPos > 0) {
|
|
2556
|
-
key =
|
|
2557
|
-
arrIndex =
|
|
2629
|
+
key = prefix.substring(0, startPos) + '.value' // groups.value
|
|
2630
|
+
arrIndex = prefix.substring(startPos + 1, prefix.length - 1) // 1
|
|
2558
2631
|
}
|
|
2559
2632
|
}
|
|
2560
2633
|
}
|
|
@@ -2616,7 +2689,6 @@ ScimGateway.prototype.endpointMapper = function endpointMapper (direction, parse
|
|
|
2616
2689
|
case 'inbound':
|
|
2617
2690
|
for (let key in dotParse) {
|
|
2618
2691
|
if (Array.isArray(dotParse[key]) && dotParse[key].length < 1) continue // avoid including 'value' in empty array if mapTo xx.value
|
|
2619
|
-
|
|
2620
2692
|
if (key.startsWith('lastLogon') && !isNaN(dotParse[key])) { // Active Directory date convert e.g. 132340394347050132 => "2020-05-15 20:03:54"
|
|
2621
2693
|
const ll = new Date(parseInt(dotParse[key], 10) / 10000 - 11644473600000)
|
|
2622
2694
|
dotParse[key] = ll.getFullYear() + '-' +
|
|
@@ -2645,11 +2717,11 @@ ScimGateway.prototype.endpointMapper = function endpointMapper (direction, parse
|
|
|
2645
2717
|
}
|
|
2646
2718
|
|
|
2647
2719
|
let mapTo = dotMap[`${key}.mapTo`]
|
|
2720
|
+
if (!mapTo) continue
|
|
2648
2721
|
if (mapTo.startsWith('urn:')) { // dot workaround for none core (e.g. enterprise and custom schema attributes) having dot in key e.g "2.0": urn:ietf:params:scim:schemas:extension:enterprise:2.0:User.department
|
|
2649
2722
|
mapTo = mapTo.replace('.', '##') // only first occurence
|
|
2650
2723
|
noneCore = true
|
|
2651
2724
|
}
|
|
2652
|
-
if (!mapTo) continue
|
|
2653
2725
|
|
|
2654
2726
|
if (dotMap[`${key}.type`] === 'array') {
|
|
2655
2727
|
let newStr = mapTo
|
package/lib/utils.js
CHANGED
|
@@ -320,17 +320,21 @@ module.exports.extendObjClear = (obj, src, isSoftSync) => {
|
|
|
320
320
|
obj[key].push(v)
|
|
321
321
|
} else {
|
|
322
322
|
const addArr = []
|
|
323
|
+
let found = false
|
|
323
324
|
for (let j = 0; j < obj[key].length; j++) {
|
|
324
325
|
const el = obj[key][j]
|
|
325
326
|
if (el.value === val.value) {
|
|
326
327
|
obj[key].splice(j, 1)
|
|
327
328
|
j -= 1
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
if (!isSoftSync) v.operation = 'delete'
|
|
331
|
-
addArr.push(v)
|
|
329
|
+
found = true
|
|
330
|
+
break
|
|
332
331
|
}
|
|
333
332
|
}
|
|
333
|
+
if (!found) {
|
|
334
|
+
const v = module.exports.copyObj(val)
|
|
335
|
+
if (!isSoftSync) v.operation = 'delete'
|
|
336
|
+
addArr.push(v)
|
|
337
|
+
}
|
|
334
338
|
if (addArr.length > 0) {
|
|
335
339
|
obj[key] = [...obj[key], ...addArr]
|
|
336
340
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scimgateway",
|
|
3
|
-
"version": "4.5.
|
|
3
|
+
"version": "4.5.7",
|
|
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",
|
package/test/lib/plugin-loki.js
CHANGED
|
@@ -467,7 +467,7 @@ describe('plugin-loki tests', () => {
|
|
|
467
467
|
})
|
|
468
468
|
})
|
|
469
469
|
|
|
470
|
-
it('
|
|
470
|
+
it('replaceUser test', (done) => {
|
|
471
471
|
const putUser = {
|
|
472
472
|
name: {
|
|
473
473
|
formatted: 'Mr. Jeff Gilbert-2',
|
|
@@ -571,7 +571,7 @@ describe('plugin-loki tests', () => {
|
|
|
571
571
|
})
|
|
572
572
|
})
|
|
573
573
|
|
|
574
|
-
it('modifyGroupMembers test
|
|
574
|
+
it('modifyGroupMembers test', (done) => {
|
|
575
575
|
server_8880.patch('/Groups/GoGoLoki?attributes=members')
|
|
576
576
|
.set(options.headers)
|
|
577
577
|
// .send({ members: [{ value: 'jsmith' }, { operation: 'delete', value: 'bjensen' }], schemas: ['urn:scim:schemas:core:1.0'] }) // scim v1.1
|
|
@@ -619,6 +619,32 @@ describe('plugin-loki tests', () => {
|
|
|
619
619
|
})
|
|
620
620
|
})
|
|
621
621
|
|
|
622
|
+
|
|
623
|
+
it('replaceGroup test', (done) => {
|
|
624
|
+
const group = {
|
|
625
|
+
displayName: 'NewGoGoLoki',
|
|
626
|
+
externalId: undefined,
|
|
627
|
+
members: [{
|
|
628
|
+
value: 'bjensen'
|
|
629
|
+
},
|
|
630
|
+
{
|
|
631
|
+
value: 'jsmith'
|
|
632
|
+
}]
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
server_8880.put('/Groups/GoGoLoki')
|
|
636
|
+
.set(options.headers)
|
|
637
|
+
.send(group)
|
|
638
|
+
.end(function (err, res) {
|
|
639
|
+
expect(err).to.equal(null)
|
|
640
|
+
expect(group.members.length).to.equal(2)
|
|
641
|
+
expect(group.displayName).to.equal("NewGoGoLoki")
|
|
642
|
+
expect(res.statusCode).to.equal(200)
|
|
643
|
+
expect(res.body.meta.location).to.equal('http://localhost:8880/Groups/GoGoLoki')
|
|
644
|
+
done()
|
|
645
|
+
})
|
|
646
|
+
})
|
|
647
|
+
|
|
622
648
|
it('deleteGroup test', (done) => {
|
|
623
649
|
server_8880.delete('/Groups/GoGoLoki')
|
|
624
650
|
.set(options.headers)
|