Closed amcgregor closed 8 years ago
Also, optional transaction support for rolling sessions back on error.
Disagree about the backends. My list of backends:
Pure cookie sessions are not worth the effort IMO, because they can't be invalidated. Or they can, but would require a server-side revocation list, which would completely defeat the purpose.
Unless of course the point is to have the authentication layer refresh the user info on every request?
Provide a generalized and extensible session service provider. (An extension that extends the context.)
The API should be Beaker-ish, that is, a UserDict subclass with additional attributes:
id
— the session identifier, whatever it may be. (E.g. a 40 character SHA.)last_accessed
— the UTC datetime the session was last loaded, None if newsave()
— mark the session for saving at the end of the request (w/ autosave configuration)persist()
— immediately commit the session to the back-enddelete()
— expire the session and call the back-end to clean upinvalidate()
— delete the current session then immediately create a new oneTwo internal keys should be provided and maintained:
_accessed_time
— the UTC datetime the session was loaded_creation_time
— the UTC datetime the session was createdBack-ends:
memory
— in-memory sessionscookie
— pure cookie sessions (crypto!)user
— simplified callbacks (a la web.auth)disk
— very simple on-disk sessionsbeaker
— the full power of beaker