diff options
author | Udo Walter | 2020-05-07 19:30:48 +0200 |
---|---|---|
committer | Udo Walter | 2020-05-07 19:30:48 +0200 |
commit | 90f06cbe0b2ff3b1a9d85d2f73fe5864e692341b (patch) | |
tree | 17139070c9ac144f9cd214a01e4af5e86a895dbe /src/main/java/de/bwlehrpool/bwlp_guac/BwlpUserContext.java | |
parent | Prevent user from sticking to connection if it was reset. (diff) | |
download | bwlp-guacamole-ext-90f06cbe0b2ff3b1a9d85d2f73fe5864e692341b.tar.gz bwlp-guacamole-ext-90f06cbe0b2ff3b1a9d85d2f73fe5864e692341b.tar.xz bwlp-guacamole-ext-90f06cbe0b2ff3b1a9d85d2f73fe5864e692341b.zip |
Add location selection
Diffstat (limited to 'src/main/java/de/bwlehrpool/bwlp_guac/BwlpUserContext.java')
-rw-r--r-- | src/main/java/de/bwlehrpool/bwlp_guac/BwlpUserContext.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/main/java/de/bwlehrpool/bwlp_guac/BwlpUserContext.java b/src/main/java/de/bwlehrpool/bwlp_guac/BwlpUserContext.java index 9a6e5d7..05fa78f 100644 --- a/src/main/java/de/bwlehrpool/bwlp_guac/BwlpUserContext.java +++ b/src/main/java/de/bwlehrpool/bwlp_guac/BwlpUserContext.java @@ -8,6 +8,8 @@ import org.apache.guacamole.net.auth.Connection; import org.apache.guacamole.net.auth.Directory; import org.apache.guacamole.net.auth.User; import org.apache.guacamole.net.auth.UserContext; +import org.apache.guacamole.net.auth.credentials.GuacamoleCredentialsException; +import org.apache.guacamole.net.auth.credentials.GuacamoleInsufficientCredentialsException; import org.apache.guacamole.net.auth.permission.ObjectPermissionSet; import org.apache.guacamole.net.auth.simple.SimpleConnection; import org.apache.guacamole.net.auth.simple.SimpleDirectory; @@ -29,6 +31,7 @@ public class BwlpUserContext extends AbstractUserContext { private final AuthenticatedUser authUser; private final UserContext originalContext; + private final Integer locationid; /** * The Directory with access to all connections within the root group associated @@ -36,15 +39,17 @@ public class BwlpUserContext extends AbstractUserContext { */ private Directory<Connection> connectionDirectory; - public BwlpUserContext(AuthenticatedUser authenticatedUser, UserContext context) { + public BwlpUserContext(AuthenticatedUser authenticatedUser, UserContext context, int locationid) + throws GuacamoleCredentialsException { authUser = authenticatedUser; originalContext = context; + this.locationid = locationid; // OK addConn(); } - private void addConn() { - WrappedConnection connection = ConnectionManager.getForUser(authUser.getCredentials().getUsername()); + private void addConn() throws GuacamoleCredentialsException { + WrappedConnection connection = ConnectionManager.getForUser(authUser.getCredentials().getUsername(), locationid); if (connection != null) { connectionDirectory = new SimpleDirectory<Connection>(connection); } else { |