Skip to content

Commit

Permalink
Merge pull request #255 from consideRatio/pr/transition-to-async
Browse files Browse the repository at this point in the history
Transition to async functions and remove tornado dependency
  • Loading branch information
consideRatio authored Sep 15, 2024
2 parents d4a2e61 + 34ddf44 commit 9f9778b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
9 changes: 4 additions & 5 deletions ldapauthenticator/ldapauthenticator.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import ldap3
from jupyterhub.auth import Authenticator
from ldap3.utils.conv import escape_filter_chars
from tornado import gen
from traitlets import Bool, Int, List, Unicode, Union, validate


Expand Down Expand Up @@ -319,8 +318,7 @@ def get_user_attributes(self, conn, userdn):
attrs = conn.entries[0].entry_attributes_as_dict
return attrs

@gen.coroutine
def authenticate(self, handler, data):
async def authenticate(self, handler, data):
"""
Note: This function is really meant to identify a user, and
check_allowed and check_blocked are meant to determine if its an
Expand Down Expand Up @@ -455,6 +453,7 @@ def authenticate(self, handler, data):


if __name__ == "__main__":
import asyncio
import getpass

c = LDAPAuthenticator()
Expand All @@ -472,5 +471,5 @@ def authenticate(self, handler, data):
username = input("Username: ")
passwd = getpass.getpass()
data = dict(username=username, password=passwd)
rs = c.authenticate(None, data)
print(rs.result())
rs = asyncio.run(c.authenticate(None, data))
print(rs)
Empty file added scripts
Empty file.
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
install_requires=[
"jupyterhub>=4.1.6",
"ldap3",
"tornado",
"traitlets",
],
extras_require={
Expand Down

0 comments on commit 9f9778b

Please sign in to comment.