Skip to content
Open
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
10 changes: 2 additions & 8 deletions src/bluesky_httpserver/authenticators.py
Original file line number Diff line number Diff line change
Expand Up @@ -1011,14 +1011,8 @@ async def resolve_username(self, username_supplied_by_user):
def get_connection(self, userdn, password):
import ldap3

# NOTE: setting 'active=False' essentially disables exclusion of inactive servers from the pool.
# It probably does not matter if the pool contains only one server, but it could have implications
# when there are multiple servers in the pool. It is not clear what those implications are.
# But using the default 'activate=True' results in the thread being blocked indefinitely
# at the step of creating 'ldap3.Connection' regardless of timeouts in case all the servers are
# inactive (e.g. the pool has one server and it is unaccessible), which is unacceptable.
# Further investigation may be needed in the future.
server_pool = ldap3.ServerPool(None, ldap3.RANDOM, active=False)
# Try connecting to some server in the pool up to 3 times, before failing.
server_pool = ldap3.ServerPool(None, ldap3.RANDOM, active=3)
for address in self.server_address_list:
if re.search(r".+:\d+", address):
# Port is found in the address
Expand Down
Loading