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

conditionally set visit/login deadlines per login #266

Open
junbl opened this issue Jul 21, 2022 · 1 comment
Open

conditionally set visit/login deadlines per login #266

junbl opened this issue Jul 21, 2022 · 1 comment
Labels
A-identity Project: actix-identity C-feature Category: new functionality

Comments

@junbl
Copy link

junbl commented Jul 21, 2022

It's fairly common for login pages to have a "keep me logged in" option. I'd love a way to do this with actix_identity.

Maybe a Identity::login_with_deadline function that would overwrite any visit/login deadline set in IdentityMiddleware? This seems difficult with the current setup, but maybe fields for per-user deadlines could be added to Identity? Then the existing enabled flags could be replaced with Option<Duration> which is either a Copy of the Duration in IdentityMiddleware or a custom one, and that's what gets checked to see if a user should be logged out (not sure if that's even possible).

Probably easier would be to provide methods to access the visit/login_deadline_enabled fields on a given identity, but to achieve the "keep logged in functionality" you'd basically just have to choose between no deadline and a short auto-logout one (ideally we could keep a default deadline even if users choose to be kept logged in).

Would love to hear what others think!

@robjtede robjtede added A-identity Project: actix-identity C-feature Category: new functionality labels Jul 21, 2022
@robjtede robjtede changed the title [actix_identity] feature: A way to conditionally set visit/login deadlines per login conditionally set visit/login deadlines per login Jul 21, 2022
@junbl
Copy link
Author

junbl commented Jul 25, 2022

Just saw this session lifecycle method for SessionMiddleware. This seems perfect for this use case, if there's a way to set this per user login.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-identity Project: actix-identity C-feature Category: new functionality
Projects
None yet
Development

No branches or pull requests

2 participants