Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep session open #17

Open
Natim opened this issue Oct 19, 2016 · 6 comments
Open

Keep session open #17

Natim opened this issue Oct 19, 2016 · 6 comments

Comments

@Natim
Copy link

Natim commented Oct 19, 2016

Apparently the site is setup to remove the session cookie when the browser or page is closed. I wish it could stay open for 30 days.

@vincentfretin
Copy link
Contributor

Indeed, we use pyramid.session.SignedCookieSessionFactory, the session timeout is set up to 7h and reissue time is 1h. I can set the session timeout to 30 days and reissue time to 48 h for example, this should be enough.

@Natim
Copy link
Author

Natim commented Oct 19, 2016

Ok thanks a lot :)

@vincentfretin
Copy link
Contributor

The change is deployed.

vincentfretin added a commit that referenced this issue Oct 26, 2016
@vincentfretin vincentfretin reopened this Oct 26, 2016
@vincentfretin
Copy link
Contributor

The change I did was for the session cookie, not the auth_tkt cookie. The change didn't make sense for the session cookie, I reverted it.

I have to verify, but I think the auth_tkt cookie is set via the pyramid.authentication.AuthTktAuthenticationPolicy that is configured in the includeme of cache/eggs/substanced-1.0a1-py3.4.egg/substanced/sdi/init.py

authn_policy = AuthTktAuthenticationPolicy(secret, callback=groupfinder)
config.set_authentication_policy(authn_policy)

The cookie set is a Session cookie so is removed when you close your browser.
I need to override the authentication policy in the novaideo package with the following parameters hashalg='sha512', secure=True, max_age=30_24_3600, wild_domain=False I think.

@vincentfretin
Copy link
Contributor

I think we should do a "Remember me" checkbox on the login page, default not checked. When not checked, the authentication cookie last only during the session (this what we have today). When checked, we use a persistent cookie that last 30 days renewed every day. I think we need to have our own authentication policy to do this.
Thoughts?

@vincentfretin
Copy link
Contributor

https://pypi.python.org/pypi/pyramid-cubicweb seems to do what I have in mind. It uses pyramid_multiauth.MultiAuthenticationPolicy with 2 policies (modified version of AuthTktAuthenticationPolicy that add a persistent=True|False parameter to the remember method), one with a session cookie named auth_tkt, and another which set a persistent cookie named pauth_tkt. And in the login view, they do remember(persistent=True) to create the persistent cookie.
We need to do something equivalent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants