对hug的基于ldap的身份验证支持
hug_authentication_ldap的Python项目详细描述
拥抱认证LDAP
为hug提供易于使用的基于ldap的身份验证支持:
importhugimporthug_authentication_ldapauthentication=hug_authentication_ldap.basic('myldap.server.net','uid={user_name},ou=people')@hug.get(requires=authentication)defsay_hello(hug_user):return'Hello {}!'.format(hug_user.name)
或者,对于hug中的通用可重用ldap密码验证:
importhugimporthug_authentication_ldapldap_check=hug_authentication_ldap.verify('myldap.server.net','uid={user_name},ou=people')@hug.get()defcheck(user_name,password):ifldap_check(user_name,password):returnTruereturnFalse
安装hug_authentication_ldap
安装hug_authentication_ldap非常简单:
pip3 install hug_authentication_ldap --upgrade
理想情况下,在虚拟环境中。
什么是hug_authentication_ldap?
hug的扩展,提供基于ldap的身份验证支持
谢谢,我希望你觉得拥抱认证有帮助
~timothy crosley