Changes between Version 3 and Version 4 of MultipleAuthBackends


Ignore:
Timestamp:
Feb 27, 2006, 10:06:04 AM (19 years ago)
Author:
jkocherhans
Comment:

added response to Max Battcher's comments

Legend:

Unmodified
Added
Removed
Modified
  • MultipleAuthBackends

    v3 v4  
    8989
    9090== Suggestions ==
    91 It makes a lot of sense to store a cache of a user object as a django model, no matter what the authentication scheme, so it might very well be useful to just go ahead, reduce the Users models to its barest core, and I would add an (optional) Expiration date for automatic cache/culling (ie, always check the db first, then try everything else).  (It may even be useful to add Expiration dates to permissions/groups.)  I'm also thinking that many of the Credential types should just all be models in their own right with a Many-to-Many relationship with the base User class (a user could be very likely to have multiple Credentials, and there might be the occaisional need for "Group Credentials").  Once the subclassing system is in place, all of the Credential models should be subclasses of each other, probably, for good Pythonic OO-ness.  Probably most DB Credentials would want Expiration dates, too.  This would be a useful generic/easy system for those GET confirmation Credentials that people do.  Finally, keep in mind that not all Credentials will have a username/password combo.  GET Credentials will probably be some random string or hash.  OpenID Credentials are URLs (tied to remote server response signatures and remote server spam white/blacklists).  Making Credentials first-class models would help make it easier to remove most of the cases where a seperate User model might be necessary (ie, OpenID users could share the same base User model that Django users do, and someone can use the very same base model if they happen to use both). --Max Battcher
     91It makes a lot of sense to store a cache of a user object as a django model, no matter what the authentication scheme, so it might very well be useful to just go ahead, reduce the Users models to its barest core, and I would add an (optional) Expiration date for automatic cache/culling (ie, always check the db first, then try everything else).  (It may even be useful to add Expiration dates to permissions/groups.)  I'm also thinking that many of the Credential types should just all be models in their own right with a Many-to-Many relationship with the base User class (a user could be very likely to have multiple Credentials, and there might be the occaisional need for "Group Credentials"). Once the subclassing system is in place, all of the Credential models should be subclasses of each other, probably, for good Pythonic OO-ness.  Probably most DB Credentials would want Expiration dates, too.  This would be a useful generic/easy system for those GET confirmation Credentials that people do.  Finally, keep in mind that not all Credentials will have a username/password combo.  GET Credentials will probably be some random string or hash.  OpenID Credentials are URLs (tied to remote server response signatures and remote server spam white/blacklists).  Making Credentials first-class models would help make it easier to remove most of the cases where a seperate User model might be necessary (ie, OpenID users could share the same base User model that Django users do, and someone can use the very same base model if they happen to use both). --Max Battcher
     92
     93
     94
     95I agree that caching a Django user mode would generally be useful, and there should be an easy way to do it, but one shouldn't HAVE to do it. Also, if they do, they should be able to take advantage of memcached, etc. We shouldn't assume that the user is stored in the db.
     96
     97To me it doesn't make sense for credentials to be stored as a model... they are just a dict or string or object or whatever that get extracted/assembled from the request. You just pass to the auth backends for checking. The auth backend already persists them. The username/password combo isn't blessed. Credentials could just as well be an api key similar to backpack, or whatever.
     98
     99I think these abstractions allow for the use cases you mention, but the details certainly need to be worked out better. I explicitly want to ''avoid'' coupling this to django models, but it should ''easy'' to do so since it's most likely the default case. -- Joseph Kocherhans
     100
Back to Top