GUAC-1132: Modify API to support listing of active connections and host information.

This commit is contained in:
Michael Jumper
2015-03-16 14:26:56 -07:00
parent 093a5a0dd9
commit 3603155f36
8 changed files with 108 additions and 4 deletions

View File

@@ -23,6 +23,7 @@
package org.glyptodon.guacamole.net.auth;
import java.util.Date;
import org.glyptodon.guacamole.net.GuacamoleSocket;
/**
* A logging record describing when a user started and ended usage of a
@@ -47,6 +48,17 @@ public interface ConnectionRecord {
*/
public Date getEndDate();
/**
* Returns the hostname or IP address of the remote host that used the
* connection associated with this record, if known. If the hostname or IP
* address is not known, null is returned.
*
* @return
* The hostname or IP address of the remote host, or null if this
* information is not available.
*/
public String getRemoteHost();
/**
* Returns the name of the user who used or is using the connection at the
* times given by this connection record.
@@ -65,4 +77,15 @@ public interface ConnectionRecord {
*/
public boolean isActive();
/**
* Returns the connected GuacamoleSocket of the connection associated with
* this record, if any. If the connection is not active, or access to
* the socket is denied, null is returned.
*
* @return
* The connected GuacamoleSocket, if any, or null if the connection is
* not active or permission is denied.
*/
public GuacamoleSocket getActiveSocket();
}

View File

@@ -22,6 +22,7 @@
package org.glyptodon.guacamole.net.auth;
import java.util.Collection;
import org.glyptodon.guacamole.GuacamoleException;
/**
@@ -95,4 +96,20 @@ public interface UserContext {
*/
ConnectionGroup getRootConnectionGroup() throws GuacamoleException;
/**
* Returns a collection of connection records associated with all active
* connections to which the current user has access. For an administrative
* user, this may include connections associated with other users.
*
* @return
* A collection of all connection records associated with active
* connections to which the current user has access.
*
* @throws GuacamoleException
* If an error occurs while reading active connection records, or if
* permission is denied.
*/
Collection<ConnectionRecord> getActiveConnections()
throws GuacamoleException;
}

View File

@@ -30,6 +30,7 @@ import java.util.UUID;
import org.glyptodon.guacamole.GuacamoleException;
import org.glyptodon.guacamole.net.auth.Connection;
import org.glyptodon.guacamole.net.auth.ConnectionGroup;
import org.glyptodon.guacamole.net.auth.ConnectionRecord;
import org.glyptodon.guacamole.net.auth.Directory;
import org.glyptodon.guacamole.net.auth.User;
import org.glyptodon.guacamole.net.auth.UserContext;
@@ -167,4 +168,10 @@ public class SimpleUserContext implements UserContext {
return rootGroup;
}
@Override
public Collection<ConnectionRecord> getActiveConnections()
throws GuacamoleException {
return Collections.EMPTY_LIST;
}
}