scimgateway 4.5.9 → 4.5.11
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 +27 -1
- package/lib/plugin-api.js +1 -1
- package/lib/plugin-ldap.js +21 -5
- package/lib/plugin-loki.js +2 -2
- package/lib/scim-stream.js +2 -1
- package/lib/scimgateway.js +194 -155
- package/lib/utils.js +1 -1
- package/package.json +1 -1
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
|
-
- One Identity/OneLogin
|
|
12
|
+
- One Identity Manager/OneLogin
|
|
13
13
|
- Okta
|
|
14
14
|
- Omada
|
|
15
15
|
- SailPoint/IdentityNow
|
|
@@ -1163,6 +1163,32 @@ MIT © [Jarle Elshaug](https://www.elshaug.xyz)
|
|
|
1163
1163
|
|
|
1164
1164
|
## Change log
|
|
1165
1165
|
|
|
1166
|
+
### v4.5.11
|
|
1167
|
+
|
|
1168
|
+
[Improved]
|
|
1169
|
+
|
|
1170
|
+
- deleteUser will try to revoke user from groups before deleting user
|
|
1171
|
+
- advanced or-filter (e.g., used by One Identity Manager) will be chunked and handled by scimgateway as separate calls to plugin
|
|
1172
|
+
- baseEntity now included in scimgateway log entries like plugin log entries
|
|
1173
|
+
|
|
1174
|
+
[Fixed]
|
|
1175
|
+
|
|
1176
|
+
- plugin-ldap, using OpenLDAP - configuration { "isOpenLdap": true } and adding an already existing group member returned 500 Error instead of 200 OK.
|
|
1177
|
+
- plugin-ldap, using OpenLDAP in combination with endpoint user mapping `"type":"array"` and `"typeInbound":"string"` for handling comma separated SCIM string mapping towards an endpoint array/multivalue attribute, did not return correct sort order of the comma separated string when using OpenLDAP. Mapping example:
|
|
1178
|
+
|
|
1179
|
+
"<endpointAttr>": {
|
|
1180
|
+
"mapTo": "<scimAttr>",
|
|
1181
|
+
"type": "array",
|
|
1182
|
+
"typeInbound": "string"
|
|
1183
|
+
},
|
|
1184
|
+
|
|
1185
|
+
|
|
1186
|
+
### v4.5.10
|
|
1187
|
+
|
|
1188
|
+
[Fixed]
|
|
1189
|
+
|
|
1190
|
+
- PUT changes introduced in v4.5.7 had incorrect check of configuration groupMemberOfUser (default not set)
|
|
1191
|
+
|
|
1166
1192
|
### v4.5.9
|
|
1167
1193
|
|
|
1168
1194
|
[Improved]
|
package/lib/plugin-api.js
CHANGED
|
@@ -57,7 +57,7 @@ scimgateway.authPassThroughAllowed = false // true enables auth passThrough (no
|
|
|
57
57
|
//
|
|
58
58
|
scimgateway.postApi = async (baseEntity, apiObj, ctx) => {
|
|
59
59
|
const action = 'postApi'
|
|
60
|
-
scimgateway.logger.debug(`${pluginName} handling "${action}" apiObj=${JSON.stringify(apiObj)}`)
|
|
60
|
+
scimgateway.logger.debug(`${pluginName}[${baseEntity}] handling "${action}" apiObj=${JSON.stringify(apiObj)}`)
|
|
61
61
|
|
|
62
62
|
if ((typeof (apiObj) !== 'object') || (Object.keys(apiObj).length === 0)) {
|
|
63
63
|
throw new Error('unsupported POST syntax')
|
package/lib/plugin-ldap.js
CHANGED
|
@@ -109,6 +109,7 @@ scimgateway.getUsers = async (baseEntity, getObj, attributes, ctx) => {
|
|
|
109
109
|
//
|
|
110
110
|
const action = 'getUsers'
|
|
111
111
|
scimgateway.logger.debug(`${pluginName}[${baseEntity}] handling "${action}" getObj=${getObj ? JSON.stringify(getObj) : ''} attributes=${attributes}`)
|
|
112
|
+
if (!config.entity[baseEntity]) throw new Error(`unsupported baseEntity: ${baseEntity}`)
|
|
112
113
|
|
|
113
114
|
const result = {
|
|
114
115
|
Resources: [],
|
|
@@ -490,6 +491,7 @@ scimgateway.getGroups = async (baseEntity, getObj, attributes, ctx) => {
|
|
|
490
491
|
//
|
|
491
492
|
const action = 'getGroups'
|
|
492
493
|
scimgateway.logger.debug(`${pluginName}[${baseEntity}] handling "${action}" getObj=${getObj ? JSON.stringify(getObj) : ''} attributes=${attributes}`)
|
|
494
|
+
if (!config.entity[baseEntity]) throw new Error(`unsupported baseEntity: ${baseEntity}`)
|
|
493
495
|
|
|
494
496
|
const result = {
|
|
495
497
|
Resources: [],
|
|
@@ -1290,6 +1292,7 @@ const getServiceClient = async (baseEntity, ctx) => {
|
|
|
1290
1292
|
// }
|
|
1291
1293
|
//
|
|
1292
1294
|
const doRequest = async (baseEntity, method, base, options, ctx) => {
|
|
1295
|
+
if (!config.entity[baseEntity]) throw new Error(`unsupported baseEntity: ${baseEntity}`)
|
|
1293
1296
|
let result = null
|
|
1294
1297
|
let client = null
|
|
1295
1298
|
base = ldapEscDn(config.entity[baseEntity].ldap.isOpenLdap, base)
|
|
@@ -1386,10 +1389,11 @@ const doRequest = async (baseEntity, method, base, options, ctx) => {
|
|
|
1386
1389
|
if (Array.isArray(options.modification[key])) {
|
|
1387
1390
|
mod.values = options.modification[key]
|
|
1388
1391
|
if (mod.values.length > 1) { // delete before replace to keep inbound order
|
|
1389
|
-
|
|
1392
|
+
const multiValueObj = {
|
|
1390
1393
|
operation: 'delete',
|
|
1391
1394
|
modification: { type: key, values: [] }
|
|
1392
|
-
}
|
|
1395
|
+
}
|
|
1396
|
+
client.modify(dn, multiValueObj, () => {})
|
|
1393
1397
|
}
|
|
1394
1398
|
} else {
|
|
1395
1399
|
if (typeof options.modification[key] === 'string') mod.values = [options.modification[key]]
|
|
@@ -1403,8 +1407,9 @@ const doRequest = async (baseEntity, method, base, options, ctx) => {
|
|
|
1403
1407
|
}
|
|
1404
1408
|
client.modify(dn, changes, (err) => {
|
|
1405
1409
|
if (err) {
|
|
1406
|
-
if (options.operation && options.operation === 'add'
|
|
1407
|
-
|
|
1410
|
+
if (options.operation && options.operation === 'add') {
|
|
1411
|
+
const msg = err.message.toLowerCase()
|
|
1412
|
+
if (msg.includes('exists')) return resolve() // "ENTRY_EXISTS" / "Value Exists" - add already existing group to user
|
|
1408
1413
|
}
|
|
1409
1414
|
return reject(err)
|
|
1410
1415
|
}
|
|
@@ -1473,12 +1478,23 @@ if (!config?.map?.user) {
|
|
|
1473
1478
|
scimgateway.logger.error('configuration map.user is missing')
|
|
1474
1479
|
throw new Error(`using exception to exit ${pluginName}, please ignore message...`)
|
|
1475
1480
|
} else {
|
|
1481
|
+
let isOpenLdapFound = false
|
|
1482
|
+
for (const key in config.entity) {
|
|
1483
|
+
if (config.entity[key]?.ldap?.isOpenLdap === true) {
|
|
1484
|
+
isOpenLdapFound = true
|
|
1485
|
+
break
|
|
1486
|
+
}
|
|
1487
|
+
}
|
|
1476
1488
|
let idFound = false
|
|
1477
1489
|
let userNameFound = false
|
|
1478
1490
|
for (const key in config.map.user) {
|
|
1479
1491
|
if (config.map.user[key].mapTo === 'id') idFound = true
|
|
1480
1492
|
else if (['userName', 'externalId'].includes(config.map.user[key].mapTo)) userNameFound = true
|
|
1481
|
-
if (
|
|
1493
|
+
if (config.map.user[key]?.type === 'array' && config.map.user[key]?.typeInbound === 'string') {
|
|
1494
|
+
if (!Object.prototype.hasOwnProperty.call(config.map.user[key], 'typeOutboundReverse')) {
|
|
1495
|
+
config.map.user[key].typeOutboundReverse = !isOpenLdapFound
|
|
1496
|
+
}
|
|
1497
|
+
}
|
|
1482
1498
|
}
|
|
1483
1499
|
if (!idFound || !userNameFound) {
|
|
1484
1500
|
scimgateway.logger.error('configuration map.user missing mapTo definition for mandatory id/userName')
|
package/lib/plugin-loki.js
CHANGED
|
@@ -614,12 +614,12 @@ scimgateway.modifyGroup = async (baseEntity, id, attrObj, ctx) => {
|
|
|
614
614
|
const stripLoki = (obj) => { // remove loki meta data and insert scim
|
|
615
615
|
const retObj = JSON.parse(JSON.stringify(obj)) // new object - don't modify loki source
|
|
616
616
|
if (retObj.meta) {
|
|
617
|
-
if (retObj.meta.created) retObj.meta.created = new Date(retObj.meta.created).toISOString()
|
|
618
617
|
delete retObj.meta.lastModified // test users loaded
|
|
618
|
+
if (retObj.meta.created) retObj.meta.created = new Date(retObj.meta.created).toISOString()
|
|
619
619
|
if (retObj.meta.updated) {
|
|
620
620
|
retObj.meta.lastModified = new Date(retObj.meta.updated).toISOString()
|
|
621
621
|
delete retObj.meta.updated
|
|
622
|
-
}
|
|
622
|
+
} else retObj.meta.lastModified = retObj.meta.created
|
|
623
623
|
if (retObj.meta.revision !== undefined) {
|
|
624
624
|
retObj.meta.version = `W/"${retObj.meta.revision}"`
|
|
625
625
|
delete retObj.meta.revision
|
package/lib/scim-stream.js
CHANGED
|
@@ -10,4 +10,5 @@
|
|
|
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_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}]};};
|
|
13
|
+
// ================================================================
|
|
14
|
+
'use strict';const a0_0x5a0f4d=a0_0xf886;(function(_0x36d8e5,_0x315713){const _0x517080=a0_0xf886,_0x576627=_0x36d8e5();while(!![]){try{const _0x519d96=-parseInt(_0x517080(0x190))/0x1+parseInt(_0x517080(0xf0))/0x2*(parseInt(_0x517080(0x1e0))/0x3)+parseInt(_0x517080(0x188))/0x4*(-parseInt(_0x517080(0xf9))/0x5)+parseInt(_0x517080(0x1ba))/0x6+-parseInt(_0x517080(0x1cd))/0x7+-parseInt(_0x517080(0x19a))/0x8*(parseInt(_0x517080(0x171))/0x9)+parseInt(_0x517080(0x163))/0xa*(parseInt(_0x517080(0xf3))/0xb);if(_0x519d96===_0x315713)break;else _0x576627['push'](_0x576627['shift']());}catch(_0x515151){_0x576627['push'](_0x576627['shift']());}}}(a0_0x2ea7,0x2aa45));function a0_0x2ea7(){const _0x159055=['All','\x20Delete\x20User\x20id=','append','replaceDomains','add','readFileSync',']\x20error:\x20','user','\x20Create\x20userName=','\x20message\x20error\x20response:\x20','Operations','1203918SjEuji','baseEntity','jetstreamManager','userName','usePutSoftSync','server_name','\x22,\x22errName\x22:\x22','undefined','DebugEvents','replace','ConsumerEvents','subscriber\x20message\x20error:\x20message\x20not\x20JSON\x20formatted','call',']\x20closed\x20with\x20error:\x20','passThrough','maxPingOut','drain','normalize','string','1900514reuHHc','startsWith','originalUrl','\x22\x20and\x20awaiting\x20result','apply','ETIMEDOUT','deleteGroup','tenant','handle','subscribe','Disconnect',']\x20client\x20has\x20a\x20stale\x20connection\x20','putApi','{\x22error\x22:\x22','body','ack','_autogenerated.cfg','createWriteStream','Errors','223089afYwXM','exports','delete','active','info','deleteUserOnLastGroupRoleRemoval',']\x20initialization\x20error:\x20missing\x20configuration\x20stream.baseUrls','closed','convertedScim20','attributes','publisher\x20response\x20error:\x20','display','SCIM\x20Stream','\x20message:\x20user\x20not\x20created\x20because\x20of\x20configuration\x20modifyOnly=true','\x20message\x20handled:\x20','path',',true','503','nats','configDir','firstn','authenticator','Resources','elementnumber','map',']\x20initialization\x20error:\x20nats.subject\x20root\x20topic\x20must\x20be\x20\x27GW\x27,\x20nats.subject\x20example:\x20GW.APP1','postApi','split','hasOwnProperty','Events','tls',']\x20client\x20disconnected\x20','publisher\x20not\x20initialized/connected','deliver_policy','subscriber\x20message\x20error:\x20handle\x20\x27','operator',']\x20client\x20error\x20','maxReconnectAttempts','\x20with\x20chunks\x20returned\x20errors:\x20','approles_','utf-8','getServer','\x20message\x20json\x20parsing\x20error:\x20','subject','groups','UnableConnectingService','2vSAeAM','uppercase','respond','2266GcgYVa','query','../lib/utils','\x20error:\x20','\x20calling\x20\x22','certificate','20980oVJCBM','status','secret','true','internal\x20stream\x20policy\x20have\x20been\x20changed\x20-\x20central\x20SCIM\x20Stream\x20must\x20be\x20stopped\x20and\x20corresponding\x20./jetstream\x20folder\x20deleted\x20before\x20startup\x20allowing\x20new\x20policy','\x20not\x20equal\x20subscriber\x20configured\x20baseEntity=','onCreate','\x20handling\x20message:\x20','activityOperation','stringify','createUser','rejected','displayName','skipConvertRolesToGroups','pluginName','Msg-Id','detail','deleteApi','increment','ENOTFOUND',']\x20handling\x20\x22','\x20result=','charAt','error','\x20error:\x20missing\x20result','reconnect','set','request',']\x20subscriber[','getGroups','parse','debug','Application','then','trim','Error','DeliverPolicy','rejectUnauthorized','decode','ctxPassThrough','subscriber\x20message\x20error:\x20message\x20missing\x20handle','ECONNREFUSED','subscriber\x20message\x20error:\x20message\x20baseEntity=','name','value','toString','file-not-configured','existsSync','replaceUsrGrp',',\x20attributes=','close','modifyOnly','fold-to-ascii','\x20-\x20will\x20do\x20auto\x20reconnect\x20when\x20connection\x20becomes\x20available','pingInterval','false',']\x20initialization\x20error:\x20missing\x20configuration\x20nats.subject','length','\x20group\x20removal\x20error:\x20','\x20=>\x20subscriber\x20not\x20activated','baseUrls','params','publish','isArray',']\x20initialization\x20certificate\x20error:\x20',']\x20connect\x20error:\x20','modifyUser','roles','Publisher','\x20processing\x20incoming\x20message','randomUUID','transports','constructor','get','/certs/','\x20message:\x20user\x20does\x20not\x20exist','StaleConnection','replaceAll','\x20convertedScim20\x20error:\x20',']\x20error:\x20client\x20have\x20not\x20been\x20initialized',',\x20obj=','logger','durable_','\x20getUserId()\x20error:\x20','endsWith','HR.','getUsers()\x20getObj=','connect','publisher[','_info','gwName','jwtAuthenticator','SIGINT','\x20-\x20',']\x20initialization\x20error:\x20missing\x20certificate\x20configuration','Reconnecting','forEach','\x20role\x20removal\x20error:\x20','remove','attribute','message','createGroup','crypto','\x20missing\x20mandatory\x20user.userName\x20in\x20message:\x20','config','data','39460yfkXHm','\x20error:\x20more\x20than\x20one\x20user\x20were\x20found}','lowercase',']\x20error:\x20message\x20must\x20be\x20JSON\x20formatted',']\x20error:\x20missing\x20entity\x20configuration\x20for\x20baseEntity=','\x20or\x20','modifyGroup','patchApi','from','publisher\x20error:\x20none\x20JSON\x20formatted\x20response:\x20','getAppRoles','join','push',']\x20client\x20reconnected\x20','9AhXfJs',']\x20subscriber\x20stopped\x20error:\x20','reconnectTimeWait','/Users/',',false','User','reason','typeId','description','\x20Replace\x20User\x20id=','GW.','update','getuniquevalue','mkdirSync',']\x20initialization\x20error:\x20missing\x20configuration\x20nats.tenant','createRandomPassword',',\x20id=','getProcessed','timeout','Subscriber','substring','operation','encode','68tkHkUo','StringCodec','Reconnect','consumers','deleteUser','jetstream','jwt','password','240866rxIDjD','copyObj','\x20message:\x20user\x20not\x20deleted\x20because\x20of\x20configuration\x20modifyOnly=true','servers','generateUserPassword','errName','\x20done','prototype','obj','waitOnFirstConnect','2636248Lydkqp',']\x20initialization\x20error:\x20missing\x20configuration\x20nats','getApi','\x27\x20not\x20supported','SCIM\x20Stream\x20-\x20Autogenerated','isClosed','\x20missing\x20user\x20object\x20in\x20message:\x20','getUsers','filter','rawFilter','\x20(count=','includes','toLowerCase',']\x20publisher[','\x20-\x20will\x20do\x20auto\x20connect\x20when\x20available\x20-\x20however,\x20please\x20verify\x20stream\x20configuration','write',']\x20client\x20is\x20attempting\x20to\x20reconnect\x20','type','approles','headers','##doIncrement'];a0_0x2ea7=function(){return _0x159055;};return a0_0x2ea7();}function a0_0xf886(_0x2718ef,_0x33fc24){const _0x2ea70f=a0_0x2ea7();return a0_0xf886=function(_0xf88642,_0x419fa2){_0xf88642=_0xf88642-0xec;let _0x2b659e=_0x2ea70f[_0xf88642];return _0x2b659e;},a0_0xf886(_0x2718ef,_0x33fc24);}const nats=require('nats'),ascii127=require(a0_0x5a0f4d(0x12d)),fs=require('fs'),utils=require(a0_0x5a0f4d(0xf5)),path=require('path'),crypto=require(a0_0x5a0f4d(0x15f));module[a0_0x5a0f4d(0x1e1)][a0_0x5a0f4d(0x184)]=function(_0x2357df){const _0x4537e7=a0_0x5a0f4d,_0x5bf57b=_0x2357df,_0x40054e={};let _0x3bb6df='';for(let _0x4fde4e=0x0;_0x4fde4e<_0x5bf57b[_0x4537e7(0x14a)][_0x4537e7(0x140)][_0x4537e7(0x132)];_0x4fde4e++){if(_0x5bf57b[_0x4537e7(0x14a)]['transports'][_0x4fde4e][_0x4537e7(0x124)]==='file'){_0x3bb6df=_0x5bf57b[_0x4537e7(0x14a)]['transports'][_0x4fde4e]['level'];break;}}const _0x11f296=''+(_0x3bb6df==='debug'?'\x0a':''),_0x5f3577=async(_0x1fb09c,_0x44ec28)=>{const _0x3f9122=_0x4537e7,_0x250d75=_0x40054e[_0x1fb09c][_0x3f9122(0x161)]?.[_0x3f9122(0x1f2)]?.[_0x3f9122(0xed)];let _0x3292cf;try{_0x3292cf=await nats['connect'](_0x44ec28);if(_0x3292cf[_0x3f9122(0x1e4)][_0x3f9122(0x1bf)]!==_0x3f9122(0x1ec)){_0x3292cf['close']();return;}_0x40054e[_0x1fb09c]['nc']=_0x3292cf,_0x112135(_0x1fb09c,_0x3292cf),_0x51fe46(_0x1fb09c,_0x3292cf);}catch(_0x537c85){_0x5bf57b[_0x3f9122(0x14a)][_0x3f9122(0x110)](_0x5bf57b['gwName']+'['+_0x5bf57b[_0x3f9122(0x107)]+']\x20subscriber['+_0x1fb09c+']['+_0x250d75+_0x3f9122(0x13a)+_0x537c85[_0x3f9122(0x15d)]+_0x3f9122(0x1a8)),_0x44ec28[_0x3f9122(0x199)]=!![];try{_0x3292cf=await nats['connect'](_0x44ec28);if(_0x3292cf['info'][_0x3f9122(0x1bf)]!==_0x3f9122(0x1ec)){_0x3292cf[_0x3f9122(0x12b)]();return;}_0x40054e[_0x1fb09c]['nc']=_0x3292cf,_0x112135(_0x1fb09c,_0x3292cf),_0x51fe46(_0x1fb09c,_0x3292cf);}catch(_0x197d64){_0x5bf57b[_0x3f9122(0x14a)]['error'](_0x5bf57b[_0x3f9122(0x153)]+'['+_0x5bf57b['pluginName']+_0x3f9122(0x115)+_0x1fb09c+']['+_0x250d75+_0x3f9122(0x13a)+_0x197d64[_0x3f9122(0x15d)]);return;}}_0x5bf57b['logger'][_0x3f9122(0x118)](_0x5bf57b[_0x3f9122(0x153)]+'['+_0x5bf57b[_0x3f9122(0x107)]+']\x20subscriber['+_0x1fb09c+']['+_0x250d75+']\x20connected\x20'+(_0x44ec28[_0x3f9122(0x1fe)]['ca']?_0x3f9122(0x1fe):'')+'\x20'+_0x3292cf[_0x3f9122(0x209)]()),_0x3292cf['closed']()[_0x3f9122(0x11a)](_0x55bd2f=>{const _0x408af=_0x3f9122;_0x55bd2f&&_0x5bf57b[_0x408af(0x14a)]['error'](_0x5bf57b[_0x408af(0x153)]+'['+_0x5bf57b[_0x408af(0x107)]+_0x408af(0x115)+_0x1fb09c+']['+_0x250d75+_0x408af(0x1c7)+_0x55bd2f[_0x408af(0x15d)]);});};this[_0x4537e7(0x1b3)]=async(_0x2abce1,_0x461a85)=>{const _0x1e9db3=_0x4537e7;if(!_0x461a85?.[_0x1e9db3(0x1f2)]){_0x5bf57b[_0x1e9db3(0x14a)][_0x1e9db3(0x110)](_0x5bf57b[_0x1e9db3(0x153)]+'['+_0x5bf57b[_0x1e9db3(0x107)]+_0x1e9db3(0x115)+_0x2abce1+_0x1e9db3(0x19b));return;}if(!_0x461a85?.[_0x1e9db3(0x1f2)]?.[_0x1e9db3(0x1d4)]){_0x5bf57b[_0x1e9db3(0x14a)]['error'](_0x5bf57b[_0x1e9db3(0x153)]+'['+_0x5bf57b['pluginName']+']\x20subscriber['+_0x2abce1+_0x1e9db3(0x17f));return;}if(!_0x461a85?.[_0x1e9db3(0x1f2)]?.[_0x1e9db3(0xed)]){_0x5bf57b[_0x1e9db3(0x14a)][_0x1e9db3(0x110)](_0x5bf57b['gwName']+'['+_0x5bf57b['pluginName']+_0x1e9db3(0x115)+_0x2abce1+_0x1e9db3(0x131));return;}if(!_0x461a85?.[_0x1e9db3(0xf8)]?.['ca']){_0x5bf57b[_0x1e9db3(0x14a)][_0x1e9db3(0x110)](_0x5bf57b[_0x1e9db3(0x153)]+'['+_0x5bf57b[_0x1e9db3(0x107)]+']\x20subscriber['+_0x2abce1+_0x1e9db3(0x157));return;}if(!_0x461a85['baseUrls']||!Array[_0x1e9db3(0x138)](_0x461a85[_0x1e9db3(0x135)])||_0x461a85[_0x1e9db3(0x135)][_0x1e9db3(0x132)]<0x1){_0x5bf57b[_0x1e9db3(0x14a)][_0x1e9db3(0x110)](_0x5bf57b[_0x1e9db3(0x153)]+'['+_0x5bf57b[_0x1e9db3(0x107)]+_0x1e9db3(0x115)+_0x2abce1+_0x1e9db3(0x1e6));return;}if(!_0x461a85['usePutSoftSync']){const _0x326534=_0x461a85?.[_0x1e9db3(0x1f2)]?.[_0x1e9db3(0xed)]['toUpperCase']();if(_0x326534[_0x1e9db3(0x1ce)](_0x1e9db3(0x14e)))_0x461a85[_0x1e9db3(0x1be)]=!![];}const _0x11447d={};try{let _0x176b43=path[_0x1e9db3(0x16e)](_0x5bf57b[_0x1e9db3(0x1f3)],_0x1e9db3(0x143),_0x461a85?.[_0x1e9db3(0xf8)]?.['ca']||_0x1e9db3(0x127));(_0x461a85?.[_0x1e9db3(0xf8)]?.['ca']?.[_0x1e9db3(0x1ce)]('/')||_0x461a85?.[_0x1e9db3(0xf8)]?.['ca']?.['includes']('\x5c'))&&(_0x176b43=_0x461a85[_0x1e9db3(0xf8)]['ca']),_0x11447d['ca']=[fs[_0x1e9db3(0x1b4)](_0x176b43)],_0x11447d[_0x1e9db3(0x11e)]=!![];}catch(_0x25c270){_0x5bf57b['logger'][_0x1e9db3(0x110)](_0x5bf57b[_0x1e9db3(0x153)]+'['+_0x5bf57b[_0x1e9db3(0x107)]+_0x1e9db3(0x115)+_0x2abce1+_0x1e9db3(0x139)+_0x25c270[_0x1e9db3(0x15d)]);return;}const _0x5aa348={},_0x3ca3dc=new TextEncoder()['encode'](_0x461a85?.[_0x1e9db3(0x1f2)]?.['secret']),_0x5dc186=_0x461a85?.[_0x1e9db3(0x1f2)]?.[_0x1e9db3(0x18e)];_0x5aa348[_0x1e9db3(0x1f5)]=nats[_0x1e9db3(0x154)](_0x5dc186,_0x3ca3dc),_0x5aa348[_0x1e9db3(0x193)]=_0x461a85['baseUrls'],_0x5aa348[_0x1e9db3(0x1fe)]=_0x11447d,_0x5aa348['waitOnFirstConnect']=![],_0x5aa348['reconnect']=!![],_0x5aa348[_0x1e9db3(0x173)]=0x3e8*0xa,_0x5aa348[_0x1e9db3(0x205)]=-0x1,_0x5aa348[_0x1e9db3(0x12f)]=0x2*0x3c*0x3e8,_0x5aa348[_0x1e9db3(0x1c9)]=0x5,_0x5aa348['debug']=![],_0x40054e[_0x2abce1]={},_0x40054e[_0x2abce1][_0x1e9db3(0x161)]=_0x461a85,_0x40054e[_0x2abce1]['nc']=undefined,_0x40054e[_0x2abce1]['sub']=undefined,_0x5f3577(_0x2abce1,_0x5aa348);};const _0x51fe46=async(_0x286e17,_0x3cb206)=>{const _0x3fe557=_0x4537e7,_0x5ba07d=_0x40054e[_0x286e17][_0x3fe557(0x161)],_0xd917e0=_0x5ba07d?.[_0x3fe557(0x1f2)]?.['subject'];if(!_0x3cb206){_0x5bf57b[_0x3fe557(0x14a)][_0x3fe557(0x110)](_0x5bf57b[_0x3fe557(0x153)]+'['+_0x5bf57b[_0x3fe557(0x107)]+_0x3fe557(0x115)+_0x286e17+']['+_0xd917e0+_0x3fe557(0x148));return;}const _0x328a38=async(_0x2aa401,_0x1387a0)=>{const _0x3495fc=_0x3fe557;try{_0x5bf57b[_0x3495fc(0x14a)]['info'](_0x2aa401+_0x3495fc(0x100)+_0x1387a0);let _0x2a1073;try{if(_0x5ba07d[_0x3495fc(0x1b2)]&&Array[_0x3495fc(0x138)](_0x5ba07d['replaceDomains']))for(let _0x558ee9=0x0;_0x558ee9<_0x5ba07d[_0x3495fc(0x1b2)][_0x3495fc(0x132)];_0x558ee9++){const _0x26ceff=_0x5ba07d[_0x3495fc(0x1b2)][_0x558ee9];if(!_0x26ceff[_0x3495fc(0x16b)]||!_0x26ceff[_0x3495fc(0x16b)]['includes']('.')||!_0x26ceff['to']||!_0x26ceff['to'][_0x3495fc(0x1a5)]('.'))continue;const _0x2408b9=new RegExp('@'+_0x26ceff['from']+'\x22','gi');_0x1387a0=_0x1387a0['replace'](_0x2408b9,'@'+_0x26ceff['to']+'\x22');}_0x2a1073=JSON[_0x3495fc(0x117)](_0x1387a0);}catch(_0x5c2d8a){_0x5bf57b[_0x3495fc(0x14a)]['error'](_0x2aa401+_0x3495fc(0xec)+_0x5c2d8a[_0x3495fc(0x15d)]+'\x20message:\x20'+_0x1387a0),_0x5bf57b['logger']['debug'](_0x2aa401+_0x3495fc(0x196)+_0x11f296);return;}const _0x4882d9=_0x2a1073[_0x3495fc(0x1b6)];if(!_0x4882d9){_0x5bf57b[_0x3495fc(0x14a)][_0x3495fc(0x110)](_0x2aa401+_0x3495fc(0x1a0)+JSON[_0x3495fc(0x102)](_0x2a1073)),_0x5bf57b[_0x3495fc(0x14a)][_0x3495fc(0x118)](_0x2aa401+'\x20done'+_0x11f296);return;}if(!_0x4882d9[_0x3495fc(0x1bd)]){_0x5bf57b[_0x3495fc(0x14a)][_0x3495fc(0x110)](_0x2aa401+_0x3495fc(0x160)+JSON['stringify'](_0x2a1073)),_0x5bf57b[_0x3495fc(0x14a)]['debug'](_0x2aa401+'\x20done'+_0x11f296);return;}delete _0x4882d9['schemas'];let _0x37329f;_0x4882d9['id']&&(_0x37329f=_0x4882d9['id'],delete _0x4882d9['id']);let _0x53ebf6;_0x4882d9[_0x3495fc(0xff)]&&(_0x53ebf6=utils[_0x3495fc(0x191)](_0x4882d9[_0x3495fc(0xff)]),delete _0x4882d9[_0x3495fc(0xff)]);await _0x560744(_0x286e17,_0x4882d9);const _0x3bf522=_0x4882d9[_0x3495fc(0x1bd)];let _0x4a1f48,_0x4a206d;try{_0x4a1f48=await _0x89d8a4(_0x286e17,_0x3495fc(0x1bd),_0x3bf522);}catch(_0x34fb04){_0x5bf57b[_0x3495fc(0x14a)][_0x3495fc(0x110)](_0x2aa401+_0x3495fc(0x14c)+_0x34fb04['message']),_0x5bf57b[_0x3495fc(0x14a)][_0x3495fc(0x118)](_0x2aa401+_0x3495fc(0x196)+_0x11f296);const _0x4603b6=['UnableConnectingHost',_0x3495fc(0xef),_0x3495fc(0x122),_0x3495fc(0x10c),_0x3495fc(0x1d2),_0x3495fc(0x183)];for(const _0x21024a in _0x4603b6){if(_0x34fb04[_0x3495fc(0x15d)][_0x3495fc(0x1a5)](_0x21024a))return!![];}return;}if(!_0x5ba07d[_0x3495fc(0x106)]){let _0x2d0da9=![];if(_0x2a1073[_0x3495fc(0x1b9)]&&Array[_0x3495fc(0x138)](_0x2a1073[_0x3495fc(0x1b9)]))for(let _0x3e40f7=0x0;_0x3e40f7<_0x2a1073[_0x3495fc(0x1b9)][_0x3495fc(0x132)];_0x3e40f7++){const _0x45ac2b=_0x2a1073[_0x3495fc(0x1b9)][_0x3e40f7];_0x45ac2b['path'][_0x3495fc(0x1ce)](_0x3495fc(0x13c))&&(_0x45ac2b[_0x3495fc(0x1ef)]='groups',Array[_0x3495fc(0x138)](_0x45ac2b[_0x3495fc(0x125)])?(_0x45ac2b[_0x3495fc(0x125)][0x0]['id']=_0x45ac2b[_0x3495fc(0x125)][0x0][_0x3495fc(0x125)],_0x45ac2b[_0x3495fc(0x125)][0x0][_0x3495fc(0x1eb)]=_0x45ac2b[_0x3495fc(0x125)][0x0][_0x3495fc(0x1ab)]+_0x3495fc(0x156)+_0x45ac2b[_0x3495fc(0x125)][0x0][_0x3495fc(0x125)],delete _0x45ac2b['value'][0x0]['value'],delete _0x45ac2b[_0x3495fc(0x125)][0x0][_0x3495fc(0x1ab)]):_0x45ac2b[_0x3495fc(0x125)]=[{'id':_0x45ac2b[_0x3495fc(0x125)],'display':_0x45ac2b['value']}],delete _0x45ac2b[_0x3495fc(0x178)],_0x2d0da9=!![]);}if(_0x4882d9['roles']&&Array[_0x3495fc(0x138)](_0x4882d9['roles'])&&_0x4882d9[_0x3495fc(0x13c)][_0x3495fc(0x132)]>0x0){if(!_0x4882d9['groups'])_0x4882d9[_0x3495fc(0xee)]=[];if(!Array[_0x3495fc(0x138)](_0x4882d9[_0x3495fc(0xee)]))_0x4882d9[_0x3495fc(0xee)]=[];for(let _0x120429=0x0;_0x120429<_0x4882d9[_0x3495fc(0x13c)][_0x3495fc(0x132)];_0x120429++){const _0x1b465f={},_0x1a819d=_0x4882d9['roles'][_0x120429];_0x1b465f[_0x3495fc(0x125)]=_0x1a819d[_0x3495fc(0x125)],_0x1b465f[_0x3495fc(0x1eb)]=_0x1a819d[_0x3495fc(0x1ab)]+_0x3495fc(0x156)+_0x1a819d['display'],_0x4882d9[_0x3495fc(0xee)][_0x3495fc(0x16f)](_0x1b465f);}delete _0x4882d9[_0x3495fc(0x13c)],_0x2d0da9=!![];}if(_0x2d0da9)_0x5bf57b[_0x3495fc(0x14a)][_0x3495fc(0x118)](_0x2aa401+'\x20roles\x20converted\x20to\x20groups:\x20'+JSON[_0x3495fc(0x102)](_0x2a1073));}if(!_0x4a1f48){if(_0x2a1073[_0x3495fc(0x101)]===_0x3495fc(0x18c)){_0x5bf57b[_0x3495fc(0x14a)][_0x3495fc(0x118)](_0x2aa401+'\x20Delete\x20User\x20userName='+_0x3bf522+_0x3495fc(0x144)),_0x5bf57b['logger'][_0x3495fc(0x118)](_0x2aa401+_0x3495fc(0x196)+_0x11f296);return;}if(_0x5ba07d[_0x3495fc(0x12c)]&&_0x5ba07d['modifyOnly']===!![]){_0x5bf57b['logger'][_0x3495fc(0x118)](_0x2aa401+_0x3495fc(0x1b7)+_0x3bf522+_0x3495fc(0x1ed)),_0x5bf57b[_0x3495fc(0x14a)][_0x3495fc(0x118)](_0x2aa401+_0x3495fc(0x196)+_0x11f296);return;}if(Object[_0x3495fc(0x197)][_0x3495fc(0x1fc)][_0x3495fc(0x1c6)](_0x4882d9,_0x3495fc(0x1e3))){if(typeof _0x4882d9[_0x3495fc(0x1e3)]===_0x3495fc(0x1cc)){const _0x228c35=_0x4882d9['active'][_0x3495fc(0x1a6)]();if(_0x228c35==='true')_0x4882d9[_0x3495fc(0x1e3)]=!![];else{if(_0x228c35===_0x3495fc(0x130))_0x4882d9[_0x3495fc(0x1e3)]=![];}}if(_0x4882d9[_0x3495fc(0x1e3)]===![]){_0x5bf57b[_0x3495fc(0x14a)][_0x3495fc(0x118)](_0x2aa401+'\x20Create\x20userName='+_0x3bf522+'\x20message:\x20user\x20not\x20created\x20because\x20of\x20active=false'),_0x5bf57b['logger'][_0x3495fc(0x118)](_0x2aa401+'\x20done'+_0x11f296);return;}}_0x5bf57b['logger'][_0x3495fc(0x118)](_0x2aa401+'\x20Create\x20User\x20userName='+_0x3bf522);const _0x22a6a8=utils[_0x3495fc(0x191)](_0x4882d9);try{delete _0x22a6a8[_0x3495fc(0xee)];!_0x22a6a8[_0x3495fc(0x18f)]&&_0x5ba07d[_0x3495fc(0x194)]&&_0x5ba07d[_0x3495fc(0x194)]===!![]&&(_0x22a6a8['password']=utils[_0x3495fc(0x180)](0xf));if(_0x53ebf6||_0x37329f){if(_0x53ebf6)for(const _0x524797 in _0x53ebf6){_0x22a6a8[_0x524797]=_0x53ebf6[_0x524797];}if(_0x37329f)_0x22a6a8['id']=_0x37329f;await _0x560744(_0x286e17,_0x22a6a8);}await _0x5bf57b['createUser'](_0x286e17,_0x22a6a8),_0x4882d9['groups']&&Array[_0x3495fc(0x138)](_0x4882d9['groups'])&&_0x4882d9[_0x3495fc(0xee)][_0x3495fc(0x132)]>0x0&&(_0x4a206d=await _0x89d8a4(_0x286e17,_0x3495fc(0x1bd),_0x3bf522));}catch(_0x1417e0){_0x5bf57b[_0x3495fc(0x14a)][_0x3495fc(0x110)](_0x2aa401+'\x20createUser()\x20obj='+JSON[_0x3495fc(0x102)](_0x22a6a8)+_0x3495fc(0xf6)+_0x1417e0[_0x3495fc(0x15d)]+'}'),_0x5bf57b['logger'][_0x3495fc(0x118)](_0x2aa401+'\x20done'+_0x11f296);return;}}if(_0x4a1f48||_0x4a206d){if(_0x2a1073['activityOperation']===_0x3495fc(0x18c)){if(_0x5ba07d[_0x3495fc(0x12c)]&&_0x5ba07d[_0x3495fc(0x12c)]===!![]){_0x5bf57b[_0x3495fc(0x14a)][_0x3495fc(0x118)](_0x2aa401+_0x3495fc(0x1b0)+_0x4a1f48+_0x3495fc(0x192)),_0x5bf57b[_0x3495fc(0x14a)][_0x3495fc(0x118)](_0x2aa401+_0x3495fc(0x196)+_0x11f296);return;}_0x5bf57b[_0x3495fc(0x14a)][_0x3495fc(0x118)](_0x2aa401+'\x20Delete\x20User\x20id='+_0x4a1f48);try{await _0x5bf57b[_0x3495fc(0x18c)](_0x286e17,_0x4a1f48);}catch(_0x4515de){_0x5bf57b[_0x3495fc(0x14a)][_0x3495fc(0x110)](_0x2aa401+_0x3495fc(0x1b0)+_0x4a1f48+_0x3495fc(0xf6)+_0x4515de[_0x3495fc(0x15d)]+'}'),_0x5bf57b[_0x3495fc(0x14a)][_0x3495fc(0x118)](_0x2aa401+_0x3495fc(0x196)+_0x11f296);return;}}else{if(_0x4a206d)_0x4a1f48=_0x4a206d;_0x5bf57b['logger']['debug'](_0x2aa401+_0x3495fc(0x17a)+_0x4a1f48);const _0x464663={};_0x464663[_0x3495fc(0x113)]=()=>{},_0x464663['params']={},_0x464663[_0x3495fc(0x136)][_0x3495fc(0x1bb)]=_0x286e17,_0x464663['params']['id']=_0x4a1f48,_0x464663['request']={},_0x464663[_0x3495fc(0x114)][_0x3495fc(0x1cf)]=_0x286e17?'/'+_0x286e17+'/Users/'+_0x4a1f48:_0x3495fc(0x174)+_0x4a1f48,_0x464663[_0x3495fc(0x114)][_0x3495fc(0x1db)]=_0x4882d9;try{await _0x5bf57b[_0x3495fc(0x129)](_0x464663,_0x5ba07d['usePutSoftSync']);}catch(_0x2de395){_0x5bf57b[_0x3495fc(0x14a)]['error'](_0x2aa401+_0x3495fc(0x17a)+_0x4a1f48+_0x3495fc(0xf6)+_0x2de395[_0x3495fc(0x15d)]),_0x5bf57b[_0x3495fc(0x14a)]['debug'](_0x2aa401+'\x20done'+_0x11f296);return;}if(_0x464663[_0x3495fc(0xfa)]&&(_0x464663[_0x3495fc(0xfa)]<0xc8||_0x464663[_0x3495fc(0xfa)]>0x12b)){if(_0x464663[_0x3495fc(0x1db)]){if(_0x464663[_0x3495fc(0x1db)][_0x3495fc(0x109)]){let _0x227a3a=_0x464663[_0x3495fc(0x1db)]['detail'];_0x227a3a=_0x227a3a['replace'](_0x5bf57b[_0x3495fc(0x153)]+'['+_0x5bf57b[_0x3495fc(0x107)]+']',''+_0x2aa401),_0x5bf57b['logger'][_0x3495fc(0x110)](''+_0x227a3a);}else{if(_0x464663[_0x3495fc(0x1db)]['Errors']&&Array[_0x3495fc(0x138)](_0x464663[_0x3495fc(0x1db)][_0x3495fc(0x1df)])&&_0x464663[_0x3495fc(0x1db)][_0x3495fc(0x1df)]['length']>0x0){let _0x10598d=_0x464663['body'][_0x3495fc(0x1df)][0x0][_0x3495fc(0x179)];_0x10598d=_0x10598d['replace'](_0x5bf57b[_0x3495fc(0x153)]+'['+_0x5bf57b[_0x3495fc(0x107)]+']',''+_0x2aa401),_0x5bf57b[_0x3495fc(0x14a)][_0x3495fc(0x110)](''+_0x10598d);}}}}if(_0x5ba07d[_0x3495fc(0x1be)]){const [_0x241c66,_0x48c793]=_0x5bf57b[_0x3495fc(0x1e8)]({'Operations':_0x2a1073[_0x3495fc(0x1b9)]});if(_0x48c793){_0x5bf57b[_0x3495fc(0x14a)][_0x3495fc(0x110)](_0x2aa401+_0x3495fc(0x17a)+_0x4a1f48+_0x3495fc(0x147)+_0x48c793[_0x3495fc(0x15d)]),_0x5bf57b['logger']['debug'](_0x2aa401+_0x3495fc(0x196)+_0x11f296);return;}const _0x4a0c4a=[];if(_0x241c66['roles']&&Array[_0x3495fc(0x138)](_0x241c66['roles']))for(let _0x36059c=0x0;_0x36059c<_0x241c66[_0x3495fc(0x13c)][_0x3495fc(0x132)];_0x36059c++){_0x241c66[_0x3495fc(0x13c)][_0x36059c][_0x3495fc(0x186)]&&_0x241c66[_0x3495fc(0x13c)][_0x36059c][_0x3495fc(0x186)]===_0x3495fc(0x1e2)&&_0x4a0c4a['push'](_0x241c66[_0x3495fc(0x13c)][_0x36059c]);}if(_0x4a0c4a[_0x3495fc(0x132)]>0x0)try{await _0x5bf57b[_0x3495fc(0x13b)](_0x286e17,_0x4a1f48,{'roles':_0x4a0c4a});}catch(_0x6ded45){_0x5bf57b[_0x3495fc(0x14a)][_0x3495fc(0x110)](_0x2aa401+'\x20Replace\x20User\x20id='+_0x4a1f48+_0x3495fc(0x15a)+_0x6ded45[_0x3495fc(0x15d)]);}const _0x2aee50=[];if(_0x241c66[_0x3495fc(0xee)]&&Array[_0x3495fc(0x138)](_0x241c66['groups']))for(let _0x2a9254=0x0;_0x2a9254<_0x241c66['groups'][_0x3495fc(0x132)];_0x2a9254++){_0x241c66[_0x3495fc(0xee)][_0x2a9254]['operation']&&_0x241c66[_0x3495fc(0xee)][_0x2a9254][_0x3495fc(0x186)]==='delete'&&_0x2aee50[_0x3495fc(0x16f)](_0x241c66[_0x3495fc(0xee)][_0x2a9254]);}if(_0x2aee50[_0x3495fc(0x132)]>0x0)for(let _0x5cbd68=0x0;_0x5cbd68<_0x2aee50['length'];_0x5cbd68++){try{await _0x5bf57b[_0x3495fc(0x169)](_0x286e17,_0x2aee50[_0x5cbd68]['id'],{'members':[{'operation':_0x3495fc(0x1e2),'value':_0x4a1f48}]});}catch(_0x1c63a7){_0x5bf57b[_0x3495fc(0x14a)]['error'](_0x2aa401+_0x3495fc(0x17a)+_0x4a1f48+_0x3495fc(0x133)+_0x1c63a7[_0x3495fc(0x15d)]);}}}if(_0x5ba07d[_0x3495fc(0x1e5)]&&_0x2a1073[_0x3495fc(0x101)]===_0x3495fc(0x13b)){if(_0x4882d9[_0x3495fc(0xee)]&&Array[_0x3495fc(0x138)](_0x4882d9[_0x3495fc(0xee)])&&_0x4882d9['groups'][_0x3495fc(0x132)]===0x0){if(_0x4882d9['roles']&&Array[_0x3495fc(0x138)](_0x4882d9[_0x3495fc(0x13c)])&&_0x4882d9['roles'][_0x3495fc(0x132)]===0x0){if(_0x2a1073['Operations']&&Array[_0x3495fc(0x138)](_0x2a1073[_0x3495fc(0x1b9)])&&_0x2a1073['Operations'][_0x3495fc(0x132)]>0x0){let _0x423748=![];for(let _0x541bfb=0x0;_0x541bfb<_0x2a1073[_0x3495fc(0x1b9)][_0x3495fc(0x132)];_0x541bfb++){const _0x48c29a=_0x2a1073['Operations'][_0x541bfb];if(_0x48c29a['op']===_0x3495fc(0x15b)){if(_0x48c29a[_0x3495fc(0x1ef)]){if(_0x48c29a[_0x3495fc(0x1ef)]['startsWith'](_0x3495fc(0x13c))&&_0x48c29a[_0x3495fc(0x178)]){_0x423748=!![];break;}else{if(_0x48c29a[_0x3495fc(0x1ef)]===_0x3495fc(0xee)){_0x423748=!![];break;}}}}}if(_0x423748){_0x5bf57b[_0x3495fc(0x14a)][_0x3495fc(0x118)](_0x2aa401+_0x3495fc(0x1b0)+_0x4a1f48);try{await _0x5bf57b[_0x3495fc(0x18c)](_0x286e17,_0x4a1f48);}catch(_0x28dc31){_0x5bf57b[_0x3495fc(0x14a)]['error'](_0x2aa401+_0x3495fc(0x1b0)+_0x4a1f48+'\x20error:\x20'+_0x28dc31[_0x3495fc(0x15d)]+'}'),_0x5bf57b[_0x3495fc(0x14a)][_0x3495fc(0x118)](_0x2aa401+_0x3495fc(0x196)+_0x11f296);return;}}}}}}}}_0x5bf57b[_0x3495fc(0x14a)]['debug'](_0x2aa401+'\x20done'+_0x11f296);}catch(_0x5421db){_0x5bf57b[_0x3495fc(0x14a)][_0x3495fc(0x110)](_0x5bf57b[_0x3495fc(0x153)]+'['+_0x5bf57b[_0x3495fc(0x107)]+_0x3495fc(0x115)+_0x286e17+']['+_0xd917e0+_0x3495fc(0x1b5)+_0x5421db[_0x3495fc(0x15d)]+_0x3495fc(0x134)+_0x11f296);}},_0x17a87d=nats[_0x3fe557(0x189)](),_0x1ef045=_0x3cb206[_0x3fe557(0x18d)](),_0x83f669=(_0x3fe557(0x14b)+_0x5bf57b[_0x3fe557(0x107)]+'_'+_0x286e17)[_0x3fe557(0x146)]('*','#')[_0x3fe557(0x146)]('>','##')[_0x3fe557(0x146)]('.','_'),_0x2fd6b2=_0xd917e0[_0x3fe557(0x1fb)]('.')[0x0]['toUpperCase']()==='GW',_0x303a62=async()=>{const _0x46a2c6=_0x3fe557;try{let _0x577c96;const _0x827431=''+_0x5ba07d?.[_0x46a2c6(0x1f2)]?.[_0x46a2c6(0x1d4)],_0x5ca5c3=await _0x3cb206[_0x46a2c6(0x1bc)](),_0x36a32=async()=>{const _0x275678=_0x46a2c6;let _0x2fe416;try{_0x2fe416=await _0x1ef045[_0x275678(0x18b)][_0x275678(0x142)](_0x827431,_0x83f669);}catch(_0x39e24b){const _0x3073ea={'durable_name':_0x83f669,'deliver_policy':nats[_0x275678(0x11d)][_0x275678(0x1af)],'ack_policy':nats['AckPolicy']['Explicit'],'filter_subject':_0xd917e0};await _0x5ca5c3['consumers'][_0x275678(0x1b3)](_0x827431,_0x3073ea),_0x2fe416=await _0x1ef045[_0x275678(0x18b)][_0x275678(0x142)](_0x827431,_0x83f669);}if(_0x2fe416?.[_0x275678(0x152)]?.[_0x275678(0x161)]?.[_0x275678(0x201)]!=='all')throw new Error(_0x275678(0xfd));_0x2fe416?.['_info']?.[_0x275678(0x161)]?.['filter_subject']!==_0xd917e0&&(await _0x5ca5c3[_0x275678(0x18b)][_0x275678(0x17c)](_0x827431,_0x83f669,{'filter_subject':_0xd917e0}),_0x2fe416=await _0x1ef045[_0x275678(0x18b)]['get'](_0x827431,_0x83f669)),_0x577c96=await _0x2fe416['consume']({'max_messages':0x64}),_0x4514b4(_0x577c96);},_0x4514b4=async _0x1ae570=>{const _0x4d7a8b=_0x46a2c6;for await(const _0x3734a1 of await _0x1ae570[_0x4d7a8b(0xfa)]()){switch(_0x3734a1[_0x4d7a8b(0x1ab)]){case nats[_0x4d7a8b(0x1c4)]['ConsumerNotFound']:_0x5bf57b[_0x4d7a8b(0x14a)][_0x4d7a8b(0x1e4)](_0x5bf57b['gwName']+'['+_0x5bf57b[_0x4d7a8b(0x107)]+_0x4d7a8b(0x115)+_0x286e17+']['+_0xd917e0+']\x20client\x20consumer\x20reinitiated\x20because\x20of\x20'+_0x3734a1[_0x4d7a8b(0x1ab)]),_0x36a32();return;}}};await _0x36a32();let _0x4b706e=-0x1;do{for await(const _0x2069df of _0x577c96){if(!_0x2069df[_0x46a2c6(0x1ad)]||!_0x2069df[_0x46a2c6(0x1ad)][_0x46a2c6(0x142)](_0x46a2c6(0x108))){_0x2069df[_0x46a2c6(0x1dc)]();continue;}_0x4b706e=_0x577c96[_0x46a2c6(0x182)]();const _0x59cefb=_0x5bf57b[_0x46a2c6(0x153)]+'['+_0x5bf57b[_0x46a2c6(0x107)]+_0x46a2c6(0x115)+_0x286e17+']['+_0x2069df[_0x46a2c6(0xed)]+']['+_0x4b706e+']['+(_0x2069df['headers']?_0x2069df[_0x46a2c6(0x1ad)]['get'](_0x46a2c6(0x108)):'')+']',_0x141bac=_0x17a87d[_0x46a2c6(0x11f)](_0x2069df[_0x46a2c6(0x162)]),_0x4091da=await _0x328a38(_0x59cefb,_0x141bac);if(!_0x4091da||_0x4091da!==!![])_0x2069df[_0x46a2c6(0x1dc)]();else _0x5bf57b[_0x46a2c6(0x14a)][_0x46a2c6(0x110)](_0x59cefb+'\x20subscriber\x20error:\x20scimgateway\x20endpoint\x20connect\x20problem\x20-\x20will\x20do\x20auto\x20retry\x20until\x20connected');if(_0x4b706e<0x1)break;}}while(_0x4b706e===0x0);}catch(_0x4b2438){_0x5bf57b[_0x46a2c6(0x14a)]['error'](_0x5bf57b[_0x46a2c6(0x153)]+'['+_0x5bf57b[_0x46a2c6(0x107)]+']\x20subscriber['+_0x286e17+']['+_0xd917e0+_0x46a2c6(0x172)+_0x4b2438[_0x46a2c6(0x15d)]);}},_0x3740fc=async()=>{const _0x274c6e=_0x3fe557,_0x26ca98=_0x3cb206[_0x274c6e(0x1d6)](_0xd917e0,{'max':0x64});for await(const _0x59fbd5 of _0x26ca98){if(!_0x59fbd5[_0x274c6e(0x1ad)]||!_0x59fbd5[_0x274c6e(0x1ad)][_0x274c6e(0x142)](_0x274c6e(0x108)))continue;let _0x170934,_0x131202;try{try{_0x170934=JSON[_0x274c6e(0x117)](_0x59fbd5[_0x274c6e(0x1cc)]());}catch(_0x2b2606){const _0x5b522e=_0x274c6e(0x1c5);_0x5bf57b[_0x274c6e(0x14a)][_0x274c6e(0x110)](_0x5bf57b[_0x274c6e(0x153)]+'['+_0x5bf57b['pluginName']+']\x20subscriber['+_0x286e17+']['+_0xd917e0+']\x20'+_0x5b522e+':\x20'+_0x59fbd5[_0x274c6e(0x1cc)]());throw new Error(_0x5b522e);}if(!_0x170934||!_0x170934[_0x274c6e(0x1d5)]){const _0x3bc4a9=_0x274c6e(0x121);_0x5bf57b['logger'][_0x274c6e(0x110)](_0x5bf57b[_0x274c6e(0x153)]+'['+_0x5bf57b['pluginName']+_0x274c6e(0x115)+_0x286e17+']['+_0xd917e0+']\x20'+_0x3bc4a9+':\x20'+_0x170934);throw new Error(_0x3bc4a9);}!Object[_0x274c6e(0x197)][_0x274c6e(0x1fc)][_0x274c6e(0x1c6)](_0x170934,_0x274c6e(0x1bb))&&(_0x170934[_0x274c6e(0x1bb)]='undefined');if(_0x170934[_0x274c6e(0x1bb)]!==_0x286e17){const _0x355989=_0x274c6e(0x123)+_0x170934[_0x274c6e(0x1bb)]+_0x274c6e(0xfe)+_0x286e17;_0x5bf57b['logger'][_0x274c6e(0x110)](_0x5bf57b[_0x274c6e(0x153)]+'['+_0x5bf57b[_0x274c6e(0x107)]+_0x274c6e(0x115)+_0x286e17+']['+_0xd917e0+']\x20'+_0x355989);throw new Error(_0x355989);}_0x131202=_0x5bf57b['gwName']+'['+_0x5bf57b[_0x274c6e(0x107)]+_0x274c6e(0x115)+_0x286e17+']['+_0x59fbd5[_0x274c6e(0xed)]+']['+(_0x59fbd5[_0x274c6e(0x1ad)]?_0x59fbd5[_0x274c6e(0x1ad)][_0x274c6e(0x142)](_0x274c6e(0x108)):'')+']',_0x5bf57b[_0x274c6e(0x14a)][_0x274c6e(0x118)](_0x131202+_0x274c6e(0x13e));const _0x14e561={};let _0x5d3fdc,_0x18cde6;switch(_0x170934[_0x274c6e(0x1d5)]){case _0x274c6e(0x1a1):if(!_0x170934[_0x274c6e(0x198)]['operator']&&_0x170934[_0x274c6e(0x198)][_0x274c6e(0x1a3)]&&_0x170934[_0x274c6e(0x198)][_0x274c6e(0x1a3)]['includes']('\x20or\x20')){const _0xe39fb=_0x170934['obj'][_0x274c6e(0x1a3)][_0x274c6e(0x1fb)](_0x274c6e(0x168));let _0x4ed6cc=[];for(let _0x422aea=0x0;_0x422aea<_0xe39fb['length'];_0x422aea++){_0xe39fb[_0x422aea]=_0xe39fb[_0x422aea][_0x274c6e(0x1c3)](/\(/g,'')[_0x274c6e(0x1c3)](/\)/g,'')['trim']();const _0x956d31=_0xe39fb[_0x422aea][_0x274c6e(0x1fb)]('\x20');if(_0x956d31[_0x274c6e(0x132)]===0x3||_0x956d31[_0x274c6e(0x132)]>0x2&&_0x956d31[0x2][_0x274c6e(0x1ce)]('\x22')&&_0x956d31[_0x956d31[_0x274c6e(0x132)]-0x1][_0x274c6e(0x14d)]('\x22')){const _0x1cec00={};_0x1cec00[_0x274c6e(0x15c)]=_0x956d31[0x0],_0x1cec00[_0x274c6e(0x203)]=_0x956d31[0x1][_0x274c6e(0x1a6)](),_0x1cec00[_0x274c6e(0x125)]=decodeURIComponent(_0x956d31['slice'](0x2)[_0x274c6e(0x16e)]('\x20')[_0x274c6e(0x1c3)](/"/g,'')),_0x4ed6cc[_0x274c6e(0x16f)](_0x1cec00);}else{_0x4ed6cc=[];break;}}if(_0x4ed6cc[_0x274c6e(0x132)]>0x0){const _0x2e9e4c=async _0x193900=>{const _0x1be146=_0x274c6e;return await _0x5bf57b[_0x170934[_0x1be146(0x1d5)]](_0x286e17,_0x193900,_0x170934[_0x1be146(0x1e9)],_0x170934[_0x1be146(0x1c8)]);},_0x3d942f=0x5,_0xa6eb1f=[];_0x5bf57b[_0x274c6e(0x14a)][_0x274c6e(0x118)](_0x131202+_0x274c6e(0xf7)+_0x170934[_0x274c6e(0x1d5)]+'\x22\x20with\x20chunks\x20and\x20awaiting\x20result');do{const _0xeeb4ff=_0x4ed6cc['splice'](0x0,_0x3d942f),_0x30bd83=await Promise['allSettled'](_0xeeb4ff[_0x274c6e(0x1f8)](_0x5501b6=>_0x2e9e4c(_0x5501b6))),_0x4da9c9=_0x30bd83[_0x274c6e(0x1a2)](_0x5e97d6=>_0x5e97d6[_0x274c6e(0xfa)]===_0x274c6e(0x104))[_0x274c6e(0x1f8)](_0x4d9522=>_0x4d9522[_0x274c6e(0x177)][_0x274c6e(0x15d)]);if(_0x4da9c9[_0x274c6e(0x132)]>0x0){const _0x3c8a2e=_0x170934[_0x274c6e(0x1d5)]+_0x274c6e(0x206)+_0x4da9c9['join'](',\x20');throw new Error(_0x3c8a2e);}const _0x5c502b=_0x30bd83[_0x274c6e(0x1f8)](_0x12aecd=>_0x12aecd?.[_0x274c6e(0x125)]?.[_0x274c6e(0x1f6)]);for(let _0xe7d1b=0x0;_0xe7d1b<_0x5c502b[_0x274c6e(0x132)];_0xe7d1b++){Array['prototype'][_0x274c6e(0x16f)][_0x274c6e(0x1d1)](_0xa6eb1f,_0x5c502b[_0xe7d1b]);}}while(_0x4ed6cc[_0x274c6e(0x132)]>0x0);_0x5d3fdc={'Resources':_0xa6eb1f};}}!_0x5d3fdc&&(_0x5bf57b[_0x274c6e(0x14a)][_0x274c6e(0x118)](_0x131202+_0x274c6e(0xf7)+_0x170934[_0x274c6e(0x1d5)]+_0x274c6e(0x1d0)),_0x5d3fdc=await _0x5bf57b[_0x170934[_0x274c6e(0x1d5)]](_0x286e17,_0x170934[_0x274c6e(0x198)],_0x170934[_0x274c6e(0x1e9)],_0x170934[_0x274c6e(0x120)]));if(Array[_0x274c6e(0x138)](_0x5d3fdc?.['Resources'])){if(_0x170934?.['attributes']?.[_0x274c6e(0x132)]===0x0||_0x170934?.[_0x274c6e(0x1e9)]?.[_0x274c6e(0x1a5)](_0x274c6e(0xee)))for(let _0x3aff77=0x0;_0x3aff77<_0x5d3fdc[_0x274c6e(0x1f6)][_0x274c6e(0x132)];_0x3aff77++){const _0x55441b=_0x5d3fdc[_0x274c6e(0x1f6)][_0x3aff77];if(!_0x55441b['id'])break;if(_0x55441b[_0x274c6e(0xee)])break;_0x55441b['groups']=await _0x5bf57b['getMemberOf'](_0x286e17,_0x55441b['id'],_0x274c6e(0x116),_0x170934[_0x274c6e(0x120)]);}}break;case _0x274c6e(0x116):_0x5bf57b['logger'][_0x274c6e(0x118)](_0x131202+_0x274c6e(0xf7)+_0x170934['handle']+_0x274c6e(0x1d0)),_0x5d3fdc=await _0x5bf57b[_0x170934[_0x274c6e(0x1d5)]](_0x286e17,_0x170934[_0x274c6e(0x198)],_0x170934[_0x274c6e(0x1e9)],_0x170934[_0x274c6e(0x120)]);break;case _0x274c6e(0x103):_0x5bf57b[_0x274c6e(0x14a)][_0x274c6e(0x118)](_0x131202+_0x274c6e(0xf7)+_0x170934[_0x274c6e(0x1d5)]+_0x274c6e(0x1d0)),_0x5d3fdc=await _0x5bf57b[_0x170934[_0x274c6e(0x1d5)]](_0x286e17,_0x170934[_0x274c6e(0x198)],_0x170934['ctxPassThrough']);break;case _0x274c6e(0x15e):_0x5bf57b['logger'][_0x274c6e(0x118)](_0x131202+_0x274c6e(0xf7)+_0x170934[_0x274c6e(0x1d5)]+_0x274c6e(0x1d0)),_0x5d3fdc=await _0x5bf57b[_0x170934['handle']](_0x286e17,_0x170934['obj'],_0x170934['ctxPassThrough']);break;case _0x274c6e(0x18c):_0x5bf57b[_0x274c6e(0x14a)][_0x274c6e(0x118)](_0x131202+_0x274c6e(0xf7)+_0x170934['handle']+'\x22\x20and\x20awaiting\x20result'),_0x5d3fdc=await _0x5bf57b[_0x170934['handle']](_0x286e17,_0x170934['id'],_0x170934['ctxPassThrough']);break;case _0x274c6e(0x1d3):_0x5bf57b['logger'][_0x274c6e(0x118)](_0x131202+_0x274c6e(0xf7)+_0x170934['handle']+_0x274c6e(0x1d0)),_0x5d3fdc=await _0x5bf57b[_0x170934['handle']](_0x286e17,_0x170934['id'],_0x170934[_0x274c6e(0x120)]);break;case'modifyUser':_0x5bf57b[_0x274c6e(0x14a)][_0x274c6e(0x118)](_0x131202+_0x274c6e(0xf7)+_0x170934[_0x274c6e(0x1d5)]+_0x274c6e(0x1d0)),_0x5d3fdc=await _0x5bf57b[_0x170934[_0x274c6e(0x1d5)]](_0x286e17,_0x170934['id'],_0x170934[_0x274c6e(0x198)],_0x170934['ctxPassThrough']);break;case _0x274c6e(0x169):_0x5bf57b['logger']['debug'](_0x131202+_0x274c6e(0xf7)+_0x170934['handle']+_0x274c6e(0x1d0)),_0x5d3fdc=await _0x5bf57b[_0x170934[_0x274c6e(0x1d5)]](_0x286e17,_0x170934['id'],_0x170934[_0x274c6e(0x198)],_0x170934[_0x274c6e(0x120)]);break;case'replaceUsrGrp':_0x14e561[_0x274c6e(0x113)]=()=>{},_0x14e561[_0x274c6e(0x136)]={},_0x14e561[_0x274c6e(0x136)][_0x274c6e(0x1bb)]=_0x286e17,_0x14e561[_0x274c6e(0x136)]['id']=_0x170934['id'],_0x14e561[_0x274c6e(0x114)]={},_0x14e561[_0x274c6e(0x114)][_0x274c6e(0x1cf)]=_0x170934['originalUrl'],_0x14e561[_0x274c6e(0x114)][_0x274c6e(0x1db)]=_0x170934['obj'],_0x14e561[_0x274c6e(0x1c8)]=_0x170934[_0x274c6e(0x120)],_0x5bf57b['logger'][_0x274c6e(0x118)](_0x131202+_0x274c6e(0xf7)+_0x170934['handle']+_0x274c6e(0x1d0)),_0x5d3fdc=await _0x5bf57b[_0x170934[_0x274c6e(0x1d5)]](_0x14e561);break;case _0x274c6e(0x1fa):_0x5bf57b[_0x274c6e(0x14a)]['debug'](_0x131202+_0x274c6e(0xf7)+_0x170934[_0x274c6e(0x1d5)]+_0x274c6e(0x1d0)),_0x5d3fdc=await _0x5bf57b[_0x170934['handle']](_0x286e17,_0x170934[_0x274c6e(0x198)],_0x170934['ctxPassThrough']);break;case _0x274c6e(0x1d9):_0x5bf57b[_0x274c6e(0x14a)][_0x274c6e(0x118)](_0x131202+_0x274c6e(0xf7)+_0x170934[_0x274c6e(0x1d5)]+_0x274c6e(0x1d0)),_0x5d3fdc=await _0x5bf57b[_0x170934[_0x274c6e(0x1d5)]](_0x286e17,_0x170934['id'],_0x170934[_0x274c6e(0x198)],_0x170934[_0x274c6e(0x120)]);break;case _0x274c6e(0x16a):_0x5bf57b[_0x274c6e(0x14a)][_0x274c6e(0x118)](_0x131202+'\x20calling\x20\x22'+_0x170934['handle']+_0x274c6e(0x1d0)),_0x5d3fdc=await _0x5bf57b[_0x170934[_0x274c6e(0x1d5)]](_0x286e17,_0x170934['id'],_0x170934[_0x274c6e(0x198)],_0x170934[_0x274c6e(0x120)]);break;case _0x274c6e(0x19c):_0x5bf57b[_0x274c6e(0x14a)][_0x274c6e(0x118)](_0x131202+_0x274c6e(0xf7)+_0x170934[_0x274c6e(0x1d5)]+_0x274c6e(0x1d0)),_0x5d3fdc=await _0x5bf57b[_0x170934['handle']](_0x286e17,_0x170934['id'],_0x170934[_0x274c6e(0xf4)],_0x170934[_0x274c6e(0x198)],_0x170934['ctxPassThrough']);break;case _0x274c6e(0x10a):_0x5bf57b[_0x274c6e(0x14a)][_0x274c6e(0x118)](_0x131202+_0x274c6e(0xf7)+_0x170934[_0x274c6e(0x1d5)]+'\x22\x20and\x20awaiting\x20result'),_0x5d3fdc=await _0x5bf57b[_0x170934['handle']](_0x286e17,_0x170934['id'],_0x170934['ctxPassThrough']);break;default:_0x18cde6=_0x274c6e(0x202)+_0x170934[_0x274c6e(0x1d5)]+_0x274c6e(0x19d),_0x5bf57b[_0x274c6e(0x14a)][_0x274c6e(0x110)](_0x131202+'\x20'+_0x18cde6);throw new Error(_0x18cde6);}if(!_0x5d3fdc)_0x5d3fdc=null;const _0x49aa35=JSON[_0x274c6e(0x102)](_0x5d3fdc);_0x59fbd5[_0x274c6e(0xf2)](_0x49aa35),_0x5bf57b['logger']['info'](_0x131202+_0x274c6e(0x1ee)+_0x170934[_0x274c6e(0x1d5)]+_0x274c6e(0x149)+(_0x170934[_0x274c6e(0x198)]?JSON[_0x274c6e(0x102)](_0x170934[_0x274c6e(0x198)]):'')+_0x274c6e(0x181)+(_0x170934['id']?_0x170934['id']:'')+_0x274c6e(0x12a)+(_0x170934[_0x274c6e(0x1e9)]?_0x170934['attributes']:'')+'\x20message\x20response:\x20'+_0x49aa35+_0x11f296);}catch(_0x3d8519){const _0x5362a0=_0x274c6e(0x1da)+_0x3d8519['message']+_0x274c6e(0x1c0)+_0x3d8519['name']+'\x22}';_0x59fbd5[_0x274c6e(0xf2)](_0x5362a0),_0x5bf57b['logger'][_0x274c6e(0x1e4)]((_0x131202||'')+_0x274c6e(0x1ee)+_0x170934[_0x274c6e(0x1d5)]+_0x274c6e(0x149)+(_0x170934['obj']?JSON[_0x274c6e(0x102)](_0x170934[_0x274c6e(0x198)]):'')+',\x20id='+(_0x170934['id']?_0x170934['id']:'')+_0x274c6e(0x12a)+(_0x170934[_0x274c6e(0x1e9)]?_0x170934[_0x274c6e(0x1e9)]:'')+_0x274c6e(0x1b8)+_0x5362a0+_0x11f296);}}};if(_0x2fd6b2)_0x3740fc();else _0x303a62();},_0x112135=async(_0x137231,_0x724401)=>{const _0x46bfc5=_0x4537e7,_0xe7ea09=_0x40054e[_0x137231][_0x46bfc5(0x161)]?.[_0x46bfc5(0x1f2)]?.['subject'];let _0x249474=0x0;for await(const _0x3056a8 of _0x724401[_0x46bfc5(0xfa)]()){switch(_0x3056a8[_0x46bfc5(0x1ab)]){case nats[_0x46bfc5(0x1fd)][_0x46bfc5(0x1d7)]:_0x5bf57b[_0x46bfc5(0x14a)][_0x46bfc5(0x110)](_0x5bf57b[_0x46bfc5(0x153)]+'['+_0x5bf57b[_0x46bfc5(0x107)]+_0x46bfc5(0x115)+_0x137231+']['+_0xe7ea09+']\x20client\x20disconnected\x20'+_0x3056a8[_0x46bfc5(0x162)]+_0x46bfc5(0x12e)),_0x249474=0x0;break;case nats[_0x46bfc5(0x1fd)]['Reconnect']:_0x5bf57b[_0x46bfc5(0x14a)]['info'](_0x5bf57b[_0x46bfc5(0x153)]+'['+_0x5bf57b['pluginName']+']\x20subscriber['+_0x137231+']['+_0xe7ea09+_0x46bfc5(0x170)+_0x3056a8[_0x46bfc5(0x162)]);break;case nats['Events']['Error']:_0x5bf57b[_0x46bfc5(0x14a)][_0x46bfc5(0x110)](_0x5bf57b['gwName']+'['+_0x5bf57b[_0x46bfc5(0x107)]+']\x20subscriber['+_0x137231+']['+_0xe7ea09+_0x46bfc5(0x204)+_0x3056a8[_0x46bfc5(0x162)]);break;case nats['DebugEvents'][_0x46bfc5(0x158)]:_0x249474+=0x1;_0x249474%0x1e===0x0&&_0x5bf57b[_0x46bfc5(0x14a)][_0x46bfc5(0x118)](_0x5bf57b[_0x46bfc5(0x153)]+'['+_0x5bf57b[_0x46bfc5(0x107)]+_0x46bfc5(0x115)+_0x137231+']['+_0xe7ea09+_0x46bfc5(0x1aa)+_0x3056a8['data']+'\x20(count='+_0x249474+')');break;case nats[_0x46bfc5(0x1c2)][_0x46bfc5(0x145)]:_0x5bf57b[_0x46bfc5(0x14a)]['debug'](_0x5bf57b['gwName']+'['+_0x5bf57b[_0x46bfc5(0x107)]+']\x20subscriber['+_0x137231+']['+_0xe7ea09+']\x20client\x20has\x20a\x20stale\x20connection\x20'+_0x3056a8['data']);break;}}};process['on']('SIGTERM',async()=>{const _0x3e18d3=_0x4537e7;for(const _0x53ea14 in _0x40054e){_0x40054e[_0x53ea14]['nc']&&!_0x40054e[_0x53ea14]['nc'][_0x3e18d3(0x19f)]()&&await _0x40054e[_0x53ea14]['nc'][_0x3e18d3(0x1ca)]();}}),process['on'](_0x4537e7(0x155),async()=>{const _0x3e58fc=_0x4537e7;for(const _0x32bc3e in _0x40054e){_0x40054e[_0x32bc3e]['nc']&&!_0x40054e[_0x32bc3e]['nc'][_0x3e58fc(0x19f)]()&&await _0x40054e[_0x32bc3e]['nc'][_0x3e58fc(0x1ca)]();}});const _0x89d8a4=async(_0x14a244,_0x3898b2,_0x386e4d)=>{const _0x4b49b0=_0x4537e7,_0x295ac0={'attribute':_0x3898b2,'operator':'eq','value':_0x386e4d,'rawFilter':undefined,'startIndex':undefined,'count':undefined},_0x17d0b7=[_0x3898b2];if(_0x3898b2!=='id')_0x17d0b7[_0x4b49b0(0x16f)]('id');try{const _0x4f265a=await _0x5bf57b[_0x4b49b0(0x1a1)](_0x14a244,_0x295ac0,_0x17d0b7);if(!_0x4f265a||!_0x4f265a[_0x4b49b0(0x1f6)]||!Array['isArray'](_0x4f265a[_0x4b49b0(0x1f6)]))throw new Error(_0x4b49b0(0x14f)+JSON[_0x4b49b0(0x102)](_0x295ac0)+_0x4b49b0(0x111));if(_0x4f265a['Resources'][_0x4b49b0(0x132)]===0x0)return null;else{if(_0x4f265a[_0x4b49b0(0x1f6)]['length']>0x2)throw new Error(_0x4b49b0(0x14f)+JSON[_0x4b49b0(0x102)](_0x295ac0)+_0x4b49b0(0x164));else{const _0x502bc9=_0x4f265a[_0x4b49b0(0x1f6)][0x0];if(!_0x502bc9['id'])throw new Error(_0x4b49b0(0x14f)+JSON[_0x4b49b0(0x102)](_0x295ac0)+_0x4b49b0(0x10e)+JSON[_0x4b49b0(0x102)](_0x502bc9)+'\x20error:\x20missing\x20id}');return decodeURIComponent(_0x502bc9['id']);}}}catch(_0x3fb72f){throw new Error(_0x4b49b0(0x14f)+JSON[_0x4b49b0(0x102)](_0x295ac0)+_0x4b49b0(0xf6)+_0x3fb72f[_0x4b49b0(0x15d)]+'}');}},_0x2b2a20=_0x23f1e5=>{const _0x472703=_0x4537e7;if(!_0x23f1e5||typeof _0x23f1e5!==_0x472703(0x1cc))return[null,null];_0x23f1e5=_0x23f1e5[_0x472703(0x11b)]();const _0x4208fa=_0x23f1e5['indexOf']('(');if(_0x4208fa<0x1)return[null,null];if(_0x23f1e5[_0x472703(0x185)](_0x23f1e5[_0x472703(0x132)]-0x1)!==')')return[null,null];if(_0x12e39b(_0x23f1e5,'(')!==_0x12e39b(_0x23f1e5,')'))return[null,null];const _0x254104=_0x23f1e5[_0x472703(0x185)](0x0,_0x4208fa),_0xeab944=_0x23f1e5['substring'](_0x4208fa+0x1,_0x23f1e5[_0x472703(0x132)]-0x1);let _0x56849b=[];const _0x1552f2=_0xeab944['split'](',');let _0x40b0f9='';for(let _0x5653ec=0x0;_0x5653ec<_0x1552f2[_0x472703(0x132)];_0x5653ec++){const _0x555099=_0x40b0f9?_0x40b0f9+','+_0x1552f2[_0x5653ec]:_0x1552f2[_0x5653ec],_0x4990ea=_0x12e39b(_0x555099,'('),_0x16d700=_0x12e39b(_0x555099,')');if(_0x4990ea===_0x16d700)_0x56849b['push'](_0x3449fd(_0x555099,'\x22')),_0x40b0f9='';else{if(_0x40b0f9)_0x40b0f9+=','+_0x1552f2[_0x5653ec];else _0x40b0f9+=_0x1552f2[_0x5653ec];}}if(_0x56849b[_0x472703(0x132)]===0x0)_0x56849b=null;return[_0x254104,_0x56849b];};function _0x12e39b(_0x3ffd38,_0x1e5d08){const _0x1ae9a7=_0x4537e7;let _0x479fcc=0x0;for(let _0x20990b=0x0;_0x20990b<_0x3ffd38[_0x1ae9a7(0x132)];_0x20990b++){_0x3ffd38[_0x1ae9a7(0x10f)](_0x20990b)===_0x1e5d08&&(_0x479fcc+=0x1);}return _0x479fcc;}const _0x3449fd=(_0x5c4654,_0xff9bad)=>{const _0x4d1052=_0x4537e7;if(typeof _0x5c4654!==_0x4d1052(0x1cc)||typeof _0xff9bad!=='string')return _0x5c4654;if(_0x5c4654[_0x4d1052(0x132)]===0x1)return _0x5c4654;if(_0xff9bad['length']!==0x1)return _0x5c4654;return _0x5c4654=_0x5c4654[_0x4d1052(0x11b)](),_0x5c4654[_0x4d1052(0x185)](0x0,0x1)===_0xff9bad&&(_0x5c4654=_0x5c4654[_0x4d1052(0x185)](0x1)),_0x5c4654['substring'](_0x5c4654['length']-0x1)===_0xff9bad&&(_0x5c4654=_0x5c4654[_0x4d1052(0x185)](0x0,_0x5c4654['length']-0x1)),_0x5c4654;},_0x43152a=async(_0x15e727,_0x10bf9b,_0x36415f,_0x5903c0)=>{const _0x1f0449=_0x4537e7;if(!_0x10bf9b||!_0x36415f||!_0x5903c0)return null;const [_0x44779b,_0x512123]=_0x2b2a20(_0x5903c0);if(!_0x44779b||!_0x512123){const _0x3c283b=_0x5903c0[_0x1f0449(0x1fb)]('(');if(_0x3c283b[_0x1f0449(0x132)]>0x1){const _0x1c20cb=['lowercase',_0x1f0449(0xf1),_0x1f0449(0x1f4),'elementnumber',_0x1f0449(0x16e),_0x1f0449(0x1c3),_0x1f0449(0x1cb),_0x1f0449(0x10b),_0x1f0449(0x17d)],_0x52d4ea=_0x3c283b[0x0][_0x1f0449(0x1a6)]();if(_0x1c20cb[_0x1f0449(0x1a5)](_0x52d4ea))return null;}return _0x5903c0;}for(let _0x2dca47=0x0;_0x2dca47<_0x512123[_0x1f0449(0x132)];_0x2dca47++){if(_0x512123[_0x2dca47]['substring'](0x0,0x1)==='['){const _0x4df2cc=_0x512123[_0x2dca47]['indexOf'](']');if(_0x4df2cc<0x0)return null;const _0xe8c7cc=_0x512123[_0x2dca47][_0x1f0449(0x185)](0x1,_0x4df2cc),_0x34750a=_0xe8c7cc[_0x1f0449(0x1fb)]('.');let _0x35e33f;for(let _0xa1299d=0x0;_0xa1299d<_0x34750a[_0x1f0449(0x132)];_0xa1299d++){if(_0xa1299d===0x0)_0x35e33f=_0x10bf9b[_0x34750a[_0xa1299d]];else{if(!_0x35e33f)return null;_0x35e33f=_0x35e33f[_0x34750a[_0xa1299d]];}}if(!_0x35e33f)return null;_0x512123[_0x2dca47]=_0x35e33f;}}for(let _0x4369ce=0x0;_0x4369ce<_0x512123['length'];_0x4369ce++){const [_0x4213ce]=_0x2b2a20(_0x512123[_0x4369ce]);_0x4213ce&&(_0x512123[_0x4369ce]=await _0x43152a(_0x15e727,_0x10bf9b,_0x36415f,_0x512123[_0x4369ce]));}if(_0x512123[0x0]===null)return null;switch(_0x44779b[_0x1f0449(0x1a6)]()){case _0x1f0449(0x165):{if(_0x512123[_0x1f0449(0x132)]!==0x1)return null;const [_0x34b599]=_0x2b2a20(_0x512123[0x0]);if(_0x34b599)_0x512123[0x0]=await _0x43152a(_0x15e727,_0x10bf9b,_0x36415f,_0x34b599);if(_0x512123[0x0]===null)return null;return _0x512123[0x0][_0x1f0449(0x1a6)]();}case _0x1f0449(0xf1):{if(_0x512123[_0x1f0449(0x132)]!==0x1)return null;const [_0x49c64a]=_0x2b2a20(_0x512123[0x0]);if(_0x49c64a)_0x512123[0x0]=await _0x43152a(_0x15e727,_0x10bf9b,_0x36415f,_0x49c64a);if(_0x512123[0x0]===null)return null;return _0x512123[0x0]['toUpperCase']();}case'firstn':{if(_0x512123[_0x1f0449(0x132)]!==0x2)return null;const [_0x478be0]=_0x2b2a20(_0x512123[0x0]);if(_0x478be0)_0x512123[0x0]=await _0x43152a(_0x15e727,_0x10bf9b,_0x36415f,_0x478be0);if(_0x512123[0x0]===null)return null;if(isNaN(_0x512123[0x1]))return null;return _0x512123[0x0][_0x1f0449(0x185)](0x0,_0x512123[0x1]);}case _0x1f0449(0x1f7):{const [_0xccb497]=_0x2b2a20(_0x512123[0x0]);if(_0x512123[_0x1f0449(0x132)]<0x2)return null;if(_0xccb497)_0x512123[0x0]=await _0x43152a(_0x15e727,_0x10bf9b,_0x36415f,_0xccb497);if(_0x512123[0x0]===null)return null;const _0x2c1e6d=_0x512123[0x1];if(isNaN(_0x2c1e6d))return null;let _0x30faea;if(_0x512123[_0x1f0449(0x132)]===0x3)_0x30faea=_0x512123[0x0][_0x1f0449(0x1fb)](_0x512123[0x2]);else _0x30faea=_0x30faea=_0x512123[0x0]['split']('\x20');if(_0x2c1e6d<=_0x30faea[_0x1f0449(0x132)])return _0x30faea[_0x2c1e6d-0x1];else return'';}case _0x1f0449(0x1c3):{const [_0x3d3a8c]=_0x2b2a20(_0x512123[0x0]);if(_0x3d3a8c)_0x512123[0x0]=await _0x43152a(_0x15e727,_0x10bf9b,_0x36415f,_0x3d3a8c);if(_0x512123[0x0]===null)return null;if(_0x512123[_0x1f0449(0x132)]!==0x3)return null;return _0x512123[0x0][_0x1f0449(0x146)](_0x512123[0x1],_0x512123[0x2]);}case'normalize':{if(_0x512123[_0x1f0449(0x132)]!==0x1)return null;const [_0x5070c2]=_0x2b2a20(_0x512123[0x0]);if(_0x5070c2)_0x512123[0x0]=await _0x43152a(_0x15e727,_0x10bf9b,_0x36415f,_0x5070c2);if(_0x512123[0x0]===null)return null;return ascii127['foldReplacing'](_0x512123[0x0]);}case _0x1f0449(0x16e):{let _0x22d705='';for(let _0x12c98e=0x0;_0x12c98e<_0x512123[_0x1f0449(0x132)];_0x12c98e++){const [_0x59226d]=_0x2b2a20(_0x512123[_0x12c98e]);if(_0x59226d)_0x512123[_0x12c98e]=await _0x43152a(_0x15e727,_0x10bf9b,_0x36415f,_0x59226d);if(_0x512123[_0x12c98e]===null)return null;_0x22d705+=_0x512123[_0x12c98e];}return _0x22d705;}case _0x1f0449(0x10b):{if(_0x512123[_0x1f0449(0x132)]>0x2)return null;const [_0x5267f9]=_0x2b2a20(_0x512123[0x0]);if(_0x5267f9)_0x512123[0x0]=await _0x43152a(_0x15e727,_0x10bf9b,_0x36415f,_0x5267f9);if(_0x512123[0x0]===null)return null;const _0x57fae9=parseInt(_0x512123[0x0]);if(isNaN(_0x57fae9))return null;let _0x504fb5=_0x1f0449(0x1ae);_0x504fb5+=','+_0x512123[0x0];if(_0x512123[_0x1f0449(0x132)]===0x2&&_0x512123[0x1][_0x1f0449(0x1a6)]()===_0x1f0449(0xfc))_0x504fb5+=_0x1f0449(0x1f0);else _0x504fb5+=_0x1f0449(0x175);return _0x504fb5+='##',_0x504fb5;}case'getuniquevalue':{if(_0x512123[_0x1f0449(0x132)]!==0x1)return null;const [_0x211e4c]=_0x2b2a20(_0x512123[0x0]);if(_0x211e4c)_0x512123[0x0]=await _0x43152a(_0x15e727,_0x10bf9b,_0x36415f,_0x211e4c);if(_0x512123[0x0]===null)return null;let _0x37449c,_0x18f1e3=![],_0x4a05a8='';const _0xe3a122=_0x512123[0x0][_0x1f0449(0x1fb)]('##');if(_0xe3a122[_0x1f0449(0x132)]>0x2)for(let _0x35c7a2=0x0;_0x35c7a2<_0xe3a122[_0x1f0449(0x132)];_0x35c7a2++){if(_0xe3a122[_0x35c7a2]['startsWith']('doIncrement')){const _0x1dc9a7=_0xe3a122[_0x35c7a2]['split'](',');if(_0x1dc9a7[_0x1f0449(0x132)]<0x2)return null;const _0x2110e5=parseInt(_0x1dc9a7[0x1]);if(isNaN(_0x2110e5))return null;_0x4a05a8='##'+_0xe3a122[_0x35c7a2]+'##',_0x37449c=_0x1dc9a7[0x1],_0x1dc9a7[_0x1f0449(0x132)]>0x2&&(_0x18f1e3=_0x1dc9a7[0x2][_0x1f0449(0x1a6)]()==='true');}}let _0x469b83,_0x43591b=0x0,_0xd9e08f=0x0;if(_0x37449c){_0xd9e08f=_0x37449c['length'],_0x43591b=0xa;for(let _0x51521b=0x1;_0x51521b<_0xd9e08f;_0x51521b++){_0x43591b*=0xa;}_0x43591b-=0x1,_0x469b83=parseInt(_0x37449c);if(isNaN(_0x469b83))return null;_0x469b83-=0x1;}else _0x469b83=0x0;do{_0x469b83+=0x1;let _0x5e7786=_0x512123[0x0];if(_0x37449c!==undefined&&_0x4a05a8){let _0x2838f5=_0x469b83[_0x1f0449(0x126)]();while(_0x2838f5[_0x1f0449(0x132)]<_0xd9e08f){_0x2838f5='0'+_0x2838f5;}_0x18f1e3?_0x5e7786=_0x5e7786[_0x1f0449(0x1c3)](_0x4a05a8,_0x2838f5):(_0x5e7786=_0x5e7786[_0x1f0449(0x1c3)](_0x4a05a8,''),_0x18f1e3=!![],_0x469b83-=0x1);}try{const _0x43bc7f=await _0x89d8a4(_0x15e727,_0x36415f,_0x5e7786);if(!_0x43bc7f)return _0x5e7786;}catch(_0xbe7821){return _0x5bf57b['logger'][_0x1f0449(0x110)](_0x5bf57b[_0x1f0449(0x153)]+'['+_0x5bf57b[_0x1f0449(0x107)]+']\x20'+_0x44779b+_0x1f0449(0x14c)+_0xbe7821['message']),null;}}while(_0x469b83<_0x43591b);return null;}default:}return null;},_0x560744=async(_0x48e136,_0x842d66)=>{const _0x1ff97f=_0x4537e7;for(const _0x4aaedb in _0x842d66){const _0x3377a5=_0x842d66[_0x4aaedb],[_0x237444,_0x3c6c90]=_0x2b2a20(_0x3377a5);if(_0x237444){const _0x231177=''+_0x4aaedb,_0xc63d5c=_0x237444+'('+_0x3c6c90[_0x1ff97f(0x16e)](',')+')',_0x1c6ffe=await _0x43152a(_0x48e136,_0x842d66,_0x231177,_0xc63d5c);if(_0x1c6ffe===null)delete _0x842d66[_0x4aaedb];else _0x842d66[_0x4aaedb]=_0x1c6ffe;}for(const _0x4f67e1 in _0x3377a5){const _0x43421b=_0x3377a5[_0x4f67e1],[_0x3d9587,_0x2b91ad]=_0x2b2a20(_0x43421b);if(_0x3d9587){const _0x281916=_0x4aaedb+'.'+_0x4f67e1,_0x186c45=_0x3d9587+'('+_0x2b91ad[_0x1ff97f(0x16e)](',')+')',_0x5a96ae=await _0x43152a(_0x48e136,_0x842d66,_0x281916,_0x186c45);if(_0x5a96ae===null)delete _0x3377a5[_0x4f67e1];else _0x3377a5[_0x4f67e1]=_0x5a96ae;}}}return _0x842d66;};},module[a0_0x5a0f4d(0x1e1)][a0_0x5a0f4d(0x13d)]=function(_0x3263a7){const _0x2e4f1b=a0_0x5a0f4d,_0x5aff94=_0x3263a7,_0x492bb1={},_0x1088d2=async(_0x217308,_0x19b923)=>{const _0x5cafc4=a0_0xf886,_0x21ec28=_0x492bb1[_0x217308][_0x5cafc4(0x161)]?.[_0x5cafc4(0x1f2)]?.[_0x5cafc4(0xed)];let _0x4c4e83=0x0;for await(const _0x45d603 of _0x19b923[_0x5cafc4(0xfa)]()){switch(_0x45d603['type']){case nats[_0x5cafc4(0x1fd)]['Disconnect']:_0x5aff94['logger'][_0x5cafc4(0x110)](_0x5aff94['gwName']+'['+_0x5aff94[_0x5cafc4(0x107)]+_0x5cafc4(0x1a7)+_0x217308+']['+_0x21ec28+_0x5cafc4(0x1ff)+_0x45d603['data']+'\x20-\x20will\x20do\x20auto\x20reconnect\x20when\x20connection\x20becomes\x20available'),_0x4c4e83=0x0;break;case nats['Events'][_0x5cafc4(0x18a)]:_0x5aff94[_0x5cafc4(0x14a)][_0x5cafc4(0x1e4)](_0x5aff94['gwName']+'['+_0x5aff94['pluginName']+_0x5cafc4(0x1a7)+_0x217308+']['+_0x21ec28+']\x20client\x20reconnected\x20'+_0x45d603[_0x5cafc4(0x162)]);break;case nats[_0x5cafc4(0x1fd)][_0x5cafc4(0x11c)]:_0x5aff94[_0x5cafc4(0x14a)][_0x5cafc4(0x110)](_0x5aff94['gwName']+'['+_0x5aff94[_0x5cafc4(0x107)]+']\x20publisher['+_0x217308+']['+_0x21ec28+_0x5cafc4(0x204)+_0x45d603[_0x5cafc4(0x162)]);break;case nats[_0x5cafc4(0x1c2)]['Reconnecting']:_0x4c4e83+=0x1;_0x4c4e83%0x1e===0x0&&_0x5aff94[_0x5cafc4(0x14a)][_0x5cafc4(0x118)](_0x5aff94[_0x5cafc4(0x153)]+'['+_0x5aff94[_0x5cafc4(0x107)]+']\x20publisher['+_0x217308+']['+_0x21ec28+_0x5cafc4(0x1aa)+_0x45d603[_0x5cafc4(0x162)]+_0x5cafc4(0x1a4)+_0x4c4e83+')');break;case nats[_0x5cafc4(0x1c2)][_0x5cafc4(0x145)]:_0x5aff94[_0x5cafc4(0x14a)][_0x5cafc4(0x118)](_0x5aff94[_0x5cafc4(0x153)]+'['+_0x5aff94[_0x5cafc4(0x107)]+_0x5cafc4(0x1a7)+_0x217308+']['+_0x21ec28+_0x5cafc4(0x1d8)+_0x45d603[_0x5cafc4(0x162)]);break;}}},_0x21f65d=async(_0x4446a3,_0x36ec9e)=>{const _0x4d4435=a0_0xf886,_0x275901=_0x492bb1[_0x4446a3][_0x4d4435(0x161)]?.[_0x4d4435(0x1f2)]?.[_0x4d4435(0xed)];let _0x458501;try{_0x458501=await nats[_0x4d4435(0x150)](_0x36ec9e);if(_0x458501[_0x4d4435(0x1e4)][_0x4d4435(0x1bf)]!==_0x4d4435(0x1ec)){_0x458501['close']();return;}_0x492bb1[_0x4446a3]['nc']=_0x458501,_0x1088d2(_0x4446a3,_0x458501);}catch(_0x37c7e9){_0x5aff94[_0x4d4435(0x14a)][_0x4d4435(0x110)](_0x5aff94[_0x4d4435(0x153)]+'['+_0x5aff94[_0x4d4435(0x107)]+']\x20publisher['+_0x4446a3+']['+_0x275901+_0x4d4435(0x13a)+_0x37c7e9[_0x4d4435(0x15d)]+'\x20-\x20will\x20do\x20auto\x20connect\x20when\x20available\x20-\x20however,\x20please\x20verify\x20stream\x20configuration'),_0x36ec9e[_0x4d4435(0x199)]=!![];try{_0x458501=await nats['connect'](_0x36ec9e);if(_0x458501[_0x4d4435(0x1e4)][_0x4d4435(0x1bf)]!=='SCIM\x20Stream'){_0x458501['close']();return;}_0x492bb1[_0x4446a3]['nc']=_0x458501,_0x1088d2(_0x4446a3,_0x458501);}catch(_0x5812c7){_0x5aff94['logger'][_0x4d4435(0x110)](_0x5aff94[_0x4d4435(0x153)]+'['+_0x5aff94[_0x4d4435(0x107)]+_0x4d4435(0x1a7)+_0x4446a3+']['+_0x275901+_0x4d4435(0x13a)+_0x5812c7[_0x4d4435(0x15d)]);return;}}_0x5aff94[_0x4d4435(0x14a)][_0x4d4435(0x118)](_0x5aff94[_0x4d4435(0x153)]+'['+_0x5aff94['pluginName']+_0x4d4435(0x1a7)+_0x4446a3+']['+_0x275901+']\x20connected\x20'+(_0x36ec9e[_0x4d4435(0x1fe)]['ca']?_0x4d4435(0x1fe):'')+'\x20'+_0x458501[_0x4d4435(0x209)]()),_0x458501[_0x4d4435(0x1e7)]()['then'](_0x2cf481=>{const _0x248d47=_0x4d4435;_0x2cf481&&_0x5aff94[_0x248d47(0x14a)][_0x248d47(0x110)](_0x5aff94[_0x248d47(0x153)]+'['+_0x5aff94[_0x248d47(0x107)]+_0x248d47(0x1a7)+_0x4446a3+']['+_0x275901+_0x248d47(0x1c7)+_0x2cf481[_0x248d47(0x15d)]);});};this['add']=async(_0x263fd6,_0x301ea1)=>{const _0x5319c2=a0_0xf886;if(!_0x301ea1?.[_0x5319c2(0x1f2)]){_0x5aff94[_0x5319c2(0x14a)]['error'](_0x5aff94[_0x5319c2(0x153)]+'['+_0x5aff94[_0x5319c2(0x107)]+_0x5319c2(0x1a7)+_0x263fd6+_0x5319c2(0x19b));return;}if(!_0x301ea1?.[_0x5319c2(0x1f2)]?.[_0x5319c2(0x1d4)]){_0x5aff94[_0x5319c2(0x14a)][_0x5319c2(0x110)](_0x5aff94[_0x5319c2(0x153)]+'['+_0x5aff94[_0x5319c2(0x107)]+_0x5319c2(0x1a7)+_0x263fd6+_0x5319c2(0x17f));return;}if(!_0x301ea1?.[_0x5319c2(0x1f2)]?.[_0x5319c2(0xed)]){_0x5aff94[_0x5319c2(0x14a)]['error'](_0x5aff94[_0x5319c2(0x153)]+'['+_0x5aff94[_0x5319c2(0x107)]+']\x20publisher['+_0x263fd6+']\x20initialization\x20error:\x20missing\x20configuration\x20nats.subject');return;}if(!_0x301ea1?.['nats']?.[_0x5319c2(0xed)][_0x5319c2(0x1ce)](_0x5319c2(0x17b))){_0x5aff94[_0x5319c2(0x14a)]['error'](_0x5aff94[_0x5319c2(0x153)]+'['+_0x5aff94[_0x5319c2(0x107)]+_0x5319c2(0x1a7)+_0x263fd6+_0x5319c2(0x1f9));return;}if(!_0x301ea1['baseUrls']||!Array[_0x5319c2(0x138)](_0x301ea1[_0x5319c2(0x135)])||_0x301ea1[_0x5319c2(0x135)][_0x5319c2(0x132)]<0x1){_0x5aff94[_0x5319c2(0x14a)][_0x5319c2(0x110)](_0x5aff94[_0x5319c2(0x153)]+'['+_0x5aff94[_0x5319c2(0x107)]+_0x5319c2(0x1a7)+_0x263fd6+_0x5319c2(0x1e6));return;}if(!_0x301ea1?.[_0x5319c2(0xf8)]?.['ca']){_0x5aff94[_0x5319c2(0x14a)][_0x5319c2(0x110)](_0x5aff94[_0x5319c2(0x153)]+'['+_0x5aff94[_0x5319c2(0x107)]+_0x5319c2(0x1a7)+_0x263fd6+_0x5319c2(0x157));return;}const _0x2863d1={};try{let _0x4b00e3=path[_0x5319c2(0x16e)](_0x5aff94[_0x5319c2(0x1f3)],_0x5319c2(0x143),_0x301ea1?.[_0x5319c2(0xf8)]?.['ca']||_0x5319c2(0x127));(_0x301ea1?.[_0x5319c2(0xf8)]?.['ca']?.['startsWith']('/')||_0x301ea1?.['certificate']?.['ca']?.[_0x5319c2(0x1a5)]('\x5c'))&&(_0x4b00e3=_0x301ea1[_0x5319c2(0xf8)]['ca']),_0x2863d1['ca']=[fs['readFileSync'](_0x4b00e3)],_0x2863d1[_0x5319c2(0x11e)]=!![];}catch(_0x254fab){_0x5aff94['logger']['error'](_0x5aff94[_0x5319c2(0x153)]+'['+_0x5aff94[_0x5319c2(0x107)]+_0x5319c2(0x1a7)+_0x263fd6+_0x5319c2(0x139)+_0x254fab[_0x5319c2(0x15d)]);return;}const _0x53a61a={},_0x2d6e43=new TextEncoder()['encode'](_0x301ea1?.[_0x5319c2(0x1f2)]?.[_0x5319c2(0xfb)]),_0x3c0ff1=_0x301ea1?.[_0x5319c2(0x1f2)]?.[_0x5319c2(0x18e)];_0x53a61a[_0x5319c2(0x1f5)]=nats[_0x5319c2(0x154)](_0x3c0ff1,_0x2d6e43),_0x53a61a['servers']=_0x301ea1[_0x5319c2(0x135)],_0x53a61a[_0x5319c2(0x1fe)]=_0x2863d1,_0x53a61a[_0x5319c2(0x199)]=![],_0x53a61a[_0x5319c2(0x112)]=!![],_0x53a61a[_0x5319c2(0x173)]=0x3e8*0xa,_0x53a61a['maxReconnectAttempts']=-0x1,_0x53a61a['pingInterval']=0x2*0x3c*0x3e8,_0x53a61a[_0x5319c2(0x1c9)]=0x5,_0x53a61a[_0x5319c2(0x118)]=![],_0x492bb1[_0x263fd6]={},_0x492bb1[_0x263fd6]['config']=_0x301ea1,_0x492bb1[_0x263fd6]['nc']=undefined,_0x21f65d(_0x263fd6,_0x53a61a);};const _0x1dc85a=nats[_0x2e4f1b(0x189)]();this[_0x2e4f1b(0x137)]=async _0x19b4e5=>{const _0x17f6c4=_0x2e4f1b;let _0x3e4915;try{if(_0x19b4e5[_0x17f6c4(0x141)]===Object){_0x3e4915=_0x19b4e5[_0x17f6c4(0x1bb)];if(!_0x3e4915)_0x19b4e5[_0x17f6c4(0x1bb)]=_0x17f6c4(0x1c1);_0x19b4e5=JSON[_0x17f6c4(0x102)](_0x19b4e5);}else{const _0x3b7a3b=JSON['parse'](_0x19b4e5);_0x3e4915=_0x3b7a3b[_0x17f6c4(0x1bb)];}}catch(_0x2dc6fc){throw new Error(_0x17f6c4(0x151)+_0x3e4915+_0x17f6c4(0x166));}if(!_0x492bb1[_0x3e4915])throw new Error(_0x17f6c4(0x151)+_0x3e4915+_0x17f6c4(0x167)+_0x3e4915);const _0x55970f=nats[_0x17f6c4(0x1ad)]();_0x55970f[_0x17f6c4(0x1b1)](_0x17f6c4(0x108),crypto[_0x17f6c4(0x13f)]());let _0xdf1103;try{if(!_0x492bb1[_0x3e4915]['nc'])throw new Error(_0x17f6c4(0x200));_0xdf1103=await _0x492bb1[_0x3e4915]['nc'][_0x17f6c4(0x114)](_0x492bb1[_0x3e4915][_0x17f6c4(0x161)]?.[_0x17f6c4(0x1f2)]?.[_0x17f6c4(0xed)],_0x1dc85a[_0x17f6c4(0x187)](_0x19b4e5),{'headers':_0x55970f});}catch(_0x125993){if(_0x125993[_0x17f6c4(0x15d)]===_0x17f6c4(0x1f1))throw new Error(_0x17f6c4(0x151)+_0x3e4915+']\x20error:\x20no\x20subscribers/responders\x20to\x20subject\x20'+_0x492bb1[_0x3e4915]['config']?.[_0x17f6c4(0x1f2)]?.['subject']);else throw new Error('publisher['+_0x3e4915+_0x17f6c4(0x1b5)+_0x125993[_0x17f6c4(0x15d)]);}let _0xf3d22a;try{_0xf3d22a=JSON[_0x17f6c4(0x117)](_0xdf1103['string']());}catch(_0x569d32){throw new Error(_0x17f6c4(0x16c)+_0xdf1103[_0x17f6c4(0x1cc)]());}if(_0xf3d22a?.['error']){const _0x6d3343=new Error(_0x17f6c4(0x1ea)+_0xf3d22a[_0x17f6c4(0x110)]);_0x6d3343[_0x17f6c4(0x124)]=_0xf3d22a[_0x17f6c4(0x195)];throw _0x6d3343;}return _0xf3d22a;},process['on']('SIGTERM',async()=>{const _0x33ba80=_0x2e4f1b;for(const _0xcea122 in _0x492bb1){_0x492bb1[_0xcea122]['nc']&&!_0x492bb1[_0xcea122]['nc']['isClosed']()&&await _0x492bb1[_0xcea122]['nc'][_0x33ba80(0x1ca)]();}}),process['on'](_0x2e4f1b(0x155),async()=>{const _0x5cbd04=_0x2e4f1b;for(const _0x5c74c4 in _0x492bb1){_0x492bb1[_0x5c74c4]['nc']&&!_0x492bb1[_0x5c74c4]['nc']['isClosed']()&&await _0x492bb1[_0x5c74c4]['nc'][_0x5cbd04(0x1ca)]();}});},module[a0_0x5a0f4d(0x1e1)][a0_0x5a0f4d(0x16d)]=async(_0x2b519f,_0x1f8042,_0x2ecc73,_0x478615)=>{const _0x182c05=a0_0x5a0f4d,_0x501b22='getAppRoles',_0x2c5296=_0x2b519f;_0x2c5296[_0x182c05(0x14a)][_0x182c05(0x118)](_0x2c5296['gwName']+'['+_0x2c5296[_0x182c05(0x107)]+_0x182c05(0x10d)+_0x501b22+'\x22');try{if(!fs[_0x182c05(0x128)](_0x2c5296[_0x182c05(0x1f3)]+'/approles'))fs[_0x182c05(0x17e)](_0x2c5296[_0x182c05(0x1f3)]+'/approles');}catch(_0x2813ab){}const _0xd77cbf=path[_0x182c05(0x16e)](''+_0x2c5296[_0x182c05(0x1f3)],_0x182c05(0x1ac),_0x182c05(0x207)+_0x2c5296[_0x182c05(0x107)]+_0x182c05(0x1dd)),_0x1ea007={};utils['fsExistsSync'](_0xd77cbf)&&fs[_0x182c05(0x1b4)](_0xd77cbf,_0x182c05(0x208))[_0x182c05(0x1fb)](/\r?\n/)[_0x182c05(0x159)](_0x3a8038=>{const _0x40ce79=_0x182c05,_0x34e53b=_0x3a8038['split']('\x20');_0x34e53b[_0x40ce79(0x132)]===0x2&&(_0x1ea007[_0x34e53b[0x0]]=_0x34e53b[0x1]);});const _0x1d719d=fs[_0x182c05(0x1de)](_0xd77cbf,{'flags':'w','encoding':'utf8','mode':0x1b6,'autoClose':!![]}),_0x36dc31=[],_0x21e161=await _0x2c5296[_0x182c05(0x116)](_0x1f8042,{'attribute':undefined,'operator':undefined,'value':undefined},['id',_0x182c05(0x105)]);return _0x21e161[_0x182c05(0x1f6)][_0x182c05(0x159)](_0x100826=>{const _0x49c36d=_0x182c05;if(_0x100826['id']){let _0x5a3332=crypto['randomUUID']();if(_0x1ea007[_0x100826['id']])_0x5a3332=_0x1ea007[_0x100826['id']];const _0x18c885={'allowedMemberTypes':[_0x49c36d(0x176)],'description':_0x49c36d(0x19e),'displayName':_0x100826[_0x49c36d(0x105)]||_0x100826['id'],'id':_0x5a3332,'isEnabled':!![],'lang':null,'origin':_0x49c36d(0x119),'value':decodeURIComponent(_0x100826['id'])};_0x36dc31[_0x49c36d(0x16f)](_0x18c885),_0x1d719d[_0x49c36d(0x1a9)](_0x100826['id']+'\x20'+_0x5a3332+'\x0a');}}),_0x1d719d['close'](),_0x2c5296[_0x182c05(0x14a)][_0x182c05(0x118)](_0x2c5296['gwName']+'['+_0x2c5296['pluginName']+']\x20approle\x20uuid\x20file\x20created:\x20'+_0xd77cbf),{'Resources':[{'appRoles':_0x36dc31}]};};
|
package/lib/scimgateway.js
CHANGED
|
@@ -367,8 +367,8 @@ const ScimGateway = function () {
|
|
|
367
367
|
ctx.response.body = { error: 'Access denied' }
|
|
368
368
|
res.body = ctx.response.body
|
|
369
369
|
}
|
|
370
|
-
logger.error(`${gwName}[${pluginName}] ${ellapsed} ${ctx.request.ip} ${userName} ${ctx.request.method} ${ctx.request.href} Inbound = ${JSON.stringify(ctx.request.body)} Outbound = ${JSON.stringify(res)}${(config.log.loglevel.file === 'debug' && ctx.request.url !== '/ping') ? '\n' : ''}`)
|
|
371
|
-
} else logger.info(`${gwName}[${pluginName}] ${ellapsed} ${ctx.request.ip} ${userName} ${ctx.request.method} ${ctx.request.href} Inbound = ${JSON.stringify(ctx.request.body)} Outbound = ${JSON.stringify(res)}${(config.log.loglevel.file === 'debug' && ctx.request.url !== '/ping') ? '\n' : ''}`)
|
|
370
|
+
logger.error(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] ${ellapsed} ${ctx.request.ip} ${userName} ${ctx.request.method} ${ctx.request.href} Inbound = ${JSON.stringify(ctx.request.body)} Outbound = ${JSON.stringify(res)}${(config.log.loglevel.file === 'debug' && ctx.request.url !== '/ping') ? '\n' : ''}`)
|
|
371
|
+
} else logger.info(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] ${ellapsed} ${ctx.request.ip} ${userName} ${ctx.request.method} ${ctx.request.href} Inbound = ${JSON.stringify(ctx.request.body)} Outbound = ${JSON.stringify(res)}${(config.log.loglevel.file === 'debug' && ctx.request.url !== '/ping') ? '\n' : ''}`)
|
|
372
372
|
requestCounter += 1 // logged on exit (not win process termination)
|
|
373
373
|
if (ctx.response.body && typeof ctx.response.body === 'object' && ctx.response.status !== 401) ctx.set('Content-Type', 'application/scim+json; charset=utf-8')
|
|
374
374
|
}
|
|
@@ -579,15 +579,15 @@ const ScimGateway = function () {
|
|
|
579
579
|
if (authType.length < 1) err = new Error(`${ctx.url} request is missing authentication information`)
|
|
580
580
|
else {
|
|
581
581
|
err = new Error(`${ctx.url} request having unsupported authentication or plugin configuration is missing`)
|
|
582
|
-
logger.debug(`${gwName}[${pluginName}] request authToken = ${authToken}`)
|
|
583
|
-
logger.debug(`${gwName}[${pluginName}] request jwt.decode(authToken) = ${JSON.stringify(jwt.decode(authToken))}`)
|
|
582
|
+
logger.debug(`${gwName}[${pluginName}][${baseEntity}] request authToken = ${authToken}`)
|
|
583
|
+
logger.debug(`${gwName}[${pluginName}][${baseEntity}] request jwt.decode(authToken) = ${JSON.stringify(jwt.decode(authToken))}`)
|
|
584
584
|
}
|
|
585
585
|
if (authType === 'Bearer') ctx.set('WWW-Authenticate', 'Bearer realm=""')
|
|
586
586
|
else if (foundBasic) ctx.set('WWW-Authenticate', 'Basic realm=""')
|
|
587
587
|
ctx.set('Content-Type', 'application/json; charset=utf-8')
|
|
588
588
|
ctx.status = 401
|
|
589
589
|
ctx.body = { error: 'Access denied' }
|
|
590
|
-
if (ctx.url !== '/favicon.ico') logger.error(`${gwName}[${pluginName}] ${err.message}`)
|
|
590
|
+
if (ctx.url !== '/favicon.ico') logger.error(`${gwName}[${pluginName}][${baseEntity}] ${err.message}`)
|
|
591
591
|
} catch (err) {
|
|
592
592
|
const body = {}
|
|
593
593
|
if (authType === 'Bearer') {
|
|
@@ -608,9 +608,9 @@ const ScimGateway = function () {
|
|
|
608
608
|
else ctx.body = { error: 'Access denied' }
|
|
609
609
|
if (pwErrCount < 3) {
|
|
610
610
|
pwErrCount += 1
|
|
611
|
-
logger.error(`${gwName}[${pluginName}] ${ctx.url} ${err.message}`)
|
|
611
|
+
logger.error(`${gwName}[${pluginName}][${baseEntity}] ${ctx.url} ${err.message}`)
|
|
612
612
|
} else { // delay brute force attempts
|
|
613
|
-
logger.error(`${gwName}[${pluginName}] ${ctx.url} ${err.message} => delaying response with 2 minutes to prevent brute force`)
|
|
613
|
+
logger.error(`${gwName}[${pluginName}][${baseEntity}] ${ctx.url} ${err.message} => delaying response with 2 minutes to prevent brute force`)
|
|
614
614
|
return new Promise((resolve) => {
|
|
615
615
|
setTimeout(() => {
|
|
616
616
|
resolve(ctx)
|
|
@@ -638,7 +638,7 @@ const ScimGateway = function () {
|
|
|
638
638
|
return new Promise((resolve) => {
|
|
639
639
|
if (!ipAllowListChecker) return resolve(next())
|
|
640
640
|
if (ipAllowListChecker(ctx.request.ip)) return resolve(next()) // if proxy, prereq: request includes header X-Forwarded-For and koa app.proxy=true
|
|
641
|
-
logger.debug(`${gwName}[${pluginName}] client ip ${ctx.request.ip} not in ipAllowList`)
|
|
641
|
+
logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] client ip ${ctx.request.ip} not in ipAllowList`)
|
|
642
642
|
ctx.status = 401
|
|
643
643
|
ctx.body = { error: 'Access denied' }
|
|
644
644
|
resolve(ctx)
|
|
@@ -664,7 +664,7 @@ const ScimGateway = function () {
|
|
|
664
664
|
app.use(router.allowedMethods())
|
|
665
665
|
|
|
666
666
|
app.on('error', (err, ctx) => { // catching none try/catch in app middleware, also bodyparser and body not json
|
|
667
|
-
logger.error(`${gwName}[${pluginName}] Koa method: ${ctx.method} url: ${ctx.request.origin + ctx.path} body: ${JSON.stringify(ctx.request.body)} error: ${err.message}`)
|
|
667
|
+
logger.error(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] Koa method: ${ctx.method} url: ${ctx.request.origin + ctx.path} body: ${JSON.stringify(ctx.request.body)} error: ${err.message}`)
|
|
668
668
|
})
|
|
669
669
|
|
|
670
670
|
router.get('/ping', async (ctx) => { // auth not required
|
|
@@ -699,7 +699,7 @@ const ScimGateway = function () {
|
|
|
699
699
|
}
|
|
700
700
|
}
|
|
701
701
|
ctx.body = tx
|
|
702
|
-
logger.debug(`${gwName}[${pluginName}] GET ${ctx.request.originalUrl} Response = ${JSON.stringify(tx)}`)
|
|
702
|
+
logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] GET ${ctx.request.originalUrl} Response = ${JSON.stringify(tx)}`)
|
|
703
703
|
})
|
|
704
704
|
|
|
705
705
|
// Initial connection, step #2: GET /Schemas
|
|
@@ -712,9 +712,9 @@ const ScimGateway = function () {
|
|
|
712
712
|
|
|
713
713
|
// oauth token request
|
|
714
714
|
router.post(['/(|scim/)oauth/token', '/:baseEntity/(|scim/)oauth/token'], async (ctx) => {
|
|
715
|
-
logger.debug(`${gwName}[${pluginName}] [oauth] token request`)
|
|
715
|
+
logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] [oauth] token request`)
|
|
716
716
|
if (!foundBearerOAuth) {
|
|
717
|
-
logger.error(`${gwName}[${pluginName}] [oauth] token request, but plugin is missing config.auth.bearerOAuth configuration`)
|
|
717
|
+
logger.error(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] [oauth] token request, but plugin is missing config.auth.bearerOAuth configuration`)
|
|
718
718
|
ctx.status = 500
|
|
719
719
|
return
|
|
720
720
|
}
|
|
@@ -762,7 +762,7 @@ const ScimGateway = function () {
|
|
|
762
762
|
if (pwErrCount < 3) {
|
|
763
763
|
pwErrCount += 1
|
|
764
764
|
} else { // delay brute force attempts
|
|
765
|
-
logger.error(`${gwName}[${pluginName}] [oauth] ${ctx.url} ${errDescr} => delaying response with 2 minutes to prevent brute force`)
|
|
765
|
+
logger.error(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] [oauth] ${ctx.url} ${errDescr} => delaying response with 2 minutes to prevent brute force`)
|
|
766
766
|
return new Promise((resolve) => {
|
|
767
767
|
setTimeout(() => {
|
|
768
768
|
resolve(ctx)
|
|
@@ -773,7 +773,7 @@ const ScimGateway = function () {
|
|
|
773
773
|
}
|
|
774
774
|
|
|
775
775
|
if (err) {
|
|
776
|
-
logger.error(`${gwName}[${pluginName}] [oauth] token request client_id: ${jsonBody ? jsonBody.client_id : ''} error: ${errDescr}`)
|
|
776
|
+
logger.error(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] [oauth] token request client_id: ${jsonBody ? jsonBody.client_id : ''} error: ${errDescr}`)
|
|
777
777
|
ctx.status = 400
|
|
778
778
|
ctx.body = {
|
|
779
779
|
error: err,
|
|
@@ -855,7 +855,7 @@ const ScimGateway = function () {
|
|
|
855
855
|
value: id
|
|
856
856
|
}
|
|
857
857
|
|
|
858
|
-
logger.debug(`${gwName}[${pluginName}] [Get ${handle.description}s] ${getObj.attribute}=${getObj.value}`)
|
|
858
|
+
logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] [Get ${handle.description}s] ${getObj.attribute}=${getObj.value}`)
|
|
859
859
|
|
|
860
860
|
let res
|
|
861
861
|
try {
|
|
@@ -869,10 +869,10 @@ const ScimGateway = function () {
|
|
|
869
869
|
attributes,
|
|
870
870
|
ctxPassThrough: ctx.passThrough
|
|
871
871
|
}
|
|
872
|
-
logger.debug(`${gwName}[${pluginName}] publishing "${handle.getMethod}" to SCIM Stream and awaiting result`)
|
|
872
|
+
logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] publishing "${handle.getMethod}" to SCIM Stream and awaiting result`)
|
|
873
873
|
res = await this.publish(streamObj)
|
|
874
874
|
} else {
|
|
875
|
-
logger.debug(`${gwName}[${pluginName}] calling "${handle.getMethod}" and awaiting result`)
|
|
875
|
+
logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] calling "${handle.getMethod}" and awaiting result`)
|
|
876
876
|
res = await this[handle.getMethod](ctx.params.baseEntity, ob, attributes, ctx.passThrough)
|
|
877
877
|
}
|
|
878
878
|
|
|
@@ -896,46 +896,19 @@ const ScimGateway = function () {
|
|
|
896
896
|
ctx.body = e
|
|
897
897
|
return
|
|
898
898
|
}
|
|
899
|
+
let userObj = scimdata.Resources[0]
|
|
899
900
|
|
|
900
901
|
// check for user attribute groups and include if needed
|
|
901
|
-
|
|
902
|
-
if (handle.getMethod === handler.users.getMethod && Object.keys(userObj).length > 0 && !userObj.groups && !config.scim.groupMemberOfUser) { // groupMemberOfUser can be set to true for skipping
|
|
902
|
+
if (handle.getMethod === handler.users.getMethod && Object.keys(userObj).length > 0) {
|
|
903
903
|
let arrAttr = []
|
|
904
904
|
if (ctx.query.attributes) arrAttr = ctx.query.attributes.split(',')
|
|
905
|
-
if ((!ctx.query.attributes || arrAttr.includes('groups'))
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
const ob = { attribute: 'members.value', operator: 'eq', value: decodeURIComponent(getObj.value) }
|
|
909
|
-
const attributes = ['id', 'displayName']
|
|
910
|
-
if (config.stream.publisher.enabled) {
|
|
911
|
-
const streamObj = {
|
|
912
|
-
handle: handler.groups.getMethod,
|
|
913
|
-
baseEntity: ctx.params.baseEntity,
|
|
914
|
-
obj: ob,
|
|
915
|
-
attributes,
|
|
916
|
-
ctxPassThrough: ctx.passThrough
|
|
917
|
-
}
|
|
918
|
-
logger.debug(`${gwName}[${pluginName}] publishing "${handler.groups.getMethod}" to SCIM Stream and awaiting result - groups to be included`)
|
|
919
|
-
res = await this.publish(streamObj)
|
|
920
|
-
} else {
|
|
921
|
-
logger.debug(`${gwName}[${pluginName}] calling "${handler.groups.getMethod}" and awaiting result - groups to be included`)
|
|
922
|
-
res = await this[handler.groups.getMethod](ctx.params.baseEntity, ob, attributes, ctx.passThrough)
|
|
923
|
-
}
|
|
924
|
-
} catch (err) {} // method may be implemented but throwing error like groups not supported/implemented
|
|
925
|
-
if (res && res.Resources && Array.isArray(res.Resources) && res.Resources.length > 0) {
|
|
926
|
-
userObj.groups = []
|
|
927
|
-
for (let i = 0; i < res.Resources.length; i++) {
|
|
928
|
-
if (!res.Resources[i].id) continue
|
|
929
|
-
const el = {}
|
|
930
|
-
el.value = res.Resources[i].id
|
|
931
|
-
if (res.Resources[i].displayName) el.display = res.Resources[i].displayName
|
|
932
|
-
if (isScimv2) el.type = 'direct'
|
|
933
|
-
else el.type = { value: 'direct' }
|
|
934
|
-
userObj.groups.push(el) // { "value": "Admins", "display": "Admins", "type": "direct"}
|
|
935
|
-
}
|
|
905
|
+
if ((!ctx.query.attributes || arrAttr.includes('groups'))) { // include groups
|
|
906
|
+
if (!userObj.groups && userObj.id) {
|
|
907
|
+
userObj.groups = await getMemberOf(ctx.params.baseEntity, userObj.id, handler.groups.getMethod, ctx.passThrough)
|
|
936
908
|
}
|
|
937
909
|
}
|
|
938
910
|
}
|
|
911
|
+
|
|
939
912
|
userObj = addPrimaryAttrs(userObj)
|
|
940
913
|
scimdata = utils.stripObj(userObj, ctx.query.attributes, ctx.query.excludedAttributes)
|
|
941
914
|
scimdata = addSchemas(scimdata, handle.description, isScimv2)
|
|
@@ -1095,7 +1068,7 @@ const ScimGateway = function () {
|
|
|
1095
1068
|
let info = ''
|
|
1096
1069
|
if (getObj.operator === 'eq' && ['id', 'userName', 'externalId', 'displayName', 'members.value'].includes(getObj.attribute)) info = ` ${getObj.attribute}=${getObj.value}`
|
|
1097
1070
|
|
|
1098
|
-
logger.debug(`${gwName}[${pluginName}] [Get ${handle.description}]${info}`)
|
|
1071
|
+
logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] [Get ${handle.description}]${info}`)
|
|
1099
1072
|
try {
|
|
1100
1073
|
getObj.startIndex = ctx.query.startIndex ? parseInt(ctx.query.startIndex) : undefined
|
|
1101
1074
|
getObj.count = ctx.query.count ? parseInt(ctx.query.count) : undefined
|
|
@@ -1103,21 +1076,82 @@ const ScimGateway = function () {
|
|
|
1103
1076
|
if (getObj.count && !getObj.startIndex) getObj.startIndex = 1
|
|
1104
1077
|
|
|
1105
1078
|
let res
|
|
1106
|
-
const
|
|
1079
|
+
const obj = utils.copyObj(getObj)
|
|
1107
1080
|
const attributes = ctx.query.attributes ? ctx.query.attributes.split(',').map(item => item.trim()) : []
|
|
1108
1081
|
if (config.stream.publisher.enabled) {
|
|
1109
1082
|
const streamObj = {
|
|
1110
1083
|
handle: handle.getMethod,
|
|
1111
1084
|
baseEntity: ctx.params.baseEntity,
|
|
1112
|
-
obj
|
|
1085
|
+
obj,
|
|
1113
1086
|
attributes,
|
|
1114
1087
|
ctxPassThrough: ctx.passThrough
|
|
1115
1088
|
}
|
|
1116
|
-
logger.debug(`${gwName}[${pluginName}] publishing "${handle.getMethod}" to SCIM Stream and awaiting result`)
|
|
1089
|
+
logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] publishing "${handle.getMethod}" to SCIM Stream and awaiting result`)
|
|
1117
1090
|
res = await this.publish(streamObj)
|
|
1118
1091
|
} else {
|
|
1119
|
-
|
|
1120
|
-
|
|
1092
|
+
if (!obj.operator && obj.rawFilter && obj.rawFilter.includes(' or ')) {
|
|
1093
|
+
// advanced filtering using or logic - used by One Identity Manager
|
|
1094
|
+
// e.g.: (id eq "bjensen") or (id eq "jsmith")
|
|
1095
|
+
// handled by scimgateway instead of plugins if supported operator being used
|
|
1096
|
+
const arr = obj.rawFilter.split(' or ')
|
|
1097
|
+
let getObjArr = []
|
|
1098
|
+
for (let i = 0; i < arr.length; i++) {
|
|
1099
|
+
arr[i] = arr[i].replace(/\(/g, '').replace(/\)/g, '').trim()
|
|
1100
|
+
const arrFilter = arr[i].split(' ')
|
|
1101
|
+
if (arrFilter.length === 3 || (arrFilter.length > 2 && arrFilter[2].startsWith('"') && arrFilter[arrFilter.length - 1].endsWith('"'))) {
|
|
1102
|
+
const o = {}
|
|
1103
|
+
o.attribute = arrFilter[0] // id
|
|
1104
|
+
o.operator = arrFilter[1].toLowerCase() // eq
|
|
1105
|
+
o.value = decodeURIComponent(arrFilter.slice(2).join(' ').replace(/"/g, '')) // bjensen
|
|
1106
|
+
getObjArr.push(o)
|
|
1107
|
+
} else {
|
|
1108
|
+
getObjArr = []
|
|
1109
|
+
break
|
|
1110
|
+
}
|
|
1111
|
+
}
|
|
1112
|
+
if (getObjArr.length > 0) {
|
|
1113
|
+
const getObj = async (o) => {
|
|
1114
|
+
return await this[handle.getMethod](ctx.params.baseEntity, o, attributes, ctx.passThrough)
|
|
1115
|
+
}
|
|
1116
|
+
const chunk = 5
|
|
1117
|
+
const chunkRes = []
|
|
1118
|
+
logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] calling "${handle.getMethod}" with chunks and awaiting result`)
|
|
1119
|
+
do {
|
|
1120
|
+
const arrChunk = getObjArr.splice(0, chunk)
|
|
1121
|
+
const results = await Promise.allSettled(arrChunk.map((o) => getObj(o))) // processing max chunk async
|
|
1122
|
+
const errors = results.filter(result => result.status === 'rejected').map(result => result.reason.message)
|
|
1123
|
+
if (errors.length > 0) {
|
|
1124
|
+
const errMsg = `${handle.getMethod} with chunks returned errors: ${errors.join(', ')}`
|
|
1125
|
+
throw new Error(errMsg)
|
|
1126
|
+
}
|
|
1127
|
+
const arrArr = results.map(result => result?.value?.Resources)
|
|
1128
|
+
for (let i = 0; i < arrArr.length; i++) {
|
|
1129
|
+
Array.prototype.push.apply(chunkRes, arrArr[i])
|
|
1130
|
+
}
|
|
1131
|
+
} while (getObjArr.length > 0)
|
|
1132
|
+
res = { Resources: chunkRes }
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
if (!res) { // standard
|
|
1137
|
+
logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] calling "${handle.getMethod}" and awaiting result`)
|
|
1138
|
+
res = await this[handle.getMethod](ctx.params.baseEntity, obj, attributes, ctx.passThrough)
|
|
1139
|
+
}
|
|
1140
|
+
// check for user attribute groups and include if needed
|
|
1141
|
+
if (Array.isArray(res?.Resources)) {
|
|
1142
|
+
if (handle.getMethod === handler.users.getMethod) {
|
|
1143
|
+
let arrAttr = []
|
|
1144
|
+
if (ctx.query.attributes) arrAttr = ctx.query.attributes.split(',')
|
|
1145
|
+
if ((!ctx.query.attributes || arrAttr.includes('groups'))) { // include groups
|
|
1146
|
+
for (let i = 0; i < res.Resources.length; i++) {
|
|
1147
|
+
const userObj = res.Resources[i]
|
|
1148
|
+
if (!userObj.id) break
|
|
1149
|
+
if (userObj.groups) break
|
|
1150
|
+
userObj.groups = await getMemberOf(ctx.params.baseEntity, userObj.id, handler.groups.getMethod, ctx.passThrough)
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1121
1155
|
}
|
|
1122
1156
|
let scimdata = {
|
|
1123
1157
|
Resources: [],
|
|
@@ -1131,50 +1165,6 @@ const ScimGateway = function () {
|
|
|
1131
1165
|
else if (typeof (res) === 'object' && Object.keys(res).length > 0) scimdata.Resources[0] = res
|
|
1132
1166
|
}
|
|
1133
1167
|
|
|
1134
|
-
// check for user attribute groups and include if needed
|
|
1135
|
-
if (handle.getMethod === handler.users.getMethod && !config.scim.groupMemberOfUser) { // groupMemberOfUser can be set to true for skipping
|
|
1136
|
-
let arrAttr = []
|
|
1137
|
-
if (ctx.query.attributes) arrAttr = ctx.query.attributes.split(',')
|
|
1138
|
-
if ((!ctx.query.attributes || arrAttr.includes('groups')) && typeof this[handler.groups.getMethod] === 'function') { // include groups
|
|
1139
|
-
for (let j = 0; j < scimdata.Resources.length; j++) {
|
|
1140
|
-
const userObj = scimdata.Resources[j]
|
|
1141
|
-
if (!userObj.id) break
|
|
1142
|
-
if (userObj.groups) break
|
|
1143
|
-
let res
|
|
1144
|
-
try {
|
|
1145
|
-
const ob = { attribute: 'members.value', operator: 'eq', value: decodeURIComponent(userObj.id) }
|
|
1146
|
-
const attributes = ['id', 'displayName']
|
|
1147
|
-
if (config.stream.publisher.enabled) {
|
|
1148
|
-
const streamObj = {
|
|
1149
|
-
handle: handler.groups.getMethod,
|
|
1150
|
-
baseEntity: ctx.params.baseEntity,
|
|
1151
|
-
obj: ob,
|
|
1152
|
-
attributes,
|
|
1153
|
-
ctxPassThrough: ctx.passThrough
|
|
1154
|
-
}
|
|
1155
|
-
logger.debug(`${gwName}[${pluginName}] publishing "${handler.groups.getMethod}" to SCIM Stream and awaiting result - groups to be included`)
|
|
1156
|
-
res = await this.publish(streamObj)
|
|
1157
|
-
} else {
|
|
1158
|
-
logger.debug(`${gwName}[${pluginName}] calling "${handler.groups.getMethod}" and awaiting result - groups to be included`)
|
|
1159
|
-
res = await this[handler.groups.getMethod](ctx.params.baseEntity, ob, attributes, ctx.passThrough) // await scimgateway.getUserGroups(baseEntity, userObj.id, 'members.value,displayName')
|
|
1160
|
-
}
|
|
1161
|
-
} catch (err) {} // method may be implemented but throwing error like groups not supported/implemented
|
|
1162
|
-
if (res && res.Resources && Array.isArray(res.Resources) && res.Resources.length > 0) {
|
|
1163
|
-
userObj.groups = []
|
|
1164
|
-
for (let i = 0; i < res.Resources.length; i++) {
|
|
1165
|
-
if (!res.Resources[i].id) continue
|
|
1166
|
-
const el = {}
|
|
1167
|
-
el.value = res.Resources[i].id
|
|
1168
|
-
if (res.Resources[i].displayName) el.display = res.Resources[i].displayName
|
|
1169
|
-
if (isScimv2) el.type = 'direct'
|
|
1170
|
-
else el.type = { value: 'direct' }
|
|
1171
|
-
userObj.groups.push(el) // { "value": "Admins", "display": "Admins", "type": "direct"}
|
|
1172
|
-
}
|
|
1173
|
-
}
|
|
1174
|
-
}
|
|
1175
|
-
}
|
|
1176
|
-
}
|
|
1177
|
-
|
|
1178
1168
|
let location = ctx.request.origin + ctx.path
|
|
1179
1169
|
if (ctx.query.attributes || (ctx.query.excludedAttributes && ctx.query.excludedAttributes.includes('meta'))) location = null
|
|
1180
1170
|
if (config.scim.skipMetaLocation) location = null
|
|
@@ -1215,7 +1205,7 @@ const ScimGateway = function () {
|
|
|
1215
1205
|
let u = ctx.request.originalUrl.substr(ctx.request.originalUrl.lastIndexOf('/') + 1) // u = Users<.json|.xml>, Groups<.json|.xml>
|
|
1216
1206
|
u = u.split('?')[0] // Users?AzureAdScimPatch062020
|
|
1217
1207
|
const handle = handler[u.split('.')[0]]
|
|
1218
|
-
logger.debug(`${gwName}[${pluginName}] [Create ${handle.description}]`)
|
|
1208
|
+
logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] [Create ${handle.description}]`)
|
|
1219
1209
|
let jsonBody = ctx.request.body
|
|
1220
1210
|
const strBody = JSON.stringify(jsonBody)
|
|
1221
1211
|
if (strBody === '{}') {
|
|
@@ -1241,10 +1231,10 @@ const ScimGateway = function () {
|
|
|
1241
1231
|
return
|
|
1242
1232
|
}
|
|
1243
1233
|
|
|
1244
|
-
logger.debug(`${gwName}[${pluginName}] POST ${ctx.request.originalUrl} body=${strBody}`)
|
|
1234
|
+
logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] POST ${ctx.request.originalUrl} body=${strBody}`)
|
|
1245
1235
|
jsonBody = JSON.parse(strBody) // using a copy
|
|
1246
1236
|
const [scimdata, err] = ScimGateway.prototype.convertedScim(jsonBody)
|
|
1247
|
-
logger.debug(`${gwName}[${pluginName}] convertedBody=${JSON.stringify(scimdata)}`)
|
|
1237
|
+
logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] convertedBody=${JSON.stringify(scimdata)}`)
|
|
1248
1238
|
if (err) {
|
|
1249
1239
|
ctx.status = 500
|
|
1250
1240
|
const [e, customErrorCode] = jsonErr(config.scim.version, pluginName, ctx.status, err)
|
|
@@ -1263,7 +1253,7 @@ const ScimGateway = function () {
|
|
|
1263
1253
|
obj: scimdata,
|
|
1264
1254
|
ctxPassThrough: ctx.passThrough
|
|
1265
1255
|
}
|
|
1266
|
-
logger.debug(`${gwName}[${pluginName}] publishing "${handle.createMethod}" to SCIM Stream and awaiting result`)
|
|
1256
|
+
logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] publishing "${handle.createMethod}" to SCIM Stream and awaiting result`)
|
|
1267
1257
|
res = await this.publish(streamObj)
|
|
1268
1258
|
} else {
|
|
1269
1259
|
if (scimdata.groups && Array.isArray(scimdata.groups) && handle.createMethod === 'createUser') {
|
|
@@ -1275,7 +1265,7 @@ const ScimGateway = function () {
|
|
|
1275
1265
|
delete scimdata.groups
|
|
1276
1266
|
}
|
|
1277
1267
|
}
|
|
1278
|
-
logger.debug(`${gwName}[${pluginName}] calling "${handle.createMethod}" and awaiting result`)
|
|
1268
|
+
logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] calling "${handle.createMethod}" and awaiting result`)
|
|
1279
1269
|
res = await this[handle.createMethod](ctx.params.baseEntity, scimdata, ctx.passThrough)
|
|
1280
1270
|
}
|
|
1281
1271
|
for (const key in res) { // merge any result e.g: {'id': 'xxxx'}
|
|
@@ -1393,7 +1383,7 @@ const ScimGateway = function () {
|
|
|
1393
1383
|
u = u.substr(u.lastIndexOf('/') + 1) // u = Users, Groups
|
|
1394
1384
|
const handle = handler[u]
|
|
1395
1385
|
const id = decodeURIComponent(ctx.params.id)
|
|
1396
|
-
logger.debug(`${gwName}[${pluginName}] [Delete ${handle.description}] id=${id}`)
|
|
1386
|
+
logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] [Delete ${handle.description}] id=${id}`)
|
|
1397
1387
|
|
|
1398
1388
|
try {
|
|
1399
1389
|
if (config.stream.publisher.enabled) {
|
|
@@ -1403,10 +1393,23 @@ const ScimGateway = function () {
|
|
|
1403
1393
|
id,
|
|
1404
1394
|
ctxPassThrough: ctx.passThrough
|
|
1405
1395
|
}
|
|
1406
|
-
logger.debug(`${gwName}[${pluginName}] publishing "${handle.deleteMethod}" to SCIM Stream and awaiting result`)
|
|
1396
|
+
logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] publishing "${handle.deleteMethod}" to SCIM Stream and awaiting result`)
|
|
1407
1397
|
await this.publish(streamObj)
|
|
1408
1398
|
} else {
|
|
1409
|
-
|
|
1399
|
+
if (handle.deleteMethod === 'deleteUser') {
|
|
1400
|
+
// remove user from groups before deleting user
|
|
1401
|
+
const groups = await getMemberOf(ctx.params.baseEntity, id, handler.groups.getMethod, ctx.passThrough)
|
|
1402
|
+
if (Array.isArray(groups) && groups.length > 0) {
|
|
1403
|
+
const revokeGroupMember = async (grpId) => {
|
|
1404
|
+
return await this[handler.groups.modifyMethod](ctx.params.baseEntity, grpId, { members: [{ operation: 'delete', value: id }] }, ctx.passThrough)
|
|
1405
|
+
}
|
|
1406
|
+
await Promise.allSettled(groups.map((grp) => {
|
|
1407
|
+
if (grp.value) return revokeGroupMember(grp.value)
|
|
1408
|
+
return Promise.resolve()
|
|
1409
|
+
})) // result not handled - ignore any failures
|
|
1410
|
+
}
|
|
1411
|
+
}
|
|
1412
|
+
logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] calling "${handle.deleteMethod}" and awaiting result`)
|
|
1410
1413
|
await this[handle.deleteMethod](ctx.params.baseEntity, id, ctx.passThrough)
|
|
1411
1414
|
}
|
|
1412
1415
|
ctx.status = 204
|
|
@@ -1459,11 +1462,11 @@ const ScimGateway = function () {
|
|
|
1459
1462
|
if (customErrorCode) ctx.status = customErrorCode
|
|
1460
1463
|
ctx.body = e
|
|
1461
1464
|
} else {
|
|
1462
|
-
logger.debug(`${gwName}[${pluginName}] [Modify ${handle.description}] id=${id}`)
|
|
1465
|
+
logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] [Modify ${handle.description}] id=${id}`)
|
|
1463
1466
|
let scimdata, err
|
|
1464
1467
|
if (jsonBody.Operations) [scimdata, err] = ScimGateway.prototype.convertedScim20(jsonBody) // v2.0
|
|
1465
1468
|
else [scimdata, err] = ScimGateway.prototype.convertedScim(jsonBody) // v1.1
|
|
1466
|
-
logger.debug(`${gwName}[${pluginName}] convertedBody=${JSON.stringify(scimdata)}`)
|
|
1469
|
+
logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] convertedBody=${JSON.stringify(scimdata)}`)
|
|
1467
1470
|
if (err) {
|
|
1468
1471
|
ctx.status = 500
|
|
1469
1472
|
const [e, customErrorCode] = jsonErr(config.scim.version, pluginName, ctx.status, err)
|
|
@@ -1504,14 +1507,14 @@ const ScimGateway = function () {
|
|
|
1504
1507
|
ctxPassThrough: ctx.passThrough
|
|
1505
1508
|
}
|
|
1506
1509
|
}
|
|
1507
|
-
logger.debug(`${gwName}[${pluginName}] publishing "${handle.modifyMethod}" to SCIM Stream and awaiting result`)
|
|
1510
|
+
logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] publishing "${handle.modifyMethod}" to SCIM Stream and awaiting result`)
|
|
1508
1511
|
await this.publish(streamObj)
|
|
1509
1512
|
} else {
|
|
1510
1513
|
if (Array.isArray(scimdata.members) && scimdata.members.length === 0 && handle.modifyMethod === 'modifyGroup') {
|
|
1511
1514
|
ctx.request.body = scimdata
|
|
1512
|
-
await replaceUsrGrp(ctx)
|
|
1515
|
+
await replaceUsrGrp(ctx, config.scim.usePutSoftSync)
|
|
1513
1516
|
} else {
|
|
1514
|
-
logger.debug(`${gwName}[${pluginName}] calling "${handle.modifyMethod}" and awaiting result`)
|
|
1517
|
+
logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] calling "${handle.modifyMethod}" and awaiting result`)
|
|
1515
1518
|
await this[handle.modifyMethod](ctx.params.baseEntity, id, scimdata, ctx.passThrough)
|
|
1516
1519
|
}
|
|
1517
1520
|
}
|
|
@@ -1559,10 +1562,10 @@ const ScimGateway = function () {
|
|
|
1559
1562
|
attributes,
|
|
1560
1563
|
ctxPassThrough: ctx.passThrough
|
|
1561
1564
|
}
|
|
1562
|
-
logger.debug(`${gwName}[${pluginName}] publishing "${handle.getMethod}" to SCIM Stream and awaiting result`)
|
|
1565
|
+
logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] publishing "${handle.getMethod}" to SCIM Stream and awaiting result`)
|
|
1563
1566
|
res = await this.publish(streamObj)
|
|
1564
1567
|
} else {
|
|
1565
|
-
logger.debug(`${gwName}[${pluginName}] calling "${handle.getMethod}" and awaiting result`)
|
|
1568
|
+
logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] calling "${handle.getMethod}" and awaiting result`)
|
|
1566
1569
|
res = await this[handle.getMethod](ctx.params.baseEntity, ob, attributes, ctx.passThrough)
|
|
1567
1570
|
}
|
|
1568
1571
|
|
|
@@ -1603,7 +1606,7 @@ const ScimGateway = function () {
|
|
|
1603
1606
|
// Replace User
|
|
1604
1607
|
// Replace Group
|
|
1605
1608
|
// ==========================================
|
|
1606
|
-
const replaceUsrGrp = async (ctx) => {
|
|
1609
|
+
const replaceUsrGrp = async (ctx, usePutSoftSync) => {
|
|
1607
1610
|
const requestBody = utils.copyObj(ctx.request.body)
|
|
1608
1611
|
let u = ctx.request.originalUrl.substr(0, ctx.request.originalUrl.lastIndexOf('/'))
|
|
1609
1612
|
u = u.substr(u.lastIndexOf('/') + 1) // u = Users, Groups
|
|
@@ -1619,10 +1622,10 @@ const ScimGateway = function () {
|
|
|
1619
1622
|
ctx.body = e
|
|
1620
1623
|
return
|
|
1621
1624
|
}
|
|
1622
|
-
logger.debug(`${gwName}[${pluginName}] PUT ${ctx.request.originalUrl} body=${strObj}`)
|
|
1625
|
+
logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] PUT ${ctx.request.originalUrl} body=${strObj}`)
|
|
1623
1626
|
|
|
1624
1627
|
// get current object
|
|
1625
|
-
logger.debug(`${gwName}[${pluginName}] calling "${handle.getMethod}" and awaiting result`)
|
|
1628
|
+
logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] calling "${handle.getMethod}" and awaiting result`)
|
|
1626
1629
|
const res = await this[handle.getMethod](ctx.params.baseEntity, { attribute: 'id', operator: 'eq', value: id }, [], ctx.passThrough)
|
|
1627
1630
|
let currentObj
|
|
1628
1631
|
if (res && res.Resources && Array.isArray(res.Resources)) {
|
|
@@ -1644,16 +1647,18 @@ const ScimGateway = function () {
|
|
|
1644
1647
|
const activeExists = Object.prototype.hasOwnProperty.call(obj, 'active')
|
|
1645
1648
|
let objGroups
|
|
1646
1649
|
if (obj.groups) {
|
|
1647
|
-
|
|
1648
|
-
|
|
1650
|
+
if (!config.scim.groupMemberOfUser && !config.scim.usePutGroupMemberOfUser) { // usePutGroupMemberOfUser is legacy
|
|
1651
|
+
objGroups = utils.copyObj(obj.groups)
|
|
1652
|
+
delete obj.groups
|
|
1653
|
+
}
|
|
1649
1654
|
}
|
|
1650
1655
|
|
|
1651
1656
|
// merge obj with currentObj as cleared
|
|
1652
|
-
utils.extendObjClear(obj, currentObj,
|
|
1657
|
+
utils.extendObjClear(obj, currentObj, usePutSoftSync)
|
|
1653
1658
|
delete obj.id
|
|
1654
1659
|
delete obj.schemas
|
|
1655
1660
|
delete obj.meta
|
|
1656
|
-
if (!activeExists && !
|
|
1661
|
+
if (!activeExists && !usePutSoftSync) delete obj.active
|
|
1657
1662
|
// remove from obj what match currentObj
|
|
1658
1663
|
utils.deltaObj(obj, currentObj)
|
|
1659
1664
|
// userName/displayName should not be set to blank
|
|
@@ -1665,12 +1670,12 @@ const ScimGateway = function () {
|
|
|
1665
1670
|
|
|
1666
1671
|
// update object
|
|
1667
1672
|
if (Object.keys(scimdata).length > 0) {
|
|
1668
|
-
logger.debug(`${gwName}[${pluginName}] calling "${handle.modifyMethod}" and awaiting result`)
|
|
1673
|
+
logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] calling "${handle.modifyMethod}" and awaiting result`)
|
|
1669
1674
|
await this[handle.modifyMethod](ctx.params.baseEntity, id, scimdata, ctx.passThrough)
|
|
1670
1675
|
}
|
|
1671
1676
|
|
|
1672
1677
|
// add/remove groups
|
|
1673
|
-
if (!config.scim.groupMemberOfUser
|
|
1678
|
+
if (!config.scim.groupMemberOfUser && !config.scim.usePutGroupMemberOfUser) { // default user member of group, usePutGroupMemberOfUser is legacy
|
|
1674
1679
|
if (objGroups && Array.isArray(objGroups)) { // only if groups included, { "groups": [] } will remove all existing
|
|
1675
1680
|
if (typeof this[handler.groups.getMethod] !== 'function' || typeof this[handler.groups.modifyMethod] !== 'function') {
|
|
1676
1681
|
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')
|
|
@@ -1729,26 +1734,26 @@ const ScimGateway = function () {
|
|
|
1729
1734
|
if (!found && currentGroups[i].value) removeGrps.push(currentGroups[i].value)
|
|
1730
1735
|
}
|
|
1731
1736
|
|
|
1732
|
-
const
|
|
1733
|
-
return await this[handler.groups.modifyMethod](ctx.params.baseEntity,
|
|
1737
|
+
const assignGroupMember = async (grpId) => {
|
|
1738
|
+
return await this[handler.groups.modifyMethod](ctx.params.baseEntity, grpId, { members: [{ value: id }] }, ctx.passThrough)
|
|
1734
1739
|
}
|
|
1735
1740
|
|
|
1736
|
-
const
|
|
1737
|
-
return await this[handler.groups.modifyMethod](ctx.params.baseEntity,
|
|
1741
|
+
const revokeGroupMember = async (grpId) => {
|
|
1742
|
+
return await this[handler.groups.modifyMethod](ctx.params.baseEntity, grpId, { members: [{ operation: 'delete', value: id }] }, ctx.passThrough)
|
|
1738
1743
|
}
|
|
1739
1744
|
|
|
1740
|
-
let
|
|
1741
|
-
if (!
|
|
1742
|
-
const res = await Promise.allSettled(removeGrps.map((
|
|
1743
|
-
|
|
1745
|
+
let errRevoke = []
|
|
1746
|
+
if (!usePutSoftSync) { // default will remove any existing groups not included, usePutSoftSync=true prevents removing existing groups (only add groups)
|
|
1747
|
+
const res = await Promise.allSettled(removeGrps.map((grpId) => revokeGroupMember(grpId)))
|
|
1748
|
+
errRevoke = res.filter(result => result.status === 'rejected').map(result => result.reason.message)
|
|
1744
1749
|
}
|
|
1745
1750
|
|
|
1746
|
-
const res = await Promise.allSettled(addGrps.map((
|
|
1747
|
-
const
|
|
1751
|
+
const res = await Promise.allSettled(addGrps.map((grpId) => assignGroupMember(grpId)))
|
|
1752
|
+
const errAssign = res.filter(result => result.status === 'rejected').map(result => result.reason.message)
|
|
1748
1753
|
|
|
1749
1754
|
let errMsg = ''
|
|
1750
|
-
if (
|
|
1751
|
-
if (
|
|
1755
|
+
if (errRevoke.length > 0) errMsg = `revokeGroupMember errors: ${errRevoke.join(', ')}`
|
|
1756
|
+
if (errAssign.length > 0) errMsg += `${errMsg ? ' ' : ''}assignGroupMember errors: ${errAssign.join(', ')}`
|
|
1752
1757
|
if (errMsg) throw new Error(errMsg)
|
|
1753
1758
|
}
|
|
1754
1759
|
}
|
|
@@ -1769,10 +1774,10 @@ const ScimGateway = function () {
|
|
|
1769
1774
|
obj: ctx.request.body,
|
|
1770
1775
|
ctxPassThrough: ctx.passThrough
|
|
1771
1776
|
}
|
|
1772
|
-
logger.debug(`${gwName}[${pluginName}] publishing replaceUsrGrp to SCIM Stream and awaiting result`)
|
|
1777
|
+
logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] publishing replaceUsrGrp to SCIM Stream and awaiting result`)
|
|
1773
1778
|
await this.publish(streamObj)
|
|
1774
1779
|
} else {
|
|
1775
|
-
await replaceUsrGrp(ctx)
|
|
1780
|
+
await replaceUsrGrp(ctx, config.scim.usePutSoftSync)
|
|
1776
1781
|
}
|
|
1777
1782
|
ctx.request.originalUrl = originalUrl
|
|
1778
1783
|
return await getById(ctx)
|
|
@@ -1788,7 +1793,7 @@ const ScimGateway = function () {
|
|
|
1788
1793
|
// {"eventName":"AsignAccessRoleEvent","subjectName":"RACF_System-B","userID":"peter01"}
|
|
1789
1794
|
//
|
|
1790
1795
|
router.post(['/api', '/:baseEntity/api'], async (ctx) => {
|
|
1791
|
-
logger.debug(`${gwName}[${pluginName}] [POST api]`)
|
|
1796
|
+
logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] [POST api]`)
|
|
1792
1797
|
const apiObj = ctx.request.body
|
|
1793
1798
|
const strBody = JSON.stringify(apiObj)
|
|
1794
1799
|
if (strBody === '{}') {
|
|
@@ -1805,10 +1810,10 @@ const ScimGateway = function () {
|
|
|
1805
1810
|
obj: apiObj,
|
|
1806
1811
|
ctxPassThrough: ctx.passThrough
|
|
1807
1812
|
}
|
|
1808
|
-
logger.debug(`${gwName}[${pluginName}] publishing "postApi" to SCIM Stream and awaiting result`)
|
|
1813
|
+
logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] publishing "postApi" to SCIM Stream and awaiting result`)
|
|
1809
1814
|
result = await this.publish(streamObj)
|
|
1810
1815
|
} else {
|
|
1811
|
-
logger.debug(`${gwName}[${pluginName}] calling "postApi" and awaiting result`)
|
|
1816
|
+
logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] calling "postApi" and awaiting result`)
|
|
1812
1817
|
result = await this.postApi(ctx.params.baseEntity, apiObj, ctx.passThrough)
|
|
1813
1818
|
}
|
|
1814
1819
|
if (result) {
|
|
@@ -1847,7 +1852,7 @@ const ScimGateway = function () {
|
|
|
1847
1852
|
//
|
|
1848
1853
|
router.put(['/api/:id', '/:baseEntity/api/:id'], async (ctx) => {
|
|
1849
1854
|
const id = ctx?.params?.id
|
|
1850
|
-
logger.debug(`${gwName}[${pluginName}] [PUT api ] id=${id}`)
|
|
1855
|
+
logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] [PUT api ] id=${id}`)
|
|
1851
1856
|
const apiObj = ctx.request.body
|
|
1852
1857
|
const strBody = JSON.stringify(apiObj)
|
|
1853
1858
|
if (strBody === '{}') {
|
|
@@ -1865,10 +1870,10 @@ const ScimGateway = function () {
|
|
|
1865
1870
|
obj: apiObj,
|
|
1866
1871
|
ctxPassThrough: ctx.passThrough
|
|
1867
1872
|
}
|
|
1868
|
-
logger.debug(`${gwName}[${pluginName}] publishing "putApi" to SCIM Stream and awaiting result`)
|
|
1873
|
+
logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] publishing "putApi" to SCIM Stream and awaiting result`)
|
|
1869
1874
|
result = await this.publish(streamObj)
|
|
1870
1875
|
} else {
|
|
1871
|
-
logger.debug(`${gwName}[${pluginName}] calling "putApi" and awaiting result`)
|
|
1876
|
+
logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] calling "putApi" and awaiting result`)
|
|
1872
1877
|
result = await this.putApi(ctx.params.baseEntity, id, apiObj, ctx.passThrough)
|
|
1873
1878
|
}
|
|
1874
1879
|
if (result) {
|
|
@@ -1907,7 +1912,7 @@ const ScimGateway = function () {
|
|
|
1907
1912
|
//
|
|
1908
1913
|
router.patch(['/api/:id', '/:baseEntity/api/:id'], async (ctx) => {
|
|
1909
1914
|
const id = ctx?.params?.id
|
|
1910
|
-
logger.debug(`${gwName}[${pluginName}] [PATCH api ] id=${id}`)
|
|
1915
|
+
logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] [PATCH api ] id=${id}`)
|
|
1911
1916
|
const apiObj = ctx.request.body
|
|
1912
1917
|
const strBody = JSON.stringify(apiObj)
|
|
1913
1918
|
if (strBody === '{}') {
|
|
@@ -1925,10 +1930,10 @@ const ScimGateway = function () {
|
|
|
1925
1930
|
obj: apiObj,
|
|
1926
1931
|
ctxPassThrough: ctx.passThrough
|
|
1927
1932
|
}
|
|
1928
|
-
logger.debug(`${gwName}[${pluginName}] publishing "patchApi" to SCIM Stream and awaiting result`)
|
|
1933
|
+
logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] publishing "patchApi" to SCIM Stream and awaiting result`)
|
|
1929
1934
|
result = await this.publish(streamObj)
|
|
1930
1935
|
} else {
|
|
1931
|
-
logger.debug(`${gwName}[${pluginName}] calling "patchApi" and awaiting result`)
|
|
1936
|
+
logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] calling "patchApi" and awaiting result`)
|
|
1932
1937
|
result = await this.patchApi(ctx.params.baseEntity, id, apiObj, ctx.passThrough)
|
|
1933
1938
|
}
|
|
1934
1939
|
if (result) {
|
|
@@ -1967,8 +1972,8 @@ const ScimGateway = function () {
|
|
|
1967
1972
|
router.get(['/api', '/api/:id',
|
|
1968
1973
|
'/:baseEntity/api', '/:baseEntity/api/:id'], async (ctx) => {
|
|
1969
1974
|
const id = ctx?.params?.id
|
|
1970
|
-
if (id) logger.debug(`${gwName}[${pluginName}] [GET api] id=${id}`)
|
|
1971
|
-
else logger.debug(`${gwName}[${pluginName}] [GET api]`)
|
|
1975
|
+
if (id) logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] [GET api] id=${id}`)
|
|
1976
|
+
else logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] [GET api]`)
|
|
1972
1977
|
let apiObj = ctx.request.body
|
|
1973
1978
|
const strBody = JSON.stringify(apiObj)
|
|
1974
1979
|
if (strBody === '{}') apiObj = undefined
|
|
@@ -1983,10 +1988,10 @@ const ScimGateway = function () {
|
|
|
1983
1988
|
obj: apiObj,
|
|
1984
1989
|
ctxPassThrough: ctx.passThrough
|
|
1985
1990
|
}
|
|
1986
|
-
logger.debug(`${gwName}[${pluginName}] publishing "getApi" to SCIM Stream and awaiting result`)
|
|
1991
|
+
logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] publishing "getApi" to SCIM Stream and awaiting result`)
|
|
1987
1992
|
result = await this.publish(streamObj)
|
|
1988
1993
|
} else {
|
|
1989
|
-
logger.debug(`${gwName}[${pluginName}] calling "getApi" and awaiting result`)
|
|
1994
|
+
logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] calling "getApi" and awaiting result`)
|
|
1990
1995
|
result = await this.getApi(ctx.params.baseEntity, id, ctx.query, apiObj, ctx.passThrough)
|
|
1991
1996
|
}
|
|
1992
1997
|
if (result) {
|
|
@@ -2021,7 +2026,7 @@ const ScimGateway = function () {
|
|
|
2021
2026
|
//
|
|
2022
2027
|
router.delete(['/api/:id', '/:baseEntity/api/:id'], async (ctx) => {
|
|
2023
2028
|
const id = ctx?.params?.id
|
|
2024
|
-
logger.debug(`${gwName}[${pluginName}] [DELETE api ] id=${id}`)
|
|
2029
|
+
logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] [DELETE api ] id=${id}`)
|
|
2025
2030
|
try {
|
|
2026
2031
|
let result
|
|
2027
2032
|
if (config.stream.publisher.enabled) {
|
|
@@ -2031,10 +2036,10 @@ const ScimGateway = function () {
|
|
|
2031
2036
|
id,
|
|
2032
2037
|
ctxPassThrough: ctx.passThrough
|
|
2033
2038
|
}
|
|
2034
|
-
logger.debug(`${gwName}[${pluginName}] publishing "deleteApi" to SCIM Stream and awaiting result`)
|
|
2039
|
+
logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] publishing "deleteApi" to SCIM Stream and awaiting result`)
|
|
2035
2040
|
result = await this.publish(streamObj)
|
|
2036
2041
|
} else {
|
|
2037
|
-
logger.debug(`${gwName}[${pluginName}] calling "deleteApi" and awaiting result`)
|
|
2042
|
+
logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] calling "deleteApi" and awaiting result`)
|
|
2038
2043
|
result = await this.deleteApi(ctx.params.baseEntity, id, ctx.passThrough)
|
|
2039
2044
|
}
|
|
2040
2045
|
if (result) {
|
|
@@ -2068,6 +2073,34 @@ const ScimGateway = function () {
|
|
|
2068
2073
|
return await getAppRoles(this, baseEntity, getObj, attributes)
|
|
2069
2074
|
}
|
|
2070
2075
|
|
|
2076
|
+
// get all groups a user is member of
|
|
2077
|
+
const getMemberOf = async (baseEntity, id, getMethod, ctxPassThrough) => {
|
|
2078
|
+
const groups = []
|
|
2079
|
+
if (getMethod !== 'getGroups') return groups
|
|
2080
|
+
if (typeof this[handler.groups.getMethod] !== 'function') return groups // method not implemented
|
|
2081
|
+
if (config.scim.groupMemberOfUser) return groups // only support user member of group
|
|
2082
|
+
let res
|
|
2083
|
+
try {
|
|
2084
|
+
const ob = { attribute: 'members.value', operator: 'eq', value: decodeURIComponent(id) }
|
|
2085
|
+
const attributes = ['id', 'displayName']
|
|
2086
|
+
logger.debug(`${gwName}[${pluginName}][${baseEntity}] calling "${handler.groups.getMethod}" and awaiting result - groups to be included`)
|
|
2087
|
+
res = await this[handler.groups.getMethod](baseEntity, ob, attributes, ctxPassThrough)
|
|
2088
|
+
} catch (err) {} // ignore errors
|
|
2089
|
+
if (res && res.Resources && Array.isArray(res.Resources) && res.Resources.length > 0) {
|
|
2090
|
+
for (let i = 0; i < res.Resources.length; i++) {
|
|
2091
|
+
if (!res.Resources[i].id) continue
|
|
2092
|
+
const el = {}
|
|
2093
|
+
el.value = res.Resources[i].id
|
|
2094
|
+
if (res.Resources[i].displayName) el.display = res.Resources[i].displayName
|
|
2095
|
+
if (isScimv2) el.type = 'direct'
|
|
2096
|
+
else el.type = { value: 'direct' }
|
|
2097
|
+
groups.push(el) // { "value": "Admins", "display": "Admins", "type": "direct"}
|
|
2098
|
+
}
|
|
2099
|
+
}
|
|
2100
|
+
return groups
|
|
2101
|
+
}
|
|
2102
|
+
this.getMemberOf = getMemberOf
|
|
2103
|
+
|
|
2071
2104
|
// ==========================================
|
|
2072
2105
|
// Starting up...
|
|
2073
2106
|
// ==========================================
|
|
@@ -2738,7 +2771,13 @@ ScimGateway.prototype.endpointMapper = function endpointMapper (direction, parse
|
|
|
2738
2771
|
else {
|
|
2739
2772
|
if (dotMap[`${key}.typeInbound`] && dotMap[`${key}.typeInbound`] === 'string') {
|
|
2740
2773
|
if (!dotNewObj[newStr]) dotNewObj[newStr] = dotParse[`${key}.${dotArrIndex}`]
|
|
2741
|
-
else
|
|
2774
|
+
else {
|
|
2775
|
+
if (dotMap[`${key}.typeOutboundReverse`]) { // e.g., ldap server not OpenLdap - Active Directory
|
|
2776
|
+
dotNewObj[newStr] = `${dotParse[`${key}.${dotArrIndex}`]},${dotNewObj[newStr]}`
|
|
2777
|
+
} else {
|
|
2778
|
+
dotNewObj[newStr] = `${dotNewObj[newStr]},${dotParse[`${key}.${dotArrIndex}`]}` // OpenLdap - { "isOpenLdap": true }
|
|
2779
|
+
}
|
|
2780
|
+
}
|
|
2742
2781
|
} else dotNewObj[`${newStr}.${dotArrIndex}`] = dotParse[`${key}.${dotArrIndex}`]
|
|
2743
2782
|
}
|
|
2744
2783
|
} else { // type=array but element is not array
|
package/lib/utils.js
CHANGED
|
@@ -277,7 +277,7 @@ module.exports.extendObjClear = (obj, src, isSoftSync) => {
|
|
|
277
277
|
if (typeof val !== 'object') {
|
|
278
278
|
if (!obj[key].includes(val)) obj[key].push(val) // e.g. ["value1", "value2"]
|
|
279
279
|
} else {
|
|
280
|
-
if (Object.prototype.hasOwnProperty.call(val, 'type')) {
|
|
280
|
+
if (Object.prototype.hasOwnProperty.call(val, 'type') && key !== 'members' && key !== 'groups') {
|
|
281
281
|
if (obj[key].length < 1) {
|
|
282
282
|
const v = this.copyObj(val)
|
|
283
283
|
if (!isSoftSync) v.operation = 'delete'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scimgateway",
|
|
3
|
-
"version": "4.5.
|
|
3
|
+
"version": "4.5.11",
|
|
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",
|