diff --git a/MySQL_conf_pbx/test1/Rest-API-Postman/CezenPBX_API.postman_collection_Security_XSRF.json b/MySQL_conf_pbx/test1/Rest-API-Postman/CezenPBX_API.postman_collection_Security_XSRF.json new file mode 100644 index 0000000..bab198f --- /dev/null +++ b/MySQL_conf_pbx/test1/Rest-API-Postman/CezenPBX_API.postman_collection_Security_XSRF.json @@ -0,0 +1,940 @@ +{ + "info": { + "_postman_id": "721d5504-301f-488d-a25b-5e78769eac5a", + "name": "CezenPBX_API", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "29498098" + }, + "item": [ + { + "name": "create a new endpoint", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"id\": \"1005\",\n// \"transport\": \"transport-udp\",\n// \"context\": \"default\",\n// \"disallow\": \"all\",\n// \"allow\": \"ulaw,alaw\",\n// \"directMedia\": \"no\",\n \"connectedLineMethod\": null,\n \"callerid\": null,\n \"dtmfMode\": null,\n// \"mohsuggest\": \"default\",\n \"mailboxes\": null\n}\n\n// {\n// \"id\": \"1004\",\n// \"transport\": \"transport-udp\",\n// \"aors\": \"1004\",\n// \"auth\": \"1004\",\n// \"context\": \"default\",\n// \"disallow\": \"all\",\n// \"allow\": \"ulaw,alaw\",\n// \"directMedia\": \"no\",\n// \"connectedLineMethod\": null,\n// \"callerid\": \"User <1004>\",\n// \"dtmfMode\": null,\n// \"mohsuggest\": \"default\",\n// \"mailboxes\": \"1004@default\"\n// }", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:8081/cezen/add_user", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "8081", + "path": [ + "cezen", + "add_user" + ] + } + }, + "response": [] + }, + { + "name": "create a new extension", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"context\": \"default\",\n \"extension\": \"1005\",\n \"priority\": 1,\n \"app\": \"Dial\",\n \"appdata\": \"PJSIP/1005,20,m(default)\"\n}\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:8081/cezen/add_extension", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "8081", + "path": [ + "cezen", + "add_extension" + ] + } + }, + "response": [ + { + "name": "1005", + "originalRequest": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"context\": \"default\",\n \"extension\": \"1005\",\n \"priority\": 1,\n \"app\": \"Dial\",\n \"appdata\": \"PJSIP/1005,20,m(default)\"\n}\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:8081/cezen/add_extension", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "8081", + "path": [ + "cezen", + "add_extension" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Vary", + "value": "Origin" + }, + { + "key": "Vary", + "value": "Access-Control-Request-Method" + }, + { + "key": "Vary", + "value": "Access-Control-Request-Headers" + }, + { + "key": "X-Content-Type-Options", + "value": "nosniff" + }, + { + "key": "X-XSS-Protection", + "value": "0" + }, + { + "key": "Cache-Control", + "value": "no-cache, no-store, max-age=0, must-revalidate" + }, + { + "key": "Pragma", + "value": "no-cache" + }, + { + "key": "Expires", + "value": "0" + }, + { + "key": "X-Frame-Options", + "value": "DENY" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Date", + "value": "Thu, 15 May 2025 10:20:09 GMT" + }, + { + "key": "Keep-Alive", + "value": "timeout=60" + }, + { + "key": "Connection", + "value": "keep-alive" + } + ], + "cookie": [], + "body": "{\n \"status\": false,\n \"message\": \"Data likely already exists or DB issue\",\n \"exceptionMessage\": \"could not execute statement [(conn=482) Duplicate entry '1005-PJSIP/1005,20,m(default)-1' for key 'extension_table_unique_val'] [insert into extensions_table (app,appdata,context,exten,priority) values (?,?,?,?,?)]; SQL [insert into extensions_table (app,appdata,context,exten,priority) values (?,?,?,?,?)]; constraint [extension_table_unique_val]\"\n}" + }, + { + "name": "test1", + "originalRequest": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"context\": \"default\",\n \"extension\": \"test1\",\n \"priority\": 1,\n \"app\": \"Dial\",\n \"appdata\": \"test123rf\"\n}\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:8081/cezen/add_extension", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "8081", + "path": [ + "cezen", + "add_extension" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Vary", + "value": "Origin" + }, + { + "key": "Vary", + "value": "Access-Control-Request-Method" + }, + { + "key": "Vary", + "value": "Access-Control-Request-Headers" + }, + { + "key": "X-Content-Type-Options", + "value": "nosniff" + }, + { + "key": "X-XSS-Protection", + "value": "0" + }, + { + "key": "Cache-Control", + "value": "no-cache, no-store, max-age=0, must-revalidate" + }, + { + "key": "Pragma", + "value": "no-cache" + }, + { + "key": "Expires", + "value": "0" + }, + { + "key": "X-Frame-Options", + "value": "DENY" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Date", + "value": "Thu, 15 May 2025 10:21:06 GMT" + }, + { + "key": "Keep-Alive", + "value": "timeout=60" + }, + { + "key": "Connection", + "value": "keep-alive" + } + ], + "cookie": [], + "body": "{\n \"status\": true,\n \"message\": \"test1 Persisted \",\n \"exceptionMessage\": \"\"\n}" + } + ] + }, + { + "name": "set_password", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"id\": \"1005\",\n \"authType\": \"userpass\",\n \"userName\": \"1005\",\n \"password\": \"12345\",\n \"md5Cred\": null,\n \"realm\": null\n}\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:8081/cezen/set_password", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "8081", + "path": [ + "cezen", + "set_password" + ] + } + }, + "response": [ + { + "name": "set_password", + "originalRequest": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"id\": \"1005\",\n \"authType\": \"userpass\",\n \"userName\": \"1005\",\n \"password\": \"12345\",\n \"md5Cred\": null,\n \"realm\": null\n}\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:8081/cezen/set_password", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "8081", + "path": [ + "cezen", + "set_password" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Vary", + "value": "Origin" + }, + { + "key": "Vary", + "value": "Access-Control-Request-Method" + }, + { + "key": "Vary", + "value": "Access-Control-Request-Headers" + }, + { + "key": "X-Content-Type-Options", + "value": "nosniff" + }, + { + "key": "X-XSS-Protection", + "value": "0" + }, + { + "key": "Cache-Control", + "value": "no-cache, no-store, max-age=0, must-revalidate" + }, + { + "key": "Pragma", + "value": "no-cache" + }, + { + "key": "Expires", + "value": "0" + }, + { + "key": "X-Frame-Options", + "value": "DENY" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Date", + "value": "Thu, 15 May 2025 10:21:54 GMT" + }, + { + "key": "Keep-Alive", + "value": "timeout=60" + }, + { + "key": "Connection", + "value": "keep-alive" + } + ], + "cookie": [], + "body": "{\n \"status\": false,\n \"message\": \"Endpoint and password already set \",\n \"exceptionMessage\": \"could not execute statement [(conn=482) Duplicate entry '1005' for key 'PRIMARY'] [insert into ps_auths (auth_type,md5_cred,password,realm,username,id) values (?,?,?,?,?,?)]; SQL [insert into ps_auths (auth_type,md5_cred,password,realm,username,id) values (?,?,?,?,?,?)]; constraint [PRIMARY]\"\n}" + } + ] + }, + { + "name": "SetAORS", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"id\": \"1005\",\n \"maxContacts\": 1\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:8081/cezen/set_aors", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "8081", + "path": [ + "cezen", + "set_aors" + ] + } + }, + "response": [ + { + "name": "SetAORS", + "originalRequest": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"id\": \"1005\",\n \"maxContacts\": 1\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:8081/cezen/set_aors", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "8081", + "path": [ + "cezen", + "set_aors" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Vary", + "value": "Origin" + }, + { + "key": "Vary", + "value": "Access-Control-Request-Method" + }, + { + "key": "Vary", + "value": "Access-Control-Request-Headers" + }, + { + "key": "X-Content-Type-Options", + "value": "nosniff" + }, + { + "key": "X-XSS-Protection", + "value": "0" + }, + { + "key": "Cache-Control", + "value": "no-cache, no-store, max-age=0, must-revalidate" + }, + { + "key": "Pragma", + "value": "no-cache" + }, + { + "key": "Expires", + "value": "0" + }, + { + "key": "X-Frame-Options", + "value": "DENY" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Date", + "value": "Thu, 15 May 2025 10:22:12 GMT" + }, + { + "key": "Keep-Alive", + "value": "timeout=60" + }, + { + "key": "Connection", + "value": "keep-alive" + } + ], + "cookie": [], + "body": "{\n \"status\": true,\n \"message\": \"1005 Persisted \",\n \"exceptionMessage\": \"\"\n}" + } + ] + }, + { + "name": "DeleteExtension", + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "http://localhost:8081/cezen/delete_extension?sipNumber=testEndPoint", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "8081", + "path": [ + "cezen", + "delete_extension" + ], + "query": [ + { + "key": "sipNumber", + "value": "testEndPoint" + } + ] + } + }, + "response": [ + { + "name": "DeleteExtension", + "originalRequest": { + "method": "DELETE", + "header": [], + "url": { + "raw": "http://localhost:8081/cezen/delete_extension?sipNumber=1005", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "8081", + "path": [ + "cezen", + "delete_extension" + ], + "query": [ + { + "key": "sipNumber", + "value": "1005" + } + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Vary", + "value": "Origin" + }, + { + "key": "Vary", + "value": "Access-Control-Request-Method" + }, + { + "key": "Vary", + "value": "Access-Control-Request-Headers" + }, + { + "key": "X-Content-Type-Options", + "value": "nosniff" + }, + { + "key": "X-XSS-Protection", + "value": "0" + }, + { + "key": "Cache-Control", + "value": "no-cache, no-store, max-age=0, must-revalidate" + }, + { + "key": "Pragma", + "value": "no-cache" + }, + { + "key": "Expires", + "value": "0" + }, + { + "key": "X-Frame-Options", + "value": "DENY" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Date", + "value": "Thu, 15 May 2025 10:22:35 GMT" + }, + { + "key": "Keep-Alive", + "value": "timeout=60" + }, + { + "key": "Connection", + "value": "keep-alive" + } + ], + "cookie": [], + "body": "true" + } + ] + }, + { + "name": "Add_a_global_extension_feature", + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"context\": \"default\",\n \"extension\": \"w\",\n \"priority\": 5,\n \"app\": \"Dial\",\n \"appdata\": \"W conf\"\n}\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:8081/cezen/add_feature", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "8081", + "path": [ + "cezen", + "add_feature" + ] + } + }, + "response": [ + { + "name": "Add_a_global_extension_feature", + "originalRequest": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"context\": \"default\",\n \"extension\": \"w\",\n \"priority\": 5,\n \"app\": \"Dial\",\n \"appdata\": \"W conf\"\n}\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:8081/cezen/add_feature", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "8081", + "path": [ + "cezen", + "add_feature" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Vary", + "value": "Origin" + }, + { + "key": "Vary", + "value": "Access-Control-Request-Method" + }, + { + "key": "Vary", + "value": "Access-Control-Request-Headers" + }, + { + "key": "X-Content-Type-Options", + "value": "nosniff" + }, + { + "key": "X-XSS-Protection", + "value": "0" + }, + { + "key": "Cache-Control", + "value": "no-cache, no-store, max-age=0, must-revalidate" + }, + { + "key": "Pragma", + "value": "no-cache" + }, + { + "key": "Expires", + "value": "0" + }, + { + "key": "X-Frame-Options", + "value": "DENY" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Date", + "value": "Thu, 15 May 2025 10:53:48 GMT" + }, + { + "key": "Keep-Alive", + "value": "timeout=60" + }, + { + "key": "Connection", + "value": "keep-alive" + } + ], + "cookie": [], + "body": "{\n \"status\": false,\n \"message\": \"w configured as default Already exists\",\n \"exceptionMessage\": \"jakarta.persistence.TransactionRequiredException: No EntityManager with actual transaction available for current thread - cannot reliably process 'persist' call\"\n}" + } + ] + }, + { + "name": "signup", + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"userName\": \"Mathew Francis\",\n \"email\":\"asda@gmail.com\",\n \"password\": \"1234567890\",\n \"confirmPassword\": \"1234567890\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:8081/open/signup", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "8081", + "path": [ + "open", + "signup" + ] + } + }, + "response": [] + }, + { + "name": "login", + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "1234", + "type": "string" + }, + { + "key": "username", + "value": "mathew", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "http://localhost:8081/open/login", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "8081", + "path": [ + "open", + "login" + ] + } + }, + "response": [ + { + "name": "login", + "originalRequest": { + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "http://localhost:8081/open/login", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "8081", + "path": [ + "open", + "login" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "Vary", + "value": "Origin" + }, + { + "key": "Vary", + "value": "Access-Control-Request-Method" + }, + { + "key": "Vary", + "value": "Access-Control-Request-Headers" + }, + { + "key": "Set-Cookie", + "value": "Authorization=eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJNYXRoZXcgRnJhbmNpcyIsInN1YiI6IkpXVF9Ub2tlbiIsInVzZXJuYW1lIjoiY29tLmV4YW1wbGUuY2V6ZW5QQlguZW50aXR5LnVzZXIuVXNlckVudGl0eUAzMGI5ZjFlOCIsImF1dGhvcml0aWVzIjoiUk9MRV9hZG1pbiIsImlhdCI6MTc0NzI5MDAyMCwiZXhwIjoxNzQ3MzIwMDIwfQ.kjyArki3Cbc90Jjf68pl5iPeg61GWaxb6yT6ivTNXes; Path=/; Secure; HttpOnly" + }, + { + "key": "X-Content-Type-Options", + "value": "nosniff" + }, + { + "key": "X-XSS-Protection", + "value": "0" + }, + { + "key": "Cache-Control", + "value": "no-cache, no-store, max-age=0, must-revalidate" + }, + { + "key": "Pragma", + "value": "no-cache" + }, + { + "key": "Expires", + "value": "0" + }, + { + "key": "X-Frame-Options", + "value": "DENY" + }, + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Transfer-Encoding", + "value": "chunked" + }, + { + "key": "Date", + "value": "Thu, 15 May 2025 06:20:20 GMT" + }, + { + "key": "Keep-Alive", + "value": "timeout=60" + }, + { + "key": "Connection", + "value": "keep-alive" + } + ], + "cookie": [], + "body": "{\n \"status\": false,\n \"message\": \"Login not yet implemented\",\n \"exceptionMessage\": \"Login not yet implemented\"\n}" + } + ] + }, + { + "name": "logout", + "request": { + "method": "POST", + "header": [], + "url": { + "raw": "http://localhost:8081/logout", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "8081", + "path": [ + "logout" + ] + } + }, + "response": [] + }, + { + "name": "XSRF", + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"id\": \"1005\",\n// \"transport\": \"transport-udp\",\n// \"context\": \"default\",\n// \"disallow\": \"all\",\n// \"allow\": \"ulaw,alaw\",\n// \"directMedia\": \"no\",\n \"connectedLineMethod\": null,\n \"callerid\": null,\n \"dtmfMode\": null,\n// \"mohsuggest\": \"default\",\n \"mailboxes\": null\n}\n\n// {\n// \"id\": \"1004\",\n// \"transport\": \"transport-udp\",\n// \"aors\": \"1004\",\n// \"auth\": \"1004\",\n// \"context\": \"default\",\n// \"disallow\": \"all\",\n// \"allow\": \"ulaw,alaw\",\n// \"directMedia\": \"no\",\n// \"connectedLineMethod\": null,\n// \"callerid\": \"User <1004>\",\n// \"dtmfMode\": null,\n// \"mohsuggest\": \"default\",\n// \"mailboxes\": \"1004@default\"\n// }" + }, + "url": { + "raw": "http://localhost:8081/user/getXSRfToken", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "8081", + "path": [ + "user", + "getXSRfToken" + ] + } + }, + "response": [] + } + ] +} \ No newline at end of file diff --git a/MySQL_conf_pbx/test1/mariadb_data/aria_log.00000001 b/MySQL_conf_pbx/test1/mariadb_data/aria_log.00000001 index 4e14826..456dfb6 100644 Binary files a/MySQL_conf_pbx/test1/mariadb_data/aria_log.00000001 and b/MySQL_conf_pbx/test1/mariadb_data/aria_log.00000001 differ diff --git a/MySQL_conf_pbx/test1/mariadb_data/aria_log_control b/MySQL_conf_pbx/test1/mariadb_data/aria_log_control index 32990a0..6de8445 100644 Binary files a/MySQL_conf_pbx/test1/mariadb_data/aria_log_control and b/MySQL_conf_pbx/test1/mariadb_data/aria_log_control differ diff --git a/MySQL_conf_pbx/test1/reactcezenpbx/src/components/operations/endPoint.jsx b/MySQL_conf_pbx/test1/reactcezenpbx/src/components/operations/endPoint.jsx index b6fc37d..9b26f3e 100644 --- a/MySQL_conf_pbx/test1/reactcezenpbx/src/components/operations/endPoint.jsx +++ b/MySQL_conf_pbx/test1/reactcezenpbx/src/components/operations/endPoint.jsx @@ -1,6 +1,7 @@ import "./end_points.css"; import phoneSvgLogo from "../../assets/phone.svg"; import { useState } from "react"; +import { createEndpointHttpEeq } from "../../http_routs/phone_operations_http"; export default function EndPoints() { const [endpointEditStatus, endpointEditFunction] = useState(false); @@ -10,6 +11,16 @@ export default function EndPoints() { return (prev = !prev); }); } + function createExtensionPoint(event) { + event.preventDefault(); + + const formData = new FormData(event.target); + const data = Object.fromEntries(formData.entries()); + + createEndpointHttpEeq(data); + + console.log(data); + } return ( <> @@ -28,7 +39,7 @@ export default function EndPoints() { {endpointEditStatus && (
- +
@@ -39,10 +50,13 @@ export default function EndPoints() { */} - +
- - + +

Lorem ipsum dolor sit amet consectetur adipisicing elit. Tenetur alias ab dolor illo voluptates ipsum sunt! Quas animi provident @@ -51,8 +65,8 @@ export default function EndPoints() {

- - + +

Lorem ipsum dolor sit amet consectetur adipisicing elit. Tenetur alias ab dolor illo voluptates ipsum sunt! Quas animi provident @@ -61,7 +75,7 @@ export default function EndPoints() {

- +

Lorem ipsum dolor sit amet consectetur adipisicing elit. Tenetur @@ -71,7 +85,7 @@ export default function EndPoints() {

- +

Lorem ipsum dolor sit amet consectetur adipisicing elit. Tenetur @@ -81,7 +95,7 @@ export default function EndPoints() {

- +

Lorem ipsum dolor sit amet consectetur adipisicing elit. Tenetur @@ -94,7 +108,7 @@ export default function EndPoints() { sip phone

- +

Lorem ipsum dolor sit amet consectetur adipisicing elit. Tenetur @@ -104,7 +118,7 @@ export default function EndPoints() {

- +
- +

Lorem ipsum dolor sit amet consectetur adipisicing elit. Tenetur @@ -128,7 +142,7 @@ export default function EndPoints() {

- +

Lorem ipsum dolor sit amet consectetur adipisicing elit. Tenetur @@ -138,7 +152,7 @@ export default function EndPoints() {

- +

Lorem ipsum dolor sit amet consectetur adipisicing elit. Tenetur @@ -148,7 +162,7 @@ export default function EndPoints() {

- +

Lorem ipsum dolor sit amet consectetur adipisicing elit. Tenetur @@ -170,68 +184,70 @@ export default function EndPoints() {

List of All the extensions

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Extension NumberCaller IdMail BoxDelete Extension
1001Mathewmat@gmail.com - -
1002SbinMexico@gmail.com - -
1003SbinMexico@gmail.com - -
1004SbinMexico@gmail.com - -
1005SbinMexico@gmail.com - -
1006SbinMexico@gmail.com - -
1007SbinMexico@gmail.com - -
Extension NumberCaller IdMail BoxDelete Extension
1001Mathewmat@gmail.com + +
1002SbinMexico@gmail.com + +
1003SbinMexico@gmail.com + +
1004SbinMexico@gmail.com + +
1005SbinMexico@gmail.com + +
1006SbinMexico@gmail.com + +
1007SbinMexico@gmail.com + +
diff --git a/MySQL_conf_pbx/test1/reactcezenpbx/src/http_routs/phone_operations_http.js b/MySQL_conf_pbx/test1/reactcezenpbx/src/http_routs/phone_operations_http.js new file mode 100644 index 0000000..4cc41c1 --- /dev/null +++ b/MySQL_conf_pbx/test1/reactcezenpbx/src/http_routs/phone_operations_http.js @@ -0,0 +1,22 @@ +import socket from "./httpDomainName"; + +// have to send a http post method to the backend ... +// make sure the backend has the cookie to +export async function createEndpointHttpEeq(inputForm = {}) { + // returns a promise we use await to get the response body using JSON() + const response = await fetch(`${socket}/cezen/add_user`, { + method: "POST", + body: JSON.stringify(inputForm), + credentials: "include", //This sends cookies (even HTTP-only ones) + headers: { + "content-type": "application/json", + }, + }); + + const resData = await response.json(); + + console.log("response data from sip"); + console.log(resData); + + return resData; +} diff --git a/MySQL_conf_pbx/test1/springCezenPBX/.gitattributes b/MySQL_conf_pbx/test1/springCezenPBX/.gitattributes old mode 100644 new mode 100755 diff --git a/MySQL_conf_pbx/test1/springCezenPBX/.gitignore b/MySQL_conf_pbx/test1/springCezenPBX/.gitignore old mode 100644 new mode 100755 diff --git a/MySQL_conf_pbx/test1/springCezenPBX/.mvn/wrapper/maven-wrapper.properties b/MySQL_conf_pbx/test1/springCezenPBX/.mvn/wrapper/maven-wrapper.properties old mode 100644 new mode 100755 diff --git a/MySQL_conf_pbx/test1/springCezenPBX/compose.yaml b/MySQL_conf_pbx/test1/springCezenPBX/compose.yaml old mode 100644 new mode 100755 diff --git a/MySQL_conf_pbx/test1/springCezenPBX/mvnw.cmd b/MySQL_conf_pbx/test1/springCezenPBX/mvnw.cmd old mode 100644 new mode 100755 diff --git a/MySQL_conf_pbx/test1/springCezenPBX/pom.xml b/MySQL_conf_pbx/test1/springCezenPBX/pom.xml old mode 100644 new mode 100755 diff --git a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/CezenPbxApplication.java b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/CezenPbxApplication.java old mode 100644 new mode 100755 diff --git a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/DAO/BasicAsteriskOpsDAO.java b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/DAO/BasicAsteriskOpsDAO.java old mode 100644 new mode 100755 diff --git a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/DAO/CezenPbxOpsDAO.java b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/DAO/CezenPbxOpsDAO.java old mode 100644 new mode 100755 diff --git a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/DAO/UserOpsDAO.java b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/DAO/UserOpsDAO.java old mode 100644 new mode 100755 diff --git a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/DAO/UserOpsDAOImpl.java b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/DAO/UserOpsDAOImpl.java old mode 100644 new mode 100755 diff --git a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/DTO/ExtensionsDTO.java b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/DTO/ExtensionsDTO.java old mode 100644 new mode 100755 diff --git a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/DTO/PsAorsDTO.java b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/DTO/PsAorsDTO.java old mode 100644 new mode 100755 diff --git a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/DTO/PsEndPointsDTO.java b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/DTO/PsEndPointsDTO.java old mode 100644 new mode 100755 diff --git a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/DTO/ReturnStatus.java b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/DTO/ReturnStatus.java old mode 100644 new mode 100755 diff --git a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/DTO/SipPasswordDTO.java b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/DTO/SipPasswordDTO.java old mode 100644 new mode 100755 diff --git a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/DTO/user/AdminSetPasswordDTO.java b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/DTO/user/AdminSetPasswordDTO.java old mode 100644 new mode 100755 diff --git a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/config/CezenLoginSecurityChain.java b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/config/CezenLoginSecurityChain.java old mode 100644 new mode 100755 index 843e794..6831ab3 --- a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/config/CezenLoginSecurityChain.java +++ b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/config/CezenLoginSecurityChain.java @@ -37,7 +37,7 @@ public class CezenLoginSecurityChain { //CSRF cookie final CookieCsrfTokenRepository cookieCsrfTokenRepo = new CookieCsrfTokenRepository(); //make secure true when using only https - cookieCsrfTokenRepo.setCookieCustomizer(responseCookieBuilder -> responseCookieBuilder.secure(true)); + cookieCsrfTokenRepo.setCookieCustomizer(responseCookieBuilder -> responseCookieBuilder.secure(false)); // bellow line is used when you are using JWT tokens instead of jSession session keys but i put always because i guess CSRF token needs it http. @@ -65,13 +65,13 @@ public class CezenLoginSecurityChain { //temporarily disabling cross sight resource forgery - .csrf(AbstractHttpConfigurer::disable) -// .csrf((csrf) -> -// csrf.csrfTokenRequestHandler(requestHandler). -// ignoringRequestMatchers("/open/signup","/open/login","/user/getXSRfToken") -// //.csrfTokenRepository(new CookieCsrfTokenRepository()) -// .csrfTokenRepository(cookieCsrfTokenRepo) -// ) + //.csrf(AbstractHttpConfigurer::disable) + .csrf((csrf) -> + csrf.csrfTokenRequestHandler(requestHandler). + ignoringRequestMatchers("/open/signup","/open/login","/user/getXSRfToken") + //.csrfTokenRepository(new CookieCsrfTokenRepository()) + .csrfTokenRepository(cookieCsrfTokenRepo) + ) //.addFilterAfter(new CsrfCookieFilter(), BasicAuthenticationFilter.class) //token generation after BasicAuthenticationFilter.class diff --git a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/config/CustomAuthenticationProviderForCezen.java b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/config/CustomAuthenticationProviderForCezen.java old mode 100644 new mode 100755 diff --git a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/constents/SecurityConstants.java b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/constents/SecurityConstants.java old mode 100644 new mode 100755 diff --git a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/controller/CezenPbxController.java b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/controller/CezenPbxController.java old mode 100644 new mode 100755 diff --git a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/controller/SignUpController.java b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/controller/SignUpController.java old mode 100644 new mode 100755 diff --git a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/controller/XsrfGet.java b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/controller/XsrfGet.java new file mode 100644 index 0000000..5ccea9c --- /dev/null +++ b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/controller/XsrfGet.java @@ -0,0 +1,20 @@ +package com.example.cezenPBX.controller; + +import org.springframework.security.web.csrf.CsrfToken; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.example.cezenPBX.DTO.ReturnStatus; + +@RestController +@RequestMapping("/user") +public class XsrfGet { + + @GetMapping("/getXSRfToken") + public CsrfToken csrf(CsrfToken csrfToken) { + return csrfToken; + } + +} diff --git a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/entity/ExtensionsTable.java b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/entity/ExtensionsTable.java old mode 100644 new mode 100755 diff --git a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/entity/PBXentiry.java b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/entity/PBXentiry.java old mode 100644 new mode 100755 diff --git a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/entity/PsAors.java b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/entity/PsAors.java old mode 100644 new mode 100755 diff --git a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/entity/PsAuths.java b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/entity/PsAuths.java old mode 100644 new mode 100755 diff --git a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/entity/PsEndPoints.java b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/entity/PsEndPoints.java old mode 100644 new mode 100755 diff --git a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/entity/user/Role.java b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/entity/user/Role.java old mode 100644 new mode 100755 diff --git a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/entity/user/UserEntity.java b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/entity/user/UserEntity.java old mode 100644 new mode 100755 diff --git a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/security/JWTTokenGeneratorFilter.java b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/security/JWTTokenGeneratorFilter.java old mode 100644 new mode 100755 index 4af13bf..03d1b7d --- a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/security/JWTTokenGeneratorFilter.java +++ b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/security/JWTTokenGeneratorFilter.java @@ -49,7 +49,7 @@ public class JWTTokenGeneratorFilter extends OncePerRequestFilter { //uncomment for cookie based saving Cookie cookie = new Cookie(SecurityConstants.JWT_HEADER,jwt); cookie.setHttpOnly(true); - cookie.setSecure(true); + cookie.setSecure(false); cookie.setPath("/"); response.addCookie(cookie); System.out.println("JWT Generated"); diff --git a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/security/JWTTokenValidatorFilter.java b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/security/JWTTokenValidatorFilter.java old mode 100644 new mode 100755 index 9390541..37a8d8d --- a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/security/JWTTokenValidatorFilter.java +++ b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/security/JWTTokenValidatorFilter.java @@ -31,6 +31,10 @@ public class JWTTokenValidatorFilter extends OncePerRequestFilter { //String jwt = request.getHeader(SecurityConstants.JWT_HEADER); //below is the COOKIE approach String jwt = null; + if(request.getCookies() == null){ + System.out.print("NO COOKIE returned from frontend"); + return; + } for(var cookie : request.getCookies()){ if(cookie.getName().equals("Authorization")){ System.out.print("COOKIE"); diff --git a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/service/BasicPbxService.java b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/service/BasicPbxService.java old mode 100644 new mode 100755 diff --git a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/service/BasicPbxServiceInterface.java b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/service/BasicPbxServiceInterface.java old mode 100644 new mode 100755 diff --git a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/service/PbxUserService.java b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/service/PbxUserService.java old mode 100644 new mode 100755 diff --git a/MySQL_conf_pbx/test1/springCezenPBX/src/main/resources/application.properties b/MySQL_conf_pbx/test1/springCezenPBX/src/main/resources/application.properties old mode 100644 new mode 100755 diff --git a/MySQL_conf_pbx/test1/springCezenPBX/src/test/java/com/example/cezenPBX/CezenPbxApplicationTests.java b/MySQL_conf_pbx/test1/springCezenPBX/src/test/java/com/example/cezenPBX/CezenPbxApplicationTests.java old mode 100644 new mode 100755 diff --git a/MySQL_conf_pbx/test1/springCezenPBX/src/test/java/com/example/cezenPBX/controller/CezenPbxHTTPControllerTest.java b/MySQL_conf_pbx/test1/springCezenPBX/src/test/java/com/example/cezenPBX/controller/CezenPbxHTTPControllerTest.java old mode 100644 new mode 100755 diff --git a/MySQL_conf_pbx/test1/springCezenPBX/src/test/java/com/example/cezenPBX/controller/PbxControllerIntegrationTest.java b/MySQL_conf_pbx/test1/springCezenPBX/src/test/java/com/example/cezenPBX/controller/PbxControllerIntegrationTest.java old mode 100644 new mode 100755