kumar303 / hawkrest

Hawk HTTP Authorization for Django Rest Framework
BSD 3-Clause "New" or "Revised" License
19 stars 8 forks source link

Can I retrieve HAWK_CREDENTIALS from the DB. #1

Closed rexposadas closed 9 years ago

rexposadas commented 9 years ago

First, thanks for creating this Django package.

Second, the docs mentioned to include HAWK_CREDENTIALS in my settings file. Does the package support retrieving this dict from the database? My use-case is a long list of mobile devices authenticating to my API. The information for each device is kept in the DB and would be too many to be manually add in the settings file. A device would serve as a "user" who is allowed to used my API.

Thanks.

kumar303 commented 9 years ago

Hi. Current hawkrest does not support this. A good patch for this feature would probably be one that follows the Django convention of a callback, like:

HAWK_CREDENTIALS = 'import.path.to.callable'

where callable(id) would return a credentials dict or something like that. There is also a django function to resolve callable paths that you could use.

kumar303 commented 9 years ago

There is a patch in the works for this: https://github.com/kumar303/hawkrest/pull/5

kumar303 commented 9 years ago

This feature was added in https://github.com/kumar303/hawkrest/pull/5 and here's the documentation on it: http://hawkrest.readthedocs.org/en/latest/usage.html