scimgateway 4.5.10 → 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 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,26 @@ 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
+
1166
1186
  ### v4.5.10
1167
1187
 
1168
1188
  [Fixed]
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')
@@ -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
- changes.push({
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' && options.modification && options.modification.member) {
1407
- if (err.message.includes('ENTRY_EXISTS')) return resolve() // add already existing group to user
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 (idFound && userNameFound) break
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')
@@ -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
@@ -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_0x2ad4e4=a0_0x7bcd;(function(_0x2159da,_0x1cd6cf){const _0x364e9f=a0_0x7bcd,_0xc901f9=_0x2159da();while(!![]){try{const _0x54c0b3=-parseInt(_0x364e9f(0x13a))/0x1*(-parseInt(_0x364e9f(0x138))/0x2)+parseInt(_0x364e9f(0x16a))/0x3*(parseInt(_0x364e9f(0xf9))/0x4)+-parseInt(_0x364e9f(0x1b5))/0x5+-parseInt(_0x364e9f(0x1a8))/0x6+parseInt(_0x364e9f(0x188))/0x7+parseInt(_0x364e9f(0x19e))/0x8+-parseInt(_0x364e9f(0x147))/0x9;if(_0x54c0b3===_0x1cd6cf)break;else _0xc901f9['push'](_0xc901f9['shift']());}catch(_0x4f48c0){_0xc901f9['push'](_0xc901f9['shift']());}}}(a0_0x1c1a,0x86d37));function a0_0x1c1a(){const _0x3d9ff8=['##doIncrement','includes','\x20-\x20will\x20do\x20auto\x20reconnect\x20when\x20connection\x20becomes\x20available','request','modifyOnly','putApi','\x20error:\x20missing\x20id}','approles_','Disconnect','rejectUnauthorized','false','remove','replaceUsrGrp','getServer','crypto','2zOShak','respond','1103814rpgQCV','indexOf',']\x20subscriber\x20stopped\x20error:\x20','\x20message:\x20user\x20does\x20not\x20exist','handle','obj','parse','originalUrl','\x20message\x20handled:\x20','utf8','timeout','baseUrls','\x22,\x22errName\x22:\x22','12227634dUNtkU','delete','detail','value',']\x20initialization\x20error:\x20missing\x20configuration\x20nats.subject','lowercase','DeliverPolicy','toUpperCase','getAppRoles','\x20Delete\x20User\x20userName=','publisher[','replace','update','decode',']\x20initialization\x20error:\x20missing\x20configuration\x20stream.baseUrls','normalize','debug','SCIM\x20Stream','\x20=>\x20subscriber\x20not\x20activated','\x20convertedScim20\x20error:\x20','patchApi',',\x20attributes=',']\x20subscriber[','secret','increment','split',']\x20initialization\x20error:\x20nats.subject\x20root\x20topic\x20must\x20be\x20\x27GW\x27,\x20nats.subject\x20example:\x20GW.APP1','subscriber\x20message\x20error:\x20handle\x20\x27','\x20Replace\x20User\x20id=','jwtAuthenticator','servers','SIGTERM','configDir','\x20createUser()\x20obj=','level','2652009gLvXYX','subject','ack','reconnectTimeWait','Resources','tls','baseEntity','\x20message:\x20user\x20not\x20created\x20because\x20of\x20configuration\x20modifyOnly=true','randomUUID','\x20-\x20','push','connect','prototype',']\x20closed\x20with\x20error:\x20','write','name',']\x20connected\x20','description','info','ENOTFOUND',']\x20initialization\x20error:\x20missing\x20certificate\x20configuration','headers',']\x20client\x20has\x20a\x20stale\x20connection\x20','string','passThrough','activityOperation','\x20missing\x20user\x20object\x20in\x20message:\x20','jetstreamManager','file-not-configured','jwt','1519280bhcmzC','ETIMEDOUT','set','Error','\x20message\x20json\x20parsing\x20error:\x20','body','Reconnect','attributes','pingInterval','substring',']\x20client\x20disconnected\x20',']\x20error:\x20message\x20must\x20be\x20JSON\x20formatted','SCIM\x20Stream\x20-\x20Autogenerated','encode','trim','Explicit',']\x20initialization\x20error:\x20missing\x20configuration\x20nats.tenant','data','\x20message\x20error\x20response:\x20','config','elementnumber','DebugEvents','7027344WsagdU','exports','uppercase','\x20result=','ctxPassThrough','toString','onCreate','charAt','503','replaceAll','4404270dtpFmn','publisher\x20error:\x20none\x20JSON\x20formatted\x20response:\x20','query','\x20Delete\x20User\x20id=','\x20done','../lib/utils','path','\x20-\x20will\x20do\x20auto\x20connect\x20when\x20available\x20-\x20however,\x20please\x20verify\x20stream\x20configuration','StaleConnection','length','add',']\x20publisher[','\x20Create\x20User\x20userName=','2191785VBvtbd','displayName',']\x20initialization\x20error:\x20missing\x20configuration\x20nats','{\x22error\x22:\x22','internal\x20stream\x20policy\x20have\x20been\x20changed\x20-\x20central\x20SCIM\x20Stream\x20must\x20be\x20stopped\x20and\x20corresponding\x20./jetstream\x20folder\x20deleted\x20before\x20startup\x20allowing\x20new\x20policy','GW.','subscriber\x20message\x20error:\x20message\x20baseEntity=','close','_info','user','roles','getUsers()\x20getObj=','Msg-Id','\x20processing\x20incoming\x20message','\x20getUserId()\x20error:\x20',',true','nats','Events','type','deleteGroup','logger',']\x20connect\x20error:\x20','display','readFileSync','drain','All',']\x20client\x20is\x20attempting\x20to\x20reconnect\x20','/certs/','Operations','waitOnFirstConnect',']\x20client\x20reconnected\x20','getGroups','deleteUserOnLastGroupRoleRemoval','existsSync','params','deleteApi','operation','from','file','Reconnecting','\x20roles\x20converted\x20to\x20groups:\x20','consumers','stringify','gwName','getUsers','groups','schemas','deleteUser','durable_','authenticator','maxPingOut','SIGINT','subscriber\x20message\x20error:\x20message\x20missing\x20handle','server_name','approles','copyObj','\x20message:\x20','modifyGroup','\x20error:\x20','Subscriber','UnableConnectingService',']\x20error:\x20','error','true','password','userName','\x20Create\x20userName=','call','undefined','closed','typeId','4kXCVvp','createWriteStream','\x20(count=','\x20message:\x20user\x20not\x20deleted\x20because\x20of\x20configuration\x20modifyOnly=true','getuniquevalue','toLowerCase','replaceDomains','forEach','reconnect','join','certificate','startsWith','constructor',']\x20client\x20error\x20','ECONNREFUSED','jetstream','firstn','then','\x20error:\x20missing\x20result','HR.','subscriber\x20message\x20error:\x20message\x20not\x20JSON\x20formatted','transports','\x20message:\x20user\x20not\x20created\x20because\x20of\x20active=false','status','StringCodec','modifyUser','skipConvertRolesToGroups','message','foldReplacing','utf-8',']\x20initialization\x20certificate\x20error:\x20','Publisher','pluginName',',false','User','createRandomPassword','Errors','isArray','\x20handling\x20message:\x20','all',',\x20obj=','/Users/','sub','get','usePutSoftSync','doIncrement','isClosed','active'];a0_0x1c1a=function(){return _0x3d9ff8;};return a0_0x1c1a();}function a0_0x7bcd(_0x245a4b,_0x55c34b){const _0x1c1a27=a0_0x1c1a();return a0_0x7bcd=function(_0x7bcd61,_0x54c915){_0x7bcd61=_0x7bcd61-0xf0;let _0x198ea0=_0x1c1a27[_0x7bcd61];return _0x198ea0;},a0_0x7bcd(_0x245a4b,_0x55c34b);}const nats=require(a0_0x2ad4e4(0x1c5)),ascii127=require('fold-to-ascii'),fs=require('fs'),utils=require(a0_0x2ad4e4(0x1ad)),path=require(a0_0x2ad4e4(0x1ae)),crypto=require(a0_0x2ad4e4(0x137));module[a0_0x2ad4e4(0x19f)][a0_0x2ad4e4(0x1f0)]=function(_0xc533ab){const _0x375032=a0_0x2ad4e4,_0x2a0389=_0xc533ab,_0x2f6dd3={};let _0x5eec2c='';for(let _0x288c56=0x0;_0x288c56<_0x2a0389[_0x375032(0x1c9)][_0x375032(0x10e)][_0x375032(0x1b1)];_0x288c56++){if(_0x2a0389['logger']['transports'][_0x288c56][_0x375032(0x179)]===_0x375032(0x1db)){_0x5eec2c=_0x2a0389[_0x375032(0x1c9)][_0x375032(0x10e)][_0x288c56][_0x375032(0x169)];break;}}const _0x77a231=''+(_0x5eec2c==='debug'?'\x0a':''),_0x298c5b=async(_0x5171a7,_0x26c189)=>{const _0x495dd1=_0x375032,_0x1833cc=_0x2f6dd3[_0x5171a7][_0x495dd1(0x19b)]?.['nats']?.[_0x495dd1(0x16b)];let _0xd54145;try{_0xd54145=await nats[_0x495dd1(0x175)](_0x26c189);if(_0xd54145['info'][_0x495dd1(0x1ea)]!=='SCIM\x20Stream'){_0xd54145[_0x495dd1(0x1bc)]();return;}_0x2f6dd3[_0x5171a7]['nc']=_0xd54145,_0x3b536e(_0x5171a7,_0xd54145),_0x549abb(_0x5171a7,_0xd54145);}catch(_0xdb95b9){_0x2a0389[_0x495dd1(0x1c9)][_0x495dd1(0xf0)](_0x2a0389[_0x495dd1(0x1e0)]+'['+_0x2a0389[_0x495dd1(0x119)]+']\x20subscriber['+_0x5171a7+']['+_0x1833cc+_0x495dd1(0x1ca)+_0xdb95b9[_0x495dd1(0x114)]+_0x495dd1(0x1af)),_0x26c189['waitOnFirstConnect']=!![];try{_0xd54145=await nats['connect'](_0x26c189);if(_0xd54145['info'][_0x495dd1(0x1ea)]!==_0x495dd1(0x158)){_0xd54145[_0x495dd1(0x1bc)]();return;}_0x2f6dd3[_0x5171a7]['nc']=_0xd54145,_0x3b536e(_0x5171a7,_0xd54145),_0x549abb(_0x5171a7,_0xd54145);}catch(_0x23f8a3){_0x2a0389[_0x495dd1(0x1c9)][_0x495dd1(0xf0)](_0x2a0389[_0x495dd1(0x1e0)]+'['+_0x2a0389[_0x495dd1(0x119)]+_0x495dd1(0x15d)+_0x5171a7+']['+_0x1833cc+_0x495dd1(0x1ca)+_0x23f8a3['message']);return;}}_0x2a0389[_0x495dd1(0x1c9)][_0x495dd1(0x157)](_0x2a0389[_0x495dd1(0x1e0)]+'['+_0x2a0389['pluginName']+']\x20subscriber['+_0x5171a7+']['+_0x1833cc+']\x20connected\x20'+(_0x26c189[_0x495dd1(0x16f)]['ca']?_0x495dd1(0x16f):'')+'\x20'+_0xd54145['getServer']()),_0xd54145[_0x495dd1(0xf7)]()[_0x495dd1(0x10a)](_0x57a741=>{const _0x570bec=_0x495dd1;_0x57a741&&_0x2a0389[_0x570bec(0x1c9)][_0x570bec(0xf0)](_0x2a0389['gwName']+'['+_0x2a0389[_0x570bec(0x119)]+']\x20subscriber['+_0x5171a7+']['+_0x1833cc+_0x570bec(0x177)+_0x57a741[_0x570bec(0x114)]);});};this['add']=async(_0x5b86f0,_0x23ceeb)=>{const _0x264667=_0x375032;if(!_0x23ceeb?.['nats']){_0x2a0389[_0x264667(0x1c9)][_0x264667(0xf0)](_0x2a0389['gwName']+'['+_0x2a0389['pluginName']+_0x264667(0x15d)+_0x5b86f0+']\x20initialization\x20error:\x20missing\x20configuration\x20nats');return;}if(!_0x23ceeb?.[_0x264667(0x1c5)]?.['tenant']){_0x2a0389[_0x264667(0x1c9)][_0x264667(0xf0)](_0x2a0389[_0x264667(0x1e0)]+'['+_0x2a0389[_0x264667(0x119)]+_0x264667(0x15d)+_0x5b86f0+']\x20initialization\x20error:\x20missing\x20configuration\x20nats.tenant');return;}if(!_0x23ceeb?.[_0x264667(0x1c5)]?.[_0x264667(0x16b)]){_0x2a0389[_0x264667(0x1c9)][_0x264667(0xf0)](_0x2a0389['gwName']+'['+_0x2a0389['pluginName']+_0x264667(0x15d)+_0x5b86f0+_0x264667(0x14b));return;}if(!_0x23ceeb?.['certificate']?.['ca']){_0x2a0389[_0x264667(0x1c9)][_0x264667(0xf0)](_0x2a0389['gwName']+'['+_0x2a0389[_0x264667(0x119)]+_0x264667(0x15d)+_0x5b86f0+_0x264667(0x17e));return;}if(!_0x23ceeb[_0x264667(0x145)]||!Array[_0x264667(0x11e)](_0x23ceeb[_0x264667(0x145)])||_0x23ceeb['baseUrls'][_0x264667(0x1b1)]<0x1){_0x2a0389['logger'][_0x264667(0xf0)](_0x2a0389[_0x264667(0x1e0)]+'['+_0x2a0389['pluginName']+_0x264667(0x15d)+_0x5b86f0+_0x264667(0x155));return;}if(!_0x23ceeb[_0x264667(0x125)]){const _0x522033=_0x23ceeb?.[_0x264667(0x1c5)]?.[_0x264667(0x16b)][_0x264667(0x14e)]();if(_0x522033[_0x264667(0x104)](_0x264667(0x10c)))_0x23ceeb[_0x264667(0x125)]=!![];}const _0x24d2c6={};try{let _0x50be22=path[_0x264667(0x102)](_0x2a0389[_0x264667(0x167)],_0x264667(0x1d0),_0x23ceeb?.['certificate']?.['ca']||_0x264667(0x186));(_0x23ceeb?.[_0x264667(0x103)]?.['ca']?.[_0x264667(0x104)]('/')||_0x23ceeb?.[_0x264667(0x103)]?.['ca']?.[_0x264667(0x12a)]('\x5c'))&&(_0x50be22=_0x23ceeb[_0x264667(0x103)]['ca']),_0x24d2c6['ca']=[fs[_0x264667(0x1cc)](_0x50be22)],_0x24d2c6[_0x264667(0x132)]=!![];}catch(_0x2b0d41){_0x2a0389[_0x264667(0x1c9)]['error'](_0x2a0389[_0x264667(0x1e0)]+'['+_0x2a0389[_0x264667(0x119)]+_0x264667(0x15d)+_0x5b86f0+_0x264667(0x117)+_0x2b0d41[_0x264667(0x114)]);return;}const _0x2ae1b6={},_0x152eba=new TextEncoder()[_0x264667(0x195)](_0x23ceeb?.[_0x264667(0x1c5)]?.[_0x264667(0x15e)]),_0x5da4e4=_0x23ceeb?.[_0x264667(0x1c5)]?.['jwt'];_0x2ae1b6[_0x264667(0x1e6)]=nats[_0x264667(0x164)](_0x5da4e4,_0x152eba),_0x2ae1b6[_0x264667(0x165)]=_0x23ceeb[_0x264667(0x145)],_0x2ae1b6['tls']=_0x24d2c6,_0x2ae1b6['waitOnFirstConnect']=![],_0x2ae1b6['reconnect']=!![],_0x2ae1b6['reconnectTimeWait']=0x3e8*0xa,_0x2ae1b6['maxReconnectAttempts']=-0x1,_0x2ae1b6['pingInterval']=0x2*0x3c*0x3e8,_0x2ae1b6['maxPingOut']=0x5,_0x2ae1b6[_0x264667(0x157)]=![],_0x2f6dd3[_0x5b86f0]={},_0x2f6dd3[_0x5b86f0][_0x264667(0x19b)]=_0x23ceeb,_0x2f6dd3[_0x5b86f0]['nc']=undefined,_0x2f6dd3[_0x5b86f0][_0x264667(0x123)]=undefined,_0x298c5b(_0x5b86f0,_0x2ae1b6);};const _0x549abb=async(_0x11a74c,_0x117e8a)=>{const _0x27c58=_0x375032,_0x4a3c1c=_0x2f6dd3[_0x11a74c]['config'],_0x1be0d9=_0x4a3c1c?.[_0x27c58(0x1c5)]?.[_0x27c58(0x16b)];if(!_0x117e8a){_0x2a0389[_0x27c58(0x1c9)][_0x27c58(0xf0)](_0x2a0389[_0x27c58(0x1e0)]+'['+_0x2a0389['pluginName']+_0x27c58(0x15d)+_0x11a74c+']['+_0x1be0d9+']\x20error:\x20client\x20have\x20not\x20been\x20initialized');return;}const _0x1dc621=async(_0xdff44d,_0x32458c)=>{const _0x917b52=_0x27c58;try{_0x2a0389[_0x917b52(0x1c9)]['info'](_0xdff44d+_0x917b52(0x11f)+_0x32458c);let _0x197126;try{if(_0x4a3c1c[_0x917b52(0xff)]&&Array['isArray'](_0x4a3c1c[_0x917b52(0xff)]))for(let _0x58c7c6=0x0;_0x58c7c6<_0x4a3c1c['replaceDomains'][_0x917b52(0x1b1)];_0x58c7c6++){const _0x4acba6=_0x4a3c1c[_0x917b52(0xff)][_0x58c7c6];if(!_0x4acba6[_0x917b52(0x1da)]||!_0x4acba6[_0x917b52(0x1da)][_0x917b52(0x12a)]('.')||!_0x4acba6['to']||!_0x4acba6['to']['includes']('.'))continue;const _0x4bbdfb=new RegExp('@'+_0x4acba6['from']+'\x22','gi');_0x32458c=_0x32458c['replace'](_0x4bbdfb,'@'+_0x4acba6['to']+'\x22');}_0x197126=JSON[_0x917b52(0x140)](_0x32458c);}catch(_0x376cea){_0x2a0389[_0x917b52(0x1c9)][_0x917b52(0xf0)](_0xdff44d+_0x917b52(0x18c)+_0x376cea[_0x917b52(0x114)]+_0x917b52(0x1ed)+_0x32458c),_0x2a0389['logger'][_0x917b52(0x157)](_0xdff44d+'\x20done'+_0x77a231);return;}const _0xcff90b=_0x197126[_0x917b52(0x1be)];if(!_0xcff90b){_0x2a0389['logger'][_0x917b52(0xf0)](_0xdff44d+_0x917b52(0x184)+JSON['stringify'](_0x197126)),_0x2a0389[_0x917b52(0x1c9)][_0x917b52(0x157)](_0xdff44d+'\x20done'+_0x77a231);return;}if(!_0xcff90b['userName']){_0x2a0389[_0x917b52(0x1c9)][_0x917b52(0xf0)](_0xdff44d+'\x20missing\x20mandatory\x20user.userName\x20in\x20message:\x20'+JSON['stringify'](_0x197126)),_0x2a0389[_0x917b52(0x1c9)]['debug'](_0xdff44d+_0x917b52(0x1ac)+_0x77a231);return;}delete _0xcff90b[_0x917b52(0x1e3)];let _0x6d107f;_0xcff90b['id']&&(_0x6d107f=_0xcff90b['id'],delete _0xcff90b['id']);let _0x26fa62;_0xcff90b['onCreate']&&(_0x26fa62=utils['copyObj'](_0xcff90b[_0x917b52(0x1a4)]),delete _0xcff90b['onCreate']);await _0x162af5(_0x11a74c,_0xcff90b);const _0x216f27=_0xcff90b[_0x917b52(0xf3)];let _0x49f5e6,_0xb395be;try{_0x49f5e6=await _0x5d75a1(_0x11a74c,_0x917b52(0xf3),_0x216f27);}catch(_0x18ab71){_0x2a0389[_0x917b52(0x1c9)][_0x917b52(0xf0)](_0xdff44d+_0x917b52(0x1c3)+_0x18ab71[_0x917b52(0x114)]),_0x2a0389[_0x917b52(0x1c9)][_0x917b52(0x157)](_0xdff44d+'\x20done'+_0x77a231);const _0x181cf1=['UnableConnectingHost',_0x917b52(0x1f1),_0x917b52(0x107),_0x917b52(0x17d),_0x917b52(0x189),_0x917b52(0x144)];for(const _0x508513 in _0x181cf1){if(_0x18ab71[_0x917b52(0x114)][_0x917b52(0x12a)](_0x508513))return!![];}return;}if(!_0x4a3c1c[_0x917b52(0x113)]){let _0x33ee0d=![];if(_0x197126[_0x917b52(0x1d1)]&&Array[_0x917b52(0x11e)](_0x197126['Operations']))for(let _0x4dcff6=0x0;_0x4dcff6<_0x197126['Operations']['length'];_0x4dcff6++){const _0xd5cfba=_0x197126[_0x917b52(0x1d1)][_0x4dcff6];_0xd5cfba[_0x917b52(0x1ae)][_0x917b52(0x104)](_0x917b52(0x1bf))&&(_0xd5cfba[_0x917b52(0x1ae)]='groups',Array[_0x917b52(0x11e)](_0xd5cfba[_0x917b52(0x14a)])?(_0xd5cfba[_0x917b52(0x14a)][0x0]['id']=_0xd5cfba[_0x917b52(0x14a)][0x0][_0x917b52(0x14a)],_0xd5cfba[_0x917b52(0x14a)][0x0][_0x917b52(0x1cb)]=_0xd5cfba[_0x917b52(0x14a)][0x0][_0x917b52(0x1c7)]+'\x20-\x20'+_0xd5cfba['value'][0x0][_0x917b52(0x14a)],delete _0xd5cfba['value'][0x0][_0x917b52(0x14a)],delete _0xd5cfba['value'][0x0]['type']):_0xd5cfba[_0x917b52(0x14a)]=[{'id':_0xd5cfba[_0x917b52(0x14a)],'display':_0xd5cfba[_0x917b52(0x14a)]}],delete _0xd5cfba[_0x917b52(0xf8)],_0x33ee0d=!![]);}if(_0xcff90b[_0x917b52(0x1bf)]&&Array[_0x917b52(0x11e)](_0xcff90b[_0x917b52(0x1bf)])&&_0xcff90b[_0x917b52(0x1bf)][_0x917b52(0x1b1)]>0x0){if(!_0xcff90b['groups'])_0xcff90b[_0x917b52(0x1e2)]=[];if(!Array['isArray'](_0xcff90b[_0x917b52(0x1e2)]))_0xcff90b[_0x917b52(0x1e2)]=[];for(let _0x4a143f=0x0;_0x4a143f<_0xcff90b['roles'][_0x917b52(0x1b1)];_0x4a143f++){const _0x44633e={},_0x5c0afc=_0xcff90b[_0x917b52(0x1bf)][_0x4a143f];_0x44633e[_0x917b52(0x14a)]=_0x5c0afc[_0x917b52(0x14a)],_0x44633e['display']=_0x5c0afc[_0x917b52(0x1c7)]+_0x917b52(0x173)+_0x5c0afc[_0x917b52(0x1cb)],_0xcff90b['groups'][_0x917b52(0x174)](_0x44633e);}delete _0xcff90b['roles'],_0x33ee0d=!![];}if(_0x33ee0d)_0x2a0389[_0x917b52(0x1c9)][_0x917b52(0x157)](_0xdff44d+_0x917b52(0x1dd)+JSON[_0x917b52(0x1df)](_0x197126));}if(!_0x49f5e6){if(_0x197126[_0x917b52(0x183)]===_0x917b52(0x1e4)){_0x2a0389[_0x917b52(0x1c9)][_0x917b52(0x157)](_0xdff44d+_0x917b52(0x150)+_0x216f27+_0x917b52(0x13d)),_0x2a0389[_0x917b52(0x1c9)][_0x917b52(0x157)](_0xdff44d+_0x917b52(0x1ac)+_0x77a231);return;}if(_0x4a3c1c[_0x917b52(0x12d)]&&_0x4a3c1c[_0x917b52(0x12d)]===!![]){_0x2a0389[_0x917b52(0x1c9)]['debug'](_0xdff44d+_0x917b52(0xf4)+_0x216f27+_0x917b52(0x171)),_0x2a0389[_0x917b52(0x1c9)][_0x917b52(0x157)](_0xdff44d+'\x20done'+_0x77a231);return;}if(Object[_0x917b52(0x176)]['hasOwnProperty'][_0x917b52(0xf5)](_0xcff90b,_0x917b52(0x128))){if(typeof _0xcff90b['active']===_0x917b52(0x181)){const _0x2dd703=_0xcff90b['active'][_0x917b52(0xfe)]();if(_0x2dd703===_0x917b52(0xf1))_0xcff90b[_0x917b52(0x128)]=!![];else{if(_0x2dd703===_0x917b52(0x133))_0xcff90b[_0x917b52(0x128)]=![];}}if(_0xcff90b[_0x917b52(0x128)]===![]){_0x2a0389['logger'][_0x917b52(0x157)](_0xdff44d+_0x917b52(0xf4)+_0x216f27+_0x917b52(0x10f)),_0x2a0389[_0x917b52(0x1c9)][_0x917b52(0x157)](_0xdff44d+_0x917b52(0x1ac)+_0x77a231);return;}}_0x2a0389[_0x917b52(0x1c9)][_0x917b52(0x157)](_0xdff44d+_0x917b52(0x1b4)+_0x216f27);const _0x4598f4=utils[_0x917b52(0x1ec)](_0xcff90b);try{delete _0x4598f4[_0x917b52(0x1e2)];!_0x4598f4[_0x917b52(0xf2)]&&_0x4a3c1c['generateUserPassword']&&_0x4a3c1c['generateUserPassword']===!![]&&(_0x4598f4[_0x917b52(0xf2)]=utils[_0x917b52(0x11c)](0xf));if(_0x26fa62||_0x6d107f){if(_0x26fa62)for(const _0x19f9fe in _0x26fa62){_0x4598f4[_0x19f9fe]=_0x26fa62[_0x19f9fe];}if(_0x6d107f)_0x4598f4['id']=_0x6d107f;await _0x162af5(_0x11a74c,_0x4598f4);}await _0x2a0389['createUser'](_0x11a74c,_0x4598f4),_0xcff90b[_0x917b52(0x1e2)]&&Array['isArray'](_0xcff90b[_0x917b52(0x1e2)])&&_0xcff90b['groups'][_0x917b52(0x1b1)]>0x0&&(_0xb395be=await _0x5d75a1(_0x11a74c,_0x917b52(0xf3),_0x216f27));}catch(_0x2b64ab){_0x2a0389[_0x917b52(0x1c9)][_0x917b52(0xf0)](_0xdff44d+_0x917b52(0x168)+JSON[_0x917b52(0x1df)](_0x4598f4)+_0x917b52(0x1ef)+_0x2b64ab[_0x917b52(0x114)]+'}'),_0x2a0389[_0x917b52(0x1c9)][_0x917b52(0x157)](_0xdff44d+_0x917b52(0x1ac)+_0x77a231);return;}}if(_0x49f5e6||_0xb395be){if(_0x197126[_0x917b52(0x183)]===_0x917b52(0x1e4)){if(_0x4a3c1c[_0x917b52(0x12d)]&&_0x4a3c1c[_0x917b52(0x12d)]===!![]){_0x2a0389['logger'][_0x917b52(0x157)](_0xdff44d+'\x20Delete\x20User\x20id='+_0x49f5e6+_0x917b52(0xfc)),_0x2a0389['logger'][_0x917b52(0x157)](_0xdff44d+_0x917b52(0x1ac)+_0x77a231);return;}_0x2a0389['logger'][_0x917b52(0x157)](_0xdff44d+'\x20Delete\x20User\x20id='+_0x49f5e6);try{await _0x2a0389[_0x917b52(0x1e4)](_0x11a74c,_0x49f5e6);}catch(_0x4227fc){_0x2a0389[_0x917b52(0x1c9)]['error'](_0xdff44d+_0x917b52(0x1ab)+_0x49f5e6+_0x917b52(0x1ef)+_0x4227fc[_0x917b52(0x114)]+'}'),_0x2a0389[_0x917b52(0x1c9)]['debug'](_0xdff44d+_0x917b52(0x1ac)+_0x77a231);return;}}else{if(_0xb395be)_0x49f5e6=_0xb395be;_0x2a0389[_0x917b52(0x1c9)][_0x917b52(0x157)](_0xdff44d+_0x917b52(0x163)+_0x49f5e6);const _0x220e97={};_0x220e97[_0x917b52(0x18a)]=()=>{},_0x220e97[_0x917b52(0x1d7)]={},_0x220e97[_0x917b52(0x1d7)][_0x917b52(0x170)]=_0x11a74c,_0x220e97[_0x917b52(0x1d7)]['id']=_0x49f5e6,_0x220e97[_0x917b52(0x12c)]={},_0x220e97[_0x917b52(0x12c)][_0x917b52(0x141)]=_0x11a74c?'/'+_0x11a74c+_0x917b52(0x122)+_0x49f5e6:_0x917b52(0x122)+_0x49f5e6,_0x220e97[_0x917b52(0x12c)]['body']=_0xcff90b;try{await _0x2a0389[_0x917b52(0x135)](_0x220e97,_0x4a3c1c[_0x917b52(0x125)]);}catch(_0x3cc849){_0x2a0389[_0x917b52(0x1c9)][_0x917b52(0xf0)](_0xdff44d+_0x917b52(0x163)+_0x49f5e6+_0x917b52(0x1ef)+_0x3cc849[_0x917b52(0x114)]),_0x2a0389[_0x917b52(0x1c9)][_0x917b52(0x157)](_0xdff44d+'\x20done'+_0x77a231);return;}if(_0x220e97[_0x917b52(0x110)]&&(_0x220e97[_0x917b52(0x110)]<0xc8||_0x220e97['status']>0x12b)){if(_0x220e97[_0x917b52(0x18d)]){if(_0x220e97[_0x917b52(0x18d)][_0x917b52(0x149)]){let _0x4f4f01=_0x220e97[_0x917b52(0x18d)][_0x917b52(0x149)];_0x4f4f01=_0x4f4f01[_0x917b52(0x152)](_0x2a0389['gwName']+'['+_0x2a0389[_0x917b52(0x119)]+']',''+_0xdff44d),_0x2a0389[_0x917b52(0x1c9)][_0x917b52(0xf0)](''+_0x4f4f01);}else{if(_0x220e97[_0x917b52(0x18d)][_0x917b52(0x11d)]&&Array[_0x917b52(0x11e)](_0x220e97[_0x917b52(0x18d)][_0x917b52(0x11d)])&&_0x220e97[_0x917b52(0x18d)]['Errors'][_0x917b52(0x1b1)]>0x0){let _0x58de21=_0x220e97[_0x917b52(0x18d)][_0x917b52(0x11d)][0x0][_0x917b52(0x17b)];_0x58de21=_0x58de21[_0x917b52(0x152)](_0x2a0389[_0x917b52(0x1e0)]+'['+_0x2a0389[_0x917b52(0x119)]+']',''+_0xdff44d),_0x2a0389[_0x917b52(0x1c9)][_0x917b52(0xf0)](''+_0x58de21);}}}}if(_0x4a3c1c[_0x917b52(0x125)]){const [_0x54e9b8,_0x48f36d]=_0x2a0389['convertedScim20']({'Operations':_0x197126[_0x917b52(0x1d1)]});if(_0x48f36d){_0x2a0389[_0x917b52(0x1c9)]['error'](_0xdff44d+_0x917b52(0x163)+_0x49f5e6+_0x917b52(0x15a)+_0x48f36d[_0x917b52(0x114)]),_0x2a0389['logger'][_0x917b52(0x157)](_0xdff44d+_0x917b52(0x1ac)+_0x77a231);return;}const _0x434f3a=[];if(_0x54e9b8[_0x917b52(0x1bf)]&&Array['isArray'](_0x54e9b8['roles']))for(let _0x2fb5dd=0x0;_0x2fb5dd<_0x54e9b8[_0x917b52(0x1bf)][_0x917b52(0x1b1)];_0x2fb5dd++){_0x54e9b8[_0x917b52(0x1bf)][_0x2fb5dd]['operation']&&_0x54e9b8[_0x917b52(0x1bf)][_0x2fb5dd]['operation']===_0x917b52(0x148)&&_0x434f3a['push'](_0x54e9b8[_0x917b52(0x1bf)][_0x2fb5dd]);}if(_0x434f3a[_0x917b52(0x1b1)]>0x0)try{await _0x2a0389[_0x917b52(0x112)](_0x11a74c,_0x49f5e6,{'roles':_0x434f3a});}catch(_0x1a386d){_0x2a0389[_0x917b52(0x1c9)][_0x917b52(0xf0)](_0xdff44d+_0x917b52(0x163)+_0x49f5e6+'\x20role\x20removal\x20error:\x20'+_0x1a386d[_0x917b52(0x114)]);}const _0x40455a=[];if(_0x54e9b8['groups']&&Array[_0x917b52(0x11e)](_0x54e9b8[_0x917b52(0x1e2)]))for(let _0x5a8057=0x0;_0x5a8057<_0x54e9b8[_0x917b52(0x1e2)]['length'];_0x5a8057++){_0x54e9b8[_0x917b52(0x1e2)][_0x5a8057][_0x917b52(0x1d9)]&&_0x54e9b8[_0x917b52(0x1e2)][_0x5a8057][_0x917b52(0x1d9)]===_0x917b52(0x148)&&_0x40455a[_0x917b52(0x174)](_0x54e9b8[_0x917b52(0x1e2)][_0x5a8057]);}if(_0x40455a[_0x917b52(0x1b1)]>0x0)for(let _0x31cfe8=0x0;_0x31cfe8<_0x40455a[_0x917b52(0x1b1)];_0x31cfe8++){try{await _0x2a0389[_0x917b52(0x1ee)](_0x11a74c,_0x40455a[_0x31cfe8]['id'],{'members':[{'operation':_0x917b52(0x148),'value':_0x49f5e6}]});}catch(_0xb09c4c){_0x2a0389['logger']['error'](_0xdff44d+_0x917b52(0x163)+_0x49f5e6+'\x20group\x20removal\x20error:\x20'+_0xb09c4c['message']);}}}if(_0x4a3c1c[_0x917b52(0x1d5)]&&_0x197126[_0x917b52(0x183)]===_0x917b52(0x112)){if(_0xcff90b['groups']&&Array[_0x917b52(0x11e)](_0xcff90b[_0x917b52(0x1e2)])&&_0xcff90b[_0x917b52(0x1e2)][_0x917b52(0x1b1)]===0x0){if(_0xcff90b[_0x917b52(0x1bf)]&&Array[_0x917b52(0x11e)](_0xcff90b[_0x917b52(0x1bf)])&&_0xcff90b[_0x917b52(0x1bf)][_0x917b52(0x1b1)]===0x0){if(_0x197126[_0x917b52(0x1d1)]&&Array[_0x917b52(0x11e)](_0x197126[_0x917b52(0x1d1)])&&_0x197126[_0x917b52(0x1d1)][_0x917b52(0x1b1)]>0x0){let _0x383183=![];for(let _0x1374d0=0x0;_0x1374d0<_0x197126['Operations'][_0x917b52(0x1b1)];_0x1374d0++){const _0x4b7999=_0x197126[_0x917b52(0x1d1)][_0x1374d0];if(_0x4b7999['op']===_0x917b52(0x134)){if(_0x4b7999[_0x917b52(0x1ae)]){if(_0x4b7999['path']['startsWith']('roles')&&_0x4b7999['typeId']){_0x383183=!![];break;}else{if(_0x4b7999[_0x917b52(0x1ae)]==='groups'){_0x383183=!![];break;}}}}}if(_0x383183){_0x2a0389[_0x917b52(0x1c9)]['debug'](_0xdff44d+_0x917b52(0x1ab)+_0x49f5e6);try{await _0x2a0389[_0x917b52(0x1e4)](_0x11a74c,_0x49f5e6);}catch(_0x3950eb){_0x2a0389[_0x917b52(0x1c9)][_0x917b52(0xf0)](_0xdff44d+'\x20Delete\x20User\x20id='+_0x49f5e6+_0x917b52(0x1ef)+_0x3950eb['message']+'}'),_0x2a0389[_0x917b52(0x1c9)]['debug'](_0xdff44d+_0x917b52(0x1ac)+_0x77a231);return;}}}}}}}}_0x2a0389[_0x917b52(0x1c9)][_0x917b52(0x157)](_0xdff44d+_0x917b52(0x1ac)+_0x77a231);}catch(_0x332a0e){_0x2a0389['logger']['error'](_0x2a0389[_0x917b52(0x1e0)]+'['+_0x2a0389['pluginName']+']\x20subscriber['+_0x11a74c+']['+_0x1be0d9+']\x20error:\x20'+_0x332a0e[_0x917b52(0x114)]+_0x917b52(0x159)+_0x77a231);}},_0x5d328b=nats[_0x27c58(0x111)](),_0x18488f=_0x117e8a[_0x27c58(0x108)](),_0x3beace=(_0x27c58(0x1e5)+_0x2a0389[_0x27c58(0x119)]+'_'+_0x11a74c)['replaceAll']('*','#')[_0x27c58(0x1a7)]('>','##')[_0x27c58(0x1a7)]('.','_'),_0x10406a=_0x1be0d9[_0x27c58(0x160)]('.')[0x0][_0x27c58(0x14e)]()==='GW',_0x238d0d=async()=>{const _0x5bb862=_0x27c58;try{let _0x45ba8b;const _0x3abe35=''+_0x4a3c1c?.[_0x5bb862(0x1c5)]?.['tenant'],_0x3d30c0=await _0x117e8a[_0x5bb862(0x185)](),_0x4b2f38=async()=>{const _0x5d3c86=_0x5bb862;let _0x8e72c0;try{_0x8e72c0=await _0x18488f[_0x5d3c86(0x1de)][_0x5d3c86(0x124)](_0x3abe35,_0x3beace);}catch(_0x861829){const _0x371bd2={'durable_name':_0x3beace,'deliver_policy':nats[_0x5d3c86(0x14d)][_0x5d3c86(0x1ce)],'ack_policy':nats['AckPolicy'][_0x5d3c86(0x197)],'filter_subject':_0x1be0d9};await _0x3d30c0['consumers'][_0x5d3c86(0x1b2)](_0x3abe35,_0x371bd2),_0x8e72c0=await _0x18488f[_0x5d3c86(0x1de)][_0x5d3c86(0x124)](_0x3abe35,_0x3beace);}if(_0x8e72c0?.['_info']?.[_0x5d3c86(0x19b)]?.['deliver_policy']!==_0x5d3c86(0x120))throw new Error(_0x5d3c86(0x1b9));_0x8e72c0?.[_0x5d3c86(0x1bd)]?.[_0x5d3c86(0x19b)]?.['filter_subject']!==_0x1be0d9&&(await _0x3d30c0[_0x5d3c86(0x1de)][_0x5d3c86(0x153)](_0x3abe35,_0x3beace,{'filter_subject':_0x1be0d9}),_0x8e72c0=await _0x18488f['consumers'][_0x5d3c86(0x124)](_0x3abe35,_0x3beace)),_0x45ba8b=await _0x8e72c0['consume']({'max_messages':0x64}),_0x3872ba(_0x45ba8b);},_0x3872ba=async _0x5a9912=>{const _0x43d155=_0x5bb862;for await(const _0x1b59b2 of await _0x5a9912['status']()){switch(_0x1b59b2['type']){case nats['ConsumerEvents']['ConsumerNotFound']:_0x2a0389['logger'][_0x43d155(0x17c)](_0x2a0389['gwName']+'['+_0x2a0389[_0x43d155(0x119)]+_0x43d155(0x15d)+_0x11a74c+']['+_0x1be0d9+']\x20client\x20consumer\x20reinitiated\x20because\x20of\x20'+_0x1b59b2[_0x43d155(0x1c7)]),_0x4b2f38();return;}}};await _0x4b2f38();let _0x2c47f3=-0x1;do{for await(const _0x419c38 of _0x45ba8b){if(!_0x419c38['headers']||!_0x419c38['headers'][_0x5bb862(0x124)](_0x5bb862(0x1c1))){_0x419c38['ack']();continue;}_0x2c47f3=_0x45ba8b['getProcessed']();const _0x18df0a=_0x2a0389[_0x5bb862(0x1e0)]+'['+_0x2a0389['pluginName']+_0x5bb862(0x15d)+_0x11a74c+']['+_0x419c38[_0x5bb862(0x16b)]+']['+_0x2c47f3+']['+(_0x419c38[_0x5bb862(0x17f)]?_0x419c38[_0x5bb862(0x17f)][_0x5bb862(0x124)]('Msg-Id'):'')+']',_0x45ca5c=_0x5d328b[_0x5bb862(0x154)](_0x419c38['data']),_0x9bf5b8=await _0x1dc621(_0x18df0a,_0x45ca5c);if(!_0x9bf5b8||_0x9bf5b8!==!![])_0x419c38[_0x5bb862(0x16c)]();else _0x2a0389[_0x5bb862(0x1c9)][_0x5bb862(0xf0)](_0x18df0a+'\x20subscriber\x20error:\x20scimgateway\x20endpoint\x20connect\x20problem\x20-\x20will\x20do\x20auto\x20retry\x20until\x20connected');if(_0x2c47f3<0x1)break;}}while(_0x2c47f3===0x0);}catch(_0x1935b3){_0x2a0389['logger'][_0x5bb862(0xf0)](_0x2a0389['gwName']+'['+_0x2a0389[_0x5bb862(0x119)]+']\x20subscriber['+_0x11a74c+']['+_0x1be0d9+_0x5bb862(0x13c)+_0x1935b3[_0x5bb862(0x114)]);}},_0x1088a5=async()=>{const _0xbeb5b9=_0x27c58,_0x389570=_0x117e8a['subscribe'](_0x1be0d9,{'max':0x64});for await(const _0x2898a4 of _0x389570){if(!_0x2898a4[_0xbeb5b9(0x17f)]||!_0x2898a4['headers'][_0xbeb5b9(0x124)]('Msg-Id'))continue;let _0x54e832,_0x223702;try{try{_0x54e832=JSON[_0xbeb5b9(0x140)](_0x2898a4['string']());}catch(_0xe14b2d){const _0x3f05fc=_0xbeb5b9(0x10d);_0x2a0389[_0xbeb5b9(0x1c9)][_0xbeb5b9(0xf0)](_0x2a0389[_0xbeb5b9(0x1e0)]+'['+_0x2a0389[_0xbeb5b9(0x119)]+_0xbeb5b9(0x15d)+_0x11a74c+']['+_0x1be0d9+']\x20'+_0x3f05fc+':\x20'+_0x2898a4[_0xbeb5b9(0x181)]());throw new Error(_0x3f05fc);}if(!_0x54e832||!_0x54e832['handle']){const _0x33c4b3=_0xbeb5b9(0x1e9);_0x2a0389[_0xbeb5b9(0x1c9)][_0xbeb5b9(0xf0)](_0x2a0389['gwName']+'['+_0x2a0389['pluginName']+_0xbeb5b9(0x15d)+_0x11a74c+']['+_0x1be0d9+']\x20'+_0x33c4b3+':\x20'+_0x54e832);throw new Error(_0x33c4b3);}!Object[_0xbeb5b9(0x176)]['hasOwnProperty']['call'](_0x54e832,_0xbeb5b9(0x170))&&(_0x54e832[_0xbeb5b9(0x170)]=_0xbeb5b9(0xf6));if(_0x54e832[_0xbeb5b9(0x170)]!==_0x11a74c){const _0xe07104=_0xbeb5b9(0x1bb)+_0x54e832[_0xbeb5b9(0x170)]+'\x20not\x20equal\x20subscriber\x20configured\x20baseEntity='+_0x11a74c;_0x2a0389['logger']['error'](_0x2a0389['gwName']+'['+_0x2a0389[_0xbeb5b9(0x119)]+_0xbeb5b9(0x15d)+_0x11a74c+']['+_0x1be0d9+']\x20'+_0xe07104);throw new Error(_0xe07104);}_0x223702=_0x2a0389['gwName']+'['+_0x2a0389[_0xbeb5b9(0x119)]+']\x20subscriber['+_0x11a74c+']['+_0x2898a4[_0xbeb5b9(0x16b)]+']['+(_0x2898a4['headers']?_0x2898a4[_0xbeb5b9(0x17f)][_0xbeb5b9(0x124)]('Msg-Id'):'')+']',_0x2a0389[_0xbeb5b9(0x1c9)][_0xbeb5b9(0x157)](_0x223702+_0xbeb5b9(0x1c2));const _0x39ea01={};let _0x575a5d,_0x3d8fc8;switch(_0x54e832[_0xbeb5b9(0x13e)]){case _0xbeb5b9(0x1e1):_0x575a5d=await _0x2a0389[_0x54e832[_0xbeb5b9(0x13e)]](_0x11a74c,_0x54e832['obj'],_0x54e832['attributes'],_0x54e832[_0xbeb5b9(0x1a2)]);break;case'getGroups':_0x575a5d=await _0x2a0389[_0x54e832['handle']](_0x11a74c,_0x54e832[_0xbeb5b9(0x13f)],_0x54e832['attributes'],_0x54e832[_0xbeb5b9(0x1a2)]);break;case'createUser':_0x575a5d=await _0x2a0389[_0x54e832['handle']](_0x11a74c,_0x54e832['obj'],_0x54e832[_0xbeb5b9(0x1a2)]);break;case'createGroup':_0x575a5d=await _0x2a0389[_0x54e832[_0xbeb5b9(0x13e)]](_0x11a74c,_0x54e832[_0xbeb5b9(0x13f)],_0x54e832[_0xbeb5b9(0x1a2)]);break;case _0xbeb5b9(0x1e4):_0x575a5d=await _0x2a0389[_0x54e832['handle']](_0x11a74c,_0x54e832['id'],_0x54e832['ctxPassThrough']);break;case _0xbeb5b9(0x1c8):_0x575a5d=await _0x2a0389[_0x54e832['handle']](_0x11a74c,_0x54e832['id'],_0x54e832['ctxPassThrough']);break;case'modifyUser':_0x575a5d=await _0x2a0389[_0x54e832[_0xbeb5b9(0x13e)]](_0x11a74c,_0x54e832['id'],_0x54e832[_0xbeb5b9(0x13f)],_0x54e832['ctxPassThrough']);break;case _0xbeb5b9(0x1ee):_0x575a5d=await _0x2a0389[_0x54e832[_0xbeb5b9(0x13e)]](_0x11a74c,_0x54e832['id'],_0x54e832['obj'],_0x54e832['ctxPassThrough']);break;case _0xbeb5b9(0x135):_0x39ea01['set']=()=>{},_0x39ea01['params']={},_0x39ea01[_0xbeb5b9(0x1d7)][_0xbeb5b9(0x170)]=_0x11a74c,_0x39ea01[_0xbeb5b9(0x1d7)]['id']=_0x54e832['id'],_0x39ea01[_0xbeb5b9(0x12c)]={},_0x39ea01[_0xbeb5b9(0x12c)][_0xbeb5b9(0x141)]=_0x54e832[_0xbeb5b9(0x141)],_0x39ea01[_0xbeb5b9(0x12c)]['body']=_0x54e832[_0xbeb5b9(0x13f)],_0x39ea01[_0xbeb5b9(0x182)]=_0x54e832['ctxPassThrough'],_0x575a5d=await _0x2a0389[_0x54e832[_0xbeb5b9(0x13e)]](_0x39ea01);break;case'postApi':_0x575a5d=await _0x2a0389[_0x54e832[_0xbeb5b9(0x13e)]](_0x11a74c,_0x54e832[_0xbeb5b9(0x13f)],_0x54e832[_0xbeb5b9(0x1a2)]);break;case _0xbeb5b9(0x12e):_0x575a5d=await _0x2a0389[_0x54e832[_0xbeb5b9(0x13e)]](_0x11a74c,_0x54e832['id'],_0x54e832[_0xbeb5b9(0x13f)],_0x54e832[_0xbeb5b9(0x1a2)]);break;case _0xbeb5b9(0x15b):_0x575a5d=await _0x2a0389[_0x54e832[_0xbeb5b9(0x13e)]](_0x11a74c,_0x54e832['id'],_0x54e832[_0xbeb5b9(0x13f)],_0x54e832[_0xbeb5b9(0x1a2)]);break;case'getApi':_0x575a5d=await _0x2a0389[_0x54e832['handle']](_0x11a74c,_0x54e832['id'],_0x54e832[_0xbeb5b9(0x1aa)],_0x54e832['obj'],_0x54e832['ctxPassThrough']);break;case _0xbeb5b9(0x1d8):_0x575a5d=await _0x2a0389[_0x54e832['handle']](_0x11a74c,_0x54e832['id'],_0x54e832[_0xbeb5b9(0x1a2)]);break;default:_0x3d8fc8=_0xbeb5b9(0x162)+_0x54e832[_0xbeb5b9(0x13e)]+'\x27\x20not\x20supported',_0x2a0389[_0xbeb5b9(0x1c9)]['error'](_0x2a0389['gwName']+'['+_0x2a0389[_0xbeb5b9(0x119)]+']\x20subscriber['+_0x11a74c+']['+_0x1be0d9+']\x20'+_0x3d8fc8);throw new Error(_0x3d8fc8);}if(!_0x575a5d)_0x575a5d=null;const _0x4501dc=JSON[_0xbeb5b9(0x1df)](_0x575a5d);_0x2898a4[_0xbeb5b9(0x139)](_0x4501dc),_0x2a0389[_0xbeb5b9(0x1c9)][_0xbeb5b9(0x17c)](_0x223702+_0xbeb5b9(0x142)+_0x54e832[_0xbeb5b9(0x13e)]+_0xbeb5b9(0x121)+(_0x54e832[_0xbeb5b9(0x13f)]?JSON[_0xbeb5b9(0x1df)](_0x54e832[_0xbeb5b9(0x13f)]):'')+',\x20id='+(_0x54e832['id']?_0x54e832['id']:'')+_0xbeb5b9(0x15c)+(_0x54e832[_0xbeb5b9(0x18f)]?_0x54e832[_0xbeb5b9(0x18f)]:'')+'\x20message\x20response:\x20'+_0x4501dc+_0x77a231);}catch(_0x2d5654){const _0x238813=_0xbeb5b9(0x1b8)+_0x2d5654[_0xbeb5b9(0x114)]+_0xbeb5b9(0x146)+_0x2d5654[_0xbeb5b9(0x179)]+'\x22}';_0x2898a4[_0xbeb5b9(0x139)](_0x238813),_0x2a0389[_0xbeb5b9(0x1c9)][_0xbeb5b9(0x17c)]((_0x223702||'')+_0xbeb5b9(0x142)+_0x54e832['handle']+_0xbeb5b9(0x121)+(_0x54e832['obj']?JSON[_0xbeb5b9(0x1df)](_0x54e832[_0xbeb5b9(0x13f)]):'')+',\x20id='+(_0x54e832['id']?_0x54e832['id']:'')+',\x20attributes='+(_0x54e832['attributes']?_0x54e832[_0xbeb5b9(0x18f)]:'')+_0xbeb5b9(0x19a)+_0x238813+_0x77a231);}}};if(_0x10406a)_0x1088a5();else _0x238d0d();},_0x3b536e=async(_0x2c8080,_0x2bf2f2)=>{const _0x1ecb69=_0x375032,_0x49ccc0=_0x2f6dd3[_0x2c8080][_0x1ecb69(0x19b)]?.['nats']?.[_0x1ecb69(0x16b)];let _0xb2b9f0=0x0;for await(const _0x3ca72a of _0x2bf2f2[_0x1ecb69(0x110)]()){switch(_0x3ca72a[_0x1ecb69(0x1c7)]){case nats[_0x1ecb69(0x1c6)][_0x1ecb69(0x131)]:_0x2a0389[_0x1ecb69(0x1c9)][_0x1ecb69(0xf0)](_0x2a0389[_0x1ecb69(0x1e0)]+'['+_0x2a0389[_0x1ecb69(0x119)]+_0x1ecb69(0x15d)+_0x2c8080+']['+_0x49ccc0+']\x20client\x20disconnected\x20'+_0x3ca72a[_0x1ecb69(0x199)]+_0x1ecb69(0x12b)),_0xb2b9f0=0x0;break;case nats[_0x1ecb69(0x1c6)][_0x1ecb69(0x18e)]:_0x2a0389['logger']['info'](_0x2a0389[_0x1ecb69(0x1e0)]+'['+_0x2a0389[_0x1ecb69(0x119)]+']\x20subscriber['+_0x2c8080+']['+_0x49ccc0+_0x1ecb69(0x1d3)+_0x3ca72a[_0x1ecb69(0x199)]);break;case nats[_0x1ecb69(0x1c6)][_0x1ecb69(0x18b)]:_0x2a0389[_0x1ecb69(0x1c9)]['error'](_0x2a0389['gwName']+'['+_0x2a0389['pluginName']+']\x20subscriber['+_0x2c8080+']['+_0x49ccc0+_0x1ecb69(0x106)+_0x3ca72a[_0x1ecb69(0x199)]);break;case nats[_0x1ecb69(0x19d)]['Reconnecting']:_0xb2b9f0+=0x1;_0xb2b9f0%0x1e===0x0&&_0x2a0389[_0x1ecb69(0x1c9)][_0x1ecb69(0x157)](_0x2a0389['gwName']+'['+_0x2a0389[_0x1ecb69(0x119)]+_0x1ecb69(0x15d)+_0x2c8080+']['+_0x49ccc0+_0x1ecb69(0x1cf)+_0x3ca72a[_0x1ecb69(0x199)]+_0x1ecb69(0xfb)+_0xb2b9f0+')');break;case nats[_0x1ecb69(0x19d)]['StaleConnection']:_0x2a0389[_0x1ecb69(0x1c9)][_0x1ecb69(0x157)](_0x2a0389[_0x1ecb69(0x1e0)]+'['+_0x2a0389['pluginName']+_0x1ecb69(0x15d)+_0x2c8080+']['+_0x49ccc0+_0x1ecb69(0x180)+_0x3ca72a['data']);break;}}};process['on'](_0x375032(0x166),async()=>{const _0x45c287=_0x375032;for(const _0x510083 in _0x2f6dd3){_0x2f6dd3[_0x510083]['nc']&&!_0x2f6dd3[_0x510083]['nc'][_0x45c287(0x127)]()&&await _0x2f6dd3[_0x510083]['nc'][_0x45c287(0x1cd)]();}}),process['on'](_0x375032(0x1e8),async()=>{const _0x4cb3e5=_0x375032;for(const _0x168095 in _0x2f6dd3){_0x2f6dd3[_0x168095]['nc']&&!_0x2f6dd3[_0x168095]['nc'][_0x4cb3e5(0x127)]()&&await _0x2f6dd3[_0x168095]['nc']['drain']();}});const _0x5d75a1=async(_0x52a935,_0x58d465,_0xdc639)=>{const _0x39cb61=_0x375032,_0x1a764e={'attribute':_0x58d465,'operator':'eq','value':_0xdc639,'rawFilter':undefined,'startIndex':undefined,'count':undefined},_0x23e78d=[_0x58d465];if(_0x58d465!=='id')_0x23e78d[_0x39cb61(0x174)]('id');try{const _0x377504=await _0x2a0389['getUsers'](_0x52a935,_0x1a764e,_0x23e78d);if(!_0x377504||!_0x377504[_0x39cb61(0x16e)]||!Array['isArray'](_0x377504[_0x39cb61(0x16e)]))throw new Error(_0x39cb61(0x1c0)+JSON[_0x39cb61(0x1df)](_0x1a764e)+_0x39cb61(0x10b));if(_0x377504[_0x39cb61(0x16e)][_0x39cb61(0x1b1)]===0x0)return null;else{if(_0x377504['Resources'][_0x39cb61(0x1b1)]>0x2)throw new Error(_0x39cb61(0x1c0)+JSON['stringify'](_0x1a764e)+'\x20error:\x20more\x20than\x20one\x20user\x20were\x20found}');else{const _0x56cea8=_0x377504[_0x39cb61(0x16e)][0x0];if(!_0x56cea8['id'])throw new Error(_0x39cb61(0x1c0)+JSON[_0x39cb61(0x1df)](_0x1a764e)+_0x39cb61(0x1a1)+JSON['stringify'](_0x56cea8)+_0x39cb61(0x12f));return decodeURIComponent(_0x56cea8['id']);}}}catch(_0x151547){throw new Error(_0x39cb61(0x1c0)+JSON['stringify'](_0x1a764e)+'\x20error:\x20'+_0x151547['message']+'}');}},_0x4dabde=_0x32239b=>{const _0x57f209=_0x375032;if(!_0x32239b||typeof _0x32239b!==_0x57f209(0x181))return[null,null];_0x32239b=_0x32239b[_0x57f209(0x196)]();const _0x326c8b=_0x32239b[_0x57f209(0x13b)]('(');if(_0x326c8b<0x1)return[null,null];if(_0x32239b[_0x57f209(0x191)](_0x32239b['length']-0x1)!==')')return[null,null];if(_0x269f6a(_0x32239b,'(')!==_0x269f6a(_0x32239b,')'))return[null,null];const _0x2d0ec9=_0x32239b[_0x57f209(0x191)](0x0,_0x326c8b),_0x528058=_0x32239b[_0x57f209(0x191)](_0x326c8b+0x1,_0x32239b[_0x57f209(0x1b1)]-0x1);let _0x5835d1=[];const _0x161e8f=_0x528058[_0x57f209(0x160)](',');let _0xdf0d13='';for(let _0x1a43ea=0x0;_0x1a43ea<_0x161e8f[_0x57f209(0x1b1)];_0x1a43ea++){const _0x1ae12f=_0xdf0d13?_0xdf0d13+','+_0x161e8f[_0x1a43ea]:_0x161e8f[_0x1a43ea],_0x2684e3=_0x269f6a(_0x1ae12f,'('),_0x295cb3=_0x269f6a(_0x1ae12f,')');if(_0x2684e3===_0x295cb3)_0x5835d1[_0x57f209(0x174)](_0x600a8d(_0x1ae12f,'\x22')),_0xdf0d13='';else{if(_0xdf0d13)_0xdf0d13+=','+_0x161e8f[_0x1a43ea];else _0xdf0d13+=_0x161e8f[_0x1a43ea];}}if(_0x5835d1[_0x57f209(0x1b1)]===0x0)_0x5835d1=null;return[_0x2d0ec9,_0x5835d1];};function _0x269f6a(_0x1d2c1c,_0x3502d8){const _0x5c6628=_0x375032;let _0x5b067a=0x0;for(let _0xb40f3e=0x0;_0xb40f3e<_0x1d2c1c[_0x5c6628(0x1b1)];_0xb40f3e++){_0x1d2c1c[_0x5c6628(0x1a5)](_0xb40f3e)===_0x3502d8&&(_0x5b067a+=0x1);}return _0x5b067a;}const _0x600a8d=(_0x1b5b0d,_0x54172b)=>{const _0x1ff84b=_0x375032;if(typeof _0x1b5b0d!==_0x1ff84b(0x181)||typeof _0x54172b!=='string')return _0x1b5b0d;if(_0x1b5b0d[_0x1ff84b(0x1b1)]===0x1)return _0x1b5b0d;if(_0x54172b[_0x1ff84b(0x1b1)]!==0x1)return _0x1b5b0d;return _0x1b5b0d=_0x1b5b0d[_0x1ff84b(0x196)](),_0x1b5b0d[_0x1ff84b(0x191)](0x0,0x1)===_0x54172b&&(_0x1b5b0d=_0x1b5b0d[_0x1ff84b(0x191)](0x1)),_0x1b5b0d[_0x1ff84b(0x191)](_0x1b5b0d[_0x1ff84b(0x1b1)]-0x1)===_0x54172b&&(_0x1b5b0d=_0x1b5b0d[_0x1ff84b(0x191)](0x0,_0x1b5b0d['length']-0x1)),_0x1b5b0d;},_0x30171c=async(_0x1b26cd,_0x3bdae3,_0x1df37d,_0x5d85a0)=>{const _0x14d576=_0x375032;if(!_0x3bdae3||!_0x1df37d||!_0x5d85a0)return null;const [_0x29d324,_0x428675]=_0x4dabde(_0x5d85a0);if(!_0x29d324||!_0x428675){const _0x4c5a14=_0x5d85a0[_0x14d576(0x160)]('(');if(_0x4c5a14[_0x14d576(0x1b1)]>0x1){const _0x2505fd=[_0x14d576(0x14c),_0x14d576(0x1a0),_0x14d576(0x109),'elementnumber',_0x14d576(0x102),'replace','normalize','increment',_0x14d576(0xfd)],_0x5aed12=_0x4c5a14[0x0]['toLowerCase']();if(_0x2505fd[_0x14d576(0x12a)](_0x5aed12))return null;}return _0x5d85a0;}for(let _0x490e98=0x0;_0x490e98<_0x428675['length'];_0x490e98++){if(_0x428675[_0x490e98][_0x14d576(0x191)](0x0,0x1)==='['){const _0x26f0f7=_0x428675[_0x490e98][_0x14d576(0x13b)](']');if(_0x26f0f7<0x0)return null;const _0x35f4a9=_0x428675[_0x490e98][_0x14d576(0x191)](0x1,_0x26f0f7),_0x40e65b=_0x35f4a9[_0x14d576(0x160)]('.');let _0x483e03;for(let _0x2e33ad=0x0;_0x2e33ad<_0x40e65b[_0x14d576(0x1b1)];_0x2e33ad++){if(_0x2e33ad===0x0)_0x483e03=_0x3bdae3[_0x40e65b[_0x2e33ad]];else{if(!_0x483e03)return null;_0x483e03=_0x483e03[_0x40e65b[_0x2e33ad]];}}if(!_0x483e03)return null;_0x428675[_0x490e98]=_0x483e03;}}for(let _0x37d500=0x0;_0x37d500<_0x428675[_0x14d576(0x1b1)];_0x37d500++){const [_0xd5aaaf]=_0x4dabde(_0x428675[_0x37d500]);_0xd5aaaf&&(_0x428675[_0x37d500]=await _0x30171c(_0x1b26cd,_0x3bdae3,_0x1df37d,_0x428675[_0x37d500]));}if(_0x428675[0x0]===null)return null;switch(_0x29d324[_0x14d576(0xfe)]()){case _0x14d576(0x14c):{if(_0x428675[_0x14d576(0x1b1)]!==0x1)return null;const [_0x5e0898]=_0x4dabde(_0x428675[0x0]);if(_0x5e0898)_0x428675[0x0]=await _0x30171c(_0x1b26cd,_0x3bdae3,_0x1df37d,_0x5e0898);if(_0x428675[0x0]===null)return null;return _0x428675[0x0]['toLowerCase']();}case _0x14d576(0x1a0):{if(_0x428675['length']!==0x1)return null;const [_0x5f5ba8]=_0x4dabde(_0x428675[0x0]);if(_0x5f5ba8)_0x428675[0x0]=await _0x30171c(_0x1b26cd,_0x3bdae3,_0x1df37d,_0x5f5ba8);if(_0x428675[0x0]===null)return null;return _0x428675[0x0][_0x14d576(0x14e)]();}case _0x14d576(0x109):{if(_0x428675[_0x14d576(0x1b1)]!==0x2)return null;const [_0x12fcc4]=_0x4dabde(_0x428675[0x0]);if(_0x12fcc4)_0x428675[0x0]=await _0x30171c(_0x1b26cd,_0x3bdae3,_0x1df37d,_0x12fcc4);if(_0x428675[0x0]===null)return null;if(isNaN(_0x428675[0x1]))return null;return _0x428675[0x0][_0x14d576(0x191)](0x0,_0x428675[0x1]);}case _0x14d576(0x19c):{const [_0x198910]=_0x4dabde(_0x428675[0x0]);if(_0x428675[_0x14d576(0x1b1)]<0x2)return null;if(_0x198910)_0x428675[0x0]=await _0x30171c(_0x1b26cd,_0x3bdae3,_0x1df37d,_0x198910);if(_0x428675[0x0]===null)return null;const _0x2e646a=_0x428675[0x1];if(isNaN(_0x2e646a))return null;let _0x29451a;if(_0x428675[_0x14d576(0x1b1)]===0x3)_0x29451a=_0x428675[0x0][_0x14d576(0x160)](_0x428675[0x2]);else _0x29451a=_0x29451a=_0x428675[0x0][_0x14d576(0x160)]('\x20');if(_0x2e646a<=_0x29451a[_0x14d576(0x1b1)])return _0x29451a[_0x2e646a-0x1];else return'';}case _0x14d576(0x152):{const [_0x1afa7f]=_0x4dabde(_0x428675[0x0]);if(_0x1afa7f)_0x428675[0x0]=await _0x30171c(_0x1b26cd,_0x3bdae3,_0x1df37d,_0x1afa7f);if(_0x428675[0x0]===null)return null;if(_0x428675[_0x14d576(0x1b1)]!==0x3)return null;return _0x428675[0x0]['replaceAll'](_0x428675[0x1],_0x428675[0x2]);}case _0x14d576(0x156):{if(_0x428675[_0x14d576(0x1b1)]!==0x1)return null;const [_0x45dfc6]=_0x4dabde(_0x428675[0x0]);if(_0x45dfc6)_0x428675[0x0]=await _0x30171c(_0x1b26cd,_0x3bdae3,_0x1df37d,_0x45dfc6);if(_0x428675[0x0]===null)return null;return ascii127[_0x14d576(0x115)](_0x428675[0x0]);}case'join':{let _0x1db14e='';for(let _0x3b9f96=0x0;_0x3b9f96<_0x428675[_0x14d576(0x1b1)];_0x3b9f96++){const [_0x3d4da9]=_0x4dabde(_0x428675[_0x3b9f96]);if(_0x3d4da9)_0x428675[_0x3b9f96]=await _0x30171c(_0x1b26cd,_0x3bdae3,_0x1df37d,_0x3d4da9);if(_0x428675[_0x3b9f96]===null)return null;_0x1db14e+=_0x428675[_0x3b9f96];}return _0x1db14e;}case _0x14d576(0x15f):{if(_0x428675[_0x14d576(0x1b1)]>0x2)return null;const [_0x24ffc9]=_0x4dabde(_0x428675[0x0]);if(_0x24ffc9)_0x428675[0x0]=await _0x30171c(_0x1b26cd,_0x3bdae3,_0x1df37d,_0x24ffc9);if(_0x428675[0x0]===null)return null;const _0x55300e=parseInt(_0x428675[0x0]);if(isNaN(_0x55300e))return null;let _0x3217a1=_0x14d576(0x129);_0x3217a1+=','+_0x428675[0x0];if(_0x428675[_0x14d576(0x1b1)]===0x2&&_0x428675[0x1][_0x14d576(0xfe)]()===_0x14d576(0xf1))_0x3217a1+=_0x14d576(0x1c4);else _0x3217a1+=_0x14d576(0x11a);return _0x3217a1+='##',_0x3217a1;}case _0x14d576(0xfd):{if(_0x428675[_0x14d576(0x1b1)]!==0x1)return null;const [_0x3efe71]=_0x4dabde(_0x428675[0x0]);if(_0x3efe71)_0x428675[0x0]=await _0x30171c(_0x1b26cd,_0x3bdae3,_0x1df37d,_0x3efe71);if(_0x428675[0x0]===null)return null;let _0x509aff,_0x262783=![],_0x9758c5='';const _0x5f19e7=_0x428675[0x0][_0x14d576(0x160)]('##');if(_0x5f19e7['length']>0x2)for(let _0x587a45=0x0;_0x587a45<_0x5f19e7[_0x14d576(0x1b1)];_0x587a45++){if(_0x5f19e7[_0x587a45]['startsWith'](_0x14d576(0x126))){const _0x4e3396=_0x5f19e7[_0x587a45][_0x14d576(0x160)](',');if(_0x4e3396['length']<0x2)return null;const _0x48f540=parseInt(_0x4e3396[0x1]);if(isNaN(_0x48f540))return null;_0x9758c5='##'+_0x5f19e7[_0x587a45]+'##',_0x509aff=_0x4e3396[0x1],_0x4e3396[_0x14d576(0x1b1)]>0x2&&(_0x262783=_0x4e3396[0x2][_0x14d576(0xfe)]()===_0x14d576(0xf1));}}let _0x2294ad,_0x2c9f9c=0x0,_0x53c40c=0x0;if(_0x509aff){_0x53c40c=_0x509aff['length'],_0x2c9f9c=0xa;for(let _0x141328=0x1;_0x141328<_0x53c40c;_0x141328++){_0x2c9f9c*=0xa;}_0x2c9f9c-=0x1,_0x2294ad=parseInt(_0x509aff);if(isNaN(_0x2294ad))return null;_0x2294ad-=0x1;}else _0x2294ad=0x0;do{_0x2294ad+=0x1;let _0x4a5680=_0x428675[0x0];if(_0x509aff!==undefined&&_0x9758c5){let _0x432eb6=_0x2294ad[_0x14d576(0x1a3)]();while(_0x432eb6[_0x14d576(0x1b1)]<_0x53c40c){_0x432eb6='0'+_0x432eb6;}_0x262783?_0x4a5680=_0x4a5680['replace'](_0x9758c5,_0x432eb6):(_0x4a5680=_0x4a5680[_0x14d576(0x152)](_0x9758c5,''),_0x262783=!![],_0x2294ad-=0x1);}try{const _0x10eb36=await _0x5d75a1(_0x1b26cd,_0x1df37d,_0x4a5680);if(!_0x10eb36)return _0x4a5680;}catch(_0x5574af){return _0x2a0389[_0x14d576(0x1c9)]['error'](_0x2a0389[_0x14d576(0x1e0)]+'['+_0x2a0389['pluginName']+']\x20'+_0x29d324+'\x20getUserId()\x20error:\x20'+_0x5574af[_0x14d576(0x114)]),null;}}while(_0x2294ad<_0x2c9f9c);return null;}default:}return null;},_0x162af5=async(_0x42dc52,_0xd159aa)=>{const _0x98a951=_0x375032;for(const _0x56ec40 in _0xd159aa){const _0xc23263=_0xd159aa[_0x56ec40],[_0x5776a9,_0xe1bd17]=_0x4dabde(_0xc23263);if(_0x5776a9){const _0x3c2d7f=''+_0x56ec40,_0x4554a5=_0x5776a9+'('+_0xe1bd17[_0x98a951(0x102)](',')+')',_0x301f47=await _0x30171c(_0x42dc52,_0xd159aa,_0x3c2d7f,_0x4554a5);if(_0x301f47===null)delete _0xd159aa[_0x56ec40];else _0xd159aa[_0x56ec40]=_0x301f47;}for(const _0x17ff7b in _0xc23263){const _0x167f21=_0xc23263[_0x17ff7b],[_0x2c4204,_0x7b092b]=_0x4dabde(_0x167f21);if(_0x2c4204){const _0x197fc5=_0x56ec40+'.'+_0x17ff7b,_0x51bdab=_0x2c4204+'('+_0x7b092b[_0x98a951(0x102)](',')+')',_0x29d4fe=await _0x30171c(_0x42dc52,_0xd159aa,_0x197fc5,_0x51bdab);if(_0x29d4fe===null)delete _0xc23263[_0x17ff7b];else _0xc23263[_0x17ff7b]=_0x29d4fe;}}}return _0xd159aa;};},module[a0_0x2ad4e4(0x19f)][a0_0x2ad4e4(0x118)]=function(_0x54f2df){const _0x4afee8=a0_0x2ad4e4,_0x5d21ca=_0x54f2df,_0x1acfcf={},_0x507a6c=async(_0x411170,_0x19d774)=>{const _0x520475=a0_0x7bcd,_0x448588=_0x1acfcf[_0x411170][_0x520475(0x19b)]?.['nats']?.['subject'];let _0x3b10f3=0x0;for await(const _0x707d44 of _0x19d774[_0x520475(0x110)]()){switch(_0x707d44[_0x520475(0x1c7)]){case nats[_0x520475(0x1c6)]['Disconnect']:_0x5d21ca['logger'][_0x520475(0xf0)](_0x5d21ca[_0x520475(0x1e0)]+'['+_0x5d21ca[_0x520475(0x119)]+_0x520475(0x1b3)+_0x411170+']['+_0x448588+_0x520475(0x192)+_0x707d44[_0x520475(0x199)]+_0x520475(0x12b)),_0x3b10f3=0x0;break;case nats[_0x520475(0x1c6)][_0x520475(0x18e)]:_0x5d21ca[_0x520475(0x1c9)][_0x520475(0x17c)](_0x5d21ca[_0x520475(0x1e0)]+'['+_0x5d21ca[_0x520475(0x119)]+_0x520475(0x1b3)+_0x411170+']['+_0x448588+_0x520475(0x1d3)+_0x707d44[_0x520475(0x199)]);break;case nats['Events'][_0x520475(0x18b)]:_0x5d21ca['logger'][_0x520475(0xf0)](_0x5d21ca['gwName']+'['+_0x5d21ca[_0x520475(0x119)]+_0x520475(0x1b3)+_0x411170+']['+_0x448588+_0x520475(0x106)+_0x707d44[_0x520475(0x199)]);break;case nats[_0x520475(0x19d)][_0x520475(0x1dc)]:_0x3b10f3+=0x1;_0x3b10f3%0x1e===0x0&&_0x5d21ca[_0x520475(0x1c9)]['debug'](_0x5d21ca[_0x520475(0x1e0)]+'['+_0x5d21ca[_0x520475(0x119)]+']\x20publisher['+_0x411170+']['+_0x448588+_0x520475(0x1cf)+_0x707d44[_0x520475(0x199)]+'\x20(count='+_0x3b10f3+')');break;case nats[_0x520475(0x19d)][_0x520475(0x1b0)]:_0x5d21ca['logger'][_0x520475(0x157)](_0x5d21ca[_0x520475(0x1e0)]+'['+_0x5d21ca[_0x520475(0x119)]+_0x520475(0x1b3)+_0x411170+']['+_0x448588+_0x520475(0x180)+_0x707d44[_0x520475(0x199)]);break;}}},_0x51ce0b=async(_0x4ceae3,_0x3b61bb)=>{const _0x4e5d58=a0_0x7bcd,_0x1296d6=_0x1acfcf[_0x4ceae3]['config']?.[_0x4e5d58(0x1c5)]?.[_0x4e5d58(0x16b)];let _0x388b41;try{_0x388b41=await nats['connect'](_0x3b61bb);if(_0x388b41[_0x4e5d58(0x17c)][_0x4e5d58(0x1ea)]!==_0x4e5d58(0x158)){_0x388b41[_0x4e5d58(0x1bc)]();return;}_0x1acfcf[_0x4ceae3]['nc']=_0x388b41,_0x507a6c(_0x4ceae3,_0x388b41);}catch(_0x1ffcf2){_0x5d21ca[_0x4e5d58(0x1c9)][_0x4e5d58(0xf0)](_0x5d21ca['gwName']+'['+_0x5d21ca[_0x4e5d58(0x119)]+_0x4e5d58(0x1b3)+_0x4ceae3+']['+_0x1296d6+']\x20connect\x20error:\x20'+_0x1ffcf2[_0x4e5d58(0x114)]+'\x20-\x20will\x20do\x20auto\x20connect\x20when\x20available\x20-\x20however,\x20please\x20verify\x20stream\x20configuration'),_0x3b61bb[_0x4e5d58(0x1d2)]=!![];try{_0x388b41=await nats[_0x4e5d58(0x175)](_0x3b61bb);if(_0x388b41[_0x4e5d58(0x17c)][_0x4e5d58(0x1ea)]!==_0x4e5d58(0x158)){_0x388b41[_0x4e5d58(0x1bc)]();return;}_0x1acfcf[_0x4ceae3]['nc']=_0x388b41,_0x507a6c(_0x4ceae3,_0x388b41);}catch(_0x35580e){_0x5d21ca[_0x4e5d58(0x1c9)]['error'](_0x5d21ca[_0x4e5d58(0x1e0)]+'['+_0x5d21ca['pluginName']+_0x4e5d58(0x1b3)+_0x4ceae3+']['+_0x1296d6+_0x4e5d58(0x1ca)+_0x35580e[_0x4e5d58(0x114)]);return;}}_0x5d21ca['logger']['debug'](_0x5d21ca[_0x4e5d58(0x1e0)]+'['+_0x5d21ca[_0x4e5d58(0x119)]+_0x4e5d58(0x1b3)+_0x4ceae3+']['+_0x1296d6+_0x4e5d58(0x17a)+(_0x3b61bb[_0x4e5d58(0x16f)]['ca']?_0x4e5d58(0x16f):'')+'\x20'+_0x388b41[_0x4e5d58(0x136)]()),_0x388b41[_0x4e5d58(0xf7)]()[_0x4e5d58(0x10a)](_0x52ec0c=>{const _0x3a6d44=_0x4e5d58;_0x52ec0c&&_0x5d21ca[_0x3a6d44(0x1c9)][_0x3a6d44(0xf0)](_0x5d21ca[_0x3a6d44(0x1e0)]+'['+_0x5d21ca[_0x3a6d44(0x119)]+_0x3a6d44(0x1b3)+_0x4ceae3+']['+_0x1296d6+_0x3a6d44(0x177)+_0x52ec0c[_0x3a6d44(0x114)]);});};this[_0x4afee8(0x1b2)]=async(_0x4b0578,_0x38de1c)=>{const _0x3a3b1b=_0x4afee8;if(!_0x38de1c?.[_0x3a3b1b(0x1c5)]){_0x5d21ca['logger'][_0x3a3b1b(0xf0)](_0x5d21ca['gwName']+'['+_0x5d21ca['pluginName']+_0x3a3b1b(0x1b3)+_0x4b0578+_0x3a3b1b(0x1b7));return;}if(!_0x38de1c?.[_0x3a3b1b(0x1c5)]?.['tenant']){_0x5d21ca[_0x3a3b1b(0x1c9)][_0x3a3b1b(0xf0)](_0x5d21ca[_0x3a3b1b(0x1e0)]+'['+_0x5d21ca['pluginName']+_0x3a3b1b(0x1b3)+_0x4b0578+_0x3a3b1b(0x198));return;}if(!_0x38de1c?.[_0x3a3b1b(0x1c5)]?.[_0x3a3b1b(0x16b)]){_0x5d21ca['logger'][_0x3a3b1b(0xf0)](_0x5d21ca[_0x3a3b1b(0x1e0)]+'['+_0x5d21ca[_0x3a3b1b(0x119)]+_0x3a3b1b(0x1b3)+_0x4b0578+_0x3a3b1b(0x14b));return;}if(!_0x38de1c?.[_0x3a3b1b(0x1c5)]?.[_0x3a3b1b(0x16b)][_0x3a3b1b(0x104)](_0x3a3b1b(0x1ba))){_0x5d21ca['logger'][_0x3a3b1b(0xf0)](_0x5d21ca[_0x3a3b1b(0x1e0)]+'['+_0x5d21ca['pluginName']+']\x20publisher['+_0x4b0578+_0x3a3b1b(0x161));return;}if(!_0x38de1c[_0x3a3b1b(0x145)]||!Array[_0x3a3b1b(0x11e)](_0x38de1c[_0x3a3b1b(0x145)])||_0x38de1c[_0x3a3b1b(0x145)]['length']<0x1){_0x5d21ca['logger'][_0x3a3b1b(0xf0)](_0x5d21ca[_0x3a3b1b(0x1e0)]+'['+_0x5d21ca[_0x3a3b1b(0x119)]+_0x3a3b1b(0x1b3)+_0x4b0578+']\x20initialization\x20error:\x20missing\x20configuration\x20stream.baseUrls');return;}if(!_0x38de1c?.[_0x3a3b1b(0x103)]?.['ca']){_0x5d21ca[_0x3a3b1b(0x1c9)][_0x3a3b1b(0xf0)](_0x5d21ca[_0x3a3b1b(0x1e0)]+'['+_0x5d21ca[_0x3a3b1b(0x119)]+_0x3a3b1b(0x1b3)+_0x4b0578+_0x3a3b1b(0x17e));return;}const _0x23090b={};try{let _0x240103=path[_0x3a3b1b(0x102)](_0x5d21ca[_0x3a3b1b(0x167)],'/certs/',_0x38de1c?.[_0x3a3b1b(0x103)]?.['ca']||_0x3a3b1b(0x186));(_0x38de1c?.[_0x3a3b1b(0x103)]?.['ca']?.[_0x3a3b1b(0x104)]('/')||_0x38de1c?.[_0x3a3b1b(0x103)]?.['ca']?.['includes']('\x5c'))&&(_0x240103=_0x38de1c[_0x3a3b1b(0x103)]['ca']),_0x23090b['ca']=[fs[_0x3a3b1b(0x1cc)](_0x240103)],_0x23090b[_0x3a3b1b(0x132)]=!![];}catch(_0x124e7d){_0x5d21ca[_0x3a3b1b(0x1c9)][_0x3a3b1b(0xf0)](_0x5d21ca[_0x3a3b1b(0x1e0)]+'['+_0x5d21ca[_0x3a3b1b(0x119)]+']\x20publisher['+_0x4b0578+']\x20initialization\x20certificate\x20error:\x20'+_0x124e7d['message']);return;}const _0x102851={},_0x43fe3e=new TextEncoder()[_0x3a3b1b(0x195)](_0x38de1c?.[_0x3a3b1b(0x1c5)]?.[_0x3a3b1b(0x15e)]),_0x5cb17f=_0x38de1c?.[_0x3a3b1b(0x1c5)]?.[_0x3a3b1b(0x187)];_0x102851[_0x3a3b1b(0x1e6)]=nats[_0x3a3b1b(0x164)](_0x5cb17f,_0x43fe3e),_0x102851[_0x3a3b1b(0x165)]=_0x38de1c[_0x3a3b1b(0x145)],_0x102851[_0x3a3b1b(0x16f)]=_0x23090b,_0x102851['waitOnFirstConnect']=![],_0x102851[_0x3a3b1b(0x101)]=!![],_0x102851[_0x3a3b1b(0x16d)]=0x3e8*0xa,_0x102851['maxReconnectAttempts']=-0x1,_0x102851[_0x3a3b1b(0x190)]=0x2*0x3c*0x3e8,_0x102851[_0x3a3b1b(0x1e7)]=0x5,_0x102851[_0x3a3b1b(0x157)]=![],_0x1acfcf[_0x4b0578]={},_0x1acfcf[_0x4b0578]['config']=_0x38de1c,_0x1acfcf[_0x4b0578]['nc']=undefined,_0x51ce0b(_0x4b0578,_0x102851);};const _0x3108af=nats[_0x4afee8(0x111)]();this['publish']=async _0x2cb6d8=>{const _0x5c590f=_0x4afee8;let _0x2b20ee;try{if(_0x2cb6d8[_0x5c590f(0x105)]===Object){_0x2b20ee=_0x2cb6d8[_0x5c590f(0x170)];if(!_0x2b20ee)_0x2cb6d8[_0x5c590f(0x170)]=_0x5c590f(0xf6);_0x2cb6d8=JSON[_0x5c590f(0x1df)](_0x2cb6d8);}else{const _0xb20f33=JSON[_0x5c590f(0x140)](_0x2cb6d8);_0x2b20ee=_0xb20f33[_0x5c590f(0x170)];}}catch(_0x336262){throw new Error(_0x5c590f(0x151)+_0x2b20ee+_0x5c590f(0x193));}if(!_0x1acfcf[_0x2b20ee])throw new Error(_0x5c590f(0x151)+_0x2b20ee+']\x20error:\x20missing\x20entity\x20configuration\x20for\x20baseEntity='+_0x2b20ee);const _0x198eb1=nats['headers']();_0x198eb1['append'](_0x5c590f(0x1c1),crypto['randomUUID']());let _0x59c1a2;try{if(!_0x1acfcf[_0x2b20ee]['nc'])throw new Error('publisher\x20not\x20initialized/connected');_0x59c1a2=await _0x1acfcf[_0x2b20ee]['nc'][_0x5c590f(0x12c)](_0x1acfcf[_0x2b20ee][_0x5c590f(0x19b)]?.[_0x5c590f(0x1c5)]?.[_0x5c590f(0x16b)],_0x3108af[_0x5c590f(0x195)](_0x2cb6d8),{'headers':_0x198eb1});}catch(_0x55ba46){if(_0x55ba46[_0x5c590f(0x114)]===_0x5c590f(0x1a6))throw new Error(_0x5c590f(0x151)+_0x2b20ee+']\x20error:\x20no\x20subscribers/responders\x20to\x20subject\x20'+_0x1acfcf[_0x2b20ee]['config']?.[_0x5c590f(0x1c5)]?.[_0x5c590f(0x16b)]);else throw new Error(_0x5c590f(0x151)+_0x2b20ee+_0x5c590f(0x1f2)+_0x55ba46[_0x5c590f(0x114)]);}let _0x13d9ea;try{_0x13d9ea=JSON[_0x5c590f(0x140)](_0x59c1a2[_0x5c590f(0x181)]());}catch(_0x23b965){throw new Error(_0x5c590f(0x1a9)+_0x59c1a2[_0x5c590f(0x181)]());}if(_0x13d9ea?.[_0x5c590f(0xf0)]){const _0x36bdb4=new Error('publisher\x20response\x20error:\x20'+_0x13d9ea[_0x5c590f(0xf0)]);_0x36bdb4[_0x5c590f(0x179)]=_0x13d9ea['errName'];throw _0x36bdb4;}return _0x13d9ea;},process['on'](_0x4afee8(0x166),async()=>{const _0x1cd413=_0x4afee8;for(const _0x53590c in _0x1acfcf){_0x1acfcf[_0x53590c]['nc']&&!_0x1acfcf[_0x53590c]['nc'][_0x1cd413(0x127)]()&&await _0x1acfcf[_0x53590c]['nc'][_0x1cd413(0x1cd)]();}}),process['on'](_0x4afee8(0x1e8),async()=>{const _0x358c33=_0x4afee8;for(const _0x1d9708 in _0x1acfcf){_0x1acfcf[_0x1d9708]['nc']&&!_0x1acfcf[_0x1d9708]['nc'][_0x358c33(0x127)]()&&await _0x1acfcf[_0x1d9708]['nc'][_0x358c33(0x1cd)]();}});},module[a0_0x2ad4e4(0x19f)][a0_0x2ad4e4(0x14f)]=async(_0x21c16b,_0x26d02e,_0x20d6bd,_0xda380f)=>{const _0x15f24c=a0_0x2ad4e4,_0x369324='getAppRoles',_0x27f5a5=_0x21c16b;_0x27f5a5[_0x15f24c(0x1c9)][_0x15f24c(0x157)](_0x27f5a5[_0x15f24c(0x1e0)]+'['+_0x27f5a5['pluginName']+']\x20handling\x20\x22'+_0x369324+'\x22');try{if(!fs[_0x15f24c(0x1d6)](_0x27f5a5[_0x15f24c(0x167)]+'/approles'))fs['mkdirSync'](_0x27f5a5[_0x15f24c(0x167)]+'/approles');}catch(_0x3948a4){}const _0x15a29f=path[_0x15f24c(0x102)](''+_0x27f5a5['configDir'],_0x15f24c(0x1eb),_0x15f24c(0x130)+_0x27f5a5[_0x15f24c(0x119)]+'_autogenerated.cfg'),_0x302315={};utils['fsExistsSync'](_0x15a29f)&&fs[_0x15f24c(0x1cc)](_0x15a29f,_0x15f24c(0x116))[_0x15f24c(0x160)](/\r?\n/)[_0x15f24c(0x100)](_0x3da6f8=>{const _0x3b5c97=_0x15f24c,_0x514d9a=_0x3da6f8[_0x3b5c97(0x160)]('\x20');_0x514d9a[_0x3b5c97(0x1b1)]===0x2&&(_0x302315[_0x514d9a[0x0]]=_0x514d9a[0x1]);});const _0xbf36a2=fs[_0x15f24c(0xfa)](_0x15a29f,{'flags':'w','encoding':_0x15f24c(0x143),'mode':0x1b6,'autoClose':!![]}),_0x442353=[],_0x17ccf1=await _0x27f5a5[_0x15f24c(0x1d4)](_0x26d02e,{'attribute':undefined,'operator':undefined,'value':undefined},['id','displayName']);return _0x17ccf1[_0x15f24c(0x16e)][_0x15f24c(0x100)](_0x448e5c=>{const _0xb9673b=_0x15f24c;if(_0x448e5c['id']){let _0x3f9d12=crypto[_0xb9673b(0x172)]();if(_0x302315[_0x448e5c['id']])_0x3f9d12=_0x302315[_0x448e5c['id']];const _0x1a13ad={'allowedMemberTypes':[_0xb9673b(0x11b)],'description':_0xb9673b(0x194),'displayName':_0x448e5c[_0xb9673b(0x1b6)]||_0x448e5c['id'],'id':_0x3f9d12,'isEnabled':!![],'lang':null,'origin':'Application','value':decodeURIComponent(_0x448e5c['id'])};_0x442353[_0xb9673b(0x174)](_0x1a13ad),_0xbf36a2[_0xb9673b(0x178)](_0x448e5c['id']+'\x20'+_0x3f9d12+'\x0a');}}),_0xbf36a2[_0x15f24c(0x1bc)](),_0x27f5a5[_0x15f24c(0x1c9)]['debug'](_0x27f5a5[_0x15f24c(0x1e0)]+'['+_0x27f5a5['pluginName']+']\x20approle\x20uuid\x20file\x20created:\x20'+_0x15a29f),{'Resources':[{'appRoles':_0x442353}]};};
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}]};};
@@ -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
- let userObj = scimdata.Resources[0]
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')) && typeof this[handler.groups.getMethod] === 'function') { // include groups
906
- let res
907
- try {
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 ob = utils.copyObj(getObj)
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: ob,
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
- logger.debug(`${gwName}[${pluginName}] calling "${handle.getMethod}" and awaiting result`)
1120
- res = await this[handle.getMethod](ctx.params.baseEntity, ob, attributes, ctx.passThrough)
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
- logger.debug(`${gwName}[${pluginName}] calling "${handle.deleteMethod}" and awaiting result`)
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
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
 
@@ -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)) {
@@ -1667,7 +1670,7 @@ const ScimGateway = function () {
1667
1670
 
1668
1671
  // update object
1669
1672
  if (Object.keys(scimdata).length > 0) {
1670
- logger.debug(`${gwName}[${pluginName}] calling "${handle.modifyMethod}" and awaiting result`)
1673
+ logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] calling "${handle.modifyMethod}" and awaiting result`)
1671
1674
  await this[handle.modifyMethod](ctx.params.baseEntity, id, scimdata, ctx.passThrough)
1672
1675
  }
1673
1676
 
@@ -1731,26 +1734,26 @@ const ScimGateway = function () {
1731
1734
  if (!found && currentGroups[i].value) removeGrps.push(currentGroups[i].value)
1732
1735
  }
1733
1736
 
1734
- const addGroups = async (grp) => {
1735
- return await this[handler.groups.modifyMethod](ctx.params.baseEntity, grp, { members: [{ value: id }] }, ctx.passThrough)
1737
+ const assignGroupMember = async (grpId) => {
1738
+ return await this[handler.groups.modifyMethod](ctx.params.baseEntity, grpId, { members: [{ value: id }] }, ctx.passThrough)
1736
1739
  }
1737
1740
 
1738
- const removeGroups = async (grp) => {
1739
- return await this[handler.groups.modifyMethod](ctx.params.baseEntity, grp, { members: [{ operation: 'delete', value: id }] }, ctx.passThrough)
1741
+ const revokeGroupMember = async (grpId) => {
1742
+ return await this[handler.groups.modifyMethod](ctx.params.baseEntity, grpId, { members: [{ operation: 'delete', value: id }] }, ctx.passThrough)
1740
1743
  }
1741
1744
 
1742
- let errRemove = []
1745
+ let errRevoke = []
1743
1746
  if (!usePutSoftSync) { // default will remove any existing groups not included, usePutSoftSync=true prevents removing existing groups (only add groups)
1744
- const res = await Promise.allSettled(removeGrps.map((grp) => removeGroups(grp)))
1745
- errRemove = res.filter(result => result.status === 'rejected').map(result => result.reason.message)
1747
+ const res = await Promise.allSettled(removeGrps.map((grpId) => revokeGroupMember(grpId)))
1748
+ errRevoke = res.filter(result => result.status === 'rejected').map(result => result.reason.message)
1746
1749
  }
1747
1750
 
1748
- const res = await Promise.allSettled(addGrps.map((grp) => addGroups(grp)))
1749
- const errAdd = res.filter(result => result.status === 'rejected').map(result => result.reason.message)
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)
1750
1753
 
1751
1754
  let errMsg = ''
1752
- if (errRemove.length > 0) errMsg = `removeGroups errors: ${errRemove.join(', ')}`
1753
- if (errAdd.length > 0) errMsg += `${errMsg ? ' ' : ''}addGroups errors: ${errAdd.join(', ')}`
1755
+ if (errRevoke.length > 0) errMsg = `revokeGroupMember errors: ${errRevoke.join(', ')}`
1756
+ if (errAssign.length > 0) errMsg += `${errMsg ? ' ' : ''}assignGroupMember errors: ${errAssign.join(', ')}`
1754
1757
  if (errMsg) throw new Error(errMsg)
1755
1758
  }
1756
1759
  }
@@ -1771,7 +1774,7 @@ const ScimGateway = function () {
1771
1774
  obj: ctx.request.body,
1772
1775
  ctxPassThrough: ctx.passThrough
1773
1776
  }
1774
- 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`)
1775
1778
  await this.publish(streamObj)
1776
1779
  } else {
1777
1780
  await replaceUsrGrp(ctx, config.scim.usePutSoftSync)
@@ -1790,7 +1793,7 @@ const ScimGateway = function () {
1790
1793
  // {"eventName":"AsignAccessRoleEvent","subjectName":"RACF_System-B","userID":"peter01"}
1791
1794
  //
1792
1795
  router.post(['/api', '/:baseEntity/api'], async (ctx) => {
1793
- logger.debug(`${gwName}[${pluginName}] [POST api]`)
1796
+ logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] [POST api]`)
1794
1797
  const apiObj = ctx.request.body
1795
1798
  const strBody = JSON.stringify(apiObj)
1796
1799
  if (strBody === '{}') {
@@ -1807,10 +1810,10 @@ const ScimGateway = function () {
1807
1810
  obj: apiObj,
1808
1811
  ctxPassThrough: ctx.passThrough
1809
1812
  }
1810
- 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`)
1811
1814
  result = await this.publish(streamObj)
1812
1815
  } else {
1813
- logger.debug(`${gwName}[${pluginName}] calling "postApi" and awaiting result`)
1816
+ logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] calling "postApi" and awaiting result`)
1814
1817
  result = await this.postApi(ctx.params.baseEntity, apiObj, ctx.passThrough)
1815
1818
  }
1816
1819
  if (result) {
@@ -1849,7 +1852,7 @@ const ScimGateway = function () {
1849
1852
  //
1850
1853
  router.put(['/api/:id', '/:baseEntity/api/:id'], async (ctx) => {
1851
1854
  const id = ctx?.params?.id
1852
- logger.debug(`${gwName}[${pluginName}] [PUT api ] id=${id}`)
1855
+ logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] [PUT api ] id=${id}`)
1853
1856
  const apiObj = ctx.request.body
