summaryrefslogtreecommitdiffstats
path: root/src/main/java/de/bwlehrpool/bwlp_guac/AvailableClient.java
diff options
context:
space:
mode:
authorSimon Rettberg2020-05-05 18:40:42 +0200
committerSimon Rettberg2020-05-05 18:40:42 +0200
commit7d88e471709c13dc4df388a73b3824901c9fef09 (patch)
tree1c9892ac6186dc1c8792a6715fab5261fb189afb /src/main/java/de/bwlehrpool/bwlp_guac/AvailableClient.java
parentAdapt to new json format (diff)
downloadbwlp-guacamole-ext-7d88e471709c13dc4df388a73b3824901c9fef09.tar.gz
bwlp-guacamole-ext-7d88e471709c13dc4df388a73b3824901c9fef09.tar.xz
bwlp-guacamole-ext-7d88e471709c13dc4df388a73b3824901c9fef09.zip
Prevent user from sticking to connection if it was reset.
Make a copy of the AvailableConnection for the ConnectionWrapper, so we don't update the password for the already active connection, if it changes, which defeats the purpose of this mechanism altogether.
Diffstat (limited to 'src/main/java/de/bwlehrpool/bwlp_guac/AvailableClient.java')
-rw-r--r--src/main/java/de/bwlehrpool/bwlp_guac/AvailableClient.java15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/main/java/de/bwlehrpool/bwlp_guac/AvailableClient.java b/src/main/java/de/bwlehrpool/bwlp_guac/AvailableClient.java
index 0318965..c886397 100644
--- a/src/main/java/de/bwlehrpool/bwlp_guac/AvailableClient.java
+++ b/src/main/java/de/bwlehrpool/bwlp_guac/AvailableClient.java
@@ -9,7 +9,7 @@ import org.slf4j.LoggerFactory;
import de.bwlehrpool.bwlp_guac.JsonClient.State;
-public class AvailableClient {
+public class AvailableClient implements Cloneable {
private static final Logger LOGGER = LoggerFactory.getLogger(AvailableClient.class);
@@ -37,6 +37,10 @@ public class AvailableClient {
this.clientip = source.clientip;
update(source);
}
+
+ private AvailableClient(String clientip) {
+ this.clientip = clientip;
+ }
/**
* Update this client's state, resetting "in use" if appropriate. Ie, the
@@ -154,5 +158,14 @@ public class AvailableClient {
return this.connectionOk = false;
}
}
+
+ @Override
+ public AvailableClient clone() {
+ AvailableClient c = new AvailableClient(this.clientip);
+ c.state = this.state;
+ c.inUseBy = this.inUseBy;
+ c.password = this.password;
+ return c;
+ }
}