Ticket #269: Removed whitespace at end of lines.

This commit is contained in:
James Muehlner
2013-02-21 23:03:37 -08:00
parent b88088f226
commit 9f0bad5dbe
6 changed files with 46 additions and 46 deletions

View File

@@ -224,7 +224,7 @@ public class ConnectionDirectory implements Directory<String, Connection>{
ConnectionParameterExample connectionParameterExample = new ConnectionParameterExample(); ConnectionParameterExample connectionParameterExample = new ConnectionParameterExample();
connectionParameterExample.createCriteria().andConnection_idEqualTo(mySQLConnection.getConnectionID()); connectionParameterExample.createCriteria().andConnection_idEqualTo(mySQLConnection.getConnectionID());
connectionParameterDAO.deleteByExample(connectionParameterExample); connectionParameterDAO.deleteByExample(connectionParameterExample);
// delete all permissions that refer to this connection // delete all permissions that refer to this connection
ConnectionPermissionExample connectionPermissionExample = new ConnectionPermissionExample(); ConnectionPermissionExample connectionPermissionExample = new ConnectionPermissionExample();
connectionPermissionExample.createCriteria().andConnection_idEqualTo(mySQLConnection.getConnectionID()); connectionPermissionExample.createCriteria().andConnection_idEqualTo(mySQLConnection.getConnectionID());

View File

@@ -45,25 +45,25 @@ import net.sourceforge.guacamole.net.auth.permission.UserPermission;
* @author James Muehlner * @author James Muehlner
*/ */
public final class MySQLConstants { public final class MySQLConstants {
/** /**
* This class should not be instantiated. * This class should not be instantiated.
*/ */
private MySQLConstants() {} private MySQLConstants() {}
// Permission constants // Permission constants
public static final String USER_READ = UserPermission.Type.READ.name(); public static final String USER_READ = UserPermission.Type.READ.name();
public static final String USER_UPDATE = UserPermission.Type.UPDATE.name(); public static final String USER_UPDATE = UserPermission.Type.UPDATE.name();
public static final String USER_DELETE = UserPermission.Type.DELETE.name(); public static final String USER_DELETE = UserPermission.Type.DELETE.name();
public static final String USER_ADMINISTER = UserPermission.Type.ADMINISTER.name(); public static final String USER_ADMINISTER = UserPermission.Type.ADMINISTER.name();
public static final String USER_CREATE = UserDirectoryPermission.Type.CREATE.name(); public static final String USER_CREATE = UserDirectoryPermission.Type.CREATE.name();
public static final String CONNECTION_READ = ConnectionPermission.Type.READ.name(); public static final String CONNECTION_READ = ConnectionPermission.Type.READ.name();
public static final String CONNECTION_UPDATE = ConnectionPermission.Type.UPDATE.name(); public static final String CONNECTION_UPDATE = ConnectionPermission.Type.UPDATE.name();
public static final String CONNECTION_DELETE = ConnectionPermission.Type.DELETE.name(); public static final String CONNECTION_DELETE = ConnectionPermission.Type.DELETE.name();
public static final String CONNECTION_ADMINISTER = ConnectionPermission.Type.ADMINISTER.name(); public static final String CONNECTION_ADMINISTER = ConnectionPermission.Type.ADMINISTER.name();
public static final String CONNECTION_CREATE = ConnectionDirectoryPermission.Type.CREATE.name(); public static final String CONNECTION_CREATE = ConnectionDirectoryPermission.Type.CREATE.name();
public static final String SYSTEM_USER_CREATE = "USER_CREATE"; public static final String SYSTEM_USER_CREATE = "USER_CREATE";
public static final String SYSTEM_CONNECTION_CREATE = "CONNECTION_CREATE"; public static final String SYSTEM_CONNECTION_CREATE = "CONNECTION_CREATE";
} }

View File

@@ -41,48 +41,48 @@ import net.sourceforge.guacamole.net.auth.mysql.model.ConnectionParameter;
import net.sourceforge.guacamole.protocol.GuacamoleConfiguration; import net.sourceforge.guacamole.protocol.GuacamoleConfiguration;
/** /**
* Provides functions for translating between GuacamoleConfiguration objects * Provides functions for translating between GuacamoleConfiguration objects
* and a collection of ConnectionParameter database records. * and a collection of ConnectionParameter database records.
* @author James Muehlner * @author James Muehlner
*/ */
public class ConfigurationTranslationUtility { public class ConfigurationTranslationUtility {
/** /**
* Get a GuacamoleConfiguration based on the provided protocol and parameters. * Get a GuacamoleConfiguration based on the provided protocol and parameters.
* @param protocol the protocol used (VNC, RDP, etc) * @param protocol the protocol used (VNC, RDP, etc)
* @param parameters the parameter database records to translate * @param parameters the parameter database records to translate
* @return * @return
*/ */
public GuacamoleConfiguration getConfiguration(String protocol, Iterable<ConnectionParameter> parameters) { public GuacamoleConfiguration getConfiguration(String protocol, Iterable<ConnectionParameter> parameters) {
GuacamoleConfiguration configuration = new GuacamoleConfiguration(); GuacamoleConfiguration configuration = new GuacamoleConfiguration();
configuration.setProtocol(protocol); configuration.setProtocol(protocol);
for(ConnectionParameter parameter : parameters) { for(ConnectionParameter parameter : parameters) {
configuration.setParameter(parameter.getParameter_name(), parameter.getParameter_value()); configuration.setParameter(parameter.getParameter_name(), parameter.getParameter_value());
} }
return configuration; return configuration;
} }
/** /**
* Creates a list of ConnectionParameter database records based on the provided connectionID and GuacamoleConfiguration. * Creates a list of ConnectionParameter database records based on the provided connectionID and GuacamoleConfiguration.
* @param connectionID the ID of the connection that these parameters are for * @param connectionID the ID of the connection that these parameters are for
* @param configuration the configuration to pull the parameter values from * @param configuration the configuration to pull the parameter values from
* @return * @return
*/ */
public List<ConnectionParameter> getConnectionParameters(int connectionID, GuacamoleConfiguration configuration) { public List<ConnectionParameter> getConnectionParameters(int connectionID, GuacamoleConfiguration configuration) {
List<ConnectionParameter> connectionParameters = new ArrayList<ConnectionParameter>(); List<ConnectionParameter> connectionParameters = new ArrayList<ConnectionParameter>();
for(String parameterName : configuration.getParameterNames()) { for(String parameterName : configuration.getParameterNames()) {
ConnectionParameter connectionParameter = new ConnectionParameter(); ConnectionParameter connectionParameter = new ConnectionParameter();
String parameterValue = configuration.getParameter(parameterName); String parameterValue = configuration.getParameter(parameterName);
connectionParameter.setConnection_id(connectionID); connectionParameter.setConnection_id(connectionID);
connectionParameter.setParameter_name(parameterName); connectionParameter.setParameter_name(parameterName);
connectionParameter.setParameter_value(parameterValue); connectionParameter.setParameter_value(parameterValue);
connectionParameters.add(connectionParameter); connectionParameters.add(connectionParameter);
} }
return connectionParameters; return connectionParameters;
} }
} }

View File

@@ -42,7 +42,7 @@ import net.sourceforge.guacamole.net.auth.Credentials;
* @author James Muehlner * @author James Muehlner
*/ */
public interface PasswordEncryptionUtility { public interface PasswordEncryptionUtility {
/** /**
* Checks if the provided Credentials are correct, compared with what the values from the database. * Checks if the provided Credentials are correct, compared with what the values from the database.
* @param credentials * @param credentials
@@ -52,7 +52,7 @@ public interface PasswordEncryptionUtility {
* @return true if the provided credentials match what's in the database for that user. * @return true if the provided credentials match what's in the database for that user.
*/ */
public boolean checkCredentials(Credentials credentials, byte[] dbPasswordHash, String dbUsername, byte[] dbSalt); public boolean checkCredentials(Credentials credentials, byte[] dbPasswordHash, String dbUsername, byte[] dbSalt);
/** /**
* Creates a password hash based on the provided username, password, and salt. * Creates a password hash based on the provided username, password, and salt.
* @param username * @param username

View File

@@ -63,59 +63,59 @@ import net.sourceforge.guacamole.protocol.ConfiguredGuacamoleSocket;
public class ProviderUtility { public class ProviderUtility {
@Inject @Inject
UserMapper userDAO; UserMapper userDAO;
@Inject @Inject
ConnectionMapper connectionDAO; ConnectionMapper connectionDAO;
@Inject @Inject
ConnectionHistoryMapper connectionHistoryDAO; ConnectionHistoryMapper connectionHistoryDAO;
@Inject @Inject
Provider<MySQLUser> mySQLUserProvider; Provider<MySQLUser> mySQLUserProvider;
@Inject @Inject
Provider<MySQLConnection> mySQLConnectionProvider; Provider<MySQLConnection> mySQLConnectionProvider;
@Inject @Inject
Provider<MySQLConnectionRecord> mySQLConnectionRecordProvider; Provider<MySQLConnectionRecord> mySQLConnectionRecordProvider;
@Inject @Inject
Provider<MySQLGuacamoleSocket> mySQLGuacamoleSocketProvider; Provider<MySQLGuacamoleSocket> mySQLGuacamoleSocketProvider;
/** /**
* Create a new user based on the provided object. * Create a new user based on the provided object.
* @param user * @param user
* @return the new MySQLUser object. * @return the new MySQLUser object.
* @throws GuacamoleException * @throws GuacamoleException
*/ */
public MySQLUser getNewMySQLUser(User user) throws GuacamoleException { public MySQLUser getNewMySQLUser(User user) throws GuacamoleException {
MySQLUser mySQLUser = mySQLUserProvider.get(); MySQLUser mySQLUser = mySQLUserProvider.get();
mySQLUser.initNew(user); mySQLUser.initNew(user);
return mySQLUser; return mySQLUser;
} }
/** /**
* Get the user based on the username of the provided object. * Get the user based on the username of the provided object.
* @param user * @param user
* @return the new MySQLUser object. * @return the new MySQLUser object.
* @throws GuacamoleException * @throws GuacamoleException
*/ */
public MySQLUser getExistingMySQLUser(User user) throws GuacamoleException { public MySQLUser getExistingMySQLUser(User user) throws GuacamoleException {
return getExistingMySQLUser(user.getUsername()); return getExistingMySQLUser(user.getUsername());
} }
/** /**
* Get the user based on the username of the provided object. * Get the user based on the username of the provided object.
* @param name * @param name
* @return the new MySQLUser object. * @return the new MySQLUser object.
* @throws GuacamoleException * @throws GuacamoleException
*/ */
public MySQLUser getExistingMySQLUser(String name) throws GuacamoleException { public MySQLUser getExistingMySQLUser(String name) throws GuacamoleException {
MySQLUser mySQLUser = mySQLUserProvider.get(); MySQLUser mySQLUser = mySQLUserProvider.get();
mySQLUser.initExisting(name); mySQLUser.initExisting(name);
return mySQLUser; return mySQLUser;
} }
/** /**
* Get an existing MySQLUser from a user database record. * Get an existing MySQLUser from a user database record.
* @param user * @param user
@@ -126,7 +126,7 @@ public class ProviderUtility {
mySQLUser.init(user); mySQLUser.init(user);
return mySQLUser; return mySQLUser;
} }
/** /**
* Get an existing MySQLUser from a user ID. * Get an existing MySQLUser from a user ID.
* @param id * @param id
@@ -140,42 +140,42 @@ public class ProviderUtility {
return null; return null;
return getExistingMySQLUser(users.get(0)); return getExistingMySQLUser(users.get(0));
} }
/** /**
* Create a new connection based on the provided object. * Create a new connection based on the provided object.
* @param connection * @param connection
* @return the new Connection object. * @return the new Connection object.
* @throws GuacamoleException * @throws GuacamoleException
*/ */
public MySQLConnection getNewMySQLConnection(Connection connection) throws GuacamoleException { public MySQLConnection getNewMySQLConnection(Connection connection) throws GuacamoleException {
MySQLConnection mySQLConnection = mySQLConnectionProvider.get(); MySQLConnection mySQLConnection = mySQLConnectionProvider.get();
mySQLConnection.initNew(connection); mySQLConnection.initNew(connection);
return mySQLConnection; return mySQLConnection;
} }
/** /**
* Get the connection based on the connection name of the provided object. * Get the connection based on the connection name of the provided object.
* @param connection * @param connection
* @return the new Connection object. * @return the new Connection object.
* @throws GuacamoleException * @throws GuacamoleException
*/ */
public MySQLConnection getExistingMySQLConnection(Connection connection) throws GuacamoleException { public MySQLConnection getExistingMySQLConnection(Connection connection) throws GuacamoleException {
return getExistingMySQLConnection(connection.getIdentifier()); return getExistingMySQLConnection(connection.getIdentifier());
} }
/** /**
* Get the connection based on the connection name of the provided object. * Get the connection based on the connection name of the provided object.
* @param name * @param name
* @return the new Connection object. * @return the new Connection object.
* @throws GuacamoleException * @throws GuacamoleException
*/ */
public MySQLConnection getExistingMySQLConnection(String name) throws GuacamoleException { public MySQLConnection getExistingMySQLConnection(String name) throws GuacamoleException {
MySQLConnection mySQLConnection = mySQLConnectionProvider.get(); MySQLConnection mySQLConnection = mySQLConnectionProvider.get();
mySQLConnection.initExisting(name); mySQLConnection.initExisting(name);
return mySQLConnection; return mySQLConnection;
} }
/** /**
* Get an existing MySQLConnection from a connection database record. * Get an existing MySQLConnection from a connection database record.
* @param connection * @param connection
@@ -186,7 +186,7 @@ public class ProviderUtility {
mySQLConnection.init(connection); mySQLConnection.init(connection);
return mySQLConnection; return mySQLConnection;
} }
/** /**
* Get an existing MySQLConnection from a connection ID. * Get an existing MySQLConnection from a connection ID.
* @param id * @param id
@@ -200,7 +200,7 @@ public class ProviderUtility {
return null; return null;
return getExistingMySQLConnection(connections.get(0)); return getExistingMySQLConnection(connections.get(0));
} }
/** /**
* Gets a list of existing MySQLConnectionRecord from the database. These represent * Gets a list of existing MySQLConnectionRecord from the database. These represent
* the history records of the connection. * the history records of the connection.
@@ -219,7 +219,7 @@ public class ProviderUtility {
} }
return connectionRecords; return connectionRecords;
} }
/** /**
* Create a MySQLConnectionRecord object around a single ConnectionHistory database record. * Create a MySQLConnectionRecord object around a single ConnectionHistory database record.
* @param history * @param history
@@ -230,12 +230,12 @@ public class ProviderUtility {
record.init(history); record.init(history);
return record; return record;
} }
/** /**
* Create a MySQLGuacamoleSocket using the provided ConfiguredGuacamoleSocket and connection ID. * Create a MySQLGuacamoleSocket using the provided ConfiguredGuacamoleSocket and connection ID.
* @param socket * @param socket
* @param connectionID * @param connectionID
* @return * @return
*/ */
public MySQLGuacamoleSocket getMySQLGuacamoleSocket(ConfiguredGuacamoleSocket socket, int connectionID) { public MySQLGuacamoleSocket getMySQLGuacamoleSocket(ConfiguredGuacamoleSocket socket, int connectionID) {
MySQLGuacamoleSocket mySQLGuacamoleSocket = mySQLGuacamoleSocketProvider.get(); MySQLGuacamoleSocket mySQLGuacamoleSocket = mySQLGuacamoleSocketProvider.get();

View File

@@ -42,9 +42,9 @@ import java.security.SecureRandom;
* @author James Muehlner * @author James Muehlner
*/ */
public class SecureRandomSaltUtility implements SaltUtility { public class SecureRandomSaltUtility implements SaltUtility {
SecureRandom secureRandom = new SecureRandom(); SecureRandom secureRandom = new SecureRandom();
@Override @Override
public byte[] generateSalt() { public byte[] generateSalt() {
byte[] salt = new byte[32]; byte[] salt = new byte[32];