路过的Apache2摘要认证信息通过mod_wsgi的运行WSGI脚本 [英] Passing apache2 digest authentication information to a wsgi script run by mod_wsgi
本文介绍了路过的Apache2摘要认证信息通过mod_wsgi的运行WSGI脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经得到指令
<VirtualHost *>
<Location />
AuthType Digest
AuthName "global"
AuthDigestDomain /
AuthUserFile /root/apache_users
<Limit GET>
Require valid-user
</Limit>
</Location>
WSGIScriptAlias / /some/script.wsgi
WSGIDaemonProcess mywsgi user=someuser group=somegroup processes=2 threads=25
WSGIProcessGroup mywsgi
ServerName some.example.org
</VirtualHost>
我想在/some/script.wsgi知道
I'd like to know in the /some/script.wsgi
def application(environ, start_response):
start_response('200 OK', [
('Content-Type', 'text/plain'),
])
return ['Hello']
已登录的用户是什么
What user is logged in.
我该怎么办呢?
推荐答案
添加 WSGIPassAuthorization在
:
<VirtualHost *>
<Location />
AuthType Digest
AuthName "global"
AuthDigestDomain /
AuthUserFile /root/apache_users
<Limit GET>
Require valid-user
</Limit>
</Location>
WSGIPassAuthorization On
WSGIScriptAlias / /some/script.wsgi
WSGIDaemonProcess mywsgi user=someuser group=somegroup processes=2 threads=25
WSGIProcessGroup mywsgi
ServerName some.example.org
</VirtualHost>
然后,只需读 ENVIRON ['REMOTE_USER']
:
def application(environ, start_response):
start_response('200 OK', [
('Content-Type', 'text/plain'),
])
return ['Hello %s' % environ['REMOTE_USER']]
在 mod_wsgi的文档的更多信息。
这篇关于路过的Apache2摘要认证信息通过mod_wsgi的运行WSGI脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文