Think of the key as a session id. You generate it once the user comes to your site...
cherrypy.session['_csrf_token'] = ''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(16))
then you set that id in the user's cookies and you compare the two keys to be sure you have the same user. That is the concept behind using the 'tools.sessions.on': True, setting in cherrypy. This allows you to know a user from one page to another in a stateless environment such as http.
https://cherrypy.readthedocs.org/en/3.3.0/refman/lib/auth_digest.html#cherrypy.lib.auth_digest.HttpDigestAuthorization.validate_nonce
**
validate_nonce(s, key)
Validate the nonce. Returns True if nonce was generated by synthesize_nonce() and the timestamp is not spoofed, else returns False.
s
A string related to the resource, such as the hostname of the server.
key
A secret string known only to the server.
Both s and key must be the same values which were used to synthesize the nonce we are trying to validate.
**
looks like forcing a logout with auth digest is not possible...
https://groups.google.com/d/msg/cherrypy-users/M-GUFH2mU_M/45zHnA5Y6XMJ
Here's more details on the digest authentication...
What is digest authentication?
But this is a simple authenication where you can force a logout...
How to logout from a simple web appl. in CherryPy, Python
Hope this helps!