Skip to content

Comments

Implement Asynchronous Authenticate Method#285

Merged
etianen merged 5 commits intoetianen:masterfrom
CristopherH95:master
Jul 7, 2025
Merged

Implement Asynchronous Authenticate Method#285
etianen merged 5 commits intoetianen:masterfrom
CristopherH95:master

Conversation

@CristopherH95
Copy link
Contributor

This PR resolves #284. The primary changes are as follows:

  1. asgiref is added to the install_requires in setup.py. This is done because the sync_to_async and async_to_sync functions are provided from asgiref 2.0.0 onward. Django distributions with async support automatically install asgiref, so the vast majority of the time this dependency should already be available.
  2. A aauthenticate method is implemented in LDAPBackend, which runs a simple async wrapper around ldap.authenticate called run_authentication_async.
  3. Adds a test testAuthenticateAsyncRunner, which checks that run_authentication_async calls ldap.authenticate as expected.

@CristopherH95
Copy link
Contributor Author

@etianen looking into the failed check here, it looks like the problem may be related to versions of Python less than 3.9 not being available for the latest Ubuntu version (related issue I found: actions/setup-python#962). Should the action workflow be updated?

@CristopherH95
Copy link
Contributor Author

@etianen just wanted to follow up on this and see if you have any thoughts.

@etianen
Copy link
Owner

etianen commented Jul 1, 2025

I'm so sorry! I missed your comment from May! 😱

Please do update the matrix. Only supporting 3.9+ makes total sense. We can add in up to 3.13 in their place.

@CristopherH95
Copy link
Contributor Author

I'm so sorry! I missed your comment from May! 😱

Please do update the matrix. Only supporting 3.9+ makes total sense. We can add in up to 3.13 in their place.

No worries! Sounds good, I can work on adding that to the PR.

@CristopherH95 CristopherH95 marked this pull request as ready for review July 6, 2025 20:52
@CristopherH95
Copy link
Contributor Author

@etianen The matrix is updated with Python versions up to 3.12. There was a little trial-and-error on my part to get it working right, but it looks like all checks work as expected now. Let me know if there's anything else that should change!

@etianen etianen merged commit 0d8a9f8 into etianen:master Jul 7, 2025
10 checks passed
@etianen
Copy link
Owner

etianen commented Jul 7, 2025

Lovely job!

@etianen
Copy link
Owner

etianen commented Jul 7, 2025

Released as v0.16.0!

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

Successfully merging this pull request may close these issues.

Support Asynchronous Backend

2 participants