'Authenticates against the LDAP directory and returns the corresponding
User object if successful. Returns None on failure.'

def authenticate(self, password):

    user = None
    try:
        self._authenticate_user_dn(password)
        self._check_requirements()
        self._get_or_create_user()
        user = self._user
    except self.AuthenticationFailed as e:
        logger.debug((u'Authentication    failed    for    %s' % self._username))
    except ldap.LDAPError as e:
        logger.warning(u'Caught    LDAPError    while    authenticating    %s:    %s', self._username, pprint.pformat(e))
    except Exception:
        logger.exception(u'Caught    Exception    while    authenticating    %s', self._username)
        raise
    return user
