public ActiveConnection getActiveConnection ( ) throws GuacamoleException { // Pull the UUID of the current tunnel UUID uuid = getUUID ( ) ; // Get the directory of active connections Directory < ActiveConnection > activeConnectionDirectory = userContext . getActiveConnectionDirectory ( ) ; Collection < String > activeConnectionIdentifiers = activeConnectionDirectory . getIdentifiers ( ) ; // Search all connections for a tunnel which matches this tunnel for ( ActiveConnection activeConnection : activeConnectionDirectory . getAll ( activeConnectionIdentifiers ) ) { // If we lack access, continue with next tunnel GuacamoleTunnel tunnel = activeConnection . getTunnel ( ) ; if ( tunnel == null ) continue ; // Tunnels are equivalent if they have the same UUID if ( uuid . equals ( tunnel . getUUID ( ) ) ) return activeConnection ; } // No active connection associated with this tunnel return null ; }
Returns the ActiveConnection object associated with this tunnel within the AuthenticationProvider and UserContext which created the tunnel . If the AuthenticationProvider is not tracking active connections or this tunnel is no longer active this will be null .