Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

auth fails with error from ldap3 module #3

Open
XenGi opened this issue Oct 9, 2020 · 0 comments
Open

auth fails with error from ldap3 module #3

XenGi opened this issue Oct 9, 2020 · 0 comments

Comments

@XenGi
Copy link

XenGi commented Oct 9, 2020

Getting an error when I try to use it:

$ hug -f dns_proxy/__init__.py
Traceback (most recent call last):
  File "/home/xengi/.pyvenvs//dns-proxy/bin/hug", line 33, in <module>
    sys.exit(load_entry_point('hug', 'console_scripts', 'hug')())
  File "/home/xengi/.pyvenvs/dns-proxy/lib/python3.8/site-packages/hug/interface.py", line 650, in __call__
    raise exception
  File "/home/xengi/.pyvenvs/dns-proxy/lib/python3.8/site-packages/hug/interface.py", line 646, in __call__
    result = self.output(self.interface(**pass_to_function), context)
  File "/home/xengi/.pyvenvs/dns-proxy/lib/python3.8/site-packages/hug/interface.py", line 129, in __call__
    return __hug_internal_self._function(*args, **kwargs)
  File "/home/xengi/.pyvenvs/dns-proxy/lib/python3.8/site-packages/hug/development_runner.py", line 65, in hug
    api_module = importlib.machinery.SourceFileLoader(file.split(".")[0], file).load_module()
  File "<frozen importlib._bootstrap_external>", line 462, in _check_name_wrapper
  File "<frozen importlib._bootstrap_external>", line 962, in load_module
  File "<frozen importlib._bootstrap_external>", line 787, in load_module
  File "<frozen importlib._bootstrap>", line 265, in _load_module_shim
  File "<frozen importlib._bootstrap>", line 702, in _load
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "dns_proxy/__init__.py", line 10, in <module>
    import hug_authentication_ldap
  File "/home/xengi/.pyvenvs/dns-proxy/lib/python3.8/site-packages/hug_authentication_ldap/__init__.py", line 23, in <module>
    from hug_authentication_ldap.authentication import server, verify, basic
  File "/home/xengi/.pyvenvs/dns-proxy/lib/python3.8/site-packages/hug_authentication_ldap/authentication.py", line 35, in <module>
    def verify(server_instance, user_template="uid={user_name},ou=people", authentication=ldap3.AUTH_SIMPLE, auto_bind=True,
AttributeError: module 'ldap3' has no attribute 'AUTH_SIMPLE'

Example code:

import hug
import hug_authentication_ldap

authentication = hug_authentication_ldap.basic('ldaps://myldapserver.com:7636', 'uid={user_name},cn=users,dc=my,dc=domain,dc=com')

@hug.post('/cname/{cname}', requires=authentication)
def update_cname(cname: fqdn_type, fqdns: fqdn_list_type, user: hug.directives.user):
    """Update CNAME with list of allowed FQDNs (old list will be replaced with the given one)"""
    print(user)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant