user3399495
user3399495

Reputation:

ldap3 bind syntax error in flask application

I am trying to validate username and password of users in a flask app using ldap3. Normal ldap is not installing in python 3.5.

The user is entering username and password through login form, I am trying to authenticate user with username / password and allow them to access the index page if it is authenticated.

Does the authentication return true of false so that I can redirect to next page based on outcome. The LDAP_PROVIDER_URL = "ldaps://appauth.corp.domain.com:636";

Please help me with the code for this. When I type appauth.corp.domain.com or corp.domain.com as HOST I get the following error

(r_web) C:\Users\dasa17\r_web\RosterWeb\RosterWeb>python Roster.py Traceback (most recent call last): File "Roster.py", line 10, in s = Server(appauth.corp.domain.com, port=636, get_info=ALL) NameError: name 'appauth' is not defined

(r_web) C:\Users\dasa17\r_web\RosterWeb\RosterWeb>python Roster.py Traceback (most recent call last): File "Roster.py", line 10, in s = Server(corp.domain.com, port=636, get_info=ALL) NameError: name 'corp' is not defined

I made some modifications , now I am able to run it by giving dummy username and password. However, I am getting a different error now.>>> c = Connection(s,user='dasa17',password='',check_names=True, lazy=False,raise_exceptions=False)

c.open() Traceback (most recent call last): File "", line 1, in c.open() File "C:\Python35\lib\site-packages\ldap3\strategy\sync.py", line 57, in open self.connection.refresh_server_info() File "C:\Python35\lib\site-packages\ldap3\core\connection.py", line 1017, in refresh_server_info self.server.get_info_from_server(self) File "C:\Python35\lib\site-packages\ldap3\core\server.py", line 382, in get_info_from_server self._get_dsa_info(connection) File "C:\Python35\lib\site-packages\ldap3\core\server.py", line 308, in _get_dsa_info get_operational_attributes=True) File "C:\Python35\lib\site-packages\ldap3\core\connection.py", line 571, in search response = self.post_send_search(self.send('searchRequest', request, controls)) File "C:\Python35\lib\site-packages\ldap3\strategy\sync.py", line 140, in post_send_search responses, result = self.get_response(message_id) File "C:\Python35\lib\site-packages\ldap3\strategy\base.py", line 298, in get_response responses = self._get_response(message_id) File "C:\Python35\lib\site-packages\ldap3\strategy\sync.py", line 158, in _get_response responses = self.receiving() File "C:\Python35\lib\site-packages\ldap3\strategy\sync.py", line 92, in receiving raise communication_exception_factory(LDAPSocketReceiveError, exc) (self.connection.last_error) ldap3.core.exceptions.LDAPSocketReceiveError: error receiving data: [WinError 10054] An existing connection was forcibly closed by the remote host

Upvotes: 0

Views: 1332

Answers (1)

user3399495
user3399495

Reputation:

I got this sorted out . Perhaps because I had set raise_exceptions=True, Setting it to False resolved the issue

Upvotes: 0

Related Questions