mirror of
				https://github.com/gyurix1968/guacamole-client.git
				synced 2025-10-30 00:23:21 +00:00 
			
		
		
		
	Get credentials and configs from AuthenticatingHttpServlet, allow main HTTP tunnel servlet to take care of attach().
This commit is contained in:
		| @@ -29,8 +29,8 @@ import net.sourceforge.guacamole.net.InetGuacamoleSocket; | |||||||
| import net.sourceforge.guacamole.protocol.GuacamoleConfiguration; | import net.sourceforge.guacamole.protocol.GuacamoleConfiguration; | ||||||
| import net.sourceforge.guacamole.properties.GuacamoleProperties; | import net.sourceforge.guacamole.properties.GuacamoleProperties; | ||||||
| import net.sourceforge.guacamole.net.GuacamoleSocket; | import net.sourceforge.guacamole.net.GuacamoleSocket; | ||||||
| import net.sourceforge.guacamole.servlet.GuacamoleSession; |  | ||||||
| import net.sourceforge.guacamole.net.GuacamoleTunnel; | import net.sourceforge.guacamole.net.GuacamoleTunnel; | ||||||
|  | import net.sourceforge.guacamole.net.auth.Credentials; | ||||||
| import net.sourceforge.guacamole.protocol.ConfiguredGuacamoleSocket; | import net.sourceforge.guacamole.protocol.ConfiguredGuacamoleSocket; | ||||||
| import net.sourceforge.guacamole.servlet.GuacamoleHTTPTunnelServlet; | import net.sourceforge.guacamole.servlet.GuacamoleHTTPTunnelServlet; | ||||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||||
| @@ -71,12 +71,14 @@ public class BasicGuacamoleTunnelServlet extends AuthenticatingHttpServlet { | |||||||
|             // Get ID of connection |             // Get ID of connection | ||||||
|             String id = request.getParameter("id"); |             String id = request.getParameter("id"); | ||||||
|              |              | ||||||
|             // Get authorized configs |             // Get credentials | ||||||
|             Map<String, GuacamoleConfiguration> configs = (Map<String, GuacamoleConfiguration>)  |             Credentials credentials = getCredentials(httpSession); | ||||||
|                     httpSession.getAttribute("GUAC_CONFIGS"); |  | ||||||
|              |              | ||||||
|             // If no configs in session, not authorized |             // Get authorized configs | ||||||
|             if (configs == null) |             Map<String, GuacamoleConfiguration> configs = getConfigurations(httpSession); | ||||||
|  |  | ||||||
|  |             // If no configs/credentials in session, not authorized | ||||||
|  |             if (credentials == null || configs == null) | ||||||
|                 throw new GuacamoleException("Cannot connect - user not logged in."); |                 throw new GuacamoleException("Cannot connect - user not logged in."); | ||||||
|  |  | ||||||
|             // Get authorized config |             // Get authorized config | ||||||
| @@ -100,10 +102,6 @@ public class BasicGuacamoleTunnelServlet extends AuthenticatingHttpServlet { | |||||||
|             // Associate socket with tunnel |             // Associate socket with tunnel | ||||||
|             GuacamoleTunnel tunnel = new GuacamoleTunnel(socket); |             GuacamoleTunnel tunnel = new GuacamoleTunnel(socket); | ||||||
|  |  | ||||||
|             // Attach tunnel to session |  | ||||||
|             GuacamoleSession session = new GuacamoleSession(httpSession); |  | ||||||
|             session.attachTunnel(tunnel); |  | ||||||
|  |  | ||||||
|             return tunnel; |             return tunnel; | ||||||
|  |  | ||||||
|         } |         } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user