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