mirror of
				https://github.com/gyurix1968/guacamole-client.git
				synced 2025-10-31 00:53:21 +00:00 
			
		
		
		
	GUAC-919: Implement basic session invalidate().
This commit is contained in:
		| @@ -26,7 +26,6 @@ import java.lang.reflect.InvocationTargetException; | ||||
| import java.util.ArrayList; | ||||
| import java.util.Collection; | ||||
| import java.util.Collections; | ||||
| import java.util.Date; | ||||
| import java.util.Map; | ||||
| import java.util.concurrent.ConcurrentHashMap; | ||||
| import org.glyptodon.guacamole.GuacamoleException; | ||||
| @@ -35,6 +34,8 @@ import org.glyptodon.guacamole.net.auth.Credentials; | ||||
| import org.glyptodon.guacamole.net.auth.UserContext; | ||||
| import org.glyptodon.guacamole.net.basic.properties.BasicGuacamoleProperties; | ||||
| import org.glyptodon.guacamole.properties.GuacamoleProperties; | ||||
| import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | ||||
|  | ||||
| /** | ||||
|  * Contains Guacamole-specific user information which is tied to the current | ||||
| @@ -44,6 +45,11 @@ import org.glyptodon.guacamole.properties.GuacamoleProperties; | ||||
|  */ | ||||
| public class GuacamoleSession { | ||||
|  | ||||
|     /** | ||||
|      * Logger for this class. | ||||
|      */ | ||||
|     private static final Logger logger = LoggerFactory.getLogger(GuacamoleSession.class); | ||||
|  | ||||
|     /** | ||||
|      * The credentials provided when the user logged in. | ||||
|      */ | ||||
| @@ -234,5 +240,23 @@ public class GuacamoleSession { | ||||
|     public long getLastAccessedTime() { | ||||
|         return lastAccessedTime; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Closes all associated tunnels and prevents any further use of this | ||||
|      * session. | ||||
|      */ | ||||
|     public void invalidate() { | ||||
|  | ||||
|         // Close all associated tunnels, if possible | ||||
|         for (GuacamoleTunnel tunnel : tunnels.values()) { | ||||
|             try { | ||||
|                 tunnel.close(); | ||||
|             } | ||||
|             catch (GuacamoleException e) { | ||||
|                 logger.debug("Unable to close tunnel.", e); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|     } | ||||
|      | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user