【发布时间】:2015-11-12 11:07:53
【问题描述】:
我在我的 Python-Django 应用程序中使用 Django Rest Framework,并为 api 使用自定义身份验证。
如果我只使用我的自定义身份验证方法,则可以正常工作。
@authentication_classes((CustomAuthentication, ))
但是,如果我尝试按顺序进行基本身份验证和自定义身份验证,我的自定义身份验证永远不会执行。我的意思是,如果基本身份验证失败,我希望尝试使用自定义身份验证。基本认证执行然后结束。
@authentication_classes((SessionAuthentication, BasicAuthentication, CustomAuthentication ))
是否可以同时拥有这三种认证方式,并按顺序执行?
【问题讨论】:
标签: django authentication django-rest-framework custom-authentication