Correction problème lors de l'authetification (login inconnu)

This commit is contained in:
Benjamin 2022-03-15 12:27:00 +01:00
parent cf0c0520b7
commit 46324885ec
4 changed files with 8 additions and 28 deletions

View File

@ -185,6 +185,7 @@ public class ClientHandler implements Runnable, AutoCloseable {
* Lorsque l'accès à été refusé. * Lorsque l'accès à été refusé.
*/ */
private void accessDenied() { private void accessDenied() {
System.out.println("AIEAIEAIE");
ProtocolWriter.ProtocolResult signErrorResult = protocolRep.executeWriter(context, SignErrorRule.NAME); ProtocolWriter.ProtocolResult signErrorResult = protocolRep.executeWriter(context, SignErrorRule.NAME);
writer.write(signErrorResult.getCommand()); // Envoie SignError car echec de la connection writer.write(signErrorResult.getCommand()); // Envoie SignError car echec de la connection
writer.flush(); writer.flush();

View File

@ -73,7 +73,11 @@ public class Context {
* @return TRUE si l'utilisateur a été authentifié * @return TRUE si l'utilisateur a été authentifié
*/ */
public boolean signIn(String login, String password) { 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;
} }
/** /**

View File

@ -194,6 +194,7 @@ public class AppData {
*/ */
public boolean verifyUser(String login, String password) { public boolean verifyUser(String login, String password) {
User user = getUser(login); User user = getUser(login);
System.out.println("OKOKOK " + password + " ok " + user);
return user != null && user.verifyPassword(password); return user != null && user.verifyPassword(password);
} }

View File

@ -1,27 +1 @@
{ {"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":[]}]}
"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"
]
}
]
}
]
}