GUAC-1132: Socket service is now really tunnel service.

This commit is contained in:
Michael Jumper
2015-03-17 13:31:26 -07:00
parent b33e515895
commit 5ce0a3a5a4
19 changed files with 70 additions and 70 deletions

View File

@@ -40,7 +40,7 @@ import org.glyptodon.guacamole.auth.jdbc.permission.SystemPermissionMapper;
import org.glyptodon.guacamole.auth.jdbc.user.UserMapper;
import org.glyptodon.guacamole.auth.jdbc.connectiongroup.ConnectionGroupService;
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.SHA256PasswordEncryptionService;
import org.glyptodon.guacamole.auth.jdbc.security.SaltService;
@@ -80,7 +80,7 @@ public class JDBCAuthenticationProviderModule extends MyBatisModule {
* The service class to use to provide GuacamoleSockets for each
* connection.
*/
private final Class<? extends GuacamoleSocketService> socketServiceClass;
private final Class<? extends GuacamoleTunnelService> tunnelServiceClass;
/**
* Creates a new JDBC authentication provider module that configures the
@@ -90,13 +90,13 @@ public class JDBCAuthenticationProviderModule extends MyBatisModule {
* @param environment
* The environment to use to configure injected classes.
*
* @param socketServiceClass
* @param tunnelServiceClass
* The socket service to use to provide sockets for connections.
*/
public JDBCAuthenticationProviderModule(Environment environment,
Class<? extends GuacamoleSocketService> socketServiceClass) {
Class<? extends GuacamoleTunnelService> tunnelServiceClass) {
this.environment = environment;
this.socketServiceClass = socketServiceClass;
this.tunnelServiceClass = tunnelServiceClass;
}
@Override
@@ -147,7 +147,7 @@ public class JDBCAuthenticationProviderModule extends MyBatisModule {
bind(UserService.class);
// Bind provided socket service
bind(GuacamoleSocketService.class).to(socketServiceClass);
bind(GuacamoleTunnelService.class).to(tunnelServiceClass);
}

View File

@@ -33,7 +33,7 @@ import java.util.Map;
import java.util.Set;
import org.glyptodon.guacamole.auth.jdbc.user.AuthenticatedUser;
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.GuacamoleException;
import org.glyptodon.guacamole.GuacamoleSecurityException;
@@ -91,7 +91,7 @@ public class ConnectionService extends GroupedDirectoryObjectService<ModeledConn
* Service for creating and tracking sockets.
*/
@Inject
private GuacamoleSocketService socketService;
private GuacamoleTunnelService tunnelService;
@Override
protected DirectoryObjectMapper<ConnectionModel> getObjectMapper() {
@@ -371,7 +371,7 @@ public class ConnectionService extends GroupedDirectoryObjectService<ModeledConn
List<ConnectionRecordModel> models = connectionRecordMapper.select(identifier);
// 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);
// Add past connections from model objects
@@ -415,7 +415,7 @@ public class ConnectionService extends GroupedDirectoryObjectService<ModeledConn
// Connect only if READ permission is granted
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
throw new GuacamoleSecurityException("Permission denied.");

View File

@@ -25,7 +25,7 @@ package org.glyptodon.guacamole.auth.jdbc.connection;
import com.google.inject.Inject;
import com.google.inject.Provider;
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.auth.jdbc.base.GroupedDirectoryObject;
import org.glyptodon.guacamole.net.GuacamoleTunnel;
@@ -54,7 +54,7 @@ public class ModeledConnection extends GroupedDirectoryObject<ConnectionModel>
* Service for creating and tracking sockets.
*/
@Inject
private GuacamoleSocketService socketService;
private GuacamoleTunnelService tunnelService;
/**
* Provider for lazy-loaded, permission-controlled configurations.
@@ -120,7 +120,7 @@ public class ModeledConnection extends GroupedDirectoryObject<ConnectionModel>
@Override
public int getActiveConnections() {
return socketService.getActiveConnections(this).size();
return tunnelService.getActiveConnections(this).size();
}
}

View File

@@ -27,7 +27,7 @@ import com.google.inject.Provider;
import java.util.Set;
import org.glyptodon.guacamole.auth.jdbc.user.AuthenticatedUser;
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.GuacamoleException;
import org.glyptodon.guacamole.GuacamoleSecurityException;
@@ -74,7 +74,7 @@ public class ConnectionGroupService extends GroupedDirectoryObjectService<Modele
* Service for creating and tracking sockets.
*/
@Inject
private GuacamoleSocketService socketService;
private GuacamoleTunnelService tunnelService;
@Override
protected DirectoryObjectMapper<ConnectionGroupModel> getObjectMapper() {
@@ -247,7 +247,7 @@ public class ConnectionGroupService extends GroupedDirectoryObjectService<Modele
// Connect only if READ permission is granted
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
throw new GuacamoleSecurityException("Permission denied.");

View File

@@ -25,7 +25,7 @@ package org.glyptodon.guacamole.auth.jdbc.connectiongroup;
import com.google.inject.Inject;
import java.util.Set;
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.auth.jdbc.base.GroupedDirectoryObject;
import org.glyptodon.guacamole.net.GuacamoleTunnel;
@@ -57,7 +57,7 @@ public class ModeledConnectionGroup extends GroupedDirectoryObject<ConnectionGro
* Service for creating and tracking sockets.
*/
@Inject
private GuacamoleSocketService socketService;
private GuacamoleTunnelService tunnelService;
/**
* Creates a new, empty ModeledConnectionGroup.
@@ -83,7 +83,7 @@ public class ModeledConnectionGroup extends GroupedDirectoryObject<ConnectionGro
@Override
public int getActiveConnections() {
return socketService.getActiveConnections(this).size();
return tunnelService.getActiveConnections(this).size();
}
@Override

View File

@@ -20,7 +20,7 @@
* 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.Provider;
@@ -60,13 +60,13 @@ import org.mybatis.guice.transactional.Transactional;
/**
* 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
* implementation of concurrency rules is up to policy-specific subclasses.
*
* @author Michael Jumper
*/
public abstract class AbstractGuacamoleSocketService implements GuacamoleSocketService {
public abstract class AbstractGuacamoleTunnelService implements GuacamoleTunnelService {
/**
* The environment of the Guacamole server.

View File

@@ -20,7 +20,7 @@
* THE SOFTWARE.
*/
package org.glyptodon.guacamole.auth.jdbc.socket;
package org.glyptodon.guacamole.auth.jdbc.tunnel;
import java.util.Collection;
import java.util.Collections;

View File

@@ -20,7 +20,7 @@
* THE SOFTWARE.
*/
package org.glyptodon.guacamole.auth.jdbc.socket;
package org.glyptodon.guacamole.auth.jdbc.tunnel;
import java.util.Date;
import org.glyptodon.guacamole.auth.jdbc.connection.ModeledConnection;

View File

@@ -20,7 +20,7 @@
* THE SOFTWARE.
*/
package org.glyptodon.guacamole.auth.jdbc.socket;
package org.glyptodon.guacamole.auth.jdbc.tunnel;
import com.google.inject.Singleton;
import java.util.Collections;
@@ -35,7 +35,7 @@ import org.glyptodon.guacamole.auth.jdbc.connectiongroup.ModeledConnectionGroup;
/**
* 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
* groups. If a user attempts to use a connection group multiple times, they
* will receive different underlying connections each time until the group is
@@ -44,8 +44,8 @@ import org.glyptodon.guacamole.auth.jdbc.connectiongroup.ModeledConnectionGroup;
* @author Michael Jumper
*/
@Singleton
public class BalancedGuacamoleSocketService
extends AbstractGuacamoleSocketService {
public class BalancedGuacamoleTunnelService
extends AbstractGuacamoleTunnelService {
/**
* The set of all active connection identifiers.

View File

@@ -20,7 +20,7 @@
* THE SOFTWARE.
*/
package org.glyptodon.guacamole.auth.jdbc.socket;
package org.glyptodon.guacamole.auth.jdbc.tunnel;
import java.util.Collection;
import org.glyptodon.guacamole.auth.jdbc.user.AuthenticatedUser;
@@ -40,7 +40,7 @@ import org.glyptodon.guacamole.protocol.GuacamoleClientInformation;
*
* @author Michael Jumper
*/
public interface GuacamoleSocketService {
public interface GuacamoleTunnelService {
/**
* Returns a connection containing connection records representing all

View File

@@ -20,7 +20,7 @@
* 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.net.InetGuacamoleSocket;

View File

@@ -20,7 +20,7 @@
* THE SOFTWARE.
*/
package org.glyptodon.guacamole.auth.jdbc.socket;
package org.glyptodon.guacamole.auth.jdbc.tunnel;
import com.google.inject.Singleton;
import java.util.Arrays;
@@ -38,15 +38,15 @@ import org.glyptodon.guacamole.auth.jdbc.connectiongroup.ModeledConnectionGroup;
/**
* 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
* of times, but each concurrent use must be associated with a different user.
*
* @author Michael Jumper
*/
@Singleton
public class MultiseatGuacamoleSocketService
extends AbstractGuacamoleSocketService {
public class MultiseatGuacamoleTunnelService
extends AbstractGuacamoleTunnelService {
/**
* The set of all active user/connection pairs.

View File

@@ -20,7 +20,7 @@
* 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.

View File

@@ -20,7 +20,7 @@
* THE SOFTWARE.
*/
package org.glyptodon.guacamole.auth.jdbc.socket;
package org.glyptodon.guacamole.auth.jdbc.tunnel;
import com.google.inject.Singleton;
import java.util.Collections;
@@ -36,7 +36,7 @@ import org.glyptodon.guacamole.auth.jdbc.connectiongroup.ModeledConnectionGroup;
/**
* 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
* allowed, and concurrent usage of connection groups is allowed only between
* different users.
@@ -44,8 +44,8 @@ import org.glyptodon.guacamole.auth.jdbc.connectiongroup.ModeledConnectionGroup;
* @author Michael Jumper
*/
@Singleton
public class SingleSeatGuacamoleSocketService
extends AbstractGuacamoleSocketService {
public class SingleSeatGuacamoleTunnelService
extends AbstractGuacamoleTunnelService {
/**
* The set of all active connection identifiers.

View File

@@ -20,7 +20,7 @@
* THE SOFTWARE.
*/
package org.glyptodon.guacamole.auth.jdbc.socket;
package org.glyptodon.guacamole.auth.jdbc.tunnel;
import com.google.inject.Singleton;
import java.util.List;
@@ -31,14 +31,14 @@ import org.glyptodon.guacamole.auth.jdbc.connectiongroup.ModeledConnectionGroup;
/**
* GuacamoleSocketService implementation which imposes no restrictions
* GuacamoleTunnelService implementation which imposes no restrictions
* whatsoever on the number of concurrent or duplicate connections.
*
* @author Michael Jumper
*/
@Singleton
public class UnrestrictedGuacamoleSocketService
extends AbstractGuacamoleSocketService {
public class UnrestrictedGuacamoleTunnelService
extends AbstractGuacamoleTunnelService {
@Override
protected ModeledConnection acquire(AuthenticatedUser user,

View File

@@ -21,7 +21,7 @@
*/
/**
* Classes related to obtaining/configuring Guacamole sockets, and restricting
* access to those sockets.
* Classes related to obtaining/configuring Guacamole tunnels, and restricting
* access to those tunnels.
*/
package org.glyptodon.guacamole.auth.jdbc.socket;
package org.glyptodon.guacamole.auth.jdbc.tunnel;

View File

@@ -32,7 +32,7 @@ import java.util.Collection;
import java.util.Collections;
import org.glyptodon.guacamole.GuacamoleException;
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.ConnectionGroup;
import org.glyptodon.guacamole.net.auth.ConnectionRecord;
@@ -53,7 +53,7 @@ public class UserContext extends RestrictedObject
* Service for creating and tracking sockets.
*/
@Inject
private GuacamoleSocketService socketService;
private GuacamoleTunnelService tunnelService;
/**
* User directory restricted by the permissions of the user associated
@@ -127,7 +127,7 @@ public class UserContext extends RestrictedObject
@Override
public Collection<ConnectionRecord> getActiveConnections()
throws GuacamoleException {
return socketService.getActiveConnections(getCurrentUser());
return tunnelService.getActiveConnections(getCurrentUser());
}
@Override