From f1b1fe95e165bea6133ff91f641689dd993642ec Mon Sep 17 00:00:00 2001 From: alex Date: Sun, 22 Dec 2024 17:20:25 +0100 Subject: [PATCH] add password in wallet --- ase_user_nodered.json | 166 ++++++++++++++++++++++++++++++++---------- 1 file changed, 129 insertions(+), 37 deletions(-) diff --git a/ase_user_nodered.json b/ase_user_nodered.json index 59a03a5..bfc9cb7 100644 --- a/ase_user_nodered.json +++ b/ase_user_nodered.json @@ -32,13 +32,6 @@ "required": true, "rows": null }, - { - "label": "ClientID", - "value": "ClientID", - "type": "text", - "required": false, - "rows": null - }, { "label": "Description title", "value": "Textname", @@ -57,7 +50,6 @@ "formValue": { "Username": "", "Password": "", - "ClientID": "", "Textname": "", "Textdescription": "" }, @@ -69,10 +61,11 @@ "splitLayout": "", "className": "", "x": 84, - "y": 240, + "y": 144, "wires": [ [ - "3711eb142a27fd31" + "3711eb142a27fd31", + "70ca52648a2c8fa5" ] ], "inputLabels": [ @@ -96,8 +89,8 @@ "correl": "", "expiry": "", "broker": "6c0c13a328d2378c", - "x": 1274, - "y": 552, + "x": 1278, + "y": 560, "wires": [] }, { @@ -108,7 +101,7 @@ "scope": null, "uncaught": false, "x": 84, - "y": 176, + "y": 24, "wires": [ [ "8669f263b392e9db" @@ -131,7 +124,7 @@ "topic": "", "name": "Error Notification", "x": 698, - "y": 176, + "y": 24, "wires": [ [] ] @@ -157,7 +150,7 @@ "to": "", "reg": false, "x": 386, - "y": 176, + "y": 24, "wires": [ [ "30603217455d8705" @@ -178,7 +171,7 @@ "rh": 0, "inputs": 0, "x": 84, - "y": 616, + "y": 624, "wires": [ [ "4f1d82b81f042382", @@ -209,7 +202,7 @@ "topic": "$CONTROL/dynamic-security/v1", "topicType": "msg", "x": 698, - "y": 800, + "y": 816, "wires": [ [ "2aecbce52ca97912", @@ -257,7 +250,7 @@ "topicType": "msg", "className": "", "x": 456, - "y": 552, + "y": 560, "wires": [ [ "1d4c2df0e173d2e3", @@ -286,10 +279,11 @@ "topic": "topic", "topicType": "msg", "x": 94, - "y": 432, + "y": 272, "wires": [ [ - "4798c117a3d42c70" + "4798c117a3d42c70", + "7b9944c244c48572" ] ] }, @@ -305,7 +299,7 @@ "initialize": "", "finalize": "", "libs": [], - "x": 688, + "x": 698, "y": 496, "wires": [ [] @@ -316,7 +310,7 @@ "type": "function", "z": "9fbdd3f57deafc08", "name": "Make msg payload to create roles and users", - "func": "var msg = {\n payload: {\n commands: [\n {\n \"command\": \"createRole\",\n \"rolename\": msg.payload.Username.concat(\"_role\"),\n \"textname\": \"\", \n\t\t\t \"textdescription\": \"\", \n\t\t\t \"acls\": [\n { \"acltype\": \"publishClientSend\", \"topic\": msg.payload.Username.concat(\"/#\"), \"priority\": 0, \"allow\": true }\n ]\n },\n {\n \"command\": \"createRole\",\n \"rolename\": msg.payload.Username.concat(\"_ase_role\"),\n \"textname\": \"\", \n\t\t\t \"textdescription\": \"\", \n\t\t\t \"acls\": [\n { \"acltype\": \"publishClientSend\", \"topic\": msg.payload.Username.concat(\"/#\"), \"priority\": 0, \"allow\": true },\n { \"acltype\": \"publishClientReceive\", \"topic\": msg.payload.Username.concat(\"/#\"), \"priority\": 0, \"allow\": true },\n { \"acltype\": \"subscribeLiteral\", \"topic\": msg.payload.Username.concat(\"/#\"), \"priority\": 0, \"allow\": true },\n { \"acltype\": \"subscribePattern\", \"topic\": msg.payload.Username.concat(\"/#\"), \"priority\": 0, \"allow\": true },\n { \"acltype\": \"unsubscribeLiteral\", \"topic\": msg.payload.Username.concat(\"/#\"), \"priority\": 0, \"allow\": true },\n { \"acltype\": \"unsubscribePattern\", \"topic\": msg.payload.Username.concat(\"/#\"), \"priority\": 0, \"allow\": true }\n ]\n },\n {\n \"command\": \"createClient\",\n \"username\": msg.payload.Username,\n \"password\": msg.payload.Password,\n \"clientid\": msg.payload.ClientID,\n\t\t\t \"textname\": msg.payload.Textname, \n \"textdescription\": msg.payload.Textdescription,\n\t\t\t \"groups\": [\n\t\t\t ],\n\t\t\t \"roles\": [\n\t\t\t\t { \"rolename\": msg.payload.Username.concat(\"_role\"), \"priority\": 0 }\n\t\t\t ]\n },\n {\n \"command\": \"createClient\",\n \"username\": msg.payload.Username.concat(\"_ase\"),\n \"password\": msg.payload.Password.concat(\"AsE\"),\n \"clientid\": msg.payload.ClientID.concat(\"_ase\"),\n \"textname\": msg.payload.Textname.concat(\" ASE subscriber\"), \n \"textdescription\": msg.payload.Textdescription.concat(\" ASE subscriber\"),\n\t\t\t \"groups\": [\n\t\t\t ],\n\t\t\t \"roles\": [\n\t\t\t\t { \"rolename\": msg.payload.Username.concat(\"_ase_role\"), \"priority\": 0 }\n\t\t\t ]\n }\n ]\n }\n};\nreturn msg;", + "func": "var msg = {\n payload: {\n commands: [\n {\n \"command\": \"createRole\",\n \"rolename\": msg.payload.Username.concat(\"_role\"),\n \"textname\": \"\", \n\t\t\t \"textdescription\": \"\", \n\t\t\t \"acls\": [\n { \"acltype\": \"publishClientSend\", \"topic\": msg.payload.Username.concat(\"/#\"), \"priority\": 0, \"allow\": true }\n ]\n },\n {\n \"command\": \"createRole\",\n \"rolename\": msg.payload.Username.concat(\"_ase_role\"),\n \"textname\": \"\", \n\t\t\t \"textdescription\": \"\", \n\t\t\t \"acls\": [\n { \"acltype\": \"publishClientSend\", \"topic\": msg.payload.Username.concat(\"/#\"), \"priority\": 0, \"allow\": true },\n { \"acltype\": \"publishClientReceive\", \"topic\": msg.payload.Username.concat(\"/#\"), \"priority\": 0, \"allow\": true },\n { \"acltype\": \"subscribeLiteral\", \"topic\": msg.payload.Username.concat(\"/#\"), \"priority\": 0, \"allow\": true },\n { \"acltype\": \"subscribePattern\", \"topic\": msg.payload.Username.concat(\"/#\"), \"priority\": 0, \"allow\": true },\n { \"acltype\": \"unsubscribeLiteral\", \"topic\": msg.payload.Username.concat(\"/#\"), \"priority\": 0, \"allow\": true },\n { \"acltype\": \"unsubscribePattern\", \"topic\": msg.payload.Username.concat(\"/#\"), \"priority\": 0, \"allow\": true }\n ]\n },\n {\n \"command\": \"createClient\",\n \"username\": msg.payload.Username,\n \"password\": msg.payload.Password,\n \"clientid\": msg.payload.Username.concat(\"_client\"),\n\t\t\t \"textname\": msg.payload.Textname, \n \"textdescription\": msg.payload.Textdescription,\n\t\t\t \"groups\": [\n\t\t\t ],\n\t\t\t \"roles\": [\n\t\t\t\t { \"rolename\": msg.payload.Username.concat(\"_role\"), \"priority\": 0 }\n\t\t\t ]\n },\n {\n \"command\": \"createClient\",\n \"username\": msg.payload.Username.concat(\"_ase\"),\n \"password\": msg.payload.Password.concat(\"AsE\"),\n \"clientid\": msg.payload.Username.concat(\"_client_ase\"),\n \"textname\": msg.payload.Textname.concat(\" ASE subscriber\"), \n \"textdescription\": msg.payload.Textdescription.concat(\" ASE subscriber\"),\n\t\t\t \"groups\": [\n\t\t\t ],\n\t\t\t \"roles\": [\n\t\t\t\t { \"rolename\": msg.payload.Username.concat(\"_ase_role\"), \"priority\": 0 }\n\t\t\t ]\n }\n ]\n }\n};\nreturn msg;", "outputs": 1, "timeout": 0, "noerr": 0, @@ -324,7 +318,7 @@ "finalize": "", "libs": [], "x": 778, - "y": 240, + "y": 176, "wires": [ [ "2aecbce52ca97912" @@ -344,7 +338,7 @@ "finalize": "", "libs": [], "x": 768, - "y": 432, + "y": 304, "wires": [ [ "2aecbce52ca97912" @@ -372,7 +366,7 @@ "topic": "topic", "topicType": "msg", "x": 94, - "y": 304, + "y": 368, "wires": [ [ "b97f2e66e9ea4702" @@ -392,7 +386,7 @@ "finalize": "", "libs": [], "x": 748, - "y": 304, + "y": 368, "wires": [ [ "2aecbce52ca97912" @@ -420,7 +414,7 @@ "topic": "topic", "topicType": "msg", "x": 94, - "y": 368, + "y": 432, "wires": [ [ "1b7e77253c8b385d" @@ -440,7 +434,7 @@ "finalize": "", "libs": [], "x": 748, - "y": 368, + "y": 432, "wires": [ [ "2aecbce52ca97912" @@ -460,7 +454,7 @@ "finalize": "", "libs": [], "x": 748, - "y": 552, + "y": 560, "wires": [ [ "2aecbce52ca97912" @@ -480,7 +474,7 @@ "finalize": "", "libs": [], "x": 386, - "y": 680, + "y": 688, "wires": [ [ "934816df4e8f7fe2" @@ -500,7 +494,7 @@ "finalize": "", "libs": [], "x": 346, - "y": 800, + "y": 816, "wires": [ [ "377b761521508bb9" @@ -520,7 +514,7 @@ "finalize": "", "libs": [], "x": 336, - "y": 736, + "y": 752, "wires": [ [ "934816df4e8f7fe2" @@ -543,7 +537,7 @@ "templateScope": "local", "className": "", "x": 668, - "y": 680, + "y": 688, "wires": [ [] ] @@ -555,7 +549,7 @@ "name": "UI action", "events": "all", "x": 84, - "y": 864, + "y": 880, "wires": [ [ "377b761521508bb9", @@ -584,7 +578,7 @@ "topic": "$CONTROL/dynamic-security/v1", "topicType": "msg", "x": 698, - "y": 864, + "y": 880, "wires": [ [ "2aecbce52ca97912" @@ -604,7 +598,7 @@ "finalize": "", "libs": [], "x": 386, - "y": 616, + "y": 624, "wires": [ [ "b711bce152685dec" @@ -627,7 +621,105 @@ "templateScope": "local", "className": "", "x": 708, - "y": 616, + "y": 624, + "wires": [ + [] + ] + }, + { + "id": "b27b626c8de3514b", + "type": "http request", + "z": "9fbdd3f57deafc08", + "name": "Add password to wallet", + "method": "POST", + "ret": "txt", + "paytoqs": "body", + "url": "http://localhost:5000/add", + "tls": "", + "persist": false, + "proxy": "", + "insecureHTTPParser": false, + "authType": "", + "senderr": false, + "headers": [ + { + "keyType": "Content-Type", + "keyValue": "", + "valueType": "application/json", + "valueValue": "" + } + ], + "x": 1270, + "y": 112, + "wires": [ + [] + ] + }, + { + "id": "70ca52648a2c8fa5", + "type": "function", + "z": "9fbdd3f57deafc08", + "name": "Make msg payload to add password to wallet", + "func": "var msg = {\n payload: {\n \"master_password\": \"Ase#2024@wallet!\",\n \"site\": msg.payload.Username.concat(\"_ase_site\"),\n \"username\": msg.payload.Username.concat(\"_ase\"),\n \"password\": msg.payload.Password.concat(\"AsE\")\n }\n}\nreturn msg;", + "outputs": 1, + "timeout": 0, + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 778, + "y": 112, + "wires": [ + [ + "b27b626c8de3514b" + ] + ] + }, + { + "id": "7b9944c244c48572", + "type": "function", + "z": "9fbdd3f57deafc08", + "name": "Make msg payload to delete password on wallet", + "func": "let user = flow.get(\"user\");\nvar msg = {\n payload: {\n \"master_password\": \"Ase#2024@wallet!\",\n \"site\": user.concat(\"_ase_site\"),\n }\n}\nreturn msg;", + "outputs": 1, + "timeout": 0, + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 788, + "y": 240, + "wires": [ + [ + "5f57768fa11f73b8" + ] + ] + }, + { + "id": "5f57768fa11f73b8", + "type": "http request", + "z": "9fbdd3f57deafc08", + "name": "Delete password on wallet", + "method": "POST", + "ret": "txt", + "paytoqs": "query", + "url": "http://localhost:5000/delete", + "tls": "", + "persist": false, + "proxy": "", + "insecureHTTPParser": false, + "authType": "", + "senderr": false, + "headers": [ + { + "keyType": "Content-Type", + "keyValue": "", + "valueType": "application/json", + "valueValue": "" + } + ], + "x": 1270, + "y": 240, "wires": [ [] ]