Question

I'm trying to follow the instructions here (http://docs.pylonsproject.org/projects/pyramid_beaker/en/latest/) so I can setup a session/login system. The instructions are confusing me greatly. What exactly is the "default activation setup"? Does that mean there is already a config for the session factory when I call config.include('pyramid_beaker'), so that calling pyramid_beaker.BeakerSessionFactoryConfig() is unnecessary?

What's the easiest way I can a secure login/permissions system working with pyramid_beaker?

Was it helpful?

Solution

Beaker is a library for handling caching and sessions (i.e. non-persistent data). You can hijack a session and use it to store whether a user is logged in (request.session['user_id'] = some_id or via pyramid.authentication.SessionAuthenticationPolicy). Both of these will simply store/track the current userid in a session instead of in some other cookie. Note, however, this has nothing to do with permissions or the workflow you use for handling user credentials and logging them in.

Yes, config.include('pyramid_beaker') will automatically configure the cache regions and session factory for you via your INI settings (those settings are documented in the link you supplied as well as the separate beaker docs).

The easiest way to setup a login/permissions system around this idea is to follow the wiki tutorial in the pyramid docs. It shows how to log users in from SQLAlchemy using the AuthTktAuthenticationPolicy which you can easily replace with the SessionAuthenticationPolicy if you deem it necessary.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top