为hug提供基于LDAP的身份验证支持
项目描述
hug_authentication_ldap
为hug提供易于使用的基于LDAP的身份验证支持
import hug
import hug_authentication_ldap
authentication = hug_authentication_ldap.basic('myldap.server.net', 'uid={user_name},ou=people')
@hug.get(requires=authentication)
def say_hello(hug_user):
return 'Hello {}!'.format(hug_user.name)
或者,为hug内部通用的可重用LDAP密码验证
import hug
import hug_authentication_ldap
ldap_check = hug_authentication_ldap.verify('myldap.server.net', 'uid={user_name},ou=people')
@hug.get()
def check(user_name, password):
if ldap_check(user_name, password):
return True
return False
安装hug_authentication_ldap
安装hug_authentication_ldap非常简单,就像
pip3 install hug_authentication_ldap --upgrade
理想情况下,在虚拟环境中。
什么是hug_authentication_ldap?
为hug提供基于LDAP的身份验证支持的扩展
感谢您,并希望您觉得hug_authentication_ldap有帮助!
~Timothy Crosley