cockpit-project/cockpit — pull request #608 by stefwalter (2014-05-23 08:15:20+00:00)
Title: ws: Fix logout, disconnect, refresh logic

First of all decouple the object references of CockpitWebService
from the logged in state. We don't want an erroneous ref leak to
become a security issue.

After the last WebSocket disconnects we wait for 15 seconds before
discarding the credentials. This allows refreshes to work, and is
exactly the same logic for holding the credentials between /login
and the first WebSocket connecting.

Using "Log out" (ie: /logout) still works as expected and discards
credentials and login state immediately, disconnecting all
WebSockets and so on.