mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUAC-1115: Do not require config base DN if not storing connections.
This commit is contained in:
@@ -117,18 +117,19 @@ public class ConfigurationService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the base DN under which all Guacamole configurations
|
* Returns the base DN under which all Guacamole configurations
|
||||||
* (connections) will be stored within the LDAP directory.
|
* (connections) will be stored within the LDAP directory. If Guacamole
|
||||||
|
* configurations will not be stored within LDAP, null is returned.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
* The base DN under which all Guacamole configurations will be stored
|
* The base DN under which all Guacamole configurations will be stored
|
||||||
* within the LDAP directory.
|
* within the LDAP directory, or null if no Guacamole configurations
|
||||||
|
* will be stored within the LDAP directory.
|
||||||
*
|
*
|
||||||
* @throws GuacamoleException
|
* @throws GuacamoleException
|
||||||
* If guacamole.properties cannot be parsed, or if the configuration
|
* If guacamole.properties cannot be parsed.
|
||||||
* base DN property is not specified.
|
|
||||||
*/
|
*/
|
||||||
public String getConfigurationBaseDN() throws GuacamoleException {
|
public String getConfigurationBaseDN() throws GuacamoleException {
|
||||||
return environment.getRequiredProperty(
|
return environment.getProperty(
|
||||||
LDAPGuacamoleProperties.LDAP_CONFIG_BASE_DN
|
LDAPGuacamoleProperties.LDAP_CONFIG_BASE_DN
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@@ -28,6 +28,7 @@ import com.novell.ldap.LDAPConnection;
|
|||||||
import com.novell.ldap.LDAPEntry;
|
import com.novell.ldap.LDAPEntry;
|
||||||
import com.novell.ldap.LDAPException;
|
import com.novell.ldap.LDAPException;
|
||||||
import com.novell.ldap.LDAPSearchResults;
|
import com.novell.ldap.LDAPSearchResults;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -86,6 +87,11 @@ public class ConnectionService {
|
|||||||
public Map<String, Connection> getConnections(LDAPConnection ldapConnection)
|
public Map<String, Connection> getConnections(LDAPConnection ldapConnection)
|
||||||
throws GuacamoleException {
|
throws GuacamoleException {
|
||||||
|
|
||||||
|
// Do not return any connections if base DN is not specified
|
||||||
|
String configurationBaseDN = confService.getConfigurationBaseDN();
|
||||||
|
if (configurationBaseDN == null)
|
||||||
|
return Collections.<String, Connection>emptyMap();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// Pull the current user DN from the LDAP connection
|
// Pull the current user DN from the LDAP connection
|
||||||
@@ -98,7 +104,7 @@ public class ConnectionService {
|
|||||||
|
|
||||||
// Find all Guacamole connections for the given user
|
// Find all Guacamole connections for the given user
|
||||||
LDAPSearchResults results = ldapConnection.search(
|
LDAPSearchResults results = ldapConnection.search(
|
||||||
confService.getConfigurationBaseDN(),
|
configurationBaseDN,
|
||||||
LDAPConnection.SCOPE_SUB,
|
LDAPConnection.SCOPE_SUB,
|
||||||
"(&(objectClass=guacConfigGroup)(member=" + escapingService.escapeLDAPSearchFilter(userDN) + "))",
|
"(&(objectClass=guacConfigGroup)(member=" + escapingService.escapeLDAPSearchFilter(userDN) + "))",
|
||||||
null,
|
null,
|
||||||
|
Reference in New Issue
Block a user