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

Transition to async functions and remove tornado dependency #255

Merged
merged 1 commit into from
Sep 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading