Ajout BCrypt
This commit is contained in:
parent
c3907be8a0
commit
0a3be75cca
@ -16,5 +16,10 @@
|
||||
<option name="name" value="MavenRepo" />
|
||||
<option name="url" value="https://repo.maven.apache.org/maven2/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="BintrayJCenter" />
|
||||
<option name="name" value="BintrayJCenter" />
|
||||
<option name="url" value="https://jcenter.bintray.com/" />
|
||||
</remote-repository>
|
||||
</component>
|
||||
</project>
|
@ -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 {
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -52,7 +52,9 @@ public class FileFrontEnd implements ClientHandlerFFE, StoreProcessorFFE {
|
||||
Iterator<Task> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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"]}]}]}
|
||||
{"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"]}]}]}
|
Loading…
Reference in New Issue
Block a user