Python: get user from apache authnz_ldap

六眼飞鱼酱① 提交于 2019-12-13 15:05:08

问题


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.

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?


回答1:


To answer my own question: http://httpd.apache.org/docs/2.2/mod/mod_authnz_ldap.html#exposed

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.



来源:https://stackoverflow.com/questions/12325578/python-get-user-from-apache-authnz-ldap

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!