This commit is contained in:
MathewFrancis 2025-06-10 12:07:37 +05:30
parent 31158ce9eb
commit 1333d962dd
44 changed files with 1088 additions and 86 deletions

View File

@ -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": []
}
]
}

View File

@ -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 && (
<form>
<div className="extension_number_enter">
<label for="ext_num">Extension number</label>
<label htmlFor="ext_num">Extension number</label>
<input type="text" id="ext_num" name="ext_num"></input>
</div>
<button> Search</button>
@ -39,10 +50,13 @@ export default function EndPoints() {
</h1> */}
</section>
</div>
<form className="phone_container phones_spacing">
<form
onSubmit={createExtensionPoint}
className="phone_container phones_spacing"
>
<div className="extension_number rowSpacing_1to3 pills">
<label for="extension">Extension Number</label>
<input type="number" id="extension" name="extension_number" />
<label htmlFor="extension">Extension Number</label>
<input type="number" id="extension" name="id" />
<p>
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() {
</p>
</div>
<div className="transport rowSpacing_1to3 pills">
<label for="transport">transport type</label>
<input type="text" id="transport" name="transport_type" />
<label htmlFor="transport">transport type</label>
<input type="text" id="transport" name="transport" />
<p>
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() {
</p>
</div>
<div className="context rowSpacing_1to3 pills">
<label for="context">context</label>
<label htmlFor="context">context</label>
<input type="text" id="context" name="context" />
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Tenetur
@ -71,7 +85,7 @@ export default function EndPoints() {
</p>
</div>
<div className="disallow rowSpacing_1to3 pills">
<label for="disallow">disallow</label>
<label htmlFor="disallow">disallow</label>
<input type="text" id="disallow" name="disallow" />
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Tenetur
@ -81,7 +95,7 @@ export default function EndPoints() {
</p>
</div>
<div className="allow pills">
<label for="allow">allow</label>
<label htmlFor="allow">allow</label>
<input type="text" id="allow" name="allow" />
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Tenetur
@ -94,7 +108,7 @@ export default function EndPoints() {
<img src={phoneSvgLogo} alt="sip phone" />
</div>
<div className="directMedia pills">
<label for="directMedia">direct media</label>
<label htmlFor="directMedia">direct media</label>
<input type="checkbox" id="directMedia" name="directMedia" />
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Tenetur
@ -104,7 +118,7 @@ export default function EndPoints() {
</p>
</div>
<div className="connectedLineMethod pills">
<label for="connectedLineMethod">connected line method</label>
<label htmlFor="connectedLineMethod">connected line method</label>
<input
type="text"
id="connectedLineMethod"
@ -118,7 +132,7 @@ export default function EndPoints() {
</p>
</div>
<div className="callerid pills">
<label for="callerid">Caller Id</label>
<label htmlFor="callerid">Caller Id</label>
<input type="text" id="callerid" name="callerid" />
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Tenetur
@ -128,7 +142,7 @@ export default function EndPoints() {
</p>
</div>
<div className="dtmfMode pills">
<label for="dtmfMode">DMF Mode</label>
<label htmlFor="dtmfMode">DMF Mode</label>
<input type="text" id="dtmfMode" name="dtmfMode" />
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Tenetur
@ -138,7 +152,7 @@ export default function EndPoints() {
</p>
</div>
<div className="mohsuggest pills">
<label for="mohsuggest">Mohsuggest</label>
<label htmlFor="mohsuggest">Mohsuggest</label>
<input type="text" id="mohsuggest" name="mohsuggest" />
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Tenetur
@ -148,7 +162,7 @@ export default function EndPoints() {
</p>
</div>
<div className="mailboxes pills">
<label for="mailboxes">Mail Box</label>
<label htmlFor="mailboxes">Mail Box</label>
<input type="text" id="mailboxes" name="mailboxes" />
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Tenetur
@ -170,68 +184,70 @@ export default function EndPoints() {
<div className="extension_table">
<h2>List of All the extensions</h2>
<table>
<tr>
<th>Extension Number</th>
<th>Caller Id</th>
<th>Mail Box</th>
<th>Delete Extension</th>
</tr>
<tr>
<td>1001</td>
<td>Mathew</td>
<td>mat@gmail.com</td>
<td>
<button className="delete_button">Delete</button>
</td>
</tr>
<tr>
<td>1002</td>
<td>Sbin</td>
<td>Mexico@gmail.com</td>
<td>
<button className="delete_button">Delete</button>
</td>
</tr>
<tr>
<td>1003</td>
<td>Sbin</td>
<td>Mexico@gmail.com</td>
<td>
<button className="delete_button">Delete</button>
</td>
</tr>
<tr>
<td>1004</td>
<td>Sbin</td>
<td>Mexico@gmail.com</td>
<td>
<button className="delete_button">Delete</button>
</td>
</tr>
<tr>
<td>1005</td>
<td>Sbin</td>
<td>Mexico@gmail.com</td>
<td>
<button className="delete_button">Delete</button>
</td>
</tr>
<tr>
<td>1006</td>
<td>Sbin</td>
<td>Mexico@gmail.com</td>
<td>
<button className="delete_button">Delete</button>
</td>
</tr>
<tr>
<td>1007</td>
<td>Sbin</td>
<td>Mexico@gmail.com</td>
<td>
<button className="delete_button">Delete</button>
</td>
</tr>
<tbody>
<tr>
<th>Extension Number</th>
<th>Caller Id</th>
<th>Mail Box</th>
<th>Delete Extension</th>
</tr>
<tr>
<td>1001</td>
<td>Mathew</td>
<td>mat@gmail.com</td>
<td>
<button className="delete_button">Delete</button>
</td>
</tr>
<tr>
<td>1002</td>
<td>Sbin</td>
<td>Mexico@gmail.com</td>
<td>
<button className="delete_button">Delete</button>
</td>
</tr>
<tr>
<td>1003</td>
<td>Sbin</td>
<td>Mexico@gmail.com</td>
<td>
<button className="delete_button">Delete</button>
</td>
</tr>
<tr>
<td>1004</td>
<td>Sbin</td>
<td>Mexico@gmail.com</td>
<td>
<button className="delete_button">Delete</button>
</td>
</tr>
<tr>
<td>1005</td>
<td>Sbin</td>
<td>Mexico@gmail.com</td>
<td>
<button className="delete_button">Delete</button>
</td>
</tr>
<tr>
<td>1006</td>
<td>Sbin</td>
<td>Mexico@gmail.com</td>
<td>
<button className="delete_button">Delete</button>
</td>
</tr>
<tr>
<td>1007</td>
<td>Sbin</td>
<td>Mexico@gmail.com</td>
<td>
<button className="delete_button">Delete</button>
</td>
</tr>
</tbody>
</table>
</div>
</>

View File

@ -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;
}

0
MySQL_conf_pbx/test1/springCezenPBX/.gitattributes vendored Normal file → Executable file
View File

0
MySQL_conf_pbx/test1/springCezenPBX/.gitignore vendored Normal file → Executable file
View File

View File

0
MySQL_conf_pbx/test1/springCezenPBX/compose.yaml Normal file → Executable file
View File

0
MySQL_conf_pbx/test1/springCezenPBX/mvnw.cmd vendored Normal file → Executable file
View File

0
MySQL_conf_pbx/test1/springCezenPBX/pom.xml Normal file → Executable file
View File

View File

@ -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

View File

@ -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;
}
}

View File

@ -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");

View File

@ -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");