From 46324885ec6009f3067d426d4b9a8b2a05b0a997 Mon Sep 17 00:00:00 2001 From: Benjamin Date: Tue, 15 Mar 2022 12:27:00 +0100 Subject: [PATCH] =?UTF-8?q?Correction=20probl=C3=A8me=20lors=20de=20l'auth?= =?UTF-8?q?etification=20(login=20inconnu)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domains/client/ClientHandler.java | 1 + .../domains/client/Context.java | 6 +++- .../java/lightcontainer/storage/AppData.java | 1 + app/src/main/resources/appdata.json | 28 +------------------ 4 files changed, 8 insertions(+), 28 deletions(-) diff --git a/app/src/main/java/lightcontainer/domains/client/ClientHandler.java b/app/src/main/java/lightcontainer/domains/client/ClientHandler.java index 2948cdb..4181b7b 100644 --- a/app/src/main/java/lightcontainer/domains/client/ClientHandler.java +++ b/app/src/main/java/lightcontainer/domains/client/ClientHandler.java @@ -185,6 +185,7 @@ public class ClientHandler implements Runnable, AutoCloseable { * Lorsque l'accès à été refusé. */ private void accessDenied() { + System.out.println("AIEAIEAIE"); ProtocolWriter.ProtocolResult signErrorResult = protocolRep.executeWriter(context, SignErrorRule.NAME); writer.write(signErrorResult.getCommand()); // Envoie SignError car echec de la connection writer.flush(); diff --git a/app/src/main/java/lightcontainer/domains/client/Context.java b/app/src/main/java/lightcontainer/domains/client/Context.java index bd23773..7864ca4 100644 --- a/app/src/main/java/lightcontainer/domains/client/Context.java +++ b/app/src/main/java/lightcontainer/domains/client/Context.java @@ -73,7 +73,11 @@ public class Context { * @return TRUE si l'utilisateur a été authentifié */ public boolean signIn(String login, String password) { - return this.repository.verifyUser(login, password); + if (this.repository.verifyUser(login, password)) { + this.login = login; + return true; + } + return false; } /** diff --git a/app/src/main/java/lightcontainer/storage/AppData.java b/app/src/main/java/lightcontainer/storage/AppData.java index 29f22f0..326839b 100644 --- a/app/src/main/java/lightcontainer/storage/AppData.java +++ b/app/src/main/java/lightcontainer/storage/AppData.java @@ -194,6 +194,7 @@ public class AppData { */ public boolean verifyUser(String login, String password) { User user = getUser(login); + System.out.println("OKOKOK " + password + " ok " + user); return user != null && user.verifyPassword(password); } diff --git a/app/src/main/resources/appdata.json b/app/src/main/resources/appdata.json index 261cc46..2baebe3 100644 --- a/app/src/main/resources/appdata.json +++ b/app/src/main/resources/appdata.json @@ -1,27 +1 @@ -{ - "unicast_port": 8000, - "multicast_ip": "224.66.66.1", - "multicast_port": 15502, - "network_interface": "Software Loopback Interface 1", - "tls": true, - "storagePath": "D:\\ffe", - "users": [ - { - "name": "aaaaa", - "password": "5d628c274ebb008324f1e199d3bfff0a3fe839730a7f2355e82850d7acca5e5ca64db9071abf3d91034295695f84a617", - "aes_key": "qlTH6TijnfMRnrS0Qf+k6IPKGp5LoRMXGxCq16e+mF4=", - "passwordSalt": "Ns8Al6DpqPsIDlCSRBVTEg==", - "files": [ - { - "name": "loader.gif", - "fileNameSalt": "qIM0UIgtc4c9I+K8iLeObg==", - "size": 89594, - "iv": "WHJj4TMCmlRnCIQqgGjrnw==", - "storage": [ - "lightcontainerSB01" - ] - } - ] - } - ] -} \ No newline at end of file +{"unicast_port":8000,"multicast_ip":"224.66.66.1","multicast_port":15502,"network_interface":"","tls":true,"storagePath":"/home/benjamin/ffe","users":[{"name":"aaaaa","password":"$2a$10$nDCEDVwbNO/YDQ4qdRcxfuES4.aboluLzWouXXsk6vDoaWocv516W","aes_key":"kYtwHy9qJBg30WS6axWTFGVE0Ge5kpYiJJlC+COIEI4=","files":[]}]} \ No newline at end of file