GUAC-1100: Commit to String identifiers.

This commit is contained in:
Michael Jumper
2015-02-12 23:07:45 -08:00
parent 37227d05e8
commit e9538a4167
27 changed files with 201 additions and 202 deletions

View File

@@ -44,12 +44,12 @@ public abstract class AbstractUser implements User {
private String password;
@Override
public String getUsername() {
public String getIdentifier() {
return username;
}
@Override
public void setUsername(String username) {
public void setIdentifier(String username) {
this.username = username;
}

View File

@@ -36,7 +36,7 @@ import org.glyptodon.guacamole.protocol.GuacamoleConfiguration;
*
* @author Michael Jumper
*/
public interface Connection {
public interface Connection extends Identifiable {
/**
* Returns the name assigned to this Connection.
@@ -51,24 +51,6 @@ public interface Connection {
*/
public void setName(String name);
/**
* Returns the unique identifier assigned to this Connection. All
* connections must have a deterministic, unique identifier which may not
* be null.
*
* @return
* The unique identifier assigned to this Connection, which may not be
* null.
*/
public String getIdentifier();
/**
* Sets the identifier assigned to this Connection.
*
* @param identifier The identifier to assign.
*/
public void setIdentifier(String identifier);
/**
* Returns the unique identifier of the parent ConnectionGroup for
* this Connection.

View File

@@ -32,10 +32,29 @@ import org.glyptodon.guacamole.protocol.GuacamoleClientInformation;
*
* @author James Muehlner
*/
public interface ConnectionGroup {
public interface ConnectionGroup extends Identifiable {
/**
* All legal types of connection group.
*/
public enum Type {
ORGANIZATIONAL, BALANCING
/**
* A connection group that purely organizes other connections or
* connection groups, serving only as a container. An organizational
* connection group is analogous to a directory or folder in a
* filesystem.
*/
ORGANIZATIONAL,
/**
* A connection group that acts as a load balancer. A balancing
* connection group can be connected to in the same manner as a
* connection, and will transparently route to the least-used
* underlying connection.
*/
BALANCING
};
/**
@@ -51,24 +70,6 @@ public interface ConnectionGroup {
*/
public void setName(String name);
/**
* Returns the unique identifier assigned to this ConnectionGroup. All
* connection groups must have a deterministic, unique identifier which may
* not be null.
*
* @return
* The unique identifier assigned to this ConnectionGroup, which may
* not be null.
*/
public String getIdentifier();
/**
* Sets the identifier assigned to this ConnectionGroup.
*
* @param identifier The identifier to assign.
*/
public void setIdentifier(String identifier);
/**
* Returns the unique identifier of the parent ConnectionGroup for
* this ConnectionGroup.
@@ -111,7 +112,7 @@ public interface ConnectionGroup {
* @throws GuacamoleException If an error occurs while creating the
* Directory.
*/
Directory<String, Connection> getConnectionDirectory()
Directory<Connection> getConnectionDirectory()
throws GuacamoleException;
/**
@@ -125,7 +126,7 @@ public interface ConnectionGroup {
* @throws GuacamoleException If an error occurs while creating the
* Directory.
*/
Directory<String, ConnectionGroup> getConnectionGroupDirectory()
Directory<ConnectionGroup> getConnectionGroupDirectory()
throws GuacamoleException;
/**

View File

@@ -34,11 +34,10 @@ import org.glyptodon.guacamole.GuacamoleException;
* function.
*
* @author Michael Jumper
* @param <IdentifierType> The type of identifier used to identify objects
* stored within this Directory.
* @param <ObjectType> The type of objects stored within this Directory.
* @param <ObjectType>
* The type of objects stored within this Directory.
*/
public interface Directory<IdentifierType, ObjectType> {
public interface Directory<ObjectType> {
/**
* Returns the object having the given identifier. Note that changes to
@@ -56,7 +55,7 @@ public interface Directory<IdentifierType, ObjectType> {
* object, or if permission for retrieving the
* object is denied.
*/
ObjectType get(IdentifierType identifier) throws GuacamoleException;
ObjectType get(String identifier) throws GuacamoleException;
/**
* Returns the objects having the given identifiers. Note that changes to
@@ -78,7 +77,7 @@ public interface Directory<IdentifierType, ObjectType> {
* If an error occurs while retrieving the objects, or if permission
* to retrieve the requested objects is denied.
*/
Collection<ObjectType> getAll(Collection<IdentifierType> identifiers)
Collection<ObjectType> getAll(Collection<String> identifiers)
throws GuacamoleException;
/**
@@ -89,7 +88,7 @@ public interface Directory<IdentifierType, ObjectType> {
* @throws GuacamoleException If an error occurs while retrieving
* the identifiers.
*/
Set<IdentifierType> getIdentifiers() throws GuacamoleException;
Set<String> getIdentifiers() throws GuacamoleException;
/**
* Adds the given object to the overall set.
@@ -121,7 +120,7 @@ public interface Directory<IdentifierType, ObjectType> {
* @throws GuacamoleException If an error occurs while removing the object,
* or if removing object is not allowed.
*/
void remove(IdentifierType identifier) throws GuacamoleException;
void remove(String identifier) throws GuacamoleException;
/**
* Moves the object with the given identifier to the given directory.
@@ -132,7 +131,7 @@ public interface Directory<IdentifierType, ObjectType> {
* @throws GuacamoleException If an error occurs while moving the object,
* or if moving object is not allowed.
*/
void move(IdentifierType identifier, Directory<IdentifierType, ObjectType> directory)
void move(String identifier, Directory<ObjectType> directory)
throws GuacamoleException;
}

View File

@@ -0,0 +1,52 @@
/*
* Copyright (C) 2013 Glyptodon LLC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.glyptodon.guacamole.net.auth;
/**
* An object which has a deterministic, unique identifier, which may not be
* null.
*
* @author Michael Jumper
*/
public interface Identifiable {
/**
* Returns the unique identifier assigned to this object. All identifiable
* objects must have a deterministic, unique identifier which may not be
* null.
*
* @return
* The unique identifier assigned to this object, which may not be
* null.
*/
public String getIdentifier();
/**
* Sets the identifier assigned to this object.
*
* @param identifier
* The identifier to assign.
*/
public void setIdentifier(String identifier);
}

View File

@@ -32,24 +32,7 @@ import org.glyptodon.guacamole.net.auth.permission.SystemPermissionSet;
*
* @author Michael Jumper
*/
public interface User {
/**
* Returns the name of this user, which must be unique across all users.
* All users must have a deterministic, unique username which may not be
* null.
*
* @return
* The unique username of this user, which may not be null.
*/
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);
public interface User extends Identifiable {
/**
* Returns this user's password. Note that the password returned may be
@@ -92,7 +75,7 @@ public interface User {
* If an error occurs while retrieving permissions, or if reading all
* permissions is not allowed.
*/
ObjectPermissionSet<String> getConnectionPermissions()
ObjectPermissionSet getConnectionPermissions()
throws GuacamoleException;
/**
@@ -106,7 +89,7 @@ public interface User {
* If an error occurs while retrieving permissions, or if reading all
* permissions is not allowed.
*/
ObjectPermissionSet<String> getConnectionGroupPermissions()
ObjectPermissionSet getConnectionGroupPermissions()
throws GuacamoleException;
/**
@@ -119,6 +102,6 @@ public interface User {
* If an error occurs while retrieving permissions, or if reading all
* permissions is not allowed.
*/
ObjectPermissionSet<String> getUserPermissions() throws GuacamoleException;
ObjectPermissionSet getUserPermissions() throws GuacamoleException;
}

View File

@@ -52,7 +52,7 @@ public interface UserContext {
* @throws GuacamoleException If an error occurs while creating the
* Directory.
*/
Directory<String, User> getUserDirectory() throws GuacamoleException;
Directory<User> getUserDirectory() throws GuacamoleException;
/**
* Retrieves a connection group which can be used to view and manipulate

View File

@@ -28,10 +28,8 @@ package org.glyptodon.guacamole.net.auth.permission;
* whole.
*
* @author Michael Jumper
* @param <IdentifierType>
* The type of identifier used by the object this permission affects.
*/
public class ObjectPermission<IdentifierType> implements Permission<ObjectPermission.Type> {
public class ObjectPermission implements Permission<ObjectPermission.Type> {
/**
* Specific types of object-level permissions. Each permission type is
@@ -65,7 +63,7 @@ public class ObjectPermission<IdentifierType> implements Permission<ObjectPermis
* The identifier of the GuacamoleConfiguration associated with the
* operation affected by this permission.
*/
private final IdentifierType identifier;
private final String identifier;
/**
* The type of operation affected by this permission.
@@ -84,7 +82,7 @@ public class ObjectPermission<IdentifierType> implements Permission<ObjectPermis
* The identifier of the object associated with the operation affected
* by this permission.
*/
public ObjectPermission(Type type, IdentifierType identifier) {
public ObjectPermission(Type type, String identifier) {
this.identifier = identifier;
this.type = type;
@@ -98,7 +96,7 @@ public class ObjectPermission<IdentifierType> implements Permission<ObjectPermis
* @return The identifier of the specific object affected by this
* permission.
*/
public IdentifierType getObjectIdentifier() {
public String getObjectIdentifier() {
return identifier;
}

View File

@@ -32,12 +32,8 @@ import org.glyptodon.guacamole.GuacamoleException;
* an associated unique identifier.
*
* @author Michael Jumper
* @param <IdentifierType>
* The type of identifier used to identify objects affected by permissions
* stored in this ObjectPermissionSet.
*/
public interface ObjectPermissionSet<IdentifierType>
extends PermissionSet<ObjectPermission<IdentifierType>> {
public interface ObjectPermissionSet extends PermissionSet<ObjectPermission> {
/**
* Tests whether the permission of the given type is granted for the
@@ -58,7 +54,7 @@ public interface ObjectPermissionSet<IdentifierType>
* cannot be checked due to lack of permissions to do so.
*/
boolean hasPermission(ObjectPermission.Type permission,
IdentifierType identifier) throws GuacamoleException;
String identifier) throws GuacamoleException;
/**
* Adds the specified permission for the object having the given
@@ -76,7 +72,7 @@ public interface ObjectPermissionSet<IdentifierType>
* add permissions is denied.
*/
void addPermission(ObjectPermission.Type permission,
IdentifierType identifier) throws GuacamoleException;
String identifier) throws GuacamoleException;
/**
* Removes the specified permission for the object having the given
@@ -94,7 +90,7 @@ public interface ObjectPermissionSet<IdentifierType>
* to remove permissions is denied.
*/
void removePermission(ObjectPermission.Type permission,
IdentifierType identifier) throws GuacamoleException;
String identifier) throws GuacamoleException;
/**
* Tests whether this user has the specified permissions for the objects
@@ -119,20 +115,20 @@ public interface ObjectPermissionSet<IdentifierType>
* If an error occurs while checking permissions, or if permissions
* cannot be checked due to lack of permissions to do so.
*/
Collection<IdentifierType> getAccessibleObjects(
Collection<String> getAccessibleObjects(
Collection<ObjectPermission.Type> permissions,
Collection<IdentifierType> identifiers) throws GuacamoleException;
Collection<String> identifiers) throws GuacamoleException;
@Override
Set<ObjectPermission<IdentifierType>> getPermissions()
Set<ObjectPermission> getPermissions()
throws GuacamoleException;
@Override
void addPermissions(Set<ObjectPermission<IdentifierType>> permissions)
void addPermissions(Set<ObjectPermission> permissions)
throws GuacamoleException;
@Override
void removePermissions(Set<ObjectPermission<IdentifierType>> permissions)
void removePermissions(Set<ObjectPermission> permissions)
throws GuacamoleException;
}

View File

@@ -35,7 +35,7 @@ import org.glyptodon.guacamole.protocol.GuacamoleConfiguration;
*
* @author Michael Jumper
*/
public class SimpleConnectionDirectory extends SimpleDirectory<String, Connection> {
public class SimpleConnectionDirectory extends SimpleDirectory<Connection> {
/**
* The Map of Connections to provide access to.

View File

@@ -44,13 +44,13 @@ public class SimpleConnectionGroup extends AbstractConnectionGroup {
* Underlying connection directory, containing all connections within this
* group.
*/
private final Directory<String, Connection> connectionDirectory;
private final Directory<Connection> connectionDirectory;
/**
* Underlying connection group directory, containing all connections within
* this group.
*/
private final Directory<String, ConnectionGroup> connectionGroupDirectory;
private final Directory<ConnectionGroup> connectionGroupDirectory;
/**
* Creates a new SimpleConnectionGroup having the given name and identifier
@@ -64,8 +64,8 @@ public class SimpleConnectionGroup extends AbstractConnectionGroup {
* when requested.
*/
public SimpleConnectionGroup(String name, String identifier,
Directory<String, Connection> connectionDirectory,
Directory<String, ConnectionGroup> connectionGroupDirectory) {
Directory<Connection> connectionDirectory,
Directory<ConnectionGroup> connectionGroupDirectory) {
// Set name
setName(name);
@@ -83,13 +83,13 @@ public class SimpleConnectionGroup extends AbstractConnectionGroup {
}
@Override
public Directory<String, Connection> getConnectionDirectory()
public Directory<Connection> getConnectionDirectory()
throws GuacamoleException {
return connectionDirectory;
}
@Override
public Directory<String, ConnectionGroup> getConnectionGroupDirectory()
public Directory<ConnectionGroup> getConnectionGroupDirectory()
throws GuacamoleException {
return connectionGroupDirectory;
}

View File

@@ -35,7 +35,7 @@ import org.glyptodon.guacamole.net.auth.ConnectionGroup;
* @author James Muehlner
*/
public class SimpleConnectionGroupDirectory
extends SimpleDirectory<String, ConnectionGroup> {
extends SimpleDirectory<ConnectionGroup> {
/**
* The Map of ConnectionGroups to provide access to.

View File

@@ -37,20 +37,15 @@ import org.glyptodon.guacamole.net.auth.Directory;
* will affect the available contents of this SimpleDirectory.
*
* @author Michael Jumper
* @param <IdentifierType>
* The type of identifier used to identify objects stored within this
* SimpleDirectory.
*
* @param <ObjectType>
* The type of objects stored within this SimpleDirectory.
*/
public class SimpleDirectory<IdentifierType, ObjectType>
implements Directory<IdentifierType, ObjectType> {
public class SimpleDirectory<ObjectType> implements Directory<ObjectType> {
/**
* The Map of objects to provide access to.
*/
private Map<IdentifierType, ObjectType> objects = Collections.EMPTY_MAP;
private Map<String, ObjectType> objects = Collections.EMPTY_MAP;
/**
* Creates a new empty SimpleDirectory which does not provide access to
@@ -66,7 +61,7 @@ public class SimpleDirectory<IdentifierType, ObjectType>
* @param objects
* The Map of objects to provide access to.
*/
public SimpleDirectory(Map<IdentifierType, ObjectType> objects) {
public SimpleDirectory(Map<String, ObjectType> objects) {
this.objects = objects;
}
@@ -78,7 +73,7 @@ public class SimpleDirectory<IdentifierType, ObjectType>
* @param objects
* The Map of objects to provide access to.
*/
protected void setObjects(Map<IdentifierType, ObjectType> objects) {
protected void setObjects(Map<String, ObjectType> objects) {
this.objects = objects;
}
@@ -90,25 +85,25 @@ public class SimpleDirectory<IdentifierType, ObjectType>
* @return
* The Map of objects which currently backs this SimpleDirectory.
*/
protected Map<IdentifierType, ObjectType> getObjects() {
protected Map<String, ObjectType> getObjects() {
return objects;
}
@Override
public ObjectType get(IdentifierType identifier)
public ObjectType get(String identifier)
throws GuacamoleException {
return objects.get(identifier);
}
@Override
public Collection<ObjectType> getAll(Collection<IdentifierType> identifiers)
public Collection<ObjectType> getAll(Collection<String> identifiers)
throws GuacamoleException {
// Create collection which has an appropriate initial size
Collection<ObjectType> foundObjects = new ArrayList<ObjectType>(identifiers.size());
// Populate collection with matching objects
for (IdentifierType identifier : identifiers) {
for (String identifier : identifiers) {
// Add the object which has the current identifier, if any
ObjectType object = objects.get(identifier);
@@ -122,7 +117,7 @@ public class SimpleDirectory<IdentifierType, ObjectType>
}
@Override
public Set<IdentifierType> getIdentifiers() throws GuacamoleException {
public Set<String> getIdentifiers() throws GuacamoleException {
return objects.keySet();
}
@@ -139,13 +134,12 @@ public class SimpleDirectory<IdentifierType, ObjectType>
}
@Override
public void remove(IdentifierType identifier) throws GuacamoleException {
public void remove(String identifier) throws GuacamoleException {
throw new GuacamoleSecurityException("Permission denied.");
}
@Override
public void move(IdentifierType identifier,
Directory<IdentifierType, ObjectType> directory)
public void move(String identifier, Directory<ObjectType> directory)
throws GuacamoleException {
throw new GuacamoleSecurityException("Permission denied.");
}

View File

@@ -36,17 +36,13 @@ import org.glyptodon.guacamole.net.auth.permission.ObjectPermissionSet;
* of Permissions to determine which permissions are present.
*
* @author Michael Jumper
* @param <IdentifierType>
* The type of identifier used to identify objects affected by permissions
* stored in this SimpleObjectPermissionSet.
*/
public class SimpleObjectPermissionSet<IdentifierType>
implements ObjectPermissionSet<IdentifierType> {
public class SimpleObjectPermissionSet implements ObjectPermissionSet {
/**
* The set of all permissions currently granted.
*/
private Set<ObjectPermission<IdentifierType>> permissions = Collections.EMPTY_SET;
private Set<ObjectPermission> permissions = Collections.EMPTY_SET;
/**
* Creates a new empty SimpleObjectPermissionSet.
@@ -62,7 +58,7 @@ public class SimpleObjectPermissionSet<IdentifierType>
* The Set of permissions this SimpleObjectPermissionSet should
* contain.
*/
public SimpleObjectPermissionSet(Set<ObjectPermission<IdentifierType>> permissions) {
public SimpleObjectPermissionSet(Set<ObjectPermission> permissions) {
this.permissions = permissions;
}
@@ -74,21 +70,21 @@ public class SimpleObjectPermissionSet<IdentifierType>
* The Set of permissions this SimpleObjectPermissionSet should
* contain.
*/
protected void setPermissions(Set<ObjectPermission<IdentifierType>> permissions) {
protected void setPermissions(Set<ObjectPermission> permissions) {
this.permissions = permissions;
}
@Override
public Set<ObjectPermission<IdentifierType>> getPermissions() {
public Set<ObjectPermission> getPermissions() {
return permissions;
}
@Override
public boolean hasPermission(ObjectPermission.Type permission,
IdentifierType identifier) throws GuacamoleException {
String identifier) throws GuacamoleException {
ObjectPermission<IdentifierType> objectPermission =
new ObjectPermission<IdentifierType>(permission, identifier);
ObjectPermission objectPermission =
new ObjectPermission(permission, identifier);
return permissions.contains(objectPermission);
@@ -96,29 +92,29 @@ public class SimpleObjectPermissionSet<IdentifierType>
@Override
public void addPermission(ObjectPermission.Type permission,
IdentifierType identifier) throws GuacamoleException {
String identifier) throws GuacamoleException {
throw new GuacamoleSecurityException("Permission denied.");
}
@Override
public void removePermission(ObjectPermission.Type permission,
IdentifierType identifier) throws GuacamoleException {
String identifier) throws GuacamoleException {
throw new GuacamoleSecurityException("Permission denied.");
}
@Override
public Collection<IdentifierType> getAccessibleObjects(
public Collection<String> getAccessibleObjects(
Collection<ObjectPermission.Type> permissionTypes,
Collection<IdentifierType> identifiers) throws GuacamoleException {
Collection<String> identifiers) throws GuacamoleException {
Collection<IdentifierType> accessibleObjects = new ArrayList<IdentifierType>(permissions.size());
Collection<String> accessibleObjects = new ArrayList<String>(permissions.size());
// For each identifier/permission combination
for (IdentifierType identifier : identifiers) {
for (String identifier : identifiers) {
for (ObjectPermission.Type permissionType : permissionTypes) {
// Add identifier if at least one requested permission is granted
ObjectPermission<IdentifierType> permission = new ObjectPermission<IdentifierType>(permissionType, identifier);
ObjectPermission permission = new ObjectPermission(permissionType, identifier);
if (permissions.contains(permission)) {
accessibleObjects.add(identifier);
break;
@@ -132,13 +128,13 @@ public class SimpleObjectPermissionSet<IdentifierType>
}
@Override
public void addPermissions(Set<ObjectPermission<IdentifierType>> permissions)
public void addPermissions(Set<ObjectPermission> permissions)
throws GuacamoleException {
throw new GuacamoleSecurityException("Permission denied.");
}
@Override
public void removePermissions(Set<ObjectPermission<IdentifierType>> permissions)
public void removePermissions(Set<ObjectPermission> permissions)
throws GuacamoleException {
throw new GuacamoleSecurityException("Permission denied.");
}

View File

@@ -28,9 +28,7 @@ import java.util.Map;
import java.util.Set;
import org.glyptodon.guacamole.GuacamoleException;
import org.glyptodon.guacamole.net.auth.AbstractUser;
import org.glyptodon.guacamole.net.auth.Connection;
import org.glyptodon.guacamole.net.auth.ConnectionGroup;
import org.glyptodon.guacamole.net.auth.User;
import org.glyptodon.guacamole.net.auth.permission.ObjectPermission;
import org.glyptodon.guacamole.net.auth.permission.ObjectPermissionSet;
import org.glyptodon.guacamole.net.auth.permission.SystemPermissionSet;
@@ -46,14 +44,14 @@ public class SimpleUser extends AbstractUser {
/**
* All connection permissions granted to this user.
*/
private final Set<ObjectPermission<String>> connectionPermissions =
new HashSet<ObjectPermission<String>>();
private final Set<ObjectPermission> connectionPermissions =
new HashSet<ObjectPermission>();
/**
* All connection group permissions granted to this user.
*/
private final Set<ObjectPermission<String>> connectionGroupPermissions =
new HashSet<ObjectPermission<String>>();
private final Set<ObjectPermission> connectionGroupPermissions =
new HashSet<ObjectPermission>();
/**
* Creates a completely uninitialized SimpleUser.
@@ -73,7 +71,7 @@ public class SimpleUser extends AbstractUser {
Collection<ConnectionGroup> groups) {
// Set username
setUsername(username);
setIdentifier(username);
// Add connection permissions
for (String identifier : configs.keySet()) {
@@ -112,21 +110,21 @@ public class SimpleUser extends AbstractUser {
}
@Override
public ObjectPermissionSet<String> getConnectionPermissions()
public ObjectPermissionSet getConnectionPermissions()
throws GuacamoleException {
return new SimpleObjectPermissionSet<String>(connectionPermissions);
return new SimpleObjectPermissionSet(connectionPermissions);
}
@Override
public ObjectPermissionSet<String> getConnectionGroupPermissions()
public ObjectPermissionSet getConnectionGroupPermissions()
throws GuacamoleException {
return new SimpleObjectPermissionSet<String>(connectionGroupPermissions);
return new SimpleObjectPermissionSet(connectionGroupPermissions);
}
@Override
public ObjectPermissionSet<String> getUserPermissions()
public ObjectPermissionSet getUserPermissions()
throws GuacamoleException {
return new SimpleObjectPermissionSet<String>();
return new SimpleObjectPermissionSet();
}
}

View File

@@ -51,7 +51,7 @@ public class SimpleUserContext implements UserContext {
* The Directory with access only to the User associated with this
* UserContext.
*/
private final Directory<String, User> userDirectory;
private final Directory<User> userDirectory;
/**
* The ConnectionGroup with access only to those Connections that the User
@@ -102,7 +102,7 @@ public class SimpleUserContext implements UserContext {
}
@Override
public Directory<String, User> getUserDirectory()
public Directory<User> getUserDirectory()
throws GuacamoleException {
return userDirectory;
}

View File

@@ -31,7 +31,7 @@ import org.glyptodon.guacamole.net.auth.User;
*
* @author Michael Jumper
*/
public class SimpleUserDirectory extends SimpleDirectory<String, User> {
public class SimpleUserDirectory extends SimpleDirectory<User> {
/**
* Creates a new SimpleUserDirectory which provides access to the single
@@ -40,7 +40,7 @@ public class SimpleUserDirectory extends SimpleDirectory<String, User> {
* @param user The user to provide access to.
*/
public SimpleUserDirectory(User user) {
super(Collections.singletonMap(user.getUsername(), user));
super(Collections.singletonMap(user.getIdentifier(), user));
}
}