cs_brandt
cs_brandt

Reputation: 1167

How to determine current active users in CouchDB?

Is it possible to query current active sessions with couchdb?

The server is able to keep track of sessions based on the timeout value so how would I figure out what users have an active session?

Upvotes: 2

Views: 225

Answers (1)

Kxepal
Kxepal

Reputation: 4679

CouchDB doesn't knows anything about active sessions. These "sessions" are actually based on HTTP Cookie, which holds username, timestamp and signature hash. When CouchDB handling the request, it decodes cookie's AuthSession value and verifies that:

  • Username is correct and exists
  • Timestamp + TTL isn't lesser than current time
  • Signature is valid

If all these conditions are ok: request is accepted for further processing. If Timestamp is closer to expiration border, CouchDB updates the cookie to make the "session" last longer.

For this scheme there is no reason and need to maintain internal list of active sessions.

Upvotes: 4

Related Questions