1854
1857
  const strBody = JSON.stringify(apiObj)
1855
1858
  if (strBody === '{}') {
@@ -1867,10 +1870,10 @@ const ScimGateway = function () {
1867
1870
  obj: apiObj,
1868
1871
  ctxPassThrough: ctx.passThrough
1869
1872
  }
1870
- 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`)
1871
1874
  result = await this.publish(streamObj)
1872
1875
  } else {
1873
- logger.debug(`${gwName}[${pluginName}] calling "putApi" and awaiting result`)
1876
+ logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] calling "putApi" and awaiting result`)
1874
1877
  result = await this.putApi(ctx.params.baseEntity, id, apiObj, ctx.passThrough)
1875
1878
  }
1876
1879
  if (result) {
@@ -1909,7 +1912,7 @@ const ScimGateway = function () {
1909
1912
  //
1910
1913
  router.patch(['/api/:id', '/:baseEntity/api/:id'], async (ctx) => {
1911
1914
  const id = ctx?.params?.id
1912
- logger.debug(`${gwName}[${pluginName}] [PATCH api ] id=${id}`)
1915
+ logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] [PATCH api ] id=${id}`)
1913
1916
  const apiObj = ctx.request.body
1914
1917
  const strBody = JSON.stringify(apiObj)
1915
1918
  if (strBody === '{}') {
@@ -1927,10 +1930,10 @@ const ScimGateway = function () {
1927
1930
  obj: apiObj,
1928
1931
  ctxPassThrough: ctx.passThrough
1929
1932
  }
1930
- 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`)
1931
1934
  result = await this.publish(streamObj)
1932
1935
  } else {
1933
- logger.debug(`${gwName}[${pluginName}] calling "patchApi" and awaiting result`)
1936
+ logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] calling "patchApi" and awaiting result`)
1934
1937
  result = await this.patchApi(ctx.params.baseEntity, id, apiObj, ctx.passThrough)
1935
1938
  }
1936
1939
  if (result) {
@@ -1969,8 +1972,8 @@ const ScimGateway = function () {
1969
1972
  router.get(['/api', '/api/:id',
1970
1973
  '/:baseEntity/api', '/:baseEntity/api/:id'], async (ctx) => {
1971
1974
  const id = ctx?.params?.id
1972
- if (id) logger.debug(`${gwName}[${pluginName}] [GET api] id=${id}`)
1973
- 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]`)
1974
1977
  let apiObj = ctx.request.body
