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);
            }
        }

        // Invalidate all user contextx
        for (UserContext userContext : userContexts)
            userContext.invalidate();

        // Invalidate the authenticated user object
        authenticatedUser.invalidate();

        // Advise any registered listeners that the user's session is now
        // invalidated
        try {
            listenerService.handleEvent(new UserSessionInvalidatedEvent() {

                @Override
                public AuthenticatedUser getAuthenticatedUser() {
                    return authenticatedUser;
                }

            });
        }
        catch (GuacamoleException e) {
            logger.error("An extension listening for session invalidation failed: {}", e.getMessage());
            logger.debug("Extension failed internally while handling the session invalidation event.", e);
        }

    }
Closes all associated tunnels and prevents any further use of this
session.
guacamole/src/main/java/org/apache/guacamole/GuacamoleSession.java