Comments (4)
The purpose of the UserSession
model is to be able to keep track of all the sessions a user has running. A UserSession
instance itself does not represent a session, it is merely a pointer to an actual session. As it is not a session, it cannot replace the builtin Session
model. Note that the builtin Session
model is not at all aware of users, it is just a data payload pointed to by a session cookie, and there may or may not be a user attached to that session. The sessions
app itself is not aware of users at all. All in all, I do not see a way of unifying this.
Could you elaborate a bit on potential problems you see, especially curious about the "cleaner implementation" bit.
from django-allauth.
@pennersr Fair enough, I just often end up using django-user-sessions
which brings in a custom SessionEngine
linking User
to Session
.
It's just a cleaner implementation using the swappable session model rather than creating the extra UserSession
instance. Since Django allows for swapping in a different session backend, it seems like it would be cleaner to implement UserSession
as a better session backend (rather than creating extra writes to the DB and extra joins with the separate model).
From taking a quick look, a session backend really only requires that UserSession
inherits from AbstractBaseSession
and a SessionStore
model.
It also wouldn't need an additional middleware (just a single session middleware).
from django-allauth.
Whatever solution is chosen, it must be able to work with different session backends. Many projects use cache based sessions. So, the approach taken by django-user-sessions does not match our requirements. Also see:
jazzband/django-user-sessions#52
As for QSessions mentioned in that ticket, that one offers at least both db
and cache
as backends, but I really do think our current solution is as simple as it gets. It does not require adjustments to your regular sessions setup (e.g. no need to remove django.contrib.sessions
from INSTALLED_APPS
, no need to alter SESSION_ENGINE
).
from django-allauth.
Fair enough, perhaps it's just one of those unnecessary overrides that doesn't derive much in he way of specific value vs the approach here. This is definitely quite a bit simpler!
from django-allauth.
Related Issues (20)
- Get id_token for send to the URL logout keycloak
- Initial value for the SignUpForm
- what is `by_id()` replaced with? HOT 1
- Wrong 'da' translation of "Password Reset Email" /locale/da/LC_MESSAGES /django.po HOT 1
- Microsoft provider does not have extract_email_addresses function defined HOT 1
- TikTok provider needed HOT 5
- keep getting error retrieving access token for microsoft oauth and using 0.61.1 HOT 3
- About old version Document. HOT 1
- Password reset from key (email) issue - invalid link - solved HOT 2
- typo in `authentication_required` in headless RESTView HOT 1
- How to use my custom model instead of django user model?
- Closing -- see SOCIALACCOUNT_EMAIL_AUTHENTICATION. HOT 4
- Tests fail if `ACCOUNT_USER_MODEL_USERNAME_FIELD = None` HOT 2
- SAML username is generic HOT 4
- Temporarily disable MFA for a user HOT 4
- Doesn't support Android Credential Manager for Google login from Android HOT 4
- Does the MFA feature in django-allauth support FIDO passkeys? Or FIDO is simply handled by the chosen provider? HOT 1
- Is allauth open to including an (optional) honeypot field on registration? HOT 3
- Facebook Graph API v14 support HOT 1
- socialauth provider saml does not log OneLogin_Saml2_Error exceptions HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-allauth.