Python:从apache authnz_ldap获取用户 [英] Python: get user from apache authnz_ldap
问题描述
我正在通过Apache2的authnz_ldap模块成功验证ldap用户.我不清楚他们登录后如何获取用户名,以便我可以通过以下任何表单/网页与他们进行交互.我已经尝试了典型的方式(os.getenv os.environ getpass等),但是它们要么只是给我www-data要么就没有结果.
I'm authenticating ldap users through Apache2's authnz_ldap module successfully. It is not clear to me how to fetch their username once they have logged in so that I can interact with them through any following forms/webpages. I've tried the typical ways (os.getenv os.environ getpass etc.) but they either just give me www-data or None result.
我怀疑我需要的东西可以在apache/ldap模块中找到,但是我可以使用一些帮助来寻找正确的路径.谁能指出我正确的方向?
I suspect what I need is available in either an apache/ldap module, but I could use some help to search down the correct path. Can anyone point me in the right direction?
推荐答案
要回答我自己的问题: http://httpd.apache.org/docs/2.2/mod/mod_authnz_ldap .html#exposed
To answer my own question: http://httpd.apache.org/docs/2.2/mod/mod_authnz_ldap.html#exposed
尽管没有记录环境密钥,但我扔出了一些可能的嫌疑人,并发现os.getenv('AUTHENTICATE_UID')
是获胜者.
Although the environment key was not documented, i threw in a few likely suspects and found that os.getenv('AUTHENTICATE_UID')
was the winner.
我希望这可以节省一些时间.
I hope this saves someone some time.
这篇关于Python:从apache authnz_ldap获取用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!