mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 05:07:41 +00:00
GUACAMOLE-360: Allow connections to active connections at API level.
This commit is contained in:
@@ -20,13 +20,18 @@
|
|||||||
package org.apache.guacamole.net.auth;
|
package org.apache.guacamole.net.auth;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.apache.guacamole.GuacamoleException;
|
||||||
|
import org.apache.guacamole.GuacamoleSecurityException;
|
||||||
import org.apache.guacamole.net.GuacamoleTunnel;
|
import org.apache.guacamole.net.GuacamoleTunnel;
|
||||||
|
import org.apache.guacamole.protocol.GuacamoleClientInformation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A pairing of username and GuacamoleTunnel representing an active usage of a
|
* A pairing of username and GuacamoleTunnel representing an active usage of a
|
||||||
* particular connection.
|
* particular connection.
|
||||||
*/
|
*/
|
||||||
public interface ActiveConnection extends Identifiable, Shareable<SharingProfile> {
|
public interface ActiveConnection extends Identifiable, Connectable,
|
||||||
|
Shareable<SharingProfile> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the identifier of the connection being actively used. Unlike the
|
* Returns the identifier of the connection being actively used. Unlike the
|
||||||
@@ -136,5 +141,31 @@ public interface ActiveConnection extends Identifiable, Shareable<SharingProfile
|
|||||||
* The connected GuacamoleTunnel, or null if permission is denied.
|
* The connected GuacamoleTunnel, or null if permission is denied.
|
||||||
*/
|
*/
|
||||||
void setTunnel(GuacamoleTunnel tunnel);
|
void setTunnel(GuacamoleTunnel tunnel);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether this ActiveConnection may be joined through a call to
|
||||||
|
* {@link #connect(org.apache.guacamole.protocol.GuacamoleClientInformation, java.util.Map)}
|
||||||
|
* by the user that retrieved this ActiveConnection.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* true if the user that retrieved this ActiveConnection may join the
|
||||||
|
* ActiveConnection through a call to
|
||||||
|
* {@link #connect(org.apache.guacamole.protocol.GuacamoleClientInformation, java.util.Map)},
|
||||||
|
* false otherwise.
|
||||||
|
*/
|
||||||
|
default boolean isConnectable() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
default GuacamoleTunnel connect(GuacamoleClientInformation info,
|
||||||
|
Map<String, String> tokens) throws GuacamoleException {
|
||||||
|
throw new GuacamoleSecurityException("Permission denied.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
default int getActiveConnections() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -54,6 +54,11 @@ public class APIActiveConnection {
|
|||||||
*/
|
*/
|
||||||
private final String username;
|
private final String username;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether this active connection may be connected to.
|
||||||
|
*/
|
||||||
|
private final boolean connectable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new APIActiveConnection, copying the information from the given
|
* Creates a new APIActiveConnection, copying the information from the given
|
||||||
* active connection.
|
* active connection.
|
||||||
@@ -67,6 +72,7 @@ public class APIActiveConnection {
|
|||||||
this.startDate = connection.getStartDate();
|
this.startDate = connection.getStartDate();
|
||||||
this.remoteHost = connection.getRemoteHost();
|
this.remoteHost = connection.getRemoteHost();
|
||||||
this.username = connection.getUsername();
|
this.username = connection.getUsername();
|
||||||
|
this.connectable = connection.isConnectable();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -121,5 +127,16 @@ public class APIActiveConnection {
|
|||||||
public String getIdentifier() {
|
public String getIdentifier() {
|
||||||
return identifier;
|
return identifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Returns whether this active connection may be connected to, just as a
|
||||||
|
* normal connection.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* true if this active connection may be connected to, false otherwise.
|
||||||
|
*/
|
||||||
|
public boolean isConnectable() {
|
||||||
|
return connectable;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -76,6 +76,14 @@ angular.module('rest').factory('ActiveConnection', [function defineActiveConnect
|
|||||||
*/
|
*/
|
||||||
this.username = template.username;
|
this.username = template.username;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether this active connection may be connected to, just as a
|
||||||
|
* normal connection.
|
||||||
|
*
|
||||||
|
* @type Boolean
|
||||||
|
*/
|
||||||
|
this.connectable = template.connectable;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return ActiveConnection;
|
return ActiveConnection;
|
||||||
|
Reference in New Issue
Block a user