This commit is contained in:
crschnick
2025-12-10 14:17:13 +00:00
parent 7236b6b189
commit ed23d48e68
6 changed files with 52 additions and 13 deletions
@@ -415,6 +415,8 @@ public abstract class DataStorage {
}
entry.setStoreInternal(store, false);
entry.initializeEntry();
saveAsync();
}
public void updateCategory(DataStoreCategory category, DataStoreCategory newCategory) {
@@ -70,6 +70,7 @@ public enum DocumentationLink {
TUNNELS_DYNAMIC("guide/ssh-tunnels#dynamic-tunnels"),
HYPERV("guide/hyperv"),
SSH_MACS("troubleshoot/ssh#no-matching-mac-found"),
SSH_FEATURE_NOT_SUPPORTED("troubleshoot/ssh#requested-feature-not-supported"),
SSH_JUMP_SERVERS("guide/ssh#gateways-and-jump-servers"),
SSH_CUSTOM("guide/ssh-config#custom-ssh-connections"),
SSH_CUSTOM_ORDER("guide/ssh-config#jump-hosts"),
@@ -4,6 +4,7 @@ import atlantafx.base.theme.Styles;
import io.xpipe.app.browser.BrowserFullSessionModel;
import io.xpipe.app.browser.file.BrowserFileOpener;
import io.xpipe.app.comp.Comp;
import io.xpipe.app.comp.CompStructure;
import io.xpipe.app.comp.base.*;
import io.xpipe.app.core.AppFontSizes;
import io.xpipe.app.core.AppI18n;
@@ -27,6 +28,7 @@ import io.xpipe.core.OsType;
import javafx.beans.binding.Bindings;
import javafx.beans.property.*;
import javafx.geometry.Insets;
import javafx.scene.control.Button;
import lombok.Data;
import java.util.List;
@@ -220,7 +222,6 @@ public class IdentityApplyDialog {
}).padding(new Insets(4, 8, 4, 8));
var options = new OptionsBuilder()
.addTitle(new ReadOnlyStringWrapper("authorized_hosts"))
.nameAndDescription("identityApplyAuthorizedHost")
.addComp(success())
.hide(showAddAuthorizedHost)
@@ -270,7 +271,6 @@ public class IdentityApplyDialog {
}).padding(new Insets(4, 8, 4, 8));
var options = new OptionsBuilder()
.addTitle(new ReadOnlyStringWrapper("sshd_config"))
.nameAndDescription("identityApplyConfigPasswordEnabled")
.addComp(warning())
.hide(showPasswordEnabledWarning.not())
@@ -296,20 +296,26 @@ public class IdentityApplyDialog {
return options;
}
public static void show(IdentityStore identity) {
public static void show(DataStoreEntryRef<IdentityStore> identity) {
var busy = new SimpleBooleanProperty();
var system = new SimpleObjectProperty<DataStoreEntryRef<ShellStore>>();
var systemState = new SimpleObjectProperty<SystemState>();
var showSetIdentityButton = new SimpleBooleanProperty();
var showIdentityAlreadySet = new SimpleBooleanProperty();
system.addListener((observable, oldValue, newValue) -> {
if (newValue == null) {
systemState.setValue(null);
showSetIdentityButton.set(false);
showIdentityAlreadySet.set(false);
return;
}
ThreadHelper.runFailableAsync(() -> {
BooleanScope.executeExclusive(busy, () -> {
var sc = newValue.getStore().getOrStartSession();
systemState.setValue(SystemState.of(sc, identity));
systemState.setValue(SystemState.of(sc, identity.getStore()));
showSetIdentityButton.set(newValue.getStore() instanceof IdentitySwitchStore iss && !iss.getIdentity().unwrap().equals(identity.getStore()));
showIdentityAlreadySet.set(newValue.getStore() instanceof IdentitySwitchStore iss && iss.getIdentity().unwrap().equals(identity.getStore()));
});
});
});
@@ -322,22 +328,36 @@ public class IdentityApplyDialog {
return null;
}
return DataStorage.get().getStoreEntryDisplayName(entry) + " -> " + IdentitySummary.createSummary(identity);
return DataStorage.get().getStoreEntryDisplayName(entry) + " -> " + IdentitySummary.createSummary(identity.getStore());
}
};
var systemChoiceBusy = new LoadingOverlayComp(systemChoice, busy, false);
var applyButton = new ButtonComp(AppI18n.observable("identityApplySetStoreIdentityButton"),
() -> {
DataStorage.get().updateEntryStore(system.get().get(),
((IdentitySwitchStore) system.get().getStore()).withIdentity(new IdentityValue.Ref(identity)));
showSetIdentityButton.set(false);
showIdentityAlreadySet.set(true);
});
applyButton.padding(new Insets(4, 8, 4, 8));
var options = new OptionsBuilder()
.nameAndDescription("identityApplyTargetHost")
.addComp(systemChoiceBusy, system)
.addComp(createAuthorizedKeysOptions(system, systemState, identity, busy))
.addComp(createConfigOptions(system, systemState, identity, busy));
.addComp(createAuthorizedKeysOptions(system, systemState, identity.getStore(), busy))
.addComp(createConfigOptions(system, systemState, identity.getStore(), busy))
.nameAndDescription("identityApplySetStoreIdentity")
.addComp(success())
.hide(showIdentityAlreadySet.not())
.nameAndDescription("identityApplySetStoreIdentity")
.addComp(fail(applyButton))
.hide(showSetIdentityButton.not());
var modal = ModalOverlay.of("identityApplyTitle", options.buildComp().prefWidth(600).prefHeight(500));
modal.persist();
modal.addButton(ModalButton.cancel());
modal.addButton(ModalButton.ok(() -> {
}).augment(button -> {
modal.addButton(ModalButton.ok().augment(button -> {
button.disableProperty().bind(PlatformThread.sync(busy));
}));
modal.show();
@@ -77,7 +77,7 @@ public class IdentityApplyHubLeafProvider implements HubLeafProvider<IdentitySto
return;
}
IdentityApplyDialog.show(ref.getStore());
IdentityApplyDialog.show(ref);
}
}
}
@@ -0,0 +1,13 @@
package io.xpipe.ext.base.identity;
import io.xpipe.app.ext.HostAddress;
import io.xpipe.ext.base.host.HostAddressStore;
import java.util.Optional;
public interface IdentitySwitchStore extends HostAddressStore {
IdentityValue getIdentity();
IdentitySwitchStore withIdentity(IdentityValue identity);
}
+5 -2
View File
@@ -1715,11 +1715,11 @@ sshKeygenPassphraseDescription=The optional passphrase for this key
ed25519SkResident=Make resident key
ed25519SkResidentDescription=Store private key on the hardware security key
ed25519SkResidentKeyName=Resident key label
ed25519SkResidentKeyNameDescription=Give the resident key a label. Needed when storing multiple keys on the hardware security key
ed25519SkResidentKeyNameDescription=Give the resident key a label. Needed when storing multiple keys on the security key
ed25519SkPinRequired=Require PIN
ed25519SkPinRequiredDescription=Require PIN entry on use
ed25519SkUserPresenceRequired=Require user presence
ed25519SkUserPresenceRequiredDescription=Require touch or similar on use
ed25519SkUserPresenceRequiredDescription=Require touch or similar on use. Some security keys require this to be enabled
copyPublicKey=Copy public key
generatePublicKey=Generate public key
publicKeyGenerateNotice=Can be generated from public key
@@ -1753,4 +1753,7 @@ identityApplyEditAuthorizedKeys=Edit authorized keys
identityApplyEditAuthorizedKeysDescription=Open the authorized_keys file in the file browser to edit or remove other keys
identityApplyEditConfigButton=Open sshd_config
identityApplyEditAuthorizedKeysButton=Open authorized_keys
identityApplySetStoreIdentity=Connection identity set
identityApplySetStoreIdentityDescription=The identity has been configured to be used by the connection
identityApplySetStoreIdentityButton=Apply identity
generateKey=Generate key