Im正在开发小型intranet web服务。我想要在msad中通过kerberos对用户进行身份验证,或者使用basic auth。因此,我需要在响应401中设置两个“WWW Authenticate”http头。我怎么能用Django做呢?在
应该是这样的:
Client: GET www/index.html
Server: HTTP/1.1 401 Unauthorized
WWW-Authenticate: Negotiate
WWW-Authenticate: Basic realm="corp site"
此代码覆盖标头
^{pr2}$
我想中间件对于这个任务来说是最好的,但是如果您有其他想法,这里是中间件代码调整为适合您的视图(如果您决定这样做,您仍然可以很容易地将其转换为中间件):
相关问题 更多 >
编程相关推荐