middleware.py:
> session['authority.user'] = self.scheme.get_user()
I thought about only putting the user's name in the session, not a complete
user object. The user name can be used to recreate the user object
afterwards, it does not need to be pickled. Furthermore I think that some
objects (Elixir's database Entities come to mind) can not be pickled
without complications.
What about putting the user object in the environment?
--
Felix Schwarz
Dipl.-Informatiker
Gubener Str. 38
10243 Berlin
Germany
www.schwarz.eu - software development and consulting
Yes, when I said "user name" I actually meant a application/scheme defined
id which can be used to identify a user. How to generate that id is up to
the application.
Say you have employees (which are authenticated against the enterprise
LDAP) and customers (which are authenticated against a database) and both
user groups do only have a numeric id. IMHO it should be up to the
application to build an id string (e.g. prefix the id with "e" for
employees and "c" for customers) to identify one specific user.
What I named "application" in the paragraphs above, should be part of an
authentication scheme in authority, I think.
> As far as holding extremely complex objects in the session, my current
> plan for database users is to have the scheme.get_user() function, get
> the Elixir/SQLAlchemy/whatever object and return a AuthorityUser object,
> so complexity of that object should be greatly reduced, and should be
> manageable even for client-side storage.
Yes, this sounds quite reasonable. Maybe we could require that the scheme
does only put an id string into the session and puts the user object
somewhere in the environment.