bug5777: clean-up, formatting, docs

This commit is contained in:
Axel Uhl committed 2022-11-09 19:59:08 +01:00
1 parent cb3920f588
commit 0aa199bf92
7 files changed
+18 -21

No files matched your search

@@ -120,7 +120,7 @@
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.google.gwt.dev.DevMode"/>
<stringAttribute key="org.eclipse.jdt.launching.MODULE_NAME" value="com.sap.sailing.gwt.ui"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-nosuperDevMode -style PRETTY -incremental -war &quot;${project_loc:com.sap.sailing.gwt.ui}&quot; -noserver -remoteUI &quot;${gwt_remote_ui_server_port}:${unique_id}&quot; -logLevel INFO -codeServerPort 9876 -startupUrl /gwt/Home.html -startupUrl /gwt/AdminConsole.html -startupUrl /gwt/PairingList.html -startupUrl /gwt/LeaderboardEditing.html -startupUrl /gwt/Leaderboard.html -startupUrl /gwt/Spectator.html -startupUrl /gwt/EmbeddedMapAndWindChart -startupUrl /gwt/RaceBoard.html -startupUrl /gwt/RegattaOverview.html -startupUrl /gwt/DataMining.html -startupUrl /gwt/Simulator.html -startupUrl /gwt/VideoPopup.html -startupUrl /gwt/AutoPlay.html -startupUrl /gwt/YoutubePopup.html com.sap.sailing.gwt.home.Home com.sap.sailing.gwt.ui.AdminConsole com.sap.sailing.gwt.ui.PairingList com.sap.sailing.gwt.ui.LeaderboardEditing com.sap.sailing.gwt.ui.Leaderboard com.sap.sailing.gwt.ui.Spectator com.sap.sailing.gwt.ui.EmbeddedMapAndWindChart com.sap.sailing.gwt.ui.RaceBoard com.sap.sailing.gwt.regattaoverview.RegattaOverview com.sap.sailing.gwt.ui.DataMining com.sap.sailing.gwt.ui.Simulator com.sap.sailing.gwt.ui.VideoPopup com.sap.sailing.gwt.ui.YoutubePopup com.sap.sailing.gwt.autoplay.AutoPlay"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-style PRETTY -incremental -war &quot;${project_loc:com.sap.sailing.gwt.ui}&quot; -noserver -remoteUI &quot;${gwt_remote_ui_server_port}:${unique_id}&quot; -logLevel INFO -codeServerPort 9876 -startupUrl /gwt/Home.html -startupUrl /gwt/AdminConsole.html -startupUrl /gwt/PairingList.html -startupUrl /gwt/LeaderboardEditing.html -startupUrl /gwt/Leaderboard.html -startupUrl /gwt/Spectator.html -startupUrl /gwt/EmbeddedMapAndWindChart -startupUrl /gwt/RaceBoard.html -startupUrl /gwt/RegattaOverview.html -startupUrl /gwt/DataMining.html -startupUrl /gwt/Simulator.html -startupUrl /gwt/VideoPopup.html -startupUrl /gwt/AutoPlay.html -startupUrl /gwt/YoutubePopup.html com.sap.sailing.gwt.home.Home com.sap.sailing.gwt.ui.AdminConsole com.sap.sailing.gwt.ui.PairingList com.sap.sailing.gwt.ui.LeaderboardEditing com.sap.sailing.gwt.ui.Leaderboard com.sap.sailing.gwt.ui.Spectator com.sap.sailing.gwt.ui.EmbeddedMapAndWindChart com.sap.sailing.gwt.ui.RaceBoard com.sap.sailing.gwt.regattaoverview.RegattaOverview com.sap.sailing.gwt.ui.DataMining com.sap.sailing.gwt.ui.Simulator com.sap.sailing.gwt.ui.VideoPopup com.sap.sailing.gwt.ui.YoutubePopup com.sap.sailing.gwt.autoplay.AutoPlay"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.sap.sailing.gwt.ui"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-XX:+UseG1GC -XX:-UseStringDeduplication -Dgwt.watchFileChanges=false -Xmx2048m -Dgwt-usearchives=false -Dgwt.persistentunitcache=false -Xmx4096m"/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${project_loc:com.sap.sailing.gwt.ui}/.tmp/gwt-work"/>
@@ -45,6 +45,10 @@ public interface LandscapeManagementWriteServiceAsync {
*/
void generateSshKeyPair(String regionId, String keyName, String privateKeyEncryptionPassphrase, AsyncCallback<SSHKeyPairDTO> callback);
/**
* Verifies a passphrase for an SSH private key. Returns {@code true} if the passphrase can decipher the private key
* and {@code false} if this does not work or the key is invalid, or the key is {@code null}.
*/
void verifyPassphrase(String regionId, SSHKeyPairDTO key, String privateKeyEncryptionPassphrase, AsyncCallback<Boolean> callback);
/**
@@ -143,7 +143,7 @@ public class SshKeyManagementPanel extends VerticalPanel {
}));
sshKeyTable.addColumn(sshKeyPairActionColumn);
add(sshKeyTable);
passphraseText =new Label(stringMessages.sshPrivateKeyPassphraseForSelectedKeyPair());
passphraseText = new Label(stringMessages.sshPrivateKeyPassphraseForSelectedKeyPair());
add(passphraseText);
add(sshPrivateKeyPassphrase);
add(passphraseStatus);
@@ -303,7 +303,7 @@ public class LandscapeManagementWriteServiceImpl extends ResultCachingProxiedRem
return getLandscapeService().getLandscape();
}
// verifies keyphrase to key. Returns true if both match and returns false if they do not match, key is invalid, or key is null
@Override
public Boolean verifyPassphrase(String regionId, SSHKeyPairDTO key, String privateKeyEncryptionPassphrase) {
final JSch jsch = new JSch();
final boolean res;
@@ -61,5 +61,5 @@ public interface AwsInstance<ShardingKey> extends Host {
return (AwsRegion) Host.super.getRegion();
}
public boolean verifySshKey( Optional<String> optionalKeyName, byte[] privateKeyEncryptionPassphrase);
boolean verifySshKey(Optional<String> optionalKeyName, byte[] privateKeyEncryptionPassphrase);
}
@@ -288,17 +288,12 @@ public class AwsInstanceImpl<ShardingKey> implements AwsInstance<ShardingKey> {
@Override
public boolean verifySshKey( Optional<String> optionalKeyName, byte[] privateKeyEncryptionPassphrase) {
final String keyName = optionalKeyName.orElseGet(()->getInstance().keyName()); // the SSH key pair name that can be used to log on
final SSHKeyPair keyPair = landscape.getSSHKeyPair(getRegion(), keyName);
if (keyPair == null) {
return false;
//throw new IllegalStateException("Couldn't find key pair "+keyName+" in landscape.");
}
final JSch jsch = new JSch();
return keyPair.checkPassphrase(jsch, privateKeyEncryptionPassphrase);
}
}
@@ -79,23 +79,21 @@ public class SSHKeyPair extends NamedImpl implements Named, WithQualifiedObjectI
/**
* Returns a{@link boolean} whether the passphrase was valid and correct.
*
* @param passphrase
* entered by the user in the textfield and should be correct for decrypting the selected ssh-private key,
* returns false if this passphrase could not be used for decrypting the key or if the format is not valid/supported
* entered by the user in the textfield and should be correct for decrypting the selected ssh-private
* key, returns false if this passphrase could not be used for decrypting the key or if the format is not
* valid/supported
*/
public boolean checkPassphrase(JSch jsch, byte[] passphrase) {
KeyPair result;
boolean res = true;
boolean res;
try {
// return false if Key is not loaded properly or has the wrong format
result = KeyPair.load(jsch, getEncryptedPrivateKey(), getPublicKey());
// return false if key is not loaded properly or has the wrong format
final KeyPair result = KeyPair.load(jsch, getEncryptedPrivateKey(), getPublicKey());
// return false if result is not decrypted
res = result.decrypt(passphrase);
} catch (JSchException e) {
return false;
}
//return false if result is not decrypted
if (!result.decrypt(passphrase)) {
return false;
res = false;
}
return res;
}