Closed amolinaalvarez closed 1 year ago
I recommend always just overriding and adding it to your configuration. In this case, I'm not sure whether you should/shouldn't, but I've used JWTAuthentication for awhile without issue with other auth methods.
There isn't a security concern with either approach, raising or not raising, so long as you unit test authentication using client
class in Django such that a user with a malformed JWT is not authorized to interact with the service.
I have configured my project using the
JWTAuthentication
along with others authentication schemes:However,
JWTAuthentication
always raises an exception if the authentication does not succeed, thus preventing other authentication schemes from being checked. Is there a way to configureJWTAuthentication
to returnNone
instead of raising an exception?A quick alternative would be to override the
JWTAuthentication
authenticate method, catching the exception and returningNone
:Would this alternative be recommended, or could it potentially lead to undesirable security issues?
Thank you in advance.