Ticket #263: Refined guacamole-ext.

This commit is contained in:
James Muehlner
2013-07-22 23:32:41 -07:00
parent 9cfb20d26e
commit aae2a8068a
5 changed files with 57 additions and 88 deletions

View File

@@ -52,7 +52,7 @@ import net.sourceforge.guacamole.protocol.GuacamoleConfiguration;
*
* @author Michael Jumper
*/
public interface Connection extends ConnectionGroupMember {
public interface Connection {
/**
* Returns the unique identifier assigned to this Connection.

View File

@@ -37,21 +37,18 @@ package net.sourceforge.guacamole.net.auth;
*
* ***** END LICENSE BLOCK ***** */
import java.util.Collection;
import net.sourceforge.guacamole.GuacamoleException;
import net.sourceforge.guacamole.net.GuacamoleSocket;
import net.sourceforge.guacamole.protocol.GuacamoleClientInformation;
/**
* Represents a pairing of a GuacamoleConfiguration with a unique,
* human-readable identifier, and abstracts the connection process. The
* backing GuacamoleConfiguration may be intentionally obfuscated or tokenized
* to protect sensitive configuration information.
* Represents a connection group, which can contain both other connection groups
* as well as connections.
*
* @author James Muehlner
*/
public interface ConnectionGroup extends ConnectionGroupMember {
public interface ConnectionGroup {
/**
* Returns the unique identifier assigned to this ConnectionGroup.
@@ -60,24 +57,39 @@ public interface ConnectionGroup extends ConnectionGroupMember {
public String getIdentifier();
/**
* Sets the identifier assigned to this Connection group.
* Sets the identifier assigned to this ConnectionGroup.
*
* @param identifier The identifier to assign.
*/
public void setIdentifier(String identifier);
/**
* Returns all members of this ConnectionGroup.
* @return all members of this ConnectionGroup.
* 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.
*
* @return A Directory whose operations are bound by the permissions of
* the user.
*
* @throws GuacamoleException If an error occurs while creating the
* Directory.
*/
public Collection<ConnectionGroupMember> getMembers();
Directory<String, Connection> getConnectionDirectory()
throws GuacamoleException;
/**
* Sets the new members for this ConnectionGroup.
*
* @param members The new members for this grouConnectionGroupp.
* Retrieves a Directory which can be used to view and manipulate
* connection groups and their members, but only as allowed by the
* permissions given to the user.
*
* @return A Directory whose operations are bound by the permissions of
* the user.
*
* @throws GuacamoleException If an error occurs while creating the
* Directory.
*/
public void setMembers(Collection<ConnectionGroupMember> members);
Directory<String, ConnectionGroup> getConnectionGroupDirectory()
throws GuacamoleException;
/**
* Establishes a connection to guacd using a connection chosen from among

View File

@@ -1,46 +0,0 @@
package net.sourceforge.guacamole.net.auth;
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is guacamole-ext.
*
* The Initial Developer of the Original Code is
* Michael Jumper.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): James Muehlner
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/**
* Represents a constituent member of a ConnectionGroup.
*
* @author James Muehlner
*/
public interface ConnectionGroupMember {}

View File

@@ -69,32 +69,18 @@ public interface UserContext {
*/
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;
/**
* Retrieves a Directory which can be used to view and manipulate
* connection groups and their members, but only as allowed by the
* permissions given to the user of this UserContext.
* Retrieves a connection group which can be used to view and manipulate
* connections, but only as allowed by the permissions given to the user of
* this UserContext.
*
* @return A Directory whose operations are bound by the restrictions
* @return A connection group whose operations are bound by the restrictions
* of this UserContext.
*
* @throws GuacamoleException If an error occurs while creating the
* Directory.
*/
Directory<String, ConnectionGroup> getConnectionGroupDirectory()
throws GuacamoleException;
ConnectionGroup getConnectionGroup() throws GuacamoleException;
}

View File

@@ -40,6 +40,7 @@ package net.sourceforge.guacamole.net.auth.simple;
import java.util.Map;
import net.sourceforge.guacamole.GuacamoleException;
import net.sourceforge.guacamole.net.auth.Connection;
import net.sourceforge.guacamole.net.auth.ConnectionGroup;
import net.sourceforge.guacamole.net.auth.Directory;
import net.sourceforge.guacamole.net.auth.User;
import net.sourceforge.guacamole.net.auth.UserContext;
@@ -66,12 +67,24 @@ public class SimpleUserContext implements UserContext {
*/
private final Directory<String, Connection> connectionDirectory;
/**
* The Directory with access only to those Connection Groups that the User
* associated with this UserContext has access to.
*/
private final Directory<String, ConnectionGroup> connectionGroupDirectory;
/**
* The Directory with access only to the User associated with this
* UserContext.
*/
private final Directory<String, User> userDirectory;
/**
* The ConnectionGroup with access only to those Connections that the User
* associated with this UserContext has access to.
*/
private final ConnectionGroup connectionGroup;
/**
* Creates a new SimpleUserContext which provides access to only those
* configurations within the given Map. The User given must be the user
@@ -89,8 +102,13 @@ public class SimpleUserContext implements UserContext {
this.connectionDirectory =
new SimpleConnectionDirectory(configs);
this.connectionGroupDirectory = new SimpleConnectionGroupDirectory();
this.userDirectory = new SimpleUserDirectory(self);
this.connectionGroup = new SimpleConnectionGroup(this.connectionDirectory,
this.connectionGroupDirectory);
}
@@ -99,16 +117,15 @@ public class SimpleUserContext implements UserContext {
return self;
}
@Override
public Directory<String, Connection> getConnectionDirectory()
throws GuacamoleException {
return connectionDirectory;
}
@Override
public Directory<String, User> getUserDirectory()
throws GuacamoleException {
return userDirectory;
}
@Override
public ConnectionGroup getConnectionGroup() throws GuacamoleException {
return connectionGroup;
}
}