Starlette: SessionMiddleware

Created on 6 Oct 2018  ·  3Comments  ·  Source: encode/starlette

Implement a session middleware that adds a mutable dict-like “session” interface into the scope.

The interface should track if it has been mutated. Loading the session data given the incoming request cookies, and saving any modified sessions in outgoing response cookies should be handled by a SessionBackend, so that we separate out the session load/save mechanics from the session interface itself.

Most helpful comment

This would also put us in a position to think about generic login/logout views, and think about how other authentications fit in here.

All 3 comments

We’ll want to at least provide in-memory session backend (testing only), a signed cookie session backend (ala flask). More complete implementations would include redis or database stored sessions.

This would also put us in a position to think about generic login/logout views, and think about how other authentications fit in here.

We have this now.
Later date: Alternative session backends, Login/Logout views etc...

Was this page helpful?
0 / 5 - 0 ratings