Easy to use LDAP based authentication support for hug:
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)
Or, for general reusable LDAP password verification within hug:
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
Installing hug_authentication_ldap is as simple as:
pip3 install hug_authentication_ldap --upgrade
Ideally, within a virtual environment.
An extension for hug that provides LDAP based authentication support
Thanks and I hope you find hug_authentication_ldap helpful!
~Timothy Crosley