mirror of
				https://github.com/gyurix1968/guacamole-client.git
				synced 2025-10-31 09:03:21 +00:00 
			
		
		
		
	Remove trailing whitespace from lines.
This commit is contained in:
		| @@ -41,8 +41,8 @@ package net.sourceforge.guacamole.net.auth; | ||||
| /** | ||||
|  * Basic implementation of a Guacamole user which uses the username to | ||||
|  * determine equality. Username comparison is case-sensitive. | ||||
|  *  | ||||
|  * @author Michael Jumper  | ||||
|  * | ||||
|  * @author Michael Jumper | ||||
|  */ | ||||
| public abstract class AbstractUser implements User { | ||||
|  | ||||
| @@ -50,7 +50,7 @@ public abstract class AbstractUser implements User { | ||||
|      * The name of this user. | ||||
|      */ | ||||
|     private String username; | ||||
|      | ||||
|  | ||||
|     /** | ||||
|      * This user's password. Note that while this provides a means for the | ||||
|      * password to be set, the data stored in this String is not necessarily | ||||
| @@ -94,7 +94,7 @@ public abstract class AbstractUser implements User { | ||||
|         // Get username | ||||
|         String objUsername = ((AbstractUser) obj).username; | ||||
|  | ||||
|         // If null, equal only if this username is null  | ||||
|         // If null, equal only if this username is null | ||||
|         if (objUsername == null) return username == null; | ||||
|  | ||||
|         // Otherwise, equal only if strings are identical | ||||
|   | ||||
| @@ -51,15 +51,15 @@ public interface AuthenticationProvider { | ||||
|  | ||||
|     /** | ||||
|      * Returns the UserContext of the user authorized by the given credentials. | ||||
|      *  | ||||
|      * | ||||
|      * @param credentials The credentials to use to retrieve the environment. | ||||
|      * @return The UserContext of the user authorized by the given credentials, | ||||
|      *         or null if the credentials are not authorized. | ||||
|      *  | ||||
|      * | ||||
|      * @throws GuacamoleException If an error occurs while creating the | ||||
|      *                            UserContext. | ||||
|      */ | ||||
|     UserContext getUserContext(Credentials credentials) | ||||
|             throws GuacamoleException; | ||||
|     | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -49,7 +49,7 @@ import net.sourceforge.guacamole.protocol.GuacamoleConfiguration; | ||||
|  * human-readable identifier, and abstracts the connection process. The | ||||
|  * backing GuacamoleConfiguration may be intentionally obfuscated or tokenized | ||||
|  * to protect sensitive configuration information. | ||||
|  *  | ||||
|  * | ||||
|  * @author Michael Jumper | ||||
|  */ | ||||
| public interface Connection { | ||||
| @@ -62,7 +62,7 @@ public interface Connection { | ||||
|  | ||||
|     /** | ||||
|      * Sets the identifier assigned to this Connection. | ||||
|      *  | ||||
|      * | ||||
|      * @param identifier The identifier to assign. | ||||
|      */ | ||||
|     public void setIdentifier(String identifier); | ||||
| @@ -71,14 +71,14 @@ public interface Connection { | ||||
|      * Returns the GuacamoleConfiguration associated with this Connection. Note | ||||
|      * that because configurations may contain sensitive information, some data | ||||
|      * in this configuration may be omitted or tokenized. | ||||
|      *  | ||||
|      * | ||||
|      * @return The GuacamoleConfiguration associated with this Connection. | ||||
|      */ | ||||
|     public GuacamoleConfiguration getConfiguration(); | ||||
|  | ||||
|     /** | ||||
|      * Sets the GuacamoleConfiguration associated with this Connection. | ||||
|      *  | ||||
|      * | ||||
|      * @param config The GuacamoleConfiguration to associate with this | ||||
|      *               Connection. | ||||
|      */ | ||||
| @@ -92,27 +92,27 @@ public interface Connection { | ||||
|      * | ||||
|      * @param info Information associated with the connecting client. | ||||
|      * @return A fully-established GuacamoleSocket. | ||||
|      *  | ||||
|      * | ||||
|      * @throws GuacamoleException If an error occurs while connecting to guacd, | ||||
|      *                            or if permission to connect is denied. | ||||
|      */ | ||||
|     public GuacamoleSocket connect(GuacamoleClientInformation info) | ||||
|             throws GuacamoleException; | ||||
|      | ||||
|  | ||||
|     /** | ||||
|      * Returns a list of ConnectionRecords representing the usage history | ||||
|      * of this Connection, including any active users. ConnectionRecords | ||||
|      * in this list will be sorted in descending order of end time (active | ||||
|      * connections are first), and then in descending order of start time | ||||
|      * (newer connections are first). | ||||
|      *  | ||||
|      * | ||||
|      * @return A list of ConnectionRecrods representing the usage history | ||||
|      *         of this Connection. | ||||
|      *  | ||||
|      * | ||||
|      * @throws GuacamoleException If an error occurs while reading the history | ||||
|      *                            of this connection, or if permission is | ||||
|      *                            denied. | ||||
|      */ | ||||
|     public List<? extends ConnectionRecord> getHistory() throws GuacamoleException; | ||||
|              | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -42,21 +42,21 @@ import java.util.Date; | ||||
| /** | ||||
|  * A logging record describing when a user started and ended usage of a | ||||
|  * particular connection. | ||||
|  *  | ||||
|  * | ||||
|  * @author Michael Jumper | ||||
|  */ | ||||
| public interface ConnectionRecord { | ||||
|  | ||||
|     /** | ||||
|      * Returns the date and time the connection began. | ||||
|      *  | ||||
|      * | ||||
|      * @return The date and time the connection began. | ||||
|      */ | ||||
|     public Date getStartDate(); | ||||
|  | ||||
|     /** | ||||
|      * Returns the date and time the connection ended, if applicable. | ||||
|      *  | ||||
|      * | ||||
|      * @return The date and time the connection ended, or null if the | ||||
|      *         connection is still running or if the end time is unknown. | ||||
|      */ | ||||
| @@ -65,14 +65,14 @@ public interface ConnectionRecord { | ||||
|     /** | ||||
|      * Returns the user who used or is using the connection at the times | ||||
|      * given by this connection record. | ||||
|      *  | ||||
|      * | ||||
|      * @return The user who used or is using the associated connection. | ||||
|      */ | ||||
|     public User getUser(); | ||||
|  | ||||
|     /** | ||||
|      * Returns the connection associated with this record. | ||||
|      *  | ||||
|      * | ||||
|      * @return The connection associated with this record. | ||||
|      */ | ||||
|     public Connection getConnection(); | ||||
| @@ -80,10 +80,10 @@ public interface ConnectionRecord { | ||||
|     /** | ||||
|      * Returns whether the connection associated with this record is still | ||||
|      * active. | ||||
|      *  | ||||
|      * | ||||
|      * @return true if the connection associated with this record is still | ||||
|      *         active, false otherwise. | ||||
|      */ | ||||
|     public boolean isActive(); | ||||
|      | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -46,7 +46,7 @@ import net.sourceforge.guacamole.GuacamoleException; | ||||
|  * Directory are not necessarily returned to the use as references to | ||||
|  * the stored objects, thus updating an object requires calling an update | ||||
|  * function. | ||||
|  *  | ||||
|  * | ||||
|  * @author Michael Jumper | ||||
|  * @param <IdentifierType> The type of identifier used to identify objects | ||||
|  *                         stored within this Directory. | ||||
| @@ -60,18 +60,18 @@ public interface Directory<IdentifierType, ObjectType> { | ||||
|      * the Directory. To update an object stored within an | ||||
|      * Directory such that future calls to get() will return the updated | ||||
|      * object, you must call update() on the object after modification. | ||||
|      *  | ||||
|      * | ||||
|      * @param identifier The identifier to use when locating the object to | ||||
|      *                   return. | ||||
|      * @return The object having the given identifier, or null if no such object | ||||
|      *         exists. | ||||
|      *  | ||||
|      * | ||||
|      * @throws GuacamoleException If an error occurs while retrieving the | ||||
|      *                            object, or if permission for retrieving the | ||||
|      *                            object is denied. | ||||
|      */ | ||||
|     ObjectType get(IdentifierType identifier) throws GuacamoleException; | ||||
|      | ||||
|  | ||||
|     /** | ||||
|      * Returns a Set containing all identifiers for all objects within this | ||||
|      * Directory. | ||||
| @@ -84,34 +84,34 @@ public interface Directory<IdentifierType, ObjectType> { | ||||
|  | ||||
|     /** | ||||
|      * Adds the given object to the overall set. | ||||
|      *  | ||||
|      * | ||||
|      * @param object The object to add. | ||||
|      *  | ||||
|      * | ||||
|      * @throws GuacamoleException If an error occurs while adding the object , or | ||||
|      *                            if adding the object is not allowed. | ||||
|      */ | ||||
|     void add(ObjectType object) | ||||
|             throws GuacamoleException; | ||||
|      | ||||
|  | ||||
|     /** | ||||
|      * Updates the stored object with the data contained in the given object. | ||||
|      *  | ||||
|      * | ||||
|      * @param object The object which will supply the data for the update. | ||||
|      *  | ||||
|      * | ||||
|      * @throws GuacamoleException If an error occurs while updating the object, | ||||
|      *                            or if updating the object is not allowed. | ||||
|      */ | ||||
|     void update(ObjectType object) | ||||
|             throws GuacamoleException; | ||||
|      | ||||
|  | ||||
|     /** | ||||
|      * Removes the object with the given identifier from the overall set. | ||||
|      *  | ||||
|      * | ||||
|      * @param identifier The identifier of the object to remove. | ||||
|      *  | ||||
|      * | ||||
|      * @throws GuacamoleException If an error occurs while removing the object, | ||||
|      *                            or if removing object is not allowed. | ||||
|      */ | ||||
|     void remove(IdentifierType identifier) throws GuacamoleException; | ||||
|   | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -44,21 +44,21 @@ import net.sourceforge.guacamole.net.auth.permission.Permission; | ||||
|  | ||||
| /** | ||||
|  * A user of the Guacamole web application. | ||||
|  *  | ||||
|  * @author Michael Jumper  | ||||
|  * | ||||
|  * @author Michael Jumper | ||||
|  */ | ||||
| public interface User { | ||||
|  | ||||
|     /** | ||||
|      * Returns the name of this user, which must be unique across all users. | ||||
|      *  | ||||
|      * | ||||
|      * @return The name of this user. | ||||
|      */ | ||||
|     public String getUsername(); | ||||
|  | ||||
|     /** | ||||
|      * Sets the name of this user, which must be unique across all users. | ||||
|      *  | ||||
|      * | ||||
|      * @param username  The name of this user. | ||||
|      */ | ||||
|     public void setUsername(String username); | ||||
| @@ -66,7 +66,7 @@ public interface User { | ||||
|     /** | ||||
|      * Returns this user's password. Note that the password returned may be | ||||
|      * hashed or completely arbitrary. | ||||
|      *  | ||||
|      * | ||||
|      * @return A String which may (or may not) be the user's password. | ||||
|      */ | ||||
|     public String getPassword(); | ||||
| @@ -75,39 +75,39 @@ public interface User { | ||||
|      * Sets this user's password. Note that while this function is guaranteed | ||||
|      * to change the password of this User object, there is no guarantee that | ||||
|      * getPassword() will return the value given to setPassword(). | ||||
|      *  | ||||
|      * | ||||
|      * @param password The password to set. | ||||
|      */ | ||||
|     public void setPassword(String password); | ||||
|  | ||||
|     /** | ||||
|      * Lists all permissions given to this user. | ||||
|      *  | ||||
|      * | ||||
|      * @return A Set of all permissions granted to this user. | ||||
|      *  | ||||
|      * | ||||
|      * @throws GuacamoleException  If an error occurs while retrieving | ||||
|      *                             permissions, or if reading all permissions | ||||
|      *                             is not allowed. | ||||
|      */ | ||||
|     Set<Permission> getPermissions() throws GuacamoleException; | ||||
|      | ||||
|  | ||||
|     /** | ||||
|      * Tests whether this user has the specified permission. | ||||
|      *  | ||||
|      * | ||||
|      * @param permission The permission to check. | ||||
|      * @return true if the permission is granted to this user, false otherwise. | ||||
|      *  | ||||
|      * | ||||
|      * @throws GuacamoleException If an error occurs while checking permissions, | ||||
|      *                            or if permissions cannot be checked due to | ||||
|      *                            lack of permissions to do so. | ||||
|      */ | ||||
|     boolean hasPermission(Permission permission) throws GuacamoleException; | ||||
|      | ||||
|  | ||||
|     /** | ||||
|      * Adds the specified permission to this user. | ||||
|      *  | ||||
|      * | ||||
|      * @param permission The permission to add. | ||||
|      *  | ||||
|      * | ||||
|      * @throws GuacamoleException If an error occurs while adding the | ||||
|      *                            permission. or if permission to add | ||||
|      *                            permissions is denied. | ||||
| @@ -116,9 +116,9 @@ public interface User { | ||||
|  | ||||
|     /** | ||||
|      * Removes the specified permission from this specified user. | ||||
|      *  | ||||
|      * | ||||
|      * @param permission The permission to remove. | ||||
|      *  | ||||
|      * | ||||
|      * @throws GuacamoleException If an error occurs while removing the | ||||
|      *                            permission. or if permission to remove | ||||
|      *                            permissions is denied. | ||||
|   | ||||
| @@ -42,7 +42,7 @@ import net.sourceforge.guacamole.GuacamoleException; | ||||
| /** | ||||
|  * The context of an active user. The functions of this class enforce all | ||||
|  * permissions and act only within the rights of the associated user. | ||||
|  *  | ||||
|  * | ||||
|  * @author Michael Jumper | ||||
|  */ | ||||
| public interface UserContext { | ||||
| @@ -50,7 +50,7 @@ public interface UserContext { | ||||
|     /** | ||||
|      * Returns the User whose access rights control the operations of this | ||||
|      * UserContext. | ||||
|      *  | ||||
|      * | ||||
|      * @return The User whose access rights control the operations of this | ||||
|      *         UserContext. | ||||
|      */ | ||||
| @@ -60,26 +60,26 @@ public interface UserContext { | ||||
|      * Retrieves a Directory which can be used to view and manipulate other | ||||
|      * users, but only as allowed by the permissions given to the user of this | ||||
|      * UserContext. | ||||
|      *  | ||||
|      * | ||||
|      * @return A Directory whose operations are bound by the restrictions | ||||
|      *         of this UserContext. | ||||
|      *  | ||||
|      * | ||||
|      * @throws GuacamoleException If an error occurs while creating the | ||||
|      *                            Directory. | ||||
|      */ | ||||
|     Directory<String, User> getUserDirectory() throws GuacamoleException; | ||||
|   | ||||
|  | ||||
|     /** | ||||
|      * Retrieves a Directory which can be used to view and manipulate | ||||
|      * connections and their configurations, but only as allowed by the | ||||
|      * permissions given to the user of this UserContext. | ||||
|      *  | ||||
|      * | ||||
|      * @return A Directory whose operations are bound by the restrictions | ||||
|      *         of this UserContext. | ||||
|      *  | ||||
|      * | ||||
|      * @throws GuacamoleException If an error occurs while creating the | ||||
|      *                            Directory. | ||||
|      */    | ||||
|      */ | ||||
|     Directory<String, Connection> getConnectionDirectory() | ||||
|             throws GuacamoleException; | ||||
|  | ||||
|   | ||||
| @@ -40,7 +40,7 @@ package net.sourceforge.guacamole.net.auth.permission; | ||||
|  | ||||
| /** | ||||
|  * A permission which controls access to a GuacamoleConfigurationDirectory. | ||||
|  *  | ||||
|  * | ||||
|  * @author Michael Jumper | ||||
|  */ | ||||
| public class ConnectionDirectoryPermission | ||||
| @@ -54,13 +54,13 @@ public class ConnectionDirectoryPermission | ||||
|     /** | ||||
|      * Creates a new ConnectionDirectoryPermission with the given | ||||
|      * type. | ||||
|      *  | ||||
|      * | ||||
|      * @param type The type of operation controlled by this permission. | ||||
|      */ | ||||
|     public ConnectionDirectoryPermission(Type type) { | ||||
|         this.type = type; | ||||
|     } | ||||
|      | ||||
|  | ||||
|     @Override | ||||
|     public Type getType() { | ||||
|         return type; | ||||
|   | ||||
| @@ -43,7 +43,7 @@ package net.sourceforge.guacamole.net.auth.permission; | ||||
|  * GuacamoleConfiguration. Note that this permission only refers to the | ||||
|  * GuacamoleConfiguration by its identifier. The actual GuacamoleConfiguration | ||||
|  * is not stored within. | ||||
|  *  | ||||
|  * | ||||
|  * @author Michael Jumper | ||||
|  */ | ||||
| public class ConnectionPermission | ||||
| @@ -64,13 +64,13 @@ public class ConnectionPermission | ||||
|      * Creates a new ConnectionPermission having the given type | ||||
|      * and identifier. The identifier must be the unique identifier assigned | ||||
|      * to the GuacamoleConfiguration by the AuthenticationProvider in use. | ||||
|      *  | ||||
|      * | ||||
|      * @param type The type of operation affected by this permission. | ||||
|      * @param identifier The identifier of the GuacamoleConfiguration associated | ||||
|      *                   with the operation affected by this permission. | ||||
|      */ | ||||
|     public ConnectionPermission(Type type, String identifier) { | ||||
|          | ||||
|  | ||||
|         this.identifier = identifier; | ||||
|         this.type = type; | ||||
|  | ||||
|   | ||||
| @@ -41,7 +41,7 @@ package net.sourceforge.guacamole.net.auth.permission; | ||||
| /** | ||||
|  * A permission which affects a specific object, rather than the system as a | ||||
|  * whole. | ||||
|  *  | ||||
|  * | ||||
|  * @author Michael Jumper | ||||
|  * @param <T> The type of identifier used by the object this permission affects. | ||||
|  */ | ||||
| @@ -78,10 +78,10 @@ public interface ObjectPermission<T> extends Permission<ObjectPermission.Type> { | ||||
|     /** | ||||
|      * Returns the identifier of the specific object affected by this | ||||
|      * permission. | ||||
|      *  | ||||
|      * | ||||
|      * @return The identifier of the specific object affected by this | ||||
|      *         permission. | ||||
|      */ | ||||
|     public T getObjectIdentifier(); | ||||
|      | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -41,17 +41,17 @@ package net.sourceforge.guacamole.net.auth.permission; | ||||
| /** | ||||
|  * A permission which affects a specific type of operation, where all available | ||||
|  * operation types are defined by an enumeration. | ||||
|  *  | ||||
|  * | ||||
|  * @author Michael Jumper | ||||
|  * @param <Type> The enumeration of all available operation types that this | ||||
|  *               permission can affect. | ||||
|  */ | ||||
| public interface Permission<Type extends Enum> { | ||||
|      | ||||
|  | ||||
|     /** | ||||
|      * Returns the type of operation affected by this permission. | ||||
|      * @return The type of operation affected by this permission. | ||||
|      */ | ||||
|     public Type getType(); | ||||
|      | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -41,7 +41,7 @@ package net.sourceforge.guacamole.net.auth.permission; | ||||
| /** | ||||
|  * A permission which affects the system as a whole, rather than an individual | ||||
|  * object. | ||||
|  *  | ||||
|  * | ||||
|  * @author Michael Jumper | ||||
|  */ | ||||
| public interface SystemPermission extends Permission<SystemPermission.Type> { | ||||
| @@ -56,7 +56,7 @@ public interface SystemPermission extends Permission<SystemPermission.Type> { | ||||
|          * Create system-level objects. | ||||
|          */ | ||||
|         CREATE | ||||
|          | ||||
|  | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -40,7 +40,7 @@ package net.sourceforge.guacamole.net.auth.permission; | ||||
|  | ||||
| /** | ||||
|  * A permission which controls access to a UserDirectory. | ||||
|  *  | ||||
|  * | ||||
|  * @author Michael Jumper | ||||
|  */ | ||||
| public class UserDirectoryPermission implements SystemPermission { | ||||
| @@ -52,13 +52,13 @@ public class UserDirectoryPermission implements SystemPermission { | ||||
|  | ||||
|     /** | ||||
|      * Creates a new UserDirectoryPermission with the given type. | ||||
|      *  | ||||
|      * | ||||
|      * @param type The type of operation controlled by this permission. | ||||
|      */ | ||||
|     public UserDirectoryPermission(Type type) { | ||||
|         this.type = type; | ||||
|     } | ||||
|      | ||||
|  | ||||
|     @Override | ||||
|     public Type getType() { | ||||
|         return type; | ||||
|   | ||||
| @@ -41,7 +41,7 @@ package net.sourceforge.guacamole.net.auth.permission; | ||||
| /** | ||||
|  * A permission which controls operations that directly affect a specific | ||||
|  * User. | ||||
|  *  | ||||
|  * | ||||
|  * @author Michael Jumper | ||||
|  */ | ||||
| public class UserPermission implements ObjectPermission<String> { | ||||
| @@ -60,7 +60,7 @@ public class UserPermission implements ObjectPermission<String> { | ||||
|     /** | ||||
|      * Creates a new UserPermission having the given type and identifier. The | ||||
|      * identifier must be the user's username. | ||||
|      *  | ||||
|      * | ||||
|      * @param type The type of operation affected by this permission. | ||||
|      * @param identifier The username of the User associated with the operation | ||||
|      *                   affected by this permission. | ||||
|   | ||||
| @@ -52,13 +52,13 @@ import net.sourceforge.guacamole.protocol.GuacamoleConfiguration; | ||||
|  * implementation intended to be easily extended. It is useful for simple | ||||
|  * authentication situations where access to web-based administration and | ||||
|  * complex users and permissions are not required. | ||||
|  *  | ||||
|  * | ||||
|  * The interface provided by SimpleAuthenticationProvider is similar to that of | ||||
|  * the AuthenticationProvider interface of older Guacamole releases. | ||||
|  * | ||||
|  * @author Michael Jumper | ||||
|  */ | ||||
| public abstract class SimpleAuthenticationProvider  | ||||
| public abstract class SimpleAuthenticationProvider | ||||
|     implements AuthenticationProvider { | ||||
|  | ||||
|     /** | ||||
| @@ -84,17 +84,17 @@ public abstract class SimpleAuthenticationProvider | ||||
|         // Get configurations | ||||
|         Map<String, GuacamoleConfiguration> configs = | ||||
|                 getAuthorizedConfigurations(credentials); | ||||
|          | ||||
|  | ||||
|         // Return as unauthorized if not authorized to retrieve configs | ||||
|         if (configs == null) | ||||
|             return null; | ||||
|          | ||||
|  | ||||
|         // Build new user from credentials | ||||
|         User user = new SimpleUser(credentials.getUsername(), configs); | ||||
|          | ||||
|  | ||||
|         // Return user context restricted to authorized configs | ||||
|         return new SimpleUserContext(user, configs); | ||||
|          | ||||
|  | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -52,7 +52,7 @@ import net.sourceforge.guacamole.protocol.GuacamoleConfiguration; | ||||
|  | ||||
| /** | ||||
|  * An extremely basic Connection implementation. | ||||
|  *  | ||||
|  * | ||||
|  * @author Michael Jumper | ||||
|  */ | ||||
| public class SimpleConnection extends AbstractConnection { | ||||
| @@ -61,17 +61,17 @@ public class SimpleConnection extends AbstractConnection { | ||||
|      * Backing configuration, containing all sensitive information. | ||||
|      */ | ||||
|     private GuacamoleConfiguration config; | ||||
|      | ||||
|  | ||||
|     /** | ||||
|      * Creates a completely uninitialized SimpleConnection. | ||||
|      */ | ||||
|     public SimpleConnection() { | ||||
|     } | ||||
|      | ||||
|  | ||||
|     /** | ||||
|      * Creates a new SimpleConnection having the given identifier and | ||||
|      * GuacamoleConfiguration. | ||||
|      *  | ||||
|      * | ||||
|      * @param identifier The identifier to associated with this connection. | ||||
|      * @param config The configuration describing how to connect to this | ||||
|      *               connection. | ||||
| @@ -95,13 +95,13 @@ public class SimpleConnection extends AbstractConnection { | ||||
|         // Get guacd connection parameters | ||||
|         String hostname = GuacamoleProperties.getProperty(GuacamoleProperties.GUACD_HOSTNAME); | ||||
|         int port = GuacamoleProperties.getProperty(GuacamoleProperties.GUACD_PORT); | ||||
|          | ||||
|  | ||||
|         // Return connected socket | ||||
|         return new ConfiguredGuacamoleSocket( | ||||
|                 new InetGuacamoleSocket(hostname, port), | ||||
|                 config, info | ||||
|         ); | ||||
|          | ||||
|  | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|   | ||||
| @@ -52,10 +52,10 @@ import net.sourceforge.guacamole.protocol.GuacamoleConfiguration; | ||||
|  * An extremely simple read-only implementation of a Directory of | ||||
|  * GuacamoleConfigurations which provides access to a pre-defined Map of | ||||
|  * GuacamoleConfigurations. | ||||
|  *  | ||||
|  * | ||||
|  * @author Michael Jumper | ||||
|  */ | ||||
| public class SimpleConnectionDirectory  | ||||
| public class SimpleConnectionDirectory | ||||
|     implements Directory<String, Connection> { | ||||
|  | ||||
|     /** | ||||
| @@ -67,7 +67,7 @@ public class SimpleConnectionDirectory | ||||
|     /** | ||||
|      * Creates a new SimpleConnectionDirectory which provides | ||||
|      * access to the configurations contained within the given Map. | ||||
|      *  | ||||
|      * | ||||
|      * @param configs The Map of GuacamoleConfigurations to provide access to. | ||||
|      */ | ||||
|     public SimpleConnectionDirectory( | ||||
| @@ -77,9 +77,9 @@ public class SimpleConnectionDirectory | ||||
|         for (Entry<String, GuacamoleConfiguration> entry : configs.entrySet()) | ||||
|             connections.put(entry.getKey(), | ||||
|                     new SimpleConnection(entry.getKey(), entry.getValue())); | ||||
|          | ||||
|  | ||||
|     } | ||||
|      | ||||
|  | ||||
|     @Override | ||||
|     public Connection get(String identifier) | ||||
|             throws GuacamoleException { | ||||
|   | ||||
| @@ -51,7 +51,7 @@ import net.sourceforge.guacamole.protocol.GuacamoleConfiguration; | ||||
|  | ||||
| /** | ||||
|  * An extremely basic User implementation. | ||||
|  *  | ||||
|  * | ||||
|  * @author Michael Jumper | ||||
|  */ | ||||
| public class SimpleUser extends AbstractUser { | ||||
| @@ -60,16 +60,16 @@ public class SimpleUser extends AbstractUser { | ||||
|      * The set of all permissions available to this user. | ||||
|      */ | ||||
|     private Set<Permission> permissions = new HashSet<Permission>(); | ||||
|      | ||||
|  | ||||
|     /** | ||||
|      * Creates a completely uninitialized SimpleUser. | ||||
|      */ | ||||
|     public SimpleUser() { | ||||
|     } | ||||
|      | ||||
|  | ||||
|     /** | ||||
|      * Creates a new SimpleUser having the given username. | ||||
|      *  | ||||
|      * | ||||
|      * @param username The username to assign to this SimpleUser. | ||||
|      * @param configs All configurations this user has read access to. | ||||
|      */ | ||||
| @@ -90,9 +90,9 @@ public class SimpleUser extends AbstractUser { | ||||
|  | ||||
|             // Add to set | ||||
|             permissions.add(permission); | ||||
|              | ||||
|  | ||||
|         } | ||||
|          | ||||
|  | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -114,5 +114,5 @@ public class SimpleUser extends AbstractUser { | ||||
|     public void removePermission(Permission permission) throws GuacamoleException { | ||||
|         throw new GuacamoleSecurityException("Permission denied."); | ||||
|     } | ||||
|      | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -49,7 +49,7 @@ import net.sourceforge.guacamole.protocol.GuacamoleConfiguration; | ||||
|  * An extremely simple UserContext implementation which provides access to | ||||
|  * a defined and restricted set of GuacamoleConfigurations. Access to | ||||
|  * querying or modifying either users or permissions is denied. | ||||
|  *  | ||||
|  * | ||||
|  * @author Michael Jumper | ||||
|  */ | ||||
| public class SimpleUserContext implements UserContext { | ||||
| @@ -59,7 +59,7 @@ public class SimpleUserContext implements UserContext { | ||||
|      * accessible within this UserContext. | ||||
|      */ | ||||
|     private final User self; | ||||
|      | ||||
|  | ||||
|     /** | ||||
|      * The Directory with access only to those Connections that the User | ||||
|      * associated with this UserContext has access to. | ||||
| @@ -71,13 +71,13 @@ public class SimpleUserContext implements UserContext { | ||||
|      * UserContext. | ||||
|      */ | ||||
|     private final Directory<String, User> userDirectory; | ||||
|      | ||||
|  | ||||
|     /** | ||||
|      * Creates a new SimpleUserContext which provides access to only those | ||||
|      * configurations within the given Map. The User given must be the user | ||||
|      * that owns this UserContext, and the Map given must contain only | ||||
|      * GuacamoleConfigurations that the given User has read access to. | ||||
|      *  | ||||
|      * | ||||
|      * @param self The owner of this UserContext. | ||||
|      * @param configs A Map of all configurations for which the user associated | ||||
|      *                with this UserContext has read access. | ||||
| @@ -89,11 +89,11 @@ public class SimpleUserContext implements UserContext { | ||||
|  | ||||
|         this.connectionDirectory = | ||||
|                 new SimpleConnectionDirectory(configs); | ||||
|          | ||||
|  | ||||
|         this.userDirectory = new SimpleUserDirectory(self); | ||||
|          | ||||
|  | ||||
|     } | ||||
|      | ||||
|  | ||||
|     @Override | ||||
|     public User self() { | ||||
|         return self; | ||||
|   | ||||
| @@ -48,7 +48,7 @@ import net.sourceforge.guacamole.net.auth.User; | ||||
| /** | ||||
|  * An extremely simple read-only implementation of a Directory of Users which | ||||
|  * provides access to a single pre-defined User. | ||||
|  *  | ||||
|  * | ||||
|  * @author Michael Jumper | ||||
|  */ | ||||
| public class SimpleUserDirectory implements Directory<String, User> { | ||||
| @@ -61,7 +61,7 @@ public class SimpleUserDirectory implements Directory<String, User> { | ||||
|     /** | ||||
|      * Creates a new SimpleUserDirectory which provides access to the single | ||||
|      * user provided. | ||||
|      *  | ||||
|      * | ||||
|      * @param user The user to provide access to. | ||||
|      */ | ||||
|     public SimpleUserDirectory(User user) { | ||||
|   | ||||
| @@ -41,7 +41,7 @@ import java.io.File; | ||||
|  | ||||
| /** | ||||
|  * Abstract representation of the Guacamole configuration directory. | ||||
|  *  | ||||
|  * | ||||
|  * @author Michael Jumper | ||||
|  */ | ||||
| public class GuacamoleHome { | ||||
| @@ -50,13 +50,13 @@ public class GuacamoleHome { | ||||
|      * GuacamoleHome is a utility class and cannot be instantiated. | ||||
|      */ | ||||
|     private GuacamoleHome() {} | ||||
|      | ||||
|  | ||||
|     /** | ||||
|      * Returns the Guacamole home directory by checking, in order: | ||||
|      * the guacamole.home system property, the GUACAMOLE_HOME environment | ||||
|      * variable, and finally the .guacamole directory in the home directory of | ||||
|      * the user running the servlet container. | ||||
|      *  | ||||
|      * | ||||
|      * @return The File representing the Guacamole home directory, which may | ||||
|      *         or may not exist, and may turn out to not be a directory. | ||||
|      */ | ||||
| @@ -64,7 +64,7 @@ public class GuacamoleHome { | ||||
|  | ||||
|         // Attempt to find Guacamole home | ||||
|         File guacHome; | ||||
|          | ||||
|  | ||||
|         // Use system property by default | ||||
|         String desiredDir = System.getProperty("guacamole.home"); | ||||
|  | ||||
|   | ||||
| @@ -50,7 +50,7 @@ import net.sourceforge.guacamole.GuacamoleServerException; | ||||
|  * file. The guacamole.properties file is preferably located in the servlet | ||||
|  * container's user's home directory, in a subdirectory called .guacamole, or | ||||
|  * in the directory set by the system property: guacamole.home. | ||||
|  *  | ||||
|  * | ||||
|  * If none of those locations are possible, guacamole.properties will also | ||||
|  * be read from the root of the classpath. | ||||
|  * | ||||
| @@ -104,9 +104,9 @@ public class GuacamoleProperties { | ||||
|  | ||||
|             // Attempt to find Guacamole home | ||||
|             File guacHome = GuacamoleHome.getDirectory(); | ||||
|              | ||||
|  | ||||
|             InputStream stream; | ||||
|              | ||||
|  | ||||
|             // If not a directory, load from classpath | ||||
|             if (!guacHome.isDirectory()) { | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user