diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
index fdc392f..b3e9cbd 100644
--- a/.idea/jarRepositories.xml
+++ b/.idea/jarRepositories.xml
@@ -16,5 +16,10 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index 3a8d723..8d3a064 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -14,6 +14,7 @@ plugins {
repositories {
// Use Maven Central for resolving dependencies.
mavenCentral()
+ jcenter()
}
dependencies {
@@ -24,6 +25,10 @@ dependencies {
implementation 'com.google.guava:guava:30.1-jre'
// Use gson to serialize/deserialize json files
implementation 'com.google.code.gson:gson:2.9.0'
+
+ // https://mvnrepository.com/artifact/org.mindrot/jbcrypt
+ implementation 'org.mindrot:jbcrypt:0.4'
+
}
application {
diff --git a/app/src/main/java/lightcontainer/App.java b/app/src/main/java/lightcontainer/App.java
index b5e133d..e5909b5 100644
--- a/app/src/main/java/lightcontainer/App.java
+++ b/app/src/main/java/lightcontainer/App.java
@@ -15,6 +15,7 @@ import lightcontainer.repository.StoreProcessorRepository;
import lightcontainer.storage.AppData;
import lightcontainer.storage.JsonAdapter;
import lightcontainer.storage.Repository;
+import org.mindrot.jbcrypt.BCrypt;
import java.nio.file.Paths;
@@ -24,7 +25,7 @@ public class App {
public static void main(String[] args) {
setupVM();
Repository repositoryStorage = prepareStorage();
-
+
// Create all repository
ClientHandlerRepository clientRep = new ClientHandlerRepository();
StoreProcessorRepository storeRep = new StoreProcessorRepository();
diff --git a/app/src/main/java/lightcontainer/domains/client/ClientHandler.java b/app/src/main/java/lightcontainer/domains/client/ClientHandler.java
index 9d924bf..f79c820 100644
--- a/app/src/main/java/lightcontainer/domains/client/ClientHandler.java
+++ b/app/src/main/java/lightcontainer/domains/client/ClientHandler.java
@@ -112,24 +112,29 @@ public class ClientHandler implements Runnable, AutoCloseable {
if (checkAccess(ruleResult)) {
// Lecture du fichier client
ruleResult.read(this.client.getInputStream());
-
+ System.out.println(context.getLogin() + " - " + 1);
ProtocolWriter.ProtocolResult writerCommand = ruleResult.getResultCommand();
// TODO : Vérifier que le StorBackEnd demandé (Pas toujours demandé) est disponible
if (ruleResult.getReceiver() == ProtocolReader.ResultCmdReceiver.STOREBACKEND && !fileFrontEnd.canExecuteCommand(ruleResult.getRequestDomain())) {
System.out.println("ICI");
+ System.out.println(context.getLogin() + " - " + 2);
writer.print(ruleResult.onNotExecutable(context)); // Renvoie au client
writer.flush();
} else if (ruleResult.getReceiver() == ProtocolReader.ResultCmdReceiver.STOREBACKEND) {
fileFrontEnd.newCommand(context, writerCommand); // Envoie dans la file de tâche FileFrontEnd en attente d'un traitement d'un StorBackEnd
+ System.out.println(context.getLogin() + " - " + 3);
// Attend la fin de la réalisation de la tâche
waitTaskResponse();
+ System.out.println(context.getLogin() + " - " + 4);
writer.write(response.getCommand()); // Renvoie au client
writer.flush();
response.write(this.client.getOutputStream()); // Ecrit au client si nécessaire
+ System.out.println(context.getLogin() + " - " + 5);
} else {
+ System.out.println(context.getLogin() + " - " + 6);
writer.print(writerCommand.getCommand()); // Renvoie au client
writer.flush();
}
diff --git a/app/src/main/java/lightcontainer/repository/FileFrontEnd.java b/app/src/main/java/lightcontainer/repository/FileFrontEnd.java
index 55394a4..ef6e4aa 100644
--- a/app/src/main/java/lightcontainer/repository/FileFrontEnd.java
+++ b/app/src/main/java/lightcontainer/repository/FileFrontEnd.java
@@ -52,7 +52,9 @@ public class FileFrontEnd implements ClientHandlerFFE, StoreProcessorFFE {
Iterator it = tasks.iterator();
while (it.hasNext()) {
Task task = it.next();
+ System.out.println("Cherche");
if (task.isResponseOfClient(store.getDomain())) {
+ System.out.println("Task trouvée");
clientRepository.respondToClient(task.getClient(), response);
it.remove(); // Suppression de la tâche
break;
@@ -71,6 +73,7 @@ public class FileFrontEnd implements ClientHandlerFFE, StoreProcessorFFE {
if (store.canProcessTask(task)) {
storeRepository.assignTask(store.getDomain(), task);
task.setDomain(store.getDomain());
+ return;
}
}
}
diff --git a/app/src/main/resources/appdata.json b/app/src/main/resources/appdata.json
index a887a1b..7efd5d9 100644
--- a/app/src/main/resources/appdata.json
+++ b/app/src/main/resources/appdata.json
@@ -1 +1 @@
-{"unicast_port":8000,"multicast_ip":"224.66.66.1","multicast_port":15502,"network_interface":"My network interface","tls":true,"storagePath":"/home/benjamin/ffe","users":[{"name":"aaaaa","password":"5d628c274ebb008324f1e199d3bfff0a3fe839730a7f2355e82850d7acca5e5ca64db9071abf3d91034295695f84a617","aes_key":"qlTH6TijnfMRnrS0Qf+k6IPKGp5LoRMXGxCq16e+mF4=","passwordSalt":"Ns8Al6DpqPsIDlCSRBVTEg==","files":[{"name":"README.md","fileNameSalt":"cDY6LMq13iqKknRS9OVBPw==","size":17,"iv":"jxc7hkIAoH64M8JF7FvNFw==","storage":["lightcontainerSB01"]}]}]}
\ No newline at end of file
+{"unicast_port":8000,"multicast_ip":"224.66.66.1","multicast_port":15502,"network_interface":"wlp1s0","tls":true,"storagePath":"/home/benjamin/ffe","users":[{"name":"aaaaa","password":"5d628c274ebb008324f1e199d3bfff0a3fe839730a7f2355e82850d7acca5e5ca64db9071abf3d91034295695f84a617","aes_key":"qlTH6TijnfMRnrS0Qf+k6IPKGp5LoRMXGxCq16e+mF4=","passwordSalt":"Ns8Al6DpqPsIDlCSRBVTEg==","files":[{"name":"ca.crt","fileNameSalt":"rTiE/FXNglnzbGBUGTDuJA==","size":4207,"iv":"0lg3QNhJ/eN292dbOvjShQ==","storage":["lightcontainerSB01"]},{"name":"main.py","fileNameSalt":"A3e6pNPkjZd4Rp2z9Nfzsg==","size":854,"iv":"rBqMLyPxtOQWJYasKFmrkA==","storage":["lightcontainerSB01"]},{"name":"README.md","fileNameSalt":"cDY6LMq13iqKknRS9OVBPw==","size":17,"iv":"jxc7hkIAoH64M8JF7FvNFw==","storage":["lightcontainerSB01"]}]}]}
\ No newline at end of file