jupyterhub / ldapauthenticator

LDAP Authenticator Plugin for Jupyter
BSD 3-Clause "New" or "Revised" License
206 stars 178 forks source link

`search_filter` config not documented in readme, and implemetation seems off #265

Closed consideRatio closed 2 months ago

consideRatio commented 2 months ago

The LDAPAuthenticator.search_filter config is available, but it looks a bit problematic. It has been around since #24. I'm listing four issues below.

Documentation

It has has a help string like below.

https://github.com/jupyterhub/ldapauthenticator/blob/686983c5cd3d9a96c7473bf245daa1e038b9d2af/ldapauthenticator/ldapauthenticator.py#L237-L239

Implementation

Its implementation looks like this in authenticate, after having authenticated/bound to auser recognized via provided username/password:

https://github.com/jupyterhub/ldapauthenticator/blob/686983c5cd3d9a96c7473bf245daa1e038b9d2af/ldapauthenticator/ldapauthenticator.py#L408-L429

Note that use of search_filter clearly constrains which users pass authentication, because it only leads to either no action or a warning -> return None. This can happen if a search with search_filter returned no matches, or if it returned multiple matches.

https://github.com/jupyterhub/ldapauthenticator/blob/686983c5cd3d9a96c7473bf245daa1e038b9d2af/ldapauthenticator/ldapauthenticator.py#L419-L422