1975
1978
  const strBody = JSON.stringify(apiObj)
1976
1979
  if (strBody === '{}') apiObj = undefined
@@ -1985,10 +1988,10 @@ const ScimGateway = function () {
1985
1988
  obj: apiObj,
1986
1989
  ctxPassThrough: ctx.passThrough
1987
1990
  }
1988
- 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`)
1989
1992
  result = await this.publish(streamObj)
1990
1993
  } else {
1991
- logger.debug(`${gwName}[${pluginName}] calling "getApi" and awaiting result`)
1994
+ logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] calling "getApi" and awaiting result`)
1992
1995
  result = await this.getApi(ctx.params.baseEntity, id, ctx.query, apiObj, ctx.passThrough)
1993
1996
  }
1994
1997
  if (result) {
@@ -2023,7 +2026,7 @@ const ScimGateway = function () {
2023
2026
  //
2024
2027
  router.delete(['/api/:id', '/:baseEntity/api/:id'], async (ctx) => {
2025
2028
  const id = ctx?.params?.id
2026
- logger.debug(`${gwName}[${pluginName}] [DELETE api ] id=${id}`)
2029
+ logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] [DELETE api ] id=${id}`)
2027
2030
  try {
2028
2031
  let result
2029
2032
  if (config.stream.publisher.enabled) {
@@ -2033,10 +2036,10 @@ const ScimGateway = function () {
2033
2036
  id,
2034
2037
  ctxPassThrough: ctx.passThrough
2035
2038
  }
2036
- 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`)
2037
2040
  result = await this.publish(streamObj)
2038
2041
  } else {
2039
- logger.debug(`${gwName}[${pluginName}] calling "deleteApi" and awaiting result`)
2042
+ logger.debug(`${gwName}[${pluginName}][${ctx?.params?.baseEntity}] calling "deleteApi" and awaiting result`)
2040
2043
  result = await this.deleteApi(ctx.params.baseEntity, id, ctx.passThrough)
2041
2044
  }
2042
2045
  if (result) {
@@ -2070,6 +2073,34 @@ const ScimGateway = function () {
2070
2073
  return await getAppRoles(this, baseEntity, getObj, attributes)
2071
2074
  }
2072
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
+
2073
2104
  // ==========================================
2074
2105
  // Starting up...
2075
2106
  // ==========================================
@@ -2740,7 +2771,13 @@ ScimGateway.prototype.endpointMapper = function endpointMapper (direction, parse
2740
2771
  else {
2741
2772
  if (dotMap[`${key}.typeInbound`] && dotMap[`${key}.typeInbound`] === 'string') {
2742
2773
  if (!dotNewObj[newStr]) dotNewObj[newStr] = dotParse[`${key}.${dotArrIndex}`]
2743
- else dotNewObj[newStr] = `${dotParse[`${key}.${dotArrIndex}`]},${dotNewObj[newStr]}`
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
+ }
2744
2781
  } else dotNewObj[`${newStr}.${dotArrIndex}`] = dotParse[`${key}.${dotArrIndex}`]
2745
2782
  }
2746
2783
  } else { // type=array but element is not array
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scimgateway",
3
- "version": "4.5.10",
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",