Skip to content
This repository has been archived by the owner on Jul 17, 2023. It is now read-only.

Commit

Permalink
GUAC-1132: Socket service is now really tunnel service.
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-jumper committed Mar 17, 2015
1 parent b33e515 commit 5ce0a3a
Show file tree
Hide file tree
Showing 19 changed files with 70 additions and 70 deletions.
Expand Up @@ -40,7 +40,7 @@
import org.glyptodon.guacamole.auth.jdbc.user.UserMapper; import org.glyptodon.guacamole.auth.jdbc.user.UserMapper;
import org.glyptodon.guacamole.auth.jdbc.connectiongroup.ConnectionGroupService; import org.glyptodon.guacamole.auth.jdbc.connectiongroup.ConnectionGroupService;
import org.glyptodon.guacamole.auth.jdbc.connection.ConnectionService; import org.glyptodon.guacamole.auth.jdbc.connection.ConnectionService;
import org.glyptodon.guacamole.auth.jdbc.socket.GuacamoleSocketService; import org.glyptodon.guacamole.auth.jdbc.tunnel.GuacamoleTunnelService;
import org.glyptodon.guacamole.auth.jdbc.security.PasswordEncryptionService; import org.glyptodon.guacamole.auth.jdbc.security.PasswordEncryptionService;
import org.glyptodon.guacamole.auth.jdbc.security.SHA256PasswordEncryptionService; import org.glyptodon.guacamole.auth.jdbc.security.SHA256PasswordEncryptionService;
import org.glyptodon.guacamole.auth.jdbc.security.SaltService; import org.glyptodon.guacamole.auth.jdbc.security.SaltService;
Expand Down Expand Up @@ -80,7 +80,7 @@ public class JDBCAuthenticationProviderModule extends MyBatisModule {
* The service class to use to provide GuacamoleSockets for each * The service class to use to provide GuacamoleSockets for each
* connection. * connection.
*/ */
private final Class<? extends GuacamoleSocketService> socketServiceClass; private final Class<? extends GuacamoleTunnelService> tunnelServiceClass;


/** /**
* Creates a new JDBC authentication provider module that configures the * Creates a new JDBC authentication provider module that configures the
Expand All @@ -90,13 +90,13 @@ public class JDBCAuthenticationProviderModule extends MyBatisModule {
* @param environment * @param environment
* The environment to use to configure injected classes. * The environment to use to configure injected classes.
* *
* @param socketServiceClass * @param tunnelServiceClass
* The socket service to use to provide sockets for connections. * The socket service to use to provide sockets for connections.
*/ */
public JDBCAuthenticationProviderModule(Environment environment, public JDBCAuthenticationProviderModule(Environment environment,
Class<? extends GuacamoleSocketService> socketServiceClass) { Class<? extends GuacamoleTunnelService> tunnelServiceClass) {
this.environment = environment; this.environment = environment;
this.socketServiceClass = socketServiceClass; this.tunnelServiceClass = tunnelServiceClass;
} }


@Override @Override
Expand Down Expand Up @@ -147,7 +147,7 @@ protected void initialize() {
bind(UserService.class); bind(UserService.class);


// Bind provided socket service // Bind provided socket service
bind(GuacamoleSocketService.class).to(socketServiceClass); bind(GuacamoleTunnelService.class).to(tunnelServiceClass);


} }


Expand Down
Expand Up @@ -33,7 +33,7 @@
import java.util.Set; import java.util.Set;
import org.glyptodon.guacamole.auth.jdbc.user.AuthenticatedUser; import org.glyptodon.guacamole.auth.jdbc.user.AuthenticatedUser;
import org.glyptodon.guacamole.auth.jdbc.base.DirectoryObjectMapper; import org.glyptodon.guacamole.auth.jdbc.base.DirectoryObjectMapper;
import org.glyptodon.guacamole.auth.jdbc.socket.GuacamoleSocketService; import org.glyptodon.guacamole.auth.jdbc.tunnel.GuacamoleTunnelService;
import org.glyptodon.guacamole.GuacamoleClientException; import org.glyptodon.guacamole.GuacamoleClientException;
import org.glyptodon.guacamole.GuacamoleException; import org.glyptodon.guacamole.GuacamoleException;
import org.glyptodon.guacamole.GuacamoleSecurityException; import org.glyptodon.guacamole.GuacamoleSecurityException;
Expand Down Expand Up @@ -91,7 +91,7 @@ public class ConnectionService extends GroupedDirectoryObjectService<ModeledConn
* Service for creating and tracking sockets. * Service for creating and tracking sockets.
*/ */
@Inject @Inject
private GuacamoleSocketService socketService; private GuacamoleTunnelService tunnelService;


