kumar303 / hawkrest

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

Default to True for USE_CACHE_FOR_HAWK_NONCE #2

Closed wolfgangmeyers closed 9 years ago

wolfgangmeyers commented 9 years ago

The existing code used the USE_CACHE_FOR_HAWK_NONCE setting without first checking that the setting was defined. For an application that has not defined the setting, an AttributeError is thrown in the construction of the receiver object, but subsequent middleware code allows the request flow to process normally. The usage documentation states:

"By default, Django uses in-memory caching so by default nonce checking will be activated".

This change supports the documented behavior by assigning a True value to this setting when authenticated if the setting has not been defined in the application.

kumar303 commented 9 years ago

You had some debugging code in this patch so I added the same thing over here: https://github.com/kumar303/hawkrest/commit/a72a2334daddc6b078d3a3107250f4fe0c3a4b56

Thanks for the patch!