Add authentication once again
This commit is contained in:
@@ -105,13 +105,16 @@
|
||||
token: token
|
||||
};
|
||||
|
||||
let creds = JSON.parse(localStorage.getItem("creds"));
|
||||
|
||||
await fetch("/payment", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify(dataToken)
|
||||
})
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": `Basic ${creds.username}:${creds.password}`
|
||||
},
|
||||
body: JSON.stringify(dataToken)
|
||||
})
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
document.getElementById("paymentAccepted").style.display = 'block';
|
||||
|
||||
@@ -8,6 +8,7 @@ import common.json.JsonManager;
|
||||
import common.logger.Logger;
|
||||
import common.socket.SocketManager;
|
||||
import httpServer.annotations.AllowedVerb;
|
||||
import httpServer.annotations.OnlyAuthorizedClients;
|
||||
import httpServer.authorization.Client;
|
||||
|
||||
import httpServer.authorization.AuthorizedClients;
|
||||
@@ -40,6 +41,7 @@ public class RequestHandler implements IRequestHandler {
|
||||
}
|
||||
|
||||
@AllowedVerb(name = "POST")
|
||||
@OnlyAuthorizedClients
|
||||
public void handlePayment(HttpExchange exchange) {
|
||||
Logger.displayReceived("/payment request");
|
||||
try{
|
||||
|
||||
Reference in New Issue
Block a user