diff options
-rw-r--r-- | src/main/java/com/gitblit/transport/ssh/SshKey.java | 9 | ||||
-rw-r--r-- | src/main/java/com/gitblit/wicket/panels/SshKeysPanel.java | 24 |
2 files changed, 32 insertions, 1 deletions
diff --git a/src/main/java/com/gitblit/transport/ssh/SshKey.java b/src/main/java/com/gitblit/transport/ssh/SshKey.java index 9fd1005a..cfd7310e 100644 --- a/src/main/java/com/gitblit/transport/ssh/SshKey.java +++ b/src/main/java/com/gitblit/transport/ssh/SshKey.java @@ -81,6 +81,15 @@ public class SshKey implements Serializable { return publicKey; } + public void detachPublicKey() + { + if (rawData == null) { + // Make sure the raw data is available + getRawData(); + } + publicKey = null; + } + public String getAlgorithm() { return getPublicKey().getAlgorithm(); } diff --git a/src/main/java/com/gitblit/wicket/panels/SshKeysPanel.java b/src/main/java/com/gitblit/wicket/panels/SshKeysPanel.java index e653a64f..d6c2ca28 100644 --- a/src/main/java/com/gitblit/wicket/panels/SshKeysPanel.java +++ b/src/main/java/com/gitblit/wicket/panels/SshKeysPanel.java @@ -67,7 +67,29 @@ public class SshKeysPanel extends BasePanel { final IModel<String> keyFeedback = Model.of("");
final List<SshKey> keys = new ArrayList<SshKey>(app().keys().getKeys(user.username));
- final ListDataProvider<SshKey> dp = new ListDataProvider<SshKey>(keys);
+ // Create list data provider that gets rid of the (not serializable EdDSA) PublicKey.
+ final ListDataProvider<SshKey> dp = new ListDataProvider<SshKey>(keys) {
+ @Override
+ public IModel<SshKey> model(final SshKey key) {
+ return new IModel<SshKey>() {
+ @Override
+ public SshKey getObject() {
+ return key;
+ }
+
+ @Override
+ public void setObject(SshKey object) {
+ // Cannot get set
+ }
+
+ @Override
+ public void detach() {
+ key.detachPublicKey();
+ }
+ };
+ }
+
+ };
final DataView<SshKey> keysView = new DataView<SshKey>("keys", dp) {
private static final long serialVersionUID = 1L;
|