Compare commits
10 Commits
852f24532f
...
413c7ee0e5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
413c7ee0e5 | ||
|
|
968f05e37b | ||
| cf97429ad9 | |||
| f68dc3d5a0 | |||
| 18a549be07 | |||
| 6565475095 | |||
| 64e64373ce | |||
|
|
6d988af61e | ||
|
|
7f8177d115 | ||
|
|
49b7366187 |
@@ -105,13 +105,16 @@
|
|||||||
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)
|
||||||
|
})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
document.getElementById("paymentAccepted").style.display = 'block';
|
document.getElementById("paymentAccepted").style.display = 'block';
|
||||||
|
|||||||
@@ -2,61 +2,47 @@ plugins {
|
|||||||
id("java")
|
id("java")
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets {
|
|
||||||
create("common") {
|
|
||||||
java.srcDir("common/src")
|
|
||||||
}
|
|
||||||
|
|
||||||
create("acq") {
|
|
||||||
java.srcDir("acq/src")
|
|
||||||
}
|
|
||||||
|
|
||||||
create("acs") {
|
|
||||||
java.srcDir("acs/src")
|
|
||||||
}
|
|
||||||
|
|
||||||
create("externalApp") {
|
|
||||||
java.srcDir("externalApp/src")
|
|
||||||
}
|
|
||||||
|
|
||||||
create("httpServer") {
|
|
||||||
java.srcDir("httpServer/src")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.register<Jar>("jarAcq") {
|
tasks.register<Jar>("jarAcq") {
|
||||||
manifest {
|
manifest {
|
||||||
attributes["Main-Class"] = "Main"
|
attributes["Main-Class"] = "acs.Main"
|
||||||
}
|
}
|
||||||
archiveBaseName.set("acq")
|
archiveBaseName.set("acq")
|
||||||
from(sourceSets["acq"].output)
|
|
||||||
|
from(sourceSets.main.get().output)
|
||||||
|
|
||||||
dependsOn("classes")
|
dependsOn("classes")
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.register<Jar>("jarAcs") {
|
tasks.register<Jar>("jarAcs") {
|
||||||
manifest {
|
manifest {
|
||||||
attributes["Main-Class"] = "Main"
|
attributes["Main-Class"] = "acs.Main"
|
||||||
}
|
}
|
||||||
archiveBaseName.set("acs")
|
archiveBaseName.set("acs")
|
||||||
from(sourceSets["acs"].output)
|
|
||||||
|
from(sourceSets.main.get().output)
|
||||||
|
|
||||||
dependsOn("classes")
|
dependsOn("classes")
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.register<Jar>("jarExternalApp") {
|
tasks.register<Jar>("jarExternalApp") {
|
||||||
manifest {
|
manifest {
|
||||||
attributes["Main-Class"] = "Main"
|
attributes["Main-Class"] = "externalApp.Main"
|
||||||
}
|
}
|
||||||
archiveBaseName.set("externalApp")
|
archiveBaseName.set("externalApp")
|
||||||
from(sourceSets["externalApp"].output)
|
|
||||||
|
from(sourceSets.main.get().output)
|
||||||
|
|
||||||
dependsOn("classes")
|
dependsOn("classes")
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.register<Jar>("jarHttpServer") {
|
tasks.register<Jar>("jarHttpServer") {
|
||||||
manifest {
|
manifest {
|
||||||
attributes["Main-Class"] = "Main"
|
attributes["Main-Class"] = "httpServer.Main"
|
||||||
}
|
}
|
||||||
archiveBaseName.set("httpServer")
|
archiveBaseName.set("httpServer")
|
||||||
from(sourceSets["httpServer"].output)
|
|
||||||
|
from(sourceSets.main.get().output)
|
||||||
|
|
||||||
dependsOn("classes")
|
dependsOn("classes")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package acq.acq.src;
|
package acq;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import javax.net.ssl.KeyManagerFactory;
|
import javax.net.ssl.KeyManagerFactory;
|
||||||
@@ -7,12 +7,12 @@ import javax.net.ssl.SSLSocket;
|
|||||||
import javax.net.ssl.SSLSocketFactory;
|
import javax.net.ssl.SSLSocketFactory;
|
||||||
import javax.net.ssl.TrustManagerFactory;
|
import javax.net.ssl.TrustManagerFactory;
|
||||||
|
|
||||||
import common.common.src.crypto.KeyFactory;
|
import common.crypto.KeyFactory;
|
||||||
import common.common.src.logger.Logger;
|
import common.logger.Logger;
|
||||||
import static common.common.src.ports.Ports.ACQ_SERVER_PORT;
|
import static common.ports.Ports.ACQ_SERVER_PORT;
|
||||||
import static common.common.src.ports.Ports.ACS_SERVER_PORT;
|
import static common.ports.Ports.ACS_SERVER_PORT;
|
||||||
import common.common.src.requestHandlers.SSLServerFactory;
|
import common.requestHandlers.SSLServerFactory;
|
||||||
import common.common.src.socket.SocketManager;
|
import common.socket.SocketManager;
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
|
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
package acs.acs.src;
|
package acs;
|
||||||
|
|
||||||
import acs.acs.src.json.CreditCard;
|
import acs.json.CreditCard;
|
||||||
import acs.acs.src.json.Payload;
|
import acs.json.Payload;
|
||||||
import common.common.src.crypto.KeyFactory;
|
import common.crypto.KeyFactory;
|
||||||
import common.common.src.crypto.CryptoUtils;
|
import common.crypto.CryptoUtils;
|
||||||
import common.common.src.json.JsonManager;
|
import common.json.JsonManager;
|
||||||
import common.common.src.logger.Logger;
|
import common.logger.Logger;
|
||||||
import common.common.src.requestHandlers.SSLServerFactory;
|
import common.requestHandlers.SSLServerFactory;
|
||||||
import common.common.src.socket.SocketManager;
|
import common.socket.SocketManager;
|
||||||
|
|
||||||
import javax.net.ssl.*;
|
import javax.net.ssl.*;
|
||||||
|
|
||||||
@@ -21,8 +21,8 @@ import java.time.YearMonth;
|
|||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static common.common.src.ports.Ports.ACS_SERVER_PORT;
|
import static common.ports.Ports.ACS_SERVER_PORT;
|
||||||
import static common.common.src.ports.Ports.AUTH_PORT;
|
import static common.ports.Ports.AUTH_PORT;
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@ public class Main {
|
|||||||
Logger.displayInfo("Détails de la carte OK");
|
Logger.displayInfo("Détails de la carte OK");
|
||||||
|
|
||||||
PrivateKey privateKey = CryptoUtils.getPrivateKey(KEY_STORE_PATH, KEY_STORE_PWD, "acs");
|
PrivateKey privateKey = CryptoUtils.getPrivateKey(KEY_STORE_PATH, KEY_STORE_PWD, "acs");
|
||||||
String token = tokenManager.generateAndStoreToken();
|
String token = tokenManager.generateAndStoreTokenFor(creditCard.number());
|
||||||
String signedToken = CryptoUtils.signData(privateKey, token);
|
String signedToken = CryptoUtils.signData(privateKey, token);
|
||||||
|
|
||||||
Map<String, Object> data = Map.of("token", token, "signature", signedToken);
|
Map<String, Object> data = Map.of("token", token, "signature", signedToken);
|
||||||
@@ -128,7 +128,7 @@ public class Main {
|
|||||||
LocalDateTime now = LocalDateTime.now();
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
|
||||||
// 1. Date d'expiration est future
|
// 1. Date d'expiration est future
|
||||||
if (cardDate.isAfter(now)) {
|
if (now.isAfter(cardDate)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
20
src/main/java/acs/TokenManager.java
Normal file
20
src/main/java/acs/TokenManager.java
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
package acs;
|
||||||
|
|
||||||
|
import common.crypto.CryptoUtils;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class TokenManager {
|
||||||
|
private final Map<String, String> tokens = new HashMap<String, String>();
|
||||||
|
|
||||||
|
public String generateAndStoreTokenFor(String cardNumber) {
|
||||||
|
String token = CryptoUtils.generateToken();
|
||||||
|
tokens.put(cardNumber, token);
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isValidToken(String token) {
|
||||||
|
return tokens.containsValue(token);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
package acs.acs.src;
|
|
||||||
|
|
||||||
import common.common.src.crypto.CryptoUtils;
|
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
|
|
||||||
public class TokenManager {
|
|
||||||
private final HashSet<String> tokens = new HashSet<String>();
|
|
||||||
|
|
||||||
public String generateAndStoreToken() {
|
|
||||||
String token = CryptoUtils.generateToken();
|
|
||||||
tokens.add(token);
|
|
||||||
return token;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isValidToken(String token) {
|
|
||||||
return tokens.contains(token);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package acs.acs.src.json;
|
package acs.json;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package acs.acs.src.json;
|
package acs.json;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package common.common.src.crypto;
|
package common.crypto;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.security.*;
|
import java.security.*;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package common.common.src.crypto;
|
package common.crypto;
|
||||||
|
|
||||||
import javax.net.ssl.KeyManagerFactory;
|
import javax.net.ssl.KeyManagerFactory;
|
||||||
import javax.net.ssl.TrustManagerFactory;
|
import javax.net.ssl.TrustManagerFactory;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package common.common.src.html;
|
package common.html;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package common.common.src.json;
|
package common.json;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package common.common.src.logger;
|
package common.logger;
|
||||||
|
|
||||||
public class Logger {
|
public class Logger {
|
||||||
public static void displayInfo(String message){
|
public static void displayInfo(String message){
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package common.common.src.ports;
|
package common.ports;
|
||||||
|
|
||||||
public class Ports {
|
public class Ports {
|
||||||
/**
|
/**
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package common.common.src.requestHandlers;
|
package common.requestHandlers;
|
||||||
|
|
||||||
import common.common.src.logger.Logger;
|
import common.logger.Logger;
|
||||||
|
|
||||||
import javax.net.ssl.SSLContext;
|
import javax.net.ssl.SSLContext;
|
||||||
import javax.net.ssl.SSLServerSocket;
|
import javax.net.ssl.SSLServerSocket;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package common.common.src.socket;
|
package common.socket;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
package externalApp.externalApp.src;
|
package externalApp;
|
||||||
|
|
||||||
import common.common.src.crypto.CryptoUtils;
|
import common.crypto.CryptoUtils;
|
||||||
import common.common.src.crypto.KeyFactory;
|
import common.crypto.KeyFactory;
|
||||||
import common.common.src.json.JsonManager;
|
import common.json.JsonManager;
|
||||||
import common.common.src.logger.Logger;
|
import common.logger.Logger;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
import common.common.src.socket.SocketManager;
|
import common.socket.SocketManager;
|
||||||
import externalApp.externalApp.src.json.Payload;
|
import externalApp.json.Payload;
|
||||||
|
|
||||||
import javax.net.ssl.*;
|
import javax.net.ssl.*;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
@@ -17,7 +17,8 @@ import java.security.*;
|
|||||||
import java.security.cert.CertificateException;
|
import java.security.cert.CertificateException;
|
||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
|
|
||||||
import static common.common.src.ports.Ports.*;
|
import static common.ports.Ports.ACS_HOST;
|
||||||
|
import static common.ports.Ports.AUTH_PORT;
|
||||||
|
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
@@ -30,12 +31,13 @@ public class Main {
|
|||||||
|
|
||||||
public static void main(String[] args) throws IOException, KeyStoreException, UnrecoverableKeyException, NoSuchAlgorithmException, InvalidKeyException, SignatureException, URISyntaxException, CertificateException, KeyManagementException {
|
public static void main(String[] args) throws IOException, KeyStoreException, UnrecoverableKeyException, NoSuchAlgorithmException, InvalidKeyException, SignatureException, URISyntaxException, CertificateException, KeyManagementException {
|
||||||
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
|
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
|
||||||
// String expirationDate = acquireStringInput( br,"Quel est la date d'expiration de la carte de crédit (MM/AA) ? ");
|
String expirationDate = acquireStringInput( br,"Quel est la date d'expiration de la carte de crédit (MM/AA) ? ");
|
||||||
// String cardNumber = acquireStringInput(br, "Numéro de la carte de crédit : ");
|
String cardNumber = acquireStringInput(br, "Numéro de la carte de crédit : ");
|
||||||
|
|
||||||
String expirationDate = "01/01";
|
// String expirationDate = "01/01"; // Invalid date for testing
|
||||||
|
// String expirationDate = "01/26"; // Valid date for testing
|
||||||
// String cardNumber = "0123456789012345"; // Invalid card for testing
|
// String cardNumber = "0123456789012345"; // Invalid card for testing
|
||||||
String cardNumber = "123456789056"; // Valid card for testing
|
// String cardNumber = "123456789056"; // Valid card for testing
|
||||||
|
|
||||||
String jsonString = buildCreditCardJson(expirationDate, cardNumber);
|
String jsonString = buildCreditCardJson(expirationDate, cardNumber);
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package externalApp.externalApp.src.json;
|
package externalApp.json;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
@@ -1,22 +1,20 @@
|
|||||||
package httpServer.httpServer.src;
|
package httpServer;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
|
||||||
import com.sun.net.httpserver.HttpsConfigurator;
|
import com.sun.net.httpserver.HttpsConfigurator;
|
||||||
import com.sun.net.httpserver.HttpsParameters;
|
import com.sun.net.httpserver.HttpsParameters;
|
||||||
import com.sun.net.httpserver.HttpsServer;
|
import com.sun.net.httpserver.HttpsServer;
|
||||||
import common.common.src.crypto.KeyFactory;
|
import common.crypto.KeyFactory;
|
||||||
import common.common.src.logger.Logger;
|
import common.logger.Logger;
|
||||||
import common.common.src.socket.SocketManager;
|
import httpServer.handlers.IRequestHandler;
|
||||||
import httpServer.httpServer.src.handlers.IRequestHandler;
|
import httpServer.handlers.RequestHandler;
|
||||||
import httpServer.httpServer.src.handlers.RequestHandler;
|
import httpServer.interceptors.RequestInterceptor;
|
||||||
import httpServer.httpServer.src.interceptors.RequestInterceptor;
|
|
||||||
|
|
||||||
import javax.net.ssl.*;
|
import javax.net.ssl.*;
|
||||||
import java.lang.reflect.Proxy;
|
import java.lang.reflect.Proxy;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
|
|
||||||
import static common.common.src.ports.Ports.*;
|
import static common.ports.Ports.HTTP_SERVER_PORT;
|
||||||
|
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package httpServer.httpServer.src.annotations;
|
package httpServer.annotations;
|
||||||
|
|
||||||
import java.lang.annotation.*;
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package httpServer.httpServer.src.annotations;
|
package httpServer.annotations;
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.ElementType;
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package httpServer.httpServer.src.authorization;
|
package httpServer.authorization;
|
||||||
|
|
||||||
import org.springframework.security.crypto.bcrypt.BCrypt;
|
import org.springframework.security.crypto.bcrypt.BCrypt;
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package httpServer.httpServer.src.authorization;
|
package httpServer.authorization;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package httpServer.httpServer.src.authorization;
|
package httpServer.authorization;
|
||||||
|
|
||||||
import org.springframework.security.crypto.bcrypt.BCrypt;
|
import org.springframework.security.crypto.bcrypt.BCrypt;
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package httpServer.httpServer.src.exceptions;
|
package httpServer.exceptions;
|
||||||
|
|
||||||
public class ClientAuthorisationException extends Exception {
|
public class ClientAuthorisationException extends Exception {
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package httpServer.httpServer.src.exceptions;
|
package httpServer.exceptions;
|
||||||
|
|
||||||
public class NoSuchVerbException extends Exception {
|
public class NoSuchVerbException extends Exception {
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package httpServer.httpServer.src.handlers;
|
package httpServer.handlers;
|
||||||
|
|
||||||
import com.sun.net.httpserver.HttpExchange;
|
import com.sun.net.httpserver.HttpExchange;
|
||||||
|
|
||||||
@@ -1,20 +1,17 @@
|
|||||||
package httpServer.httpServer.src.handlers;
|
package httpServer.handlers;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.sun.net.httpserver.HttpExchange;
|
import com.sun.net.httpserver.HttpExchange;
|
||||||
import common.common.src.html.HtmlManager;
|
import common.html.HtmlManager;
|
||||||
import common.common.src.json.JsonManager;
|
import common.json.JsonManager;
|
||||||
import common.common.src.logger.Logger;
|
import common.logger.Logger;
|
||||||
import common.common.src.socket.SocketManager;
|
import common.socket.SocketManager;
|
||||||
import common.common.src.json.JsonManager;
|
import httpServer.annotations.AllowedVerb;
|
||||||
import httpServer.httpServer.src.annotations.AllowedVerb;
|
import httpServer.annotations.OnlyAuthorizedClients;
|
||||||
import httpServer.httpServer.src.annotations.OnlyAuthorizedClients;
|
import httpServer.authorization.Client;
|
||||||
import httpServer.httpServer.src.authorization.AuthorizedClients;
|
|
||||||
import httpServer.httpServer.src.authorization.Client;
|
|
||||||
|
|
||||||
import static common.common.src.ports.Ports.*;
|
|
||||||
|
|
||||||
|
import httpServer.authorization.AuthorizedClients;
|
||||||
import javax.net.ssl.SSLContext;
|
import javax.net.ssl.SSLContext;
|
||||||
import javax.net.ssl.SSLSocket;
|
import javax.net.ssl.SSLSocket;
|
||||||
import javax.net.ssl.SSLSocketFactory;
|
import javax.net.ssl.SSLSocketFactory;
|
||||||
@@ -23,6 +20,8 @@ import java.io.*;
|
|||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static common.ports.Ports.ACQ_SERVER_PORT;
|
||||||
|
|
||||||
public class RequestHandler implements IRequestHandler {
|
public class RequestHandler implements IRequestHandler {
|
||||||
|
|
||||||
private final AuthorizedClients authorizedClients = new AuthorizedClients();
|
private final AuthorizedClients authorizedClients = new AuthorizedClients();
|
||||||
@@ -42,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{
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
package httpServer.httpServer.src.interceptors;
|
package httpServer.interceptors;
|
||||||
|
|
||||||
import com.sun.net.httpserver.HttpExchange;
|
import com.sun.net.httpserver.HttpExchange;
|
||||||
import common.common.src.logger.Logger;
|
import common.logger.Logger;
|
||||||
import httpServer.httpServer.src.annotations.AllowedVerb;
|
import httpServer.annotations.AllowedVerb;
|
||||||
import httpServer.httpServer.src.annotations.OnlyAuthorizedClients;
|
import httpServer.annotations.OnlyAuthorizedClients;
|
||||||
import httpServer.httpServer.src.authorization.AuthorizedClients;
|
import httpServer.authorization.AuthorizedClients;
|
||||||
import httpServer.httpServer.src.exceptions.NoSuchVerbException;
|
import httpServer.exceptions.NoSuchVerbException;
|
||||||
import httpServer.httpServer.src.exceptions.ClientAuthorisationException;
|
import httpServer.exceptions.ClientAuthorisationException;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.*;
|
import java.lang.reflect.*;
|
||||||
Reference in New Issue
Block a user