def authenticate_direct_bind(self, username, password):
bind_user = '<STR_LIT>'.format(<EOL>rdn=self.config.get('<STR_LIT>'),<EOL>username=username,<EOL>user_search_dn=self.full_user_search_dn,<EOL>)<EOL>connection = self._make_connection(<EOL>bind_user=bind_user,<EOL>bind_password=password,<EOL>)<EOL>response = AuthenticationResponse()<EOL>try:<EOL><INDENT>connection.bind()<EOL>log.debug(<EOL>"<STR_LIT>".format(username))<EOL>response.status = AuthenticationResponseStatus.success<EOL>user_info = self.get_user_info(<EOL>dn=bind_user, _connection=connection)<EOL>response.user_dn = bind_user<EOL>response.user_id = username<EOL>response.user_info = user_info<EOL>if self.config.get('<STR_LIT>'):<EOL><INDENT>response.user_groups = self.get_user_groups(<EOL>dn=bind_user, _connection=connection)<EOL><DEDENT><DEDENT>except ldap3.core.exceptions.LDAPInvalidCredentialsResult:<EOL><INDENT>log.debug(<EOL>"<STR_LIT>".format(username))<EOL>response.status = AuthenticationResponseStatus.fail<EOL><DEDENT>except Exception as e:<EOL><INDENT>log.error(e)<EOL>response.status = AuthenticationResponseStatus.fail<EOL><DEDENT>self.destroy_connection(connection)<EOL>return response<EOL>
Performs a direct bind. We can do this since the RDN is the same
as the login attribute. Hence we just string together a dn to find
this user with.

Args:
    username (str): Username of the user to bind (the field specified
        as LDAP_BIND_RDN_ATTR)
    password (str): User's password to bind with.

Returns:
    AuthenticationResponse