Goal: Add a mechanism for private key authentication instead of / in addition to a password.
Wanted functionality: When adding a connection, there should be any sort of input to add a SSH private key.
Below is a mockup of the view where the changes have to be made

This view has to be updated: activiy_connection_details.xml.
This view is used in the ConnectionDetailsActivity class.
You therefore have to add a new column in our SQLite Database to persist the private key. Either by saving it directly into the database as byte array or as file and attach a filepath to the model class and database. Furthermore, a field to decide if a private key should be used has to be added.
Connection model class seen below
|
public class Connection extends SugarRecord { |
|
private String hostname; |
|
private String username; |
|
private String password; |
|
private Integer sshPort; |
|
private Integer timesConnected = 0; |
|
private String operatingSystem = ""; |
|
private String hostKey; |
This has to be implemented into the underlying connection manager. We use the awesome library JSch for this.
|
@Override |
|
protected void onPreExecute() { |
|
this.ces = new CommandExecutionSummary(); |
|
// bootstrap connection to server |
|
try { |
|
JSch jsch = new JSch(); |
|
|
|
this.jschSession = jsch.getSession( |
|
this.connection.getUsername(), |
|
this.connection.getHostname(), |
|
this.connection.getSshPort()); |
|
|
|
this.jschSession.setPassword(this.connection.getPassword()); |
If any questions come to your mind feel free to ask.
Thanks in advance,
David
Goal: Add a mechanism for private key authentication instead of / in addition to a password.
Wanted functionality: When adding a connection, there should be any sort of input to add a SSH private key.
Below is a mockup of the view where the changes have to be made

This view has to be updated: activiy_connection_details.xml.
This view is used in the ConnectionDetailsActivity class.
You therefore have to add a new column in our SQLite Database to persist the private key. Either by saving it directly into the database as byte array or as file and attach a filepath to the model class and database. Furthermore, a field to decide if a private key should be used has to be added.
Connection model class seen below
docker2go/app/src/main/java/at/htl_villach/docker2go/Connection.java
Lines 9 to 16 in 5541f93
This has to be implemented into the underlying connection manager. We use the awesome library JSch for this.
docker2go/app/src/main/java/at/htl_villach/docker2go/AsyncTaskCommandExecutor.java
Lines 54 to 66 in 18c6d7e
If any questions come to your mind feel free to ask.
Thanks in advance,
David