GUAC-586: Ensure parent is properly set on LDAP connections.

This commit is contained in:
Michael Jumper
2015-09-01 01:45:40 -07:00
parent 71052fa126
commit 8dff06c819
3 changed files with 12 additions and 7 deletions

View File

@@ -42,6 +42,11 @@ import org.glyptodon.guacamole.net.auth.UserContext;
*/ */
public class LDAPAuthenticationProvider implements AuthenticationProvider { public class LDAPAuthenticationProvider implements AuthenticationProvider {
/**
* The identifier reserved for the root connection group.
*/
public static final String ROOT_CONNECTION_GROUP = "ROOT";
/** /**
* Injector which will manage the object graph of this authentication * Injector which will manage the object graph of this authentication
* provider. * provider.

View File

@@ -31,6 +31,7 @@ import com.novell.ldap.LDAPSearchResults;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import net.sourceforge.guacamole.net.auth.ldap.LDAPAuthenticationProvider;
import org.glyptodon.guacamole.auth.ldap.ConfigurationService; import org.glyptodon.guacamole.auth.ldap.ConfigurationService;
import org.glyptodon.guacamole.auth.ldap.EscapingService; import org.glyptodon.guacamole.auth.ldap.EscapingService;
import org.glyptodon.guacamole.GuacamoleException; import org.glyptodon.guacamole.GuacamoleException;
@@ -153,7 +154,9 @@ public class ConnectionService {
// Store connection using cn for both identifier and name // Store connection using cn for both identifier and name
String name = cn.getStringValue(); String name = cn.getStringValue();
connections.put(name, new SimpleConnection(name, name, config)); Connection connection = new SimpleConnection(name, name, config);
connection.setParentIdentifier(LDAPAuthenticationProvider.ROOT_CONNECTION_GROUP);
connections.put(name, connection);
} }

View File

@@ -26,6 +26,7 @@ import com.google.inject.Inject;
import com.novell.ldap.LDAPConnection; import com.novell.ldap.LDAPConnection;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import net.sourceforge.guacamole.net.auth.ldap.LDAPAuthenticationProvider;
import org.glyptodon.guacamole.auth.ldap.connection.ConnectionService; import org.glyptodon.guacamole.auth.ldap.connection.ConnectionService;
import org.glyptodon.guacamole.GuacamoleException; import org.glyptodon.guacamole.GuacamoleException;
import org.glyptodon.guacamole.form.Form; import org.glyptodon.guacamole.form.Form;
@@ -56,11 +57,6 @@ public class UserContext implements org.glyptodon.guacamole.net.auth.UserContext
*/ */
private final Logger logger = LoggerFactory.getLogger(UserContext.class); private final Logger logger = LoggerFactory.getLogger(UserContext.class);
/**
* The identifier reserved for the root connection group.
*/
private static final String ROOT_CONNECTION_GROUP = "ROOT";
/** /**
* Service for retrieving Guacamole connections from the LDAP server. * Service for retrieving Guacamole connections from the LDAP server.
*/ */
@@ -141,7 +137,8 @@ public class UserContext implements org.glyptodon.guacamole.net.auth.UserContext
// Root group contains only connections // Root group contains only connections
rootGroup = new SimpleConnectionGroup( rootGroup = new SimpleConnectionGroup(
ROOT_CONNECTION_GROUP, ROOT_CONNECTION_GROUP, LDAPAuthenticationProvider.ROOT_CONNECTION_GROUP,
LDAPAuthenticationProvider.ROOT_CONNECTION_GROUP,
connectionDirectory.getIdentifiers(), connectionDirectory.getIdentifiers(),
Collections.<String>emptyList() Collections.<String>emptyList()
); );