Feature: do not store the passwrd as plain text but instead use a public key generated on server side

This commit is contained in:
Laurent Clouet
2019-08-22 21:35:26 +02:00
parent e044c35ad7
commit 72462b88c7
7 changed files with 46 additions and 2 deletions

View File

@@ -45,13 +45,15 @@ import javax.swing.border.EmptyBorder;
import com.sheepit.client.Client;
import com.sheepit.client.Configuration;
import com.sheepit.client.Gui;
import com.sheepit.client.SettingsLoader;
import com.sheepit.client.Stats;
import com.sheepit.client.standalone.swing.activity.Settings;
import com.sheepit.client.standalone.swing.activity.Working;
import lombok.Setter;
public class GuiSwing extends JFrame implements Gui {
public static final String type = "swing";
public enum ActivityType {
WORKING, SETTINGS
}
@@ -68,6 +70,9 @@ public class GuiSwing extends JFrame implements Gui {
private boolean waitingForAuthentication;
private Client client;
@Setter
private SettingsLoader settingsLoader;
private ThreadClient threadClient;
@@ -222,6 +227,16 @@ public class GuiSwing extends JFrame implements Gui {
public Configuration getConfiguration() {
return client.getConfiguration();
}
@Override
public void successfulAuthenticationEvent(String publickey) {
if (settingsLoader != null) {
if (publickey != null) {
settingsLoader.setPassword(publickey);
}
settingsLoader.saveFile();
}
}
public void setCredentials(String contentLogin, String contentPassword) {
client.getConfiguration().setLogin(contentLogin);

View File

@@ -145,4 +145,8 @@ public class GuiText implements Gui {
return client;
}
@Override
public void successfulAuthenticationEvent(String publickey) {
}
}

View File

@@ -158,6 +158,11 @@ public class GuiTextOneLine implements Gui {
return client;
}
@Override
public void successfulAuthenticationEvent(String publickey) {
}
private void updateLine() {
int charToRemove = line.length();

View File

@@ -619,7 +619,7 @@ public class Settings implements Activity {
}
if (saveFile.isSelected()) {
new SettingsLoader(config.getConfigFilePath(), login.getText(), new String(password.getPassword()), proxyText, hostnameText, method, selected_gpu, cpu_cores, max_ram, max_rendertime, cachePath, autoSignIn.isSelected(), GuiSwing.type, tile, priority.getValue()).saveFile();
parent.setSettingsLoader(new SettingsLoader(config.getConfigFilePath(), login.getText(), new String(password.getPassword()), proxyText, hostnameText, method, selected_gpu, cpu_cores, max_ram, max_rendertime, cachePath, autoSignIn.isSelected(), GuiSwing.type, tile, priority.getValue()));
}
}
}