@Override @Override
protected DirectoryObjectMapper<ConnectionModel> getObjectMapper() { protected DirectoryObjectMapper<ConnectionModel> getObjectMapper() {
Expand Down Expand Up @@ -371,7 +371,7 @@ public List<ConnectionRecord> retrieveHistory(AuthenticatedUser user,
List<ConnectionRecordModel> models = connectionRecordMapper.select(identifier); List<ConnectionRecordModel> models = connectionRecordMapper.select(identifier);


// Get currently-active connections // Get currently-active connections
List<ConnectionRecord> records = new ArrayList<ConnectionRecord>(socketService.getActiveConnections(connection)); List<ConnectionRecord> records = new ArrayList<ConnectionRecord>(tunnelService.getActiveConnections(connection));
Collections.reverse(records); Collections.reverse(records);


// Add past connections from model objects // Add past connections from model objects
Expand Down Expand Up @@ -415,7 +415,7 @@ public GuacamoleTunnel connect(AuthenticatedUser user,


// Connect only if READ permission is granted // Connect only if READ permission is granted
if (hasObjectPermission(user, connection.getIdentifier(), ObjectPermission.Type.READ)) if (hasObjectPermission(user, connection.getIdentifier(), ObjectPermission.Type.READ))
return socketService.getGuacamoleTunnel(user, connection, info); return tunnelService.getGuacamoleTunnel(user, connection, info);


// The user does not have permission to connect // The user does not have permission to connect
throw new GuacamoleSecurityException("Permission denied."); throw new GuacamoleSecurityException("Permission denied.");
Expand Down
Expand Up @@ -25,7 +25,7 @@
import com.google.inject.Inject; import com.google.inject.Inject;
import com.google.inject.Provider; import com.google.inject.Provider;
import java.util.List; import java.util.List;
import org.glyptodon.guacamole.auth.jdbc.socket.GuacamoleSocketService; import org.glyptodon.guacamole.auth.jdbc.tunnel.GuacamoleTunnelService;
import org.glyptodon.guacamole.GuacamoleException; import org.glyptodon.guacamole.GuacamoleException;
import org.glyptodon.guacamole.auth.jdbc.base.GroupedDirectoryObject; import org.glyptodon.guacamole.auth.jdbc.base.GroupedDirectoryObject;
import org.glyptodon.guacamole.net.GuacamoleTunnel; import org.glyptodon.guacamole.net.GuacamoleTunnel;
Expand Down Expand Up @@ -54,7 +54,7 @@ public class ModeledConnection extends GroupedDirectoryObject<ConnectionModel>
* Service for creating and tracking sockets. * Service for creating and tracking sockets.
*/ */
@Inject @Inject
private GuacamoleSocketService socketService; private GuacamoleTunnelService tunnelService;


/** /**
* Provider for lazy-loaded, permission-controlled configurations. * Provider for lazy-loaded, permission-controlled configurations.
Expand Down Expand Up @@ -120,7 +120,7 @@ public GuacamoleTunnel connect(GuacamoleClientInformation info) throws Guacamole


@Override @Override
public int getActiveConnections() { public int getActiveConnections() {
return socketService.getActiveConnections(this).size(); return tunnelService.getActiveConnections(this).size();
} }


} }
Expand Up @@ -27,7 +27,7 @@
import java.util.Set; import java.util.Set;
import org.glyptodon.guacamole.auth.jdbc.user.AuthenticatedUser; import org.glyptodon.guacamole.auth.jdbc.user.AuthenticatedUser;
import org.glyptodon.guacamole.auth.jdbc.base.DirectoryObjectMapper; import org.glyptodon.guacamole.auth.jdbc.base.DirectoryObjectMapper;
import org.glyptodon.guacamole.auth.jdbc.socket.GuacamoleSocketService; import org.glyptodon.guacamole.auth.jdbc.tunnel.GuacamoleTunnelService;
import org.glyptodon.guacamole.GuacamoleClientException; import org.glyptodon.guacamole.GuacamoleClientException;
import org.glyptodon.guacamole.GuacamoleException; import org.glyptodon.guacamole.GuacamoleException;
import org.glyptodon.guacamole.GuacamoleSecurityException; import org.glyptodon.guacamole.GuacamoleSecurityException;
Expand Down Expand Up @@ -74,7 +74,7 @@ public class ConnectionGroupService extends GroupedDirectoryObjectService<Modele
* Service for creating and tracking sockets. * Service for creating and tracking sockets.
*/ */
@Inject @Inject
private GuacamoleSocketService socketService; private GuacamoleTunnelService tunnelService;


@Override @Override
protected DirectoryObjectMapper<ConnectionGroupModel> getObjectMapper() { protected DirectoryObjectMapper<ConnectionGroupModel> getObjectMapper() {
Expand Down Expand Up @@ -247,7 +247,7 @@ public GuacamoleTunnel connect(AuthenticatedUser user,


// Connect only if READ permission is granted // Connect only if READ permission is granted
if (hasObjectPermission(user, connectionGroup.getIdentifier(), ObjectPermission.Type.READ)) if (hasObjectPermission(user, connectionGroup.getIdentifier(), ObjectPermission.Type.READ))
return socketService.getGuacamoleTunnel(user, connectionGroup, info); return tunnelService.getGuacamoleTunnel(user, connectionGroup, info);


// The user does not have permission to connect // The user does not have permission to connect
throw new GuacamoleSecurityException("Permission denied."); throw new GuacamoleSecurityException("Permission denied.");
Expand Down
Expand Up @@ -25,7 +25,7 @@
import com.google.inject.Inject; import com.google.inject.Inject;
import java.util.Set; import java.util.Set;
import org.glyptodon.guacamole.auth.jdbc.connection.ConnectionService; import org.glyptodon.guacamole.auth.jdbc.connection.ConnectionService;
import org.glyptodon.guacamole.auth.jdbc.socket.GuacamoleSocketService; import org.glyptodon.guacamole.auth.jdbc.tunnel.GuacamoleTunnelService;
import org.glyptodon.guacamole.GuacamoleException; import org.glyptodon.guacamole.GuacamoleException;
import org.glyptodon.guacamole.auth.jdbc.base.GroupedDirectoryObject; import org.glyptodon.guacamole.auth.jdbc.base.GroupedDirectoryObject;
import org.glyptodon.guacamole.net.GuacamoleTunnel; import org.glyptodon.guacamole.net.GuacamoleTunnel;
Expand Down Expand Up @@ -57,7 +57,7 @@ public class ModeledConnectionGroup extends GroupedDirectoryObject<ConnectionGro
* Service for creating and tracking sockets. * Service for creating and tracking sockets.
*/ */
@Inject @Inject
private GuacamoleSocketService socketService; private GuacamoleTunnelService tunnelService;


/** /**
* Creates a new, empty ModeledConnectionGroup. * Creates a new, empty ModeledConnectionGroup.
Expand All @@ -83,7 +83,7 @@ public GuacamoleTunnel connect(GuacamoleClientInformation info)


@Override @Override
public int getActiveConnections() { public int getActiveConnections() {
return socketService.getActiveConnections(this).size(); return tunnelService.getActiveConnections(this).size();
} }


@Override @Override
Expand Down
Expand Up @@ -20,7 +20,7 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */


package org.glyptodon.guacamole.auth.jdbc.socket; package org.glyptodon.guacamole.auth.jdbc.tunnel;


import com.google.inject.Inject; import com.google.inject.Inject;
import com.google.inject.Provider; import com.google.inject.Provider;
Expand Down Expand Up @@ -60,13 +60,13 @@




/** /**
* Base implementation of the GuacamoleSocketService, handling retrieval of * Base implementation of the GuacamoleTunnelService, handling retrieval of
* connection parameters, load balancing, and connection usage counts. The * connection parameters, load balancing, and connection usage counts. The
* implementation of concurrency rules is up to policy-specific subclasses. * implementation of concurrency rules is up to policy-specific subclasses.
* *
* @author Michael Jumper * @author Michael Jumper
*/ */
public abstract class AbstractGuacamoleSocketService implements GuacamoleSocketService { public abstract class AbstractGuacamoleTunnelService implements GuacamoleTunnelService {


/** /**
* The environment of the Guacamole server. * The environment of the Guacamole server.
Expand Down
Expand Up @@ -20,7 +20,7 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */


package org.glyptodon.guacamole.auth.jdbc.socket; package org.glyptodon.guacamole.auth.jdbc.tunnel;


import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
Expand Down
Expand Up @@ -20,7 +20,7 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */


package org.glyptodon.guacamole.auth.jdbc.socket; package org.glyptodon.guacamole.auth.jdbc.tunnel;


import java.util.Date; import java.util.Date;
import org.glyptodon.guacamole.auth.jdbc.connection.ModeledConnection; import org.glyptodon.guacamole.auth.jdbc.connection.ModeledConnection;
Expand Down
Expand Up @@ -20,7 +20,7 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */


package org.glyptodon.guacamole.auth.jdbc.socket; package org.glyptodon.guacamole.auth.jdbc.tunnel;


import com.google.inject.Singleton; import com.google.inject.Singleton;
import java.util.Collections; import java.util.Collections;
Expand All @@ -35,7 +35,7 @@




/** /**
* GuacamoleSocketService implementation which allows only one user per * GuacamoleTunnelService implementation which allows only one user per
* connection at any time, but does not disallow concurrent use of connection * connection at any time, but does not disallow concurrent use of connection
* groups. If a user attempts to use a connection group multiple times, they * groups. If a user attempts to use a connection group multiple times, they
* will receive different underlying connections each time until the group is * will receive different underlying connections each time until the group is
Expand All @@ -44,8 +44,8 @@
* @author Michael Jumper * @author Michael Jumper
*/ */
@Singleton @Singleton
public class BalancedGuacamoleSocketService public class BalancedGuacamoleTunnelService
extends AbstractGuacamoleSocketService { extends AbstractGuacamoleTunnelService {


/** /**
* The set of all active connection identifiers. * The set of all active connection identifiers.
Expand Down
Expand Up @@ -20,7 +20,7 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */


package org.glyptodon.guacamole.auth.jdbc.socket; package org.glyptodon.guacamole.auth.jdbc.tunnel;


import java.util.Collection; import java.util.Collection;
import org.glyptodon.guacamole.auth.jdbc.user.AuthenticatedUser; import org.glyptodon.guacamole.auth.jdbc.user.AuthenticatedUser;
Expand All @@ -40,7 +40,7 @@
* *
* @author Michael Jumper * @author Michael Jumper
*/ */
public interface GuacamoleSocketService { public interface GuacamoleTunnelService {


/** /**
* Returns a connection containing connection records representing all * Returns a connection containing connection records representing all
Expand Down
Expand Up @@ -20,7 +20,7 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */


package org.glyptodon.guacamole.auth.jdbc.socket; package org.glyptodon.guacamole.auth.jdbc.tunnel;


import org.glyptodon.guacamole.GuacamoleException; import org.glyptodon.guacamole.GuacamoleException;
import org.glyptodon.guacamole.net.InetGuacamoleSocket; import org.glyptodon.guacamole.net.InetGuacamoleSocket;
Expand Down
Expand Up @@ -20,7 +20,7 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */


package org.glyptodon.guacamole.auth.jdbc.socket; package org.glyptodon.guacamole.auth.jdbc.tunnel;


import com.google.inject.Singleton; import com.google.inject.Singleton;
import java.util.Arrays; import java.util.Arrays;
Expand All @@ -38,15 +38,15 @@




/** /**
* GuacamoleSocketService implementation which restricts concurrency only on a * GuacamoleTunnelService implementation which restricts concurrency only on a
* per-user basis. Each connection or group may be used concurrently any number * per-user basis. Each connection or group may be used concurrently any number
* of times, but each concurrent use must be associated with a different user. * of times, but each concurrent use must be associated with a different user.
* *
* @author Michael Jumper * @author Michael Jumper
*/ */
@Singleton @Singleton
public class MultiseatGuacamoleSocketService public class MultiseatGuacamoleTunnelService
extends AbstractGuacamoleSocketService { extends AbstractGuacamoleTunnelService {


/** /**
* The set of all active user/connection pairs. * The set of all active user/connection pairs.
Expand Down
Expand Up @@ -20,7 +20,7 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */


package org.glyptodon.guacamole.auth.jdbc.socket; package org.glyptodon.guacamole.auth.jdbc.tunnel;


/** /**
* A unique pairing of user and connection or connection group. * A unique pairing of user and connection or connection group.
Expand Down
Expand Up @@ -20,7 +20,7 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */


package org.glyptodon.guacamole.auth.jdbc.socket; package org.glyptodon.guacamole.auth.jdbc.tunnel;


import com.google.inject.Singleton; import com.google.inject.Singleton;
import java.util.Collections; import java.util.Collections;
Expand All @@ -36,16 +36,16 @@




/** /**
* GuacamoleSocketService implementation which allows exactly one use * GuacamoleTunnelService implementation which allows exactly one use
* of any connection at any time. Concurrent usage of connections is not * of any connection at any time. Concurrent usage of connections is not
* allowed, and concurrent usage of connection groups is allowed only between * allowed, and concurrent usage of connection groups is allowed only between
* different users. * different users.
* *
* @author Michael Jumper * @author Michael Jumper
*/ */
@Singleton @Singleton
public class SingleSeatGuacamoleSocketService public class SingleSeatGuacamoleTunnelService
extends AbstractGuacamoleSocketService { extends AbstractGuacamoleTunnelService {


/** /**
* The set of all active connection identifiers. * The set of all active connection identifiers.
Expand Down
Expand Up @@ -20,7 +20,7 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */


package org.glyptodon.guacamole.auth.jdbc.socket; package org.glyptodon.guacamole.auth.jdbc.tunnel;


import com.google.inject.Singleton; import com.google.inject.Singleton;
import java.util.List; import java.util.List;
Expand All @@ -31,14 +31,14 @@




/** /**
* GuacamoleSocketService implementation which imposes no restrictions * GuacamoleTunnelService implementation which imposes no restrictions
* whatsoever on the number of concurrent or duplicate connections. * whatsoever on the number of concurrent or duplicate connections.
* *
* @author Michael Jumper * @author Michael Jumper
*/ */
@Singleton @Singleton
public class UnrestrictedGuacamoleSocketService public class UnrestrictedGuacamoleTunnelService
extends AbstractGuacamoleSocketService { extends AbstractGuacamoleTunnelService {


@Override @Override
protected ModeledConnection acquire(AuthenticatedUser user, protected ModeledConnection acquire(AuthenticatedUser user,
Expand Down
Expand Up @@ -21,7 +21,7 @@
*/ */


/** /**
* Classes related to obtaining/configuring Guacamole sockets, and restricting * Classes related to obtaining/configuring Guacamole tunnels, and restricting
* access to those sockets. * access to those tunnels.
*/ */
package org.glyptodon.guacamole.auth.jdbc.socket; package org.glyptodon.guacamole.auth.jdbc.tunnel;
Expand Up @@ -32,7 +32,7 @@
import java.util.Collections; import java.util.Collections;
import org.glyptodon.guacamole.GuacamoleException; import org.glyptodon.guacamole.GuacamoleException;
import org.glyptodon.guacamole.auth.jdbc.base.RestrictedObject; import org.glyptodon.guacamole.auth.jdbc.base.RestrictedObject;
import org.glyptodon.guacamole.auth.jdbc.socket.GuacamoleSocketService; import org.glyptodon.guacamole.auth.jdbc.tunnel.GuacamoleTunnelService;
import org.glyptodon.guacamole.net.auth.Connection; import org.glyptodon.guacamole.net.auth.Connection;
import org.glyptodon.guacamole.net.auth.ConnectionGroup; import org.glyptodon.guacamole.net.auth.ConnectionGroup;
import org.glyptodon.guacamole.net.auth.ConnectionRecord; import org.glyptodon.guacamole.net.auth.ConnectionRecord;
Expand All @@ -53,7 +53,7 @@ public class UserContext extends RestrictedObject
* Service for creating and tracking sockets. * Service for creating and tracking sockets.
*/ */
@Inject @Inject
private GuacamoleSocketService socketService; private GuacamoleTunnelService tunnelService;


/** /**
* User directory restricted by the permissions of the user associated * User directory restricted by the permissions of the user associated
Expand Down Expand Up @@ -127,7 +127,7 @@ public ConnectionGroup getRootConnectionGroup() throws GuacamoleException {
@Override @Override
public Collection<ConnectionRecord> getActiveConnections() public Collection<ConnectionRecord> getActiveConnections()
throws GuacamoleException { throws GuacamoleException {
return socketService.getActiveConnections(getCurrentUser()); return tunnelService.getActiveConnections(getCurrentUser());
} }


@Override @Override
Expand Down

0 comments on commit 5ce0a3a

Please sign in to comment.